ParserTests: allow test of precedence between interwiki links and namespaces
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 #
30 # You can also set the following parser properties via test options:
31 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
32 # wgLinkHolderBatchSize, wgRawHtml
33 #
34 # For testing purposes, temporary articles can created:
35 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
36 # where '/' denotes a newline.
37
38 # This is the standard article assumed to exist.
39 !! article
40 Main Page
41 !! text
42 blah blah
43 !! endarticle
44
45 !!article
46 Template:Foo
47 !!text
48 FOO
49 !!endarticle
50
51 !! article
52 Template:Blank
53 !! text
54 !! endarticle
55
56 !! article
57 Template:pipe
58 !! text
59 |
60 !! endarticle
61
62 !!article
63 MediaWiki:bad image list
64 !!text
65 * [[File:Bad.jpg]] except [[Nasty page]]
66 !!endarticle
67
68 !! article
69 Template:inner list
70 !! text
71 * item 1
72 !! endarticle
73
74 !! article
75 Template:tbl-start
76 !! text
77 {|
78 !! endarticle
79
80 !! article
81 Template:tbl-end
82 !! text
83 |}
84 !! endarticle
85
86 !! article
87 Template:!
88 !! text
89 |
90 !! endarticle
91
92 !! article
93 Template:echo
94 !! text
95 {{{1}}}
96 !! endarticle
97
98 !! article
99 Template:echo_with_span
100 !! text
101 <span>{{{1}}}</span>
102 !! endarticle
103
104 !! article
105 Template:echo_with_div
106 !! text
107 <div>{{{1}}}</div>
108 !! endarticle
109
110 !! article
111 Template:attr_str
112 !! text
113 {{{1}}}="{{{2}}}"
114 !! endarticle
115
116 !! article
117 Template:table_attribs
118 !! text
119 <noinclude>
120 |</noinclude>style="color: red"| Foo
121 !! endarticle
122
123 !! article
124 Template:table_cells
125 !! text
126 {{table_attribs}} || Bar || Baz
127 !! endarticle
128
129 !! article
130 Template:image_attribs
131 !! text
132 <noinclude>
133 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
134 !! endarticle
135
136 !! article
137 A?b
138 !! text
139 Weirdo titles!
140 !! endarticle
141
142 !!article
143 Template:Bullet
144 !!text
145 * Bar
146 !!endarticle
147
148 ###
149 ### Basic tests
150 ###
151 !! test
152 Blank input
153 !! input
154 !! result
155 !! end
156
157
158 !! test
159 Simple paragraph
160 !! input
161 This is a simple paragraph.
162 !! result
163 <p>This is a simple paragraph.
164 </p>
165 !! end
166
167 !! test
168 Paragraphs with extra newline spacing
169 !! input
170 foo
171
172 bar
173
174
175 baz
176
177
178
179 booz
180 !! result
181 <p>foo
182 </p><p>bar
183 </p><p><br />
184 baz
185 </p><p><br />
186 </p><p>booz
187 </p>
188 !! end
189
190 !! test
191 Paragraphs with newline spacing with comment lines in between
192 !! input
193 ----
194 a
195 <!--foo-->
196 b
197 ----
198 a
199 <!--foo--><!--More than 1 comment, still stripped-->
200 b
201 ----
202 a
203 <!--foo--> <!----> <!-- bar -->
204 b
205 ----
206 a
207 <!--foo-->
208
209 b
210 ----
211 a
212
213 <!--foo-->
214 b
215 ----
216 a
217 <!--foo-->
218
219
220 b
221 ----
222 a
223
224
225 <!--foo-->
226 b
227 ----
228 !! result
229 <hr />
230 <p>a
231 b
232 </p>
233 <hr />
234 <p>a
235 b
236 </p>
237 <hr />
238 <p>a
239 b
240 </p>
241 <hr />
242 <p>a
243 </p><p>b
244 </p>
245 <hr />
246 <p>a
247 </p><p>b
248 </p>
249 <hr />
250 <p>a
251 </p><p><br />
252 b
253 </p>
254 <hr />
255 <p>a
256 </p><p><br />
257 b
258 </p>
259 <hr />
260
261 !! end
262
263 !! test
264 Paragraphs with newline spacing with non-empty white-space lines in between
265 !! input
266 ----
267 a
268
269 b
270 ----
271 a
272
273
274 b
275 ----
276 !! result
277 <hr />
278 <p>a
279 </p><p>b
280 </p>
281 <hr />
282 <p>a
283 </p><p><br />
284 b
285 </p>
286 <hr />
287
288 !! end
289
290 !! test
291 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
292 !! input
293 ----
294 a
295 <!--foo-->
296 b
297 ----
298 a
299 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
300 b
301 ----
302 a
303
304 <!--foo-->
305 <!--bar-->
306 b
307 ----
308 a
309
310 <!--foo-->
311 <!--bar-->
312
313 b
314 ----
315 !! result
316 <hr />
317 <p>a
318 b
319 </p>
320 <hr />
321 <p>a
322 b
323 </p>
324 <hr />
325 <p>a
326 </p><p>b
327 </p>
328 <hr />
329 <p>a
330 </p><p><br />
331 b
332 </p>
333 <hr />
334
335 !! end
336
337 !! test
338 Extra newlines: More paragraphs with indented comment
339 !! input
340 a
341
342 <!--boo-->
343
344 b
345 !!result
346 <p>a
347 </p><p><br />
348 b
349 </p>
350 !!end
351
352 !! test
353 Extra newlines followed by heading
354 !! input
355 a
356
357
358
359 =b=
360 [[a]]
361
362
363 =b=
364 !! result
365 <p>a
366 </p><p><br />
367 </p>
368 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
369 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
370 </p><p><br />
371 </p>
372 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
373
374 !! end
375
376 !! test
377 Extra newlines between heading and content are swallowed
378 !! input
379 =b=
380
381
382
383 [[a]]
384 !! result
385 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
386 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
387 </p>
388 !! end
389
390 !! test
391 Parsing an URL
392 !! input
393 http://fr.wikipedia.org/wiki/🍺
394 <!-- EasterEgg we love beer, better be able be able to link to it -->
395 !! result
396 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
397 </p>
398 !! end
399
400 !! test
401 Simple list
402 !! input
403 * Item 1
404 * Item 2
405 !! result
406 <ul><li> Item 1
407 </li><li> Item 2
408 </li></ul>
409
410 !! end
411
412 !! test
413 Italics and bold
414 !! input
415 * plain
416 * plain''italic''plain
417 * plain''italic''plain''italic''plain
418 * plain'''bold'''plain
419 * plain'''bold'''plain'''bold'''plain
420 * plain''italic''plain'''bold'''plain
421 * plain'''bold'''plain''italic''plain
422 * plain''italic'''bold-italic'''italic''plain
423 * plain'''bold''bold-italic''bold'''plain
424 * plain'''''bold-italic'''italic''plain
425 * plain'''''bold-italic''bold'''plain
426 * plain''italic'''bold-italic'''''plain
427 * plain'''bold''bold-italic'''''plain
428 * plain l'''italic''plain
429 * plain l''''bold''' plain
430 !! result
431 <ul><li> plain
432 </li><li> plain<i>italic</i>plain
433 </li><li> plain<i>italic</i>plain<i>italic</i>plain
434 </li><li> plain<b>bold</b>plain
435 </li><li> plain<b>bold</b>plain<b>bold</b>plain
436 </li><li> plain<i>italic</i>plain<b>bold</b>plain
437 </li><li> plain<b>bold</b>plain<i>italic</i>plain
438 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
439 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
440 </li><li> plain<i><b>bold-italic</b>italic</i>plain
441 </li><li> plain<b><i>bold-italic</i>bold</b>plain
442 </li><li> plain<i>italic<b>bold-italic</b></i>plain
443 </li><li> plain<b>bold<i>bold-italic</i></b>plain
444 </li><li> plain l'<i>italic</i>plain
445 </li><li> plain l'<b>bold</b> plain
446 </li></ul>
447
448 !! end
449
450 # this example taken from the [[simple:Moon]] article (bug 47326)
451 !! test
452 Italics and possessives (1)
453 !! input
454 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
455 !! result
456 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
457 </p>
458 !! end
459
460 # this example taken from [[en:Flaming Pie]] (bug 49926)
461 !! test
462 Italics and possessives (2)
463 !! input
464 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
465 !! result
466 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
467 </p>
468 !! end
469
470 # this example taken from [[en:Dictionary]] (bug 49926)
471 !! test
472 Italics and possessives (3)
473 !! input
474 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
475 !! result
476 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
477 </p>
478 !! end
479
480
481 ###
482 ### 2-quote opening sequence tests
483 ###
484 !! test
485 Italics and bold: 2-quote opening sequence: (2,2)
486 !! input
487 ''foo''
488 !! result
489 <p><i>foo</i>
490 </p>
491 !!end
492
493
494 !! test
495 Italics and bold: 2-quote opening sequence: (2,3)
496 !! input
497 ''foo'''
498 !! result
499 <p><i>foo'</i>
500 </p>
501 !!end
502
503
504 !! test
505 Italics and bold: 2-quote opening sequence: (2,4)
506 !! input
507 ''foo''''
508 !! result
509 <p><i>foo''</i>
510 </p>
511 !!end
512
513
514 !! test
515 Italics and bold: 2-quote opening sequence: (2,5) (php)
516 !! options
517 php
518 !! input
519 ''foo'''''
520 !! result
521 <p><i>foo</i>
522 </p>
523 !!end
524 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
525 !! test
526 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
527 !! options
528 parsoid
529 !! input
530 ''foo'''''
531 !! result
532 <p><i>foo</i><b></b>
533 </p>
534 !!end
535
536
537 ###
538 ### 3-quote opening sequence tests
539 ###
540
541 !! test
542 Italics and bold: 3-quote opening sequence: (3,2)
543 !! input
544 '''foo''
545 !! result
546 <p>'<i>foo</i>
547 </p>
548 !!end
549
550
551 !! test
552 Italics and bold: 3-quote opening sequence: (3,3)
553 !! input
554 '''foo'''
555 !! result
556 <p><b>foo</b>
557 </p>
558 !!end
559
560
561 !! test
562 Italics and bold: 3-quote opening sequence: (3,4)
563 !! input
564 '''foo''''
565 !! result
566 <p><b>foo'</b>
567 </p>
568 !!end
569
570
571 !! test
572 Italics and bold: 3-quote opening sequence: (3,5) (php)
573 !! options
574 php
575 !! input
576 '''foo'''''
577 !! result
578 <p><b>foo</b>
579 </p>
580 !!end
581 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
582 !! test
583 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
584 !! options
585 parsoid
586 !! input
587 '''foo'''''
588 !! result
589 <p><b>foo</b><i></i>
590 </p>
591 !!end
592
593
594 ###
595 ### 4-quote opening sequence tests
596 ###
597
598 !! test
599 Italics and bold: 4-quote opening sequence: (4,2)
600 !! input
601 ''''foo''
602 !! result
603 <p>''<i>foo</i>
604 </p>
605 !!end
606
607
608 !! test
609 Italics and bold: 4-quote opening sequence: (4,3)
610 !! input
611 ''''foo'''
612 !! result
613 <p>'<b>foo</b>
614 </p>
615 !!end
616
617
618 !! test
619 Italics and bold: 4-quote opening sequence: (4,4)
620 !! input
621 ''''foo''''
622 !! result
623 <p>'<b>foo'</b>
624 </p>
625 !!end
626
627
628 !! test
629 Italics and bold: 4-quote opening sequence: (4,5) (php)
630 !! options
631 php
632 !! input
633 ''''foo'''''
634 !! result
635 <p>'<b>foo</b>
636 </p>
637 !!end
638 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
639 !! test
640 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
641 !! options
642 parsoid
643 !! input
644 ''''foo'''''
645 !! result
646 <p>'<b>foo</b><i></i>
647 </p>
648 !!end
649
650
651 ###
652 ### 5-quote opening sequence tests
653 ###
654
655 !! test
656 Italics and bold: 5-quote opening sequence: (5,2)
657 !! options
658 !! input
659 '''''foo''
660 !! result
661 <p><b><i>foo</i></b>
662 </p>
663 !!end
664
665
666 !! test
667 Italics and bold: 5-quote opening sequence: (5,3)
668 !! input
669 '''''foo'''
670 !! result
671 <p><i><b>foo</b></i>
672 </p>
673 !!end
674
675
676 !! test
677 Italics and bold: 5-quote opening sequence: (5,4)
678 !! input
679 '''''foo''''
680 !! result
681 <p><i><b>foo'</b></i>
682 </p>
683 !!end
684
685
686 !! test
687 Italics and bold: 5-quote opening sequence: (5,5)
688 !! input
689 '''''foo'''''
690 !! result
691 <p><i><b>foo</b></i>
692 </p>
693 !!end
694
695 ###
696 ### multiple quote sequences in a line
697 ###
698 !! test
699 Italics and bold: multiple quote sequences: (2,4,2)
700 !! input
701 ''foo''''bar''
702 !! result
703 <p><i>foo'<b>bar</b></i>
704 </p>
705 !!end
706
707
708 !! test
709 Italics and bold: multiple quote sequences: (2,4,3)
710 !! input
711 ''foo''''bar'''
712 !! result
713 <p><i>foo'<b>bar</b></i>
714 </p>
715 !!end
716
717
718 !! test
719 Italics and bold: multiple quote sequences: (2,4,4)
720 !! input
721 ''foo''''bar''''
722 !! result
723 <p><i>foo'<b>bar'</b></i>
724 </p>
725 !!end
726
727
728 !! test
729 Italics and bold: multiple quote sequences: (3,4,2) (php)
730 !! options
731 php
732 !! input
733 '''foo''''bar''
734 !! result
735 <p><b>foo'</b>bar
736 </p>
737 !!end
738 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
739 !! test
740 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
741 !! options
742 parsoid
743 !! input
744 '''foo''''bar''
745 !! result
746 <p><b>foo'</b>bar<i></i>
747 </p>
748 !!end
749
750
751 !! test
752 Italics and bold: multiple quote sequences: (3,4,3) (php)
753 !! options
754 php
755 !! input
756 '''foo''''bar'''
757 !! result
758 <p><b>foo'</b>bar
759 </p>
760 !!end
761 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
762 !! test
763 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
764 !! options
765 parsoid
766 !! input
767 '''foo''''bar'''
768 !! result
769 <p><b>foo'</b>bar<b></b>
770 </p>
771 !!end
772
773 ###
774 ### other quote tests
775 ###
776 !! test
777 Italics and bold: other quote tests: (2,3,5)
778 !! input
779 ''this is about '''foo's family'''''
780 !! result
781 <p><i>this is about <b>foo's family</b></i>
782 </p>
783 !!end
784
785
786 !! test
787 Italics and bold: other quote tests: (2,(3,3),2)
788 !! input
789 ''this is about '''foo's''' family''
790 !! result
791 <p><i>this is about <b>foo's</b> family</i>
792 </p>
793 !!end
794
795
796 !! test
797 Italics and bold: other quote tests: (3,2,3,2)
798 !! input
799 '''this is about ''foo'''s family''
800 !! result
801 <p><b>this is about <i>foo</i></b><i>s family</i>
802 </p>
803 !!end
804
805
806 !! test
807 Italics and bold: other quote tests: (3,2,3,3)
808 !! options
809 !! input
810 '''this is about ''foo'''s family'''
811 !! result
812 <p>'<i>this is about </i>foo<b>s family</b>
813 </p>
814 !!end
815
816
817 !! test
818 Italics and bold: other quote tests: (3,(2,2),3)
819 !! input
820 '''this is about ''foo's'' family'''
821 !! result
822 <p><b>this is about <i>foo's</i> family</b>
823 </p>
824 !!end
825
826
827 !! test
828 Italicized possessive
829 !! input
830 The ''[[Main Page]]'''s talk page.
831 !! result
832 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
833 </p>
834 !! end
835
836 !! test
837 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
838 (Requires tidy for PHP parser output to be fixed up)
839 !! options
840 parsoid=wt2html,wt2wt
841 !! input
842 {|
843 !''a!!''b
844 |''a||''b
845 |}
846 !! result
847 <table>
848 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
849 <td><i>a</i></td><td><i>b</i></td></tr>
850 </tbody></table>
851 !! end
852
853 ###
854 ### Non-html5 tags
855 ###
856
857 !! test
858 Non-html5 tags should be accepted
859 !! input
860 <center>''foo''</center>
861 <big>''foo''</big>
862 <font>''foo''</font>
863 <strike>''foo''</strike>
864 <tt>''foo''</tt>
865 !! result
866 <center><i>foo</i></center>
867 <p><big><i>foo</i></big>
868 <font><i>foo</i></font>
869 <strike><i>foo</i></strike>
870 <tt><i>foo</i></tt>
871 </p>
872 !! end
873
874 !! test
875 <wbr> is valid wikitext (bug 52468)
876 !! input
877 <wbr>
878 !! result
879 <p><wbr />
880 </p>
881 !! end
882
883 # <strike> is HTML4, <s> is HTML4/5.
884 !! test
885 <s> or <strike> for strikethrough
886 !! input
887 <strike>strike</strike>
888
889 <s>s</s>
890 !! result
891 <p><strike>strike</strike>
892 </p><p><s>s</s>
893 </p>
894 !! end
895
896 !! test
897 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
898 !! input
899 <b→> doesn't work! </b>
900
901 <bä> doesn't work! </b>
902
903 <boo> works fine </b>
904
905 <s.foo>foo</s>
906
907 <s.foo>s.foo</s.foo>
908
909 <sub-ID#1>
910 !! result
911 <p>&lt;b→&gt; doesn't work! &lt;/b&gt;
912 </p><p>&lt;bä&gt; doesn't work! &lt;/b&gt;
913 </p><p>&lt;boo&gt; works fine &lt;/b&gt;
914 </p><p>&lt;s.foo&gt;foo&lt;/s&gt;
915 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
916 </p><p>&lt;sub-ID#1&gt;
917 </p>
918 !! end
919
920 ###
921 ### Special characters
922 ###
923
924 !! test
925 Bare pipe character (bug 52363)
926 !! input
927 |
928 !! result
929 <p>|
930 </p>
931 !! end
932
933 !! test
934 Bare pipe character from a template (bug 52363)
935 !! input
936 {{pipe}}
937 !! result
938 <p>|
939 </p>
940 !! end
941
942 ###
943 ### <nowiki> test cases
944 ###
945
946 !! test
947 <nowiki> unordered list
948 !! input
949 <nowiki>* This is not an unordered list item.</nowiki>
950 !! result
951 <p>* This is not an unordered list item.
952 </p>
953 !! end
954
955 !! test
956 <nowiki> spacing
957 !! input
958 <nowiki>Lorem ipsum dolor
959
960 sed abit.
961 sed nullum.
962
963 :and a colon
964 </nowiki>
965 !! result
966 <p>Lorem ipsum dolor
967
968 sed abit.
969 sed nullum.
970
971 :and a colon
972
973 </p>
974 !! end
975
976 !! test
977 nowiki 3
978 !! input
979 :There is not nowiki.
980 :There is <nowiki>nowiki</nowiki>.
981
982 #There is not nowiki.
983 #There is <nowiki>nowiki</nowiki>.
984
985 *There is not nowiki.
986 *There is <nowiki>nowiki</nowiki>.
987 !! result
988 <dl><dd>There is not nowiki.
989 </dd><dd>There is nowiki.
990 </dd></dl>
991 <ol><li>There is not nowiki.
992 </li><li>There is nowiki.
993 </li></ol>
994 <ul><li>There is not nowiki.
995 </li><li>There is nowiki.
996 </li></ul>
997
998 !! end
999
1000 !! test
1001 Entities inside <nowiki>
1002 !! input
1003 <nowiki>&lt;</nowiki>
1004 !! result
1005 <p>&lt;
1006 </p>
1007 !! end
1008
1009 !! test
1010 Entities inside template parameters
1011 !! options
1012 parsoid
1013 !! input
1014 {{echo|&ndash;}}
1015 !! result
1016 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span>
1017 </p>
1018 !! end
1019
1020 ###
1021 ### Comments
1022 ###
1023 !! test
1024 Comments and Indent-Pre
1025 !! input
1026 <!-- comment 1 --> asdf
1027
1028 <!-- comment 1 --> asdf
1029 <!-- comment 2 -->
1030
1031 <!-- comment 1 --> asdf
1032 <!-- comment 2 -->xyz
1033
1034 <!-- comment 1 --> asdf
1035 <!-- comment 2 --> xyz
1036 !! result
1037 <pre>asdf
1038 </pre>
1039 <pre>asdf
1040 </pre>
1041 <pre>asdf
1042 </pre>
1043 <p>xyz
1044 </p>
1045 <pre>asdf
1046 xyz
1047 </pre>
1048 !! end
1049
1050 !! test
1051 Comment test 2a
1052 !! input
1053 asdf
1054 <!-- comment 1 -->
1055 jkl
1056 !! result
1057 <p>asdf
1058 jkl
1059 </p>
1060 !! end
1061
1062 !! test
1063 Comment test 2b
1064 !! input
1065 asdf
1066 <!-- comment 1 -->
1067
1068 jkl
1069 !! result
1070 <p>asdf
1071 </p><p>jkl
1072 </p>
1073 !! end
1074
1075 !! test
1076 Comment test 3
1077 !! input
1078 asdf
1079 <!-- comment 1 -->
1080 <!-- comment 2 -->
1081 jkl
1082 !! result
1083 <p>asdf
1084 jkl
1085 </p>
1086 !! end
1087
1088 !! test
1089 Comment test 4
1090 !! input
1091 asdf<!-- comment 1 -->jkl
1092 !! result
1093 <p>asdfjkl
1094 </p>
1095 !! end
1096
1097 !! test
1098 Comment spacing
1099 !! input
1100 a
1101 <!-- foo --> b <!-- bar -->
1102 c
1103 !! result
1104 <p>a
1105 </p>
1106 <pre> b
1107 </pre>
1108 <p>c
1109 </p>
1110 !! end
1111
1112 !! test
1113 Comment whitespace
1114 !! input
1115 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1116 !! result
1117
1118 !! end
1119
1120 !! test
1121 Comment semantics and delimiters
1122 !! input
1123 <!-- --><!----><!-----><!------>
1124 !! result
1125
1126 !! end
1127
1128 !! test
1129 Comment semantics and delimiters, redux
1130 !! input
1131 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1132 -- foo -- funky huh? ... -->
1133 !! result
1134
1135 !! end
1136
1137 !! test
1138 Comment semantics and delimiters: directors cut
1139 !! input
1140 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1141 everything starting with < followed by !-- until the first -- and > we see,
1142 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1143 -->-->
1144 !! result
1145 <p>--&gt;
1146 </p>
1147 !! end
1148
1149 !! test
1150 Comment semantics: nesting
1151 !! input
1152 <!--<!-- no, we're not going to do anything fancy here -->-->
1153 !! result
1154 <p>--&gt;
1155 </p>
1156 !! end
1157
1158 !! test
1159 Comment semantics: unclosed comment at end
1160 !! input
1161 <!--This comment will run out to the end of the document
1162 !! result
1163
1164 !! end
1165
1166 !! test
1167 Comment in template title
1168 !! input
1169 {{f<!---->oo}}
1170 !! result
1171 <p>FOO
1172 </p>
1173 !! end
1174
1175 !! test
1176 Comment on its own line post-expand
1177 !! input
1178 a
1179 {{blank}}<!---->
1180 b
1181 !! result
1182 <p>a
1183 </p><p>b
1184 </p>
1185 !! end
1186
1187 !! test
1188 Comment on its own line post-expand with non-significant whitespace
1189 !! input
1190 a
1191 {{blank}} <!---->
1192 b
1193 !! result
1194 <p>a
1195 </p><p>b
1196 </p>
1197 !! end
1198
1199 ###
1200 ### paragraph wrapping tests
1201 ###
1202 !! test
1203 No block tags
1204 !! input
1205 a
1206
1207 b
1208 !! result
1209 <p>a
1210 </p><p>b
1211 </p>
1212 !! end
1213
1214 !! test
1215 Block tag on one line (<div>)
1216 !! input
1217 a <div>foo</div>
1218
1219 b
1220 !! result
1221 a <div>foo</div>
1222 <p>b
1223 </p>
1224 !! end
1225
1226 !! test
1227 Block tag on one line (<blockquote>)
1228 !! input
1229 a <blockquote>foo</blockquote>
1230
1231 b
1232 !! result
1233 a <blockquote>foo</blockquote>
1234 <p>b
1235 </p>
1236 !! end
1237
1238 !! test
1239 Block tag on both lines (<div>)
1240 !! input
1241 a <div>foo</div>
1242
1243 b <div>foo</div>
1244 !! result
1245 a <div>foo</div>
1246 b <div>foo</div>
1247
1248 !! end
1249
1250 !! test
1251 Block tag on both lines (<blockquote>)
1252 !! input
1253 a <blockquote>foo</blockquote>
1254
1255 b <blockquote>foo</blockquote>
1256 !! result
1257 a <blockquote>foo</blockquote>
1258 b <blockquote>foo</blockquote>
1259
1260 !! end
1261
1262 !! test
1263 Multiple lines without block tags
1264 !! input
1265 <div>foo</div> a
1266 b
1267 c
1268 d<!--foo--> e
1269 x <div>foo</div> z
1270 !! result
1271 <div>foo</div> a
1272 <p>b
1273 c
1274 d e
1275 </p>
1276 x <div>foo</div> z
1277
1278 !! end
1279
1280 !! test
1281 Empty lines between lines with block tags
1282 !! input
1283 <div></div>
1284
1285
1286 <div></div>a
1287
1288 b
1289 <div>a</div>b
1290
1291 <div>b</div>d
1292
1293
1294 <div>e</div>
1295 !! result
1296 <div></div>
1297 <p><br />
1298 </p>
1299 <div></div>a
1300 <p>b
1301 </p>
1302 <div>a</div>b
1303 <div>b</div>d
1304 <p><br />
1305 </p>
1306 <div>e</div>
1307
1308 !! end
1309
1310 ###
1311 ### Preformatted text
1312 ###
1313 !! test
1314 Preformatted text
1315 !! input
1316 This is some
1317 Preformatted text
1318 With ''italic''
1319 And '''bold'''
1320 And a [[Main Page|link]]
1321 !! result
1322 <pre>This is some
1323 Preformatted text
1324 With <i>italic</i>
1325 And <b>bold</b>
1326 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1327 </pre>
1328 !! end
1329
1330 !! test
1331 Tabs don't trigger preformatted text
1332 !! input
1333 This is not
1334 preformatted text.
1335 This is preformatted text.
1336 So is this.
1337 !! result
1338 <p> This is not
1339 preformatted text.
1340 </p>
1341 <pre>This is preformatted text.
1342 So is this.
1343 </pre>
1344 !! end
1345
1346 !! test
1347 Ident preformatting with inline content
1348 !! input
1349 a
1350 ''b''
1351 !! result
1352 <pre>a
1353 <i>b</i>
1354 </pre>
1355 !! end
1356
1357 !! test
1358 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1359 !! input
1360 <pre><nowiki>
1361 <b>
1362 <cite>
1363 <em>
1364 </nowiki></pre>
1365 !! result
1366 <pre>
1367 &lt;b&gt;
1368 &lt;cite&gt;
1369 &lt;em&gt;
1370 </pre>
1371
1372 !! end
1373
1374 !! test
1375 Regression with preformatted in <center>
1376 !! input
1377 <center>
1378 Blah
1379 </center>
1380 !! result
1381 <center>
1382 <pre>Blah
1383 </pre>
1384 </center>
1385
1386 !! end
1387
1388 !! test
1389 Bug 52763: Preformatted in <blockquote>
1390 !! input
1391 <blockquote>
1392 Blah
1393 </blockquote>
1394 !! result
1395 <blockquote>
1396 <p> Blah
1397 </p>
1398 </blockquote>
1399
1400 !! end
1401
1402 !! test
1403 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1404 !! input
1405 <blockquote>
1406 Foo
1407
1408 Bar
1409 </blockquote>
1410 !! result
1411 <blockquote>
1412 <p>Foo
1413 </p><p>Bar
1414 </p>
1415 </blockquote>
1416
1417 !! end
1418
1419 !! test
1420 Bug 15491: <ins>/<del> in blockquote
1421 !! input
1422 <blockquote>
1423 Foo <del>bar</del> <ins>baz</ins> quux
1424 </blockquote>
1425 !! result
1426 <blockquote>
1427 <p>Foo <del>bar</del> <ins>baz</ins> quux
1428 </p>
1429 </blockquote>
1430
1431 !! end
1432
1433 # Note that the p-wrapping is newline sensitive, which could be
1434 # considered a bug: tidy will wrap only the 'Foo' in the example
1435 # below in a <p> tag. (see comment 23-25 of bug #6200)
1436 !! test
1437 Bug 15491: <ins>/<del> in blockquote (2)
1438 !! input
1439 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1440 </blockquote>
1441 !! result
1442 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1443 </blockquote>
1444
1445 !! end
1446
1447 !! test
1448 <pre> with attributes (bug 3202)
1449 !! input
1450 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1451 !! result
1452 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1453
1454 !! end
1455
1456 !! test
1457 <pre> with width attribute (bug 3202)
1458 !! input
1459 <pre width="8">Narrow screen goodies</pre>
1460 !! result
1461 <pre width="8">Narrow screen goodies</pre>
1462
1463 !! end
1464
1465 !! test
1466 <pre> with forbidden attribute (bug 3202)
1467 !! input
1468 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1469 !! result
1470 <pre width="8">Narrow screen goodies</pre>
1471
1472 !! end
1473
1474 !! test
1475 Entities inside <pre>
1476 !! input
1477 <pre>&lt;</pre>
1478 !! result
1479 <pre>&lt;</pre>
1480
1481 !! end
1482
1483 !! test
1484 <pre> with forbidden attribute values (bug 3202)
1485 !! input
1486 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1487 !! result
1488 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1489
1490 !! end
1491
1492 !! test
1493 <nowiki> inside <pre> (bug 13238)
1494 !! input
1495 <pre>
1496 <nowiki>
1497 </pre>
1498 <pre>
1499 <nowiki></nowiki>
1500 </pre>
1501 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1502 !! result
1503 <pre>
1504 &lt;nowiki&gt;
1505 </pre>
1506 <pre>
1507
1508 </pre>
1509 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1510
1511 !! end
1512
1513 !! test
1514 <nowiki> and <pre> preference (first one wins)
1515 !! input
1516 <pre>
1517 <nowiki>
1518 </pre>
1519 </nowiki>
1520 </pre>
1521
1522 <nowiki>
1523 <pre>
1524 <nowiki>
1525 </pre>
1526 </nowiki>
1527 </pre>
1528
1529 !! result
1530 <pre>
1531 &lt;nowiki&gt;
1532 </pre>
1533 <p>&lt;/nowiki&gt;
1534 &lt;/pre&gt;
1535 </p><p>
1536 &lt;pre&gt;
1537 &lt;nowiki&gt;
1538 &lt;/pre&gt;
1539
1540 &lt;/pre&gt;
1541 </p>
1542 !! end
1543
1544 !! test
1545 </pre> inside nowiki
1546 !! input
1547 <nowiki></pre></nowiki>
1548 !! result
1549 <p>&lt;/pre&gt;
1550 </p>
1551 !! end
1552
1553 !!test
1554 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1555 !!input
1556 {{echo|}}
1557 !!result
1558
1559 !!end
1560
1561 !!test
1562 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1563 !!input
1564 {{echo|
1565 foo}}
1566 !!result
1567 <p>foo
1568 </p>
1569 !!end
1570
1571 !! test
1572 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1573 !! input
1574 {{echo|a
1575 b}}
1576 !!result
1577 <pre>a
1578 </pre>
1579 <p>b
1580 </p>
1581 !!end
1582
1583 !! test
1584 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1585 !! input
1586 {{echo|a
1587 b
1588 c
1589 d
1590 e
1591 }}
1592 !!result
1593 <pre>a
1594 </pre>
1595 <p>b
1596 c
1597 </p>
1598 <pre>d
1599 </pre>
1600 <p>e
1601 </p>
1602 !!end
1603
1604 !!test
1605 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1606 !!input
1607 {{echo| foo}}
1608
1609 {{echo| foo}}{{echo| bar}}
1610
1611 {{echo| foo}}
1612 {{echo| bar}}
1613
1614 {{echo|<!--cmt--> foo}}
1615
1616 <!--cmt-->{{echo| foo}}
1617
1618 {{echo|{{echo| }}bar}}
1619 !!result
1620 <pre>foo
1621 </pre>
1622 <pre>foo bar
1623 </pre>
1624 <pre>foo
1625 bar
1626 </pre>
1627 <pre>foo
1628 </pre>
1629 <pre>foo
1630 </pre>
1631 <pre>bar
1632 </pre>
1633 !!end
1634
1635 !! test
1636 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1637 !! input
1638 {{echo| }}a
1639
1640 {{echo|
1641 }}a
1642
1643 {{echo|
1644 b}}
1645
1646 {{echo|a
1647 }}b
1648
1649 {{echo|a
1650 }} b
1651 !!result
1652 <pre>a
1653 </pre>
1654 <p><br />
1655 </p>
1656 <pre>a
1657 </pre>
1658 <p><br />
1659 </p>
1660 <pre>b
1661 </pre>
1662 <p>a
1663 </p>
1664 <pre>b
1665 </pre>
1666 <p>a
1667 </p>
1668 <pre>b
1669 </pre>
1670 !!end
1671
1672 # TODO / maybe: fix wt2wt for this
1673 !! test
1674 Parsoid: Don't paragraph-wrap fosterable content
1675 !! options
1676 parsoid=wt2html
1677 !! input
1678 {|
1679 <td></td>
1680 <td></td>
1681
1682
1683
1684 |}
1685 !! result
1686 <table>
1687
1688 <tbody>
1689 <tr>
1690 <td></td>
1691
1692 <td></td></tr>
1693
1694
1695
1696 </tbody></table>
1697 !! end
1698
1699 !! test
1700 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
1701 !! options
1702 parsoid=wt2html
1703 !! input
1704 {|
1705 <td>
1706 <td>
1707 </td>
1708
1709
1710
1711 |}
1712 !! result
1713 <table>
1714
1715 <tbody>
1716 <tr>
1717 <td></td>
1718
1719 <td>
1720 </td></tr>
1721
1722
1723
1724 </tbody></table>
1725 !! end
1726
1727
1728 #--------------------------------------------------------------------
1729 # Transclusion parameter whitespace stripping tests
1730 # Behavior is different for positional and named parameters
1731 #--------------------------------------------------------------------
1732 !! test
1733 Templates: Strip leading and trailing whitespace from named-param values
1734 !! input
1735 {{echo|1= a }}
1736
1737 {{echo|1= {{echo|b}} }}
1738
1739 {{echo| 1 =
1740 c }}
1741
1742 {{echo| 1 =
1743 * d
1744 }}
1745 !! result
1746 <p>a
1747 </p><p>b
1748 </p><p>c
1749 </p>
1750 <ul><li> d
1751 </li></ul>
1752
1753 !! end
1754
1755 !! test
1756 Templates: Don't strip whitespace from positional-param values
1757 !! input
1758 {{echo|a }}
1759
1760 {{echo|{{echo|b}} }}
1761
1762 {{echo| c
1763 }}
1764
1765 {{echo| {{echo|d}}
1766 }}
1767
1768 {{echo|
1769 e}}
1770
1771 {{echo|
1772 * f}}
1773
1774 {{echo|
1775 }}g
1776 !! result
1777 <p>a
1778 </p><p>b
1779 </p>
1780 <pre>c
1781 </pre>
1782 <p><br />
1783 </p>
1784 <pre>d
1785 </pre>
1786 <p><br />
1787 </p>
1788 <pre>e
1789 </pre>
1790 <p><br />
1791 </p>
1792 <ul><li> f
1793 </li></ul>
1794 <p><br />
1795 </p>
1796 <pre>g
1797 </pre>
1798 !! end
1799
1800 !! test
1801 Templates: Handle empty comment-and-ws-only lines correctly
1802 !! input
1803 {{echo|foo
1804 <!--should be ignored-->
1805 <!--should be ignored as well-->
1806 bar}}
1807 !! result
1808 <p>foo
1809 bar
1810 </p>
1811 !! end
1812
1813 #--------------------------------------------------------------------
1814 # Transclusion parameter escaping tests
1815 #--------------------------------------------------------------------
1816 !! test
1817 Templates: Parsoid parameter escaping test 1
1818 !! options
1819 parsoid
1820 !! input
1821 {{echo|[foo]|{{echo|[bar]}}}}
1822 !! result
1823 <p about="#mwt1" typeof="mw:Transclusion"
1824 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
1825 !! end
1826
1827 !! test
1828 Parsoid: Pipes in external links in template parameter
1829 !! options
1830 parsoid
1831 !! input
1832 {{echo|[{{echo|http://example.com}} link]}}
1833 !! result
1834 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
1835 !! end
1836
1837 !! test
1838 Parsoid: pipe in transclusion parameter
1839 !! options
1840 parsoid
1841 !! input
1842 {{echo|http://foo.com/a&#124;b}}
1843 !! result
1844 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1845 typeof="mw:Transclusion"
1846 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
1847 !! end
1848
1849 !! test
1850 Parsoid: Pipe in external link target and content in template parameter
1851 !! options
1852 parsoid=html2wt,wt2wt
1853 !! input
1854 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1855 !! result
1856 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1857 typeof="mw:Transclusion"
1858 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
1859 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
1860 !! end
1861
1862 !! test
1863 Templates: Dont escape already nowiki-escaped text in template parameters
1864 !! options
1865 parsoid=html2wt,wt2wt
1866 !! input
1867 {{echo|foo<nowiki>|</nowiki>bar}}
1868 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1869 {{echo|<nowiki></nowiki>}}
1870 !! result
1871 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
1872 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
1873 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
1874 </p>
1875 !! end
1876
1877 ## Bug 52824
1878 !! test
1879 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
1880 !! options
1881 parsoid=html2wt,wt2wt
1882 !! input
1883 {{echo|{{echo|1=bar}}}}
1884 !! result
1885 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
1886 !! end
1887
1888 ###
1889 ### Parsoid-centric tests for testing RT edge cases for pre
1890 ###
1891
1892 !!test
1893 1a. Indent-Pre and Comments
1894 !!input
1895 a
1896 <!--a-->
1897 c
1898 !!result
1899 <pre>a
1900 </pre>
1901 <p>c
1902 </p>
1903 !!end
1904
1905 !!test
1906 1b. Indent-Pre and Comments
1907 !!input
1908 a
1909 <!--a-->
1910 c
1911 !!result
1912 <pre>a
1913 </pre>
1914 <p>c
1915 </p>
1916 !!end
1917
1918 !!test
1919 1c. Indent-Pre and Comments
1920 !!input
1921 <!--a--> a
1922
1923 <!--a--> a
1924 !!result
1925 <pre> a
1926 </pre>
1927 <pre> a
1928 </pre>
1929 !!end
1930
1931 !!test
1932 1d. Indent-Pre and Comments
1933 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
1934 !!input
1935 <!--a--> a
1936
1937 <!--b-->b
1938 !!result
1939 <pre>a
1940 </pre>
1941 <pre>b
1942 </pre>
1943 !!end
1944
1945 !!test
1946 2a. Indent-Pre and tables
1947 !!input
1948 {|
1949 |-
1950 !h1!!h2
1951 |foo||bar
1952 |}
1953 !!result
1954 <table>
1955
1956 <tr>
1957 <th>h1</th>
1958 <th>h2
1959 </th>
1960 <td>foo</td>
1961 <td>bar
1962 </td></tr></table>
1963
1964 !!end
1965
1966 !!test
1967 2b. Indent-Pre and tables
1968 !!input
1969 {|
1970 |-
1971 |foo
1972 |}
1973 !!result
1974 <table>
1975
1976 <tr>
1977 <td>foo
1978 </td></tr></table>
1979
1980 !!end
1981
1982 !!test
1983 2c. Indent-Pre and tables (bug 42252)
1984 !!input
1985 {|
1986 |+ foo
1987 ! | bar
1988 |}
1989 !!result
1990 <table>
1991 <caption> foo
1992 </caption>
1993 <tr>
1994 <th> bar
1995 </th></tr></table>
1996
1997 !!end
1998
1999 !!test
2000 3a. Indent-Pre and block tags (single-line html)
2001 !!input
2002 <p> foo </p>
2003 <div> foo </div>
2004 <blockquote> foo </blockquote>
2005 <span> foo </span>
2006 !!result
2007 <p> foo </p>
2008 <div> foo </div>
2009 <blockquote> foo </blockquote>
2010 <pre><span> foo </span>
2011 </pre>
2012 !!end
2013
2014 !!test
2015 3b. Indent-Pre and block tags (pre-content on separate line)
2016 !!input
2017 <p>
2018 foo
2019 </p>
2020
2021 <div>
2022 foo
2023 </div>
2024
2025 <center>
2026 foo
2027 </center>
2028
2029 <blockquote>
2030 foo
2031 </blockquote>
2032
2033 <blockquote>
2034 <pre>
2035 foo
2036 </pre>
2037 </blockquote>
2038
2039 <table><tr><td>
2040 foo
2041 </td></tr></table>
2042
2043 <ul><li>
2044 foo
2045 </li></ul>
2046
2047 !!result
2048 <p>
2049 foo
2050 </p>
2051 <div>
2052 <pre>foo
2053 </pre>
2054 </div>
2055 <center>
2056 <pre>foo
2057 </pre>
2058 </center>
2059 <blockquote>
2060 <p> foo
2061 </p>
2062 </blockquote>
2063 <blockquote>
2064 <pre>
2065 foo
2066 </pre>
2067 </blockquote>
2068 <table><tr><td>
2069 <pre>foo
2070 </pre>
2071 </td></tr></table>
2072 <ul><li>
2073 foo
2074 </li></ul>
2075
2076 !!end
2077
2078 !!test
2079 4. Multiple spaces at start-of-line
2080 !!input
2081 <p> foo </p>
2082 foo
2083 {|
2084 |foo
2085 |}
2086 !!result
2087 <p> foo </p>
2088 <pre> foo
2089 </pre>
2090 <table>
2091 <tr>
2092 <td>foo
2093 </td></tr></table>
2094
2095 !!end
2096
2097 !! test
2098 5. White-space in indent-pre
2099 NOTE: the white-space char on 2nd line is significant
2100 !! input
2101 a<br/>
2102
2103 b
2104 !! result
2105 <pre>a<br />
2106
2107 b
2108 </pre>
2109 !! end
2110
2111 !! test
2112 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2113 !! input
2114 a
2115
2116 <!-- continue -->
2117 b
2118
2119 c
2120
2121 d
2122 !! result
2123 <pre>a
2124
2125 b
2126 </pre>
2127 <pre>c
2128
2129 </pre>
2130 <p>d
2131 </p>
2132 !! end
2133
2134 !! test
2135 7a. Indent-pre and category links
2136 !! options
2137 parsoid=wt2html,wt2wt
2138 !! input
2139 [[Category:foo]] <!-- No pre-wrapping -->
2140 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2141 !! result
2142 <link rel="mw:WikiLink/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2143 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2144 <link rel="mw:WikiLink/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2145 !! end
2146
2147 !! test
2148 7b. Indent-pre and category links
2149 !! options
2150 parsoid=wt2html,wt2wt
2151 !! input
2152 [[Category:foo]] a
2153 [[Category:foo]] {{echo|b}}
2154 !! result
2155 <pre>
2156 <link rel="mw:WikiLink/Category" href="./Category:Foo"> a
2157
2158 <link rel="mw:WikiLink/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
2159 !! end
2160
2161 ###
2162 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2163 ###
2164
2165 !!test
2166 HTML-pre: 1. embedded newlines
2167 !!input
2168 <pre>foo</pre>
2169
2170 <pre>
2171 foo
2172 </pre>
2173
2174 <pre>
2175
2176 foo
2177 </pre>
2178
2179 <pre>
2180
2181
2182 foo
2183 </pre>
2184 !!result
2185 <pre>foo</pre>
2186 <pre>
2187 foo
2188 </pre>
2189 <pre>
2190
2191 foo
2192 </pre>
2193 <pre>
2194
2195
2196 foo
2197 </pre>
2198
2199 !!end
2200
2201 !!test
2202 HTML-pre: 2: indented text
2203 !!input
2204 <pre>
2205 foo
2206 </pre>
2207 !!result
2208 <pre>
2209 foo
2210 </pre>
2211
2212 !!end
2213
2214 !!test
2215 HTML-pre: 3: other wikitext
2216 !!input
2217 <pre>
2218 * foo
2219 # bar
2220 = no-h =
2221 '' no-italic ''
2222 [[ NoLink ]]
2223 </pre>
2224 !!result
2225 <pre>
2226 * foo
2227 # bar
2228 = no-h =
2229 '' no-italic ''
2230 [[ NoLink ]]
2231 </pre>
2232
2233 !!end
2234
2235 ###
2236 ### Definition lists
2237 ###
2238 !! test
2239 Simple definition
2240 !! input
2241 ; name : Definition
2242 !! result
2243 <dl><dt> name&#160;</dt><dd> Definition
2244 </dd></dl>
2245
2246 !! end
2247
2248 !! test
2249 Definition list for indentation only
2250 !! input
2251 : Indented text
2252 !! result
2253 <dl><dd> Indented text
2254 </dd></dl>
2255
2256 !! end
2257
2258 !! test
2259 Definition list with no space
2260 !! input
2261 ;name:Definition
2262 !! result
2263 <dl><dt>name</dt><dd>Definition
2264 </dd></dl>
2265
2266 !!end
2267
2268 !! test
2269 Definition list with URL link
2270 !! input
2271 ; http://example.com/ : definition
2272 !! result
2273 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
2274 </dd></dl>
2275
2276 !! end
2277
2278 !! test
2279 Definition list with bracketed URL link
2280 !! input
2281 ;[http://www.example.com/ Example]:Something about it
2282 !! result
2283 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
2284 </dd></dl>
2285
2286 !! end
2287
2288 !! test
2289 Definition list with wikilink containing colon
2290 !! input
2291 ; [[Help:FAQ]]: The least-read page on Wikipedia
2292 !! result
2293 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt><dd> The least-read page on Wikipedia
2294 </dd></dl>
2295
2296 !! end
2297
2298 # At Brion's and JeLuF's insistence... :)
2299 !! test
2300 Definition list with news link containing colon
2301 !! input
2302 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2303 !! result
2304 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
2305 </dd></dl>
2306
2307 !! end
2308
2309 !! test
2310 Malformed definition list with colon
2311 !! input
2312 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2313 !! result
2314 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
2315 </dt></dl>
2316
2317 !! end
2318
2319 !! test
2320 Definition lists: colon in external link text
2321 !! input
2322 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2323 !! result
2324 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt><dd> OK, I made that up
2325 </dd></dl>
2326
2327 !! end
2328
2329 !! test
2330 Definition lists: colon in HTML attribute
2331 !! input
2332 ;<b style="display: inline">bold</b>
2333 !! result
2334 <dl><dt><b style="display: inline">bold</b>
2335 </dt></dl>
2336
2337 !! end
2338
2339 !! test
2340 Definition lists: self-closed tag
2341 !! input
2342 ;one<br/>two : two-line fun
2343 !! result
2344 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
2345 </dd></dl>
2346
2347 !! end
2348
2349 !! test
2350 Bug 11748: Literal closing tags
2351 !! input
2352 <dl>
2353 <dt>test 1</dt>
2354 <dd>test test test test test</dd>
2355 <dt>test 2</dt>
2356 <dd>test test test test test</dd>
2357 </dl>
2358 !! result
2359 <dl>
2360 <dt>test 1</dt>
2361 <dd>test test test test test</dd>
2362 <dt>test 2</dt>
2363 <dd>test test test test test</dd>
2364 </dl>
2365
2366 !! end
2367
2368 !! test
2369 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2370 !! input
2371 <ul><li>
2372 ; term : description
2373 * unordered
2374 </li>
2375 </ul>
2376 !! result
2377 <ul><li>
2378 <dl><dt> term&#160;</dt><dd> description
2379 </dd></dl>
2380 <ul><li> unordered
2381 </li></ul>
2382 </li>
2383 </ul>
2384
2385 !! end
2386
2387 !! test
2388
2389 Definition list with empty definition and following paragraph
2390 !! input
2391 ; term:
2392 Paragraph text
2393 !! result
2394 <dl><dt> term</dt><dd>
2395 </dd></dl>
2396 <p>Paragraph text
2397 </p>
2398 !! end
2399
2400 !! test
2401 Nested definition lists using html syntax
2402 !! input
2403 <dl><dd>
2404 <dl>
2405 <dd>Foo</dd>
2406 </dl>
2407 </dd></dl>
2408 !! result
2409 <dl><dd>
2410 <dl>
2411 <dd>Foo</dd>
2412 </dl>
2413 </dd></dl>
2414
2415 !! end
2416
2417 !! test
2418 Definition Lists: No nesting: Multiple dd's
2419 !! input
2420 ;x
2421 :a
2422 :b
2423 !! result
2424 <dl><dt>x
2425 </dt><dd>a
2426 </dd><dd>b
2427 </dd></dl>
2428
2429 !! end
2430
2431 !! test
2432 Definition Lists: Indentation: Regular
2433 !! input
2434 :i1
2435 ::i2
2436 :::i3
2437 !! result
2438 <dl><dd>i1
2439 <dl><dd>i2
2440 <dl><dd>i3
2441 </dd></dl>
2442 </dd></dl>
2443 </dd></dl>
2444
2445 !! end
2446
2447 !! test
2448 Definition Lists: Indentation: Missing 1st level
2449 !! input
2450 ::i2
2451 :::i3
2452 !! result
2453 <dl><dd><dl><dd>i2
2454 <dl><dd>i3
2455 </dd></dl>
2456 </dd></dl>
2457 </dd></dl>
2458
2459 !! end
2460
2461 !! test
2462 Definition Lists: Indentation: Multi-level indent
2463 !! input
2464 :::i3
2465 !! result
2466 <dl><dd><dl><dd><dl><dd>i3
2467 </dd></dl>
2468 </dd></dl>
2469 </dd></dl>
2470
2471 !! end
2472
2473 !! test
2474 Definition Lists: Hacky use to indent tables
2475 !! input
2476 ::{|
2477 |foo
2478 |bar
2479 |}
2480 this text
2481 should be left alone
2482 !! result
2483 <dl><dd><dl><dd><table>
2484 <tr>
2485 <td>foo
2486 </td>
2487 <td>bar
2488 </td></tr></table></dd></dl></dd></dl>
2489 <p>this text
2490 should be left alone
2491 </p>
2492 !! end
2493
2494 # Bug 52473
2495 !! test
2496 Definition Lists: Hacky use to indent tables (WS-insensitive)
2497 !! options
2498 parsoid
2499 !! input
2500 : {|
2501 |a
2502 |}
2503 !! result
2504 <dl><dd> <table><tr><td>a</td></tr></table> </dd></dl>
2505 !! end
2506 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2507 ## as an empty dt item. It also ignores all but the last ";" when followed
2508 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2509 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2510 ## ";"s.
2511 ##
2512 ## Ex: ";;t2 ::d2" is transformed into:
2513 ##
2514 ## <dl>
2515 ## <dt>t2 </dt>
2516 ## <dd>
2517 ## <dl>
2518 ## <dt></dt>
2519 ## <dd>d2</dd>
2520 ## </dl>
2521 ## </dd>
2522 ## </dl>
2523 ##
2524 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2525 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2526 ##
2527 ## <dl>
2528 ## <dt>
2529 ## <dl>
2530 ## <dt>t2 </dt>
2531 ## <dd>:d2</dd>
2532 ## </dl>
2533 ## </dt>
2534 ## </dl>
2535 ##
2536 ## All Parsoid only definition list tests have this difference.
2537 ##
2538 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2539 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2540
2541 !! test
2542 Table / list interaction: indented table with lists in table contents
2543 !! input
2544 :{|
2545 |-
2546 | a
2547 * b
2548 |-
2549 | c
2550 * d
2551 |}
2552 !! result
2553 <dl><dd><table>
2554
2555 <tr>
2556 <td> a
2557 <ul><li> b
2558 </li></ul>
2559 </td></tr>
2560 <tr>
2561 <td> c
2562 <ul><li> d
2563 </li></ul>
2564 </td></tr></table></dd></dl>
2565
2566 !! end
2567
2568 !!test
2569 Table / list interaction: lists nested in tables nested in indented lists
2570 !!input
2571 :{|
2572 |
2573 :a
2574 :b
2575 |
2576 *c
2577 *d
2578 |}
2579
2580 *e
2581 *f
2582 !!result
2583 <dl><dd><table>
2584 <tr>
2585 <td>
2586 <dl><dd>a
2587 </dd><dd>b
2588 </dd></dl>
2589 </td>
2590 <td>
2591 <ul><li>c
2592 </li><li>d
2593 </li></ul>
2594 </td></tr></table></dd></dl>
2595 <ul><li>e
2596 </li><li>f
2597 </li></ul>
2598
2599 !!end
2600
2601 !! test
2602 Definition Lists: Nesting: Multi-level (Parsoid only)
2603 !! options
2604 parsoid
2605 !! input
2606 ;t1 :d1
2607 ;;t2 ::d2
2608 ;;;t3 :::d3
2609 !! result
2610 <dl>
2611 <dt>t1 </dt>
2612 <dd>d1</dd>
2613 <dt>
2614 <dl>
2615 <dt>t2 </dt>
2616 <dd>:d2</dd>
2617 <dt>
2618 <dl>
2619 <dt>t3 </dt>
2620 <dd>::d3</dd>
2621 </dl>
2622 </dt>
2623 </dl>
2624 </dt>
2625 </dl>
2626
2627
2628 !! end
2629
2630
2631 !! test
2632 Definition Lists: Nesting: Test 2 (Parsoid only)
2633 !! options
2634 parsoid
2635 !! input
2636 ;t1
2637 ::d2
2638 !! result
2639 <dl>
2640 <dt>t1</dt>
2641 <dd>
2642 <dl>
2643 <dd>d2</dd>
2644 </dl>
2645 </dd>
2646 </dl>
2647
2648 !! end
2649
2650
2651 !! test
2652 Definition Lists: Nesting: Test 3 (Parsoid only)
2653 !! options
2654 parsoid
2655 !! input
2656 :;t1
2657 ::::d2
2658 !! result
2659 <dl>
2660 <dd>
2661 <dl>
2662 <dt>t1</dt>
2663 <dd>
2664 <dl>
2665 <dd>
2666 <dl>
2667 <dd>d2</dd>
2668 </dl>
2669 </dd>
2670 </dl>
2671 </dd>
2672 </dl>
2673 </dd>
2674 </dl>
2675
2676 !! end
2677
2678
2679 !! test
2680 Definition Lists: Nesting: Test 4
2681 !! input
2682 ::;t3
2683 :::d3
2684 !! result
2685 <dl><dd><dl><dd><dl><dt>t3
2686 </dt><dd>d3
2687 </dd></dl>
2688 </dd></dl>
2689 </dd></dl>
2690
2691 !! end
2692
2693
2694 ## The Parsoid team believes the following three test exposes a
2695 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2696 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2697 !! test
2698 Definition Lists: Mixed Lists: Test 1 (php)
2699 !! options
2700 php
2701 !! input
2702 :;* foo
2703 ::* bar
2704 :; baz
2705 !! result
2706 <dl><dd><dl><dt><ul><li> foo
2707 </li><li> bar
2708 </li></ul>
2709 </dt></dl>
2710 <dl><dt> baz
2711 </dt></dl>
2712 </dd></dl>
2713
2714 !! end
2715 !! test
2716 Definition Lists: Mixed Lists: Test 1 (parsoid)
2717 !! options
2718 parsoid
2719 !! input
2720 :;* foo
2721 ::* bar
2722 :; baz
2723 !! result
2724 <dl><dd><dl><dt><ul><li> foo
2725 </li></ul></dt><dd><ul><li> bar
2726 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2727 !! end
2728
2729 !! test
2730 Definition Lists: Mixed Lists: Test 2
2731 !! input
2732 *: d1
2733 *: d2
2734 !! result
2735 <ul><li><dl><dd> d1
2736 </dd><dd> d2
2737 </dd></dl>
2738 </li></ul>
2739
2740 !! end
2741
2742
2743 !! test
2744 Definition Lists: Mixed Lists: Test 3
2745 !! input
2746 *::: d1
2747 *::: d2
2748 !! result
2749 <ul><li><dl><dd><dl><dd><dl><dd> d1
2750 </dd><dd> d2
2751 </dd></dl>
2752 </dd></dl>
2753 </dd></dl>
2754 </li></ul>
2755
2756 !! end
2757
2758
2759 !! test
2760 Definition Lists: Mixed Lists: Test 4
2761 !! input
2762 *;d1 :d2
2763 *;d3 :d4
2764 !! result
2765 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2766 </dd><dt>d3&#160;</dt><dd>d4
2767 </dd></dl>
2768 </li></ul>
2769
2770 !! end
2771
2772
2773 !! test
2774 Definition Lists: Mixed Lists: Test 5
2775 !! input
2776 *:d1
2777 *:: d2
2778 !! result
2779 <ul><li><dl><dd>d1
2780 <dl><dd> d2
2781 </dd></dl>
2782 </dd></dl>
2783 </li></ul>
2784
2785 !! end
2786
2787
2788 !! test
2789 Definition Lists: Mixed Lists: Test 6
2790 !! input
2791 #*:d1
2792 #*::: d3
2793 !! result
2794 <ol><li><ul><li><dl><dd>d1
2795 <dl><dd><dl><dd> d3
2796 </dd></dl>
2797 </dd></dl>
2798 </dd></dl>
2799 </li></ul>
2800 </li></ol>
2801
2802 !! end
2803
2804
2805 !! test
2806 Definition Lists: Mixed Lists: Test 7
2807 !! input
2808 :* d1
2809 :* d2
2810 !! result
2811 <dl><dd><ul><li> d1
2812 </li><li> d2
2813 </li></ul>
2814 </dd></dl>
2815
2816 !! end
2817
2818
2819 !! test
2820 Definition Lists: Mixed Lists: Test 8
2821 !! input
2822 :* d1
2823 ::* d2
2824 !! result
2825 <dl><dd><ul><li> d1
2826 </li></ul>
2827 <dl><dd><ul><li> d2
2828 </li></ul>
2829 </dd></dl>
2830 </dd></dl>
2831
2832 !! end
2833
2834
2835 !! test
2836 Definition Lists: Mixed Lists: Test 9
2837 !! input
2838 *;foo :bar
2839 !! result
2840 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2841 </dd></dl>
2842 </li></ul>
2843
2844 !! end
2845
2846
2847 !! test
2848 Definition Lists: Mixed Lists: Test 10
2849 !! input
2850 *#;foo :bar
2851 !! result
2852 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2853 </dd></dl>
2854 </li></ol>
2855 </li></ul>
2856
2857 !! end
2858
2859 # The Parsoid team disagrees with the PHP parser's seemingly-random
2860 # rules regarding dd/dt on the next two tests. Parsoid is more
2861 # consistent, and recognizes the shared nesting and keeps the
2862 # still-open tags around until the nesting is complete.
2863
2864 !! test
2865 Definition Lists: Mixed Lists: Test 11 (php)
2866 !! options
2867 php
2868 !! input
2869 *#*#;*;;foo :bar
2870 *#*#;boo :baz
2871 !! result
2872 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2873 </dt></dl>
2874 </dd></dl>
2875 </li></ul>
2876 </dd></dl>
2877 <dl><dt>boo&#160;</dt><dd>baz
2878 </dd></dl>
2879 </li></ol>
2880 </li></ul>
2881 </li></ol>
2882 </li></ul>
2883
2884 !! end
2885 !! test
2886 Definition Lists: Mixed Lists: Test 11 (parsoid)
2887 !! options
2888 parsoid
2889 !! input
2890 *#*#;*;;foo :bar
2891 *#*#;boo :baz
2892 !! result
2893 <ul>
2894 <li>
2895 <ol>
2896 <li>
2897 <ul>
2898 <li>
2899 <ol>
2900 <li>
2901 <dl>
2902 <dt>
2903 <ul>
2904 <li>
2905 <dl>
2906 <dt>
2907 <dl>
2908 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2909 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2910 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2911 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2912 !! end
2913
2914
2915 !! test
2916 Definition Lists: Weird Ones: Test 1 (php)
2917 !! options
2918 php
2919 !! input
2920 *#;*::;; foo : bar (who uses this?)
2921 !! result
2922 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2923 </dt></dl>
2924 </dd></dl>
2925 </dd></dl>
2926 </dd></dl>
2927 </li></ul>
2928 </dd></dl>
2929 </li></ol>
2930 </li></ul>
2931
2932 !! end
2933 !! test
2934 Definition Lists: Weird Ones: Test 1 (parsoid)
2935 !! options
2936 parsoid
2937 !! input
2938 *#;*::;; foo : bar (who uses this?)
2939 !! result
2940 <ul>
2941 <li>
2942 <ol>
2943 <li>
2944 <dl>
2945 <dt>
2946 <ul>
2947 <li>
2948 <dl>
2949 <dd>
2950 <dl>
2951 <dd>
2952 <dl>
2953 <dt>
2954 <dl>
2955 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2956 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd></dl></dt></dl></dd></dl></dd></dl></li></ul></dt></dl></li></ol></li></ul>
2957 !! end
2958
2959 ###
2960 ### External links
2961 ###
2962 !! test
2963 External links: non-bracketed
2964 !! input
2965 Non-bracketed: http://example.com
2966 !! result
2967 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2968 </p>
2969 !! end
2970
2971 !! test
2972 External links: numbered
2973 !! input
2974 Numbered: [http://example.com]
2975 Numbered: [http://example.net]
2976 Numbered: [http://example.com]
2977 !! result
2978 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2979 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2980 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2981 </p>
2982 !!end
2983
2984 !! test
2985 External links: specified text
2986 !! input
2987 Specified text: [http://example.com link]
2988 !! result
2989 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2990 </p>
2991 !!end
2992
2993 !! test
2994 External links: trail
2995 !! input
2996 Linktrails should not work for external links: [http://example.com link]s
2997 !! result
2998 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2999 </p>
3000 !! end
3001
3002 !! test
3003 External links: dollar sign in URL
3004 !! input
3005 http://example.com/1$2345
3006 !! result
3007 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3008 </p>
3009 !! end
3010
3011 !! test
3012 External links: dollar sign in URL (named)
3013 !! input
3014 [http://example.com/1$2345]
3015 !! result
3016 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3017 </p>
3018 !!end
3019
3020 !! test
3021 External links: open square bracket forbidden in URL (bug 4377)
3022 !! input
3023 http://example.com/1[2345
3024 !! result
3025 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3026 </p>
3027 !! end
3028
3029 !! test
3030 External links: open square bracket forbidden in URL (named) (bug 4377)
3031 !! input
3032 [http://example.com/1[2345]
3033 !! result
3034 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3035 </p>
3036 !!end
3037
3038 !! test
3039 External links: nowiki in URL link text (bug 6230)
3040 !!input
3041 [http://example.com/ <nowiki>''example site''</nowiki>]
3042 !! result
3043 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3044 </p>
3045 !! end
3046
3047 !! test
3048 External links: newline forbidden in text (bug 6230 regression check)
3049 !! input
3050 [http://example.com/ first
3051 second]
3052 !! result
3053 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3054 second]
3055 </p>
3056 !!end
3057
3058 !! test
3059 External links: Pipe char between url and text
3060 !! input
3061 [http://example.com | link]
3062 !! result
3063 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3064 </p>
3065 !!end
3066
3067 !! test
3068 External links: protocol-relative URL in brackets
3069 !! input
3070 [//example.com/ Test]
3071 !! result
3072 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3073 </p>
3074 !! end
3075
3076 !! test
3077 External links: protocol-relative URL in brackets without text
3078 !! input
3079 [//example.com]
3080 !! result
3081 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3082 </p>
3083 !! end
3084
3085 !! test
3086 External links: protocol-relative URL in free text is left alone
3087 !! input
3088 //example.com/Foo
3089 !! result
3090 <p>//example.com/Foo
3091 </p>
3092 !!end
3093
3094 !! test
3095 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3096 !! input
3097 foo//example.com/Foo
3098 !! result
3099 <p>foo//example.com/Foo
3100 </p>
3101 !! end
3102
3103 !! test
3104 External image
3105 !! input
3106 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3107 !! result
3108 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3109 </p>
3110 !! end
3111
3112 !! test
3113 External image from https
3114 !! input
3115 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3116 !! result
3117 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3118 </p>
3119 !! end
3120
3121 !! test
3122 External image (when not allowed)
3123 !! options
3124 wgAllowExternalImages=0
3125 !! input
3126 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3127 !! result
3128 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
3129 </p>
3130 !! end
3131
3132 !! test
3133 Link to non-http image, no img tag
3134 !! input
3135 Link to non-http image, no img tag: ftp://example.com/test.jpg
3136 !! result
3137 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
3138 </p>
3139 !! end
3140
3141 !! test
3142 External links: terminating separator
3143 !! input
3144 Terminating separator: http://example.com/thing,
3145 !! result
3146 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3147 </p>
3148 !! end
3149
3150 !! test
3151 External links: intervening separator
3152 !! input
3153 Intervening separator: http://example.com/1,2,3
3154 !! result
3155 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3156 </p>
3157 !! end
3158
3159 !! test
3160 External links: old bug with URL in query
3161 !! input
3162 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3163 !! result
3164 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3165 </p>
3166 !! end
3167
3168 !! test
3169 External links: old URL-in-URL bug, mixed protocols
3170 !! input
3171 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3172 !! result
3173 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3174 </p>
3175 !!end
3176
3177 !! test
3178 External links: URL in text
3179 !! input
3180 URL in text: [http://example.com http://example.com]
3181 !! result
3182 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3183 </p>
3184 !! end
3185
3186 !! test
3187 External links: Clickable images
3188 !! input
3189 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3190 !! result
3191 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
3192 </p>
3193 !!end
3194
3195 !! test
3196 External links: raw ampersand
3197 !! input
3198 Old &amp; use: http://x&y
3199 !! result
3200 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3201 </p>
3202 !! end
3203
3204 !! test
3205 External links: encoded ampersand
3206 !! input
3207 Old &amp; use: http://x&amp;y
3208 !! result
3209 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3210 </p>
3211 !! end
3212
3213 !! test
3214 External links: encoded equals (bug 6102)
3215 !! input
3216 http://example.com/?foo&#61;bar
3217 !! result
3218 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3219 </p>
3220 !! end
3221
3222 !! test
3223 External links: [raw ampersand]
3224 !! input
3225 Old &amp; use: [http://x&y]
3226 !! result
3227 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3228 </p>
3229 !! end
3230
3231 !! test
3232 External links: [encoded ampersand]
3233 !! input
3234 Old &amp; use: [http://x&amp;y]
3235 !! result
3236 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3237 </p>
3238 !! end
3239
3240 !! test
3241 External links: [encoded equals] (bug 6102)
3242 !! input
3243 [http://example.com/?foo&#61;bar]
3244 !! result
3245 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3246 </p>
3247 !! end
3248
3249 !! test
3250 External links: [IDN ignored character reference in hostname; strip it right off]
3251 !! input
3252 [http://e&zwnj;xample.com/]
3253 !! result
3254 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3255 </p>
3256 !! end
3257
3258 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3259 # Where an external link could easily circumvent the sanitization of the text of
3260 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3261 # test demands a higher standard. That's a bit strange.
3262 #
3263 # Example:
3264 #
3265 # http://e‌xample.com -> [http://example.com|http://example.com]
3266 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3267 #
3268 # The first example is sanitized, but the second is not. Any security benefits
3269 # from this production are trivial to circumvent. Either remove this test and
3270 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3271 # the test accordingly.
3272 #
3273 # All our love,
3274 # The Parsoid team.
3275 !! test
3276 External links: IDN ignored character reference in hostname; strip it right off
3277 !! input
3278 http://e&zwnj;xample.com/
3279 !! result
3280 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3281 </p>
3282 !! end
3283
3284 !! test
3285 External links: www.jpeg.org (bug 554)
3286 !! input
3287 http://www.jpeg.org
3288 !!result
3289 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3290 </p>
3291 !! end
3292
3293 !! test
3294 External links: URL within URL (original bug 2)
3295 !! input
3296 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3297 !! result
3298 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3299 </p>
3300 !! end
3301
3302 !! test
3303 BUG 361: URL inside bracketed URL
3304 !! input
3305 [http://www.example.com/foo http://www.example.com/bar]
3306 !! result
3307 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3308 </p>
3309 !! end
3310
3311 !! test
3312 BUG 361: URL within URL, not bracketed
3313 !! input
3314 http://www.example.com/foo?=http://www.example.com/bar
3315 !! result
3316 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
3317 </p>
3318 !! end
3319
3320 !! test
3321 BUG 289: ">"-token in URL-tail
3322 !! input
3323 http://www.example.com/<hello>
3324 !! result
3325 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3326 </p>
3327 !!end
3328
3329 !! test
3330 BUG 289: literal ">"-token in URL-tail
3331 !! input
3332 http://www.example.com/<b>html</b>
3333 !! result
3334 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3335 </p>
3336 !!end
3337
3338 !! test
3339 BUG 289: ">"-token in bracketed URL
3340 !! input
3341 [http://www.example.com/<hello> stuff]
3342 !! result
3343 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3344 </p>
3345 !!end
3346
3347 !! test
3348 BUG 289: literal ">"-token in bracketed URL
3349 !! input
3350 [http://www.example.com/<b>html</b> stuff]
3351 !! result
3352 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3353 </p>
3354 !!end
3355
3356 !! test
3357 BUG 289: literal double quote at end of URL
3358 !! input
3359 http://www.example.com/"hello"
3360 !! result
3361 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3362 </p>
3363 !!end
3364
3365 !! test
3366 BUG 289: literal double quote in bracketed URL
3367 !! input
3368 [http://www.example.com/"hello" stuff]
3369 !! result
3370 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3371 </p>
3372 !!end
3373
3374 !! test
3375 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3376 !! input
3377 [http://www.example.com test]
3378 !! result
3379 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3380 </p>
3381 !! end
3382
3383 !! test
3384 External links: link text with spaces
3385 !! input
3386 [http://www.example.com a b c]
3387 [http://www.example.com ''a'' ''b'']
3388 !! result
3389 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3390 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3391 </p>
3392 !! end
3393
3394 !! test
3395 External links: wiki links within external link (Bug 3695)
3396 !! input
3397 [http://example.com [[wikilink]] embedded in ext link]
3398 !! result
3399 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
3400 </p>
3401 !! end
3402
3403 !! test
3404 BUG 787: Links with one slash after the url protocol are invalid
3405 !! input
3406 http:/example.com
3407
3408 [http:/example.com title]
3409 !! result
3410 <p>http:/example.com
3411 </p><p>[http:/example.com title]
3412 </p>
3413 !! end
3414
3415 !! test
3416 Bracketed external links with template-generated invalid target
3417 !! input
3418 [{{echo|http:/example.com}} title]
3419 !! result
3420 <p>[http:/example.com title]
3421 </p>
3422 !! end
3423
3424 !! test
3425 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3426 !! input
3427 ''[http://example.com text'']
3428 [http://example.com '''text]'''
3429 ''Something [http://example.com in italic'']
3430 ''Something [http://example.com mixed''''', even bold]'''
3431 '''''Now [http://example.com both''''']
3432 !! result
3433 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3434 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3435 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3436 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3437 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3438 </p>
3439 !! end
3440
3441
3442 !! test
3443 Bug 4781: %26 in URL
3444 !! input
3445 http://www.example.com/?title=AT%26T
3446 !! result
3447 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3448 </p>
3449 !! end
3450
3451 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3452 # % is actually legal in HTML5. Any change in output would need testing though.
3453 !! test
3454 Bug 4781, 5267: %25 in URL
3455 !! input
3456 http://www.example.com/?title=100%25_Bran
3457 !! result
3458 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
3459 </p>
3460 !! end
3461
3462 !! test
3463 Bug 4781, 5267: %28, %29 in URL
3464 !! input
3465 http://www.example.com/?title=Ben-Hur_%281959_film%29
3466 !! result
3467 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
3468 </p>
3469 !! end
3470
3471
3472 !! test
3473 Bug 4781: %26 in autonumber URL
3474 !! input
3475 [http://www.example.com/?title=AT%26T]
3476 !! result
3477 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3478 </p>
3479 !! end
3480
3481 !! test
3482 Bug 4781, 5267: %26 in autonumber URL
3483 !! input
3484 [http://www.example.com/?title=100%25_Bran]
3485 !! result
3486 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3487 </p>
3488 !! end
3489
3490 !! test
3491 Bug 4781, 5267: %28, %29 in autonumber URL
3492 !! input
3493 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3494 !! result
3495 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3496 </p>
3497 !! end
3498
3499
3500 !! test
3501 Bug 4781: %26 in bracketed URL
3502 !! input
3503 [http://www.example.com/?title=AT%26T link]
3504 !! result
3505 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3506 </p>
3507 !! end
3508
3509 !! test
3510 Bug 4781, 5267: %26 in bracketed URL
3511 !! input
3512 [http://www.example.com/?title=100%25_Bran link]
3513 !! result
3514 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3515 </p>
3516 !! end
3517
3518 !! test
3519 Bug 4781, 5267: %28, %29 in bracketed URL
3520 !! input
3521 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3522 !! result
3523 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3524 </p>
3525 !! end
3526
3527 !! test
3528 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3529 !! input
3530 Some [http://example.com/ pretty ''italics'' and stuff]!
3531 !! result
3532 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3533 </p>
3534 !! end
3535
3536 !! test
3537 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3538 !! input
3539 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3540 !! result
3541 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
3542 </p>
3543 !! end
3544
3545 !! test
3546 External link containing double-single-quotes with no space separating the url from text in italics
3547 !! input
3548 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
3549 !! result
3550 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
3551 </p>
3552 !! end
3553
3554 !! test
3555 External link with comments in link text
3556 !! input
3557 [http://www.google.com Google <!-- comment -->]
3558 !! result
3559 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3560 </p>
3561 !! end
3562
3563 !! test
3564 URL-encoding in URL functions (single parameter)
3565 !! input
3566 {{localurl:Some page|amp=&}}
3567 !! result
3568 <p>/index.php?title=Some_page&amp;amp=&amp;
3569 </p>
3570 !! end
3571
3572 !! test
3573 URL-encoding in URL functions (multiple parameters)
3574 !! input
3575 {{localurl:Some page|q=?&amp=&}}
3576 !! result
3577 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3578 </p>
3579 !! end
3580
3581 !! test
3582 Brackets in urls
3583 !! input
3584 http://example.com/index.php?foozoid%5B%5D=bar
3585
3586 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3587 !! result
3588 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3589 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3590 </p>
3591 !! end
3592
3593 !! test
3594 IPv6 urls (bug 21261)
3595 !! options
3596 disabled
3597 !! input
3598 http://[2404:130:0:1000::187:2]/index.php
3599 !! result
3600 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
3601 </p>
3602 !! end
3603
3604 !! test
3605 Non-extlinks in brackets
3606 !! input
3607 [foo]
3608 [foo bar]
3609 [foo ''bar'']
3610 [fool's] errand
3611 [fool's errand]
3612 [{{echo|foo}}]
3613 [{{echo|foo}} bar]
3614 [{{echo|foo}} ''bar'']
3615 [{{echo|foo}}l's] errand
3616 [{{echo|foo}}l's errand]
3617 [url={{echo|foo}}]
3618 [url=http://example.com]
3619 !! result
3620 <p>[foo]
3621 [foo bar]
3622 [foo <i>bar</i>]
3623 [fool's] errand
3624 [fool's errand]
3625 [foo]
3626 [foo bar]
3627 [foo <i>bar</i>]
3628 [fool's] errand
3629 [fool's errand]
3630 [url=foo]
3631 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3632 </p>
3633 !! end
3634
3635 !! test
3636 Parsoid: Percent encoding in external links
3637 !! options
3638 parsoid
3639 !! input
3640 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3641 !! result
3642 <p><a rel="mw:ExtLink"
3643 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3644 !! end
3645
3646 !! test
3647 Parsoid: use url link syntax for links where the content is equal the link
3648 target
3649 !! options
3650 parsoid
3651 !! input
3652 http://example.com
3653 !! result
3654 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3655 !! end
3656
3657 ###
3658 ### Quotes
3659 ###
3660
3661 !! test
3662 Quotes
3663 !! input
3664 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3665
3666 Normal text. '''''Bold italic text.''''' Normal text.
3667 !!result
3668 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3669 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3670 </p>
3671 !! end
3672
3673
3674 !! test
3675 Unclosed and unmatched quotes (php)
3676 !! options
3677 php
3678 !! input
3679 '''''Bold italic text '''with bold deactivated''' in between.'''''
3680
3681 '''''Bold italic text ''with italic deactivated'' in between.'''''
3682
3683 '''Bold text..
3684
3685 ..spanning two paragraphs (should not work).'''
3686
3687 '''Bold tag left open
3688
3689 ''Italic tag left open
3690
3691 Normal text.
3692
3693 <!-- Unmatching number of opening, closing tags: -->
3694 '''This year''''s election ''should'' beat '''last year''''s.
3695
3696 ''Tom'''s car is bigger than ''Susan'''s.
3697
3698 Plain ''italic'''s plain
3699 !! result
3700 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3701 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3702 </p><p><b>Bold text..</b>
3703 </p><p>..spanning two paragraphs (should not work).
3704 </p><p><b>Bold tag left open</b>
3705 </p><p><i>Italic tag left open</i>
3706 </p><p>Normal text.
3707 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3708 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3709 </p><p>Plain <i>italic'</i>s plain
3710 </p>
3711 !! end
3712 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3713 # parser strips. The wikitext contains just the first half of the bold
3714 # quote pair.
3715 !! test
3716 Unclosed and unmatched quotes (parsoid)
3717 !! options
3718 parsoid
3719 !! input
3720 '''''Bold italic text '''with bold deactivated''' in between.'''''
3721
3722 '''''Bold italic text ''with italic deactivated'' in between.'''''
3723
3724 '''Bold text..
3725
3726 ..spanning two paragraphs (should not work).'''
3727
3728 '''Bold tag left open
3729
3730 ''Italic tag left open
3731
3732 Normal text.
3733
3734 <!-- Unmatching number of opening, closing tags: -->
3735 '''This year''''s election ''should'' beat '''last year''''s.
3736
3737 ''Tom'''s car is bigger than ''Susan'''s.
3738
3739 Plain ''italic'''s plain
3740 !! result
3741 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3742 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3743 </p><p><b>Bold text..</b>
3744 </p><p>..spanning two paragraphs (should not work).<b></b>
3745 </p><p><b>Bold tag left open</b>
3746 </p><p><i>Italic tag left open</i>
3747 </p><p>Normal text.
3748 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3749 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3750 </p><p>Plain <i>italic'</i>s plain
3751 </p>
3752 !! end
3753
3754 ###
3755 ### Tables
3756 ###
3757 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3758 ###
3759
3760 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3761 # is the bare minimum required by the spec, see:
3762 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3763 !! test
3764 A table with no data. (php)
3765 !! options
3766 php
3767 !! input
3768 {||}
3769 !! result
3770 !! end
3771 # Parsoid team replies: empty table tags are legal in HTML5
3772 !! test
3773 A table with no data. (parsoid)
3774 !! options
3775 parsoid
3776 !! input
3777 {||}
3778 !! result
3779 <table></table>
3780 !! end
3781
3782 # A table with nothing but a caption is invalid XHTML, we might want to render
3783 # this as <p>caption</p>
3784 !! test
3785 A table with nothing but a caption (php)
3786 !! options
3787 php
3788 !! input
3789 {|
3790 |+ caption
3791 |}
3792 !! result
3793 <table>
3794 <caption> caption
3795 </caption><tr><td></td></tr></table>
3796
3797 !! end
3798 # Parsoid team replies: table with only a caption is legal in HTML5
3799 !! test
3800 A table with nothing but a caption (parsoid)
3801 !! options
3802 parsoid
3803 !! input
3804 {|
3805 |+ caption
3806 |}
3807 !! result
3808 <table><caption> caption</caption></table>
3809 !! end
3810
3811 !! test
3812 A table with caption with default-spaced attributes and a table row
3813 !! input
3814 {|
3815 |+ style="color: red;" | caption1
3816 |-
3817 | foo
3818 |}
3819 !! result
3820 <table>
3821 <caption style="color: red;"> caption1
3822 </caption>
3823 <tr>
3824 <td> foo
3825 </td></tr></table>
3826
3827 !! end
3828
3829 !! test
3830 A table with captions with non-default spaced attributes and a table row
3831 !! input
3832 {|
3833 |+style="color: red;"|caption2
3834 |+ style="color: red;"| caption3
3835 |-
3836 | foo
3837 |}
3838 !! result
3839 <table>
3840 <caption style="color: red;">caption2
3841 </caption>
3842 <caption style="color: red;"> caption3
3843 </caption>
3844 <tr>
3845 <td> foo
3846 </td></tr></table>
3847
3848 !! end
3849
3850 !! test
3851 Table td-cell syntax variations
3852 !! input
3853 {|
3854 | foo bar foo | baz
3855 | foo bar foo || baz
3856 | style='color:red;' | baz
3857 | style='color:red;' || baz
3858 |}
3859 !! result
3860 <table>
3861 <tr>
3862 <td> baz
3863 </td>
3864 <td> foo bar foo </td>
3865 <td> baz
3866 </td>
3867 <td style="color:red;"> baz
3868 </td>
3869 <td> style='color:red;' </td>
3870 <td> baz
3871 </td></tr></table>
3872
3873 !! end
3874
3875 !! test
3876 Simple table
3877 !! input
3878 {|
3879 | 1 || 2
3880 |-
3881 | 3 || 4
3882 |}
3883 !! result
3884 <table>
3885 <tr>
3886 <td> 1 </td>
3887 <td> 2
3888 </td></tr>
3889 <tr>
3890 <td> 3 </td>
3891 <td> 4
3892 </td></tr></table>
3893
3894 !! end
3895
3896 !! test
3897 Simple table but with multiple dashes for row wikitext
3898 !! input
3899 {|
3900 | foo
3901 |-----
3902 | bar
3903 |}
3904 !! result
3905 <table>
3906 <tr>
3907 <td> foo
3908 </td></tr>
3909 <tr>
3910 <td> bar
3911 </td></tr></table>
3912
3913 !! end
3914 !! test
3915 Multiplication table
3916 !! input
3917 {| border="1" cellpadding="2"
3918 |+Multiplication table
3919 |-
3920 ! &times; !! 1 !! 2 !! 3
3921 |-
3922 ! 1
3923 | 1 || 2 || 3
3924 |-
3925 ! 2
3926 | 2 || 4 || 6
3927 |-
3928 ! 3
3929 | 3 || 6 || 9
3930 |-
3931 ! 4
3932 | 4 || 8 || 12
3933 |-
3934 ! 5
3935 | 5 || 10 || 15
3936 |}
3937 !! result
3938 <table border="1" cellpadding="2">
3939 <caption>Multiplication table
3940 </caption>
3941 <tr>
3942 <th> &#215; </th>
3943 <th> 1 </th>
3944 <th> 2 </th>
3945 <th> 3
3946 </th></tr>
3947 <tr>
3948 <th> 1
3949 </th>
3950 <td> 1 </td>
3951 <td> 2 </td>
3952 <td> 3
3953 </td></tr>
3954 <tr>
3955 <th> 2
3956 </th>
3957 <td> 2 </td>
3958 <td> 4 </td>
3959 <td> 6
3960 </td></tr>
3961 <tr>
3962 <th> 3
3963 </th>
3964 <td> 3 </td>
3965 <td> 6 </td>
3966 <td> 9
3967 </td></tr>
3968 <tr>
3969 <th> 4
3970 </th>
3971 <td> 4 </td>
3972 <td> 8 </td>
3973 <td> 12
3974 </td></tr>
3975 <tr>
3976 <th> 5
3977 </th>
3978 <td> 5 </td>
3979 <td> 10 </td>
3980 <td> 15
3981 </td></tr></table>
3982
3983 !! end
3984
3985 !! test
3986 Accept "||" in table headings
3987 !! input
3988 {|
3989 !h1 || h2
3990 |}
3991 !! result
3992 <table>
3993 <tr>
3994 <th>h1 </th>
3995 <th> h2
3996 </th></tr></table>
3997
3998 !! end
3999
4000 !! test
4001 Accept "||" in indented table headings
4002 !! input
4003 :{|
4004 !h1 || h2
4005 |}
4006 !! result
4007 <dl><dd><table>
4008 <tr>
4009 <th>h1 </th>
4010 <th> h2
4011 </th></tr></table></dd></dl>
4012
4013 !! end
4014
4015 !! test
4016 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4017 !! input
4018 {|
4019 !| h1
4020 || a
4021 |}
4022 !! result
4023 <table>
4024 <tr>
4025 <th> h1
4026 </th>
4027 <td> a
4028 </td></tr></table>
4029
4030 !! end
4031
4032 !!test
4033 Accept "| !" at start of line in tables (ignore !-attribute)
4034 !!input
4035 {|
4036 |-
4037 | !style="color:red" | bar
4038 |}
4039 !!result
4040 <table>
4041
4042 <tr>
4043 <td> bar
4044 </td></tr></table>
4045
4046 !!end
4047
4048 !!test
4049 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
4050 !!input
4051 {|
4052 |-
4053 |style='color:red;'|+1
4054 |style='color:blue;'|-1
4055 |-
4056 | 1 || 2 || 3
4057 | 1 ||+2 ||-3
4058 |-
4059 | +1
4060 | -1
4061 |}
4062 !!result
4063 <table>
4064
4065 <tr>
4066 <td style="color:red;">+1
4067 </td>
4068 <td style="color:blue;">-1
4069 </td></tr>
4070 <tr>
4071 <td> 1 </td>
4072 <td> 2 </td>
4073 <td> 3
4074 </td>
4075 <td> 1 </td>
4076 <td>+2 </td>
4077 <td>-3
4078 </td></tr>
4079 <tr>
4080 <td> +1
4081 </td>
4082 <td> -1
4083 </td></tr></table>
4084
4085 !!end
4086
4087 !! test
4088 Table rowspan
4089 !! input
4090 {| border=1
4091 | Cell 1, row 1
4092 |rowspan=2| Cell 2, row 1 (and 2)
4093 | Cell 3, row 1
4094 |-
4095 | Cell 1, row 2
4096 | Cell 3, row 2
4097 |}
4098 !! result
4099 <table border="1">
4100 <tr>
4101 <td> Cell 1, row 1
4102 </td>
4103 <td rowspan="2"> Cell 2, row 1 (and 2)
4104 </td>
4105 <td> Cell 3, row 1
4106 </td></tr>
4107 <tr>
4108 <td> Cell 1, row 2
4109 </td>
4110 <td> Cell 3, row 2
4111 </td></tr></table>
4112
4113 !! end
4114
4115 !! test
4116 Nested table
4117 !! input
4118 {| border=1
4119 | &alpha;
4120 |
4121 {| bgcolor=#ABCDEF border=2
4122 |nested
4123 |-
4124 |table
4125 |}
4126 |the original table again
4127 |}
4128 !! result
4129 <table border="1">
4130 <tr>
4131 <td> &#945;
4132 </td>
4133 <td>
4134 <table bgcolor="#ABCDEF" border="2">
4135 <tr>
4136 <td>nested
4137 </td></tr>
4138 <tr>
4139 <td>table
4140 </td></tr></table>
4141 </td>
4142 <td>the original table again
4143 </td></tr></table>
4144
4145 !! end
4146
4147 !! test
4148 Invalid attributes in table cell (bug 1830)
4149 !! input
4150 {|
4151 |Cell:|broken
4152 |}
4153 !! result
4154 <table>
4155 <tr>
4156 <td>broken
4157 </td></tr></table>
4158
4159 !! end
4160
4161
4162 !! test
4163 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
4164 !! input
4165 {|
4166 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
4167 !! result
4168 <table>
4169 <tr>
4170 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
4171 <td>]" onmouseover="alert(document.cookie)"&gt;test
4172 </td>
4173 </tr>
4174 </table>
4175
4176 !! end
4177
4178
4179 !! test
4180 Indented table markup mixed with indented pre content (proposed in bug 6200)
4181 !! input
4182 <table>
4183 <tr>
4184 <td>
4185 Text that should be rendered preformatted
4186 </td>
4187 </tr>
4188 </table>
4189 !! result
4190 <table>
4191 <tr>
4192 <td>
4193 <pre>Text that should be rendered preformatted
4194 </pre>
4195 </td>
4196 </tr>
4197 </table>
4198
4199 !! end
4200
4201 !! test
4202 Template-generated table cell attributes and cell content
4203 !! input
4204 {|
4205 |{{table_attribs}}
4206 | {{table_attribs}}
4207 |}
4208 !! result
4209 <table>
4210 <tr>
4211 <td style="color: red"> Foo
4212 </td>
4213 <td style="color: red"> Foo
4214 </td></tr></table>
4215
4216 !! end
4217
4218 !! test
4219 Template-generated table cell attributes and cell content (2)
4220 !! input
4221 {|
4222 |align=center {{table_attribs}}
4223 |}
4224 !! result
4225 <table>
4226 <tr>
4227 <td align="center" style="color: red"> Foo
4228 </td></tr></table>
4229
4230 !! end
4231
4232 !! test
4233 Template-generated table cell attributes and cell content (3)
4234 !! input
4235 {|
4236 |align=center {{table_cells}}
4237 |}
4238 !! result
4239 <table>
4240 <tr>
4241 <td align="center" style="color: red"> Foo </td>
4242 <td> Bar </td>
4243 <td> Baz
4244 </td></tr></table>
4245
4246 !! end
4247
4248 !! test
4249 Table with row followed by newlines and table heading
4250 !! input
4251 {|
4252 |-
4253
4254 ! foo
4255 |}
4256 !! result
4257 <table>
4258
4259
4260 <tr>
4261 <th> foo
4262 </th></tr></table>
4263
4264 !! end
4265
4266 !! test
4267 Table with empty line following the start tag
4268 !! input
4269 {|
4270
4271 |-
4272 | foo
4273 |}
4274 !! result
4275 <table>
4276
4277
4278 <tr>
4279 <td> foo
4280 </td></tr></table>
4281
4282 !! end
4283
4284 # FIXME: Preserve the attribute properly (with an empty string as value) in
4285 # the PHP parser. Parsoid implements the behavior below.
4286 !! test
4287 Table attributes with empty value
4288 !! options
4289 parsoid
4290 !! input
4291 {|
4292 | style=| hello
4293 |}
4294 !! result
4295 <table>
4296 <tbody>
4297 <tr>
4298 <td style=""> hello
4299 </td></tr></tbody></table>
4300
4301 !! end
4302
4303 !! test
4304 Wikitext table with a lot of comments
4305 !! input
4306 {|
4307 <!-- c0 -->
4308 | foo
4309 <!-- c1 -->
4310 |- <!-- c2 -->
4311 <!-- c3 -->
4312 |<!-- c4 -->
4313 <!-- c5 -->
4314 |}
4315 !! result
4316 <table>
4317 <tr>
4318 <td> foo
4319 </td></tr>
4320 <tr>
4321 <td>
4322 </td></tr></table>
4323
4324 !! end
4325
4326 !! test
4327 Wikitext table with double-line table cell
4328 !! input
4329 {|
4330 |a
4331 b
4332 |}
4333 !! result
4334 <table>
4335 <tr>
4336 <td>a
4337 <p>b
4338 </p>
4339 </td></tr></table>
4340
4341 !! end
4342
4343 !! test
4344 Table cell with a single comment
4345 !! input
4346 {|
4347 | <!-- c1 -->
4348 | a
4349 |}
4350 !! result
4351 <table>
4352 <tr>
4353 <td>
4354 </td>
4355 <td> a
4356 </td></tr></table>
4357
4358 !! end
4359
4360 # The expected HTML structure in this test is debatable. The PHP parser does
4361 # not parse this kind of table at all. The main focus for Parsoid is on
4362 # round-tripping, so this output is ok for now. TODO: revisit!
4363 !! test
4364 Wikitext table with html-syntax row (Parsoid)
4365 !! options
4366 parsoid
4367 !! input
4368 {|
4369 |-
4370 <td>foo</td>
4371 |}
4372 !! result
4373 <table>
4374 <tbody>
4375 <tr>
4376 <td>foo</td></tr></tbody></table>
4377 !! end
4378
4379 !! test
4380 Implicit <td> after a |-
4381 (PHP parser relies on Tidy to add the missing <td> tags)
4382 !! options
4383 parsoid=wt2html,wt2wt
4384 !! input
4385 {|
4386 |-
4387 a
4388 |}
4389 !! result
4390 <table>
4391 <tr><td>a</td></tr>
4392 </table>
4393 !! end
4394
4395 !! test
4396 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4397 (PHP parser relies on Tidy to add the missing <td> tags)
4398 !! options
4399 parsoid=wt2html,wt2wt
4400 !! input
4401 {|
4402 |-
4403 |
4404 a
4405 |-
4406 b
4407 |}
4408 !! result
4409 <table>
4410 <tbody>
4411 <tr><td><pre>a</pre></td></tr>
4412 <tr><td> b</td></tr>
4413 </tbody>
4414 </table>
4415 !! end
4416
4417 !! test
4418 Lists should be recognized in an implicit <td> context
4419 (PHP parser relies on Tidy to add the missing <td> tags)
4420 !! options
4421 parsoid=wt2html,wt2wt
4422 !! input
4423 {|
4424 |-
4425 *a
4426 |}
4427 !! result
4428 <table>
4429 <tr>
4430 <td><ul><li>a</li></ul></td>
4431 </tr>
4432 </table>
4433 !! end
4434
4435 !! test
4436 Parsoid: Round-trip tables directly followed by content (bug 51219)
4437 !! options
4438 parsoid=wt2html,wt2wt
4439 !! input
4440 {|
4441 |foo
4442 |} bar
4443
4444 {|
4445 |baz
4446 |}<b>quux</b>
4447 !! result
4448 <table><tbody>
4449 <tr>
4450 <td>foo</td></tr></tbody></table> bar
4451 <table>
4452 <tbody>
4453 <tr>
4454 <td>baz</td></tr></tbody></table><b>quux</b>
4455 !! end
4456
4457 !! test
4458 Parsoid: Default to a newline after tables in new content (bug 51219)
4459 !! options
4460 parsoid=html2wt
4461 !! input
4462 {|
4463 |foo
4464 |}
4465 <nowiki> </nowiki>bar
4466 {|
4467 |baz
4468 |}
4469 '''quux'''
4470 !! result
4471 <table><tbody>
4472 <tr><td>foo</td></tr></tbody></table> bar
4473 <table><tbody>
4474 <tr><td>baz</td></tr></tbody></table><b>quux</b>
4475 !! end
4476
4477 ###
4478 ### Internal links
4479 ###
4480 !! test
4481 Plain link, capitalized
4482 !! input
4483 [[Main Page]]
4484 !! result
4485 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4486 </p>
4487 !! end
4488
4489 !! test
4490 Plain link, uncapitalized
4491 !! input
4492 [[main Page]]
4493 !! result
4494 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4495 </p>
4496 !! end
4497
4498 !! test
4499 Piped link
4500 !! input
4501 [[Main Page|The Main Page]]
4502 !! result
4503 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4504 </p>
4505 !! end
4506
4507 !! test
4508 Piped link with comment in link text
4509 !! input
4510 [[Main Page|The Main<!--front--> Page]]
4511 !! result
4512 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4513 </p>
4514 !! end
4515
4516 !! test
4517 Broken link
4518 !! input
4519 [[Zigzagzogzagzig]]
4520 !! result
4521 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4522 </p>
4523 !! end
4524
4525 !! test
4526 Broken link with fragment
4527 !! input
4528 [[Zigzagzogzagzig#zug]]
4529 !! result
4530 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4531 </p>
4532 !! end
4533
4534 !! test
4535 Special page link with fragment
4536 !! input
4537 [[Special:Version#anchor]]
4538 !! result
4539 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4540 </p>
4541 !! end
4542
4543 !! test
4544 Nonexistent special page link with fragment
4545 !! input
4546 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4547 !! result
4548 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4549 </p>
4550 !! end
4551
4552 !! test
4553 Link with prefix
4554 !! input
4555 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4556 !! result
4557 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4558 </p>
4559 !! end
4560
4561 !! test
4562 Link with suffix
4563 !! input
4564 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4565 !! result
4566 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
4567 </p>
4568 !! end
4569
4570 !! article
4571 prefixed article
4572 !! text
4573 Some text
4574 !! endarticle
4575
4576 !! test
4577 Bug 43661: Piped links with identical prefixes
4578 !! input
4579 [[prefixed article|prefixed articles with spaces]]
4580
4581 [[prefixed article|prefixed articlesaoeu]]
4582
4583 [[Main Page|Main Page test]]
4584 !! result
4585 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4586 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4587 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4588 </p>
4589 !! end
4590
4591
4592 !! test
4593 Link with HTML entity in suffix / tail
4594 !! input
4595 [[Main Page]]&quot;, [[Main Page]]&#97;
4596 !! result
4597 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
4598 </p>
4599 !! end
4600
4601 !! test
4602 Link with 3 brackets
4603 !! input
4604 [[[main page]]]
4605 !! result
4606 <p>[[[main page]]]
4607 </p>
4608 !! end
4609
4610 !! test
4611 Piped link with 3 brackets
4612 !! input
4613 [[[main page|the main page]]]
4614 !! result
4615 <p>[[[main page|the main page]]]
4616 </p>
4617 !! end
4618
4619 !! test
4620 Link with multiple pipes
4621 !! input
4622 [[Main Page|The|Main|Page]]
4623 !! result
4624 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4625 </p>
4626 !! end
4627
4628 !! test
4629 Link to namespaces
4630 !! input
4631 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4632 !! result
4633 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
4634 </p>
4635 !! end
4636
4637 !! article
4638 MemoryAlpha:AlphaTest
4639 !! text
4640 This is an article in the MemoryAlpha namespace
4641 (which shadows the memoryalpha interwiki link).
4642 !! endarticle
4643
4644 !! test
4645 Namespace takes precedence over interwiki link (bug 51680)
4646 !! input
4647 [[MemoryAlpha:AlphaTest]]
4648 !! result
4649 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
4650 </p>
4651 !! end
4652
4653 !! test
4654 Piped link to namespace
4655 !! input
4656 [[Meta:Disclaimers|The disclaimers]]
4657 !! result
4658 <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>
4659 </p>
4660 !! end
4661
4662 !! test
4663 Link containing }
4664 !! input
4665 [[Usually caused by a typo (oops}]]
4666 !! result
4667 <p>[[Usually caused by a typo (oops}]]
4668 </p>
4669 !! end
4670
4671 !! test
4672 Link containing % (not as a hex sequence)
4673 !! input
4674 [[7% Solution]]
4675 !! result
4676 <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>
4677 </p>
4678 !! end
4679
4680 !! test
4681 Link containing % as a single hex sequence interpreted to char
4682 !! input
4683 [[7%25 Solution]]
4684 !! result
4685 <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>
4686 </p>
4687 !!end
4688
4689 !! test
4690 Link containing % as a double hex sequence interpreted to hex sequence
4691 !! input
4692 [[7%2525 Solution]]
4693 !! result
4694 <p>[[7%2525 Solution]]
4695 </p>
4696 !!end
4697
4698 !! test
4699 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4700 Example for such a section: == < ==
4701 !! input
4702 [[%23%3c]][[%23%3e]]
4703 !! result
4704 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4705 </p>
4706 !! end
4707
4708 !! test
4709 Link containing "<#" and ">#" as a hex sequences
4710 !! input
4711 [[%3c%23]][[%3e%23]]
4712 !! result
4713 <p>[[%3c%23]][[%3e%23]]
4714 </p>
4715 !! end
4716
4717 !! test
4718 Link containing an equals sign
4719 !! input
4720 [[Special:BookSources/isbn=4-00-026157-6]]
4721 !! result
4722 <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>
4723 </p>
4724 !! end
4725
4726 !! article
4727 Foo~bar
4728 !! text
4729 Just a test of an article title containing a tilde.
4730 !! endarticle
4731
4732 # note that links containing signatures, like [[Foo~~~~]], are
4733 # massaged by the pre-save transform (PST) and so the tildes are never
4734 # seen by the parser.
4735 !! test
4736 Link containing a tilde
4737 !! input
4738 [[Foo~bar]]
4739 !! result
4740 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4741 </p>
4742 !! end
4743
4744 !! test
4745 Link containing double-single-quotes '' (bug 4598)
4746 !! input
4747 [[Lista d''e paise d''o munno]]
4748 !! result
4749 <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>
4750 </p>
4751 !! end
4752
4753 !! test
4754 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4755 !! input
4756 Some [[Link|pretty ''italics'' and stuff]]!
4757 !! result
4758 <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>!
4759 </p>
4760 !! end
4761
4762 !! test
4763 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4764 !! input
4765 ''Some [[Link|pretty ''italics'' and stuff]]!
4766 !! result
4767 <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>
4768 </p>
4769 !! end
4770
4771 !! test
4772 Link with double quotes in title part (literal) and alternate part (interpreted)
4773 !! input
4774 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4775
4776 [[''Pentecoste'']]
4777
4778 [[''Pentecoste''|Pentecoste]]
4779
4780 [[''Pentecoste''|''Pentecoste'']]
4781 !! result
4782 <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>
4783 </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>
4784 </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>
4785 </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>
4786 </p>
4787 !! end
4788
4789 !! test
4790 Broken image links with HTML captions (bug 39700)
4791 !! input
4792 [[File:Nonexistent|<script></script>]]
4793 [[File:Nonexistent|100px|<script></script>]]
4794 [[File:Nonexistent|&lt;]]
4795 [[File:Nonexistent|a<i>b</i>c]]
4796 !! result
4797 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4798 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4799 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4800 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4801 </p>
4802 !! end
4803
4804 !! test
4805 Plain link to URL
4806 !! input
4807 [[http://www.example.com]]
4808 !! result
4809 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4810 </p>
4811 !! end
4812
4813 !! test
4814 Plain link to URL with link text
4815 !! input
4816 [[http://www.example.com Link text]]
4817 !! result
4818 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4819 </p>
4820 !! end
4821
4822 !! test
4823 Plain link to protocol-relative URL
4824 !! input
4825 [[//www.example.com]]
4826 !! result
4827 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4828 </p>
4829 !! end
4830
4831 !! test
4832 Plain link to protocol-relative URL with link text
4833 !! input
4834 [[//www.example.com Link text]]
4835 !! result
4836 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4837 </p>
4838 !! end
4839
4840 !! test
4841 Plain link to page with question mark in title
4842 !! input
4843 [[A?b]]
4844
4845 [[A?b|Baz]]
4846 !! result
4847 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4848 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4849 </p>
4850 !! end
4851
4852
4853 # I'm fairly sure the expected result here is wrong.
4854 # We want these to be URL links, not pseudo-pages with URLs for titles....
4855 # However the current output is also pretty screwy.
4856 #
4857 # ----
4858 # I'm changing it to match the current output--it arguably makes more
4859 # sense in the light of the test above. Old expected result was:
4860 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4861 #</p>
4862 # But I think this test is bordering on "garbage in, garbage out" anyway.
4863 # -- wtm
4864 !! test
4865 Piped link to URL
4866 !! input
4867 Piped link to URL: [[http://www.example.com|an example URL]]
4868 !! result
4869 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4870 </p>
4871 !! end
4872
4873 !! test
4874 BUG 2: [[page|http://url/]] should link to page, not http://url/
4875 !! input
4876 [[Main Page|http://url/]]
4877 !! result
4878 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4879 </p>
4880 !! end
4881
4882 !! test
4883 BUG 337: Escaped self-links should be bold
4884 !! options
4885 title=[[Bug462]]
4886 !! input
4887 [[Bu&#103;462]] [[Bug462]]
4888 !! result
4889 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4890 </p>
4891 !! end
4892
4893 !! test
4894 Self-link to section should not be bold
4895 !! options
4896 title=[[Main Page]]
4897 !! input
4898 [[Main Page#section]]
4899 !! result
4900 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4901 </p>
4902 !! end
4903
4904 !! article
4905 00
4906 !! text
4907 This is 00.
4908 !! endarticle
4909
4910 !!test
4911 Self-link to numeric title
4912 !!options
4913 title=[[0]]
4914 !!input
4915 [[0]]
4916 !!result
4917 <p><strong class="selflink">0</strong>
4918 </p>
4919 !!end
4920
4921 !!test
4922 Link to numeric-equivalent title
4923 !!options
4924 title=[[0]]
4925 !!input
4926 [[00]]
4927 !!result
4928 <p><a href="/wiki/00" title="00">00</a>
4929 </p>
4930 !!end
4931
4932 !! test
4933 <nowiki> inside a link
4934 !! input
4935 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4936 !! result
4937 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4938 </p>
4939 !! end
4940
4941 !! test
4942 Non-breaking spaces in title
4943 !! input
4944 [[&nbsp; Main &nbsp; Page &nbsp;]]
4945 !! result
4946 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4947 </p>
4948 !!end
4949
4950 !! test
4951 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4952 !! options
4953 language=ca
4954 !! input
4955 '''[[Main Page]]'''
4956 !! result
4957 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4958 </p>
4959 !! end
4960
4961 !! test
4962 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4963 !! options
4964 language=ca
4965 !! input
4966 ''[[Main Page]]''
4967 !! result
4968 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4969 </p>
4970 !! end
4971
4972 !! test
4973 Internal link with en linktrail: no apostrophes (bug 27473)
4974 !! options
4975 language=en
4976 !! input
4977 [[Something]]'nice
4978 !! result
4979 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4980 </p>
4981 !! end
4982
4983 !! test
4984 Internal link with ca linktrail with apostrophes (bug 27473)
4985 !! options
4986 language=ca
4987 !! input
4988 [[Something]]'nice
4989 !! result
4990 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4991 </p>
4992 !! end
4993
4994 !! test
4995 Internal link with kaa linktrail with apostrophes (bug 27473)
4996 !! options
4997 language=kaa
4998 !! input
4999 [[Something]]'nice
5000 !! result
5001 <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>
5002 </p>
5003 !! end
5004
5005 !! article
5006 Söfnuður
5007 !! text
5008 Test.
5009 !! endarticle
5010
5011 !! test
5012 Internal link with is link prefix
5013 !! options
5014 language=is
5015 !! input
5016 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
5017 !! result
5018 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
5019 </p>
5020 !! end
5021
5022 !! article
5023 Mótmælendatrú
5024 !! text
5025 Test.
5026 !! endarticle
5027
5028 !! test
5029 Internal link with is link trail and link prefix
5030 !! options
5031 language=is
5032 !! input
5033 [[mótmælendatrú|xxx]]ar
5034 [[mótmælendatrú]]ar
5035 mótmælenda[[söfnuður]]
5036 mótmælenda[[söfnuður|söfnuðir]]
5037 mótmælenda[[söfnuður|söfnuðir]]xxx
5038 !! result
5039 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
5040 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
5041 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
5042 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
5043 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
5044 </p>
5045 !! end
5046
5047 !! test
5048 Parsoid link trail escaping
5049 !! options
5050 parsoid=html2wt,html2html
5051 !! input
5052 [[apple]]<nowiki/>s
5053 !! result
5054 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
5055 !! end
5056
5057 !! test
5058 Parsoid link prefix escaping
5059 !! options
5060 language=is
5061 parsoid=html2wt,html2html
5062 !! input
5063 Aðrir mótmælenda<nowiki/>[[söfnuður]]
5064 !! result
5065 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
5066 !! end
5067
5068 !! test
5069 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
5070 !! input
5071 [[Foo| bar]]
5072
5073 [[Foo| ''bar'']]
5074
5075 [http://wp.org foo]
5076
5077 [http://wp.org ''foo'']
5078 !! result
5079 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
5080 </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>
5081 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
5082 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
5083 </p>
5084 !! end
5085
5086 ###
5087 ### Interwiki links (see maintenance/interwiki.sql)
5088 ###
5089
5090 !! test
5091 Inline interwiki link
5092 !! input
5093 [[MeatBall:SoftSecurity]]
5094 !! result
5095 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
5096 </p>
5097 !! end
5098
5099 !! test
5100 Inline interwiki link with empty title (bug 2372)
5101 !! input
5102 [[MeatBall:]]
5103 !! result
5104 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
5105 </p>
5106 !! end
5107
5108 !! test
5109 Interwiki link encoding conversion (bug 1636)
5110 !! input
5111 *[[Wikipedia:ro:Olteni&#0355;a]]
5112 *[[Wikipedia:ro:Olteni&#355;a]]
5113 !! result
5114 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
5115 </li><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
5116 </li></ul>
5117
5118 !! end
5119
5120 !! test
5121 Interwiki link with fragment (bug 2130)
5122 !! input
5123 [[MeatBall:SoftSecurity#foo]]
5124 !! result
5125 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
5126 </p>
5127 !! end
5128
5129
5130 ###
5131 ### Interlanguage links
5132 ### Language links (so that searching for '### language' matches..)
5133 ###
5134
5135 !! test
5136 Interlanguage link
5137 !! input
5138 Blah blah blah
5139 [[zh:Chinese]]
5140 !!result
5141 <p>Blah blah blah
5142 </p>
5143 !! end
5144
5145 !! test
5146 Double interlanguage link
5147 !! input
5148 Blah blah blah
5149 [[es:Spanish]]
5150 [[zh:Chinese]]
5151 !!result
5152 <p>Blah blah blah
5153 </p>
5154 !! end
5155
5156 !! test
5157 Interlanguage link, with prefix links
5158 !! options
5159 language=ln
5160 !! input
5161 Blah blah blah
5162 [[zh:Chinese]]
5163 !!result
5164 <p>Blah blah blah
5165 </p>
5166 !! end
5167
5168 !! test
5169 Double interlanguage link, with prefix links (bug 8897)
5170 !! options
5171 language=ln
5172 !! input
5173 Blah blah blah
5174 [[es:Spanish]]
5175 [[zh:Chinese]]
5176 !!result
5177 <p>Blah blah blah
5178 </p>
5179 !! end
5180
5181 !! test
5182 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
5183 !! options
5184 language=ln
5185 !! input
5186 [[WW&nbsp;II]]
5187 !!result
5188 <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>
5189 </p>
5190 !! end
5191
5192 !! test
5193 Parsoid bug 53221: Wikilinks should be properly entity-escaped
5194 !! options
5195 parsoid=html2wt
5196 !! input
5197 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
5198
5199 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
5200 !!result
5201 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5202 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5203 !! end
5204
5205 !! test
5206 Parsoid: handle constructor well
5207 !! options
5208 parsoid
5209 !! input
5210 [[constructor]]
5211
5212 [[constructor:foo]]
5213 !! result
5214 <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>
5215
5216
5217 <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>
5218 !! end
5219
5220 !! test
5221 Parsoid: recognize interlanguage links without a target page
5222 !! options
5223 parsoid
5224 !! input
5225 [[ko:]]
5226 !! result
5227 <p>
5228 <link rel="mw:WikiLink/Language" href="http://ko.wikipedia.org/wiki/"></p>
5229 !! end
5230
5231 !! test
5232 Parsoid: recognize interwiki links without a target page
5233 !! options
5234 parsoid
5235 !! input
5236 [[:ko:]]
5237 !! result
5238 <p><a rel="mw:WikiLink/Interwiki" href="http://ko.wikipedia.org/wiki/">ko:</a></p>
5239 !! end
5240
5241 ###
5242 ### Redirects, Parsoid-only
5243 ###
5244 !! test
5245 Simple redirect to page
5246 !! options
5247 parsoid
5248 !! input
5249 #REDIRECT [[Main Page]]
5250 !! result
5251 <link rel="mw:PageProp/redirect" href="./Main_Page">
5252 !! end
5253
5254 !! test
5255 Optional colon in #REDIRECT
5256 !! options
5257 # the colon is archaic syntax. we support it for wt2html, but we
5258 # don't care that it roundtrips back to the modern syntax.
5259 parsoid=wt2html,html2html
5260 !! input
5261 #REDIRECT:[[Main Page]]
5262 !! result
5263 <link rel="mw:PageProp/redirect" href="./Main_Page">
5264 !! end
5265
5266 !! test
5267 Whitespace in #REDIRECT with optional colon
5268 !! options
5269 # the colon and gratuitous whitespace is archaic syntax. we support
5270 # it for wt2html, but we don't care that it roundtrips back to the
5271 # modern syntax (without extra whitespace)
5272 parsoid=wt2html,html2html
5273 !! input
5274
5275 #REDIRECT
5276 :
5277 [[Main Page]]
5278 !! result
5279 <link rel="mw:PageProp/redirect" href="./Main_Page">
5280 !! end
5281
5282 !! test
5283 Piped link in #REDIRECT
5284 !! options
5285 # content after piped link is ignored. we support this syntax,
5286 # but don't care that the piped link is lost when we roundtrip this.
5287 parsoid=wt2html
5288 !! input
5289 #REDIRECT [[Main Page|bar]]
5290 !! result
5291 <link rel="mw:PageProp/redirect" href="./Main_Page">
5292 !! end
5293
5294 !! test
5295 Redirect to category
5296 !! options
5297 parsoid=wt2html
5298 !! input
5299 #REDIRECT [[Category:Foo]]
5300 !! result
5301 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
5302 !! end
5303
5304 !! test
5305 Redirect to category with URL encoding
5306 !! options
5307 parsoid=wt2html
5308 !! input
5309 #REDIRECT [[Category%3AFoo]]
5310 !! result
5311 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
5312 !! end
5313
5314 !! test
5315 Redirect to category page
5316 !! options
5317 parsoid=wt2html,html2html
5318 !! input
5319 #REDIRECT [[:Category:Foo]]
5320 !! result
5321 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
5322 !! end
5323
5324 !! test
5325 Redirect to image page (1)
5326 !! options
5327 parsoid
5328 !! input
5329 #REDIRECT [[File:Wiki.png]]
5330 !! result
5331 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5332 !! end
5333
5334 !! test
5335 Redirect to image page (2)
5336 !! options
5337 parsoid
5338 !! input
5339 #REDIRECT [[Image:Wiki.png]]
5340 !! result
5341 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5342 !! end
5343
5344 !! test
5345 Redirect to language
5346 !! options
5347 parsoid
5348 !! input
5349 #REDIRECT [[en:File:Wiki.png]]
5350 !! result
5351 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5352 !! end
5353
5354 !! test
5355 Redirect to interwiki
5356 !! options
5357 parsoid
5358 !! input
5359 #REDIRECT [[meatball:File:Wiki.png]]
5360 !! result
5361 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5362 !! end
5363
5364 !! test
5365 Non-English #REDIRECT
5366 !! options
5367 parsoid
5368 language=is
5369 !! input
5370 #TILVÍSUN [[Main Page]]
5371 !! result
5372 <link rel="mw:PageProp/redirect" href="./Main_Page">
5373 !! end
5374
5375 ##
5376 ## XHTML tidiness
5377 ###
5378
5379 !! test
5380 <br> to <br />
5381 !! input
5382 1<br>2<br />3
5383 !! result
5384 <p>1<br />2<br />3
5385 </p>
5386 !! end
5387
5388 !! test
5389 Broken br tag sanitization
5390 !! options
5391 php
5392 !! input
5393 </br>
5394 !! result
5395 <p>&lt;/br&gt;
5396 </p>
5397 !! end
5398
5399 # TODO: Fix html2html mode (bug 51055)!
5400 !! test
5401 Parsoid: Broken br tag recognition
5402 !! options
5403 parsoid=wt2html
5404 !! input
5405 </br>
5406 !! result
5407 <p><br></p>
5408 !! end
5409
5410 !! test
5411 Incorrecly removing closing slashes from correctly formed XHTML
5412 !! input
5413 <br style="clear:both;" />
5414 !! result
5415 <p><br style="clear:both;" />
5416 </p>
5417 !! end
5418
5419 !! test
5420 Failing to transform badly formed HTML into correct XHTML
5421 !! input
5422 <br style="clear: left;">
5423 <br style="clear: right;">
5424 <br style="clear: both;">
5425 !! result
5426 <p><br style="clear: left;" />
5427 <br style="clear: right;" />
5428 <br style="clear: both;" />
5429 </p>
5430 !!end
5431
5432 !! test
5433 Handling html with a div self-closing tag
5434 !! input
5435 <div title />
5436 <div title/>
5437 <div title/ >
5438 <div title=bar />
5439 <div title=bar/>
5440 <div title=bar/ >
5441 !! result
5442 <p>&lt;div title /&gt;
5443 &lt;div title/&gt;
5444 </p>
5445 <div>
5446 <p>&lt;div title=bar /&gt;
5447 &lt;div title=bar/&gt;
5448 </p>
5449 <div title="bar/"></div>
5450 </div>
5451
5452 !! end
5453
5454 !! test
5455 Handling html with a br self-closing tag
5456 !! input
5457 <br title />
5458 <br title/>
5459 <br title/ >
5460 <br title=bar />
5461 <br title=bar/>
5462 <br title=bar/ >
5463 !! result
5464 <p><br title="title" />
5465 <br title="title" />
5466 <br />
5467 <br title="bar" />
5468 <br title="bar" />
5469 <br title="bar/" />
5470 </p>
5471 !! end
5472
5473 !! test
5474 Horizontal ruler (should it add that extra space?)
5475 !! input
5476 <hr>
5477 <hr >
5478 foo <hr
5479 > bar
5480 !! result
5481 <hr />
5482 <hr />
5483 foo <hr /> bar
5484
5485 !! end
5486
5487 !! test
5488 Horizontal ruler -- 4+ dashes render hr
5489 !! input
5490 ----
5491 !! result
5492 <hr />
5493
5494 !! end
5495
5496 !! test
5497 Horizontal ruler -- eats additional dashes on the same line
5498 !! input
5499 ---------
5500 !! result
5501 <hr />
5502
5503 !! end
5504
5505 !! test
5506 Horizontal ruler -- does not collapse dashes on consecutive lines
5507 !! input
5508 ----
5509 ----
5510 !! result
5511 <hr />
5512 <hr />
5513
5514 !! end
5515
5516 !! test
5517 Horizontal ruler -- <4 dashes render as plain text
5518 !! input
5519 ---
5520 !! result
5521 <p>---
5522 </p>
5523 !! end
5524
5525 !! test
5526 Horizontal ruler -- Supports content following dashes on same line
5527 !! input
5528 ---- Foo
5529 !! result
5530 <hr /> Foo
5531
5532 !! end
5533
5534 ###
5535 ### Block-level elements
5536 ###
5537 !! test
5538 Common list
5539 !! input
5540 *Common list
5541 * item 2
5542 *item 3
5543 !! result
5544 <ul><li>Common list
5545 </li><li> item 2
5546 </li><li>item 3
5547 </li></ul>
5548
5549 !! end
5550
5551 !! test
5552 Numbered list
5553 !! input
5554 #Numbered list
5555 #item 2
5556 # item 3
5557 !! result
5558 <ol><li>Numbered list
5559 </li><li>item 2
5560 </li><li> item 3
5561 </li></ol>
5562
5563 !! end
5564
5565 !! test
5566 Mixed list
5567 !! input
5568 *Mixed list
5569 *# with numbers
5570 ** and bullets
5571 *# and numbers
5572 *bullets again
5573 **bullet level 2
5574 ***bullet level 3
5575 ***#Number on level 4
5576 **bullet level 2
5577 **#Number on level 3
5578 **#Number on level 3
5579 *#number level 2
5580 *Level 1
5581 *** Level 3
5582 #** Level 3, but ordered
5583 !! result
5584 <ul><li>Mixed list
5585 <ol><li> with numbers
5586 </li></ol>
5587 <ul><li> and bullets
5588 </li></ul>
5589 <ol><li> and numbers
5590 </li></ol>
5591 </li><li>bullets again
5592 <ul><li>bullet level 2
5593 <ul><li>bullet level 3
5594 <ol><li>Number on level 4
5595 </li></ol>
5596 </li></ul>
5597 </li><li>bullet level 2
5598 <ol><li>Number on level 3
5599 </li><li>Number on level 3
5600 </li></ol>
5601 </li></ul>
5602 <ol><li>number level 2
5603 </li></ol>
5604 </li><li>Level 1
5605 <ul><li><ul><li> Level 3
5606 </li></ul>
5607 </li></ul>
5608 </li></ul>
5609 <ol><li><ul><li><ul><li> Level 3, but ordered
5610 </li></ul>
5611 </li></ul>
5612 </li></ol>
5613
5614 !! end
5615
5616 !! test
5617 Nested lists 1
5618 !! input
5619 *foo
5620 **bar
5621 !! result
5622 <ul><li>foo
5623 <ul><li>bar
5624 </li></ul>
5625 </li></ul>
5626
5627 !! end
5628
5629 !! test
5630 Nested lists 2
5631 !! input
5632 **foo
5633 *bar
5634 !! result
5635 <ul><li><ul><li>foo
5636 </li></ul>
5637 </li><li>bar
5638 </li></ul>
5639
5640 !! end
5641
5642 !! test
5643 Nested lists 3 (first element empty)
5644 !! input
5645 *
5646 **bar
5647 !! result
5648 <ul><li>
5649 <ul><li>bar
5650 </li></ul>
5651 </li></ul>
5652
5653 !! end
5654
5655 !! test
5656 Nested lists 4 (first element empty)
5657 !! input
5658 **
5659 *bar
5660 !! result
5661 <ul><li><ul><li>
5662 </li></ul>
5663 </li><li>bar
5664 </li></ul>
5665
5666 !! end
5667
5668 !! test
5669 Nested lists 5 (both elements empty)
5670 !! input
5671 **
5672 *
5673 !! result
5674 <ul><li><ul><li>
5675 </li></ul>
5676 </li><li>
5677 </li></ul>
5678
5679 !! end
5680
5681 !! test
5682 Nested lists 6 (both elements empty)
5683 !! input
5684 *
5685 **
5686 !! result
5687 <ul><li>
5688 <ul><li>
5689 </li></ul>
5690 </li></ul>
5691
5692 !! end
5693
5694 !! test
5695 Nested lists 7 (skip initial nesting levels)
5696 !! input
5697 *** foo
5698 !! result
5699 <ul><li><ul><li><ul><li> foo
5700 </li></ul>
5701 </li></ul>
5702 </li></ul>
5703
5704 !! end
5705
5706 !! test
5707 Nested lists 8 (multiple nesting transitions)
5708 !! input
5709 * foo
5710 *** bar
5711 ** baz
5712 * boo
5713 !! result
5714 <ul><li> foo
5715 <ul><li><ul><li> bar
5716 </li></ul>
5717 </li><li> baz
5718 </li></ul>
5719 </li><li> boo
5720 </li></ul>
5721
5722 !! end
5723
5724 !! test
5725 1. Lists with start-of-line-transparent tokens before bullets: Comments
5726 !! input
5727 *foo
5728 *<!--cmt-->bar
5729 <!--cmt-->*baz
5730 !! result
5731 <ul><li>foo
5732 </li><li>bar
5733 </li><li>baz
5734 </li></ul>
5735
5736 !! end
5737
5738 !! test
5739 2. Lists with start-of-line-transparent tokens before bullets: Template close
5740 !! input
5741 *foo {{echo|bar
5742 }}*baz
5743 !! result
5744 <ul><li>foo bar
5745 </li><li>baz
5746 </li></ul>
5747
5748 !! end
5749
5750 !! test
5751 List items are not parsed correctly following a <pre> block (bug 785)
5752 !! input
5753 * <pre>foo</pre>
5754 * <pre>bar</pre>
5755 * zar
5756 !! result
5757 <ul><li> <pre>foo</pre>
5758 </li><li> <pre>bar</pre>
5759 </li><li> zar
5760 </li></ul>
5761
5762 !! end
5763
5764 !! test
5765 List items from template
5766 !! input
5767
5768 {{inner list}}
5769 * item 2
5770
5771 * item 0
5772 {{inner list}}
5773 * item 2
5774
5775 * item 0
5776 * notSOL{{inner list}}
5777 * item 2
5778 !! result
5779 <ul><li> item 1
5780 </li><li> item 2
5781 </li></ul>
5782 <ul><li> item 0
5783 </li><li> item 1
5784 </li><li> item 2
5785 </li></ul>
5786 <ul><li> item 0
5787 </li><li> notSOL
5788 </li><li> item 1
5789 </li><li> item 2
5790 </li></ul>
5791
5792 !! end
5793
5794 !! test
5795 List interrupted by empty line or heading
5796 !! input
5797 * foo
5798
5799 ** bar
5800 == A heading ==
5801 * Another list item
5802 !! result
5803 <ul><li> foo
5804 </li></ul>
5805 <ul><li><ul><li> bar
5806 </li></ul>
5807 </li></ul>
5808 <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>
5809 <ul><li> Another list item
5810 </li></ul>
5811
5812 !!end
5813
5814 !!test
5815 Multiple list tags generated by templates
5816 !!input
5817 {{echo|<li>}}a
5818 {{echo|<li>}}b
5819 {{echo|<li>}}c
5820 !!result
5821 <li>a
5822 <li>b
5823 <li>c</li>
5824 </li>
5825 </li>
5826
5827 !!end
5828
5829 !!test
5830 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
5831 !!input
5832 *a
5833 <!--This line will NOT split the list-->
5834 *b
5835 <!--This line will NOT split the list either-->
5836 *c
5837 <!--foo--> <!----> <!--This line NOT split the list either-->
5838 *d
5839 !!result
5840 <ul><li>a
5841 </li><li>b
5842 </li><li>c
5843 </li><li>d
5844 </li></ul>
5845
5846 !!end
5847
5848 !!test
5849 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
5850 !!input
5851 *a
5852 <!--This line will NOT split the list-->
5853 *b
5854 <!--This line will NOT split the list either-->
5855 *c
5856 <!--foo--> <!----> <!--This line NOT split the list
5857 either-->
5858 *d
5859 !!result
5860 <ul><li>a
5861 </li><li>b
5862 </li><li>c
5863 </li><li>d
5864 </li></ul>
5865
5866 !!end
5867
5868 !!test
5869 Test the li-hack
5870 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5871 !!options
5872 parsoid=wt2html,wt2wt
5873 !!input
5874 * foo
5875 * <li>li-hack
5876 * {{echo|<li>templated li-hack}}
5877 * <!--foo--> <li> unsupported li-hack with preceding comments
5878
5879 <ul>
5880 <li><li>not a li-hack
5881 </li>
5882 </ul>
5883 !!result
5884 <ul><li> foo</li>
5885 <li>li-hack</li>
5886 <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>
5887 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5888
5889 <ul>
5890 <li></li><li>not a li-hack
5891 </li>
5892 </ul>
5893 !!end
5894
5895 !! test
5896 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5897 !! options
5898 parsoid
5899 !! input
5900 # foo
5901 ## bar
5902 * foo
5903 ** bar
5904 : foo
5905 :: bar
5906 !! result
5907 <ol><li> foo<ol><li> bar</li></ol></li></ol><ul><li> foo<ul><li> bar</li></ul></li></ul><dl><dd> foo<dl><dd> bar</dd></dl></dd></dl>
5908 !! end
5909
5910 !! test
5911 Parsoid: Test of whitespace serialization with Templated bullets
5912 !! options
5913 parsoid
5914 !! input
5915 * {{bullet}}
5916 !! result
5917 <ul>
5918 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
5919 </ul>
5920 !! end
5921
5922 # ------------------------------------------------------------------------
5923 # The next set of tests are about Parsoid's ability to handle badly nested
5924 # tags (parse, minimize scope of fixup, and roundtrip back)
5925 # ------------------------------------------------------------------------
5926
5927 !! test
5928 Unbalanced closing block tags break a list
5929 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5930 !! options
5931 parsoid
5932 !! input
5933 <div>
5934 *a</div><div>
5935 *b</div>
5936 !! result
5937 <div>
5938 <ul><li>a
5939 </li></ul></div><div>
5940 <ul><li>b
5941 </li></ul></div>
5942 !! end
5943
5944 !! test
5945 Unbalanced closing non-block tags don't break a list
5946 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5947 !! options
5948 parsoid
5949 !! input
5950 <span>
5951 *a</span><span>
5952 *b</span>
5953 !! result
5954 <p><span></span>
5955 </p>
5956 <ul><li>a<span></span>
5957 </li><li>b
5958 </li></ul>
5959 !! end
5960
5961 !! test
5962 Unclosed formatting tags that straddle lists are closed and reopened
5963 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5964 !! options
5965 parsoid
5966 !! input
5967 # <s> a
5968 # b </s>
5969 !! result
5970 <ol><li> <s> a </s>
5971 </li><li> <s> b </s>
5972 </li></ol>
5973 !! end
5974
5975 !!test
5976 List embedded in a non-block tag
5977 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5978 !! options
5979 parsoid
5980 !!input
5981 <small>
5982 * foo
5983 </small>
5984 !!result
5985 <p><small></small></p>
5986 <small>
5987 <ul>
5988 <li> foo</li>
5989 </ul>
5990 </small>
5991 <p><small></small></p>
5992 !!end
5993
5994 !! test
5995 Table with missing opening <tr> tag
5996 !! options
5997 parsoid=wt2html,wt2wt
5998 !! input
5999 <table>
6000 <td>foo</td>
6001 </tr>
6002 </table>
6003 !! result
6004 <table>
6005 <tr>
6006 <td>foo</td>
6007 </tr>
6008 </table>
6009 !! end
6010
6011 ###
6012 ### Magic Words
6013 ###
6014
6015 # Note that the current date is hard-coded as
6016 # 1970-01-01T00:02:03Z (a Thursday)
6017 # when running parser tests. The timezone is also fixed to GMT, so
6018 # local date will be identical to current date.
6019
6020 !! test
6021 Magic Word: {{CURRENTDAY}}
6022 !! input
6023 {{CURRENTDAY}}
6024 !! result
6025 <p>1
6026 </p>
6027 !! end
6028
6029 !! test
6030 Magic Word: {{CURRENTDAY2}}
6031 !! input
6032 {{CURRENTDAY2}}
6033 !! result
6034 <p>01
6035 </p>
6036 !! end
6037
6038 !! test
6039 Magic Word: {{CURRENTDAYNAME}}
6040 !! input
6041 {{CURRENTDAYNAME}}
6042 !! result
6043 <p>Thursday
6044 </p>
6045 !! end
6046
6047 !! test
6048 Magic Word: {{CURRENTDOW}}
6049 !! input
6050 {{CURRENTDOW}}
6051 !! result
6052 <p>4
6053 </p>
6054 !! end
6055
6056 !! test
6057 Magic Word: {{CURRENTMONTH}}
6058 !! input
6059 {{CURRENTMONTH}}
6060 !! result
6061 <p>01
6062 </p>
6063 !! end
6064
6065 !! test
6066 Magic Word: {{CURRENTMONTH1}}
6067 !! input
6068 {{CURRENTMONTH1}}
6069 !! result
6070 <p>1
6071 </p>
6072 !! end
6073
6074 !! test
6075 Magic Word: {{CURRENTMONTHABBREV}}
6076 !! input
6077 {{CURRENTMONTHABBREV}}
6078 !! result
6079 <p>Jan
6080 </p>
6081 !! end
6082
6083 !! test
6084 Magic Word: {{CURRENTMONTHNAME}}
6085 !! input
6086 {{CURRENTMONTHNAME}}
6087 !! result
6088 <p>January
6089 </p>
6090 !! end
6091
6092 !! test
6093 Magic Word: {{CURRENTMONTHNAMEGEN}}
6094 !! input
6095 {{CURRENTMONTHNAMEGEN}}
6096 !! result
6097 <p>January
6098 </p>
6099 !! end
6100
6101 !! test
6102 Magic Word: {{CURRENTTIME}}
6103 !! input
6104 {{CURRENTTIME}}
6105 !! result
6106 <p>00:02
6107 </p>
6108 !! end
6109
6110 !! test
6111 Magic Word: {{CURRENTHOUR}}
6112 !! input
6113 {{CURRENTHOUR}}
6114 !! result
6115 <p>00
6116 </p>
6117 !! end
6118
6119 !! test
6120 Magic Word: {{CURRENTWEEK}} (@bug 4594)
6121 !! input
6122 {{CURRENTWEEK}}
6123 !! result
6124 <p>1
6125 </p>
6126 !! end
6127
6128 !! test
6129 Magic Word: {{CURRENTYEAR}}
6130 !! input
6131 {{CURRENTYEAR}}
6132 !! result
6133 <p>1970
6134 </p>
6135 !! end
6136
6137 !! test
6138 Magic Word: {{CURRENTTIMESTAMP}}
6139 !! input
6140 {{CURRENTTIMESTAMP}}
6141 !! result
6142 <p>19700101000203
6143 </p>
6144 !! end
6145
6146 !! test
6147 Magic Words LOCAL (UTC)
6148 !! input
6149 * {{LOCALMONTH}}
6150 * {{LOCALMONTH1}}
6151 * {{LOCALMONTHNAME}}
6152 * {{LOCALMONTHNAMEGEN}}
6153 * {{LOCALMONTHABBREV}}
6154 * {{LOCALDAY}}
6155 * {{LOCALDAY2}}
6156 * {{LOCALDAYNAME}}
6157 * {{LOCALYEAR}}
6158 * {{LOCALTIME}}
6159 * {{LOCALHOUR}}
6160 * {{LOCALWEEK}}
6161 * {{LOCALDOW}}
6162 * {{LOCALTIMESTAMP}}
6163 !! result
6164 <ul><li> 01
6165 </li><li> 1
6166 </li><li> January
6167 </li><li> January
6168 </li><li> Jan
6169 </li><li> 1
6170 </li><li> 01
6171 </li><li> Thursday
6172 </li><li> 1970
6173 </li><li> 00:02
6174 </li><li> 00
6175 </li><li> 1
6176 </li><li> 4
6177 </li><li> 19700101000203
6178 </li></ul>
6179
6180 !! end
6181
6182 !! test
6183 Magic Word: {{FULLPAGENAME}}
6184 !! options
6185 title=[[User:Ævar Arnfjörð Bjarmason]]
6186 !! input
6187 {{FULLPAGENAME}}
6188 !! result
6189 <p>User:Ævar Arnfjörð Bjarmason
6190 </p>
6191 !! end
6192
6193 !! test
6194 Magic Word: {{FULLPAGENAMEE}}
6195 !! options
6196 title=[[User:Ævar Arnfjörð Bjarmason]]
6197 !! input
6198 {{FULLPAGENAMEE}}
6199 !! result
6200 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6201 </p>
6202 !! end
6203
6204 !! test
6205 Magic Word: {{TALKSPACE}}
6206 !! options
6207 title=[[User:Ævar Arnfjörð Bjarmason]]
6208 !! input
6209 {{TALKSPACE}}
6210 !! result
6211 <p>User talk
6212 </p>
6213 !! end
6214
6215 !! test
6216 Magic Word: {{TALKSPACE}}, same namespace
6217 !! options
6218 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6219 !! input
6220 {{TALKSPACE}}
6221 !! result
6222 <p>User talk
6223 </p>
6224 !! end
6225
6226 !! test
6227 Magic Word: {{TALKSPACE}}, main namespace
6228 !! options
6229 title=[[Parser Test]]
6230 !! input
6231 {{TALKSPACE}}
6232 !! result
6233 <p>Talk
6234 </p>
6235 !! end
6236
6237 !! test
6238 Magic Word: {{TALKSPACEE}}
6239 !! options
6240 title=[[User:Ævar Arnfjörð Bjarmason]]
6241 !! input
6242 {{TALKSPACEE}}
6243 !! result
6244 <p>User_talk
6245 </p>
6246 !! end
6247
6248 !! test
6249 Magic Word: {{SUBJECTSPACE}}
6250 !! options
6251 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6252 !! input
6253 {{SUBJECTSPACE}}
6254 !! result
6255 <p>User
6256 </p>
6257 !! end
6258
6259 !! test
6260 Magic Word: {{SUBJECTSPACE}}, same namespace
6261 !! options
6262 title=[[User:Ævar Arnfjörð Bjarmason]]
6263 !! input
6264 {{SUBJECTSPACE}}
6265 !! result
6266 <p>User
6267 </p>
6268 !! end
6269
6270 !! test
6271 Magic Word: {{SUBJECTSPACE}}, main namespace
6272 !! options
6273 title=[[Parser Test]]
6274 !! input
6275 {{SUBJECTSPACE}}
6276 !! result
6277
6278 !! end
6279
6280 !! test
6281 Magic Word: {{SUBJECTSPACEE}}
6282 !! options
6283 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6284 !! input
6285 {{SUBJECTSPACEE}}
6286 !! result
6287 <p>User
6288 </p>
6289 !! end
6290
6291 !! test
6292 Magic Word: {{NAMESPACE}}
6293 !! options
6294 title=[[User:Ævar Arnfjörð Bjarmason]]
6295 !! input
6296 {{NAMESPACE}}
6297 !! result
6298 <p>User
6299 </p>
6300 !! end
6301
6302 !! test
6303 Magic Word: {{NAMESPACEE}}
6304 !! options
6305 title=[[User:Ævar Arnfjörð Bjarmason]]
6306 !! input
6307 {{NAMESPACEE}}
6308 !! result
6309 <p>User
6310 </p>
6311 !! end
6312
6313 !! test
6314 Magic Word: {{NAMESPACENUMBER}}
6315 !! options
6316 title=[[User:Ævar Arnfjörð Bjarmason]]
6317 !! input
6318 {{NAMESPACENUMBER}}
6319 !! result
6320 <p>2
6321 </p>
6322 !! end
6323
6324 !! test
6325 Magic Word: {{SUBPAGENAME}}
6326 !! options
6327 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6328 !! input
6329 {{SUBPAGENAME}}
6330 !! result
6331 <p>sub ö
6332 </p>
6333 !! end
6334
6335 !! test
6336 Magic Word: {{SUBPAGENAMEE}}
6337 !! options
6338 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6339 !! input
6340 {{SUBPAGENAMEE}}
6341 !! result
6342 <p>sub_%C3%B6
6343 </p>
6344 !! end
6345
6346 !! test
6347 Magic Word: {{ROOTPAGENAME}}
6348 !! options
6349 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6350 !! input
6351 {{ROOTPAGENAME}}
6352 !! result
6353 <p>Ævar Arnfjörð Bjarmason
6354 </p>
6355 !! end
6356
6357 !! test
6358 Magic Word: {{ROOTPAGENAMEE}}
6359 !! options
6360 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6361 !! input
6362 {{ROOTPAGENAMEE}}
6363 !! result
6364 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6365 </p>
6366 !! end
6367
6368 !! test
6369 Magic Word: {{BASEPAGENAME}}
6370 !! options
6371 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6372 !! input
6373 {{BASEPAGENAME}}
6374 !! result
6375 <p>Ævar Arnfjörð Bjarmason
6376 </p>
6377 !! end
6378
6379 !! test
6380 Magic Word: {{BASEPAGENAMEE}}
6381 !! options
6382 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6383 !! input
6384 {{BASEPAGENAMEE}}
6385 !! result
6386 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6387 </p>
6388 !! end
6389
6390 !! test
6391 Magic Word: {{TALKPAGENAME}}
6392 !! options
6393 title=[[User:Ævar Arnfjörð Bjarmason]]
6394 !! input
6395 {{TALKPAGENAME}}
6396 !! result
6397 <p>User talk:Ævar Arnfjörð Bjarmason
6398 </p>
6399 !! end
6400
6401 !! test
6402 Magic Word: {{TALKPAGENAMEE}}
6403 !! options
6404 title=[[User:Ævar Arnfjörð Bjarmason]]
6405 !! input
6406 {{TALKPAGENAMEE}}
6407 !! result
6408 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6409 </p>
6410 !! end
6411
6412 !! test
6413 Magic Word: {{SUBJECTPAGENAME}}
6414 !! options
6415 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6416 !! input
6417 {{SUBJECTPAGENAME}}
6418 !! result
6419 <p>User:Ævar Arnfjörð Bjarmason
6420 </p>
6421 !! end
6422
6423 !! test
6424 Magic Word: {{SUBJECTPAGENAMEE}}
6425 !! options
6426 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6427 !! input
6428 {{SUBJECTPAGENAMEE}}
6429 !! result
6430 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6431 </p>
6432 !! end
6433
6434 !! test
6435 Magic Word: {{NUMBEROFFILES}}
6436 !! input
6437 {{NUMBEROFFILES}}
6438 !! result
6439 <p>4
6440 </p>
6441 !! end
6442
6443 !! test
6444 Magic Word: {{PAGENAME}}
6445 !! options
6446 title=[[User:Ævar Arnfjörð Bjarmason]]
6447 !! input
6448 {{PAGENAME}}
6449 !! result
6450 <p>Ævar Arnfjörð Bjarmason
6451 </p>
6452 !! end
6453
6454 !! test
6455 Magic Word: {{PAGENAME}} with metacharacters
6456 !! options
6457 title=[['foo & bar = baz']]
6458 !! input
6459 ''{{PAGENAME}}''
6460 !! result
6461 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
6462 </p>
6463 !! end
6464
6465 !! test
6466 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
6467 !! options
6468 title=[[*RFC 1234 http://example.com/]]
6469 !! input
6470 {{PAGENAME}}
6471 !! result
6472 <p>&#42;RFC&#32;1234 http&#58;//example.com/
6473 </p>
6474 !! end
6475
6476 !! test
6477 Magic Word: {{PAGENAMEE}}
6478 !! options
6479 title=[[User:Ævar Arnfjörð Bjarmason]]
6480 !! input
6481 {{PAGENAMEE}}
6482 !! result
6483 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6484 </p>
6485 !! end
6486
6487 !! test
6488 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
6489 !! options
6490 title=[[*RFC 1234 http://example.com/]]
6491 !! input
6492 {{PAGENAMEE}}
6493 !! result
6494 <p>&#42;RFC_1234_http&#58;//example.com/
6495 </p>
6496 !! end
6497
6498 !! test
6499 Magic Word: {{REVISIONID}}
6500 !! input
6501 {{REVISIONID}}
6502 !! result
6503 <p>1337
6504 </p>
6505 !! end
6506
6507 !! test
6508 Magic Word: {{SCRIPTPATH}}
6509 !! input
6510 {{SCRIPTPATH}}
6511 !! result
6512 <p>/
6513 </p>
6514 !! end
6515
6516 !! test
6517 Magic Word: {{STYLEPATH}}
6518 !! input
6519 {{STYLEPATH}}
6520 !! result
6521 <p>/skins
6522 </p>
6523 !! end
6524
6525 !! test
6526 Magic Word: {{SERVER}}
6527 !! input
6528 {{SERVER}}
6529 !! result
6530 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6531 </p>
6532 !! end
6533
6534 !! test
6535 Magic Word: {{SERVERNAME}}
6536 !! input
6537 {{SERVERNAME}}
6538 !! result
6539 <p>example.org
6540 </p>
6541 !! end
6542
6543 !! test
6544 Magic Word: {{SITENAME}}
6545 !! input
6546 {{SITENAME}}
6547 !! result
6548 <p>MediaWiki
6549 </p>
6550 !! end
6551
6552 !! test
6553 Case-sensitive magic words, when cased differently, should just be template transclusions
6554 !! input
6555 {{CurrentMonth}}
6556 {{currentday}}
6557 {{cURreNTweEK}}
6558 {{currentHour}}
6559 !! result
6560 <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>
6561 <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>
6562 <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>
6563 <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>
6564 </p>
6565 !! end
6566
6567 !! test
6568 Case-insensitive magic words should still work with weird casing.
6569 !! input
6570 {{sErVeRNaMe}}
6571 {{LCFirst:AOEU}}
6572 {{ucFIRST:aoeu}}
6573 {{SERver}}
6574 !! result
6575 <p>example.org
6576 aOEU
6577 Aoeu
6578 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6579 </p>
6580 !! end
6581
6582 !! test
6583 Namespace 1 {{ns:1}}
6584 !! input
6585 {{ns:1}}
6586 !! result
6587 <p>Talk
6588 </p>
6589 !! end
6590
6591 !! test
6592 Namespace 1 {{ns:01}}
6593 !! input
6594 {{ns:01}}
6595 !! result
6596 <p>Talk
6597 </p>
6598 !! end
6599
6600 !! test
6601 Namespace 0 {{ns:0}} (bug 4783)
6602 !! input
6603 {{ns:0}}
6604 !! result
6605
6606 !! end
6607
6608 !! test
6609 Namespace 0 {{ns:00}} (bug 4783)
6610 !! input
6611 {{ns:00}}
6612 !! result
6613
6614 !! end
6615
6616 !! test
6617 Namespace -1 {{ns:-1}}
6618 !! input
6619 {{ns:-1}}
6620 !! result
6621 <p>Special
6622 </p>
6623 !! end
6624
6625 !! test
6626 Namespace User {{ns:User}}
6627 !! input
6628 {{ns:User}}
6629 !! result
6630 <p>User
6631 </p>
6632 !! end
6633
6634 !! test
6635 Namespace User talk {{ns:User_talk}}
6636 !! input
6637 {{ns:User_talk}}
6638 !! result
6639 <p>User talk
6640 </p>
6641 !! end
6642
6643 !! test
6644 Namespace User talk {{ns:uSeR tAlK}}
6645 !! input
6646 {{ns:uSeR tAlK}}
6647 !! result
6648 <p>User talk
6649 </p>
6650 !! end
6651
6652 !! test
6653 Namespace File {{ns:File}}
6654 !! input
6655 {{ns:File}}
6656 !! result
6657 <p>File
6658 </p>
6659 !! end
6660
6661 !! test
6662 Namespace File {{ns:Image}}
6663 !! input
6664 {{ns:Image}}
6665 !! result
6666 <p>File
6667 </p>
6668 !! end
6669
6670 !! test
6671 Namespace (lang=de) Benutzer {{ns:User}}
6672 !! options
6673 language=de
6674 !! input
6675 {{ns:User}}
6676 !! result
6677 <p>Benutzer
6678 </p>
6679 !! end
6680
6681 !! test
6682 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
6683 !! options
6684 language=de
6685 !! input
6686 {{ns:3}}
6687 !! result
6688 <p>Benutzer Diskussion
6689 </p>
6690 !! end
6691
6692
6693 !! test
6694 Urlencode
6695 !! input
6696 {{urlencode:hi world?!}}
6697 {{urlencode:hi world?!|WIKI}}
6698 {{urlencode:hi world?!|PATH}}
6699 {{urlencode:hi world?!|QUERY}}
6700 !! result
6701 <p>hi+world%3F%21
6702 hi_world%3F!
6703 hi%20world%3F%21
6704 hi+world%3F%21
6705 </p>
6706 !! end
6707
6708 ###
6709 ### Magic links
6710 ###
6711 !! test
6712 Magic links: internal link to RFC (bug 479)
6713 !! input
6714 [[RFC 123]]
6715 !! result
6716 <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>
6717 </p>
6718 !! end
6719
6720 !! test
6721 Magic links: RFC (bug 479)
6722 !! input
6723 RFC 822
6724 !! result
6725 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
6726 </p>
6727 !! end
6728
6729 !! test
6730 Magic links: ISBN (bug 1937)
6731 !! input
6732 ISBN 0-306-40615-2
6733 !! result
6734 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
6735 </p>
6736 !! end
6737
6738 !! test
6739 Magic links: PMID incorrectly converts space to underscore
6740 !! input
6741 PMID 1234
6742 !! result
6743 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
6744 </p>
6745 !! end
6746
6747 ###
6748 ### Templates
6749 ####
6750
6751 !! test
6752 Nonexistent template
6753 !! input
6754 {{thistemplatedoesnotexist}}
6755 !! result
6756 <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>
6757 </p>
6758 !! end
6759
6760 !! test
6761 Template with invalid target containing tags
6762 !! input
6763 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6764 !! result
6765 <p>{{a<b>b</b>|foo|a=b|a = b}}
6766 </p>
6767 !! end
6768
6769 !! test
6770 Template with invalid target containing unclosed tag
6771 !! input
6772 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6773 !! result
6774 <p>{{a<b>|foo|a=b|a = b}}</b>
6775 </p>
6776 !! end
6777
6778 !! article
6779 Template:test
6780 !! text
6781 This is a test template
6782 !! endarticle
6783
6784 !! test
6785 Simple template
6786 !! input
6787 {{test}}
6788 !! result
6789 <p>This is a test template
6790 </p>
6791 !! end
6792
6793 !! test
6794 Template with explicit namespace
6795 !! input
6796 {{Template:test}}
6797 !! result
6798 <p>This is a test template
6799 </p>
6800 !! end
6801
6802
6803 !! article
6804 Template:paramtest
6805 !! text
6806 This is a test template with parameter {{{param}}}
6807 !! endarticle
6808
6809 !! test
6810 Template parameter
6811 !! input
6812 {{paramtest|param=foo}}
6813 !! result
6814 <p>This is a test template with parameter foo
6815 </p>
6816 !! end
6817
6818 !! article
6819 Template:paramtestnum
6820 !! text
6821 [[{{{1}}}|{{{2}}}]]
6822 !! endarticle
6823
6824 !! test
6825 Template unnamed parameter
6826 !! input
6827 {{paramtestnum|Main Page|the main page}}
6828 !! result
6829 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
6830 </p>
6831 !! end
6832
6833 !! article
6834 Template:templatesimple
6835 !! text
6836 (test)
6837 !! endarticle
6838
6839 !! article
6840 Template:templateredirect
6841 !! text
6842 #redirect [[Template:templatesimple]]
6843 !! endarticle
6844
6845 !! article
6846 Template:templateasargtestnum
6847 !! text
6848 {{{{{1}}}}}
6849 !! endarticle
6850
6851 !! article
6852 Template:templateasargtest
6853 !! text
6854 {{template{{{templ}}}}}
6855 !! endarticle
6856
6857 !! article
6858 Template:templateasargtest2
6859 !! text
6860 {{{{{templ}}}}}
6861 !! endarticle
6862
6863 !! test
6864 Template with template name as unnamed argument
6865 !! input
6866 {{templateasargtestnum|templatesimple}}
6867 !! result
6868 <p>(test)
6869 </p>
6870 !! end
6871
6872 !! test
6873 Template with template name as argument
6874 !! input
6875 {{templateasargtest|templ=simple}}
6876 !! result
6877 <p>(test)
6878 </p>
6879 !! end
6880
6881 !! test
6882 Template with template name as argument (2)
6883 !! input
6884 {{templateasargtest2|templ=templatesimple}}
6885 !! result
6886 <p>(test)
6887 </p>
6888 !! end
6889
6890 !! article
6891 Template:templateasargtestdefault
6892 !! text
6893 {{{{{templ|templatesimple}}}}}
6894 !! endarticle
6895
6896 !! article
6897 Template:templa
6898 !! text
6899 '''templ'''
6900 !! endarticle
6901
6902 !! test
6903 Template with default value
6904 !! input
6905 {{templateasargtestdefault}}
6906 !! result
6907 <p>(test)
6908 </p>
6909 !! end
6910
6911 !! test
6912 Template with default value (value set)
6913 !! input
6914 {{templateasargtestdefault|templ=templa}}
6915 !! result
6916 <p><b>templ</b>
6917 </p>
6918 !! end
6919
6920 !! test
6921 Template redirect
6922 !! input
6923 {{templateredirect}}
6924 !! result
6925 <p>(test)
6926 </p>
6927 !! end
6928
6929 !! test
6930 Template with argument in separate line
6931 !! input
6932 {{ templateasargtest |
6933 templ = simple }}
6934 !! result
6935 <p>(test)
6936 </p>
6937 !! end
6938
6939 !! test
6940 Template with complex template as argument
6941 !! input
6942 {{paramtest|
6943 param ={{ templateasargtest |
6944 templ = simple }}}}
6945 !! result
6946 <p>This is a test template with parameter (test)
6947 </p>
6948 !! end
6949
6950 !! test
6951 Template with thumb image (with link in description)
6952 !! input
6953 {{paramtest|
6954 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6955 !! result
6956 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>
6957
6958 !! end
6959
6960 !! article
6961 Template:complextemplate
6962 !! text
6963 {{{1}}} {{paramtest|
6964 param ={{{param}}}}}
6965 !! endarticle
6966
6967 !! test
6968 Template with complex arguments
6969 !! input
6970 {{complextemplate|
6971 param ={{ templateasargtest |
6972 templ = simple }}|[[Template:complextemplate|link]]}}
6973 !! result
6974 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6975 </p>
6976 !! end
6977
6978 !! test
6979 BUG 553: link with two variables in a piped link
6980 !! input
6981 {|
6982 |[[{{{1}}}|{{{2}}}]]
6983 |}
6984 !! result
6985 <table>
6986 <tr>
6987 <td>[[{{{1}}}|{{{2}}}]]
6988 </td></tr></table>
6989
6990 !! end
6991
6992 !! test
6993 Magic variable as template parameter
6994 !! input
6995 {{paramtest|param={{SITENAME}}}}
6996 !! result
6997 <p>This is a test template with parameter MediaWiki
6998 </p>
6999 !! end
7000
7001 !! article
7002 Template:linktest
7003 !! text
7004 [[{{{param}}}|link]]
7005 !! endarticle
7006
7007 !! test
7008 Template parameter as link source
7009 !! input
7010 {{linktest|param=Main Page}}
7011 !! result
7012 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
7013 </p>
7014 !! end
7015
7016 !!test
7017 Template-generated attribute string (k='v')
7018 !!input
7019 <span {{attr_str|id|v1}}>bar</span>
7020 !!result
7021 <p><span id="v1">bar</span>
7022 </p>
7023 !!end
7024
7025 !!article
7026 Template:paramtest2
7027 !! text
7028 including another template, {{paramtest|param={{{arg}}}}}
7029 !! endarticle
7030
7031 !! test
7032 Template passing argument to another template
7033 !! input
7034 {{paramtest2|arg='hmm'}}
7035 !! result
7036 <p>including another template, This is a test template with parameter 'hmm'
7037 </p>
7038 !! end
7039
7040 !! article
7041 Template:Linktest2
7042 !! text
7043 Main Page
7044 !! endarticle
7045
7046 !! test
7047 Template as link source
7048 !! input
7049 [[{{linktest2}}]]
7050
7051 [[{{linktest2}}|Main Page]]
7052
7053 [[{{linktest2}}]]Page
7054 !! result
7055 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7056 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7057 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
7058 </p>
7059 !! end
7060
7061
7062 !! article
7063 Template:loop1
7064 !! text
7065 {{loop2}}
7066 !! endarticle
7067
7068 !! article
7069 Template:loop2
7070 !! text
7071 {{loop1}}
7072 !! endarticle
7073
7074 !! test
7075 Template infinite loop
7076 !! input
7077 {{loop1}}
7078 !! result
7079 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
7080 </p>
7081 !! end
7082
7083 !! test
7084 Template from main namespace
7085 !! input
7086 {{:Main Page}}
7087 !! result
7088 <p>blah blah
7089 </p>
7090 !! end
7091
7092 !! article
7093 Template:table
7094 !! text
7095 {|
7096 | 1 || 2
7097 |-
7098 | 3 || 4
7099 |}
7100 !! endarticle
7101
7102 !! test
7103 BUG 529: Template with table, not included at beginning of line
7104 !! input
7105 foo {{table}}
7106 !! result
7107 <p>foo
7108 </p>
7109 <table>
7110 <tr>
7111 <td> 1 </td>
7112 <td> 2
7113 </td></tr>
7114 <tr>
7115 <td> 3 </td>
7116 <td> 4
7117 </td></tr></table>
7118
7119 !! end
7120
7121 !! test
7122 BUG 523: Template shouldn't eat newline (or add an extra one before table)
7123 !! input
7124 foo
7125 {{table}}
7126 !! result
7127 <p>foo
7128 </p>
7129 <table>
7130 <tr>
7131 <td> 1 </td>
7132 <td> 2
7133 </td></tr>
7134 <tr>
7135 <td> 3 </td>
7136 <td> 4
7137 </td></tr></table>
7138
7139 !! end
7140
7141 !! test
7142 BUG 41: Template parameters shown as broken links
7143 !! input
7144 {{{parameter}}}
7145 !! result
7146 <p>{{{parameter}}}
7147 </p>
7148 !! end
7149
7150 !! test
7151 Template with targets containing wikilinks
7152 !! input
7153 {{[[foo]]}}
7154
7155 {{[[{{echo|foo}}]]}}
7156
7157 {{{{echo|[[foo}}]]}}
7158 !! result
7159 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7160 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7161 </p><p>{{[[foo}}]]
7162 </p>
7163 !! end
7164
7165 !! article
7166 Template:MSGNW test
7167 !! text
7168 ''None'' of '''this''' should be
7169 * interpreted
7170 but rather passed unmodified
7171 {{test}}
7172 !! endarticle
7173
7174 # hmm, fix this or just deprecate msgnw and document its behavior?
7175 !! test
7176 msgnw keyword
7177 !! options
7178 disabled
7179 !! input
7180 {{msgnw:MSGNW test}}
7181 !! result
7182 <p>''None'' of '''this''' should be
7183 * interpreted
7184 but rather passed unmodified
7185 {{test}}
7186 </p>
7187 !! end
7188
7189 !! test
7190 int keyword
7191 !! input
7192 {{int:youhavenewmessages|lots of money|not!}}
7193 !! result
7194 <p>You have lots of money (not!).
7195 </p>
7196 !! end
7197
7198 !! article
7199 Template:Includes
7200 !! text
7201 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
7202 !! endarticle
7203
7204 !! test
7205 <includeonly> and <noinclude> being included
7206 !! input
7207 {{Includes}}
7208 !! result
7209 <p>Foobar
7210 </p>
7211 !! end
7212
7213 !! article
7214 Template:Includes2
7215 !! text
7216 <onlyinclude>Foo</onlyinclude>bar
7217 !! endarticle
7218
7219 !! test
7220 <onlyinclude> being included
7221 !! input
7222 {{Includes2}}
7223 !! result
7224 <p>Foo
7225 </p>
7226 !! end
7227
7228
7229 !! article
7230 Template:Includes3
7231 !! text
7232 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
7233 !! endarticle
7234
7235 !! test
7236 <onlyinclude> and <includeonly> being included
7237 !! input
7238 {{Includes3}}
7239 !! result
7240 <p>Foo
7241 </p>
7242 !! end
7243
7244 !! test
7245 <includeonly> and <noinclude> on a page
7246 !! input
7247 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
7248 !! result
7249 <p>Foozar
7250 </p>
7251 !! end
7252
7253 !! test
7254 Un-closed <noinclude>
7255 !! input
7256 <noinclude>
7257 !! result
7258 !! end
7259
7260 !! test
7261 <onlyinclude> on a page
7262 !! input
7263 <onlyinclude>Foo</onlyinclude>bar
7264 !! result
7265 <p>Foobar
7266 </p>
7267 !! end
7268
7269 !! test
7270 Un-closed <onlyinclude>
7271 !! input
7272 <onlyinclude>
7273 !! result
7274 !! end
7275
7276 !!test
7277 Self-closed noinclude, includeonly, onlyinclude tags
7278 !!input
7279 <noinclude />
7280 <includeonly />
7281 <onlyinclude />
7282 !!result
7283 <p><br />
7284 </p>
7285 !!end
7286
7287 !!test
7288 Unbalanced includeonly and noinclude tags
7289 !!input
7290 {|
7291 |a</noinclude>
7292 |b</noinclude></noinclude>
7293 |c</noinclude></includeonly>
7294 |d</includeonly></includeonly>
7295 |}
7296 !!result
7297 <table>
7298 <tr>
7299 <td>a
7300 </td>
7301 <td>b
7302 </td>
7303 <td>c&lt;/includeonly&gt;
7304 </td>
7305 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
7306 </td></tr></table>
7307
7308 !!end
7309
7310 !! article
7311 Template:Includeonly section
7312 !! text
7313 <includeonly>
7314 ==Includeonly section==
7315 </includeonly>
7316 ==Section T-1==
7317 !!endarticle
7318
7319 !! test
7320 Bug 6563: Edit link generation for section shown by <includeonly>
7321 !! input
7322 {{includeonly section}}
7323 !! result
7324 <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>
7325 <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>
7326
7327 !! end
7328
7329 # Uses same input as the contents of [[Template:Includeonly section]]
7330 !! test
7331 Bug 6563: Section extraction for section shown by <includeonly>
7332 !! options
7333 section=T-2
7334 !! input
7335 <includeonly>
7336 ==Includeonly section==
7337 </includeonly>
7338 ==Section T-2==
7339 !! result
7340 ==Section T-2==
7341 !! end
7342
7343 !! test
7344 Bug 6563: Edit link generation for section suppressed by <includeonly>
7345 !! input
7346 <includeonly>
7347 ==Includeonly section==
7348 </includeonly>
7349 ==Section 1==
7350 !! result
7351 <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>
7352
7353 !! end
7354
7355 !! test
7356 Bug 6563: Section extraction for section suppressed by <includeonly>
7357 !! options
7358 section=1
7359 !! input
7360 <includeonly>
7361 ==Includeonly section==
7362 </includeonly>
7363 ==Section 1==
7364 !! result
7365 ==Section 1==
7366 !! end
7367
7368 !! test
7369 Un-closed <includeonly>
7370 !! input
7371 <includeonly>
7372 !! result
7373 !! end
7374
7375 # TODO: test with DOM fragment reuse!
7376 !! test
7377 Parsoid: DOM fragment reuse
7378 !! options
7379 parsoid=wt2wt,wt2html
7380 !! input
7381 a{{echo|b<table></table>c}}d
7382
7383 a{{echo|b
7384 <table></table>
7385 c}}d
7386
7387 {{echo|a
7388
7389 <table></table>
7390
7391 b}}
7392 !! result
7393 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
7394 <table></table>c"}},"i":0}}]}'>b</span>
7395 <table about="#mwt1"></table><span about="#mwt1">c</span>d
7396
7397
7398 <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">
7399 </span>
7400 <table about="#mwt2"></table><span about="#mwt2">
7401 </span>
7402 <p about="#mwt2">cd</p>
7403
7404
7405 <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">
7406
7407 </span>
7408 <table about="#mwt3"></table><span about="#mwt3">
7409
7410 </span>
7411 <p about="#mwt3">b</p>
7412 !! end
7413
7414 !! test
7415 Parsoid: Merge double tds (bug 50603)
7416 !! options
7417 parsoid
7418 !! input
7419 {|
7420 |{{echo|{{!}} foo}}
7421 |}
7422 !! result
7423 <table><tbody>
7424 <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>
7425 </tbody></table>
7426 !! end
7427
7428 !! test
7429 Parsoid: Merge double tds in nested transclusion content (bug 50603)
7430 !! options
7431 parsoid
7432 !! input
7433 {{echo|<div>}}
7434 {|
7435 |{{echo|{{!}} foo}}
7436 |}
7437 {{echo|</div>}}
7438 !! result
7439 <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}}]}'>
7440 <table><tbody>
7441 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
7442 </tbody></table>
7443 </div>
7444 !! end
7445
7446 ###
7447 ### <includeonly> and <noinclude> in attributes
7448 ###
7449 !!test
7450 0. includeonly around the entire attribute
7451 !!input
7452 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
7453 !!result
7454 <p><span id="v2">bar</span>
7455 </p>
7456 !!end
7457
7458 !!test
7459 1. includeonly in html attr key
7460 !!input
7461 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
7462 !!result
7463 <p><span id="foo">bar</span>
7464 </p>
7465 !!end
7466
7467 !!test
7468 2. includeonly in html attr value
7469 !!input
7470 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
7471 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
7472 !!result
7473 <p><span id="v1">bar</span>
7474 <span id="v1">bar</span>
7475 </p>
7476 !!end
7477
7478 !!test
7479 3. includeonly in part of an attr value
7480 !!input
7481 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
7482 !!result
7483 <p><span style="color:red;">bar</span>
7484 </p>
7485 !!end
7486
7487 ###
7488 ### Testing parsing of templates where a template arg
7489 ### has the same name as the template itself.
7490 ###
7491
7492 !! article
7493 Template:quote
7494 !! text
7495 {{{quote|{{{1}}}}}}
7496 !! endarticle
7497
7498 !!test
7499 Templates: Template Name/Arg clash: 1. Use of positional param
7500 !!input
7501 {{quote|foo}}
7502 !!result
7503 <p>foo
7504 </p>
7505 !!end
7506
7507 !!test
7508 Templates: Template Name/Arg clash: 2. Use of named param
7509 !!input
7510 {{quote|quote=foo}}
7511 !!result
7512 <p>foo
7513 </p>
7514 !!end
7515
7516 !!test
7517 Templates: Template Name/Arg clash: 3. Use of named param with empty input
7518 !!input
7519 {{quote|quote}}
7520 !!result
7521 <p>quote
7522 </p>
7523 !!end
7524
7525 ###
7526 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
7527 ###
7528
7529 !!test
7530 Templates: 1. Simple use
7531 !!input
7532 {{echo|Foo}}
7533 !!result
7534 <p>Foo
7535 </p>
7536 !!end
7537
7538 !!test
7539 Templates: 2. Inside a block tag
7540 !!input
7541 <div>{{echo|Foo}}</div>
7542 <blockquote>{{echo|Foo}}</blockquote>
7543 !!result
7544 <div>Foo</div>
7545 <blockquote>Foo</blockquote>
7546
7547 !!end
7548
7549 !!test
7550 Templates: P-wrapping: 1a. Templates on consecutive lines
7551 !!input
7552 {{echo|Foo}}
7553 {{echo|bar}}
7554 !!result
7555 <p>Foo
7556 bar
7557 </p>
7558 !!end
7559
7560 !!test
7561 Templates: P-wrapping: 1b. Templates on consecutive lines
7562 !!input
7563 Foo
7564
7565 {{echo|bar}}
7566 {{echo|baz}}
7567 !!result
7568 <p>Foo
7569 </p><p>bar
7570 baz
7571 </p>
7572 !!end
7573
7574 !!test
7575 Templates: P-wrapping: 1c. Templates on consecutive lines
7576 !!input
7577 {{echo|Foo}}
7578 {{echo|bar}} <div>baz</div>
7579 !!result
7580 <p>Foo
7581 </p>
7582 bar <div>baz</div>
7583
7584 !!end
7585
7586 !!test
7587 Templates: P-wrapping: 1d. Template preceded by comment-only line
7588 !!options
7589 parsoid
7590 !!input
7591 <!-- foo -->
7592 {{echo|Bar}}
7593 !!result
7594 <!-- foo -->
7595
7596 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
7597 !!end
7598
7599 !!test
7600 Templates: Inline Text: 1. Multiple tmeplate uses
7601 !!input
7602 {{echo|Foo}}bar{{echo|baz}}
7603 !!result
7604 <p>Foobarbaz
7605 </p>
7606 !!end
7607
7608 !!test
7609 Templates: Inline Text: 2. Back-to-back template uses
7610 !!input
7611 {{echo|Foo}}{{echo|bar}}
7612 !!result
7613 <p>Foobar
7614 </p>
7615 !!end
7616
7617 !!test
7618 Templates: Block Tags: 1. Multiple template uses
7619 !!input
7620 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
7621 !!result
7622 <div>Foo</div><div>bar</div><div>baz</div>
7623
7624 !!end
7625
7626 !!test
7627 Templates: Block Tags: 2. Back-to-back template uses
7628 !!input
7629 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
7630 !!result
7631 <div>Foo</div><div>bar</div>
7632
7633 !!end
7634
7635 !!test
7636 Templates: Links: 1. Simple example
7637 !!input
7638 {{echo|[[Foo|bar]]}}
7639 !!result
7640 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7641 </p>
7642 !!end
7643
7644 !!test
7645 Templates: Links: 2. Generation of link href
7646 !!input
7647 [[{{echo|Foo}}|bar]]
7648 !!result
7649 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7650 </p>
7651 !!end
7652
7653 !!test
7654 Templates: Links: 3. Generation of part of a link href
7655 !!input
7656 [[Fo{{echo|o}}|bar]]
7657
7658 [[Foo{{echo|bar}}]]
7659
7660 [[Foo{{echo|bar}}baz]]
7661
7662 [[Foo{{echo|bar}}|bar]]
7663
7664 [[:Foo{{echo|bar}}]]
7665
7666 [[:Foo{{echo|bar}}|bar]]
7667 !!result
7668 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7669 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7670 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
7671 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7672 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7673 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7674 </p>
7675 !!end
7676
7677 !!test
7678 Templates: Links: 4. Multiple templates generating link href
7679 !!input
7680 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
7681 !!result
7682 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7683 </p>
7684 !!end
7685
7686 !!test
7687 Templates: Links: 5. Generation of link text
7688 !!input
7689 [[Foo|{{echo|bar}}]]
7690 !!result
7691 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7692 </p>
7693 !!end
7694
7695 !!test
7696 Templates: Links: 5. Nested templates (only outermost template should be marked)
7697 !!input
7698 {{echo|[[{{echo|Foo}}|bar]]}}
7699 !!result
7700 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7701 </p>
7702 !!end
7703
7704 !!test
7705 Templates: HTML Tag: 1. Generation of HTML attr. key
7706 !!input
7707 <div {{echo|style}}="color:red;">foo</div>
7708 !!result
7709 <div style="color:red;">foo</div>
7710
7711 !!end
7712
7713 !!test
7714 Templates: HTML Tag: 2. Generation of HTML attr. value
7715 !!input
7716 <div style={{echo|'color:red;'}}>foo</div>
7717 !!result
7718 <div style="color:red;">foo</div>
7719
7720 !!end
7721
7722 !!test
7723 Templates: HTML Tag: 3. Generation of HTML attr key and value
7724 !!input
7725 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
7726 !!result
7727 <div style="color:red;">foo</div>
7728
7729 !!end
7730
7731 !!test
7732 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
7733 !!input
7734 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
7735 !!result
7736 <div title="This is a long title with just one piece templated">foo</div>
7737
7738 !!end
7739
7740 !!test
7741 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
7742 !!input
7743 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
7744 !!result
7745 <div title="This is a long title with just one piece templated">foo</div>
7746
7747 !!end
7748
7749 !!test
7750 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
7751 !!input
7752 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
7753 !!result
7754 <div title="This is a long title with just one piece templated">foo</div>
7755
7756 !!end
7757
7758 !!test
7759 Templates: HTML Tag: 7. Generation of partial attribute key string
7760 !!input
7761 <div st{{echo|yle}}="color:red;">foo</div>
7762 !!result
7763 <div style="color:red;">foo</div>
7764
7765 !!end
7766
7767 !!test
7768 Templates: HTML Tables: 1. Generating start of a HTML table
7769 !!input
7770 {{echo|<table><tr><td>foo</td>}}</tr></table>
7771 !!result
7772 <table><tr><td>foo</td></tr></table>
7773
7774 !!end
7775
7776 !!test
7777 Templates: HTML Tables: 2a. Generating middle of a HTML table
7778 !!input
7779 <table><tr>{{echo|<td>foo</td>}}</tr></table>
7780 !!result
7781 <table><tr><td>foo</td></tr></table>
7782
7783 !!end
7784
7785 !!test
7786 Templates: HTML Tables: 2b. Generating middle of a HTML table
7787 !!input
7788 <table>{{echo|<tr><td>foo</td></tr>}}</table>
7789 !!result
7790 <table><tr><td>foo</td></tr></table>
7791
7792 !!end
7793
7794 !!test
7795 Templates: HTML Tables: 3. Generating end of a HTML table
7796 !!input
7797 <table><tr>{{echo|<td>foo</td></tr></table>}}
7798 !!result
7799 <table><tr><td>foo</td></tr></table>
7800
7801 !!end
7802
7803 !!test
7804 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
7805 !!input
7806 {{echo|<table>}}<tr><td>foo</td></tr></table>
7807 !!result
7808 <table><tr><td>foo</td></tr></table>
7809
7810 !!end
7811
7812 !!test
7813 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
7814 !!input
7815 <table>{{echo|<tr>}}<td>foo</td></tr></table>
7816 !!result
7817 <table><tr><td>foo</td></tr></table>
7818
7819 !!end
7820
7821 !!test
7822 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
7823 !!input
7824 <table><tr>{{echo|<td>}}foo</td></tr></table>
7825 !!result
7826 <table><tr><td>foo</td></tr></table>
7827
7828 !!end
7829
7830 !!test
7831 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
7832 !!input
7833 <table><tr><td>foo{{echo|</td>}}</tr></table>
7834 !!result
7835 <table><tr><td>foo</td></tr></table>
7836
7837 !!end
7838
7839 !!test
7840 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
7841 !!input
7842 <table><tr><td>foo</td>{{echo|</tr>}}</table>
7843 !!result
7844 <table><tr><td>foo</td></tr></table>
7845
7846 !!end
7847
7848 !!test
7849 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
7850 !!input
7851 <table><tr><td>foo</td></tr>{{echo|</table>}}
7852 !!result
7853 <table><tr><td>foo</td></tr></table>
7854
7855 !!end
7856
7857 !!test
7858 Templates: HTML Tables: 5. Proper fostering of categories from inside
7859 !!options
7860 parsoid=wt2html,wt2wt
7861 !!input
7862 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
7863 <!--Two categories (Bug 50330)-->
7864 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
7865 !!result
7866 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
7867 <!--Two categories (Bug 50330)-->
7868 <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>
7869 !!end
7870
7871 !!test
7872 Templates: Wiki Tables: 1a. Fostering of entire template content
7873 !!input
7874 {|
7875 {{echo|a}}
7876 |}
7877 !!result
7878 <table>
7879 a
7880 <tr><td></td></tr></table>
7881
7882 !!end
7883
7884 !!test
7885 Templates: Wiki Tables: 1b. Fostering of entire template content
7886 !!input
7887 {|
7888 {{echo|<div>}}
7889 foo
7890 {{echo|</div>}}
7891 |}
7892 !!result
7893 <table>
7894 <div>
7895 <p>foo
7896 </p>
7897 </div>
7898 <tr><td></td></tr></table>
7899
7900 !!end
7901
7902 !!test
7903 Templates: Wiki Tables: 2. Fostering of partial template content
7904 !!input
7905 {|
7906 {{echo|a
7907 <div>b</div>}}
7908 |}
7909 !!result
7910 <table>
7911 a
7912 <div>b</div>
7913 <tr><td></td></tr></table>
7914
7915 !!end
7916
7917 !!test
7918 Templates: Wiki Tables: 3. td-content via multiple templates
7919 !!input
7920 {|
7921 {{echo|{{pipe}}a}}{{echo|b}}
7922 |}
7923 !!result
7924 <table>
7925 <tr>
7926 <td>ab
7927 </td></tr></table>
7928
7929 !!end
7930
7931 !!test
7932 Templates: Wiki Tables: 4. Templated tags, no content
7933 !!input
7934 {{tbl-start}}
7935 {{tbl-end}}
7936 !!result
7937 <table>
7938 <tr><td></td></tr></table>
7939
7940 !!end
7941
7942 !!test
7943 Templates: Wiki Tables: 5. Templated tags, regular td-tags
7944 !!input
7945 {{tbl-start}}
7946 |foo
7947 {{tbl-end}}
7948 !!result
7949 <table>
7950 <tr>
7951 <td>foo
7952 </td></tr></table>
7953
7954 !!end
7955
7956 !!test
7957 Templates: Wiki Tables: 6. Templated tags, templated td-tags
7958 !!input
7959 {{tbl-start}}
7960 {{!}}foo
7961 {{tbl-end}}
7962 !!result
7963 <table>
7964 <tr>
7965 <td>foo
7966 </td></tr></table>
7967
7968 !!end
7969
7970 !!test
7971 Templates: Lists: Multi-line list-items via templates
7972 !!input
7973 *{{echo|a {{nonexistent|
7974 unused}}}}
7975 *{{echo|b {{nonexistent|
7976 unused}}}}
7977 !!result
7978 <ul><li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
7979 </li><li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
7980 </li></ul>
7981
7982 !!end
7983
7984 !!test
7985 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
7986 !!input
7987 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
7988 !!result
7989 <p><i>ab</i>c<i>d</i>e
7990 </p>
7991 !!end
7992
7993 !!test
7994 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7995 (PHP parser generates misnested html)
7996 !! options
7997 parsoid
7998 !!input
7999 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
8000 !!result
8001 <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>
8002 !!end
8003
8004 !!test
8005 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
8006 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
8007 !! options
8008 parsoid=wt2html,wt2wt
8009 !!input
8010 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
8011 !!result
8012 <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>
8013 <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>
8014 <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>
8015 !!end
8016
8017 !!test
8018 Templates: Ugly nesting: 4. Divs opened/closed across templates
8019 !!input
8020 a<div>b{{echo|c</div>d}}e
8021 !!result
8022 a<div>bc</div>de
8023
8024 !!end
8025
8026 !!test
8027 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
8028 (Parsoid-centric)
8029 !! options
8030 parsoid
8031 !!input
8032 {|
8033 |{{echo|foo</table>}}
8034 |bar
8035 |}
8036 !!result
8037 <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|}"]}'>
8038
8039 <tbody>
8040 <tr>
8041 <td>foo</td></tr></tbody></table><span about="#mwt1">
8042 </span><span about="#mwt1">bar</span><span about="#mwt1">
8043 </span>
8044 !!end
8045
8046 !!test
8047 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
8048 (Parsoid-centric)
8049 !! options
8050 parsoid
8051 !!input
8052 <table>
8053 <tr>
8054 <td>
8055 <table>
8056 <tr>
8057 <td>1. {{echo|foo </table>}}</td>
8058 <td> bar </td>
8059 <td>2. {{echo|baz </table>}}</td>
8060 </tr>
8061 <tr>
8062 <td>abc</td>
8063 </tr>
8064 </table>
8065 </td>
8066 </tr>
8067 <tr>
8068 <td>xyz</td>
8069 </tr>
8070 </table>
8071 !!result
8072 <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>"]}'>
8073 <tbody><tr>
8074 <td>
8075 <table>
8076 <tbody><tr>
8077 <td>1. foo </td></tr></tbody></table></td>
8078 <td> bar </td>
8079 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
8080 </span><span about="#mwt2">
8081 </span><span about="#mwt2">
8082 </span><span about="#mwt2">abc</span><span about="#mwt2">
8083 </span><span about="#mwt2">
8084 </span><span about="#mwt2">
8085 </span><span about="#mwt2">
8086 </span><span about="#mwt2">
8087 </span><span about="#mwt2">
8088 </span><span about="#mwt2">xyz</span><span about="#mwt2">
8089 </span><span about="#mwt2">
8090 </span>
8091 !!end
8092
8093 !! test
8094 Templates: Ugly templates: 3. newline-only template parameter
8095 !! input
8096 foo {{echo|
8097 }}
8098 !! result
8099 <p>foo
8100 </p>
8101 !! end
8102
8103 # This looks like a bug: a single newline triggers p/br for some reason.
8104 !! test
8105 Templates: Ugly templates: 4. newline-only template parameter inconsistency
8106 !! input
8107 {{echo|
8108 }}
8109 !! result
8110 <p><br />
8111 </p>
8112 !! end
8113
8114
8115 !!test
8116 Parser Functions: 1. Simple example
8117 !!input
8118 {{uc:foo}}
8119 !!result
8120 <p>FOO
8121 </p>
8122 !!end
8123
8124 !!test
8125 Parser Functions: 2. Nested use (only outermost should be marked up)
8126 !!input
8127 {{uc:{{lc:FOO}}}}
8128 !!result
8129 <p>FOO
8130 </p>
8131 !!end
8132
8133 ###
8134 ### Pre-save transform tests
8135 ###
8136 !! test
8137 pre-save transform: subst:
8138 !! options
8139 PST
8140 !! input
8141 {{subst:test}}
8142 !! result
8143 This is a test template
8144 !! end
8145
8146 !! test
8147 pre-save transform: normal template
8148 !! options
8149 PST
8150 !! input
8151 {{test}}
8152 !! result
8153 {{test}}
8154 !! end
8155
8156 !! test
8157 pre-save transform: nonexistent template
8158 !! options
8159 PST
8160 !! input
8161 {{thistemplatedoesnotexist}}
8162 !! result
8163 {{thistemplatedoesnotexist}}
8164 !! end
8165
8166
8167 !! test
8168 pre-save transform: subst magic variables
8169 !! options
8170 PST
8171 !! input
8172 {{subst:SITENAME}}
8173 !! result
8174 MediaWiki
8175 !! end
8176
8177 # This is bug 89, which I fixed. -- wtm
8178 !! test
8179 pre-save transform: subst: templates with parameters
8180 !! options
8181 pst
8182 !! input
8183 {{subst:paramtest|param="something else"}}
8184 !! result
8185 This is a test template with parameter "something else"
8186 !! end
8187
8188 !! article
8189 Template:nowikitest
8190 !! text
8191 <nowiki>'''not wiki'''</nowiki>
8192 !! endarticle
8193
8194 !! test
8195 pre-save transform: nowiki in subst (bug 1188)
8196 !! options
8197 pst
8198 !! input
8199 {{subst:nowikitest}}
8200 !! result
8201 <nowiki>'''not wiki'''</nowiki>
8202 !! end
8203
8204
8205 !! article
8206 Template:commenttest
8207 !! text
8208 This template has <!-- a comment --> in it.
8209 !! endarticle
8210
8211 !! test
8212 pre-save transform: comment in subst (bug 1936)
8213 !! options
8214 pst
8215 !! input
8216 {{subst:commenttest}}
8217 !! result
8218 This template has <!-- a comment --> in it.
8219 !! end
8220
8221 !! test
8222 pre-save transform: unclosed tag
8223 !! options
8224 pst noxml
8225 !! input
8226 <nowiki>'''not wiki'''
8227 !! result
8228 <nowiki>'''not wiki'''
8229 !! end
8230
8231 !! test
8232 pre-save transform: mixed tag case
8233 !! options
8234 pst noxml
8235 !! input
8236 <NOwiki>'''not wiki'''</noWIKI>
8237 !! result
8238 <NOwiki>'''not wiki'''</noWIKI>
8239 !! end
8240
8241 !! test
8242 pre-save transform: unclosed comment in <nowiki>
8243 !! options
8244 pst noxml
8245 !! input
8246 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
8247 !! result
8248 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
8249 !!end
8250
8251 # Leading @ in this template definition works around a limitation
8252 # in parsoid's parserTests which otherwise strips the <span> from the
8253 # result (confusing it for a template wrapper)
8254 !! article
8255 Template:dangerous
8256 !!text
8257 @<span onmouseover="alert('crap')">Oh no</span>
8258 !!endarticle
8259
8260 !!test
8261 (confirming safety of fix for subst bug 1936)
8262 !! input
8263 {{Template:dangerous}}
8264 !! result
8265 <p>@<span>Oh no</span>
8266 </p>
8267 !! end
8268
8269 !! test
8270 pre-save transform: comment containing gallery (bug 5024)
8271 !! options
8272 pst
8273 !! input
8274 <!-- <gallery>data</gallery> -->
8275 !!result
8276 <!-- <gallery>data</gallery> -->
8277 !!end
8278
8279 !! test
8280 pre-save transform: comment containing extension
8281 !! options
8282 pst
8283 !! input
8284 <!-- <tag>data</tag> -->
8285 !!result
8286 <!-- <tag>data</tag> -->
8287 !!end
8288
8289 !! test
8290 pre-save transform: comment containing nowiki
8291 !! options
8292 pst
8293 !! input
8294 <!-- <nowiki>data</nowiki> -->
8295 !!result
8296 <!-- <nowiki>data</nowiki> -->
8297 !!end
8298
8299 !! test
8300 pre-save transform: <noinclude> in subst (bug 3298)
8301 !! options
8302 pst
8303 !! input
8304 {{subst:Includes}}
8305 !! result
8306 Foobar
8307 !! end
8308
8309 !! test
8310 pre-save transform: <onlyinclude> in subst (bug 3298)
8311 !! options
8312 pst
8313 !! input
8314 {{subst:Includes2}}
8315 !! result
8316 Foo
8317 !! end
8318
8319 !! article
8320 Template:SubstTest
8321 !!text
8322 {{<includeonly>subst:</includeonly>Includes}}
8323 !! endarticle
8324
8325 !! article
8326 Template:SafeSubstTest
8327 !! text
8328 {{<includeonly>safesubst:</includeonly>Includes}}
8329 !! endarticle
8330
8331 !! test
8332 bug 22297: safesubst: works during PST
8333 !! options
8334 pst
8335 !! input
8336 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
8337 !! result
8338 FoobarFoobar
8339 !! end
8340
8341 !! test
8342 bug 22297: safesubst: works during normal parse
8343 !! input
8344 {{SafeSubstTest}}
8345 !! result
8346 <p>Foobar
8347 </p>
8348 !! end
8349
8350 !! test:
8351 subst: does not work during normal parse
8352 !! input
8353 {{SubstTest}}
8354 !! result
8355 <p>{{subst:Includes}}
8356 </p>
8357 !! end
8358
8359 !! test
8360 pre-save transform: context links ("pipe trick")
8361 !! options
8362 pst
8363 !! input
8364 [[Article (context)|]]
8365 [[Bar:Article|]]
8366 [[:Bar:Article|]]
8367 [[Bar:Article (context)|]]
8368 [[:Bar:Article (context)|]]
8369 [[|Article]]
8370 [[|Article (context)]]
8371 [[Bar:X (Y) Z|]]
8372 [[:Bar:X (Y) Z|]]
8373 !! result
8374 [[Article (context)|Article]]
8375 [[Bar:Article|Article]]
8376 [[:Bar:Article|Article]]
8377 [[Bar:Article (context)|Article]]
8378 [[:Bar:Article (context)|Article]]
8379 [[Article]]
8380 [[Article (context)]]
8381 [[Bar:X (Y) Z|X (Y) Z]]
8382 [[:Bar:X (Y) Z|X (Y) Z]]
8383 !! end
8384
8385 !! test
8386 pre-save transform: context links ("pipe trick") with interwiki prefix
8387 !! options
8388 pst
8389 !! input
8390 [[interwiki:Article|]]
8391 [[:interwiki:Article|]]
8392 [[interwiki:Bar:Article|]]
8393 [[:interwiki:Bar:Article|]]
8394 !! result
8395 [[interwiki:Article|Article]]
8396 [[:interwiki:Article|Article]]
8397 [[interwiki:Bar:Article|Bar:Article]]
8398 [[:interwiki:Bar:Article|Bar:Article]]
8399 !! end
8400
8401 !! test
8402 pre-save transform: context links ("pipe trick") with parens in title
8403 !! options
8404 pst title=[[Somearticle (context)]]
8405 !! input
8406 [[|Article]]
8407 !! result
8408 [[Article (context)|Article]]
8409 !! end
8410
8411 !! test
8412 pre-save transform: context links ("pipe trick") with comma in title
8413 !! options
8414 pst title=[[Someplace, Somewhere]]
8415 !! input
8416 [[|Otherplace]]
8417 [[Otherplace, Elsewhere|]]
8418 [[Otherplace, Elsewhere, Anywhere|]]
8419 !! result
8420 [[Otherplace, Somewhere|Otherplace]]
8421 [[Otherplace, Elsewhere|Otherplace]]
8422 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
8423 !! end
8424
8425 !! test
8426 pre-save transform: context links ("pipe trick") with parens and comma
8427 !! options
8428 pst title=[[Someplace (IGNORED), Somewhere]]
8429 !! input
8430 [[|Otherplace]]
8431 [[Otherplace (place), Elsewhere|]]
8432 !! result
8433 [[Otherplace, Somewhere|Otherplace]]
8434 [[Otherplace (place), Elsewhere|Otherplace]]
8435 !! end
8436
8437 !! test
8438 pre-save transform: context links ("pipe trick") with comma and parens
8439 !! options
8440 pst title=[[Who, me? (context)]]
8441 !! input
8442 [[|Yes, you.]]
8443 [[Me, Myself, and I (1937 song)|]]
8444 !! result
8445 [[Yes, you. (context)|Yes, you.]]
8446 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
8447 !! end
8448
8449 !! test
8450 pre-save transform: context links ("pipe trick") with namespace
8451 !! options
8452 pst title=[[Ns:Somearticle]]
8453 !! input
8454 [[|Article]]
8455 !! result
8456 [[Ns:Article|Article]]
8457 !! end
8458
8459 !! test
8460 pre-save transform: context links ("pipe trick") with namespace and parens
8461 !! options
8462 pst title=[[Ns:Somearticle (context)]]
8463 !! input
8464 [[|Article]]
8465 !! result
8466 [[Ns:Article (context)|Article]]
8467 !! end
8468
8469 !! test
8470 pre-save transform: context links ("pipe trick") with namespace and comma
8471 !! options
8472 pst title=[[Ns:Somearticle, Context, Whatever]]
8473 !! input
8474 [[|Article]]
8475 !! result
8476 [[Ns:Article, Context, Whatever|Article]]
8477 !! end
8478
8479 !! test
8480 pre-save transform: context links ("pipe trick") with namespace, comma and parens
8481 !! options
8482 pst title=[[Ns:Somearticle, Context (context)]]
8483 !! input
8484 [[|Article]]
8485 !! result
8486 [[Ns:Article (context)|Article]]
8487 !! end
8488
8489 !! test
8490 pre-save transform: context links ("pipe trick") with namespace, parens and comma
8491 !! options
8492 pst title=[[Ns:Somearticle (IGNORED), Context]]
8493 !! input
8494 [[|Article]]
8495 !! result
8496 [[Ns:Article, Context|Article]]
8497 !! end
8498
8499 !! test
8500 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
8501 !! options
8502 pst
8503 !! input
8504 [[Article(context)|]]
8505 [[Bar:Article(context)|]]
8506 [[:Bar:Article(context)|]]
8507 [[|Article(context)]]
8508 [[Bar:X(Y)Z|]]
8509 [[:Bar:X(Y)Z|]]
8510 !! result
8511 [[Article(context)|Article]]
8512 [[Bar:Article(context)|Article]]
8513 [[:Bar:Article(context)|Article]]
8514 [[Article(context)]]
8515 [[Bar:X(Y)Z|X(Y)Z]]
8516 [[:Bar:X(Y)Z|X(Y)Z]]
8517 !! end
8518
8519 !! test
8520 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
8521 !! options
8522 pst
8523 !! input
8524 [[Article (context)|]]
8525 [[Bar:Article (context)|]]
8526 [[:Bar:Article (context)|]]
8527 [[|Article (context)]]
8528 [[Bar:X (Y) Z|]]
8529 [[:Bar:X (Y) Z|]]
8530 !! result
8531 [[Article (context)|Article]]
8532 [[Bar:Article (context)|Article]]
8533 [[:Bar:Article (context)|Article]]
8534 [[Article (context)]]
8535 [[Bar:X (Y) Z|X (Y) Z]]
8536 [[:Bar:X (Y) Z|X (Y) Z]]
8537 !! end
8538
8539 !! test
8540 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
8541 !! options
8542 pst
8543 !! input
8544 [[Article(context)|]]
8545 [[Bar:Article(context)|]]
8546 [[:Bar:Article(context)|]]
8547 [[|Article(context)]]
8548 [[Bar:X(Y)Z|]]
8549 [[:Bar:X(Y)Z|]]
8550 !! result
8551 [[Article(context)|Article]]
8552 [[Bar:Article(context)|Article]]
8553 [[:Bar:Article(context)|Article]]
8554 [[Article(context)]]
8555 [[Bar:X(Y)Z|X(Y)Z]]
8556 [[:Bar:X(Y)Z|X(Y)Z]]
8557 !! end
8558
8559 !! test
8560 pre-save transform: context links ("pipe trick") with commas (bug 21660)
8561 !! options
8562 pst
8563 !! input
8564 [[Article (context), context|]]
8565 [[Article (context),context|]]
8566 [[Bar:Article (context), context|]]
8567 [[Bar:Article (context),context|]]
8568 [[:Bar:Article (context), context|]]
8569 [[:Bar:Article (context),context|]]
8570 !! result
8571 [[Article (context), context|Article]]
8572 [[Article (context),context|Article]]
8573 [[Bar:Article (context), context|Article]]
8574 [[Bar:Article (context),context|Article]]
8575 [[:Bar:Article (context), context|Article]]
8576 [[:Bar:Article (context),context|Article]]
8577 !! end
8578
8579 !! test
8580 pre-save transform: trim trailing empty lines
8581 !! options
8582 pst
8583 !! input
8584 Empty lines are trimmed
8585
8586
8587
8588
8589 !! result
8590 Empty lines are trimmed
8591 !! end
8592
8593 !! test
8594 pre-save transform: Signature expansion
8595 !! options
8596 pst
8597 !! input
8598 * ~~~
8599 * <noinclude>~~~</noinclude>
8600 * <includeonly>~~~</includeonly>
8601 * <onlyinclude>~~~</onlyinclude>
8602 !! result
8603 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
8604 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
8605 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
8606 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
8607 !! end
8608
8609
8610 !! test
8611 pre-save transform: Signature expansion in nowiki tags (bug 93)
8612 !! options
8613 pst disabled
8614 !! input
8615 Shall not expand:
8616
8617 <nowiki>~~~~</nowiki>
8618
8619 <includeonly><nowiki>~~~~</nowiki></includeonly>
8620
8621 <noinclude><nowiki>~~~~</nowiki></noinclude>
8622
8623 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8624
8625 {{subst:Foo}} shall be converted to FOO
8626
8627 As well as inside noinclude/onlyinclude
8628 <noinclude>{{subst:Foo}}</noinclude>
8629 <onlyinclude>{{subst:Foo}}</onlyinclude>
8630
8631 But not inside includeonly
8632 <includeonly>{{subst:Foo}}</includeonly>
8633 !! result
8634 Shall not expand:
8635
8636 <nowiki>~~~~</nowiki>
8637
8638 <includeonly><nowiki>~~~~</nowiki></includeonly>
8639
8640 <noinclude><nowiki>~~~~</nowiki></noinclude>
8641
8642 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8643
8644 FOO shall be converted to FOO
8645
8646 As well as inside noinclude/onlyinclude
8647 <noinclude>FOO</noinclude>
8648 <onlyinclude>FOO</onlyinclude>
8649
8650 But not inside includeonly
8651 <includeonly>{{subst:Foo}}</includeonly>
8652 !! end
8653
8654 !! test
8655 Parsoid: Recognize nowiki with trailing space in tags
8656 !! options
8657 parsoid=wt2html
8658 !! input
8659 <nowiki ><div>[[foo]]</nowiki >
8660
8661 a<nowiki / >b
8662
8663 c<nowiki />d
8664
8665 e<nowiki/ >f
8666 !! result
8667 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8668 <p>ab</p>
8669 <p>cd</p>
8670 <p>ef</p>
8671 !! end
8672
8673 !! test
8674 Parsoid: Recognize nowiki with odd capitalization
8675 !! options
8676 parsoid=wt2html
8677 !! input
8678 <noWikI ><div>[[foo]]</Nowiki >
8679 !! result
8680 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8681 !! end
8682
8683
8684 !! test
8685 Parsoid: Escape nowiki with trailing space in tags
8686 !! options
8687 parsoid=html2wt
8688 !! input
8689 &lt;nowiki &gt; foo &lt;/nowiki &gt;
8690
8691 a&lt;nowiki /&gt;b
8692
8693 c&lt;nowiki/ &gt;d
8694 !! result
8695 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
8696 <p>a&lt;nowiki /&gt;b</p>
8697 <p>c&lt;nowiki/ &gt;d</p>
8698 !! end
8699
8700 !! test
8701 Parsoid: Escape weird noWikI capitalizations
8702 !! options
8703 parsoid=html2wt
8704 !! input
8705 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
8706 !! result
8707 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
8708 !! end
8709
8710 ###
8711 ### Message transform tests
8712 ###
8713 !! test
8714 message transform: magic variables
8715 !! options
8716 msg
8717 !! input
8718 {{SITENAME}}
8719 !! result
8720 MediaWiki
8721 !! end
8722
8723 !! test
8724 message transform: should not transform wiki markup
8725 !! options
8726 msg
8727 !! input
8728 ''test''
8729 !! result
8730 ''test''
8731 !! end
8732
8733 !! test
8734 message transform: <noinclude> in transcluded template (bug 4926)
8735 !! options
8736 msg
8737 !! input
8738 {{Includes}}
8739 !! result
8740 Foobar
8741 !! end
8742
8743 !! test
8744 message transform: <onlyinclude> in transcluded template (bug 4926)
8745 !! options
8746 msg
8747 !! input
8748 {{Includes2}}
8749 !! result
8750 Foo
8751 !! end
8752
8753 !! test
8754 {{#special:}} page name, known
8755 !! options
8756 msg
8757 !! input
8758 {{#special:Recentchanges}}
8759 !! result
8760 Special:RecentChanges
8761 !! end
8762
8763 !! test
8764 {{#special:}} page name with subpage, known
8765 !! options
8766 msg
8767 !! input
8768 {{#special:Recentchanges/param}}
8769 !! result
8770 Special:RecentChanges/param
8771 !! end
8772
8773 !! test
8774 {{#special:}} page name, unknown
8775 !! options
8776 msg
8777 !! input
8778 {{#special:foobar nonexistent}}
8779 !! result
8780 Special:Foobar nonexistent
8781 !! end
8782
8783 !! test
8784 {{#speciale:}} page name, known
8785 !! options
8786 msg
8787 !! input
8788 {{#speciale:Recentchanges}}
8789 !! result
8790 Special:RecentChanges
8791 !! end
8792
8793 !! test
8794 {{#speciale:}} page name with subpage, known
8795 !! options
8796 msg
8797 !! input
8798 {{#speciale:Recentchanges/param}}
8799 !! result
8800 Special:RecentChanges/param
8801 !! end
8802
8803 !! test
8804 {{#speciale:}} page name, unknown
8805 !! options
8806 msg
8807 !! input
8808 {{#speciale:foobar nonexistent}}
8809 !! result
8810 Special:Foobar_nonexistent
8811 !! end
8812
8813 ###
8814 ### Images
8815 ###
8816 ### For Parsoid-specific tests, see
8817 #### http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8818
8819 !! test
8820 Simple image (php)
8821 !! options
8822 php
8823 !! input
8824 [[Image:foobar.jpg]]
8825 !! result
8826 <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>
8827 </p>
8828 !! end
8829
8830 !! test
8831 Simple image (parsoid)
8832 !! options
8833 parsoid=wt2html
8834 !! input
8835 [[Image:foobar.jpg]]
8836 !! result
8837 <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>
8838 </p>
8839 !! end
8840
8841 !! test
8842 Simple image (using File: namespace, now canonical) (php)
8843 !! options
8844 php
8845 !! input
8846 [[File:foobar.jpg]]
8847 !! result
8848 <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>
8849 </p>
8850 !! end
8851
8852 !! test
8853 Simple image (using File: namespace, now canonical) (parsoid)
8854 !! options
8855 parsoid
8856 !! input
8857 [[File:Foobar.jpg]]
8858 !! result
8859 <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>
8860 </p>
8861 !! end
8862
8863 !! test
8864 Right-aligned image (php)
8865 !! options
8866 php
8867 !! input
8868 [[Image:foobar.jpg|right]]
8869 !! result
8870 <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>
8871
8872 !! end
8873
8874 !! test
8875 Right-aligned image (parsoid)
8876 !! options
8877 parsoid
8878 !! input
8879 [[File:Foobar.jpg|right]]
8880 !! result
8881 <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>
8882 !! end
8883
8884 !! test
8885 Image with caption (php)
8886 !! options
8887 php
8888 !! input
8889 [[File:Foobar.jpg|right|Caption text]]
8890 !! result
8891 <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>
8892
8893 !! end
8894
8895 !! test
8896 Image with caption (parsoid)
8897 !! options
8898 parsoid
8899 !! input
8900 [[File:Foobar.jpg|right|Caption text]]
8901 !! result
8902 <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>
8903 !! end
8904
8905 !! test
8906 Image with empty attribute (php)
8907 !! options
8908 php
8909 !! input
8910 [[File:Foobar.jpg|right||Caption text]]
8911 !! result
8912 <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>
8913
8914 !! end
8915
8916 !! test
8917 Image with empty attribute (parsoid)
8918 !! options
8919 parsoid=wt2html
8920 !! input
8921 [[File:Foobar.jpg|right||Caption text]]
8922 !! result
8923 <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>
8924 !! end
8925
8926 !! test
8927 Image with attributes from template (php)
8928 !! options
8929 php
8930 !! input
8931 [[File:Foobar.jpg|{{image_attribs}}]]
8932 !! result
8933 <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>
8934
8935 !! end
8936
8937 !! test
8938 Image with attributes from template (parsoid)
8939 !! options
8940 parsoid
8941 !! input
8942 [[File:Foobar.jpg|{{image_attribs}}]]
8943 !! result
8944 <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>
8945 !! end
8946
8947 !! test
8948 Image with link tails (php)
8949 !! options
8950 php
8951 !! input
8952 123[[File:Foobar.jpg]]456
8953 123[[File:Foobar.jpg|right]]456
8954 123[[File:Foobar.jpg|thumb]]456
8955 !! result
8956 <p>123<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
8957 </p>
8958 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
8959 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
8960
8961 !! end
8962
8963 !! test
8964 Image with link tails (parsoid)
8965 !! options
8966 parsoid
8967 !! input
8968 123[[File:Foobar.jpg]]456
8969 123[[File:Foobar.jpg|right]]456
8970 123[[File:Foobar.jpg|thumb]]456
8971 !! result
8972 <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>
8973 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
8974 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
8975 !! end
8976
8977 !! test
8978 Image with multiple captions -- only last one is accepted (php)
8979 !! options
8980 php
8981 !! input
8982 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8983 !! result
8984 <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>
8985
8986 !! end
8987
8988 !! test
8989 Image with multiple captions -- only last one is accepted (parsoid)
8990 !! options
8991 parsoid
8992 !! input
8993 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8994 !! result
8995 <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>
8996 !! end
8997
8998 !! test
8999 Image with width attribute at different positions (php)
9000 !! options
9001 php
9002 !! input
9003 [[File:Foobar.jpg|200px|right|Caption]]
9004 [[File:Foobar.jpg|right|200px|Caption]]
9005 [[File:Foobar.jpg|right|Caption|200px]]
9006 !! result
9007 <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>
9008 <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>
9009 <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>
9010
9011 !! end
9012
9013 !! test
9014 Image with width attribute at different positions (parsoid)
9015 !! options
9016 parsoid
9017 !! input
9018 [[File:Foobar.jpg|200px|right|Caption]]
9019 [[File:Foobar.jpg|right|200px|Caption]]
9020 [[File:Foobar.jpg|right|Caption|200px]]
9021 !! result
9022 <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>
9023 <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>
9024 <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>
9025 !! end
9026
9027 !! test
9028 Image with link parameter, wiki target (php)
9029 !! options
9030 php
9031 !! input
9032 [[File:Foobar.jpg|link=Main Page]]
9033 !! result
9034 <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>
9035 </p>
9036 !! end
9037
9038 !! test
9039 Image with link parameter, wiki target (parsoid)
9040 !! options
9041 parsoid
9042 !! input
9043 [[File:Foobar.jpg|link=Main Page]]
9044 !! result
9045 <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>
9046 !! end
9047
9048 !! test
9049 Image with link parameter, URL target (php)
9050 !! options
9051 php
9052 !! input
9053 [[File:Foobar.jpg|link=http://example.com/]]
9054 !! result
9055 <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>
9056 </p>
9057 !! end
9058
9059 # parsoid bug 49293 (part 1)
9060 !! test
9061 Image with link parameter, URL target (parsoid)
9062 !! options
9063 parsoid
9064 !! input
9065 [[File:Foobar.jpg|link=http://example.com/]]
9066 !! result
9067 <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>
9068 !! end
9069
9070 !! test
9071 Image with link parameter, protocol-less URL target (php)
9072 !! options
9073 php
9074 !! input
9075 [[File:Foobar.jpg|link=//example.com/]]
9076 !! result
9077 <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>
9078 </p>
9079 !! end
9080
9081 # parsoid bug 49293 (part 2)
9082 !! test
9083 Image with link parameter, protocol-less URL target (parsoid)
9084 !! options
9085 parsoid
9086 !! input
9087 [[File:Foobar.jpg|link=//example.com/]]
9088 !! result
9089 <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>
9090 !! end
9091
9092 !! test
9093 Image with link parameter, wgExternalLinkTarget
9094 !! input
9095 [[Image:foobar.jpg|link=http://example.com/]]
9096 !! config
9097 wgExternalLinkTarget='foobar'
9098 !! result
9099 <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>
9100 </p>
9101 !! end
9102
9103 !! test
9104 Image with link parameter, wgNoFollowLinks set to false
9105 !! input
9106 [[Image:foobar.jpg|link=http://example.com/]]
9107 !! config
9108 wgNoFollowLinks=false
9109 !! result
9110 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9111 </p>
9112 !! end
9113
9114 !! test
9115 Image with link parameter, wgNoFollowDomainExceptions
9116 !! input
9117 [[Image:foobar.jpg|link=http://example.com/]]
9118 !! config
9119 wgNoFollowDomainExceptions='example.com'
9120 !! result
9121 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9122 </p>
9123 !! end
9124
9125 !! test
9126 Image with link parameter, wgExternalLinkTarget, unnamed parameter
9127 !! input
9128 [[Image:foobar.jpg|link=http://example.com/|Title]]
9129 !! config
9130 wgExternalLinkTarget='foobar'
9131 !! result
9132 <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>
9133 </p>
9134 !! end
9135
9136 !! test
9137 Image with empty link parameter (php)
9138 !! options
9139 php
9140 !! input
9141 [[File:Foobar.jpg|link=]]
9142 !! result
9143 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
9144 </p>
9145 !! end
9146
9147 !! test
9148 Image with empty link parameter (parsoid)
9149 !! options
9150 parsoid
9151 !! input
9152 [[File:Foobar.jpg|link=]]
9153 !! result
9154 <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>
9155 !! end
9156
9157 !! test
9158 Image with link parameter (wiki target) and unnamed parameter (php)
9159 !! options
9160 php
9161 !! input
9162 [[File:Foobar.jpg|link=Main Page|Title]]
9163 !! result
9164 <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>
9165 </p>
9166 !! end
9167
9168 !! test
9169 Image with link parameter (wiki target) and unnamed parameter (parsoid)
9170 !! options
9171 parsoid
9172 !! input
9173 [[File:Foobar.jpg|link=Main Page|Title]]
9174 !! result
9175 <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>
9176 !! end
9177
9178 !! test
9179 Image with link parameter (URL target) and unnamed parameter (php)
9180 !! options
9181 php
9182 !! input
9183 [[File:Foobar.jpg|link=http://example.com/|Title]]
9184 !! result
9185 <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>
9186 </p>
9187 !! end
9188
9189 !! test
9190 Image with link parameter (URL target) and unnamed parameter (parsoid)
9191 !! options
9192 parsoid
9193 !! input
9194 [[File:Foobar.jpg|link=http://example.com/|Title]]
9195 !! result
9196 <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>
9197 !! end
9198
9199 !! test
9200 Thumbnail image with link parameter
9201 !! options
9202 php
9203 !! input
9204 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
9205 !! result
9206 <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>
9207
9208 !! end
9209
9210 !! test
9211 Manually-specified thumbnail image
9212 !! options
9213 php
9214 !! input
9215 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
9216 !! result
9217 <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>
9218
9219 !! end
9220
9221 !! test
9222 Manually-specified thumbnail image with explicit link to wiki page
9223 !! options
9224 php
9225 !! input
9226 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
9227 !! result
9228 <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>
9229
9230 !! end
9231
9232 !! test
9233 Manually-specified thumbnail image with explicit link to url
9234 !! options
9235 php
9236 !! input
9237 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
9238 !! result
9239 <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>
9240
9241 !! end
9242
9243 !! test
9244 Manually-specified thumbnail image with explicit no link
9245 !! options
9246 php
9247 !! input
9248 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
9249 !! result
9250 <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>
9251
9252 !! end
9253
9254 !! test
9255 Manually-specified thumbnail image with explicit link and alt text
9256 !! options
9257 php
9258 !! input
9259 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
9260 !! result
9261 <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>
9262
9263 !! end
9264
9265 !! test
9266 Image with frame and link
9267 !! input
9268 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
9269 !! result
9270 <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>
9271
9272 !! end
9273
9274 !! test
9275 Image with frame and link and explicit alt
9276 !! input
9277 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
9278 !! result
9279 <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>
9280
9281 !! end
9282
9283 !! test
9284 Image with wiki markup in implicit alt
9285 !! input
9286 [[Image:Foobar.jpg|testing '''bold''' in alt]]
9287 !! result
9288 <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>
9289 </p>
9290 !! end
9291
9292 !! test
9293 Image with wiki markup in explicit alt
9294 !! input
9295 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
9296 !! result
9297 <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>
9298 </p>
9299 !! end
9300
9301 !! test
9302 Link to image page- image page normally doesn't exists, hence edit link
9303 Add test with existing image page
9304 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
9305 !! input
9306 [[:Image:test]]
9307 !! result
9308 <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>
9309 </p>
9310 !! end
9311
9312 !! test
9313 bug 18784 Link to non-existent image page with caption should use caption as link text
9314 !! input
9315 [[:Image:test|caption]]
9316 !! result
9317 <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>
9318 </p>
9319 !! end
9320
9321 !! test
9322 Frameless image caption with a free URL
9323 !! input
9324 [[Image:foobar.jpg|http://example.com]]
9325 !! result
9326 <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>
9327 </p>
9328 !! end
9329
9330 !! test
9331 Thumbnail image caption with a free URL
9332 !! input
9333 [[Image:foobar.jpg|thumb|http://example.com]]
9334 !! result
9335 <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>
9336
9337 !! end
9338
9339 !! test
9340 Thumbnail image caption with a free URL and explicit alt
9341 !! input
9342 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
9343 !! result
9344 <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>
9345
9346 !! end
9347
9348 !! test
9349 SVG thumbnails with no language set
9350 !! options
9351 !! input
9352 [[File:Foobar.svg|thumb|width=200]]
9353 !! result
9354 <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>
9355
9356 !! end
9357
9358 !! test
9359 SVG thumbnails with language de
9360 !! options
9361 !! input
9362 [[File:Foobar.svg|thumb|width=200|lang=de]]
9363 !! result
9364 <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>
9365
9366 !! end
9367
9368 !! test
9369 SVG thumbnails with invalid language code
9370 !! options
9371 !! input
9372 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
9373 !! result
9374 <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>
9375
9376 !! end
9377
9378 !! test
9379 BUG 1887: A ISBN with a thumbnail
9380 !! input
9381 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
9382 !! result
9383 <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>
9384
9385 !! end
9386
9387 !! test
9388 BUG 1887: A RFC with a thumbnail
9389 !! input
9390 [[Image:foobar.jpg|thumb|This is RFC 12354]]
9391 !! result
9392 <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>
9393
9394 !! end
9395
9396 !! test
9397 BUG 1887: A mailto link with a thumbnail
9398 !! input
9399 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
9400 !! result
9401 <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>
9402
9403 !! end
9404
9405 # Pending resolution to bug 368
9406 !! test
9407 BUG 648: Frameless image caption with a link
9408 !! input
9409 [[Image:foobar.jpg|text with a [[link]] in it]]
9410 !! result
9411 <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>
9412 </p>
9413 !! end
9414
9415 !! test
9416 BUG 648: Frameless image caption with a link (suffix)
9417 !! input
9418 [[Image:foobar.jpg|text with a [[link]]foo in it]]
9419 !! result
9420 <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>
9421 </p>
9422 !! end
9423
9424 !! test
9425 BUG 648: Frameless image caption with an interwiki link
9426 !! input
9427 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
9428 !! result
9429 <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>
9430 </p>
9431 !! end
9432
9433 !! test
9434 BUG 648: Frameless image caption with a piped interwiki link
9435 !! input
9436 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
9437 !! result
9438 <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>
9439 </p>
9440 !! end
9441
9442 !! test
9443 Escape HTML special chars in image alt text
9444 !! input
9445 [[Image:foobar.jpg|& < > "]]
9446 !! result
9447 <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>
9448 </p>
9449 !! end
9450
9451 !! test
9452 BUG 499: Alt text should have &#1234;, not &amp;1234;
9453 !! input
9454 [[Image:foobar.jpg|&#9792;]]
9455 !! result
9456 <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>
9457 </p>
9458 !! end
9459
9460 !! test
9461 Broken image caption with link
9462 !! input
9463 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
9464 !! result
9465 <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.
9466 </p>
9467 !! end
9468
9469 !! test
9470 Image caption containing another image
9471 !! input
9472 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
9473 !! result
9474 <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>
9475
9476 !! end
9477
9478 !! test
9479 Image caption containing a newline
9480 !! input
9481 [[Image:Foobar.jpg|This
9482 *is some text]]
9483 !! result
9484 <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>
9485 </p>
9486 !!end
9487
9488 !!test
9489 Parsoid: Image caption containing leading space
9490 (The leading space should not trigger nowiki escaping in wt2wt mode)
9491 !! input
9492 [[Image:Foobar.jpg|thumb| bar]]
9493 !! result
9494 <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>
9495
9496 !!end
9497
9498 !! test
9499 Bug 3090: External links other than http: in image captions
9500 !! input
9501 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
9502 !! result
9503 <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>
9504
9505 !! end
9506
9507 !! test
9508 Custom class
9509 !! input
9510 [[Image:foobar.jpg|a|class=b]]
9511 !! result
9512 <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>
9513 </p>
9514 !! end
9515
9516 !! test
9517 Localized image handling (1).
9518 !! options
9519 language=es
9520 !! input
9521 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
9522 !! result
9523 <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>
9524
9525 !! end
9526
9527 !! test
9528 Localized image handling (2).
9529 !! options
9530 language=es
9531 !! input
9532 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
9533 !! result
9534 <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>
9535
9536 !! end
9537
9538 !! test
9539 "border", "frameless" and "class" attributes on an image.
9540 !! input
9541 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
9542 !! result
9543 <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>
9544 </p>
9545 !! end
9546
9547 !! article
9548 File:Barfoo.jpg
9549 !! text
9550 #REDIRECT [[File:Barfoo.jpg]]
9551 !! endarticle
9552
9553 !! test
9554 Redirected image
9555 !! input
9556 [[Image:Barfoo.jpg]]
9557 !! result
9558 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
9559 </p>
9560 !! end
9561
9562 !! test
9563 Missing image with uploads disabled
9564 !! options
9565 wgEnableUploads=0
9566 !! input
9567 [[Image:Foobaz.jpg]]
9568 !! result
9569 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
9570 </p>
9571 !! end
9572
9573 # Parsoid-specific testing for images
9574 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9575 # Currently imperfect due to a flaw in the Parsoid testrunner
9576 # Work in progress
9577 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
9578 # image tests.
9579
9580 !! test
9581 Parsoid-specific image handling - simple image with size and middle alignment
9582 !! options
9583 parsoid
9584 !! input
9585 [[Image:Foobar.jpg|50px|middle]]
9586 !! result
9587 <p>
9588 <span class="mw-valign-middle" typeof="mw:Image">
9589 <a href="File:Foobar.jpg">
9590 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
9591 </a>
9592 </span>
9593 </p>
9594 !! end
9595
9596 !! test
9597 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
9598 !! options
9599 parsoid
9600 !! input
9601 [[Image:Foobar.jpg|500x10px|baseline|caption]]
9602 !! result
9603 <p>
9604 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9605 <a href="File:Foobar.jpg">
9606 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
9607 </a>
9608 </span>
9609 </p>
9610 !! end
9611
9612 !! test
9613 Parsoid-specific image handling - simple image with border and size spec
9614 !! options
9615 parsoid
9616 !! input
9617 [[Image:Foobar.jpg|50px|border|caption]]
9618 !! result
9619 <p>
9620 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9621 <a href="File:Foobar.jpg">
9622 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
9623 </a>
9624 </span>
9625 </p>
9626 !! end
9627
9628 !! test
9629 Parsoid-specific image handling - thumbnail with halign, valign, and caption
9630 !! options
9631 parsoid
9632 !! input
9633 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
9634 !! result
9635 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
9636 <a href="File:Foobar.jpg">
9637 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
9638 </a>
9639 <figcaption>caption content</figcaption>
9640 </figure>
9641 !! end
9642
9643 !! test
9644 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
9645 !! options
9646 parsoid
9647 !! input
9648 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
9649 !! result
9650 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
9651 <a href="File:Foobar.jpg">
9652 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
9653 </a>
9654 <figcaption>caption</figcaption>
9655 </figure>
9656 !! end
9657
9658 !! test
9659 Parsoid-specific image handling - framed image with specific size and caption
9660 !! options
9661 parsoid
9662 !! input
9663 [[Image:Foobar.jpg|500x50px|frame|caption]]
9664 !! result
9665 <figure typeof="mw:Image/Frame">
9666 <a href="File:Foobar.jpg">
9667 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9668 </a>
9669 <figcaption>caption</figcaption>
9670 </figure>
9671 !! end
9672
9673 !! test
9674 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
9675 !! options
9676 parsoid
9677 !! input
9678 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
9679 !! result
9680 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
9681 <a href="File:Foobar.jpg">
9682 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9683 </a>
9684 <figcaption>caption</figcaption>
9685 </figure>
9686 !! end
9687
9688 !! test
9689 Parsoid-specific image handling - frameless image with specific size, border, and caption
9690 !! options
9691 parsoid
9692 !! input
9693 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
9694 !! result
9695 <p>
9696 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9697 <a href="File:Foobar.jpg">
9698 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9699 </a>
9700 </p>
9701 !! end
9702
9703 #!! test
9704 #Parsoid-specific image handling - simple image with a formatted caption
9705 #!! options
9706 #parsoid
9707 #!! input
9708 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
9709 #!! result
9710 #<p>
9711 #<span typeof="mw:Image">
9712 #<a class="mw-default-size" href="Image:Foobar.jpg">
9713 #<img alt="Foobar.jpg" class="mw-default-size" src="http://example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
9714 #</a>
9715 #<span>abc</span>
9716 #</span>
9717 #</p>
9718
9719
9720 ###
9721 ### Subpages
9722 ###
9723 !! article
9724 Subpage test/subpage
9725 !! text
9726 foo
9727 !! endarticle
9728
9729 !! test
9730 Subpage link
9731 !! options
9732 subpage title=[[Subpage test]]
9733 !! input
9734 [[/subpage]]
9735 !! result
9736 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
9737 </p>
9738 !! end
9739
9740 !! test
9741 Subpage noslash link
9742 !! options
9743 subpage title=[[Subpage test]]
9744 !!input
9745 [[/subpage/]]
9746 !! result
9747 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
9748 </p>
9749 !! end
9750
9751 # TODO: make this PHP-parser compatible!
9752 !! test
9753 Relative subpage noslash link
9754 !! options
9755 parsoid=wt2wt,wt2html,html2html
9756 subpage title=[[Subpage test/1/2/3/4]]
9757 !!input
9758 [[../../subpage/]]
9759
9760 [[../../subpage]]
9761 !! result
9762 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
9763 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
9764 !! end
9765
9766 # TODO: make this PHP-parser compatible!
9767 !! test
9768 Parsoid: dot-slash prefixed wikilinks
9769 !! options
9770 parsoid=wt2wt,wt2html,html2html
9771 !!input
9772 [[./foo]]
9773
9774 [[././bar]]
9775
9776 [[././baz/]]
9777 !! result
9778 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
9779 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
9780 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
9781 !! end
9782
9783 !! test
9784 Disabled subpages
9785 !! input
9786 [[/subpage]]
9787 !! result
9788 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
9789 </p>
9790 !! end
9791
9792 !! test
9793 BUG 561: {{/Subpage}}
9794 !! options
9795 subpage title=[[Page]]
9796 !! input
9797 {{/Subpage}}
9798 !! result
9799 <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>
9800 </p>
9801 !! end
9802
9803 ###
9804 ### Categories
9805 ###
9806 !! article
9807 Category:MediaWiki User's Guide
9808 !! text
9809 blah
9810 !! endarticle
9811
9812 !! test
9813 Link to category
9814 !! input
9815 [[:Category:MediaWiki User's Guide]]
9816 !! result
9817 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
9818 </p>
9819 !! end
9820
9821 !! test
9822 Simple category
9823 !! options
9824 cat
9825 !! input
9826 [[Category:MediaWiki User's Guide]]
9827 !! result
9828 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9829 !! end
9830
9831 !! test
9832 PAGESINCATEGORY invalid title fatal (r33546 fix)
9833 !! input
9834 {{PAGESINCATEGORY:<bogus>}}
9835 !! result
9836 <p>0
9837 </p>
9838 !! end
9839
9840 !! test
9841 Category with different sort key
9842 !! options
9843 cat
9844 !! input
9845 [[Category:MediaWiki User's Guide|Foo]]
9846 !! result
9847 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9848 !! end
9849
9850 !! test
9851 Category with identical sort key
9852 !! options
9853 cat
9854 !! input
9855 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9856 !! result
9857 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9858 !! end
9859
9860 !! test
9861 Category with empty sort key
9862 !! options
9863 cat
9864 pst
9865 !! input
9866 [[Category:MediaWiki User's Guide|]]
9867 !! result
9868 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9869 !! end
9870
9871 !! test
9872 Category with empty sort key and parentheses
9873 !! options
9874 cat
9875 pst
9876 !! input
9877 [[Category:Foo (bar)|]]
9878 !! result
9879 [[Category:Foo (bar)|Foo]]
9880 !! end
9881
9882 !! test
9883 Category with link tail
9884 !! options
9885 cat
9886 pst
9887 !! input
9888 123[[Category:Foo]]456
9889 !! result
9890 123[[Category:Foo]]456
9891 !! end
9892
9893 !! test
9894 Category with template
9895 !! options
9896 cat
9897 pst
9898 !! input
9899 [[Category:{{echo|Foo}}]]
9900 !! result
9901 [[Category:{{echo|Foo}}]]
9902 !! end
9903
9904 !! test
9905 Category with template in sort key
9906 !! options
9907 cat
9908 pst
9909 !! input
9910 [[Category:Foo|{{echo|Bar}}]]
9911 !! result
9912 [[Category:Foo|{{echo|Bar}}]]
9913 !! end
9914
9915 !! test
9916 Category with template in sort key and title
9917 !! options
9918 cat
9919 pst
9920 !! input
9921 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9922 !! result
9923 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9924 !! end
9925
9926 !! test
9927 Category / paragraph interactions
9928 !! input
9929 Foo [[Category:Baz]] Bar
9930
9931 Foo [[Category:Baz]]
9932 Bar
9933
9934 Foo
9935 [[Category:Baz]]
9936 Bar
9937
9938 Foo
9939 [[Category:Baz]] Bar
9940
9941 Foo
9942 [[Category:Baz]]
9943 [[Category:Baz]]
9944 [[Category:Baz]]
9945 Bar
9946
9947 [[Category:Baz]]
9948 [[Category:Baz]]
9949 [[Category:Baz]]
9950
9951 [[Category:Baz]]
9952 {{echo|[[Category:Baz]]}}
9953 [[Category:Baz]]
9954 !! result
9955 <p>Foo Bar
9956 </p><p>Foo
9957 Bar
9958 </p><p>Foo
9959 Bar
9960 </p><p>Foo Bar
9961 </p><p>Foo
9962 Bar
9963 </p>
9964 !! end
9965
9966 !! test
9967 Parsoid: Serialize link to category page with colon escape
9968 !! options
9969 parsoid
9970 !! input
9971
9972 [[:Category:Foo]]
9973 [[:Category:Foo|Bar]]
9974 !! result
9975 <p>
9976 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
9977 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
9978 </p>
9979 !! end
9980
9981 !! test
9982 Parsoid: Link prefix/suffixes aren't applied to category links
9983 !! options
9984 parsoid=wt2html,wt2wt,html2html
9985 language=is
9986 !! input
9987 x[[Category:Foo]]y
9988 !! result
9989 <p>x<link rel="mw:WikiLink/Category" href="Category:Foo">y</p>
9990 !! end
9991
9992 !! test
9993 Parsoid: Serialize link to file page with colon escape
9994 !! options
9995 parsoid
9996 !! input
9997
9998 [[:File:Foo.png]]
9999 [[:File:Foo.png|Bar]]
10000 !! result
10001 <p>
10002 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
10003 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
10004 </p>
10005 !! end
10006
10007 !! test
10008 Parsoid: Serialize a genuine category link without colon escape
10009 !! options
10010 parsoid
10011 !! input
10012 [[Category:Foo]]
10013 [[Category:Foo|Bar]]
10014 !! result
10015 <link rel="mw:WikiLink/Category" href="Category:Foo">
10016 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
10017 !! end
10018
10019 ###
10020 ### Inter-language links
10021 ###
10022 !! test
10023 Inter-language links
10024 !! options
10025 ill
10026 !! input
10027 [[es:Alimento]]
10028 [[fr:Nourriture]]
10029 [[zh:&#39135;&#21697;]]
10030 !! result
10031 es:Alimento fr:Nourriture zh:食品
10032 !! end
10033
10034 !! test
10035 Duplicate interlanguage links (bug 24502)
10036 !! options
10037 ill
10038 !! input
10039 [[es:1]]
10040 [[es:2]]
10041 [[fr:1]]
10042 [[fr:2]]
10043 !! result
10044 es:1 fr:1
10045 !! end
10046
10047 ###
10048 ### Sections
10049 ###
10050 !! test
10051 Basic section headings
10052 !! input
10053 == Headline 1 ==
10054 Some text
10055
10056 ==Headline 2==
10057 More
10058 ===Smaller headline===
10059 Blah blah
10060 !! result
10061 <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>
10062 <p>Some text
10063 </p>
10064 <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>
10065 <p>More
10066 </p>
10067 <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>
10068 <p>Blah blah
10069 </p>
10070 !! end
10071
10072 !! test
10073 Section headings with TOC
10074 !! input
10075 == Headline 1 ==
10076 === Subheadline 1 ===
10077 ===== Skipping a level =====
10078 ====== Skipping a level ======
10079
10080 == Headline 2 ==
10081 Some text
10082 ===Another headline===
10083 !! result
10084 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10085 <ul>
10086 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
10087 <ul>
10088 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
10089 <ul>
10090 <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>
10091 <ul>
10092 <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>
10093 </ul>
10094 </li>
10095 </ul>
10096 </li>
10097 </ul>
10098 </li>
10099 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
10100 <ul>
10101 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
10102 </ul>
10103 </li>
10104 </ul>
10105 </div>
10106 <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>
10107 <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>
10108 <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>
10109 <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>
10110 <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>
10111 <p>Some text
10112 </p>
10113 <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>
10114
10115 !! end
10116
10117 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
10118 !! test
10119 Handling of sections up to level 6 and beyond
10120 !! input
10121 = Level 1 Heading=
10122 == Level 2 Heading==
10123 === Level 3 Heading===
10124 ==== Level 4 Heading====
10125 ===== Level 5 Heading=====
10126 ====== Level 6 Heading======
10127 ======= Level 7 Heading=======
10128 ======== Level 8 Heading========
10129 ========= Level 9 Heading=========
10130 ========== Level 10 Heading==========
10131 !! result
10132 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10133 <ul>
10134 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
10135 <ul>
10136 <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>
10137 <ul>
10138 <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>
10139 <ul>
10140 <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>
10141 <ul>
10142 <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>
10143 <ul>
10144 <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>
10145 <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>
10146 <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>
10147 <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>
10148 <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>
10149 </ul>
10150 </li>
10151 </ul>
10152 </li>
10153 </ul>
10154 </li>
10155 </ul>
10156 </li>
10157 </ul>
10158 </li>
10159 </ul>
10160 </div>
10161 <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>
10162 <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>
10163 <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>
10164 <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>
10165 <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>
10166 <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>
10167 <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>
10168 <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>
10169 <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>
10170 <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>
10171
10172 !! end
10173
10174 !! test
10175 TOC regression (bug 9764)
10176 !! input
10177 == title 1 ==
10178 === title 1.1 ===
10179 ==== title 1.1.1 ====
10180 === title 1.2 ===
10181 == title 2 ==
10182 === title 2.1 ===
10183 !! result
10184 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10185 <ul>
10186 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10187 <ul>
10188 <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>
10189 <ul>
10190 <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>
10191 </ul>
10192 </li>
10193 <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>
10194 </ul>
10195 </li>
10196 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
10197 <ul>
10198 <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>
10199 </ul>
10200 </li>
10201 </ul>
10202 </div>
10203 <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>
10204 <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>
10205 <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>
10206 <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>
10207 <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>
10208 <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>
10209
10210 !! end
10211
10212 !! test
10213 TOC with wgMaxTocLevel=3 (bug 6204)
10214 !! options
10215 wgMaxTocLevel=3
10216 !! input
10217 == title 1 ==
10218 === title 1.1 ===
10219 ==== title 1.1.1 ====
10220 === title 1.2 ===
10221 == title 2 ==
10222 === title 2.1 ===
10223 !! result
10224 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10225 <ul>
10226 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10227 <ul>
10228 <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>
10229 <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>
10230 </ul>
10231 </li>
10232 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
10233 <ul>
10234 <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>
10235 </ul>
10236 </li>
10237 </ul>
10238 </div>
10239 <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>
10240 <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>
10241 <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>
10242 <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>
10243 <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>
10244 <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>
10245
10246 !! end
10247
10248 !! test
10249 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
10250 !! options
10251 wgMaxTocLevel=3
10252 !! input
10253 ==Section 1==
10254 ===Section 1.1===
10255 ====Section 1.1.1====
10256 ====Section 1.1.1.1====
10257 ==Section 2==
10258 !! result
10259 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10260 <ul>
10261 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
10262 <ul>
10263 <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>
10264 </ul>
10265 </li>
10266 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
10267 </ul>
10268 </div>
10269 <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>
10270 <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>
10271 <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>
10272 <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>
10273 <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>
10274
10275 !! end
10276
10277
10278 !! test
10279 Resolving duplicate section names
10280 !! input
10281 == Foo bar ==
10282 == Foo bar ==
10283 !! result
10284 <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>
10285 <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>
10286
10287 !! end
10288
10289 !! test
10290 Resolving duplicate section names with differing case (bug 10721)
10291 !! input
10292 == Foo bar ==
10293 == Foo Bar ==
10294 !! result
10295 <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>
10296 <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>
10297
10298 !! end
10299
10300 !! article
10301 Template:sections
10302 !! text
10303 ===Section 1===
10304 ==Section 2==
10305 !! endarticle
10306
10307 !! test
10308 Template with sections, __NOTOC__
10309 !! input
10310 __NOTOC__
10311 ==Section 0==
10312 {{sections}}
10313 ==Section 4==
10314 !! result
10315 <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>
10316 <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>
10317 <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>
10318 <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>
10319
10320 !! end
10321
10322 !! test
10323 __NOEDITSECTION__ keyword
10324 !! input
10325 __NOEDITSECTION__
10326 ==Section 1==
10327 ==Section 2==
10328 !! result
10329 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
10330 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
10331
10332 !! end
10333
10334 !! test
10335 Link inside a section heading
10336 !! input
10337 ==Section with a [[Main Page|link]] in it==
10338 !! result
10339 <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>
10340
10341 !! end
10342
10343 !! test
10344 TOC regression (bug 12077)
10345 !! input
10346 __TOC__
10347 == title 1 ==
10348 === title 1.1 ===
10349 == title 2 ==
10350 !! result
10351 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10352 <ul>
10353 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10354 <ul>
10355 <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>
10356 </ul>
10357 </li>
10358 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
10359 </ul>
10360 </div>
10361 <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>
10362 <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>
10363 <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>
10364
10365 !! end
10366
10367 !! test
10368 BUG 1219 URL next to image (good)
10369 !! input
10370 http://example.com [[Image:foobar.jpg]]
10371 !! result
10372 <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>
10373 </p>
10374 !!end
10375
10376 !! test
10377 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
10378 !! input
10379 ===
10380 The line above must have a trailing space!
10381 === <!--
10382 --> <!-- -->
10383 But just in case it doesn't...
10384 !! result
10385 <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>
10386 <p>The line above must have a trailing space!
10387 </p>
10388 <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>
10389 <p>But just in case it doesn't...
10390 </p>
10391 !! end
10392
10393 !! test
10394 Header with special characters (bug 25462)
10395 !! input
10396 The tooltips shall not show entities to the user (ie. be double escaped)
10397
10398 == text > text ==
10399 section 1
10400
10401 == text < text ==
10402 section 2
10403
10404 == text & text ==
10405 section 3
10406
10407 == text ' text ==
10408 section 4
10409
10410 == text " text ==
10411 section 5
10412 !! result
10413 <p>The tooltips shall not show entities to the user (ie. be double escaped)
10414 </p>
10415 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10416 <ul>
10417 <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>
10418 <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>
10419 <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>
10420 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
10421 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
10422 </ul>
10423 </div>
10424 <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>
10425 <p>section 1
10426 </p>
10427 <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>
10428 <p>section 2
10429 </p>
10430 <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>
10431 <p>section 3
10432 </p>
10433 <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>
10434 <p>section 4
10435 </p>
10436 <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>
10437 <p>section 5
10438 </p>
10439 !! end
10440
10441 !! test
10442 Headers with excess '=' characters
10443 (Are similar tests necessary beyond the 1st level?)
10444 !! input
10445 =foo==
10446 ==foo=
10447 =''italic'' heading==
10448 ==''italic'' heading=
10449 !! result
10450 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10451 <ul>
10452 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
10453 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
10454 <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>
10455 <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>
10456 </ul>
10457 </div>
10458 <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>
10459 <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>
10460 <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>
10461 <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>
10462
10463 !! end
10464
10465 !! test
10466 HTML headers vs TOC (bug 23393)
10467 (__NOEDITSECTION__ for clearer output, doesn't matter here)
10468 !! input
10469 <h1>Header 1</h1>
10470 == Header 1.1 ==
10471 == Header 1.2 ==
10472
10473 <h1>Header 2
10474 </h1>
10475 == Header 2.1 ==
10476 == Header 2.2 ==
10477 __NOEDITSECTION__
10478 !! result
10479 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10480 <ul>
10481 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
10482 <ul>
10483 <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>
10484 <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>
10485 </ul>
10486 </li>
10487 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
10488 <ul>
10489 <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>
10490 <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>
10491 </ul>
10492 </li>
10493 </ul>
10494 </div>
10495 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
10496 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
10497 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
10498 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
10499 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
10500 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
10501
10502 !! end
10503
10504 !! test
10505 BUG 1219 URL next to image (broken)
10506 !! input
10507 http://example.com[[Image:foobar.jpg]]
10508 !! result
10509 <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>
10510 </p>
10511 !!end
10512
10513 !! test
10514 Bug 1186 news: in the middle of text
10515 !! input
10516 http://en.wikinews.org/wiki/Wikinews:Workplace
10517 !! result
10518 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
10519 </p>
10520 !!end
10521
10522
10523 !! test
10524 Namespaced link must have a title
10525 !! input
10526 [[Project:]]
10527 !! result
10528 <p>[[Project:]]
10529 </p>
10530 !!end
10531
10532 !! test
10533 Namespaced link must have a title (bad fragment version)
10534 !! input
10535 [[Project:#fragment]]
10536 !! result
10537 <p>[[Project:#fragment]]
10538 </p>
10539 !!end
10540
10541
10542 ###
10543 ### HTML tags and HTML attributes
10544 ###
10545
10546 !! test
10547 div with no attributes
10548 !! input
10549 <div>HTML rocks</div>
10550 !! result
10551 <div>HTML rocks</div>
10552
10553 !! end
10554
10555 !! test
10556 div with double-quoted attribute
10557 !! input
10558 <div id="rock">HTML rocks</div>
10559 !! result
10560 <div id="rock">HTML rocks</div>
10561
10562 !! end
10563
10564 !! test
10565 div with single-quoted attribute
10566 !! input
10567 <div id='rock'>HTML rocks</div>
10568 !! result
10569 <div id="rock">HTML rocks</div>
10570
10571 !! end
10572
10573 !! test
10574 div with unquoted attribute
10575 !! input
10576 <div id=rock>HTML rocks</div>
10577 !! result
10578 <div id="rock">HTML rocks</div>
10579
10580 !! end
10581
10582 !! test
10583 div with illegal double attributes
10584 !! input
10585 <div id="a" id="b">HTML rocks</div>
10586 !! result
10587 <div id="b">HTML rocks</div>
10588
10589 !!end
10590
10591 # FIXME: produce empty string instead of "class" in the PHP parser, following
10592 # the HTML5 spec.
10593 !! test
10594 div with empty attribute value, space before equals
10595 !! options
10596 parsoid
10597 !! input
10598 <div class =>HTML rocks</div>
10599 !! result
10600 <div class="">HTML rocks</div>
10601
10602 !! end
10603
10604 # The PHP parser escapes the opening brace to &#123; for some reason, so
10605 # disabled this test for it.
10606 !! test
10607 div with braces in attribute value
10608 !! options
10609 parsoid
10610 !! input
10611 <div title="{}">Foo</div>
10612 !! result
10613 <div title="{}">Foo</div>
10614 !! end
10615
10616 # This it very inconsistent in the PHP parser: it returns
10617 # class="class" if there is a space between the name and the equal sign (see
10618 # 'div with empty attribute value, space before equals'), but strips the
10619 # attribute completely if the space is missing. We hope that not much content
10620 # depends on this, so are implementing the behavior below in Parsoid for
10621 # consistencies' sake. Disabled for the PHP parser.
10622 # FIXME: fix this behavior in the PHP parser?
10623 !! test
10624 div with empty attribute value, no space before equals
10625 !! options
10626 parsoid
10627 !! input
10628 <div class=>HTML rocks</div>
10629 !! result
10630 <div class="">HTML rocks</div>
10631
10632 !! end
10633
10634 !! test
10635 HTML multiple attributes correction
10636 !! input
10637 <p class="error" class="awesome">Awesome!</p>
10638 !! result
10639 <p class="awesome">Awesome!</p>
10640
10641 !!end
10642
10643 !! test
10644 Table multiple attributes correction
10645 !! input
10646 {|
10647 !+ class="error" class="awesome"| status
10648 |}
10649 !! result
10650 <table>
10651 <tr>
10652 <th class="awesome"> status
10653 </th></tr></table>
10654
10655 !!end
10656
10657 !! test
10658 DIV IN UPPERCASE
10659 !! input
10660 <DIV ID="x">HTML ROCKS</DIV>
10661 !! result
10662 <div id="x">HTML ROCKS</div>
10663
10664 !!end
10665
10666 !! test
10667 Non-ASCII pseudo-tags are rendered as text
10668 !! input
10669 <khyô>
10670 !! result
10671 <p>&lt;khyô&gt;
10672 </p>
10673 !! end
10674
10675 !! test
10676 Pseudo-tag with URL 'name' renders as url link
10677 !! input
10678 <http://example.com/>
10679 !! result
10680 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
10681 </p>
10682 !! end
10683
10684 !! test
10685 text with amp in the middle of nowhere
10686 !! input
10687 Remember AT&T?
10688 !!result
10689 <p>Remember AT&amp;T?
10690 </p>
10691 !! end
10692
10693 !! test
10694 text with character entity: eacute
10695 !! input
10696 I always thought &eacute; was a cute letter.
10697 !! result
10698 <p>I always thought &#233; was a cute letter.
10699 </p>
10700 !! end
10701
10702 !! test
10703 text with entity-escaped character entity-like string: eacute
10704 !! input
10705 I always thought &amp;eacute; was a cute letter.
10706 !! result
10707 <p>I always thought &amp;eacute; was a cute letter.
10708 </p>
10709 !! end
10710
10711 !! test
10712 text with undefined character entity: xacute
10713 !! input
10714 I always thought &xacute; was a cute letter.
10715 !! result
10716 <p>I always thought &amp;xacute; was a cute letter.
10717 </p>
10718 !! end
10719
10720
10721 ###
10722 ### Nesting tests (see bug 41545, 50604, 51081)
10723 ###
10724
10725 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
10726 # Note that html2wt is considerably more difficult if we use <b> in
10727 # the test case, instead of <big>
10728 !! test
10729 Ensure that HTML adoption agency algorithm is properly implemented.
10730 !! input
10731 <big>X<big>Y</big>Z</big>
10732 !! result
10733 <p><big>X<big>Y</big>Z</big>
10734 </p>
10735 !! end
10736
10737 # This was bug 41545 in the PHP parser.
10738 !! test
10739 Nesting of <kbd>
10740 !! input
10741 <kbd>X<kbd>Y</kbd>Z</kbd>
10742 !! result
10743 <p><kbd>X<kbd>Y</kbd>Z</kbd>
10744 </p>
10745 !! end
10746
10747 # The following cases were bug 51081 in the PHP parser.
10748 # Note that there are some other nestable tags (b, i, etc) which are
10749 # not covered; see bug 51081 for discussion.
10750 !! test
10751 Nesting of <em>
10752 !! input
10753 <em>X<em>Y</em>Z</em>
10754 !! result
10755 <p><em>X<em>Y</em>Z</em>
10756 </p>
10757 !! end
10758
10759 !! test
10760 Nesting of <strong>
10761 !! input
10762 <strong>X<strong>Y</strong>Z</strong>
10763 !! result
10764 <p><strong>X<strong>Y</strong>Z</strong>
10765 </p>
10766 !! end
10767
10768 !! test
10769 Nesting of <q>
10770 !! input
10771 <q>X<q>Y</q>Z</q>
10772 !! result
10773 <p><q>X<q>Y</q>Z</q>
10774 </p>
10775 !! end
10776
10777 !! test
10778 Nesting of <ruby>
10779 !! input
10780 <ruby>X<ruby>Y</ruby>Z</ruby>
10781 !! result
10782 <p><ruby>X<ruby>Y</ruby>Z</ruby>
10783 </p>
10784 !! end
10785
10786 !! test
10787 Nesting of <bdo>
10788 !! input
10789 <bdo>X<bdo>Y</bdo>Z</bdo>
10790 !! result
10791 <p><bdo>X<bdo>Y</bdo>Z</bdo>
10792 </p>
10793 !! end
10794
10795
10796 ###
10797 ### Media links
10798 ###
10799
10800 !! test
10801 Media link
10802 !! input
10803 [[Media:Foobar.jpg]]
10804 !! result
10805 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
10806 </p>
10807 !! end
10808
10809 !! test
10810 Media link with text
10811 !! input
10812 [[Media:Foobar.jpg|A neat file to look at]]
10813 !! result
10814 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
10815 </p>
10816 !! end
10817
10818 # FIXME: this is still bad HTML tag nesting
10819 !! test
10820 Media link with nasty text
10821 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
10822 !! input
10823 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
10824 !! result
10825 <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>
10826
10827 !! end
10828
10829 !! test
10830 Media link to nonexistent file (bug 1702)
10831 !! input
10832 [[Media:No such.jpg]]
10833 !! result
10834 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
10835 </p>
10836 !! end
10837
10838 !! test
10839 Image link to nonexistent file (bug 1850 - good)
10840 !! input
10841 [[Image:No such.jpg]]
10842 !! result
10843 <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>
10844 </p>
10845 !! end
10846
10847 !! test
10848 :Image link to nonexistent file (bug 1850 - bad)
10849 !! input
10850 [[:Image:No such.jpg]]
10851 !! result
10852 <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>
10853 </p>
10854 !! end
10855
10856
10857
10858 !! test
10859 Character reference normalization in link text (bug 1938)
10860 !! input
10861 [[Main Page|this&that]]
10862 !! result
10863 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
10864 </p>
10865 !!end
10866
10867 !! article
10868 אַ
10869 !! text
10870 Test for unicode normalization
10871
10872 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
10873 !! endarticle
10874
10875 !! test
10876 (bug 19451) Links should refer to the normalized form.
10877 !! input
10878 [[&#xFB2E;]]
10879 [[&#x5d0;&#x5b7;]]
10880 [[&#x5d0;ַ]]
10881 [[א&#x5b7;]]
10882 [[אַ]]
10883 !! result
10884 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
10885 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
10886 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
10887 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
10888 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
10889 </p>
10890 !! end
10891
10892 !! test
10893 Empty attribute crash test (bug 2067)
10894 !! input
10895 <font color="">foo</font>
10896 !! result
10897 <p><font color="">foo</font>
10898 </p>
10899 !! end
10900
10901 !! test
10902 Empty attribute crash test single-quotes (bug 2067)
10903 !! input
10904 <font color=''>foo</font>
10905 !! result
10906 <p><font color="">foo</font>
10907 </p>
10908 !! end
10909
10910 !! test
10911 Attribute test: equals, then nothing
10912 !! input
10913 <font color=>foo</font>
10914 !! result
10915 <p><font>foo</font>
10916 </p>
10917 !! end
10918
10919 !! test
10920 Attribute test: unquoted value
10921 !! input
10922 <font color=x>foo</font>
10923 !! result
10924 <p><font color="x">foo</font>
10925 </p>
10926 !! end
10927
10928 !! test
10929 Attribute test: unquoted but illegal value (hash)
10930 !! input
10931 <font color=#x>foo</font>
10932 !! result
10933 <p><font color="#x">foo</font>
10934 </p>
10935 !! end
10936
10937 !! test
10938 Attribute test: no value
10939 !! input
10940 <font color>foo</font>
10941 !! result
10942 <p><font color="color">foo</font>
10943 </p>
10944 !! end
10945
10946 !! test
10947 Bug 2095: link with three closing brackets
10948 !! input
10949 [[Main Page]]]
10950 !! result
10951 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
10952 </p>
10953 !! end
10954
10955 !! test
10956 Bug 2095: link with pipe and three closing brackets
10957 !! input
10958 [[Main Page|link]]]
10959 !! result
10960 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
10961 </p>
10962 !! end
10963
10964 !! test
10965 Bug 2095: link with pipe and three closing brackets, version 2
10966 !! input
10967 [[Main Page|[http://example.com/]]]
10968 !! result
10969 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
10970 </p>
10971 !! end
10972
10973
10974 ###
10975 ### Safety
10976 ###
10977
10978 !! article
10979 Template:Dangerous attribute
10980 !! text
10981 " onmouseover="alert(document.cookie)
10982 !! endarticle
10983
10984 !! article
10985 Template:Dangerous style attribute
10986 !! text
10987 border-size: expression(alert(document.cookie))
10988 !! endarticle
10989
10990 !! article
10991 Template:Div style
10992 !! text
10993 <div style="float: right; {{{1}}}">Magic div</div>
10994 !! endarticle
10995
10996 !! test
10997 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
10998 !! input
10999 <div title="{{test}}"></div>
11000 !! result
11001 <div title="This is a test template"></div>
11002
11003 !! end
11004
11005 !! test
11006 Bug 2304: HTML attribute safety (dangerous template; 2309)
11007 !! input
11008 <div title="{{dangerous attribute}}"></div>
11009 !! result
11010 <div title=""></div>
11011
11012 !! end
11013
11014 !! test
11015 Bug 2304: HTML attribute safety (dangerous style template; 2309)
11016 !! input
11017 <div style="{{dangerous style attribute}}"></div>
11018 !! result
11019 <div style="/* insecure input */"></div>
11020
11021 !! end
11022
11023 !! test
11024 Bug 2304: HTML attribute safety (safe parameter; 2309)
11025 !! input
11026 {{div style|width: 200px}}
11027 !! result
11028 <div style="float: right; width: 200px">Magic div</div>
11029
11030 !! end
11031
11032 !! test
11033 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
11034 !! input
11035 {{div style|width: expression(alert(document.cookie))}}
11036 !! result
11037 <div style="/* insecure input */">Magic div</div>
11038
11039 !! end
11040
11041 !! test
11042 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
11043 !! input
11044 {{div style|"><script>alert(document.cookie)</script>}}
11045 !! result
11046 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
11047
11048 !! end
11049
11050 !! test
11051 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
11052 !! input
11053 {{div style|" ><script>alert(document.cookie)</script>}}
11054 !! result
11055 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
11056
11057 !! end
11058
11059 !! test
11060 Bug 2304: HTML attribute safety (link)
11061 !! input
11062 <div title="[[Main Page]]"></div>
11063 !! result
11064 <div title="&#91;&#91;Main Page]]"></div>
11065
11066 !! end
11067
11068 !! test
11069 Bug 2304: HTML attribute safety (italics)
11070 !! input
11071 <div title="''foobar''"></div>
11072 !! result
11073 <div title="&#39;&#39;foobar&#39;&#39;"></div>
11074
11075 !! end
11076
11077 !! test
11078 Bug 2304: HTML attribute safety (bold)
11079 !! input
11080 <div title="'''foobar'''"></div>
11081 !! result
11082 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
11083
11084 !! end
11085
11086
11087 !! test
11088 Bug 2304: HTML attribute safety (ISBN)
11089 !! input
11090 <div title="ISBN 1234567890"></div>
11091 !! result
11092 <div title="&#73;SBN 1234567890"></div>
11093
11094 !! end
11095
11096 !! test
11097 Bug 2304: HTML attribute safety (RFC)
11098 !! input
11099 <div title="RFC 1234"></div>
11100 !! result
11101 <div title="&#82;FC 1234"></div>
11102
11103 !! end
11104
11105 !! test
11106 Bug 2304: HTML attribute safety (PMID)
11107 !! input
11108 <div title="PMID 1234567890"></div>
11109 !! result
11110 <div title="&#80;MID 1234567890"></div>
11111
11112 !! end
11113
11114 !! test
11115 Bug 2304: HTML attribute safety (web link)
11116 !! input
11117 <div title="http://example.com/"></div>
11118 !! result
11119 <div title="http&#58;//example.com/"></div>
11120
11121 !! end
11122
11123 !! test
11124 Bug 2304: HTML attribute safety (named web link)
11125 !! input
11126 <div title="[http://example.com/ link]"></div>
11127 !! result
11128 <div title="&#91;http&#58;//example.com/ link]"></div>
11129
11130 !! end
11131
11132 !! test
11133 Bug 3244: HTML attribute safety (extension; safe)
11134 !! input
11135 <div style="<nowiki>background:blue</nowiki>"></div>
11136 !! result
11137 <div style="background:blue"></div>
11138
11139 !! end
11140
11141 !! test
11142 Bug 3244: HTML attribute safety (extension; unsafe)
11143 !! input
11144 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
11145 !! result
11146 <div style="/* insecure input */"></div>
11147
11148 !! end
11149
11150 # More MSIE fun discovered by Tom Gilder
11151
11152 !! test
11153 MSIE CSS safety test: spurious slash
11154 !! input
11155 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
11156 !! result
11157 <div style="/* insecure input */">evil</div>
11158
11159 !! end
11160
11161 !! test
11162 MSIE CSS safety test: hex code
11163 !! input
11164 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
11165 !! result
11166 <div style="/* insecure input */">evil</div>
11167
11168 !! end
11169
11170 !! test
11171 MSIE CSS safety test: comment in url
11172 !! input
11173 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
11174 !! result
11175 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
11176
11177 !! end
11178
11179 !! test
11180 MSIE CSS safety test: comment in expression
11181 !! input
11182 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
11183 !! result
11184 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
11185
11186 !! end
11187
11188
11189 !! test
11190 Table attribute legitimate extension
11191 !! input
11192 {|
11193 !+ style="<nowiki>color:blue</nowiki>"| status
11194 |}
11195 !! result
11196 <table>
11197 <tr>
11198 <th style="color:blue"> status
11199 </th></tr></table>
11200
11201 !!end
11202
11203 !! test
11204 Table attribute safety
11205 !! input
11206 {|
11207 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
11208 |}
11209 !! result
11210 <table>
11211 <tr>
11212 <th style="/* insecure input */"> status
11213 </th></tr></table>
11214
11215 !! end
11216
11217 !! test
11218 CSS line continuation 1
11219 !! input
11220 <div style="background-image: u\&#10;rl(test.jpg);"></div>
11221 !! result
11222 <div style="/* insecure input */"></div>
11223
11224 !! end
11225
11226 !! test
11227 CSS line continuation 2
11228 !! input
11229 <div style="background-image: u\&#13;rl(test.jpg); "></div>
11230 !! result
11231 <div style="/* insecure input */"></div>
11232
11233 !! end
11234
11235 !! article
11236 Template:Identity
11237 !! text
11238 {{{1}}}
11239 !! endarticle
11240
11241 !! test
11242 Expansion of multi-line templates in attribute values (bug 6255)
11243 !! input
11244 <div style="background: {{identity|#00FF00}}">-</div>
11245 !! result
11246 <div style="background: #00FF00">-</div>
11247
11248 !! end
11249
11250
11251 !! test
11252 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
11253 !! input
11254 <div style="background:
11255 #00FF00">-</div>
11256 !! result
11257 <div style="background: #00FF00">-</div>
11258
11259 !! end
11260
11261 !! test
11262 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
11263 !! input
11264 <div style="background: &#10;#00FF00">-</div>
11265 !! result
11266 <div style="background: &#10;#00FF00">-</div>
11267
11268 !! end
11269
11270 ###
11271 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
11272 ###
11273 !! test
11274 Parser hook: empty input
11275 !! input
11276 <tag></tag>
11277 !! result
11278 <pre>
11279 ''
11280 array (
11281 )
11282 </pre>
11283
11284 !! end
11285
11286 !! test
11287 Parser hook: empty input using terminated empty elements
11288 !! input
11289 <tag/>
11290 !! result
11291 <pre>
11292 NULL
11293 array (
11294 )
11295 </pre>
11296
11297 !! end
11298
11299 !! test
11300 Parser hook: empty input using terminated empty elements (space before)
11301 !! input
11302 <tag />
11303 !! result
11304 <pre>
11305 NULL
11306 array (
11307 )
11308 </pre>
11309
11310 !! end
11311
11312 !! test
11313 Parser hook: basic input
11314 !! input
11315 <tag>input</tag>
11316 !! result
11317 <pre>
11318 'input'
11319 array (
11320 )
11321 </pre>
11322
11323 !! end
11324
11325
11326 !! test
11327 Parser hook: case insensitive
11328 !! input
11329 <TAG>input</TAG>
11330 !! result
11331 <pre>
11332 'input'
11333 array (
11334 )
11335 </pre>
11336
11337 !! end
11338
11339
11340 !! test
11341 Parser hook: case insensitive, redux
11342 !! input
11343 <TaG>input</TAg>
11344 !! result
11345 <pre>
11346 'input'
11347 array (
11348 )
11349 </pre>
11350
11351 !! end
11352
11353 !! test
11354 Parser hook: nested tags
11355 !! options
11356 noxml
11357 !! input
11358 <tag><tag></tag></tag>
11359 !! result
11360 <pre>
11361 '<tag>'
11362 array (
11363 )
11364 </pre>&lt;/tag&gt;
11365
11366 !! end
11367
11368 !! test
11369 Parser hook: basic arguments
11370 !! input
11371 <tag width=200 height = "100" depth = '50' square></tag>
11372 !! result
11373 <pre>
11374 ''
11375 array (
11376 'width' => '200',
11377 'height' => '100',
11378 'depth' => '50',
11379 'square' => 'square',
11380 )
11381 </pre>
11382
11383 !! end
11384
11385 !! test
11386 Parser hook: argument containing a forward slash (bug 5344)
11387 !! input
11388 <tag filename='/tmp/bla'></tag>
11389 !! result
11390 <pre>
11391 ''
11392 array (
11393 'filename' => '/tmp/bla',
11394 )
11395 </pre>
11396
11397 !! end
11398
11399 !! test
11400 Parser hook: empty input using terminated empty elements (bug 2374)
11401 !! input
11402 <tag foo=bar/>text
11403 !! result
11404 <pre>
11405 NULL
11406 array (
11407 'foo' => 'bar',
11408 )
11409 </pre>text
11410
11411 !! end
11412
11413 # </tag> should be output literally since there is no matching tag that begins it
11414 !! test
11415 Parser hook: basic arguments using terminated empty elements (bug 2374)
11416 !! input
11417 <tag width=200 height = "100" depth = '50' square/>
11418 other stuff
11419 </tag>
11420 !! result
11421 <pre>
11422 NULL
11423 array (
11424 'width' => '200',
11425 'height' => '100',
11426 'depth' => '50',
11427 'square' => 'square',
11428 )
11429 </pre>
11430 <p>other stuff
11431 &lt;/tag&gt;
11432 </p>
11433 !! end
11434
11435 ###
11436 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
11437 ###
11438
11439 !! test
11440 Parser hook: static parser hook not inside a comment
11441 !! input
11442 <statictag>hello, world</statictag>
11443 <statictag action=flush/>
11444 !! result
11445 <p>hello, world
11446 </p>
11447 !! end
11448
11449
11450 !! test
11451 Parser hook: static parser hook inside a comment
11452 !! input
11453 <!-- <statictag>hello, world</statictag> -->
11454 <statictag action=flush/>
11455 !! result
11456 <p><br />
11457 </p>
11458 !! end
11459
11460 # Nested template calls; this case was broken by Parser.php rev 1.506,
11461 # since reverted.
11462
11463 !! article
11464 Template:One-parameter
11465 !! text
11466 (My parameter is: {{{1}}})
11467 !! endarticle
11468
11469 !! article
11470 Template:Map-one-parameter
11471 !! text
11472 {{{{{1}}}|{{{2}}}}}
11473 !! endarticle
11474
11475 !! test
11476 Nested template calls
11477 !! input
11478 {{Map-one-parameter|One-parameter|param}}
11479 !! result
11480 <p>(My parameter is: param)
11481 </p>
11482 !! end
11483
11484
11485 ###
11486 ### Sanitizer
11487 ###
11488 !! test
11489 Sanitizer: Closing of open tags
11490 !! input
11491 <s></s><table></table>
11492 !! result
11493 <s></s><table></table>
11494
11495 !! end
11496
11497 !! test
11498 Sanitizer: Closing of open but not closed tags
11499 !! input
11500 <s>foo
11501 !! result
11502 <p><s>foo</s>
11503 </p>
11504 !! end
11505
11506 !! test
11507 Sanitizer: Closing of closed but not open tags
11508 !! input
11509 </s>
11510 !! result
11511 <p>&lt;/s&gt;
11512 </p>
11513 !! end
11514
11515 !! test
11516 Sanitizer: Closing of closed but not open table tags
11517 !! input
11518 Table not started</td></tr></table>
11519 !! result
11520 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
11521 </p>
11522 !! end
11523
11524 !! test
11525 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
11526 !! input
11527 <span id="æ: v">byte</span>[[#æ: v|backlink]]
11528 !! result
11529 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
11530 </p>
11531 !! end
11532
11533 !! test
11534 Sanitizer: Validating the contents of the id attribute (bug 4515)
11535 !! options
11536 disabled
11537 !! input
11538 <br id=9 />
11539 !! result
11540 Something, but definitely not <br id="9" />...
11541 !! end
11542
11543 !! test
11544 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
11545 !! options
11546 disabled
11547 !! input
11548 <br id="foo" /><br id="foo" />
11549 !! result
11550 Something need to be done. foo-2 ?
11551 !! end
11552
11553 !! test
11554 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
11555 !! input
11556 <div itemscope>
11557 <meta itemprop="hello" content="world">
11558 <meta http-equiv="refresh" content="5">
11559 <meta itemprop="hello" http-equiv="refresh" content="5">
11560 <link itemprop="hello" href="{{SERVER}}">
11561 <link rel="stylesheet" href="{{SERVER}}">
11562 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
11563 </div>
11564 !! result
11565 <div itemscope="itemscope">
11566 <p> <meta itemprop="hello" content="world" />
11567 &lt;meta http-equiv="refresh" content="5"&gt;
11568 <meta itemprop="hello" content="5" />
11569 </p>
11570 <link itemprop="hello" href="http&#58;//example.org" />
11571 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
11572 <link itemprop="hello" href="http&#58;//example.org" />
11573 </div>
11574
11575 !! end
11576
11577 !! test
11578 Language converter: output gets cut off unexpectedly (bug 5757)
11579 !! options
11580 language=zh
11581 !! input
11582 this bit is safe: }-
11583
11584 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
11585
11586 then we get cut off here: }-
11587
11588 all additional text is vanished
11589 !! result
11590 <p>this bit is safe: }-
11591 </p><p>but if we add a conversion instance: xxx
11592 </p><p>then we get cut off here: }-
11593 </p><p>all additional text is vanished
11594 </p>
11595 !! end
11596
11597 !! test
11598 Self closed html pairs (bug 5487)
11599 !! options
11600 !! input
11601 <center><font id="bug" />Centered text</center>
11602 <div><font id="bug2" />In div text</div>
11603 !! result
11604 <center>&lt;font id="bug" /&gt;Centered text</center>
11605 <div>&lt;font id="bug2" /&gt;In div text</div>
11606
11607 !! end
11608
11609 #
11610 #
11611 #
11612
11613 !! test
11614 Punctuation: nbsp before exclamation
11615 !! input
11616 C'est grave !
11617 !! result
11618 <p>C'est grave&#160;!
11619 </p>
11620 !! end
11621
11622 !! test
11623 Punctuation: CSS !important (bug 11874)
11624 !! input
11625 <div style="width:50% !important">important</div>
11626 !! result
11627 <div style="width:50% !important">important</div>
11628
11629 !!end
11630
11631 !! test
11632 Punctuation: CSS ! important (bug 11874; with space after)
11633 !! input
11634 <div style="width:50% ! important">important</div>
11635 !! result
11636 <div style="width:50% ! important">important</div>
11637
11638 !!end
11639
11640
11641 !! test
11642 HTML bullet list, closed tags (bug 5497)
11643 !! input
11644 <ul>
11645 <li>One</li>
11646 <li>Two</li>
11647 </ul>
11648 !! result
11649 <ul>
11650 <li>One</li>
11651 <li>Two</li>
11652 </ul>
11653
11654 !! end
11655
11656 !! test
11657 HTML bullet list, unclosed tags (bug 5497)
11658 !! options
11659 disabled
11660 !! input
11661 <ul>
11662 <li>One
11663 <li>Two
11664 </ul>
11665 !! result
11666 <ul>
11667 <li>One
11668 </li><li>Two
11669 </li></ul>
11670
11671 !! end
11672
11673 !! test
11674 HTML ordered list, closed tags (bug 5497)
11675 !! input
11676 <ol>
11677 <li>One</li>
11678 <li>Two</li>
11679 </ol>
11680 !! result
11681 <ol>
11682 <li>One</li>
11683 <li>Two</li>
11684 </ol>
11685
11686 !! end
11687
11688 !! test
11689 HTML ordered list, unclosed tags (bug 5497)
11690 !! options
11691 disabled
11692 !! input
11693 <ol>
11694 <li>One
11695 <li>Two
11696 </ol>
11697 !! result
11698 <ol>
11699 <li>One
11700 </li><li>Two
11701 </li></ol>
11702
11703 !! end
11704
11705 !! test
11706 HTML nested bullet list, closed tags (bug 5497)
11707 !! input
11708 <ul>
11709 <li>One</li>
11710 <li>Two:
11711 <ul>
11712 <li>Sub-one</li>
11713 <li>Sub-two</li>
11714 </ul>
11715 </li>
11716 </ul>
11717 !! result
11718 <ul>
11719 <li>One</li>
11720 <li>Two:
11721 <ul>
11722 <li>Sub-one</li>
11723 <li>Sub-two</li>
11724 </ul>
11725 </li>
11726 </ul>
11727
11728 !! end
11729
11730 !! test
11731 HTML nested bullet list, open tags (bug 5497)
11732 !! options
11733 disabled
11734 !! input
11735 <ul>
11736 <li>One
11737 <li>Two:
11738 <ul>
11739 <li>Sub-one
11740 <li>Sub-two
11741 </ul>
11742 </ul>
11743 !! result
11744 <ul>
11745 <li>One
11746 </li><li>Two:
11747 <ul>
11748 <li>Sub-one
11749 </li><li>Sub-two
11750 </li></ul>
11751 </li></ul>
11752
11753 !! end
11754
11755 !! test
11756 HTML nested ordered list, closed tags (bug 5497)
11757 !! input
11758 <ol>
11759 <li>One</li>
11760 <li>Two:
11761 <ol>
11762 <li>Sub-one</li>
11763 <li>Sub-two</li>
11764 </ol>
11765 </li>
11766 </ol>
11767 !! result
11768 <ol>
11769 <li>One</li>
11770 <li>Two:
11771 <ol>
11772 <li>Sub-one</li>
11773 <li>Sub-two</li>
11774 </ol>
11775 </li>
11776 </ol>
11777
11778 !! end
11779
11780 !! test
11781 HTML nested ordered list, open tags (bug 5497)
11782 !! options
11783 disabled
11784 !! input
11785 <ol>
11786 <li>One
11787 <li>Two:
11788 <ol>
11789 <li>Sub-one
11790 <li>Sub-two
11791 </ol>
11792 </ol>
11793 !! result
11794 <ol>
11795 <li>One
11796 </li><li>Two:
11797 <ol>
11798 <li>Sub-one
11799 </li><li>Sub-two
11800 </li></ol>
11801 </li></ol>
11802
11803 !! end
11804
11805 !! test
11806 HTML ordered list item with parameters oddity
11807 !! input
11808 <ol><li id="fragment">One</li></ol>
11809 !! result
11810 <ol><li id="fragment">One</li></ol>
11811
11812 !! end
11813
11814 !!test
11815 bug 5918: autonumbering
11816 !! input
11817 [http://first/] [http://second] [ftp://ftp]
11818
11819 ftp://inlineftp
11820
11821 [mailto:enclosed@mail.tld With target]
11822
11823 [mailto:enclosed@mail.tld]
11824
11825 mailto:inline@mail.tld
11826 !! result
11827 <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>
11828 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
11829 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
11830 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
11831 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
11832 </p>
11833 !! end
11834
11835
11836 #
11837 # Security and HTML correctness
11838 # From Nick Jenkins' fuzz testing
11839 #
11840
11841 !! test
11842 Fuzz testing: Parser13
11843 !! input
11844 {|
11845 | http://a|
11846 !! result
11847 <table>
11848 <tr>
11849 <td>
11850 </td>
11851 </tr>
11852 </table>
11853
11854 !! end
11855
11856 !! test
11857 Fuzz testing: Parser14
11858 !! input
11859 == onmouseover= ==
11860 http://__TOC__
11861 !! result
11862 <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>
11863 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11864 <ul>
11865 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
11866 </ul>
11867 </div>
11868
11869 !! end
11870
11871 !! test
11872 Fuzz testing: Parser14-table
11873 !! input
11874 ==a==
11875 {| STYLE=__TOC__
11876 !! result
11877 <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>
11878 <table style="&#95;_TOC&#95;_">
11879 <tr><td></td></tr>
11880 </table>
11881
11882 !! end
11883
11884 # Known to produce bogus xml (extra </td>)
11885 !! test
11886 Fuzz testing: Parser16
11887 !! options
11888 noxml
11889 !! input
11890 {|
11891 !https://||||||
11892 !! result
11893 <table>
11894 <tr>
11895 <th>https://</th>
11896 <th></th>
11897 <th></th>
11898 <th>
11899 </td>
11900 </tr>
11901 </table>
11902
11903 !! end
11904
11905 !! test
11906 Fuzz testing: Parser21
11907 !! input
11908 {|
11909 ! irc://{{ftp://a" onmouseover="alert('hello world');"
11910 |
11911 !! result
11912 <table>
11913 <tr>
11914 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
11915 </th>
11916 <td>
11917 </td>
11918 </tr>
11919 </table>
11920
11921 !! end
11922
11923 !! test
11924 Fuzz testing: Parser22
11925 !! input
11926 http://===r:::https://b
11927
11928 {|
11929 !!result
11930 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
11931 </p>
11932 <table>
11933 <tr><td></td></tr>
11934 </table>
11935
11936 !! end
11937
11938 # Known to produce bad XML for now
11939 !! test
11940 Fuzz testing: Parser24
11941 !! options
11942 noxml
11943 !! input
11944 {|
11945 {{{|
11946 <u CLASS=
11947 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
11948 <br style="onmouseover='alert(document.cookie);' " />
11949
11950 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11951 |
11952 !! result
11953 <table>
11954 {{{|
11955 <u class="&#124;">}}}} &gt;
11956 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
11957
11958 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11959 <tr>
11960 <td></u>
11961 </td>
11962 </tr>
11963 </table>
11964
11965 !! end
11966
11967 # Note: the current result listed for this is not what the original one was,
11968 # but the original bug was JavaScript injection, which is fixed in any case.
11969 # It's not clear that the original result listed was any more correct than the
11970 # current one. Original result:
11971 # <p>{{{|
11972 # </p>
11973 # <li class="&#124;&#124;">
11974 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11975 !!test
11976 Fuzz testing: Parser25 (bug 6055)
11977 !! input
11978 {{{
11979 |
11980 <LI CLASS=||
11981 >
11982 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
11983 !! result
11984 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11985 </p>
11986 !! end
11987
11988 !!test
11989 Fuzz testing: URL adjacent extension (with space, clean)
11990 !! options
11991 !! input
11992 http://example.com <nowiki>junk</nowiki>
11993 !! result
11994 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
11995 </p>
11996 !!end
11997
11998 !!test
11999 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
12000 !! options
12001 !! input
12002 http://example.com<nowiki>junk</nowiki>
12003 !! result
12004 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
12005 </p>
12006 !!end
12007
12008 !!test
12009 Fuzz testing: URL adjacent extension (no space, dirty; pre)
12010 !! options
12011 !! input
12012 http://example.com<pre>junk</pre>
12013 !! result
12014 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
12015
12016 !!end
12017
12018 !!test
12019 Fuzz testing: image with bogus manual thumbnail
12020 !!input
12021 [[Image:foobar.jpg|thumbnail= ]]
12022 !!result
12023 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
12024
12025 !!end
12026
12027 !! test
12028 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
12029 !! input
12030 <pre dir="&#10;"></pre>
12031 !! result
12032 <pre dir="&#10;"></pre>
12033
12034 !! end
12035
12036 !! test
12037 Parsing optional HTML elements (Bug 6171)
12038 !! options
12039 !! input
12040 <table>
12041 <tr>
12042 <td> Some tabular data</td>
12043 <td> More tabular data ...
12044 <td> And yet som tabular data</td>
12045 </tr>
12046 </table>
12047 !! result
12048 <table>
12049 <tr>
12050 <td> Some tabular data</td>
12051 <td> More tabular data ...
12052 </td><td> And yet som tabular data</td>
12053 </tr>
12054 </table>
12055
12056 !! end
12057
12058 !! test
12059 Correct handling of <td>, <tr> (Bug 6171)
12060 !! options
12061 !! input
12062 <table>
12063 <tr>
12064 <td> Some tabular data</td>
12065 <td> More tabular data ...</td>
12066 <td> And yet som tabular data</td>
12067 </tr>
12068 </table>
12069 !! result
12070 <table>
12071 <tr>
12072 <td> Some tabular data</td>
12073 <td> More tabular data ...</td>
12074 <td> And yet som tabular data</td>
12075 </tr>
12076 </table>
12077
12078 !! end
12079
12080
12081 !! test
12082 Parsing crashing regression (fr:JavaScript)
12083 !! input
12084 </body></x>
12085 !! result
12086 <p>&lt;/body&gt;&lt;/x&gt;
12087 </p>
12088 !! end
12089
12090 !! test
12091 Inline wiki vs wiki block nesting
12092 !! input
12093 '''Bold paragraph
12094
12095 New wiki paragraph
12096 !! result
12097 <p><b>Bold paragraph</b>
12098 </p><p>New wiki paragraph
12099 </p>
12100 !! end
12101
12102 !! test
12103 Inline HTML vs wiki block nesting
12104 !! options
12105 disabled
12106 !! input
12107 <b>Bold paragraph
12108
12109 New wiki paragraph
12110 !! result
12111 <p><b>Bold paragraph</b>
12112 </p><p>New wiki paragraph
12113 </p>
12114 !! end
12115
12116 # Original result was this:
12117 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
12118 # </p>
12119 # While that might be marginally more intuitive, maybe, the six-apostrophe
12120 # construct is clearly pathological and the result stated here (which is what
12121 # the parser actually does) is about as reasonable as anything.
12122 !!test
12123 Mixing markup for italics and bold
12124 !! options
12125 !! input
12126 '''bold''''''bold''bolditalics'''''
12127 !! result
12128 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
12129 </p>
12130 !! end
12131
12132
12133 !! article
12134 Xyzzyx
12135 !! text
12136 Article for special page transclusion test
12137 !! endarticle
12138
12139 !! test
12140 Special page transclusion
12141 !! options
12142 !! input
12143 {{Special:Prefixindex/Xyzzyx}}
12144 !! result
12145 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
12146
12147 !! end
12148
12149 !! test
12150 Special page transclusion twice (bug 5021)
12151 !! options
12152 !! input
12153 {{Special:Prefixindex/Xyzzyx}}
12154 {{Special:Prefixindex/Xyzzyx}}
12155 !! result
12156 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
12157 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
12158
12159 !! end
12160
12161 !! test
12162 Transclusion of default MediaWiki message
12163 !! input
12164 {{MediaWiki:Mainpage}}
12165 !!result
12166 <p>Main Page
12167 </p>
12168 !! end
12169
12170 !! test
12171 Transclusion of nonexistent MediaWiki message
12172 !! input
12173 {{MediaWiki:Mainpagexxx}}
12174 !!result
12175 <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>
12176 </p>
12177 !! end
12178
12179 !! test
12180 Transclusion of MediaWiki message with underscore
12181 !! input
12182 {{MediaWiki:history_short}}
12183 !! result
12184 <p>History
12185 </p>
12186 !! end
12187
12188 !! test
12189 Transclusion of MediaWiki message with space
12190 !! input
12191 {{MediaWiki:history short}}
12192 !! result
12193 <p>History
12194 </p>
12195 !! end
12196
12197 !! test
12198 Invalid header with following text
12199 !! input
12200 = x = y
12201 !! result
12202 <p>= x = y
12203 </p>
12204 !! end
12205
12206
12207 !! test
12208 Section extraction test (section 0)
12209 !! options
12210 section=0
12211 !! input
12212 start
12213 ==a==
12214 ===aa===
12215 ====aaa====
12216 ==b==
12217 ===ba===
12218 ===bb===
12219 ====bba====
12220 ===bc===
12221 ==c==
12222 ===ca===
12223 !! result
12224 start
12225 !! end
12226
12227 !! test
12228 Section extraction test (section 1)
12229 !! options
12230 section=1
12231 !! input
12232 start
12233 ==a==
12234 ===aa===
12235 ====aaa====
12236 ==b==
12237 ===ba===
12238 ===bb===
12239 ====bba====
12240 ===bc===
12241 ==c==
12242 ===ca===
12243 !! result
12244 ==a==
12245 ===aa===
12246 ====aaa====
12247 !! end
12248
12249 !! test
12250 Section extraction test (section 2)
12251 !! options
12252 section=2
12253 !! input
12254 start
12255 ==a==
12256 ===aa===
12257 ====aaa====
12258 ==b==
12259 ===ba===
12260 ===bb===
12261 ====bba====
12262 ===bc===
12263 ==c==
12264 ===ca===
12265 !! result
12266 ===aa===
12267 ====aaa====
12268 !! end
12269
12270 !! test
12271 Section extraction test (section 3)
12272 !! options
12273 section=3
12274 !! input
12275 start
12276 ==a==
12277 ===aa===
12278 ====aaa====
12279 ==b==
12280 ===ba===
12281 ===bb===
12282 ====bba====
12283 ===bc===
12284 ==c==
12285 ===ca===
12286 !! result
12287 ====aaa====
12288 !! end
12289
12290 !! test
12291 Section extraction test (section 4)
12292 !! options
12293 section=4
12294 !! input
12295 start
12296 ==a==
12297 ===aa===
12298 ====aaa====
12299 ==b==
12300 ===ba===
12301 ===bb===
12302 ====bba====
12303 ===bc===
12304 ==c==
12305 ===ca===
12306 !! result
12307 ==b==
12308 ===ba===
12309 ===bb===
12310 ====bba====
12311 ===bc===
12312 !! end
12313
12314 !! test
12315 Section extraction test (section 5)
12316 !! options
12317 section=5
12318 !! input
12319 start
12320 ==a==
12321 ===aa===
12322 ====aaa====
12323 ==b==
12324 ===ba===
12325 ===bb===
12326 ====bba====
12327 ===bc===
12328 ==c==
12329 ===ca===
12330 !! result
12331 ===ba===
12332 !! end
12333
12334 !! test
12335 Section extraction test (section 6)
12336 !! options
12337 section=6
12338 !! input
12339 start
12340 ==a==
12341 ===aa===
12342 ====aaa====
12343 ==b==
12344 ===ba===
12345 ===bb===
12346 ====bba====
12347 ===bc===
12348 ==c==
12349 ===ca===
12350 !! result
12351 ===bb===
12352 ====bba====
12353 !! end
12354
12355 !! test
12356 Section extraction test (section 7)
12357 !! options
12358 section=7
12359 !! input
12360 start
12361 ==a==
12362 ===aa===
12363 ====aaa====
12364 ==b==
12365 ===ba===
12366 ===bb===
12367 ====bba====
12368 ===bc===
12369 ==c==
12370 ===ca===
12371 !! result
12372 ====bba====
12373 !! end
12374
12375 !! test
12376 Section extraction test (section 8)
12377 !! options
12378 section=8
12379 !! input
12380 start
12381 ==a==
12382 ===aa===
12383 ====aaa====
12384 ==b==
12385 ===ba===
12386 ===bb===
12387 ====bba====
12388 ===bc===
12389 ==c==
12390 ===ca===
12391 !! result
12392 ===bc===
12393 !! end
12394
12395 !! test
12396 Section extraction test (section 9)
12397 !! options
12398 section=9
12399 !! input
12400 start
12401 ==a==
12402 ===aa===
12403 ====aaa====
12404 ==b==
12405 ===ba===
12406 ===bb===
12407 ====bba====
12408 ===bc===
12409 ==c==
12410 ===ca===
12411 !! result
12412 ==c==
12413 ===ca===
12414 !! end
12415
12416 !! test
12417 Section extraction test (section 10)
12418 !! options
12419 section=10
12420 !! input
12421 start
12422 ==a==
12423 ===aa===
12424 ====aaa====
12425 ==b==
12426 ===ba===
12427 ===bb===
12428 ====bba====
12429 ===bc===
12430 ==c==
12431 ===ca===
12432 !! result
12433 ===ca===
12434 !! end
12435
12436 !! test
12437 Section extraction test (nonexistent section 11)
12438 !! options
12439 section=11
12440 !! input
12441 start
12442 ==a==
12443 ===aa===
12444 ====aaa====
12445 ==b==
12446 ===ba===
12447 ===bb===
12448 ====bba====
12449 ===bc===
12450 ==c==
12451 ===ca===
12452 !! result
12453 !! end
12454
12455 !! test
12456 Section extraction test with bogus heading (section 1)
12457 !! options
12458 section=1
12459 !! input
12460 ==a==
12461 ==bogus== not a legal section
12462 ==b==
12463 !! result
12464 ==a==
12465 ==bogus== not a legal section
12466 !! end
12467
12468 !! test
12469 Section extraction test with bogus heading (section 2)
12470 !! options
12471 section=2
12472 !! input
12473 ==a==
12474 ==bogus== not a legal section
12475 ==b==
12476 !! result
12477 ==b==
12478 !! end
12479
12480 !! test
12481 Section extraction test with comment after heading (section 1)
12482 !! options
12483 section=1
12484 !! input
12485 ==a==
12486 ==b== <!-- -->
12487 ==c==
12488 !! result
12489 ==a==
12490 !! end
12491
12492 !! test
12493 Section extraction test with comment after heading (section 2)
12494 !! options
12495 section=2
12496 !! input
12497 ==a==
12498 ==b== <!-- -->
12499 ==c==
12500 !! result
12501 ==b== <!-- -->
12502 !! end
12503
12504 !! test
12505 Section extraction test with bogus <nowiki> heading (section 1)
12506 !! options
12507 section=1
12508 !! input
12509 ==a==
12510 ==bogus== <nowiki>not a legal section</nowiki>
12511 ==b==
12512 !! result
12513 ==a==
12514 ==bogus== <nowiki>not a legal section</nowiki>
12515 !! end
12516
12517 !! test
12518 Section extraction test with bogus <nowiki> heading (section 2)
12519 !! options
12520 section=2
12521 !! input
12522 ==a==
12523 ==bogus== <nowiki>not a legal section</nowiki>
12524 ==b==
12525 !! result
12526 ==b==
12527 !! end
12528
12529
12530 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
12531 # instead of respecting commented sections
12532 !! test
12533 Section extraction prefixed by comment (section 1)
12534 !! options
12535 section=1
12536 !! input
12537 <!-- -->==sec1==
12538 ==sec2==
12539 !!result
12540 ==sec2==
12541 !!end
12542
12543 !! test
12544 Section extraction prefixed by comment (section 2)
12545 !! options
12546 section=2
12547 !! input
12548 <!-- -->==sec1==
12549 ==sec2==
12550 !!result
12551
12552 !!end
12553
12554
12555 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
12556 # instead of respecting HTML-style headings
12557 !! test
12558 Section extraction, mixed wiki and html (section 1)
12559 !! options
12560 section=1
12561 !! input
12562 <h2>unmarked</h2>
12563 unmarked
12564 ==1==
12565 one
12566 ==2==
12567 two
12568 !! result
12569 ==1==
12570 one
12571 !! end
12572
12573 !! test
12574 Section extraction, mixed wiki and html (section 2)
12575 !! options
12576 section=2
12577 !! input
12578 <h2>unmarked</h2>
12579 unmarked
12580 ==1==
12581 one
12582 ==2==
12583 two
12584 !! result
12585 ==2==
12586 two
12587 !! end
12588
12589
12590 # Formerly testing for bug 3342
12591 !! test
12592 Section extraction, heading surrounded by <noinclude>
12593 !! options
12594 section=1
12595 !! input
12596 <noinclude>==unmarked==</noinclude>
12597 ==marked==
12598 !! result
12599 ==marked==
12600 !!end
12601
12602 # Test behavior of bug 19910
12603 !! test
12604 Sectiion with all-equals
12605 !! options
12606 section=2
12607 !! input
12608 ===
12609 The line above must have a trailing space
12610 === <!--
12611 --> <!-- -->
12612 But just in case it doesn't...
12613 !! result
12614 === <!--
12615 --> <!-- -->
12616 But just in case it doesn't...
12617 !! end
12618
12619 !! test
12620 Section replacement test (section 0)
12621 !! options
12622 replace=0,"xxx"
12623 !! input
12624 start
12625 ==a==
12626 ===aa===
12627 ====aaa====
12628 ==b==
12629 ===ba===
12630 ===bb===
12631 ====bba====
12632 ===bc===
12633 ==c==
12634 ===ca===
12635 !! result
12636 xxx
12637
12638 ==a==
12639 ===aa===
12640 ====aaa====
12641 ==b==
12642 ===ba===
12643 ===bb===
12644 ====bba====
12645 ===bc===
12646 ==c==
12647 ===ca===
12648 !! end
12649
12650 !! test
12651 Section replacement test (section 1)
12652 !! options
12653 replace=1,"xxx"
12654 !! input
12655 start
12656 ==a==
12657 ===aa===
12658 ====aaa====
12659 ==b==
12660 ===ba===
12661 ===bb===
12662 ====bba====
12663 ===bc===
12664 ==c==
12665 ===ca===
12666 !! result
12667 start
12668 xxx
12669
12670 ==b==
12671 ===ba===
12672 ===bb===
12673 ====bba====
12674 ===bc===
12675 ==c==
12676 ===ca===
12677 !! end
12678
12679 !! test
12680 Section replacement test (section 2)
12681 !! options
12682 replace=2,"xxx"
12683 !! input
12684 start
12685 ==a==
12686 ===aa===
12687 ====aaa====
12688 ==b==
12689 ===ba===
12690 ===bb===
12691 ====bba====
12692 ===bc===
12693 ==c==
12694 ===ca===
12695 !! result
12696 start
12697 ==a==
12698 xxx
12699
12700 ==b==
12701 ===ba===
12702 ===bb===
12703 ====bba====
12704 ===bc===
12705 ==c==
12706 ===ca===
12707 !! end
12708
12709 !! test
12710 Section replacement test (section 3)
12711 !! options
12712 replace=3,"xxx"
12713 !! input
12714 start
12715 ==a==
12716 ===aa===
12717 ====aaa====
12718 ==b==
12719 ===ba===
12720 ===bb===
12721 ====bba====
12722 ===bc===
12723 ==c==
12724 ===ca===
12725 !! result
12726 start
12727 ==a==
12728 ===aa===
12729 xxx
12730
12731 ==b==
12732 ===ba===
12733 ===bb===
12734 ====bba====
12735 ===bc===
12736 ==c==
12737 ===ca===
12738 !! end
12739
12740 !! test
12741 Section replacement test (section 4)
12742 !! options
12743 replace=4,"xxx"
12744 !! input
12745 start
12746 ==a==
12747 ===aa===
12748 ====aaa====
12749 ==b==
12750 ===ba===
12751 ===bb===
12752 ====bba====
12753 ===bc===
12754 ==c==
12755 ===ca===
12756 !! result
12757 start
12758 ==a==
12759 ===aa===
12760 ====aaa====
12761 xxx
12762
12763 ==c==
12764 ===ca===
12765 !! end
12766
12767 !! test
12768 Section replacement test (section 5)
12769 !! options
12770 replace=5,"xxx"
12771 !! input
12772 start
12773 ==a==
12774 ===aa===
12775 ====aaa====
12776 ==b==
12777 ===ba===
12778 ===bb===
12779 ====bba====
12780 ===bc===
12781 ==c==
12782 ===ca===
12783 !! result
12784 start
12785 ==a==
12786 ===aa===
12787 ====aaa====
12788 ==b==
12789 xxx
12790
12791 ===bb===
12792 ====bba====
12793 ===bc===
12794 ==c==
12795 ===ca===
12796 !! end
12797
12798 !! test
12799 Section replacement test (section 6)
12800 !! options
12801 replace=6,"xxx"
12802 !! input
12803 start
12804 ==a==
12805 ===aa===
12806 ====aaa====
12807 ==b==
12808 ===ba===
12809 ===bb===
12810 ====bba====
12811 ===bc===
12812 ==c==
12813 ===ca===
12814 !! result
12815 start
12816 ==a==
12817 ===aa===
12818 ====aaa====
12819 ==b==
12820 ===ba===
12821 xxx
12822
12823 ===bc===
12824 ==c==
12825 ===ca===
12826 !! end
12827
12828 !! test
12829 Section replacement test (section 7)
12830 !! options
12831 replace=7,"xxx"
12832 !! input
12833 start
12834 ==a==
12835 ===aa===
12836 ====aaa====
12837 ==b==
12838 ===ba===
12839 ===bb===
12840 ====bba====
12841 ===bc===
12842 ==c==
12843 ===ca===
12844 !! result
12845 start
12846 ==a==
12847 ===aa===
12848 ====aaa====
12849 ==b==
12850 ===ba===
12851 ===bb===
12852 xxx
12853
12854 ===bc===
12855 ==c==
12856 ===ca===
12857 !! end
12858
12859 !! test
12860 Section replacement test (section 8)
12861 !! options
12862 replace=8,"xxx"
12863 !! input
12864 start
12865 ==a==
12866 ===aa===
12867 ====aaa====
12868 ==b==
12869 ===ba===
12870 ===bb===
12871 ====bba====
12872 ===bc===
12873 ==c==
12874 ===ca===
12875 !! result
12876 start
12877 ==a==
12878 ===aa===
12879 ====aaa====
12880 ==b==
12881 ===ba===
12882 ===bb===
12883 ====bba====
12884 xxx
12885
12886 ==c==
12887 ===ca===
12888 !!end
12889
12890 !! test
12891 Section replacement test (section 9)
12892 !! options
12893 replace=9,"xxx"
12894 !! input
12895 start
12896 ==a==
12897 ===aa===
12898 ====aaa====
12899 ==b==
12900 ===ba===
12901 ===bb===
12902 ====bba====
12903 ===bc===
12904 ==c==
12905 ===ca===
12906 !! result
12907 start
12908 ==a==
12909 ===aa===
12910 ====aaa====
12911 ==b==
12912 ===ba===
12913 ===bb===
12914 ====bba====
12915 ===bc===
12916 xxx
12917 !! end
12918
12919 !! test
12920 Section replacement test (section 10)
12921 !! options
12922 replace=10,"xxx"
12923 !! input
12924 start
12925 ==a==
12926 ===aa===
12927 ====aaa====
12928 ==b==
12929 ===ba===
12930 ===bb===
12931 ====bba====
12932 ===bc===
12933 ==c==
12934 ===ca===
12935 !! result
12936 start
12937 ==a==
12938 ===aa===
12939 ====aaa====
12940 ==b==
12941 ===ba===
12942 ===bb===
12943 ====bba====
12944 ===bc===
12945 ==c==
12946 xxx
12947 !! end
12948
12949 !! test
12950 Section replacement test with initial whitespace (bug 13728)
12951 !! options
12952 replace=2,"xxx"
12953 !! input
12954 Preformatted initial line
12955 ==a==
12956 ===a===
12957 !! result
12958 Preformatted initial line
12959 ==a==
12960 xxx
12961 !! end
12962
12963
12964 !! test
12965 Section extraction, heading followed by pre with 20 spaces (bug 6398)
12966 !! options
12967 section=1
12968 !! input
12969 ==a==
12970 a
12971 !! result
12972 ==a==
12973 a
12974 !! end
12975
12976 !! test
12977 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
12978 !! options
12979 section=1
12980 !! input
12981 ==a==
12982 a
12983 !! result
12984 ==a==
12985 a
12986 !! end
12987
12988
12989 !! test
12990 Section extraction, <pre> around bogus header (bug 10309)
12991 !! options
12992 noxml section=2
12993 !! input
12994 == Section One ==
12995 <pre>
12996 =======
12997 </pre>
12998
12999 == Section Two ==
13000 stuff
13001 !! result
13002 == Section Two ==
13003 stuff
13004 !! end
13005
13006 !! test
13007 Section replacement, <pre> around bogus header (bug 10309)
13008 !! options
13009 noxml replace=2,"xxx"
13010 !! input
13011 == Section One ==
13012 <pre>
13013 =======
13014 </pre>
13015
13016 == Section Two ==
13017 stuff
13018 !! result
13019 == Section One ==
13020 <pre>
13021 =======
13022 </pre>
13023
13024 xxx
13025 !! end
13026
13027
13028
13029 !! test
13030 Handling of &#x0A; in URLs
13031 !! input
13032 **irc://&#x0A;a
13033 !! result
13034 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
13035 </li></ul>
13036 </li></ul>
13037
13038 !!end
13039
13040 !! test
13041 5 quotes, code coverage +1 line (php)
13042 !! options
13043 php
13044 !! input
13045 '''''
13046 !! result
13047 !! end
13048 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
13049 !! test
13050 5 quotes, code coverage +1 line (parsoid)
13051 !! options
13052 parsoid
13053 !! input
13054 '''''
13055 !! result
13056 <p><b><i></i></b></p>
13057 !! end
13058
13059 !! test
13060 Special:Search page linking.
13061 !! input
13062 {{Special:search}}
13063 !! result
13064 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
13065 </p>
13066 !! end
13067
13068 !! test
13069 Say the magic word
13070 !! options
13071 title=[[Parser test]]
13072 !! input
13073 * {{PAGENAME}}
13074 * {{PAGENAMEE}}
13075 * {{FULLPAGENAME}}
13076 * {{FULLPAGENAMEE}}
13077 * {{BASEPAGENAME}}
13078 * {{BASEPAGENAMEE}}
13079 * {{SUBPAGENAME}}
13080 * {{SUBPAGENAMEE}}
13081 * {{ROOTPAGENAME}}
13082 * {{ROOTPAGENAMEE}}
13083 * {{TALKPAGENAME}}
13084 * {{TALKPAGENAMEE}}
13085 * {{SUBJECTPAGENAME}}
13086 * {{SUBJECTPAGENAMEE}}
13087 * {{NAMESPACEE}}
13088 * {{NAMESPACE}}
13089 * {{NAMESPACENUMBER}}
13090 * {{TALKSPACE}}
13091 * {{TALKSPACEE}}
13092 * {{SUBJECTSPACE}}
13093 * {{SUBJECTSPACEE}}
13094 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
13095 !! result
13096 <ul><li> Parser test
13097 </li><li> Parser_test
13098 </li><li> Parser test
13099 </li><li> Parser_test
13100 </li><li> Parser test
13101 </li><li> Parser_test
13102 </li><li> Parser test
13103 </li><li> Parser_test
13104 </li><li> Parser test
13105 </li><li> Parser_test
13106 </li><li> Talk:Parser test
13107 </li><li> Talk:Parser_test
13108 </li><li> Parser test
13109 </li><li> Parser_test
13110 </li><li>
13111 </li><li>
13112 </li><li> 0
13113 </li><li> Talk
13114 </li><li> Talk
13115 </li><li>
13116 </li><li>
13117 </li><li> <a href="/index.php?title=Template:Dynamic&amp;action=edit&amp;redlink=1" class="new" title="Template:Dynamic (page does not exist)">Template:Dynamic</a>
13118 </li></ul>
13119
13120 !! end
13121 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
13122
13123 !! test
13124 Gallery
13125 !! input
13126 <gallery>
13127 image1.png |
13128 image2.gif|||||
13129
13130 image3|
13131 image4 |300px| centre
13132 image5.svg| http://///////
13133 [[x|xx]]]]
13134 * image6
13135 </gallery>
13136 !! result
13137 <ul class="gallery mw-gallery-traditional">
13138 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13139 <div class="thumb" style="height: 150px;">Image1.png</div>
13140 <div class="gallerytext">
13141 </div>
13142 </div></li>
13143 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13144 <div class="thumb" style="height: 150px;">Image2.gif</div>
13145 <div class="gallerytext">
13146 <p>||||
13147 </p>
13148 </div>
13149 </div></li>
13150 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13151 <div class="thumb" style="height: 150px;">Image3</div>
13152 <div class="gallerytext">
13153 </div>
13154 </div></li>
13155 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13156 <div class="thumb" style="height: 150px;">Image4</div>
13157 <div class="gallerytext">
13158 <p>300px| centre
13159 </p>
13160 </div>
13161 </div></li>
13162 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13163 <div class="thumb" style="height: 150px;">Image5.svg</div>
13164 <div class="gallerytext">
13165 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
13166 </p>
13167 </div>
13168 </div></li>
13169 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13170 <div class="thumb" style="height: 150px;">* image6</div>
13171 <div class="gallerytext">
13172 </div>
13173 </div></li>
13174 </ul>
13175
13176 !! end
13177
13178 !! test
13179 Gallery (with options)
13180 !! input
13181 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
13182 File:Nonexistant.jpg|caption
13183 File:Nonexistant.jpg
13184 image:foobar.jpg|some '''caption''' [[Main Page]]
13185 image:foobar.jpg
13186 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
13187 </gallery>
13188 !! result
13189 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
13190 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
13191 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13192 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
13193 <div class="gallerytext">
13194 <p>caption
13195 </p>
13196 </div>
13197 </div></li>
13198 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13199 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
13200 <div class="gallerytext">
13201 </div>
13202 </div></li>
13203 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13204 <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>
13205 <div class="gallerytext">
13206 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13207 </p>
13208 </div>
13209 </div></li>
13210 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13211 <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>
13212 <div class="gallerytext">
13213 </div>
13214 </div></li>
13215 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13216 <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>
13217 <div class="gallerytext">
13218 <p>Blabla|blabla.
13219 </p>
13220 </div>
13221 </div></li>
13222 </ul>
13223
13224 !! end
13225
13226 !! test
13227 Gallery with wikitext inside caption
13228 !! input
13229 <gallery>
13230 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
13231 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
13232 </gallery>
13233 !! result
13234 <ul class="gallery mw-gallery-traditional">
13235 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13236 <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>
13237 <div class="gallerytext">
13238 <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>
13239 </p>
13240 </div>
13241 </div></li>
13242 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13243 <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>
13244 <div class="gallerytext">
13245 <p>This is a test template
13246 </p>
13247 </div>
13248 </div></li>
13249 </ul>
13250
13251 !! end
13252
13253 !! test
13254 gallery (with showfilename option)
13255 !! input
13256 <gallery showfilename>
13257 File:Nonexistant.jpg|caption
13258 File:Nonexistant.jpg
13259 image:foobar.jpg|some '''caption''' [[Main Page]]
13260 File:Foobar.jpg
13261 </gallery>
13262 !! result
13263 <ul class="gallery mw-gallery-traditional">
13264 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13265 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13266 <div class="gallerytext">
13267 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
13268 caption
13269 </p>
13270 </div>
13271 </div></li>
13272 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13273 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13274 <div class="gallerytext">
13275 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
13276 </p>
13277 </div>
13278 </div></li>
13279 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13280 <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>
13281 <div class="gallerytext">
13282 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
13283 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13284 </p>
13285 </div>
13286 </div></li>
13287 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13288 <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>
13289 <div class="gallerytext">
13290 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
13291 </p>
13292 </div>
13293 </div></li>
13294 </ul>
13295
13296 !! end
13297
13298 !! test
13299 Gallery (with namespace-less filenames)
13300 !! input
13301 <gallery>
13302 File:Nonexistant.jpg
13303 Nonexistant.jpg
13304 image:foobar.jpg
13305 foobar.jpg
13306 </gallery>
13307 !! result
13308 <ul class="gallery mw-gallery-traditional">
13309 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13310 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13311 <div class="gallerytext">
13312 </div>
13313 </div></li>
13314 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13315 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13316 <div class="gallerytext">
13317 </div>
13318 </div></li>
13319 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13320 <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>
13321 <div class="gallerytext">
13322 </div>
13323 </div></li>
13324 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13325 <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>
13326 <div class="gallerytext">
13327 </div>
13328 </div></li>
13329 </ul>
13330
13331 !! end
13332
13333 !! test
13334 HTML Hex character encoding (spells the word "JavaScript")
13335 !! input
13336 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
13337 !! result
13338 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
13339 </p>
13340 !! end
13341
13342 !! test
13343 HTML Hex character encoding bogus encoding (bug 26437 regression check)
13344 !! input
13345 &#xsee;&#XSEE;
13346 !! result
13347 <p>&amp;#xsee;&amp;#XSEE;
13348 </p>
13349 !! end
13350
13351 !! test
13352 HTML Hex character encoding mixed case
13353 !! input
13354 &#xEE;&#Xee;
13355 !! result
13356 <p>&#xee;&#xee;
13357 </p>
13358 !! end
13359
13360 !! test
13361 __FORCETOC__ override
13362 !! input
13363 __NEWSECTIONLINK__
13364 __FORCETOC__
13365 !! result
13366 <p><br />
13367 </p>
13368 !! end
13369
13370 !! test
13371 ISBN code coverage
13372 !! input
13373 ISBN 978-0-1234-56&#x20;789
13374 !! result
13375 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
13376 </p>
13377 !! end
13378
13379 !! test
13380 ISBN followed by 5 spaces
13381 !! input
13382 ISBN
13383 !! result
13384 <p>ISBN
13385 </p>
13386 !! end
13387
13388 !! test
13389 Double ISBN
13390 !! input
13391 ISBN ISBN 1234567890
13392 !! result
13393 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13394 </p>
13395 !! end
13396
13397 !! test
13398 Bug 22905: <abbr> followed by ISBN followed by </a>
13399 !! input
13400 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
13401 !! result
13402 <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>
13403 </p>
13404 !! end
13405
13406 !! test
13407 Double RFC
13408 !! input
13409 RFC RFC 1234
13410 !! result
13411 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
13412 </p>
13413 !! end
13414
13415 !! test
13416 Double RFC with a wiki link
13417 !! input
13418 RFC [[RFC 1234]]
13419 !! result
13420 <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>
13421 </p>
13422 !! end
13423
13424 !! test
13425 RFC code coverage
13426 !! input
13427 RFC 983&#x20;987
13428 !! result
13429 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
13430 </p>
13431 !! end
13432
13433 !! test
13434 Centre-aligned image
13435 !! input
13436 [[Image:foobar.jpg|centre]]
13437 !! result
13438 <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>
13439
13440 !!end
13441
13442 !! test
13443 None-aligned image
13444 !! input
13445 [[Image:foobar.jpg|none]]
13446 !! result
13447 <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>
13448
13449 !!end
13450
13451 !! test
13452 Width + Height sized image (using px) (height is ignored)
13453 !! input
13454 [[Image:foobar.jpg|640x480px]]
13455 !! result
13456 <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>
13457 </p>
13458 !!end
13459
13460 !! test
13461 Width-sized image (using px, no following whitespace)
13462 !! input
13463 [[Image:foobar.jpg|640px]]
13464 !! result
13465 <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>
13466 </p>
13467 !!end
13468
13469 !! test
13470 Width-sized image (using px, with following whitespace - test regression from r39467)
13471 !! input
13472 [[Image:foobar.jpg|640px ]]
13473 !! result
13474 <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>
13475 </p>
13476 !!end
13477
13478 !! test
13479 Width-sized image (using px, with preceding whitespace - test regression from r39467)
13480 !! input
13481 [[Image:foobar.jpg| 640px]]
13482 !! result
13483 <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>
13484 </p>
13485 !!end
13486
13487 !! test
13488 Another italics / bold test
13489 !! input
13490 ''' ''x'
13491 !! result
13492 <pre>'<i> </i>x'
13493 </pre>
13494 !!end
13495
13496 # Note the results may be incorrect, as parserTest output included this:
13497 # XML error: Mismatched tag at byte 6120:
13498 # ...<dd> </dt></dl> </dd...
13499 !! test
13500 dt/dd/dl test
13501 !! options
13502 disabled
13503 !! input
13504 :;;;::
13505 !! result
13506 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
13507 </dd></dl>
13508 </dd></dl>
13509 </dt></dl>
13510 </dt></dl>
13511 </dt></dl>
13512 </dd></dl>
13513
13514 !!end
13515
13516
13517 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
13518 !! test
13519 Images with the "|" character in the comment
13520 !! input
13521 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
13522 !! result
13523 <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>
13524
13525 !!end
13526
13527 !! test
13528 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
13529 !! input
13530 <html><script>alert(1);</script></html>
13531 !! result
13532 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
13533 </p>
13534 !! end
13535
13536 !! test
13537 HTML with raw HTML ($wgRawHtml==true)
13538 !! options
13539 wgRawHtml=1
13540 !! input
13541 <html><script>alert(1);</script></html>
13542 !! result
13543 <p><script>alert(1);</script>
13544 </p>
13545 !! end
13546
13547 !! test
13548 Parents of subpages, one level up
13549 !! options
13550 subpage title=[[Subpage test/L1/L2/L3]]
13551 !! input
13552 [[../|L2]]
13553 !! result
13554 <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>
13555 </p>
13556 !! end
13557
13558
13559 !! test
13560 Parents of subpages, one level up, not named
13561 !! options
13562 subpage title=[[Subpage test/L1/L2/L3]]
13563 !! input
13564 [[../]]
13565 !! result
13566 <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>
13567 </p>
13568 !! end
13569
13570
13571
13572 !! test
13573 Parents of subpages, two levels up
13574 !! options
13575 subpage title=[[Subpage test/L1/L2/L3]]
13576 !! input
13577 [[../../|L1]]2
13578
13579 [[../../|L1]]l
13580 !! result
13581 <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
13582 </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>
13583 </p>
13584 !! end
13585
13586 !! test
13587 Parents of subpages, two levels up, without trailing slash or name.
13588 !! options
13589 subpage title=[[Subpage test/L1/L2/L3]]
13590 !! input
13591 [[../..]]
13592 !! result
13593 <p>[[../..]]
13594 </p>
13595 !! end
13596
13597 !! test
13598 Parents of subpages, two levels up, with lots of extra trailing slashes.
13599 !! options
13600 subpage title=[[Subpage test/L1/L2/L3]]
13601 !! input
13602 [[../../////]]
13603 !! result
13604 <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>
13605 </p>
13606 !! end
13607
13608 !! article
13609 Subpage test/L1/L2/L3Sibling
13610 !! text
13611 Sibling article
13612 !! endarticle
13613
13614 !! test
13615 Transclusion of a sibling page (one level up)
13616 !! options
13617 subpage title=[[Subpage test/L1/L2/L3]]
13618 !! input
13619 {{../L3Sibling}}
13620 !! result
13621 <p>Sibling article
13622 </p>
13623 !! end
13624
13625 !! test
13626 Transclusion of a child page
13627 !! options
13628 subpage title=[[Subpage test/L1/L2]]
13629 !! input
13630 {{/L3Sibling}}
13631 !! result
13632 <p>Sibling article
13633 </p>
13634 !! end
13635
13636 !! test
13637 Non-transclusion because of too many up levels
13638 !! options
13639 subpage title=[[Subpage test/L1/L2/L3]]
13640 !! input
13641 {{../../../../More than parent}}
13642 !! result
13643 <p>{{../../../../More than parent}}
13644 </p>
13645 !! end
13646
13647 !! test
13648 Definition list code coverage
13649 !! input
13650 ; title : def
13651 ; title : def
13652 ;title: def
13653 !! result
13654 <dl><dt> title &#160;</dt><dd> def
13655 </dd><dt> title&#160;</dt><dd> def
13656 </dd><dt>title</dt><dd> def
13657 </dd></dl>
13658
13659 !! end
13660
13661 !! test
13662 Don't fall for the self-closing div
13663 !! input
13664 <div>hello world</div/>
13665 !! result
13666 <div>hello world</div>
13667
13668 !! end
13669
13670 !! test
13671 MSGNW magic word
13672 !! input
13673 {{MSGNW:msg}}
13674 !! result
13675 <p>&#91;&#91;:Template:Msg&#93;&#93;
13676 </p>
13677 !! end
13678
13679 !! test
13680 RAW magic word
13681 !! input
13682 {{RAW:QUERTY}}
13683 !! result
13684 <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>
13685 </p>
13686 !! end
13687
13688 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
13689 !! test
13690 Always escape literal '>' in output, not just after '<'
13691 !! input
13692 ><>
13693 !! result
13694 <p>&gt;&lt;&gt;
13695 </p>
13696 !! end
13697
13698 !! test
13699 Template caching
13700 !! input
13701 {{Test}}
13702 {{Test}}
13703 !! result
13704 <p>This is a test template
13705 This is a test template
13706 </p>
13707 !! end
13708
13709
13710 !! article
13711 MediaWiki:Fake
13712 !! text
13713 ==header==
13714 !! endarticle
13715
13716 !! test
13717 Inclusion of !userCanEdit() content
13718 !! input
13719 {{MediaWiki:Fake}}
13720 !! result
13721 <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>
13722
13723 !! end
13724
13725
13726 !! test
13727 Out-of-order TOC heading levels
13728 !! input
13729 ==2==
13730 ======6======
13731 ===3===
13732 =1=
13733 =====5=====
13734 ==2==
13735 !! result
13736 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13737 <ul>
13738 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
13739 <ul>
13740 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
13741 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
13742 </ul>
13743 </li>
13744 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
13745 <ul>
13746 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
13747 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
13748 </ul>
13749 </li>
13750 </ul>
13751 </div>
13752 <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>
13753 <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>
13754 <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>
13755 <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>
13756 <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>
13757 <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>
13758
13759 !! end
13760
13761
13762 !! test
13763 ISBN with a dummy number
13764 !! input
13765 ISBN ---
13766 !! result
13767 <p>ISBN ---
13768 </p>
13769 !! end
13770
13771
13772 !! test
13773 ISBN with space-delimited number
13774 !! input
13775 ISBN 92 9017 032 8
13776 !! result
13777 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
13778 </p>
13779 !! end
13780
13781
13782 !! test
13783 ISBN with multiple spaces, no number
13784 !! input
13785 ISBN foo
13786 !! result
13787 <p>ISBN foo
13788 </p>
13789 !! end
13790
13791
13792 !! test
13793 ISBN length
13794 !! input
13795 ISBN 123456789
13796
13797 ISBN 1234567890
13798
13799 ISBN 12345678901
13800 !! result
13801 <p>ISBN 123456789
13802 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13803 </p><p>ISBN 12345678901
13804 </p>
13805 !! end
13806
13807
13808 !! test
13809 ISBN with trailing year (bug 8110)
13810 !! input
13811 ISBN 1-234-56789-0 - 2006
13812
13813 ISBN 1 234 56789 0 - 2006
13814 !! result
13815 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
13816 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
13817 </p>
13818 !! end
13819
13820
13821 !! test
13822 anchorencode
13823 !! input
13824 {{anchorencode:foo bar©#%n}}
13825 !! result
13826 <p>foo_bar.C2.A9.23.25n
13827 </p>
13828 !! end
13829
13830 !! test
13831 anchorencode trims spaces
13832 !! input
13833 {{anchorencode: __pretty__please__}}
13834 !! result
13835 <p>pretty_please
13836 </p>
13837 !! end
13838
13839 !! test
13840 anchorencode deals with links
13841 !! input
13842 {{anchorencode: [[hello|world]] [[hi]]}}
13843 !! result
13844 <p>world_hi
13845 </p>
13846 !! end
13847
13848 !! test
13849 anchorencode deals with templates
13850 !! input
13851 {{anchorencode: {{Foo}} }}
13852 !! result
13853 <p>FOO
13854 </p>
13855 !! end
13856
13857 !! test
13858 anchorencode encodes like the TOC generator: (bug 18431)
13859 !! input
13860 === _ +:.3A%3A&&amp;]] ===
13861 {{anchorencode: _ +:.3A%3A&&amp;]] }}
13862 __NOEDITSECTION__
13863 !! result
13864 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
13865 <p>.2B:.3A.253A.26.26.5D.5D
13866 </p>
13867 !! end
13868
13869 !! test
13870 Bug 6200: blockquotes and paragraph formatting
13871 !! input
13872 <blockquote>
13873 foo
13874 </blockquote>
13875
13876 bar
13877
13878 baz
13879 !! result
13880 <blockquote>
13881 <p>foo
13882 </p>
13883 </blockquote>
13884 <p>bar
13885 </p>
13886 <pre>baz
13887 </pre>
13888 !! end
13889
13890 !! test
13891 Bug 8293: Use of center tag ruins paragraph formatting
13892 !! input
13893 <center>
13894 foo
13895 </center>
13896
13897 bar
13898
13899 baz
13900 !! result
13901 <center>
13902 <p>foo
13903 </p>
13904 </center>
13905 <p>bar
13906 </p>
13907 <pre>baz
13908 </pre>
13909 !! end
13910
13911 !!test
13912 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
13913 !!options
13914 php
13915 !!input
13916 <span><s>x</span></s>
13917 !!result
13918 <p><span><s>x&lt;/span&gt;</s></span>
13919 </p>
13920 !!end
13921
13922 !!test
13923 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
13924 !!options
13925 parsoid
13926 !!input
13927 <span><s>x</span></s>
13928 !!result
13929 <p><span><s>x</s></span><s></s>
13930 </p>
13931 !!end
13932
13933 ###
13934 ### Language variants related tests
13935 ###
13936 !! test
13937 Self-link in language variants
13938 !! options
13939 title=[[Dunav]] language=sr
13940 !! input
13941 Both [[Dunav]] and [[Дунав]] are names for this river.
13942 !! result
13943 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
13944 </p>
13945 !!end
13946
13947 !! article
13948 Дуна
13949 !! text
13950 content
13951 !! endarticle
13952
13953 !! test
13954 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
13955 !! options
13956 title=[[Duna]] language=sr
13957 !! input
13958 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
13959 !! result
13960 <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.
13961 </p>
13962 !! end
13963
13964 !! test
13965 Link to pages in language variants
13966 !! options
13967 language=sr
13968 !! input
13969 Main Page can be written as [[Маин Паге]]
13970 !! result
13971 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
13972 </p>
13973 !!end
13974
13975
13976 !! test
13977 Multiple links to pages in language variants
13978 !! options
13979 language=sr
13980 !! input
13981 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
13982 !! result
13983 <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>.
13984 </p>
13985 !!end
13986
13987
13988 !! test
13989 Simple template in language variants
13990 !! options
13991 language=sr
13992 !! input
13993 {{тест}}
13994 !! result
13995 <p>This is a test template
13996 </p>
13997 !! end
13998
13999
14000 !! test
14001 Template with explicit namespace in language variants
14002 !! options
14003 language=sr
14004 !! input
14005 {{Template:тест}}
14006 !! result
14007 <p>This is a test template
14008 </p>
14009 !! end
14010
14011
14012 !! test
14013 Basic test for template parameter in language variants
14014 !! options
14015 language=sr
14016 !! input
14017 {{парамтест|param=foo}}
14018 !! result
14019 <p>This is a test template with parameter foo
14020 </p>
14021 !! end
14022
14023
14024 !! test
14025 Simple category in language variants
14026 !! options
14027 language=sr cat
14028 !! input
14029 [[Category:МедиаWики Усер'с Гуиде]]
14030 !! result
14031 <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>
14032 !! end
14033
14034
14035 !! article
14036 Category:分类
14037 !! text
14038 blah
14039 !! endarticle
14040
14041 !! article
14042 Category:分類
14043 !! text
14044 blah
14045 !! endarticle
14046
14047 !! test
14048 Don't convert blue categorylinks to another variant (bug 33210)
14049 !! options
14050 language=zh cat
14051 !! input
14052 [[A]][[Category:分类]]
14053 !! result
14054 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
14055 !! end
14056
14057
14058 !! test
14059 Stripping -{}- tags (language variants)
14060 !! options
14061 language=sr
14062 !! input
14063 Latin proverb: -{Ne nuntium necare}-
14064 !! result
14065 <p>Latin proverb: Ne nuntium necare
14066 </p>
14067 !! end
14068
14069
14070 !! test
14071 Prevent conversion with -{}- tags (language variants)
14072 !! options
14073 language=sr variant=sr-ec
14074 !! input
14075 Latinski: -{Ne nuntium necare}-
14076 !! result
14077 <p>Латински: Ne nuntium necare
14078 </p>
14079 !! end
14080
14081
14082 !! test
14083 Prevent conversion of text with -{}- tags (language variants)
14084 !! options
14085 language=sr variant=sr-ec
14086 !! input
14087 Latinski: -{Ne nuntium necare}-
14088 !! result
14089 <p>Латински: Ne nuntium necare
14090 </p>
14091 !! end
14092
14093
14094 !! test
14095 Prevent conversion of links with -{}- tags (language variants)
14096 !! options
14097 language=sr variant=sr-ec
14098 !! input
14099 -{[[Main Page]]}-
14100 !! result
14101 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14102 </p>
14103 !! end
14104
14105
14106 !! test
14107 -{}- tags within headlines (within html for parserConvert())
14108 !! options
14109 language=sr variant=sr-ec
14110 !! input
14111 == -{Naslov}- ==
14112 !! result
14113 <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>
14114
14115 !! end
14116
14117
14118 !! test
14119 Explicit definition of language variant alternatives
14120 !! options
14121 language=zh variant=zh-tw
14122 !! input
14123 -{zh:China;zh-tw:Taiwan}-, not China
14124 !! result
14125 <p>Taiwan, not China
14126 </p>
14127 !! end
14128
14129
14130 !! test
14131 Conversion around HTML tags
14132 !! options
14133 language=sr variant=sr-ec
14134 !! input
14135 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
14136 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
14137 !! result
14138 <p>
14139 <span title="ЛаCтин">ски</span>
14140 </p>
14141 !! end
14142
14143
14144 !! test
14145 Explicit session-wise language variant mapping (A flag and - flag)
14146 !! options
14147 language=zh variant=zh-tw
14148 !! input
14149 Taiwan is not China.
14150 But -{A|zh:China;zh-tw:Taiwan}- is China,
14151 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
14152 and -{China}- is China.
14153 !! result
14154 <p>Taiwan is not China.
14155 But Taiwan is Taiwan,
14156 (This should be stripped!)
14157 and China is China.
14158 </p>
14159 !! end
14160
14161 !! test
14162 Explicit session-wise language variant mapping (H flag for hide)
14163 !! options
14164 language=zh variant=zh-tw
14165 !! input
14166 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
14167 Taiwan is China.
14168 !! result
14169 <p>(This should be stripped!)
14170 Taiwan is Taiwan.
14171 </p>
14172 !! end
14173
14174 !! test
14175 Adding explicit conversion rule for title (T flag)
14176 !! options
14177 language=zh variant=zh-tw showtitle
14178 !! input
14179 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
14180 !! result
14181 Taiwan
14182 <p>Should be stripped!
14183 </p>
14184 !! end
14185
14186 !! test
14187 Testing that changing the language variant here in the tests actually works
14188 !! options
14189 language=zh variant=zh showtitle
14190 !! input
14191 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
14192 !! result
14193 China
14194 <p>Should be stripped!
14195 </p>
14196 !! end
14197
14198 !! test
14199 Recursive conversion of alt and title attrs shouldn't clear converter state
14200 !! options
14201 language=zh variant=zh-cn showtitle
14202 !! input
14203 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
14204 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
14205 !! result
14206 China
14207 <p>
14208 Should be stripped<span title="Exclamation">!</span>
14209 </p>
14210 !! end
14211
14212 !! test
14213 Bug 24072: more test on conversion rule for title
14214 !! options
14215 language=zh variant=zh-tw showtitle
14216 !! input
14217 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
14218 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
14219 !! result
14220 Taiwan
14221 <p>This should be stripped!
14222 This won't take interferes with the title rule.
14223 </p>
14224 !! end
14225
14226 !! test
14227 Partly disable title conversion if variant == main language code
14228 !! options
14229 language=zh variant=zh title=[[ZH]] showtitle
14230 !! input
14231 -{T|zh-cn:CN;zh-tw:TW}-
14232 !! result
14233 ZH
14234 <p>
14235 </p>
14236 !! end
14237
14238 !! test
14239 Partly disable title conversion if variant == main language code, more
14240 !! options
14241 language=zh variant=zh title=[[ZH]] showtitle
14242 !! input
14243 -{T|TW}-
14244 !! result
14245 ZH
14246 <p>
14247 </p>
14248 !! end
14249
14250 !! test
14251 Raw output of variant escape tags (R flag)
14252 !! options
14253 language=zh variant=zh-tw
14254 !! input
14255 Raw: -{R|zh:China;zh-tw:Taiwan}-
14256 !! result
14257 <p>Raw: zh:China;zh-tw:Taiwan
14258 </p>
14259 !! end
14260
14261 !! test
14262 Nested using of manual convert syntax
14263 !! options
14264 language=zh variant=zh-hk
14265 !! input
14266 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
14267 !! result
14268 <p>Nested: Hello Hong Kong!
14269 </p>
14270 !! end
14271
14272 !! test
14273 Proper conversion of text in external links
14274 !! options
14275 language=sr variant=sr-ec
14276 !! input
14277 http://www.google.com
14278 gopher://www.google.com
14279 [http://www.google.com http://www.google.com]
14280 [gopher://www.google.com gopher://www.google.com]
14281 [https://www.google.com irc://www.google.com]
14282 [ftp://www.google.com www.google.com/ftp://dir]
14283 [//www.google.com www.google.com]
14284 !! result
14285 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
14286 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
14287 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
14288 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
14289 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
14290 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
14291 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
14292 </p>
14293 !! end
14294
14295 !! test
14296 Do not convert roman numbers to language variants
14297 !! options
14298 language=sr variant=sr-ec
14299 !! input
14300 Fridrih IV je car.
14301 !! result
14302 <p>Фридрих IV је цар.
14303 </p>
14304 !! end
14305
14306 !! test
14307 Unclosed language converter markup "-{"
14308 !! options
14309 language=sr
14310 !! input
14311 -{T|hello
14312 !! result
14313 <p>-{T|hello
14314 </p>
14315 !! end
14316
14317 !! test
14318 Don't convert raw rule "-{R|=&gt;}-" to "=>"
14319 !! options
14320 language=sr
14321 !! input
14322 -{R|=&gt;}-
14323 !! result
14324 <p>=&gt;
14325 </p>
14326 !!end
14327
14328 !! test
14329 Bug 529: Uncovered bullet
14330 !! input
14331 * Foo {{bullet}}
14332 !! result
14333 <ul><li> Foo
14334 </li><li> Bar
14335 </li></ul>
14336
14337 !! end
14338
14339 # Plain MediaWiki does not remove empty lists, but tidy actually does.
14340 # Templates in Wikipedia rely on this behavior, as tidy has always been
14341 # enabled there. These tests are normally run *without* tidy, so specify the
14342 # full output here.
14343 # To test realistic parsing behavior, apply a tidy-like transformation to both
14344 # the expected output and your parser's output.
14345 !! test
14346 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
14347 !! input
14348 ******* Foo {{bullet}}
14349 !! result
14350 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
14351 </li></ul>
14352 </li></ul>
14353 </li></ul>
14354 </li></ul>
14355 </li></ul>
14356 </li></ul>
14357 </li><li> Bar
14358 </li></ul>
14359
14360 !! end
14361
14362 !! test
14363 Bug 529: Uncovered table already at line-start
14364 !! input
14365 x
14366
14367 {{table}}
14368 y
14369 !! result
14370 <p>x
14371 </p>
14372 <table>
14373 <tr>
14374 <td> 1 </td>
14375 <td> 2
14376 </td></tr>
14377 <tr>
14378 <td> 3 </td>
14379 <td> 4
14380 </td></tr></table>
14381 <p>y
14382 </p>
14383 !! end
14384
14385 !! test
14386 Bug 529: Uncovered bullet in parser function result
14387 !! input
14388 * Foo {{lc:{{bullet}} }}
14389 !! result
14390 <ul><li> Foo
14391 </li><li> bar
14392 </li></ul>
14393
14394 !! end
14395
14396 !! test
14397 Bug 5678: Double-parsed template argument
14398 !! input
14399 {{lc:{{{1}}}|hello}}
14400 !! result
14401 <p>{{{1}}}
14402 </p>
14403 !! end
14404
14405 !! test
14406 Bug 5678: Double-parsed template invocation
14407 !! input
14408 {{lc:{{paramtest {{!}} param = hello }} }}
14409 !! result
14410 <p>{{paramtest | param = hello }}
14411 </p>
14412 !! end
14413
14414 !! test
14415 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
14416 !! options
14417 language=cs
14418 title=[[Main Page]]
14419 !! input
14420 {{PRVNÍVELKÉ:ěščř}}
14421 {{prvnívelké:ěščř}}
14422 {{PRVNÍMALÉ:ěščř}}
14423 {{prvnímalé:ěščř}}
14424 {{MALÁ:ěščř}}
14425 {{malá:ěščř}}
14426 {{VELKÁ:ěščř}}
14427 {{velká:ěščř}}
14428 !! result
14429 <p>Ěščř
14430 Ěščř
14431 ěščř
14432 ěščř
14433 ěščř
14434 ěščř
14435 ĚŠČŘ
14436 ĚŠČŘ
14437 </p>
14438 !! end
14439
14440 !! test
14441 Morwen/13: Unclosed link followed by heading
14442 !! input
14443 [[link
14444 ==heading==
14445 !! result
14446 <p>[[link
14447 </p>
14448 <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>
14449
14450 !! end
14451
14452 !! test
14453 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
14454 !! input
14455 {{foo|
14456 =heading=
14457 !! result
14458 <p>{{foo|
14459 </p>
14460 <h1><span class="mw-headline" id="heading">heading</span></h1>
14461
14462 !! end
14463
14464 !! test
14465 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
14466 !! input
14467 {{foo|
14468 ==heading==
14469 !! result
14470 <p>{{foo|
14471 </p>
14472 <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>
14473
14474 !! end
14475
14476 !! test
14477 Tildes in comments
14478 !! options
14479 pst
14480 !! input
14481 <!-- ~~~~ -->
14482 !! result
14483 <!-- ~~~~ -->
14484 !! end
14485
14486 !! test
14487 Paragraphs inside divs (no extra line breaks)
14488 !! input
14489 <div>Line one
14490
14491 Line two</div>
14492 !! result
14493 <div>Line one
14494 Line two</div>
14495
14496 !! end
14497
14498 !! test
14499 Paragraphs inside divs (extra line break on open)
14500 !! input
14501 <div>
14502 Line one
14503
14504 Line two</div>
14505 !! result
14506 <div>
14507 <p>Line one
14508 </p>
14509 Line two</div>
14510
14511 !! end
14512
14513 !! test
14514 Paragraphs inside divs (extra line break on close)
14515 !! input
14516 <div>Line one
14517
14518 Line two
14519 </div>
14520 !! result
14521 <div>Line one
14522 <p>Line two
14523 </p>
14524 </div>
14525
14526 !! end
14527
14528 !! test
14529 Paragraphs inside divs (extra line break on open and close)
14530 !! input
14531 <div>
14532 Line one
14533
14534 Line two
14535 </div>
14536 !! result
14537 <div>
14538 <p>Line one
14539 </p><p>Line two
14540 </p>
14541 </div>
14542
14543 !! end
14544
14545 !! test
14546 Nesting tags, paragraphs on lines which begin with <div>
14547 !! options
14548 disabled
14549 !! input
14550 <div></div><strong>A
14551 B</strong>
14552 !! result
14553 <div></div>
14554 <p><strong>A
14555 B</strong>
14556 </p>
14557 !! end
14558
14559 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
14560 !! test
14561 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
14562 !! input
14563 <blockquote>Line one
14564
14565 Line two</blockquote>
14566 !! result
14567 <blockquote>Line one
14568 Line two</blockquote>
14569
14570 !! end
14571
14572 !! test
14573 Bug 6200: paragraphs inside blockquotes (extra line break on open)
14574 !! input
14575 <blockquote>
14576 Line one
14577
14578 Line two</blockquote>
14579 !! result
14580 <blockquote>
14581 <p>Line one
14582 </p>
14583 Line two</blockquote>
14584
14585 !! end
14586
14587 !! test
14588 Bug 6200: paragraphs inside blockquotes (extra line break on close)
14589 !! input
14590 <blockquote>Line one
14591
14592 Line two
14593 </blockquote>
14594 !! result
14595 <blockquote>Line one
14596 <p>Line two
14597 </p>
14598 </blockquote>
14599
14600 !! end
14601
14602 !! test
14603 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
14604 !! input
14605 <blockquote>
14606 Line one
14607
14608 Line two
14609 </blockquote>
14610 !! result
14611 <blockquote>
14612 <p>Line one
14613 </p><p>Line two
14614 </p>
14615 </blockquote>
14616
14617 !! end
14618
14619 !! test
14620 Paragraphs inside blockquotes/divs (no extra line breaks)
14621 !! input
14622 <blockquote><div>Line one
14623
14624 Line two</div></blockquote>
14625 !! result
14626 <blockquote><div>Line one
14627 Line two</div></blockquote>
14628
14629 !! end
14630
14631 !! test
14632 Paragraphs inside blockquotes/divs (extra line break on open)
14633 !! input
14634 <blockquote><div>
14635 Line one
14636
14637 Line two</div></blockquote>
14638 !! result
14639 <blockquote><div>
14640 <p>Line one
14641 </p>
14642 Line two</div></blockquote>
14643
14644 !! end
14645
14646 !! test
14647 Paragraphs inside blockquotes/divs (extra line break on close)
14648 !! input
14649 <blockquote><div>Line one
14650
14651 Line two
14652 </div></blockquote>
14653 !! result
14654 <blockquote><div>Line one
14655 <p>Line two
14656 </p>
14657 </div></blockquote>
14658
14659 !! end
14660
14661 !! test
14662 Paragraphs inside blockquotes/divs (extra line break on open and close)
14663 !! input
14664 <blockquote><div>
14665 Line one
14666
14667 Line two
14668 </div></blockquote>
14669 !! result
14670 <blockquote><div>
14671 <p>Line one
14672 </p><p>Line two
14673 </p>
14674 </div></blockquote>
14675
14676 !! end
14677
14678 !! test
14679 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
14680 !! options
14681 wgLinkHolderBatchSize=0
14682 !! input
14683 [[meatball:1]]
14684 [[meatball:2]]
14685 [[meatball:3]]
14686 !! result
14687 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
14688 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
14689 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
14690 </p>
14691 !! end
14692
14693 !! test
14694 Free external link invading image caption
14695 !! input
14696 [[Image:Foobar.jpg|thumb|http://x|hello]]
14697 !! result
14698 <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>
14699
14700 !! end
14701
14702 !! test
14703 Bug 15196: localised external link numbers
14704 !! options
14705 language=fa
14706 !! input
14707 [http://en.wikipedia.org/]
14708 !! result
14709 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
14710 </p>
14711 !! end
14712
14713 !! test
14714 Multibyte character in padleft
14715 !! input
14716 {{padleft:-Hello|7|Æ}}
14717 !! result
14718 <p>Æ-Hello
14719 </p>
14720 !! end
14721
14722 !! test
14723 Multibyte character in padright
14724 !! input
14725 {{padright:Hello-|7|Æ}}
14726 !! result
14727 <p>Hello-Æ
14728 </p>
14729 !! end
14730
14731 !!test
14732 formatdate parser function
14733 !!input
14734 {{#formatdate:2009-03-24}}
14735 !! result
14736 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
14737 </p>
14738 !! end
14739
14740 !!test
14741 formatdate parser function, with default format
14742 !!input
14743 {{#formatdate:2009-03-24|mdy}}
14744 !! result
14745 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
14746 </p>
14747 !! end
14748
14749 !! test
14750 Spacing of numbers in formatted dates
14751 !! input
14752 {{#formatdate:January 15}}
14753 !! result
14754 <p><span class="mw-formatted-date" title="01-15">January 15</span>
14755 </p>
14756 !! end
14757
14758 !! test
14759 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
14760 !! options
14761 language=nl title=[[MediaWiki:Common.css]]
14762 !! input
14763 {{#formatdate:2009-03-24|dmy}}
14764 !! result
14765 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
14766 </p>
14767 !! end
14768
14769 #
14770 #
14771 #
14772
14773 #
14774 # Edit comments
14775 #
14776
14777 !! test
14778 Edit comment with link
14779 !! options
14780 comment
14781 !! input
14782 I like the [[Main Page]] a lot
14783 !! result
14784 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
14785 !!end
14786
14787 !! test
14788 Edit comment with link and link text
14789 !! options
14790 comment
14791 !! input
14792 I like the [[Main Page|best pages]] a lot
14793 !! result
14794 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14795 !!end
14796
14797 !! test
14798 Edit comment with link and link text with suffix
14799 !! options
14800 comment
14801 !! input
14802 I like the [[Main Page|best page]]s a lot
14803 !! result
14804 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14805 !!end
14806
14807 !! test
14808 Edit comment with section link (non-local, eg in history list)
14809 !! options
14810 comment title=[[Main Page]]
14811 !! input
14812 /* External links */ removed bogus entries
14813 !! result
14814 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14815 !!end
14816
14817 !! test
14818 Edit comment with section link and text before it (non-local, eg in history list)
14819 !! options
14820 comment title=[[Main Page]]
14821 !! input
14822 pre-comment text /* External links */ removed bogus entries
14823 !! result
14824 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>
14825 !!end
14826
14827 !! test
14828 Edit comment with section link (local, eg in diff view)
14829 !! options
14830 comment local title=[[Main Page]]
14831 !! input
14832 /* External links */ removed bogus entries
14833 !! result
14834 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14835 !!end
14836
14837 !! test
14838 Edit comment with subpage link (bug 14080)
14839 !! options
14840 comment
14841 subpage
14842 title=[[Subpage test]]
14843 !! input
14844 Poked at a [[/subpage]] here...
14845 !! result
14846 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
14847 !!end
14848
14849 !! test
14850 Edit comment with subpage link and link text (bug 14080)
14851 !! options
14852 comment
14853 subpage
14854 title=[[Subpage test]]
14855 !! input
14856 Poked at a [[/subpage|neat little page]] here...
14857 !! result
14858 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
14859 !!end
14860
14861 !! test
14862 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
14863 !! options
14864 comment
14865 title=[[Subpage test]]
14866 !! input
14867 Poked at a [[/subpage]] here...
14868 !! result
14869 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...
14870 !!end
14871
14872 !! test
14873 Edit comment with bare anchor link (local, as on diff)
14874 !! options
14875 comment
14876 local
14877 title=[[Main Page]]
14878 !!input
14879 [[#section]]
14880 !! result
14881 <a href="#section">#section</a>
14882 !! end
14883
14884 !! test
14885 Edit comment with bare anchor link (non-local, as on history)
14886 !! options
14887 comment
14888 title=[[Main Page]]
14889 !!input
14890 [[#section]]
14891 !! result
14892 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
14893 !! end
14894
14895 !! test
14896 Anchor starting with underscore
14897 !!input
14898 [[#_ref|One]]
14899 !! result
14900 <p><a href="#_ref">One</a>
14901 </p>
14902 !! end
14903
14904 !! test
14905 Id starting with underscore
14906 !!input
14907 <div id="_ref"></div>
14908 !! result
14909 <div id="_ref"></div>
14910
14911 !! end
14912
14913 !! test
14914 Space normalisation on autocomment (bug 22784)
14915 !! options
14916 comment
14917 title=[[Main Page]]
14918 !!input
14919 /* __hello__world__ */
14920 !! result
14921 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
14922 !! end
14923
14924 !! test
14925 percent-encoding and + signs in comments (Bug 26410)
14926 !! options
14927 comment
14928 !!input
14929 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
14930 !! result
14931 <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>
14932 !! end
14933
14934 !! test
14935 Bad images - basic functionality
14936 !! options
14937 disabled
14938 !! input
14939 [[File:Bad.jpg]]
14940 !! result
14941 !! end
14942
14943 !! test
14944 Bad images - bug 16039: text after bad image disappears
14945 !! options
14946 disabled
14947 !! input
14948 Foo bar
14949 [[File:Bad.jpg]]
14950 Bar foo
14951 !! result
14952 <p>Foo bar
14953 </p><p>Bar foo
14954 </p>
14955 !! end
14956
14957 !! test
14958 Verify that displaytitle works (bug #22501) no displaytitle
14959 !! options
14960 showtitle
14961 !! config
14962 wgAllowDisplayTitle=true
14963 wgRestrictDisplayTitle=false
14964 !! input
14965 this is not the the title
14966 !! result
14967 Parser test
14968 <p>this is not the the title
14969 </p>
14970 !! end
14971
14972 !! test
14973 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
14974 !! options
14975 showtitle
14976 title=[[Screen]]
14977 !! config
14978 wgAllowDisplayTitle=true
14979 wgRestrictDisplayTitle=false
14980 !! input
14981 this is not the the title
14982 {{DISPLAYTITLE:whatever}}
14983 !! result
14984 whatever
14985 <p>this is not the the title
14986 </p>
14987 !! end
14988
14989 !! test
14990 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
14991 !! options
14992 showtitle
14993 title=[[Screen]]
14994 !! config
14995 wgAllowDisplayTitle=true
14996 wgRestrictDisplayTitle=true
14997 !! input
14998 this is not the the title
14999 {{DISPLAYTITLE:whatever}}
15000 !! result
15001 Screen
15002 <p>this is not the the title
15003 </p>
15004 !! end
15005
15006 !! test
15007 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
15008 !! options
15009 showtitle
15010 title=[[Screen]]
15011 !! config
15012 wgAllowDisplayTitle=true
15013 wgRestrictDisplayTitle=true
15014 !! input
15015 this is not the the title
15016 {{DISPLAYTITLE:screen}}
15017 !! result
15018 screen
15019 <p>this is not the the title
15020 </p>
15021 !! end
15022
15023 !! test
15024 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
15025 !! options
15026 showtitle
15027 title=[[Screen]]
15028 !! config
15029 wgAllowDisplayTitle=false
15030 !! input
15031 this is not the the title
15032 {{DISPLAYTITLE:screen}}
15033 !! result
15034 Screen
15035 <p>this is not the the title
15036 <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>
15037 </p>
15038 !! end
15039
15040 !! test
15041 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
15042 !! options
15043 showtitle
15044 title=[[Screen]]
15045 !! config
15046 wgAllowDisplayTitle=false
15047 !! input
15048 this is not the the title
15049 !! result
15050 Screen
15051 <p>this is not the the title
15052 </p>
15053 !! end
15054
15055 !! test
15056 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
15057 !! options
15058 showtitle
15059 title=[[Screen]]
15060 !! config
15061 wgAllowDisplayTitle=true
15062 wgRestrictDisplayTitle=true
15063 !! input
15064 this is not the the title
15065 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
15066 !! result
15067 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
15068 <p>this is not the the title
15069 </p>
15070 !! end
15071
15072 !! test
15073 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
15074 !! options
15075 showtitle
15076 title=[[Screen]]
15077 !! config
15078 wgAllowDisplayTitle=true
15079 wgRestrictDisplayTitle=true
15080 !! input
15081 this is not the the title
15082 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
15083 !! result
15084 <span style="color: red;">s</span>creen
15085 <p>this is not the the title
15086 </p>
15087 !! end
15088
15089 !! test
15090 preload: check <noinclude> and <includeonly>
15091 !! options
15092 preload
15093 !! input
15094 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
15095 !! result
15096 Hello kind world.
15097 !! end
15098
15099 !! test
15100 preload: check <onlyinclude>
15101 !! options
15102 preload
15103 !! input
15104 Goodbye <onlyinclude>Hello world</onlyinclude>
15105 !! result
15106 Hello world
15107 !! end
15108
15109 !! test
15110 preload: can pass tags through if we want to
15111 !! options
15112 preload
15113 !! input
15114 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
15115 !! result
15116 <includeonly>Hello world</includeonly>
15117 !! end
15118
15119 !! test
15120 preload: check that it doesn't try to do tricks
15121 !! options
15122 preload
15123 !! input
15124 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
15125 !! result
15126 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
15127 !! end
15128
15129 !! test
15130 Play a bit with r67090 and bug 3158
15131 !! options
15132 disabled
15133 !! input
15134 <div style="width:50% !important">&nbsp;</div>
15135 <div style="width:50%&nbsp;!important">&nbsp;</div>
15136 <div style="width:50%&#160;!important">&nbsp;</div>
15137 <div style="border : solid;">&nbsp;</div>
15138 !! result
15139 <div style="width:50% !important">&nbsp;</div>
15140 <div style="width:50% !important">&nbsp;</div>
15141 <div style="width:50% !important">&nbsp;</div>
15142 <div style="border&#160;: solid;">&nbsp;</div>
15143
15144 !! end
15145
15146 !! test
15147 HTML5 data attributes
15148 !! input
15149 <span data-foo="bar">Baz</span>
15150 <p data-abc-def_hij="">Quuz</p>
15151 !! result
15152 <p><span data-foo="bar">Baz</span>
15153 </p>
15154 <p data-abc-def_hij="">Quuz</p>
15155
15156 !! end
15157
15158 !! test
15159 percent-encoding and + signs in internal links (Bug 26410)
15160 !! input
15161 [[User:+%]] [[Page+title%]]
15162 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
15163 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
15164 [[%33%45]] [[%33%45+]]
15165 !! result
15166 <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>
15167 <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>
15168 <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>
15169 <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>
15170 </p>
15171 !! end
15172
15173 !! test
15174 Special characters in embedded file links (bug 27679)
15175 !! input
15176 [[File:Contains & ampersand.jpg]]
15177 [[File:Does not exist.jpg|Title with & ampersand]]
15178 !! result
15179 <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>
15180 <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>
15181 </p>
15182 !! end
15183
15184
15185 !! test
15186 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
15187 !! input
15188 Text&apos;s been normalized?
15189 !! result
15190 <p>Text&#39;s been normalized?
15191 </p>
15192 !! end
15193
15194 !! test
15195 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
15196 !! input
15197 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
15198 !! result
15199 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
15200 </p>
15201 !! end
15202
15203 !! test
15204 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
15205 !! input
15206 [http://www.example.org/ ideograms]
15207 !! result
15208 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
15209 </p>
15210 !! end
15211
15212 !! test
15213 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
15214 !! input
15215 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
15216 !! result
15217 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
15218 </p>
15219 !! end
15220
15221 !! article
15222 Mediawiki:loop1
15223 !! text
15224 {{Identical|A}}
15225 !! endarticle
15226
15227 !! article
15228 Mediawiki:loop2
15229 !! text
15230 {{Identical|B}}
15231 !! endarticle
15232
15233 !! article
15234 Template:Identical
15235 !! text
15236 {{int:loop1}}
15237 {{int:loop2}}
15238 !! endarticle
15239
15240 !! test
15241 Bug 31098 Template which includes system messages which includes the template
15242 !! input
15243 {{Identical}}
15244 !! result
15245 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
15246 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
15247 </p>
15248 !! end
15249
15250 !! test
15251 Bug31490 Turkish: ucfirst 'blah'
15252 !! options
15253 language=tr
15254 !! input
15255 {{ucfirst:blah}}
15256 !! result
15257 <p>Blah
15258 </p>
15259 !! end
15260
15261 !! test
15262 Bug31490 Turkish: ucfirst 'ix'
15263 !! options
15264 language=tr
15265 !! input
15266 {{ucfirst:ix}}
15267 !! result
15268 <p>İx
15269 </p>
15270 !! end
15271
15272 !! test
15273 Bug31490 Turkish: lcfirst 'BLAH'
15274 !! options
15275 language=tr
15276 !! input
15277 {{lcfirst:BLAH}}
15278 !! result
15279 <p>bLAH
15280 </p>
15281 !! end
15282
15283 !! test
15284 Bug31490 Turkish: ucfırst (with a dotless i)
15285 !! options
15286 language=tr
15287 !! input
15288 {{ucfırst:blah}}
15289 !! result
15290 <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>
15291 </p>
15292 !! end
15293
15294 !! test
15295 Bug31490 ucfırst (with a dotless i) with English language
15296 !! options
15297 language=en
15298 !! input
15299 {{ucfırst:blah}}
15300 !! result
15301 <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>
15302 </p>
15303 !! end
15304
15305 !! test
15306 Bug 26375: TOC with italics
15307 !! options
15308 title=[[Main Page]]
15309 !! input
15310 __TOC__
15311 == ''Lost'' episodes ==
15312 !! result
15313 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15314 <ul>
15315 <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>
15316 </ul>
15317 </div>
15318 <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>
15319
15320 !! end
15321
15322 !! test
15323 Bug 26375: TOC with bold
15324 !! options
15325 title=[[Main Page]]
15326 !! input
15327 __TOC__
15328 == '''should be bold''' then normal text ==
15329 !! result
15330 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15331 <ul>
15332 <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>
15333 </ul>
15334 </div>
15335 <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>
15336
15337 !! end
15338
15339 !! test
15340 Bug 33845: Headings become cursive in TOC when they contain an image
15341 !! options
15342 title=[[Main Page]]
15343 !! input
15344 __TOC__
15345 == Image [[Image:foobar.jpg]] ==
15346 !! result
15347 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15348 <ul>
15349 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
15350 </ul>
15351 </div>
15352 <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>
15353
15354 !! end
15355
15356 !! test
15357 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
15358 !! options
15359 title=[[Main Page]]
15360 !! input
15361 __TOC__
15362 == <blockquote>Quote</blockquote> ==
15363 !! result
15364 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15365 <ul>
15366 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
15367 </ul>
15368 </div>
15369 <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>
15370
15371 !! end
15372
15373 !! test
15374 Unclosed tags in TOC
15375 !! options
15376 title=[[Main Page]]
15377 !! input
15378 __TOC__
15379 == Proof: 2 < 3 ==
15380 <small>Hanc marginis exiguitas non caperet.</small>
15381 QED
15382 !! result
15383 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15384 <ul>
15385 <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>
15386 </ul>
15387 </div>
15388 <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>
15389 <p><small>Hanc marginis exiguitas non caperet.</small>
15390 QED
15391 </p>
15392 !! end
15393
15394 !! test
15395 Multiple tags in TOC
15396 !! input
15397 __TOC__
15398 == <i>Foo</i> <b>Bar</b> ==
15399
15400 == <i>Foo</i> <blockquote>Bar</blockquote> ==
15401 !! result
15402 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15403 <ul>
15404 <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>
15405 <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>
15406 </ul>
15407 </div>
15408 <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>
15409 <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>
15410
15411 !! end
15412
15413 !! test
15414 Tags with parameters in TOC
15415 !! input
15416 __TOC__
15417 == <sup class="in-h2">Hello</sup> ==
15418
15419 == <sup class="a > b">Evilbye</sup> ==
15420 !! result
15421 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15422 <ul>
15423 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
15424 <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>
15425 </ul>
15426 </div>
15427 <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>
15428 <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>
15429
15430 !! end
15431
15432 !! test
15433 span tags with directionality in TOC
15434 !! input
15435 __TOC__
15436 == <span dir="ltr">C++</span> ==
15437
15438 == <span dir="rtl">זבנג!</span> ==
15439
15440 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
15441
15442 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
15443
15444 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
15445 !! result
15446 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15447 <ul>
15448 <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>
15449 <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>
15450 <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>
15451 <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>
15452 <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>
15453 </ul>
15454 </div>
15455 <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>
15456 <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>
15457 <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>
15458 <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>
15459 <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>
15460
15461 !! end
15462
15463 !! article
15464 MediaWiki:Bug32057
15465 !! text
15466 == {{int:headline_sample}} ==
15467 !! endarticle
15468
15469 !! test
15470 Bug 32057: Title needed when expanding <h> nodes.
15471 !! options
15472 title=[[Main Page]]
15473 !! input
15474 {{int:Bug32057}}
15475 !! result
15476 <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>
15477
15478 !! end
15479
15480 !! test
15481 Strip marker in urlencode
15482 !! input
15483 {{urlencode:x<nowiki/>y}}
15484 {{urlencode:x<nowiki/>y|wiki}}
15485 {{urlencode:x<nowiki/>y|path}}
15486 !! result
15487 <p>xy
15488 xy
15489 xy
15490 </p>
15491 !! end
15492
15493 !! test
15494 Strip marker in lc
15495 !! input
15496 {{lc:x<nowiki/>y}}
15497 !! result
15498 <p>xy
15499 </p>
15500 !! end
15501
15502 !! test
15503 Strip marker in uc
15504 !! input
15505 {{uc:x<nowiki/>y}}
15506 !! result
15507 <p>XY
15508 </p>
15509 !! end
15510
15511 !! test
15512 Strip marker in formatNum
15513 !! input
15514 {{formatnum:1<nowiki/>2}}
15515 {{formatnum:1<nowiki/>2|R}}
15516 !! result
15517 <p>12
15518 12
15519 </p>
15520 !! end
15521
15522 !! test
15523 Check noCommafy in formatNum
15524 !! options
15525 language=be-tarask
15526 !! input
15527 {{formatnum:123456.78}}
15528 {{formatnum:123456.78|NOSEP}}
15529 !! result
15530 <p>123 456,78
15531 123456.78
15532 </p>
15533 !! end
15534
15535 !! test
15536 Strip marker in grammar
15537 !! options
15538 language=fi
15539 !! input
15540 {{grammar:elative|foo<nowiki/>bar}}
15541 !! result
15542 <p>foobarista
15543 </p>
15544 !! end
15545
15546 !! test
15547 Strip marker in padleft
15548 !! input
15549 {{padleft:|2|x<nowiki/>y}}
15550 !! result
15551 <p>xy
15552 </p>
15553 !! end
15554
15555 !! test
15556 Strip marker in padright
15557 !! input
15558 {{padright:|2|x<nowiki/>y}}
15559 !! result
15560 <p>xy
15561 </p>
15562 !! end
15563
15564 !! test
15565 Strip marker in anchorencode
15566 !! input
15567 {{anchorencode:x<nowiki/>y}}
15568 !! result
15569 <p>xy
15570 </p>
15571 !! end
15572
15573 !! test
15574 nowiki inside link inside heading (bug 18295)
15575 !! input
15576 ==[[foo|x<nowiki>y</nowiki>z]]==
15577 !! result
15578 <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>
15579
15580 !! end
15581
15582 !! test
15583 new support for bdi element (bug 31817)
15584 !! input
15585 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
15586 !! result
15587 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
15588
15589 !!end
15590
15591 !! test
15592 Ignore pipe between table row attributes
15593 !! input
15594 {|
15595 | quux
15596 |- id=foo | style='color: red'
15597 | bar
15598 |}
15599 !! result
15600 <table>
15601 <tr>
15602 <td> quux
15603 </td></tr>
15604 <tr id="foo" style="color: red">
15605 <td> bar
15606 </td></tr></table>
15607
15608 !! end
15609
15610 !!test
15611 Gallery override link with WikiLink (bug 34852)
15612 !! input
15613 <gallery>
15614 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
15615 </gallery>
15616 !! result
15617 <ul class="gallery mw-gallery-traditional">
15618 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15619 <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>
15620 <div class="gallerytext">
15621 <p>caption
15622 </p>
15623 </div>
15624 </div></li>
15625 </ul>
15626
15627 !! end
15628
15629 !!test
15630 Gallery override link with absolute external link (bug 34852)
15631 !! input
15632 <gallery>
15633 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
15634 </gallery>
15635 !! result
15636 <ul class="gallery mw-gallery-traditional">
15637 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15638 <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>
15639 <div class="gallerytext">
15640 <p>caption
15641 </p>
15642 </div>
15643 </div></li>
15644 </ul>
15645
15646 !! end
15647
15648 !!test
15649 Gallery override link with malicious javascript (bug 34852)
15650 !! input
15651 <gallery>
15652 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
15653 </gallery>
15654 !! result
15655 <ul class="gallery mw-gallery-traditional">
15656 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15657 <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>
15658 <div class="gallerytext">
15659 <p>caption
15660 </p>
15661 </div>
15662 </div></li>
15663 </ul>
15664
15665 !! end
15666
15667 !!test
15668 Gallery with invalid title as link (bug 43964)
15669 !! input
15670 <gallery>
15671 File:foobar.jpg|link=<
15672 </gallery>
15673 !! result
15674 <ul class="gallery mw-gallery-traditional">
15675 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15676 <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>
15677 <div class="gallerytext">
15678 </div>
15679 </div></li>
15680 </ul>
15681
15682 !! end
15683
15684 !!test
15685 Language parser function
15686 !! input
15687 {{#language:ar}}
15688 !! result
15689 <p>العربية
15690 </p>
15691 !! end
15692
15693 !!test
15694 Padleft and padright as substr
15695 !! input
15696 {{padleft:|3|abcde}}
15697 {{padright:|3|abcde}}
15698 !! result
15699 <p>abc
15700 abc
15701 </p>
15702 !! end
15703
15704 !!test
15705 Special parser function
15706 !! input
15707 {{#special:RandomPage}}
15708 {{#special:BaDtItLe}}
15709 {{#special:Foobar}}
15710 !! result
15711 <p>Special:Random
15712 Special:Badtitle
15713 Special:Foobar
15714 </p>
15715 !! end
15716
15717 !!test
15718 Bug 34939 - Case insensitive link parsing ([HttP://])
15719 !! input
15720 [HttP://MediaWiki.Org/]
15721 !! result
15722 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
15723 </p>
15724 !! end
15725
15726 !!test
15727 Bug 34939 - Case insensitive link parsing ([HttP:// title])
15728 !! input
15729 [HttP://MediaWiki.Org/ MediaWiki]
15730 !! result
15731 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
15732 </p>
15733 !! end
15734
15735 !!test
15736 Bug 34939 - Case insensitive link parsing (HttP://)
15737 !! input
15738 HttP://MediaWiki.Org/
15739 !! result
15740 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
15741 </p>
15742 !! end
15743
15744
15745 ###
15746 ### Parsoids-specific tests
15747 ### Parsoid-PHP parser incompatibilities
15748 ###
15749 !!test
15750 1. SOL-sensitive wikitext tokens as template-args
15751 !!options
15752 parsoid=wt2html,wt2wt
15753 !!input
15754 {{echo|*a}}
15755 {{echo|#a}}
15756 {{echo|:a}}
15757 !!result
15758 <span about="#mwt1" typeof="mw:Transclusion">
15759 </span><ul about="#mwt1"><li>a</li></ul>
15760 <span about="#mwt2" typeof="mw:Transclusion">
15761 </span><ol about="#mwt2"><li>a</li></ol>
15762 <span about="#mwt3" typeof="mw:Transclusion">
15763 </span><dl about="#mwt3"><dd>a</dd></dl>
15764 !!end
15765
15766 #### ----------------------------------------------------------------
15767 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
15768 #### tags. Parsoid's output for these tags differs from that of the
15769 #### PHP parser.
15770 #### ----------------------------------------------------------------
15771
15772 !!test
15773 Ref: 1. ref-location should be replaced with an index span
15774 !!options
15775 parsoid
15776 !!input
15777 A <ref>foo</ref>
15778 B <ref name="x">foo</ref>
15779 C <ref name="y" />
15780 !!result
15781 <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>
15782 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>
15783 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>
15784 !!end
15785
15786 !!test
15787 Ref: 2. ref-tags with identical names should all get the same index
15788 !!options
15789 parsoid
15790 !!input
15791 A <ref name="x">foo</ref>
15792 B <ref name="x" />
15793 !!result
15794 <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>
15795 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>
15796 !!end
15797
15798 !!test
15799 Ref: 3. spaces in ref-names should be ignored
15800 !!options
15801 parsoid
15802 !!input
15803 A <ref name="x">foo</ref>
15804 B <ref name=" x " />
15805 C <ref name= x />
15806 !!result
15807 <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>
15808 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>
15809 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>
15810 !!end
15811
15812 !!test
15813 Ref: 4. 'constructor' should be accepted as a valid ref-name
15814 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
15815 !!options
15816 parsoid
15817 !!input
15818 A <ref name="constructor">foo</ref>
15819 !!result
15820 <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>
15821 !!end
15822
15823 !!test
15824 Ref: 5. body should accept generic wikitext
15825 !!options
15826 parsoid
15827 !!input
15828 A <ref>
15829 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
15830 </ref>
15831
15832 <references />
15833 !!result
15834 <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>
15835
15836 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'>
15837 <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>
15838 </li></ol>
15839 !!end
15840
15841 !!test
15842 Ref: 6. indent-pres should not be output in ref-body
15843 !!options
15844 parsoid
15845 !!input
15846 A <ref>
15847 foo
15848 bar
15849 baz
15850 </ref>
15851
15852 <references />
15853 !!result
15854 <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>
15855
15856 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
15857 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15858 bar
15859 baz
15860 </li></ol>
15861 !!end
15862
15863 !!test
15864 Ref: 7. No p-wrapping in ref-body
15865 !!options
15866 parsoid
15867 !!input
15868 A <ref>
15869 foo
15870
15871 bar
15872
15873
15874 baz
15875
15876
15877
15878 booz
15879 </ref>
15880
15881 <references />
15882 !!result
15883 <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>
15884
15885 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
15886 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15887
15888 bar
15889
15890
15891 baz
15892
15893
15894
15895 booz
15896 </li></ol>
15897 !!end
15898
15899 !!test
15900 Ref: 8. transclusion wikitext has lower precedence
15901 !!options
15902 parsoid
15903 !!input
15904 A <ref> foo {{echo|</ref> B C}}
15905
15906 <references />
15907 !!result
15908 <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>
15909
15910 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
15911 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <span typeof="mw:Nowiki">{{</span>echo|</li></ol>
15912 !!end
15913
15914 !!test
15915 Ref: 9. unclosed comments should not leak out of ref-body
15916 !!options
15917 parsoid
15918 !!input
15919 A <ref> foo <!--</ref> B C
15920
15921 <references />
15922 !!result
15923 <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>
15924
15925 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
15926 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
15927 !!end
15928
15929 !!test
15930 Ref: 10. Unclosed HTML tags should not leak out of ref-body
15931 !!options
15932 parsoid
15933 !!input
15934 A <ref> <b> foo </ref> B C
15935
15936 <references />
15937 !!result
15938 <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>
15939
15940 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
15941 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> <b> foo </b></li></ol>
15942 !!end
15943
15944 !!test
15945 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
15946 !!options
15947 parsoid
15948 !!input
15949 A <ref>foo</ref> B
15950 C <ref>bar</ref> D
15951 !!result
15952 <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
15953 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>
15954 !!end
15955
15956 !!test
15957 Ref: 12. ref-tags act as trailing newline migration barrier
15958 !!options
15959 parsoid
15960 !!input
15961 <!--the newline at the end of this line moves out of the p-tag-->a
15962
15963 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
15964 <ref />
15965
15966 c
15967 !!result
15968 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
15969
15970
15971 <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>
15972 <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>
15973
15974
15975 <p>c</p>
15976 !!end
15977
15978 !!test
15979 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
15980 !!options
15981 parsoid
15982 !!input
15983 <ref>foo</ref> A
15984 <ref>bar
15985 </ref> B
15986 !!result
15987 <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
15988 <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>
15989 !!end
15990
15991 !!test
15992 Ref: 14. A nested ref-tag should be emitted as plain text
15993 !!options
15994 parsoid
15995 !!input
15996 <ref>foo <ref>bar</ref> baz</ref>
15997
15998 <references />
15999 !!result
16000 <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>
16001
16002 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
16003 <li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo &lt;ref&gt;bar&lt;/ref&gt; baz</li></ol>
16004 !!end
16005
16006 !!test
16007 Ref: 15. ref-tags with identical names should get identical indexes
16008 !!options
16009 parsoid
16010 !!input
16011 A1 <ref name="a">foo</ref> A2 <ref name="a" />
16012 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
16013
16014 <references />
16015 !!result
16016 <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>
16017 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>
16018
16019 <ol about="#mwt10" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-a-1-0">1.0</a> <a href="#cite_ref-a-1-1">1.1</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy">↑ <a href="#cite_ref-b-2-0">2.0</a> <a href="#cite_ref-b-2-1">2.1</a></span> bar</li></ol>
16020 !!end
16021
16022 !!test
16023 References: 1. references tag without any refs should be handled properly
16024 !!options
16025 parsoid
16026 !!input
16027 <references />
16028 !!result
16029 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
16030 !!end
16031
16032 !!test
16033 References: 2. references tag with group only outputs references from that group
16034 !!options
16035 parsoid
16036 !!input
16037 A <ref group="a">foo</ref>
16038 B <ref group="b">bar</ref>
16039
16040 <references group='a' />
16041 !!result
16042 <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>
16043 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>
16044
16045 <ol about="#mwt6" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
16046 !!end
16047
16048 !!test
16049 References: 3. ref list should be cleared after processing references
16050 !!options
16051 parsoid
16052 !!input
16053 A <ref>foo</ref>
16054
16055 <references />
16056
16057 B <ref>bar</ref>
16058
16059 <references />
16060 !!result
16061 <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>
16062
16063 <ol about="#mwt4" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
16064
16065 <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>
16066
16067 <ol about="#mwt8" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> bar</li></ol>
16068 !!end
16069
16070 !!test
16071 References: 4. only referenced group should be cleared after processing references
16072 !!options
16073 parsoid
16074 !!input
16075 A <ref group="a">afoo</ref>
16076 B <ref>bfoo</ref>
16077
16078 <references group="a"/>
16079
16080 C <ref>cfoo</ref>
16081
16082 <references />
16083 !!result
16084 <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>
16085 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>
16086
16087 <ol about="#mwt6" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> afoo</li></ol>
16088
16089 <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>
16090
16091 <ol about="#mwt10" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> bfoo</li><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2-0">↑</a></span> cfoo</li></ol>
16092 !!end
16093
16094 !!test
16095 References: 5. ref tags in references should be processed while ignoring all other content
16096 !!options
16097 parsoid
16098 !!input
16099 A <ref name="a" />
16100 B <ref name="b">bar</ref>
16101
16102 <references>
16103 <ref name="a">foo</ref>
16104 This should just get lost.
16105 </references>
16106 !!result
16107 <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>
16108 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>
16109
16110 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","body":{"extsrc":"<ref name=\"a\">foo</ref>\nThis should just get lost.","html":"\n<span about=\"#mwt8\" class=\"reference\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;html&amp;quot;:&amp;quot;foo&amp;quot;},&amp;quot;attrs&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;a&amp;quot;}}\" rel=\"dc:references\" typeof=\"mw:Extension/ref\"><a href=\"#cite_note-a-1\">[1]</a></span>\n"},"attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="#cite_ref-a-1-0">↑</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> bar</li></ol>
16111 !!end
16112
16113 !!test
16114 References: 6. <references /> from a transclusion
16115 !!options
16116 parsoid
16117 !!input
16118 {{echo|<references />}}
16119 !!result
16120 <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>
16121 !!end
16122
16123 !! test
16124 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
16125 !! options
16126 parsoid
16127 !! input
16128 A <ref>foo bar for a</ref>
16129 B <ref name="b" />
16130
16131 <references />
16132
16133 <references>
16134 <ref name="b">foo</ref>
16135 </references>
16136 !! result
16137 <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>
16138 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>
16139
16140 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
16141 <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>
16142 <li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> </li></ol>
16143
16144 <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":{}}'>
16145 <li about="#cite_note-b-1" id="cite_note-b-1"><span rel="mw:referencedBy">↑</span> foo</li></ol>
16146 !! end
16147
16148 #### ----------------------------------------------------------------
16149 #### The following section of tests are primarily to test
16150 #### wikitext escaping capabilities of Parsoid. Given that
16151 #### escaping can be done any number of ways, the wikitext (input)
16152 #### is always adjusted to reflect how Parsoid adds nowiki
16153 #### escape tags.
16154 ####
16155 #### We are marking several tests as parsoid-only since the
16156 #### HTML in the result section is different from what the
16157 #### PHP parser generates for it.
16158 #### ----------------------------------------------------------------
16159
16160
16161 #### --------------- Headings ---------------
16162 #### 0. Unnested
16163 #### 1. Nested inside html <h1>=foo=</h1>
16164 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
16165 #### 3. Nested inside html with wikitext split by html tags
16166 #### 4. No escape needed
16167 #### 5. Empty headings <h1></h1>
16168 #### 6. Heading chars in SOL context
16169 #### ----------------------------------------
16170 !! test
16171 Headings: 0. Unnested
16172 !! options
16173 parsoid
16174 !! input
16175 <nowiki>=foo=</nowiki>
16176
16177 <nowiki> =foo= </nowiki>
16178 <!--cmt-->
16179 <nowiki>=foo=</nowiki>
16180
16181 =foo''a''<nowiki>=</nowiki>
16182 !! result
16183 <p><span typeof="mw:Nowiki">=foo=</span></p>
16184
16185 <p><span typeof="mw:Nowiki"> =foo= </span>
16186 <!--cmt-->
16187 <span typeof="mw:Nowiki">=foo=</span></p>
16188
16189 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
16190 !!end
16191
16192 !! test
16193 Headings: 1. Nested inside html
16194 !! options
16195 parsoid
16196 !! input
16197 =<nowiki>=foo=</nowiki>=
16198
16199 ==<nowiki>=foo=</nowiki>==
16200
16201 ===<nowiki>=foo=</nowiki>===
16202
16203 ====<nowiki>=foo=</nowiki>====
16204
16205 =====<nowiki>=foo=</nowiki>=====
16206
16207 ======<nowiki>=foo=</nowiki>======
16208 !! result
16209 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
16210 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
16211 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
16212 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
16213 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
16214 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
16215 !!end
16216
16217 !! test
16218 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
16219 !! options
16220 parsoid
16221 !! input
16222 =foo=
16223 <nowiki>*</nowiki>bar
16224
16225 =foo=
16226 =bar
16227
16228 =foo=
16229 <nowiki>=bar=</nowiki>
16230 !! result
16231 <h1>foo</h1>*bar
16232 <h1>foo</h1>=bar
16233 <h1>foo</h1>=bar=
16234 !!end
16235
16236 !! test
16237 Headings: 3. Nested inside html with wikitext split by html tags
16238 !! options
16239 parsoid
16240 !! input
16241 =='''bold'''<nowiki>foo=</nowiki>=
16242 !! result
16243 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
16244 !!end
16245
16246 !! test
16247 Headings: 4a. No escaping needed (testing just h1 and h2)
16248 !! options
16249 parsoid
16250 !! input
16251 ==foo=
16252
16253 =foo==
16254
16255 = =foo= =
16256
16257 ==foo= bar=
16258
16259 ===foo==
16260
16261 ==foo===
16262
16263 =''=''foo==
16264
16265 =<nowiki>=</nowiki>=
16266 !! result
16267 <h1>=foo</h1>
16268 <h1>foo=</h1>
16269 <h1> =foo= </h1>
16270 <h1>=foo= bar</h1>
16271 <h2>=foo</h2>
16272 <h2>foo=</h2>
16273 <h1><i>=</i>foo=</h1>
16274 <h1><span typeof="mw:Nowiki">=</span></h1>
16275 !!end
16276
16277 !! test
16278 Headings: 4b. No escaping needed (inside p-tags)
16279 !! options
16280 parsoid
16281 !! input
16282 ===
16283 =foo= x
16284 =foo= <s></s>
16285 !! result
16286 <p>===
16287 =foo= x
16288 =foo= <s></s>
16289 </p>
16290 !!end
16291
16292 !! test
16293 Headings: 5. Empty headings
16294 !! options
16295 parsoid
16296 !! input
16297 =<nowiki/>=
16298
16299 ==<nowiki/>==
16300
16301 ===<nowiki/>===
16302
16303 ====<nowiki/>====
16304
16305 =====<nowiki/>=====
16306
16307 ======<nowiki/>======
16308 !! result
16309 <h1></h1>
16310 <h2></h2>
16311 <h3></h3>
16312 <h4></h4>
16313 <h5></h5>
16314 <h6></h6>
16315 !!end
16316
16317 !! test
16318 Headings: 6a. Heading chars in SOL context (with trailing spaces)
16319 !! options
16320 parsoid
16321 !! input
16322 <nowiki>=a=</nowiki>
16323
16324 <nowiki>=a=</nowiki>
16325
16326 <nowiki>=a=</nowiki>
16327
16328 <nowiki>=a=</nowiki>
16329 !! result
16330 <p>=a=</p>
16331 <p>=a= </p>
16332 <p>=a= </p>
16333 <p>=a= </p>
16334 !!end
16335
16336 !! test
16337 Headings: 6b. Heading chars in SOL context (with trailing newlines)
16338 !! options
16339 parsoid
16340 !! input
16341 <nowiki>=a=
16342 b</nowiki>
16343
16344 <nowiki>=a=
16345 b</nowiki>
16346
16347 <nowiki>=a=
16348 b</nowiki>
16349
16350 <nowiki>=a=
16351 b</nowiki>
16352 !! result
16353 <p>=a=
16354 b</p>
16355 <p>=a=
16356 b</p>
16357 <p>=a=
16358 b</p>
16359 <p>=a=
16360 b</p>
16361 </p>
16362 !!end
16363
16364 !! test
16365 Headings: 6c. Heading chars in SOL context (leading newline break)
16366 !! options
16367 parsoid
16368 !! input
16369 a
16370 <nowiki>=b=</nowiki>
16371 !! result
16372 <p>a
16373 =b=</p>
16374 !!end
16375
16376 !! test
16377 Headings: 6d. Heading chars in SOL context (with interspersed comments)
16378 !! options
16379 parsoid
16380 !! input
16381 <!--c0--><nowiki>=a=</nowiki>
16382 <!--c1-->
16383 <nowiki>=a=</nowiki> <!--c2--> <!--c3-->
16384 !! result
16385 <p><!--c0-->=a=</p>
16386 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
16387 !!end
16388
16389 !! test
16390 Headings: 6d. Heading chars in SOL context (No escaping needed)
16391 !! options
16392 parsoid=html2wt
16393 !! input
16394 =a=<div>b</div>
16395 !! result
16396 =a=<div>b</div>
16397 !!end
16398
16399 #### --------------- Lists ---------------
16400 #### 0. Outside nests (*foo, etc.)
16401 #### 1. Nested inside html <ul><li>*foo</li></ul>
16402 #### 2. Inside definition lists
16403 #### 3. Only bullets at start should be escaped
16404 #### 4. No escapes needed
16405 #### 5. No unnecessary escapes
16406 #### 6. Escape bullets in SOL position
16407 #### 7. Escape bullets in a multi-line context
16408 #### ----------------------------------------
16409
16410 !! test
16411 Lists: 0. Outside nests
16412 !! input
16413 <nowiki>*</nowiki>foo
16414
16415 <nowiki>#</nowiki>foo
16416 !! result
16417 <p>*foo
16418 </p><p>#foo
16419 </p>
16420 !!end
16421
16422 !! test
16423 Lists: 1. Nested inside html
16424 !! input
16425 *<nowiki>*foo</nowiki>
16426
16427 *<nowiki>#foo</nowiki>
16428
16429 *<nowiki>:foo</nowiki>
16430
16431 *<nowiki>;foo</nowiki>
16432
16433 #<nowiki>*foo</nowiki>
16434
16435 #<nowiki>#foo</nowiki>
16436
16437 #<nowiki>:foo</nowiki>
16438
16439 #<nowiki>;foo</nowiki>
16440 !! result
16441 <ul><li>*foo
16442 </li></ul>
16443 <ul><li>#foo
16444 </li></ul>
16445 <ul><li>:foo
16446 </li></ul>
16447 <ul><li>;foo
16448 </li></ul>
16449 <ol><li>*foo
16450 </li></ol>
16451 <ol><li>#foo
16452 </li></ol>
16453 <ol><li>:foo
16454 </li></ol>
16455 <ol><li>;foo
16456 </li></ol>
16457
16458 !!end
16459
16460 !! test
16461 Lists: 2. Inside definition lists
16462 !! input
16463 ;<nowiki>;foo</nowiki>
16464
16465 ;<nowiki>:foo</nowiki>
16466
16467 ;<nowiki>:foo</nowiki>
16468 :bar
16469
16470 :<nowiki>:foo</nowiki>
16471 !! result
16472 <dl><dt>;foo
16473 </dt></dl>
16474 <dl><dt>:foo
16475 </dt></dl>
16476 <dl><dt>:foo
16477 </dt><dd>bar
16478 </dd></dl>
16479 <dl><dd>:foo
16480 </dd></dl>
16481
16482 !!end
16483
16484 !! test
16485 Lists: 3. Only bullets at start of text should be escaped
16486 !! input
16487 *<nowiki>*foo*bar</nowiki>
16488
16489 *<nowiki>*foo</nowiki>''it''*bar
16490 !! result
16491 <ul><li>*foo*bar
16492 </li></ul>
16493 <ul><li>*foo<i>it</i>*bar
16494 </li></ul>
16495
16496 !!end
16497
16498 !! test
16499 Lists: 4. No escapes needed
16500 !! options
16501 parsoid
16502 !! input
16503 *foo*bar
16504
16505 *''foo''*bar
16506
16507 *[[Foo]]: bar
16508 !! result
16509 <ul><li>foo*bar
16510 </li></ul>
16511 <ul><li><i>foo</i>*bar
16512 </li></ul>
16513 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
16514 </li></ul>
16515 !!end
16516
16517 !! test
16518 Lists: 5. No unnecessary escapes
16519 !! input
16520 * bar <span><nowiki>[[foo]]</nowiki></span>
16521
16522 *=bar <span><nowiki>[[foo]]</nowiki></span>
16523
16524 *[[bar <span><nowiki>[[foo]]</nowiki></span>
16525
16526 *]]bar <span><nowiki>[[foo]]</nowiki></span>
16527
16528 *=bar <span>foo]]</span>=
16529
16530 * <s></s>: a
16531 !! result
16532 <ul><li> bar <span>[[foo]]</span>
16533 </li></ul>
16534 <ul><li>=bar <span>[[foo]]</span>
16535 </li></ul>
16536 <ul><li>[[bar <span>[[foo]]</span>
16537 </li></ul>
16538 <ul><li>]]bar <span>[[foo]]</span>
16539 </li></ul>
16540 <ul><li>=bar <span>foo]]</span>=
16541 </li></ul>
16542 <ul><li> <s></s>: a
16543 </li></ul>
16544
16545 !!end
16546
16547 !! test
16548 Lists: 6. Escape bullets in SOL position
16549 !! options
16550 parsoid
16551 !! input
16552 <!--cmt--><nowiki>*foo</nowiki>
16553 !! result
16554 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
16555 !!end
16556
16557 !! test
16558 Lists: 7. Escape bullets in a multi-line context
16559 !! input
16560 a
16561 <nowiki>*</nowiki>b
16562 !! result
16563 <p>a
16564 *b
16565 </p>
16566 !!end
16567
16568 #### --------------- HRs ---------------
16569 #### 1. Single line
16570 #### -----------------------------------
16571
16572 !! test
16573 HRs: 1. Single line
16574 !! options
16575 parsoid
16576 !! input
16577 ----<nowiki>----</nowiki>
16578 ----=foo=
16579 ----*foo
16580 !! result
16581 <hr><span typeof="mw:Nowiki">----</span>
16582 <hr>=foo=
16583 <hr>*foo
16584 !! end
16585
16586 #### --------------- Tables ---------------
16587 #### 1a. Simple example
16588 #### 1b. No escaping needed (!foo)
16589 #### 1c. No escaping needed (|foo)
16590 #### 1d. No escaping needed (|}foo)
16591 ####
16592 #### 2a. Nested in td (<td>foo|bar</td>)
16593 #### 2b. Nested in td (<td>foo||bar</td>)
16594 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
16595 ####
16596 #### 3a. Nested in th (<th>foo!bar</th>)
16597 #### 3b. Nested in th (<th>foo!!bar</th>)
16598 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
16599 ####
16600 #### 4a. Escape -
16601 #### 4b. Escape +
16602 #### 4c. No escaping needed
16603 #### --------------------------------------
16604
16605 !! test
16606 Tables: 1a. Simple example
16607 !! input
16608 <nowiki>{|
16609 |}</nowiki>
16610 !! result
16611 <p>{|
16612 |}
16613 </p>
16614 !! end
16615
16616 !! test
16617 Tables: 1b. No escaping needed
16618 !! input
16619 !foo
16620 !! result
16621 <p>!foo
16622 </p>
16623 !! end
16624
16625 !! test
16626 Tables: 1c. No escaping needed
16627 !! input
16628 |foo
16629 !! result
16630 <p>|foo
16631 </p>
16632 !! end
16633
16634 !! test
16635 Tables: 1d. No escaping needed
16636 !! input
16637 |}foo
16638 !! result
16639 <p>|}foo
16640 </p>
16641 !! end
16642
16643 !! test
16644 Tables: 2a. Nested in td
16645 !! options
16646 parsoid
16647 !! input
16648 {|
16649 |<nowiki>foo|bar</nowiki>
16650 |}
16651 !! result
16652 <table><tbody><tr>
16653 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
16654 !! end
16655
16656 !! test
16657 Tables: 2b. Nested in td
16658 !! options
16659 parsoid
16660 !! input
16661 {|
16662 |<nowiki>foo||bar</nowiki>
16663 |''it''<nowiki>foo||bar</nowiki>
16664 |}
16665 !! result
16666 <table><tbody><tr>
16667 <td><span typeof="mw:Nowiki">foo||bar</span></td>
16668 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
16669 !! end
16670
16671 !! test
16672 Tables: 2c. Nested in td -- no escaping needed
16673 !! options
16674 parsoid
16675 !! input
16676 {|
16677 |foo!!bar
16678 |}
16679 !! result
16680 <table><tbody><tr><td>foo!!bar
16681 </td></tr></tbody></table>
16682
16683 !! end
16684
16685 !! test
16686 Tables: 3a. Nested in th
16687 !! options
16688 parsoid
16689 !! input
16690 {|
16691 !foo!bar
16692 |}
16693 !! result
16694 <table><tbody><tr><th>foo!bar
16695 </th></tr></tbody></table>
16696
16697 !! end
16698
16699 !! test
16700 Tables: 3b. Nested in th
16701 !! options
16702 parsoid
16703 !! input
16704 {|
16705 !<nowiki>foo!!bar</nowiki>
16706 |}
16707 !! result
16708 <table>
16709 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
16710 </tbody></table>
16711 !! end
16712
16713 !! test
16714 Tables: 3c. Nested in th -- no escaping needed
16715 !! options
16716 parsoid
16717 !! input
16718 {|
16719 !<nowiki>foo||bar</nowiki>
16720 |}
16721 !! result
16722 <table><tbody><tr>
16723 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
16724 !! end
16725
16726 !! test
16727 Tables: 4a. Escape -
16728 !! options
16729 parsoid
16730 !! input
16731 {|
16732 !-bar
16733 |-
16734 |<nowiki>-bar</nowiki>
16735 |}
16736 !! result
16737 <table><tbody>
16738 <tr><th>-bar</th></tr>
16739 <tr>
16740 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
16741 !! end
16742
16743 !! test
16744 Tables: 4b. Escape +
16745 !! options
16746 parsoid
16747 !! input
16748 {|
16749 !+bar
16750 |-
16751 |<nowiki>+bar</nowiki>
16752 |}
16753 !! result
16754 <table><tbody>
16755 <tr><th>+bar</th></tr>
16756 <tr>
16757 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
16758 !! end
16759
16760 !! test
16761 Tables: 4c. No escaping needed
16762 !! options
16763 parsoid
16764 !! input
16765 {|
16766 |foo-bar
16767 |foo+bar
16768 |-
16769 |''foo''-bar
16770 |''foo''+bar
16771 |-
16772 |foo
16773 bar|baz
16774 +bar
16775 -bar
16776 |}
16777 !! result
16778 <table><tbody>
16779 <tr><td>foo-bar</td><td>foo+bar</td></tr>
16780 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
16781 <tr><td>foo
16782 <p>bar|baz
16783 +bar
16784 -bar</p></td></tr>
16785 </tbody></table>
16786 !! end
16787
16788 ### SSS FIXME: Disabled right now because accurate html2wt
16789 ### on this snippet requires data-parsoid flags that we've
16790 ### stripped out of these tests. We should scheme how we
16791 ### we want to handle these kind of tests that require
16792 ### data-parsoid flags for accurate html2wt serialization
16793
16794 !! test
16795 Tables: 4d. No escaping needed
16796 !! options
16797 disabled
16798 !! input
16799 {|
16800 ||+1
16801 ||-2
16802 |}
16803 !! result
16804 <table>
16805 <tr>
16806 <td>+1
16807 </td>
16808 <td>-2
16809 </td></tr></table>
16810
16811 !! end
16812
16813 #### --------------- Links ----------------
16814 #### 1. Quote marks in link text
16815 #### 2. Wikilinks: Escapes needed
16816 #### 3. Wikilinks: No escapes needed
16817 #### 4. Extlinks: Escapes needed
16818 #### 5. Extlinks: No escapes needed
16819 #### --------------------------------------
16820 !! test
16821 Links 1. Quote marks in link text
16822 !! options
16823 parsoid
16824 !! input
16825 [[Foo|Foo<nowiki>''boo''</nowiki>]]
16826 !! result
16827 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
16828 !! end
16829
16830 !! test
16831 Links 2. WikiLinks: Escapes needed
16832 !! options
16833 parsoid
16834 !! input
16835 [[Foo|<nowiki>[Foobar]</nowiki>]]
16836 [[Foo|<nowiki>Foobar]</nowiki>]]
16837 [[Foo|x [Foobar] x]]
16838 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
16839 [[Foo|<nowiki>[[Bar]]</nowiki>]]
16840 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
16841 [[Foo|<nowiki>|Bar</nowiki>]]
16842 [[Foo|<nowiki>]]bar</nowiki>]]
16843 [[Foo|<nowiki>[[bar</nowiki>]]
16844 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
16845 !! result
16846 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
16847 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
16848 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
16849 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
16850 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
16851 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
16852 <a href="Foo" rel="mw:WikiLink">|Bar</a>
16853 <a href="Foo" rel="mw:WikiLink">]]bar</a>
16854 <a href="Foo" rel="mw:WikiLink">[[bar</a>
16855 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
16856 !! end
16857
16858 !! test
16859 Links 3. WikiLinks: No escapes needed
16860 !! options
16861 parsoid
16862 !! input
16863 [[Foo|[Foobar]]
16864 [[Foo|foo|bar]]
16865 !! result
16866 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
16867 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
16868 !! end
16869
16870 !! test
16871 Links 4. ExtLinks: Escapes needed
16872 !! options
16873 parsoid
16874 !! input
16875 [http://google.com <nowiki>[google]</nowiki>]
16876 [http://google.com <nowiki>google]</nowiki>]
16877 !! result
16878 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
16879 <a href="http://google.com" rel="mw:ExtLink">google]</a>
16880 !! end
16881
16882 !! test
16883 Links 5. ExtLinks: No escapes needed
16884 !! options
16885 parsoid
16886 !! input
16887 [http://google.com [google]
16888 !! result
16889 <a href="http://google.com" rel="mw:ExtLink">[google</a>
16890 !! end
16891
16892 #### --------------- Quotes ---------------
16893 #### 1. Quotes inside <b> and <i>
16894 #### 2. Link fragments separated by <i> and <b> tags
16895 #### 3. Link fragments inside <i> and <b>
16896 #### 4. No escaping needed
16897 #### --------------------------------------
16898 !! test
16899 1. Quotes inside <b> and <i>
16900 !! options
16901 parsoid=html2wt,wt2wt
16902 !! input
16903 ''<nowiki>'foo'</nowiki>''
16904 ''<nowiki>''foo''</nowiki>''
16905 ''<nowiki>'''foo'''</nowiki>''
16906 ''foo''<nowiki/>'s
16907 '''<nowiki>'foo'</nowiki>'''
16908 '''<nowiki>''foo''</nowiki>'''
16909 '''<nowiki>'''foo'''</nowiki>'''
16910 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
16911 '''foo'''<nowiki/>'s
16912 '''foo''
16913 ''foo''<nowiki/>'
16914 '<nowiki/>''foo''<nowiki/>'
16915 ''''foo'''
16916 '''foo'''<nowiki/>'
16917 '<nowiki/>'''foo'''<nowiki/>'
16918 !! result
16919 <p><i>'foo'</i>
16920 <i>''foo''</i>
16921 <i>'''foo'''</i>
16922 <i>foo</i>'s
16923 <b>'foo'</b>
16924 <b>''foo''</b>
16925 <b>'''foo'''</b>
16926 <b>foo'<i>bar'</i>baz</b>
16927 <b>foo</b>'s
16928 '<i>foo</i>
16929 <i>foo</i>'
16930 '<i>foo</i>'
16931 '<b>foo</b>
16932 <b>foo</b>'
16933 '<b>foo</b>'</p>
16934 !! end
16935
16936 !! test
16937 2. Link fragments separated by <i> and <b> tags
16938 !! input
16939 [[''foo''<nowiki>hello]]</nowiki>
16940
16941 [['''foo'''<nowiki>hello]]</nowiki>
16942 !! result
16943 <p>[[<i>foo</i>hello]]
16944 </p><p>[[<b>foo</b>hello]]
16945 </p>
16946 !! end
16947
16948 !! test
16949 3. Link fragments inside <i> and <b>
16950 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
16951 this is one of the shortcomings of this format)
16952 !! input
16953 ''[[foo''<nowiki>]]</nowiki>
16954
16955 '''[[foo'''<nowiki>]]</nowiki>
16956 !! result
16957 <p><i>[[foo</i>]]
16958 </p><p><b>[[foo</b>]]
16959 </p>
16960 !! end
16961
16962 !! test
16963 4. No escaping needed
16964 !! input
16965 '<span>''bar''</span>'
16966 '<span>'''bar'''</span>'
16967 !! result
16968 <p>'<span><i>bar</i></span>'
16969 '<span><b>bar</b></span>'
16970 </p>
16971 !! end
16972
16973 #### ----------- Paragraphs ---------------
16974 #### 1. No unnecessary escapes
16975 #### --------------------------------------
16976
16977 !! test
16978 1. No unnecessary escapes
16979 !! input
16980 bar <span><nowiki>[[foo]]</nowiki></span>
16981
16982 =bar <span><nowiki>[[foo]]</nowiki></span>
16983
16984 [[bar <span><nowiki>[[foo]]</nowiki></span>
16985
16986 ]]bar <span><nowiki>[[foo]]</nowiki></span>
16987
16988 =bar <span>foo]]</span><nowiki>=</nowiki>
16989 !! result
16990 <p>bar <span>[[foo]]</span>
16991 </p><p>=bar <span>[[foo]]</span>
16992 </p><p>[[bar <span>[[foo]]</span>
16993 </p><p>]]bar <span>[[foo]]</span>
16994 </p><p>=bar <span>foo]]</span>=
16995 </p>
16996 !!end
16997
16998 #### ----------------------- PRE --------------------------
16999 #### 1. Leading whitespace in SOL context should be escaped
17000 #### ------------------------------------------------------
17001 !! test
17002 1. Leading whitespace in SOL context should be escaped
17003 !! options
17004 parsoid
17005 !! input
17006 <nowiki> </nowiki>a
17007
17008 <nowiki> </nowiki> a
17009
17010 <nowiki> </nowiki>a(tab)
17011
17012 <nowiki> </nowiki> a
17013 <!--cmt-->
17014 <nowiki> </nowiki> a
17015
17016 a
17017 <nowiki> </nowiki>b
17018
17019 a
17020 <nowiki> </nowiki>b
17021
17022 a
17023 <nowiki> </nowiki> b
17024 !! result
17025 <p> a</p>
17026 <p> a</p>
17027 <p> a(tab)</p>
17028 <p> a</p>
17029 <p><!--cmt--> a</p>
17030 <p>a
17031 b</p>
17032 <p>a
17033 b</p>
17034 <p>a
17035 b</p>
17036 !! end
17037
17038 #### --------------- HTML tags ---------------
17039 #### 1. a tags
17040 #### 2. other tags
17041 #### 3. multi-line html tag
17042 #### -----------------------------------------
17043 !! test
17044 1. a tags
17045 !! options
17046 parsoid
17047 !! input
17048 <a href="http://google.com">google</a>
17049 !! result
17050 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
17051 !! end
17052
17053 !! test
17054 2. other tags
17055 !! input
17056 <nowiki><div>foo</div>
17057 <div style="color:red">foo</div></nowiki>
17058 !! result
17059 <p>&lt;div&gt;foo&lt;/div&gt;
17060 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
17061 </p>
17062 !! end
17063
17064 !! test
17065 3. multi-line html tag
17066 !! input
17067 <nowiki><div
17068 >foo</div
17069 ></nowiki>
17070 !! result
17071 <p>&lt;div
17072 &gt;foo&lt;/div
17073 &gt;
17074 </p>
17075 !! end
17076
17077 !! test
17078 4. extension tags
17079 !! input
17080 <nowiki><ref>foo</ref></nowiki>
17081 !! result
17082 <p>&lt;ref&gt;foo&lt;/ref&gt;
17083 </p>
17084 !! end
17085
17086 #### --------------- Others ---------------
17087 !! test
17088 Escaping nowikis
17089 !! input
17090 &lt;nowiki&gt;foo&lt;/nowiki&gt;
17091 !! result
17092 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
17093 </p>
17094 !! end
17095
17096 ## The quote-char in the input is necessary for triggering the bug
17097 !! test
17098 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
17099 !! options
17100 parsoid=wt2wt,html2wt
17101 !! input
17102 foo's bar :
17103 !! result
17104 <p>foo's bar :</p>
17105 !! end
17106
17107 !! test
17108
17109 Tag-like HTML structures are passed through as text
17110 !! input
17111 <x y>
17112
17113 <x.y>
17114
17115 <x-y>
17116
17117 1>2
17118
17119 x<y
17120
17121 a>b
17122
17123 1<d e>f
17124 !! result
17125 <p>&lt;x y&gt;
17126 </p><p>&lt;x.y&gt;
17127 </p><p>&lt;x-y&gt;
17128 </p><p>1&gt;2
17129 </p><p>x&lt;y
17130 </p><p>a&gt;b
17131 </p><p>1&lt;d e&gt;f
17132 </p>
17133 !! end
17134
17135
17136 # This was a bug in the PHP parser (see bug 17663 and its dups,
17137 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
17138 !! test
17139 Tag names followed by punctuation should not be recognized as tags
17140 !! input
17141 <s.ome> text
17142 !! result
17143 <p>&lt;s.ome&gt; text
17144 </p>
17145 !! end
17146
17147 !! test
17148 HTML tag with necessary entities in attributes
17149 !! input
17150 <span title="&amp;amp;">foo</span>
17151 !! result
17152 <p><span title="&amp;amp;">foo</span>
17153 </p>
17154 !! end
17155
17156 !! test
17157 HTML tag with 'unnecessary' entity encoding in attributes
17158 !! input
17159 <span title="&amp;">foo</span>
17160 !! result
17161 <p><span title="&amp;">foo</span>
17162 </p>
17163 !! end
17164
17165 !! test
17166 HTML tag with broken attribute value quoting
17167 !! input
17168 <span title="Hello world>Foo</span>
17169 !! result
17170 <p><span>Foo</span>
17171 </p>
17172 !! end
17173
17174 !! test
17175 Parsoid-only: HTML tag with broken attribute value quoting
17176 !! options
17177 parsoid
17178 !! input
17179 <span title="Hello world>Foo</span>
17180 !! result
17181 <p><span title="Hello world">Foo</span>
17182 </p>
17183 !! end
17184
17185 !! test
17186 Table with broken attribute value quoting
17187 !! input
17188 {|
17189 | title="Hello world|Foo
17190 |}
17191 !! result
17192 <table>
17193 <tr>
17194 <td>Foo
17195 </td></tr></table>
17196
17197 !! end
17198
17199 !! test
17200 Table with broken attribute value quoting on consecutive lines
17201 !! input
17202 {|
17203 | title="Hello world|Foo
17204 | style="color:red|Bar
17205 |}
17206 !! result
17207 <table>
17208 <tr>
17209 <td>Foo
17210 </td>
17211 <td>Bar
17212 </td></tr></table>
17213
17214 !! end
17215
17216 !! test
17217 Parsoid-only: Table with broken attribute value quoting on consecutive lines
17218 !! options
17219 parsoid
17220 !! input
17221 {|
17222 | title="Hello world|Foo
17223 | style="color:red|Bar
17224 |}
17225 !! result
17226 <table><tbody>
17227 <tr>
17228 <td title="Hello world">Foo
17229 </td><td style="color: red">Bar
17230 </td></tr></tbody></table>
17231
17232 !! end
17233
17234 !! test
17235 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
17236 !! options
17237 parsoid
17238 !! input
17239 {{}}
17240 !! result
17241 {{}}
17242 !! end
17243
17244 !! test
17245 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
17246 !! options
17247 parsoid
17248 !! input
17249 }}{{
17250 !! result
17251 }}{{
17252 !! end
17253
17254 !!test
17255 Accept empty td cell attribute
17256 !!input
17257 {|
17258 | align="center" | foo || |
17259 |}
17260 !!result
17261 <table>
17262 <tr>
17263 <td align="center"> foo </td>
17264 <td>
17265 </td></tr></table>
17266
17267 !!end
17268
17269 !!test
17270 Non-empty attributes in th-cells
17271 !!input
17272 {|
17273 ! Foo !! style="color: red" | Bar
17274 |}
17275 !!result
17276 <table>
17277 <tr>
17278 <th> Foo </th>
17279 <th style="color: red"> Bar
17280 </th></tr></table>
17281
17282 !!end
17283
17284 !!test
17285 Accept empty attributes in th-cells
17286 !!input
17287 {|
17288 !| foo !!| bar
17289 |}
17290 !!result
17291 <table>
17292 <tr>
17293 <th> foo </th>
17294 <th> bar
17295 </th></tr></table>
17296
17297 !!end
17298
17299 !!test
17300 Empty table rows go away
17301 !!input
17302 {|
17303 | Hello
17304 | there
17305 |- class="foo"
17306 |-
17307 |}
17308 !! result
17309 <table>
17310 <tr>
17311 <td> Hello
17312 </td>
17313 <td> there
17314 </td></tr>
17315
17316 </table>
17317
17318 !! end
17319
17320 ###
17321 ### Parsoid-centric tests for testing RTing of inter-element separators
17322 ### Edge cases not tested by existing parser tests and specific to
17323 ### Parsoid-specific serialization strategies.
17324 ###
17325
17326 !!test
17327 RT-ed inter-element separators should be valid separators
17328 !!input
17329 {|
17330 |- [[foo]]
17331 |}
17332 !!result
17333 <table>
17334
17335 </table>
17336
17337 !!end
17338
17339 !!test
17340 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
17341 (Parsoid-only since PHP parser relies on Tidy for correct output)
17342 !!options
17343 parsoid
17344 !!input
17345 {|
17346 |<small>foo
17347 bar
17348 |}
17349
17350 {|
17351 |<small>foo<small>
17352 |}
17353 !!result
17354 !!end
17355
17356 !!test
17357 Empty TD followed by TD with tpl-generated attribute
17358 !!input
17359 {|
17360 |-
17361 |
17362 |{{echo|style='color:red'}}|foo
17363 |}
17364 !!result
17365 <table>
17366
17367 <tr>
17368 <td>
17369 </td>
17370 <td>foo
17371 </td></tr></table>
17372
17373 !!end
17374
17375 !!test
17376 Indented table with an empty td
17377 !!input
17378 {|
17379 |-
17380 |
17381 |foo
17382 |}
17383 !!result
17384 <table>
17385
17386 <tr>
17387 <td>
17388 </td>
17389 <td>foo
17390 </td></tr></table>
17391
17392 !!end
17393
17394 !!test
17395 Empty TR followed by a template-generated TR
17396 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
17397 !!options
17398 parsoid
17399 !!input
17400 {|
17401 |-
17402 {{echo|<tr><td>foo</td></tr>}}
17403 |}
17404 !!result
17405 <table>
17406 <tbody>
17407 <tr></tr>
17408 <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}}]}'>
17409 <td>foo</td></tr>
17410 </tbody></table>
17411 !!end
17412
17413 ## PHP and parsoid output differ for this, and since this is primarily
17414 ## for testing Parsoid's serializer, marking this Parsoid only
17415 !!test
17416 Empty TR followed by mixed-ws-comment line should RT correctly
17417 !!options
17418 parsoid
17419 !!input
17420 {|
17421 |-
17422 <!--c-->
17423 |-
17424 <!--c--> <!--d-->
17425 |}
17426 !!result
17427 <table>
17428 <tbody>
17429 <tr></tr>
17430 <!--c-->
17431 <tr>
17432 <!--c--> </tr><!--d-->
17433 </tbody></table>
17434
17435 !!end
17436
17437 !!test
17438 Multi-line image caption generated by templates with/without trailing newlines
17439 !!options
17440 parsoid
17441 !!input
17442 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
17443 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
17444 !!result
17445 <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>
17446 <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>
17447
17448 !!end
17449
17450 ## PHP emits broken html for this, and since this is primarily
17451 ## a Parsoid serializer test, marking this Parsoid only
17452 !!test
17453 Improperly nested inline or quotes tags with whitespace in between
17454 !!options
17455 parsoid
17456 !!input
17457 <span> <s>x</span> </s>
17458 ''' ''x''' ''
17459 !!result
17460 <p><span> <s>x</s></span><s> </s>
17461 <b> <i>x</i></b><i> </i>
17462 </p>
17463 !!end
17464
17465 !!test
17466 Encapsulate protected attributes from wt
17467 !!options
17468 parsoid
17469 !!input
17470 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
17471 !!result
17472 <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>
17473 </body>
17474 !!end
17475
17476 ## Currently the p-wrapper is fragile in how adds / removes transformations.
17477 ## Having nested or stray pre tags results in the attempt to add duplicates,
17478 ## causing an assertion fail. This test tries to prevent that situation.
17479 !!test
17480 Ensure ParagraphWrapper can deal with stray closing pre tags
17481 !!options
17482 parsoid=wt2html
17483 !!input
17484 plain text</pre>
17485 !!result
17486 plain text
17487 !!end
17488
17489 !!test
17490 Ensure fostered text content is wrapped in spans
17491 !!options
17492 parsoid=wt2html
17493 !!input
17494 <table>hi</table><table>ho</table>
17495 !!result
17496 <span>hi</span>
17497 <table></table>
17498 <span>ho</span>
17499 <table></table>
17500 !!end
17501
17502 # -----------------------------------------------------------------
17503 # The following section of tests are primarily to spec requirements
17504 # around serialization of new/edited content.
17505 #
17506 # All these tests are marked Parsoid html2wt and html2html only
17507 # ----------------------------------------------------------------
17508
17509 !! test
17510 Image: Modifying size of an image
17511 !! options
17512 parsoid=html2wt
17513 !! input
17514 [[Image:Wiki.png|230x230px]]
17515 !! result
17516 <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>
17517 !!end
17518
17519 !! test
17520 Image: New block level image should have \n before and after
17521 !! options
17522 parsoid=html2wt
17523 !! input
17524 123
17525 [[File:Wiki.png|right|thumb|150x150px]]
17526 456
17527 !! result
17528 <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>
17529 !!end
17530
17531 # Wacky -- the leading newline in input is required because
17532 # that is what the serializer emits. To be fixed. Not fixing
17533 # the test because this test is required to test serialization of
17534 # new content and preferred whitespace style.
17535 !! test
17536 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
17537 !! options
17538 parsoid=html2wt
17539 !! input
17540
17541 * foo
17542 !! result
17543 <ul>
17544 <li><p>foo</p></li>
17545 </ul>
17546 !! end
17547
17548 # Wacky -- the leading newline in input is required because
17549 # that is what the serializer emits. To be fixed. Not fixing
17550 # the test because this test is required to test serialization of
17551 # new content and preferred whitespace style.
17552 !! test
17553 Lists: Add space after bullets
17554 !! options
17555 parsoid=html2wt
17556 !! input
17557
17558 * foo
17559 * bar
17560 * <span> baz</span>
17561 !! result
17562 <ul>
17563 <li>foo</li>
17564 <li> bar</li>
17565 <li><span> baz</span></li>
17566 </ul>
17567 !! end
17568
17569 !! test
17570 Parsoid: Serialize positional parameters with = in them as named parameter
17571 !! options
17572 parsoid=html2wt
17573 !! input
17574 {{echo|1 = f=oo}}
17575
17576 {{echo|1 = f=oo|2 = bar}}
17577
17578 <!--Orig params with data-parsoid has heuristics for handling = chars-->
17579 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
17580 {{echo|<nowiki>f=oo</nowiki>|bar}}
17581 !! result
17582 <p about="#mwt1" typeof="mw:Transclusion"
17583 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
17584
17585 <p about="#mwt1" typeof="mw:Transclusion"
17586 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
17587
17588 <!--Orig params with data-parsoid has heuristics for handling = chars-->
17589 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
17590 <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>
17591 !! end
17592
17593 !! test
17594 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
17595 !! options
17596 parsoid=html2wt
17597 !! input
17598 <div>a
17599 b
17600 </div>
17601 <div>a
17602 b
17603 </div>
17604 <div>
17605 a
17606
17607 b
17608 </div>
17609 !! result
17610 <div>a<p>b</p></div>
17611 <div>a
17612 <p>b</p></div>
17613 <div>
17614 a
17615 <p>b</p></div>
17616 !! end
17617
17618 #-----------------------------
17619 # I/B quote minimization tests
17620 #-----------------------------
17621
17622 !! test
17623 1. I/B qoute minimization: wikitext-only tags should be combined
17624 !! options
17625 parsoid=html2wt
17626 !! input
17627 ''AB''
17628
17629 '''AB'''
17630
17631 ''A'''B'''''
17632
17633 '''A''B'''''
17634
17635 '''A''BC''D'''
17636 !! result
17637 <p><i>A</i><i>B</i></p>
17638 <p><b>A</b><b>B</b></p>
17639 <p><i>A</i><b><i>B</i></b></p>
17640 <p><b>A</b><i><b>B</b></i></p>
17641 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
17642 !! end
17643
17644 !! test
17645 2. I/B qoute minimization: wikitext and html tags should not be combined
17646 !! options
17647 parsoid=html2wt
17648 !! input
17649 ''A''<i>B</i>
17650
17651 ''A'''''<i>B</i>'''
17652 !! result
17653 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
17654 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
17655 !! end
17656
17657 !! test
17658 3. I/B qoute minimization: templated content stops minimization
17659 !! options
17660 parsoid=html2wt
17661 !! input
17662 ''A''{{echo|''B''}}
17663
17664 ''A''{{echo|'''''B'''''}}
17665 !! result
17666 <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>
17667 <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>
17668 !! end
17669
17670 !! test
17671 4. I/B qoute minimization: new content should be mimimized with adjacent old content
17672 !! options
17673 parsoid=html2wt
17674 !! input
17675 ''AB''
17676
17677 '''AB'''
17678
17679 ''A'''B'''''
17680 !! result
17681 <p><i>A</i><i data-parsoid='{}'>B</i></p>
17682 <p><b data-parsoid='{}'>A</b><b>B</b></p>
17683 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
17684 !! end
17685
17686 # -----------------------------------------------------------------
17687 # End of section for Parsoid-only html2wt tests for serialization
17688 # of new content
17689 # -----------------------------------------------------------------
17690
17691 TODO:
17692 more images
17693 more tables
17694 character entities
17695 and much more
17696 Try for 100% code coverage