Merge "Clean up Parser::doQuotes()."
[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<i></i></b>
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<i></i></b>
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) (php)
657 !! options
658 php
659 !! input
660 '''''foo''
661 !! result
662 <p><b><i>foo</i></b>
663 </p>
664 !!end
665 # Parsoid reverses the nesting order, compared to the PHP parser
666 !! test
667 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
668 !! options
669 parsoid
670 !! input
671 '''''foo''
672 !! result
673 <p><i><b>foo</b></i>
674 </p>
675 !!end
676
677
678 !! test
679 Italics and bold: 5-quote opening sequence: (5,3)
680 !! input
681 '''''foo'''
682 !! result
683 <p><i><b>foo</b></i>
684 </p>
685 !!end
686
687
688 !! test
689 Italics and bold: 5-quote opening sequence: (5,4)
690 !! input
691 '''''foo''''
692 !! result
693 <p><i><b>foo'</b></i>
694 </p>
695 !!end
696
697
698 !! test
699 Italics and bold: 5-quote opening sequence: (5,5)
700 !! input
701 '''''foo'''''
702 !! result
703 <p><i><b>foo</b></i>
704 </p>
705 !!end
706
707 ###
708 ### multiple quote sequences in a line
709 ###
710 !! test
711 Italics and bold: multiple quote sequences: (2,4,2)
712 !! input
713 ''foo''''bar''
714 !! result
715 <p><i>foo'<b>bar</b></i>
716 </p>
717 !!end
718
719
720 !! test
721 Italics and bold: multiple quote sequences: (2,4,3)
722 !! input
723 ''foo''''bar'''
724 !! result
725 <p><i>foo'<b>bar</b></i>
726 </p>
727 !!end
728
729
730 !! test
731 Italics and bold: multiple quote sequences: (2,4,4)
732 !! input
733 ''foo''''bar''''
734 !! result
735 <p><i>foo'<b>bar'</b></i>
736 </p>
737 !!end
738
739
740 !! test
741 Italics and bold: multiple quote sequences: (3,4,2) (php)
742 !! options
743 php
744 !! input
745 '''foo''''bar''
746 !! result
747 <p><b>foo'</b>bar
748 </p>
749 !!end
750 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
751 !! test
752 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
753 !! options
754 parsoid
755 !! input
756 '''foo''''bar''
757 !! result
758 <p><b>foo'</b>bar<i></i>
759 </p>
760 !!end
761
762
763 !! test
764 Italics and bold: multiple quote sequences: (3,4,3) (php)
765 !! options
766 php
767 !! input
768 '''foo''''bar'''
769 !! result
770 <p><b>foo'</b>bar
771 </p>
772 !!end
773 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
774 !! test
775 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
776 !! options
777 parsoid
778 !! input
779 '''foo''''bar'''
780 !! result
781 <p><b>foo'</b>bar<b></b>
782 </p>
783 !!end
784
785 ###
786 ### other quote tests
787 ###
788 !! test
789 Italics and bold: other quote tests: (2,3,5)
790 !! input
791 ''this is about '''foo's family'''''
792 !! result
793 <p><i>this is about <b>foo's family</b></i>
794 </p>
795 !!end
796
797
798 !! test
799 Italics and bold: other quote tests: (2,(3,3),2)
800 !! input
801 ''this is about '''foo's''' family''
802 !! result
803 <p><i>this is about <b>foo's</b> family</i>
804 </p>
805 !!end
806
807
808 !! test
809 Italics and bold: other quote tests: (3,2,3,2)
810 !! input
811 '''this is about ''foo'''s family''
812 !! result
813 <p><b>this is about <i>foo</i></b><i>s family</i>
814 </p>
815 !!end
816
817
818 # The Parsoid team believes the PHP parser's output on this test is wrong.
819 # It only checks for convert-to-bold-on-single-character-word when the word
820 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
821 # This means that the bold token in position 2 (0-indexed) gets converted by
822 # parsoid, but doesn't get changed by the PHP parser.
823 !! test
824 Italics and bold: other quote tests: (3,2,3,3) (php)
825 !! options
826 php
827 !! input
828 '''this is about ''foo'''s family'''
829 !! result
830 <p>'<i>this is about </i>foo<b>s family</b>
831 </p>
832 !!end
833 # This is the output the Parsoid team believes to be correct.
834 !! test
835 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
836 !! options
837 parsoid
838 !! input
839 '''this is about ''foo'''s family'''
840 !! result
841 <p><b>this is about <i>foo'</i>s family</b>
842 </p>
843 !!end
844
845
846 !! test
847 Italics and bold: other quote tests: (3,(2,2),3)
848 !! input
849 '''this is about ''foo's'' family'''
850 !! result
851 <p><b>this is about <i>foo's</i> family</b>
852 </p>
853 !!end
854
855
856 !! test
857 Italicized possessive
858 !! input
859 The ''[[Main Page]]'''s talk page.
860 !! result
861 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
862 </p>
863 !! end
864
865 !! test
866 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
867 (Requires tidy for PHP parser output to be fixed up)
868 !! options
869 parsoid=wt2html,wt2wt
870 !! input
871 {|
872 !''a!!''b
873 |''a||''b
874 |}
875 !! result
876 <table>
877 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
878 <td><i>a</i></td><td><i>b</i></td></tr>
879 </tbody></table>
880 !! end
881
882 ###
883 ### Non-html5 tags
884 ###
885
886 !! test
887 Non-html5 tags should be accepted
888 !! input
889 <center>''foo''</center>
890 <big>''foo''</big>
891 <font>''foo''</font>
892 <strike>''foo''</strike>
893 <tt>''foo''</tt>
894 !! result
895 <center><i>foo</i></center>
896 <p><big><i>foo</i></big>
897 <font><i>foo</i></font>
898 <strike><i>foo</i></strike>
899 <tt><i>foo</i></tt>
900 </p>
901 !! end
902
903 !! test
904 <wbr> is valid wikitext (bug 52468)
905 !! input
906 <wbr>
907 !! result
908 <p><wbr />
909 </p>
910 !! end
911
912 # <strike> is HTML4, <s> is HTML4/5.
913 !! test
914 <s> or <strike> for strikethrough
915 !! input
916 <strike>strike</strike>
917
918 <s>s</s>
919 !! result
920 <p><strike>strike</strike>
921 </p><p><s>s</s>
922 </p>
923 !! end
924
925 !! test
926 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
927 !! input
928 <b→> doesn't work! </b>
929
930 <bä> doesn't work! </b>
931
932 <boo> works fine </b>
933
934 <s.foo>foo</s>
935
936 <s.foo>s.foo</s.foo>
937
938 <sub-ID#1>
939 !! result
940 <p>&lt;b→&gt; doesn't work! &lt;/b&gt;
941 </p><p>&lt;bä&gt; doesn't work! &lt;/b&gt;
942 </p><p>&lt;boo&gt; works fine &lt;/b&gt;
943 </p><p>&lt;s.foo&gt;foo&lt;/s&gt;
944 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
945 </p><p>&lt;sub-ID#1&gt;
946 </p>
947 !! end
948
949 ###
950 ### Special characters
951 ###
952
953 !! test
954 Bare pipe character (bug 52363)
955 !! input
956 |
957 !! result
958 <p>|
959 </p>
960 !! end
961
962 !! test
963 Bare pipe character from a template (bug 52363)
964 !! input
965 {{pipe}}
966 !! result
967 <p>|
968 </p>
969 !! end
970
971 ###
972 ### <nowiki> test cases
973 ###
974
975 !! test
976 <nowiki> unordered list
977 !! input
978 <nowiki>* This is not an unordered list item.</nowiki>
979 !! result
980 <p>* This is not an unordered list item.
981 </p>
982 !! end
983
984 !! test
985 <nowiki> spacing
986 !! input
987 <nowiki>Lorem ipsum dolor
988
989 sed abit.
990 sed nullum.
991
992 :and a colon
993 </nowiki>
994 !! result
995 <p>Lorem ipsum dolor
996
997 sed abit.
998 sed nullum.
999
1000 :and a colon
1001
1002 </p>
1003 !! end
1004
1005 !! test
1006 nowiki 3
1007 !! input
1008 :There is not nowiki.
1009 :There is <nowiki>nowiki</nowiki>.
1010
1011 #There is not nowiki.
1012 #There is <nowiki>nowiki</nowiki>.
1013
1014 *There is not nowiki.
1015 *There is <nowiki>nowiki</nowiki>.
1016 !! result
1017 <dl><dd>There is not nowiki.
1018 </dd><dd>There is nowiki.
1019 </dd></dl>
1020 <ol><li>There is not nowiki.
1021 </li><li>There is nowiki.
1022 </li></ol>
1023 <ul><li>There is not nowiki.
1024 </li><li>There is nowiki.
1025 </li></ul>
1026
1027 !! end
1028
1029 !! test
1030 Entities inside <nowiki>
1031 !! input
1032 <nowiki>&lt;</nowiki>
1033 !! result
1034 <p>&lt;
1035 </p>
1036 !! end
1037
1038 !! test
1039 Entities inside template parameters
1040 !! options
1041 parsoid
1042 !! input
1043 {{echo|&ndash;}}
1044 !! result
1045 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}'>&ndash;</span>
1046 </p>
1047 !! end
1048
1049 ###
1050 ### Comments
1051 ###
1052 !! test
1053 Comments and Indent-Pre
1054 !! input
1055 <!-- comment 1 --> asdf
1056
1057 <!-- comment 1 --> asdf
1058 <!-- comment 2 -->
1059
1060 <!-- comment 1 --> asdf
1061 <!-- comment 2 -->xyz
1062
1063 <!-- comment 1 --> asdf
1064 <!-- comment 2 --> xyz
1065 !! result
1066 <pre>asdf
1067 </pre>
1068 <pre>asdf
1069 </pre>
1070 <pre>asdf
1071 </pre>
1072 <p>xyz
1073 </p>
1074 <pre>asdf
1075 xyz
1076 </pre>
1077 !! end
1078
1079 !! test
1080 Comment test 2a
1081 !! input
1082 asdf
1083 <!-- comment 1 -->
1084 jkl
1085 !! result
1086 <p>asdf
1087 jkl
1088 </p>
1089 !! end
1090
1091 !! test
1092 Comment test 2b
1093 !! input
1094 asdf
1095 <!-- comment 1 -->
1096
1097 jkl
1098 !! result
1099 <p>asdf
1100 </p><p>jkl
1101 </p>
1102 !! end
1103
1104 !! test
1105 Comment test 3
1106 !! input
1107 asdf
1108 <!-- comment 1 -->
1109 <!-- comment 2 -->
1110 jkl
1111 !! result
1112 <p>asdf
1113 jkl
1114 </p>
1115 !! end
1116
1117 !! test
1118 Comment test 4
1119 !! input
1120 asdf<!-- comment 1 -->jkl
1121 !! result
1122 <p>asdfjkl
1123 </p>
1124 !! end
1125
1126 !! test
1127 Comment spacing
1128 !! input
1129 a
1130 <!-- foo --> b <!-- bar -->
1131 c
1132 !! result
1133 <p>a
1134 </p>
1135 <pre> b
1136 </pre>
1137 <p>c
1138 </p>
1139 !! end
1140
1141 !! test
1142 Comment whitespace
1143 !! input
1144 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1145 !! result
1146
1147 !! end
1148
1149 !! test
1150 Comment semantics and delimiters
1151 !! input
1152 <!-- --><!----><!-----><!------>
1153 !! result
1154
1155 !! end
1156
1157 !! test
1158 Comment semantics and delimiters, redux
1159 !! input
1160 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1161 -- foo -- funky huh? ... -->
1162 !! result
1163
1164 !! end
1165
1166 !! test
1167 Comment semantics and delimiters: directors cut
1168 !! input
1169 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1170 everything starting with < followed by !-- until the first -- and > we see,
1171 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1172 -->-->
1173 !! result
1174 <p>--&gt;
1175 </p>
1176 !! end
1177
1178 !! test
1179 Comment semantics: nesting
1180 !! input
1181 <!--<!-- no, we're not going to do anything fancy here -->-->
1182 !! result
1183 <p>--&gt;
1184 </p>
1185 !! end
1186
1187 !! test
1188 Comment semantics: unclosed comment at end
1189 !! input
1190 <!--This comment will run out to the end of the document
1191 !! result
1192
1193 !! end
1194
1195 !! test
1196 Comment in template title
1197 !! input
1198 {{f<!---->oo}}
1199 !! result
1200 <p>FOO
1201 </p>
1202 !! end
1203
1204 !! test
1205 Comment on its own line post-expand
1206 !! input
1207 a
1208 {{blank}}<!---->
1209 b
1210 !! result
1211 <p>a
1212 </p><p>b
1213 </p>
1214 !! end
1215
1216 !! test
1217 Comment on its own line post-expand with non-significant whitespace
1218 !! input
1219 a
1220 {{blank}} <!---->
1221 b
1222 !! result
1223 <p>a
1224 </p><p>b
1225 </p>
1226 !! end
1227
1228 ###
1229 ### paragraph wrapping tests
1230 ###
1231 !! test
1232 No block tags
1233 !! input
1234 a
1235
1236 b
1237 !! result
1238 <p>a
1239 </p><p>b
1240 </p>
1241 !! end
1242 !! test
1243 Block tag on one line
1244 !! input
1245 a <div>foo</div>
1246
1247 b
1248 !! result
1249 a <div>foo</div>
1250 <p>b
1251 </p>
1252 !! end
1253
1254 !! test
1255 Block tag on both lines
1256 !! input
1257 a <div>foo</div>
1258
1259 b <div>foo</div>
1260 !! result
1261 a <div>foo</div>
1262 b <div>foo</div>
1263
1264 !! end
1265
1266 !! test
1267 Multiple lines without block tags
1268 !! input
1269 <div>foo</div> a
1270 b
1271 c
1272 d<!--foo--> e
1273 x <div>foo</div> z
1274 !! result
1275 <div>foo</div> a
1276 <p>b
1277 c
1278 d e
1279 </p>
1280 x <div>foo</div> z
1281
1282 !! end
1283
1284 !! test
1285 Empty lines between lines with block tags
1286 !! input
1287 <div></div>
1288
1289
1290 <div></div>a
1291
1292 b
1293 <div>a</div>b
1294
1295 <div>b</div>d
1296
1297
1298 <div>e</div>
1299 !! result
1300 <div></div>
1301 <p><br />
1302 </p>
1303 <div></div>a
1304 <p>b
1305 </p>
1306 <div>a</div>b
1307 <div>b</div>d
1308 <p><br />
1309 </p>
1310 <div>e</div>
1311
1312 !! end
1313
1314 ###
1315 ### Preformatted text
1316 ###
1317 !! test
1318 Preformatted text
1319 !! input
1320 This is some
1321 Preformatted text
1322 With ''italic''
1323 And '''bold'''
1324 And a [[Main Page|link]]
1325 !! result
1326 <pre>This is some
1327 Preformatted text
1328 With <i>italic</i>
1329 And <b>bold</b>
1330 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1331 </pre>
1332 !! end
1333
1334 !! test
1335 Tabs don't trigger preformatted text
1336 !! input
1337 This is not
1338 preformatted text.
1339 This is preformatted text.
1340 So is this.
1341 !! result
1342 <p> This is not
1343 preformatted text.
1344 </p>
1345 <pre>This is preformatted text.
1346 So is this.
1347 </pre>
1348 !! end
1349
1350 !! test
1351 Ident preformatting with inline content
1352 !! input
1353 a
1354 ''b''
1355 !! result
1356 <pre>a
1357 <i>b</i>
1358 </pre>
1359 !! end
1360
1361 !! test
1362 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1363 !! input
1364 <pre><nowiki>
1365 <b>
1366 <cite>
1367 <em>
1368 </nowiki></pre>
1369 !! result
1370 <pre>
1371 &lt;b&gt;
1372 &lt;cite&gt;
1373 &lt;em&gt;
1374 </pre>
1375
1376 !! end
1377
1378 !! test
1379 Regression with preformatted in <center>
1380 !! input
1381 <center>
1382 Blah
1383 </center>
1384 !! result
1385 <center>
1386 <pre>Blah
1387 </pre>
1388 </center>
1389
1390 !! end
1391
1392 # Expected output in the following test is not really expected (there should be
1393 # <pre> in the output) -- it's only testing for well-formedness.
1394 !! test
1395 Bug 6200: Preformatted in <blockquote>
1396 !! input
1397 <blockquote>
1398 Blah
1399 </blockquote>
1400 !! result
1401 <blockquote>
1402 Blah
1403 </blockquote>
1404
1405 !! end
1406
1407 !! test
1408 <pre> with attributes (bug 3202)
1409 !! input
1410 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1411 !! result
1412 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1413
1414 !! end
1415
1416 !! test
1417 <pre> with width attribute (bug 3202)
1418 !! input
1419 <pre width="8">Narrow screen goodies</pre>
1420 !! result
1421 <pre width="8">Narrow screen goodies</pre>
1422
1423 !! end
1424
1425 !! test
1426 <pre> with forbidden attribute (bug 3202)
1427 !! input
1428 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1429 !! result
1430 <pre width="8">Narrow screen goodies</pre>
1431
1432 !! end
1433
1434 !! test
1435 Entities inside <pre>
1436 !! input
1437 <pre>&lt;</pre>
1438 !! result
1439 <pre>&lt;</pre>
1440
1441 !! end
1442
1443 !! test
1444 <pre> with forbidden attribute values (bug 3202)
1445 !! input
1446 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1447 !! result
1448 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1449
1450 !! end
1451
1452 !! test
1453 <nowiki> inside <pre> (bug 13238)
1454 !! input
1455 <pre>
1456 <nowiki>
1457 </pre>
1458 <pre>
1459 <nowiki></nowiki>
1460 </pre>
1461 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1462 !! result
1463 <pre>
1464 &lt;nowiki&gt;
1465 </pre>
1466 <pre>
1467
1468 </pre>
1469 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1470
1471 !! end
1472
1473 !! test
1474 <nowiki> and <pre> preference (first one wins)
1475 !! input
1476 <pre>
1477 <nowiki>
1478 </pre>
1479 </nowiki>
1480 </pre>
1481
1482 <nowiki>
1483 <pre>
1484 <nowiki>
1485 </pre>
1486 </nowiki>
1487 </pre>
1488
1489 !! result
1490 <pre>
1491 &lt;nowiki&gt;
1492 </pre>
1493 <p>&lt;/nowiki&gt;
1494 &lt;/pre&gt;
1495 </p><p>
1496 &lt;pre&gt;
1497 &lt;nowiki&gt;
1498 &lt;/pre&gt;
1499
1500 &lt;/pre&gt;
1501 </p>
1502 !! end
1503
1504 !! test
1505 </pre> inside nowiki
1506 !! input
1507 <nowiki></pre></nowiki>
1508 !! result
1509 <p>&lt;/pre&gt;
1510 </p>
1511 !! end
1512
1513 !!test
1514 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1515 !!input
1516 {{echo|}}
1517 !!result
1518
1519 !!end
1520
1521 !!test
1522 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1523 !!input
1524 {{echo|
1525 foo}}
1526 !!result
1527 <p>foo
1528 </p>
1529 !!end
1530
1531 !! test
1532 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1533 !! input
1534 {{echo|a
1535 b}}
1536 !!result
1537 <pre>a
1538 </pre>
1539 <p>b
1540 </p>
1541 !!end
1542
1543 !! test
1544 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1545 !! input
1546 {{echo|a
1547 b
1548 c
1549 d
1550 e
1551 }}
1552 !!result
1553 <pre>a
1554 </pre>
1555 <p>b
1556 c
1557 </p>
1558 <pre>d
1559 </pre>
1560 <p>e
1561 </p>
1562 !!end
1563
1564 !!test
1565 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1566 !!input
1567 {{echo| foo}}
1568
1569 {{echo| foo}}{{echo| bar}}
1570
1571 {{echo| foo}}
1572 {{echo| bar}}
1573
1574 {{echo|<!--cmt--> foo}}
1575
1576 <!--cmt-->{{echo| foo}}
1577
1578 {{echo|{{echo| }}bar}}
1579 !!result
1580 <pre>foo
1581 </pre>
1582 <pre>foo bar
1583 </pre>
1584 <pre>foo
1585 bar
1586 </pre>
1587 <pre>foo
1588 </pre>
1589 <pre>foo
1590 </pre>
1591 <pre>bar
1592 </pre>
1593 !!end
1594
1595 !! test
1596 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1597 !! input
1598 {{echo| }}a
1599
1600 {{echo|
1601 }}a
1602
1603 {{echo|
1604 b}}
1605
1606 {{echo|a
1607 }}b
1608
1609 {{echo|a
1610 }} b
1611 !!result
1612 <pre>a
1613 </pre>
1614 <p><br />
1615 </p>
1616 <pre>a
1617 </pre>
1618 <p><br />
1619 </p>
1620 <pre>b
1621 </pre>
1622 <p>a
1623 </p>
1624 <pre>b
1625 </pre>
1626 <p>a
1627 </p>
1628 <pre>b
1629 </pre>
1630 !!end
1631
1632 #--------------------------------------------------------------------
1633 # Transclusion parameter whitespace stripping tests
1634 # Behavior is different for positional and named parameters
1635 #--------------------------------------------------------------------
1636 !! test
1637 Templates: Strip leading and trailing whitespace from named-param values
1638 !! input
1639 {{echo|1= a }}
1640
1641 {{echo|1= {{echo|b}} }}
1642
1643 {{echo| 1 =
1644 c }}
1645
1646 {{echo| 1 =
1647 * d
1648 }}
1649 !! result
1650 <p>a
1651 </p><p>b
1652 </p><p>c
1653 </p>
1654 <ul><li> d
1655 </li></ul>
1656
1657 !! end
1658
1659 !! test
1660 Templates: Don't strip whitespace from positional-param values
1661 !! options
1662 !! input
1663 {{echo|a }}
1664
1665 {{echo|{{echo|b}} }}
1666
1667 {{echo| c
1668 }}
1669
1670 {{echo| {{echo|d}}
1671 }}
1672
1673 {{echo|
1674 e}}
1675
1676 {{echo|
1677 * f}}
1678
1679 {{echo|
1680 }}g
1681 !! result
1682 <p>a
1683 </p><p>b
1684 </p>
1685 <pre>c
1686 </pre>
1687 <p><br />
1688 </p>
1689 <pre>d
1690 </pre>
1691 <p><br />
1692 </p>
1693 <pre>e
1694 </pre>
1695 <p><br />
1696 </p>
1697 <ul><li> f
1698 </li></ul>
1699 <p><br />
1700 </p>
1701 <pre>g
1702 </pre>
1703 !! end
1704
1705 #--------------------------------------------------------------------
1706 # Transclusion parameter escaping tests
1707 #--------------------------------------------------------------------
1708 !! test
1709 Templates: Parsoid parameter escaping test 1
1710 !! options
1711 parsoid
1712 !! input
1713 {{echo|[foo]|{{echo|[bar]}}}}
1714 !! result
1715 <p about="#mwt1" typeof="mw:Transclusion"
1716 data-mw="{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;[foo]&quot;},&quot;2&quot;:{&quot;wt&quot;:&quot;{{echo|[bar]}}&quot;}},&quot;i&quot;:0}">[foo]</p>
1717 !! end
1718
1719 !! test
1720 Parsoid: Pipes in external links in template parameter
1721 !! options
1722 parsoid
1723 !! input
1724 {{echo|[{{echo|http://example.com}} link]}}
1725 !! result
1726 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw="{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;[{{echo|http://example.com}} link]&quot;}},&quot;i&quot;:0}">link</a></p>
1727 !! end
1728
1729 !! test
1730 Parsoid: pipe in transclusion parameter
1731 !! options
1732 parsoid
1733 !! input
1734 {{echo|http://foo.com/a&#124;b}}
1735 !! result
1736 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1737 typeof="mw:Transclusion"
1738 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a|b"}},"i":0}'>http://foo.com/a|b</a></p>
1739 !! end
1740
1741 !! test
1742 Parsoid: Pipe in external link target and content in template parameter
1743 !! options
1744 parsoid=html2wt,wt2wt
1745 !! input
1746 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1747 !! result
1748 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1749 typeof="mw:Transclusion"
1750 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},
1751 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}'>a|b</a></p>
1752 !! end
1753
1754 !! test
1755 Templates: Dont escape already nowiki-escaped text in template parameters
1756 !! options
1757 parsoid=html2wt,wt2wt
1758 !! input
1759 {{echo|foo<nowiki>|</nowiki>bar}}
1760 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1761 {{echo|<nowiki></nowiki>}}
1762 !! result
1763 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
1764 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
1765 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}'></span>
1766 </p>
1767 !! end
1768
1769 ###
1770 ### Parsoid-centric tests for testing RT edge cases for pre
1771 ###
1772
1773 !!test
1774 1a. Indent-Pre and Comments
1775 !!input
1776 a
1777 <!--a-->
1778 c
1779 !!result
1780 <pre>a
1781 </pre>
1782 <p>c
1783 </p>
1784 !!end
1785
1786 !!test
1787 1b. Indent-Pre and Comments
1788 !!input
1789 a
1790 <!--a-->
1791 c
1792 !!result
1793 <pre>a
1794 </pre>
1795 <p>c
1796 </p>
1797 !!end
1798
1799 !!test
1800 1c. Indent-Pre and Comments
1801 !!input
1802 <!--a--> a
1803
1804 <!--a--> a
1805 !!result
1806 <pre> a
1807 </pre>
1808 <pre> a
1809 </pre>
1810 !!end
1811
1812 !!test
1813 1d. Indent-Pre and Comments
1814 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
1815 !!input
1816 <!--a--> a
1817
1818 <!--b-->b
1819 !!result
1820 <pre>a
1821 </pre>
1822 <pre>b
1823 </pre>
1824 !!end
1825
1826 !!test
1827 2a. Indent-Pre and tables
1828 !!input
1829 {|
1830 |-
1831 !h1!!h2
1832 |foo||bar
1833 |}
1834 !!result
1835 <table>
1836
1837 <tr>
1838 <th>h1</th>
1839 <th>h2
1840 </th>
1841 <td>foo</td>
1842 <td>bar
1843 </td></tr></table>
1844
1845 !!end
1846
1847 !!test
1848 2b. Indent-Pre and tables
1849 !!input
1850 {|
1851 |-
1852 |foo
1853 |}
1854 !!result
1855 <table>
1856
1857 <tr>
1858 <td>foo
1859 </td></tr></table>
1860
1861 !!end
1862
1863 !!test
1864 2c. Indent-Pre and tables (bug 42252)
1865 !!input
1866 {|
1867 |+ foo
1868 ! | bar
1869 |}
1870 !!result
1871 <table>
1872 <caption> foo
1873 </caption>
1874 <tr>
1875 <th> bar
1876 </th></tr></table>
1877
1878 !!end
1879
1880 !!test
1881 3a. Indent-Pre and block tags (single-line html)
1882 !!input
1883 <p> foo </p>
1884 <div> foo </div>
1885 <span> foo </span>
1886 !!result
1887 <p> foo </p>
1888 <div> foo </div>
1889 <pre><span> foo </span>
1890 </pre>
1891 !!end
1892
1893 !!test
1894 3b. Indent-Pre and block tags (pre-content on separate line)
1895 !!input
1896 <p>
1897 foo
1898 </p>
1899
1900 <div>
1901 foo
1902 </div>
1903
1904 <center>
1905 foo
1906 </center>
1907
1908 <blockquote>
1909 foo
1910 </blockquote>
1911
1912 <table><tr><td>
1913 foo
1914 </td></tr></table>
1915
1916 <ul><li>
1917 foo
1918 </li></ul>
1919
1920 !!result
1921 <p>
1922 foo
1923 </p>
1924 <div>
1925 <pre>foo
1926 </pre>
1927 </div>
1928 <center>
1929 <pre>foo
1930 </pre>
1931 </center>
1932 <blockquote>
1933 foo
1934 </blockquote>
1935 <table><tr><td>
1936 <pre>foo
1937 </pre>
1938 </td></tr></table>
1939 <ul><li>
1940 foo
1941 </li></ul>
1942
1943 !!end
1944
1945 !!test
1946 4. Multiple spaces at start-of-line
1947 !!input
1948 <p> foo </p>
1949 foo
1950 {|
1951 |foo
1952 |}
1953 !!result
1954 <p> foo </p>
1955 <pre> foo
1956 </pre>
1957 <table>
1958 <tr>
1959 <td>foo
1960 </td></tr></table>
1961
1962 !!end
1963
1964 !! test
1965 5. White-space in indent-pre
1966 NOTE: the white-space char on 2nd line is significant
1967 !! input
1968 a<br/>
1969
1970 b
1971 !! result
1972 <pre>a<br />
1973
1974 b
1975 </pre>
1976 !! end
1977
1978 !! test
1979 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
1980 !! input
1981 a
1982
1983 <!-- continue -->
1984 b
1985
1986 c
1987
1988 d
1989 !! result
1990 <pre>a
1991
1992 b
1993 </pre>
1994 <pre>c
1995
1996 </pre>
1997 <p>d
1998 </p>
1999 !! end
2000
2001 !! test
2002 7a. Indent-pre and category links
2003 !! options
2004 parsoid=wt2html,wt2wt
2005 !! input
2006 [[Category:foo]] <!-- No pre-wrapping -->
2007 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2008 !! result
2009 <span typeof="mw:Transclusion"> </span>
2010 !! end
2011
2012 !! test
2013 7b. Indent-pre and category links
2014 !! options
2015 parsoid=wt2html,wt2wt
2016 !! input
2017 [[Category:foo]] a
2018 [[Category:foo]] {{echo|b}}
2019 !! result
2020 <pre> a <span typeof="mw:Transclusion">b</span>
2021 </pre>
2022 !! end
2023
2024 ###
2025 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2026 ###
2027
2028 !!test
2029 HTML-pre: 1. embedded newlines
2030 !!input
2031 <pre>foo</pre>
2032
2033 <pre>
2034 foo
2035 </pre>
2036
2037 <pre>
2038
2039 foo
2040 </pre>
2041
2042 <pre>
2043
2044
2045 foo
2046 </pre>
2047 !!result
2048 <pre>foo</pre>
2049 <pre>
2050 foo
2051 </pre>
2052 <pre>
2053
2054 foo
2055 </pre>
2056 <pre>
2057
2058
2059 foo
2060 </pre>
2061
2062 !!end
2063
2064 !!test
2065 HTML-pre: 2: indented text
2066 !!input
2067 <pre>
2068 foo
2069 </pre>
2070 !!result
2071 <pre>
2072 foo
2073 </pre>
2074
2075 !!end
2076
2077 !!test
2078 HTML-pre: 3: other wikitext
2079 !!input
2080 <pre>
2081 * foo
2082 # bar
2083 = no-h =
2084 '' no-italic ''
2085 [[ NoLink ]]
2086 </pre>
2087 !!result
2088 <pre>
2089 * foo
2090 # bar
2091 = no-h =
2092 '' no-italic ''
2093 [[ NoLink ]]
2094 </pre>
2095
2096 !!end
2097
2098 ###
2099 ### Definition lists
2100 ###
2101 !! test
2102 Simple definition
2103 !! input
2104 ; name : Definition
2105 !! result
2106 <dl><dt> name&#160;</dt><dd> Definition
2107 </dd></dl>
2108
2109 !! end
2110
2111 !! test
2112 Definition list for indentation only
2113 !! input
2114 : Indented text
2115 !! result
2116 <dl><dd> Indented text
2117 </dd></dl>
2118
2119 !! end
2120
2121 !! test
2122 Definition list with no space
2123 !! input
2124 ;name:Definition
2125 !! result
2126 <dl><dt>name</dt><dd>Definition
2127 </dd></dl>
2128
2129 !!end
2130
2131 !! test
2132 Definition list with URL link
2133 !! input
2134 ; http://example.com/ : definition
2135 !! result
2136 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
2137 </dd></dl>
2138
2139 !! end
2140
2141 !! test
2142 Definition list with bracketed URL link
2143 !! input
2144 ;[http://www.example.com/ Example]:Something about it
2145 !! result
2146 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
2147 </dd></dl>
2148
2149 !! end
2150
2151 !! test
2152 Definition list with wikilink containing colon
2153 !! input
2154 ; [[Help:FAQ]]: The least-read page on Wikipedia
2155 !! result
2156 <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
2157 </dd></dl>
2158
2159 !! end
2160
2161 # At Brion's and JeLuF's insistence... :)
2162 !! test
2163 Definition list with news link containing colon
2164 !! input
2165 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2166 !! result
2167 <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!
2168 </dd></dl>
2169
2170 !! end
2171
2172 !! test
2173 Malformed definition list with colon
2174 !! input
2175 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2176 !! result
2177 <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
2178 </dt></dl>
2179
2180 !! end
2181
2182 !! test
2183 Definition lists: colon in external link text
2184 !! input
2185 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2186 !! result
2187 <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
2188 </dd></dl>
2189
2190 !! end
2191
2192 !! test
2193 Definition lists: colon in HTML attribute
2194 !! input
2195 ;<b style="display: inline">bold</b>
2196 !! result
2197 <dl><dt><b style="display: inline">bold</b>
2198 </dt></dl>
2199
2200 !! end
2201
2202 !! test
2203 Definition lists: self-closed tag
2204 !! input
2205 ;one<br/>two : two-line fun
2206 !! result
2207 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
2208 </dd></dl>
2209
2210 !! end
2211
2212 !! test
2213 Bug 11748: Literal closing tags
2214 !! input
2215 <dl>
2216 <dt>test 1</dt>
2217 <dd>test test test test test</dd>
2218 <dt>test 2</dt>
2219 <dd>test test test test test</dd>
2220 </dl>
2221 !! result
2222 <dl>
2223 <dt>test 1</dt>
2224 <dd>test test test test test</dd>
2225 <dt>test 2</dt>
2226 <dd>test test test test test</dd>
2227 </dl>
2228
2229 !! end
2230
2231 !! test
2232 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2233 !! input
2234 <ul><li>
2235 ; term : description
2236 * unordered
2237 </li>
2238 </ul>
2239 !! result
2240 <ul><li>
2241 <dl><dt> term&#160;</dt><dd> description
2242 </dd></dl>
2243 <ul><li> unordered
2244 </li></ul>
2245 </li>
2246 </ul>
2247
2248 !! end
2249
2250 !! test
2251
2252 Definition list with empty definition and following paragraph
2253 !! input
2254 ; term:
2255 Paragraph text
2256 !! result
2257 <dl><dt> term</dt><dd>
2258 </dd></dl>
2259 <p>Paragraph text
2260 </p>
2261 !! end
2262
2263 !! test
2264 Nested definition lists using html syntax
2265 !! input
2266 <dl><dd>
2267 <dl>
2268 <dd>Foo</dd>
2269 </dl>
2270 </dd></dl>
2271 !! result
2272 <dl><dd>
2273 <dl>
2274 <dd>Foo</dd>
2275 </dl>
2276 </dd></dl>
2277
2278 !! end
2279
2280 !! test
2281 Definition Lists: No nesting: Multiple dd's
2282 !! input
2283 ;x
2284 :a
2285 :b
2286 !! result
2287 <dl><dt>x
2288 </dt><dd>a
2289 </dd><dd>b
2290 </dd></dl>
2291
2292 !! end
2293
2294 !! test
2295 Definition Lists: Indentation: Regular
2296 !! input
2297 :i1
2298 ::i2
2299 :::i3
2300 !! result
2301 <dl><dd>i1
2302 <dl><dd>i2
2303 <dl><dd>i3
2304 </dd></dl>
2305 </dd></dl>
2306 </dd></dl>
2307
2308 !! end
2309
2310 !! test
2311 Definition Lists: Indentation: Missing 1st level
2312 !! input
2313 ::i2
2314 :::i3
2315 !! result
2316 <dl><dd><dl><dd>i2
2317 <dl><dd>i3
2318 </dd></dl>
2319 </dd></dl>
2320 </dd></dl>
2321
2322 !! end
2323
2324 !! test
2325 Definition Lists: Indentation: Multi-level indent
2326 !! input
2327 :::i3
2328 !! result
2329 <dl><dd><dl><dd><dl><dd>i3
2330 </dd></dl>
2331 </dd></dl>
2332 </dd></dl>
2333
2334 !! end
2335
2336 !! test
2337 Definition Lists: Hacky use to indent tables
2338 !! input
2339 ::{|
2340 |foo
2341 |bar
2342 |}
2343 this text
2344 should be left alone
2345 !! result
2346 <dl><dd><dl><dd><table>
2347 <tr>
2348 <td>foo
2349 </td>
2350 <td>bar
2351 </td></tr></table></dd></dl></dd></dl>
2352 <p>this text
2353 should be left alone
2354 </p>
2355 !! end
2356
2357 # Bug 52473
2358 !! test
2359 Definition Lists: Hacky use to indent tables (WS-insensitive)
2360 !! options
2361 parsoid
2362 !! input
2363 : {|
2364 |a
2365 |}
2366 !! result
2367 <dl><dd> <table><tr><td>a</td></tr></table> </dd></dl>
2368 !! end
2369 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2370 ## as an empty dt item. It also ignores all but the last ";" when followed
2371 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2372 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2373 ## ";"s.
2374 ##
2375 ## Ex: ";;t2 ::d2" is transformed into:
2376 ##
2377 ## <dl>
2378 ## <dt>t2 </dt>
2379 ## <dd>
2380 ## <dl>
2381 ## <dt></dt>
2382 ## <dd>d2</dd>
2383 ## </dl>
2384 ## </dd>
2385 ## </dl>
2386 ##
2387 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2388 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2389 ##
2390 ## <dl>
2391 ## <dt>
2392 ## <dl>
2393 ## <dt>t2 </dt>
2394 ## <dd>:d2</dd>
2395 ## </dl>
2396 ## </dt>
2397 ## </dl>
2398 ##
2399 ## All Parsoid only definition list tests have this difference.
2400 ##
2401 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2402 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2403
2404 !! test
2405 Table / list interaction: indented table with lists in table contents
2406 !! input
2407 :{|
2408 |-
2409 | a
2410 * b
2411 |-
2412 | c
2413 * d
2414 |}
2415 !! result
2416 <dl><dd><table>
2417
2418 <tr>
2419 <td> a
2420 <ul><li> b
2421 </li></ul>
2422 </td></tr>
2423 <tr>
2424 <td> c
2425 <ul><li> d
2426 </li></ul>
2427 </td></tr></table></dd></dl>
2428
2429 !! end
2430
2431 !!test
2432 Table / list interaction: lists nested in tables nested in indented lists
2433 !!input
2434 :{|
2435 |
2436 :a
2437 :b
2438 |
2439 *c
2440 *d
2441 |}
2442
2443 *e
2444 *f
2445 !!result
2446 <dl><dd><table>
2447 <tr>
2448 <td>
2449 <dl><dd>a
2450 </dd><dd>b
2451 </dd></dl>
2452 </td>
2453 <td>
2454 <ul><li>c
2455 </li><li>d
2456 </li></ul>
2457 </td></tr></table></dd></dl>
2458 <ul><li>e
2459 </li><li>f
2460 </li></ul>
2461
2462 !!end
2463
2464 !! test
2465 Definition Lists: Nesting: Multi-level (Parsoid only)
2466 !! options
2467 parsoid
2468 !! input
2469 ;t1 :d1
2470 ;;t2 ::d2
2471 ;;;t3 :::d3
2472 !! result
2473 <dl>
2474 <dt>t1 </dt>
2475 <dd>d1</dd>
2476 <dt>
2477 <dl>
2478 <dt>t2 </dt>
2479 <dd>:d2</dd>
2480 <dt>
2481 <dl>
2482 <dt>t3 </dt>
2483 <dd>::d3</dd>
2484 </dl>
2485 </dt>
2486 </dl>
2487 </dt>
2488 </dl>
2489
2490
2491 !! end
2492
2493
2494 !! test
2495 Definition Lists: Nesting: Test 2 (Parsoid only)
2496 !! options
2497 parsoid
2498 !! input
2499 ;t1
2500 ::d2
2501 !! result
2502 <dl>
2503 <dt>t1</dt>
2504 <dd>
2505 <dl>
2506 <dd>d2</dd>
2507 </dl>
2508 </dd>
2509 </dl>
2510
2511 !! end
2512
2513
2514 !! test
2515 Definition Lists: Nesting: Test 3 (Parsoid only)
2516 !! options
2517 parsoid
2518 !! input
2519 :;t1
2520 ::::d2
2521 !! result
2522 <dl>
2523 <dd>
2524 <dl>
2525 <dt>t1</dt>
2526 <dd>
2527 <dl>
2528 <dd>
2529 <dl>
2530 <dd>d2</dd>
2531 </dl>
2532 </dd>
2533 </dl>
2534 </dd>
2535 </dl>
2536 </dd>
2537 </dl>
2538
2539 !! end
2540
2541
2542 !! test
2543 Definition Lists: Nesting: Test 4
2544 !! input
2545 ::;t3
2546 :::d3
2547 !! result
2548 <dl><dd><dl><dd><dl><dt>t3
2549 </dt><dd>d3
2550 </dd></dl>
2551 </dd></dl>
2552 </dd></dl>
2553
2554 !! end
2555
2556
2557 ## The Parsoid team believes the following three test exposes a
2558 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2559 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2560 !! test
2561 Definition Lists: Mixed Lists: Test 1 (php)
2562 !! options
2563 php
2564 !! input
2565 :;* foo
2566 ::* bar
2567 :; baz
2568 !! result
2569 <dl><dd><dl><dt><ul><li> foo
2570 </li><li> bar
2571 </li></ul>
2572 </dt></dl>
2573 <dl><dt> baz
2574 </dt></dl>
2575 </dd></dl>
2576
2577 !! end
2578 !! test
2579 Definition Lists: Mixed Lists: Test 1 (parsoid)
2580 !! options
2581 parsoid
2582 !! input
2583 :;* foo
2584 ::* bar
2585 :; baz
2586 !! result
2587 <dl><dd><dl><dt><ul><li> foo
2588 </li></ul></dt><dd><ul><li> bar
2589 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2590 !! end
2591
2592 !! test
2593 Definition Lists: Mixed Lists: Test 2
2594 !! input
2595 *: d1
2596 *: d2
2597 !! result
2598 <ul><li><dl><dd> d1
2599 </dd><dd> d2
2600 </dd></dl>
2601 </li></ul>
2602
2603 !! end
2604
2605
2606 !! test
2607 Definition Lists: Mixed Lists: Test 3
2608 !! input
2609 *::: d1
2610 *::: d2
2611 !! result
2612 <ul><li><dl><dd><dl><dd><dl><dd> d1
2613 </dd><dd> d2
2614 </dd></dl>
2615 </dd></dl>
2616 </dd></dl>
2617 </li></ul>
2618
2619 !! end
2620
2621
2622 !! test
2623 Definition Lists: Mixed Lists: Test 4
2624 !! input
2625 *;d1 :d2
2626 *;d3 :d4
2627 !! result
2628 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2629 </dd><dt>d3&#160;</dt><dd>d4
2630 </dd></dl>
2631 </li></ul>
2632
2633 !! end
2634
2635
2636 !! test
2637 Definition Lists: Mixed Lists: Test 5
2638 !! input
2639 *:d1
2640 *:: d2
2641 !! result
2642 <ul><li><dl><dd>d1
2643 <dl><dd> d2
2644 </dd></dl>
2645 </dd></dl>
2646 </li></ul>
2647
2648 !! end
2649
2650
2651 !! test
2652 Definition Lists: Mixed Lists: Test 6
2653 !! input
2654 #*:d1
2655 #*::: d3
2656 !! result
2657 <ol><li><ul><li><dl><dd>d1
2658 <dl><dd><dl><dd> d3
2659 </dd></dl>
2660 </dd></dl>
2661 </dd></dl>
2662 </li></ul>
2663 </li></ol>
2664
2665 !! end
2666
2667
2668 !! test
2669 Definition Lists: Mixed Lists: Test 7
2670 !! input
2671 :* d1
2672 :* d2
2673 !! result
2674 <dl><dd><ul><li> d1
2675 </li><li> d2
2676 </li></ul>
2677 </dd></dl>
2678
2679 !! end
2680
2681
2682 !! test
2683 Definition Lists: Mixed Lists: Test 8
2684 !! input
2685 :* d1
2686 ::* d2
2687 !! result
2688 <dl><dd><ul><li> d1
2689 </li></ul>
2690 <dl><dd><ul><li> d2
2691 </li></ul>
2692 </dd></dl>
2693 </dd></dl>
2694
2695 !! end
2696
2697
2698 !! test
2699 Definition Lists: Mixed Lists: Test 9
2700 !! input
2701 *;foo :bar
2702 !! result
2703 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2704 </dd></dl>
2705 </li></ul>
2706
2707 !! end
2708
2709
2710 !! test
2711 Definition Lists: Mixed Lists: Test 10
2712 !! input
2713 *#;foo :bar
2714 !! result
2715 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2716 </dd></dl>
2717 </li></ol>
2718 </li></ul>
2719
2720 !! end
2721
2722 # The Parsoid team disagrees with the PHP parser's seemingly-random
2723 # rules regarding dd/dt on the next two tests. Parsoid is more
2724 # consistent, and recognizes the shared nesting and keeps the
2725 # still-open tags around until the nesting is complete.
2726
2727 !! test
2728 Definition Lists: Mixed Lists: Test 11 (php)
2729 !! options
2730 php
2731 !! input
2732 *#*#;*;;foo :bar
2733 *#*#;boo :baz
2734 !! result
2735 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2736 </dt></dl>
2737 </dd></dl>
2738 </li></ul>
2739 </dd></dl>
2740 <dl><dt>boo&#160;</dt><dd>baz
2741 </dd></dl>
2742 </li></ol>
2743 </li></ul>
2744 </li></ol>
2745 </li></ul>
2746
2747 !! end
2748 !! test
2749 Definition Lists: Mixed Lists: Test 11 (parsoid)
2750 !! options
2751 parsoid
2752 !! input
2753 *#*#;*;;foo :bar
2754 *#*#;boo :baz
2755 !! result
2756 <ul>
2757 <li>
2758 <ol>
2759 <li>
2760 <ul>
2761 <li>
2762 <ol>
2763 <li>
2764 <dl>
2765 <dt>
2766 <ul>
2767 <li>
2768 <dl>
2769 <dt>
2770 <dl>
2771 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2772 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2773 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2774 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2775 !! end
2776
2777
2778 !! test
2779 Definition Lists: Weird Ones: Test 1 (php)
2780 !! options
2781 php
2782 !! input
2783 *#;*::;; foo : bar (who uses this?)
2784 !! result
2785 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2786 </dt></dl>
2787 </dd></dl>
2788 </dd></dl>
2789 </dd></dl>
2790 </li></ul>
2791 </dd></dl>
2792 </li></ol>
2793 </li></ul>
2794
2795 !! end
2796 !! test
2797 Definition Lists: Weird Ones: Test 1 (parsoid)
2798 !! options
2799 parsoid
2800 !! input
2801 *#;*::;; foo : bar (who uses this?)
2802 !! result
2803 <ul>
2804 <li>
2805 <ol>
2806 <li>
2807 <dl>
2808 <dt>
2809 <ul>
2810 <li>
2811 <dl>
2812 <dd>
2813 <dl>
2814 <dd>
2815 <dl>
2816 <dt>
2817 <dl>
2818 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2819 <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>
2820 !! end
2821
2822 ###
2823 ### External links
2824 ###
2825 !! test
2826 External links: non-bracketed
2827 !! input
2828 Non-bracketed: http://example.com
2829 !! result
2830 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2831 </p>
2832 !! end
2833
2834 !! test
2835 External links: numbered
2836 !! input
2837 Numbered: [http://example.com]
2838 Numbered: [http://example.net]
2839 Numbered: [http://example.com]
2840 !! result
2841 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2842 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2843 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2844 </p>
2845 !!end
2846
2847 !! test
2848 External links: specified text
2849 !! input
2850 Specified text: [http://example.com link]
2851 !! result
2852 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2853 </p>
2854 !!end
2855
2856 !! test
2857 External links: trail
2858 !! input
2859 Linktrails should not work for external links: [http://example.com link]s
2860 !! result
2861 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2862 </p>
2863 !! end
2864
2865 !! test
2866 External links: dollar sign in URL
2867 !! input
2868 http://example.com/1$2345
2869 !! result
2870 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2871 </p>
2872 !! end
2873
2874 !! test
2875 External links: dollar sign in URL (named)
2876 !! input
2877 [http://example.com/1$2345]
2878 !! result
2879 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2880 </p>
2881 !!end
2882
2883 !! test
2884 External links: open square bracket forbidden in URL (bug 4377)
2885 !! input
2886 http://example.com/1[2345
2887 !! result
2888 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2889 </p>
2890 !! end
2891
2892 !! test
2893 External links: open square bracket forbidden in URL (named) (bug 4377)
2894 !! input
2895 [http://example.com/1[2345]
2896 !! result
2897 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2898 </p>
2899 !!end
2900
2901 !! test
2902 External links: nowiki in URL link text (bug 6230)
2903 !!input
2904 [http://example.com/ <nowiki>''example site''</nowiki>]
2905 !! result
2906 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2907 </p>
2908 !! end
2909
2910 !! test
2911 External links: newline forbidden in text (bug 6230 regression check)
2912 !! input
2913 [http://example.com/ first
2914 second]
2915 !! result
2916 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2917 second]
2918 </p>
2919 !!end
2920
2921 !! test
2922 External links: Pipe char between url and text
2923 !! input
2924 [http://example.com | link]
2925 !! result
2926 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2927 </p>
2928 !!end
2929
2930 !! test
2931 External links: protocol-relative URL in brackets
2932 !! input
2933 [//example.com/ Test]
2934 !! result
2935 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2936 </p>
2937 !! end
2938
2939 !! test
2940 External links: protocol-relative URL in brackets without text
2941 !! input
2942 [//example.com]
2943 !! result
2944 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2945 </p>
2946 !! end
2947
2948 !! test
2949 External links: protocol-relative URL in free text is left alone
2950 !! input
2951 //example.com/Foo
2952 !! result
2953 <p>//example.com/Foo
2954 </p>
2955 !!end
2956
2957 !! test
2958 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2959 !! input
2960 foo//example.com/Foo
2961 !! result
2962 <p>foo//example.com/Foo
2963 </p>
2964 !! end
2965
2966 !! test
2967 External image
2968 !! input
2969 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2970 !! result
2971 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2972 </p>
2973 !! end
2974
2975 !! test
2976 External image from https
2977 !! input
2978 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2979 !! result
2980 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2981 </p>
2982 !! end
2983
2984 !! test
2985 External image (when not allowed)
2986 !! options
2987 wgAllowExternalImages=0
2988 !! input
2989 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2990 !! result
2991 <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>
2992 </p>
2993 !! end
2994
2995 !! test
2996 Link to non-http image, no img tag
2997 !! input
2998 Link to non-http image, no img tag: ftp://example.com/test.jpg
2999 !! result
3000 <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>
3001 </p>
3002 !! end
3003
3004 !! test
3005 External links: terminating separator
3006 !! input
3007 Terminating separator: http://example.com/thing,
3008 !! result
3009 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3010 </p>
3011 !! end
3012
3013 !! test
3014 External links: intervening separator
3015 !! input
3016 Intervening separator: http://example.com/1,2,3
3017 !! result
3018 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3019 </p>
3020 !! end
3021
3022 !! test
3023 External links: old bug with URL in query
3024 !! input
3025 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3026 !! result
3027 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3028 </p>
3029 !! end
3030
3031 !! test
3032 External links: old URL-in-URL bug, mixed protocols
3033 !! input
3034 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3035 !! result
3036 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3037 </p>
3038 !!end
3039
3040 !! test
3041 External links: URL in text
3042 !! input
3043 URL in text: [http://example.com http://example.com]
3044 !! result
3045 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3046 </p>
3047 !! end
3048
3049 !! test
3050 External links: Clickable images
3051 !! input
3052 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3053 !! result
3054 <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>
3055 </p>
3056 !!end
3057
3058 !! test
3059 External links: raw ampersand
3060 !! input
3061 Old &amp; use: http://x&y
3062 !! result
3063 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3064 </p>
3065 !! end
3066
3067 !! test
3068 External links: encoded ampersand
3069 !! input
3070 Old &amp; use: http://x&amp;y
3071 !! result
3072 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3073 </p>
3074 !! end
3075
3076 !! test
3077 External links: encoded equals (bug 6102)
3078 !! input
3079 http://example.com/?foo&#61;bar
3080 !! result
3081 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3082 </p>
3083 !! end
3084
3085 !! test
3086 External links: [raw ampersand]
3087 !! input
3088 Old &amp; use: [http://x&y]
3089 !! result
3090 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3091 </p>
3092 !! end
3093
3094 !! test
3095 External links: [encoded ampersand]
3096 !! input
3097 Old &amp; use: [http://x&amp;y]
3098 !! result
3099 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3100 </p>
3101 !! end
3102
3103 !! test
3104 External links: [encoded equals] (bug 6102)
3105 !! input
3106 [http://example.com/?foo&#61;bar]
3107 !! result
3108 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3109 </p>
3110 !! end
3111
3112 !! test
3113 External links: [IDN ignored character reference in hostname; strip it right off]
3114 !! input
3115 [http://e&zwnj;xample.com/]
3116 !! result
3117 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3118 </p>
3119 !! end
3120
3121 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3122 # Where an external link could easily circumvent the sanitization of the text of
3123 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3124 # test demands a higher standard. That's a bit strange.
3125 #
3126 # Example:
3127 #
3128 # http://e‌xample.com -> [http://example.com|http://example.com]
3129 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3130 #
3131 # The first example is sanitized, but the second is not. Any security benefits
3132 # from this production are trivial to circumvent. Either remove this test and
3133 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3134 # the test accordingly.
3135 #
3136 # All our love,
3137 # The Parsoid team.
3138 !! test
3139 External links: IDN ignored character reference in hostname; strip it right off
3140 !! input
3141 http://e&zwnj;xample.com/
3142 !! result
3143 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3144 </p>
3145 !! end
3146
3147 !! test
3148 External links: www.jpeg.org (bug 554)
3149 !! input
3150 http://www.jpeg.org
3151 !!result
3152 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3153 </p>
3154 !! end
3155
3156 !! test
3157 External links: URL within URL (original bug 2)
3158 !! input
3159 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3160 !! result
3161 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3162 </p>
3163 !! end
3164
3165 !! test
3166 BUG 361: URL inside bracketed URL
3167 !! input
3168 [http://www.example.com/foo http://www.example.com/bar]
3169 !! result
3170 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3171 </p>
3172 !! end
3173
3174 !! test
3175 BUG 361: URL within URL, not bracketed
3176 !! input
3177 http://www.example.com/foo?=http://www.example.com/bar
3178 !! result
3179 <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>
3180 </p>
3181 !! end
3182
3183 !! test
3184 BUG 289: ">"-token in URL-tail
3185 !! input
3186 http://www.example.com/<hello>
3187 !! result
3188 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3189 </p>
3190 !!end
3191
3192 !! test
3193 BUG 289: literal ">"-token in URL-tail
3194 !! input
3195 http://www.example.com/<b>html</b>
3196 !! result
3197 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3198 </p>
3199 !!end
3200
3201 !! test
3202 BUG 289: ">"-token in bracketed URL
3203 !! input
3204 [http://www.example.com/<hello> stuff]
3205 !! result
3206 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3207 </p>
3208 !!end
3209
3210 !! test
3211 BUG 289: literal ">"-token in bracketed URL
3212 !! input
3213 [http://www.example.com/<b>html</b> stuff]
3214 !! result
3215 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3216 </p>
3217 !!end
3218
3219 !! test
3220 BUG 289: literal double quote at end of URL
3221 !! input
3222 http://www.example.com/"hello"
3223 !! result
3224 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3225 </p>
3226 !!end
3227
3228 !! test
3229 BUG 289: literal double quote in bracketed URL
3230 !! input
3231 [http://www.example.com/"hello" stuff]
3232 !! result
3233 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3234 </p>
3235 !!end
3236
3237 !! test
3238 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3239 !! input
3240 [http://www.example.com test]
3241 !! result
3242 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3243 </p>
3244 !! end
3245
3246 !! test
3247 External links: link text with spaces
3248 !! input
3249 [http://www.example.com a b c]
3250 [http://www.example.com ''a'' ''b'']
3251 !! result
3252 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3253 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3254 </p>
3255 !! end
3256
3257 !! test
3258 External links: wiki links within external link (Bug 3695)
3259 !! input
3260 [http://example.com [[wikilink]] embedded in ext link]
3261 !! result
3262 <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>
3263 </p>
3264 !! end
3265
3266 !! test
3267 BUG 787: Links with one slash after the url protocol are invalid
3268 !! input
3269 http:/example.com
3270
3271 [http:/example.com title]
3272 !! result
3273 <p>http:/example.com
3274 </p><p>[http:/example.com title]
3275 </p>
3276 !! end
3277
3278 !! test
3279 Bracketed external links with template-generated invalid target
3280 !! input
3281 [{{echo|http:/example.com}} title]
3282 !! result
3283 <p>[http:/example.com title]
3284 </p>
3285 !! end
3286
3287 !! test
3288 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3289 !! input
3290 ''[http://example.com text'']
3291 [http://example.com '''text]'''
3292 ''Something [http://example.com in italic'']
3293 ''Something [http://example.com mixed''''', even bold]'''
3294 '''''Now [http://example.com both''''']
3295 !! result
3296 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3297 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3298 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3299 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3300 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3301 </p>
3302 !! end
3303
3304
3305 !! test
3306 Bug 4781: %26 in URL
3307 !! input
3308 http://www.example.com/?title=AT%26T
3309 !! result
3310 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3311 </p>
3312 !! end
3313
3314 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3315 # % is actually legal in HTML5. Any change in output would need testing though.
3316 !! test
3317 Bug 4781, 5267: %25 in URL
3318 !! input
3319 http://www.example.com/?title=100%25_Bran
3320 !! result
3321 <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>
3322 </p>
3323 !! end
3324
3325 !! test
3326 Bug 4781, 5267: %28, %29 in URL
3327 !! input
3328 http://www.example.com/?title=Ben-Hur_%281959_film%29
3329 !! result
3330 <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>
3331 </p>
3332 !! end
3333
3334
3335 !! test
3336 Bug 4781: %26 in autonumber URL
3337 !! input
3338 [http://www.example.com/?title=AT%26T]
3339 !! result
3340 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3341 </p>
3342 !! end
3343
3344 !! test
3345 Bug 4781, 5267: %26 in autonumber URL
3346 !! input
3347 [http://www.example.com/?title=100%25_Bran]
3348 !! result
3349 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3350 </p>
3351 !! end
3352
3353 !! test
3354 Bug 4781, 5267: %28, %29 in autonumber URL
3355 !! input
3356 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3357 !! result
3358 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3359 </p>
3360 !! end
3361
3362
3363 !! test
3364 Bug 4781: %26 in bracketed URL
3365 !! input
3366 [http://www.example.com/?title=AT%26T link]
3367 !! result
3368 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3369 </p>
3370 !! end
3371
3372 !! test
3373 Bug 4781, 5267: %26 in bracketed URL
3374 !! input
3375 [http://www.example.com/?title=100%25_Bran link]
3376 !! result
3377 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3378 </p>
3379 !! end
3380
3381 !! test
3382 Bug 4781, 5267: %28, %29 in bracketed URL
3383 !! input
3384 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3385 !! result
3386 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3387 </p>
3388 !! end
3389
3390 !! test
3391 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3392 !! input
3393 Some [http://example.com/ pretty ''italics'' and stuff]!
3394 !! result
3395 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3396 </p>
3397 !! end
3398
3399 !! test
3400 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3401 !! input
3402 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3403 !! result
3404 <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>
3405 </p>
3406 !! end
3407
3408 !! test
3409 External link containing double-single-quotes with no space separating the url from text in italics
3410 !! input
3411 [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]].]
3412 !! result
3413 <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>
3414 </p>
3415 !! end
3416
3417 !! test
3418 External link with comments in link text
3419 !! input
3420 [http://www.google.com Google <!-- comment -->]
3421 !! result
3422 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3423 </p>
3424 !! end
3425
3426 !! test
3427 URL-encoding in URL functions (single parameter)
3428 !! input
3429 {{localurl:Some page|amp=&}}
3430 !! result
3431 <p>/index.php?title=Some_page&amp;amp=&amp;
3432 </p>
3433 !! end
3434
3435 !! test
3436 URL-encoding in URL functions (multiple parameters)
3437 !! input
3438 {{localurl:Some page|q=?&amp=&}}
3439 !! result
3440 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3441 </p>
3442 !! end
3443
3444 !! test
3445 Brackets in urls
3446 !! input
3447 http://example.com/index.php?foozoid%5B%5D=bar
3448
3449 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3450 !! result
3451 <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>
3452 </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>
3453 </p>
3454 !! end
3455
3456 !! test
3457 IPv6 urls (bug 21261)
3458 !! options
3459 disabled
3460 !! input
3461 http://[2404:130:0:1000::187:2]/index.php
3462 !! result
3463 <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>
3464 </p>
3465 !! end
3466
3467 !! test
3468 Non-extlinks in brackets
3469 !! input
3470 [foo]
3471 [foo bar]
3472 [foo ''bar'']
3473 [fool's] errand
3474 [fool's errand]
3475 [{{echo|foo}}]
3476 [{{echo|foo}} bar]
3477 [{{echo|foo}} ''bar'']
3478 [{{echo|foo}}l's] errand
3479 [{{echo|foo}}l's errand]
3480 [url={{echo|foo}}]
3481 [url=http://example.com]
3482 !! result
3483 <p>[foo]
3484 [foo bar]
3485 [foo <i>bar</i>]
3486 [fool's] errand
3487 [fool's errand]
3488 [foo]
3489 [foo bar]
3490 [foo <i>bar</i>]
3491 [fool's] errand
3492 [fool's errand]
3493 [url=foo]
3494 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3495 </p>
3496 !! end
3497
3498 !! test
3499 Parsoid: Percent encoding in external links
3500 !! options
3501 parsoid
3502 !! input
3503 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3504 !! result
3505 <p><a rel="mw:ExtLink"
3506 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3507 !! end
3508
3509 !! test
3510 Parsoid: use url link syntax for links where the content is equal the link
3511 target
3512 !! options
3513 parsoid
3514 !! input
3515 http://example.com
3516 !! result
3517 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3518 !! end
3519
3520 ###
3521 ### Quotes
3522 ###
3523
3524 !! test
3525 Quotes
3526 !! input
3527 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3528
3529 Normal text. '''''Bold italic text.''''' Normal text.
3530 !!result
3531 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3532 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3533 </p>
3534 !! end
3535
3536
3537 !! test
3538 Unclosed and unmatched quotes (php)
3539 !! options
3540 php
3541 !! input
3542 '''''Bold italic text '''with bold deactivated''' in between.'''''
3543
3544 '''''Bold italic text ''with italic deactivated'' in between.'''''
3545
3546 '''Bold text..
3547
3548 ..spanning two paragraphs (should not work).'''
3549
3550 '''Bold tag left open
3551
3552 ''Italic tag left open
3553
3554 Normal text.
3555
3556 <!-- Unmatching number of opening, closing tags: -->
3557 '''This year''''s election ''should'' beat '''last year''''s.
3558
3559 ''Tom'''s car is bigger than ''Susan'''s.
3560
3561 Plain ''italic'''s plain
3562 !! result
3563 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3564 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3565 </p><p><b>Bold text..</b>
3566 </p><p>..spanning two paragraphs (should not work).
3567 </p><p><b>Bold tag left open</b>
3568 </p><p><i>Italic tag left open</i>
3569 </p><p>Normal text.
3570 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3571 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3572 </p><p>Plain <i>italic'</i>s plain
3573 </p>
3574 !! end
3575 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3576 # parser strips. The wikitext contains just the first half of the bold
3577 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3578 # differently than the PHP parser.)
3579 !! test
3580 Unclosed and unmatched quotes (parsoid)
3581 !! options
3582 parsoid
3583 !! input
3584 '''''Bold italic text '''with bold deactivated''' in between.'''''
3585
3586 '''''Bold italic text ''with italic deactivated'' in between.'''''
3587
3588 '''Bold text..
3589
3590 ..spanning two paragraphs (should not work).'''
3591
3592 '''Bold tag left open
3593
3594 ''Italic tag left open
3595
3596 Normal text.
3597
3598 <!-- Unmatching number of opening, closing tags: -->
3599 '''This year''''s election ''should'' beat '''last year''''s.
3600
3601 ''Tom'''s car is bigger than ''Susan'''s.
3602
3603 Plain ''italic'''s plain
3604 !! result
3605 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3606 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3607 </p><p><b>Bold text..</b>
3608 </p><p>..spanning two paragraphs (should not work).<b></b>
3609 </p><p><b>Bold tag left open</b>
3610 </p><p><i>Italic tag left open</i>
3611 </p><p>Normal text.
3612 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3613 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3614 </p><p>Plain <i>italic'</i>s plain
3615 </p>
3616 !! end
3617
3618 ###
3619 ### Tables
3620 ###
3621 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3622 ###
3623
3624 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3625 # is the bare minimum required by the spec, see:
3626 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3627 !! test
3628 A table with no data. (php)
3629 !! options
3630 php
3631 !! input
3632 {||}
3633 !! result
3634 !! end
3635 # Parsoid team replies: empty table tags are legal in HTML5
3636 !! test
3637 A table with no data. (parsoid)
3638 !! options
3639 parsoid
3640 !! input
3641 {||}
3642 !! result
3643 <table></table>
3644 !! end
3645
3646 # A table with nothing but a caption is invalid XHTML, we might want to render
3647 # this as <p>caption</p>
3648 !! test
3649 A table with nothing but a caption (php)
3650 !! options
3651 php
3652 !! input
3653 {|
3654 |+ caption
3655 |}
3656 !! result
3657 <table>
3658 <caption> caption
3659 </caption><tr><td></td></tr></table>
3660
3661 !! end
3662 # Parsoid team replies: table with only a caption is legal in HTML5
3663 !! test
3664 A table with nothing but a caption (parsoid)
3665 !! options
3666 parsoid
3667 !! input
3668 {|
3669 |+ caption
3670 |}
3671 !! result
3672 <table><caption> caption</caption></table>
3673 !! end
3674
3675 !! test
3676 A table with caption with default-spaced attributes and a table row
3677 !! input
3678 {|
3679 |+ style="color: red;" | caption1
3680 |-
3681 | foo
3682 |}
3683 !! result
3684 <table>
3685 <caption style="color: red;"> caption1
3686 </caption>
3687 <tr>
3688 <td> foo
3689 </td></tr></table>
3690
3691 !! end
3692
3693 !! test
3694 A table with captions with non-default spaced attributes and a table row
3695 !! input
3696 {|
3697 |+style="color: red;"|caption2
3698 |+ style="color: red;"| caption3
3699 |-
3700 | foo
3701 |}
3702 !! result
3703 <table>
3704 <caption style="color: red;">caption2
3705 </caption>
3706 <caption style="color: red;"> caption3
3707 </caption>
3708 <tr>
3709 <td> foo
3710 </td></tr></table>
3711
3712 !! end
3713
3714 !! test
3715 Table td-cell syntax variations
3716 !! input
3717 {|
3718 | foo bar foo | baz
3719 | foo bar foo || baz
3720 | style='color:red;' | baz
3721 | style='color:red;' || baz
3722 |}
3723 !! result
3724 <table>
3725 <tr>
3726 <td> baz
3727 </td>
3728 <td> foo bar foo </td>
3729 <td> baz
3730 </td>
3731 <td style="color:red;"> baz
3732 </td>
3733 <td> style='color:red;' </td>
3734 <td> baz
3735 </td></tr></table>
3736
3737 !! end
3738
3739 !! test
3740 Simple table
3741 !! input
3742 {|
3743 | 1 || 2
3744 |-
3745 | 3 || 4
3746 |}
3747 !! result
3748 <table>
3749 <tr>
3750 <td> 1 </td>
3751 <td> 2
3752 </td></tr>
3753 <tr>
3754 <td> 3 </td>
3755 <td> 4
3756 </td></tr></table>
3757
3758 !! end
3759
3760 !! test
3761 Simple table but with multiple dashes for row wikitext
3762 !! input
3763 {|
3764 | foo
3765 |-----
3766 | bar
3767 |}
3768 !! result
3769 <table>
3770 <tr>
3771 <td> foo
3772 </td></tr>
3773 <tr>
3774 <td> bar
3775 </td></tr></table>
3776
3777 !! end
3778 !! test
3779 Multiplication table
3780 !! input
3781 {| border="1" cellpadding="2"
3782 |+Multiplication table
3783 |-
3784 ! &times; !! 1 !! 2 !! 3
3785 |-
3786 ! 1
3787 | 1 || 2 || 3
3788 |-
3789 ! 2
3790 | 2 || 4 || 6
3791 |-
3792 ! 3
3793 | 3 || 6 || 9
3794 |-
3795 ! 4
3796 | 4 || 8 || 12
3797 |-
3798 ! 5
3799 | 5 || 10 || 15
3800 |}
3801 !! result
3802 <table border="1" cellpadding="2">
3803 <caption>Multiplication table
3804 </caption>
3805 <tr>
3806 <th> &#215; </th>
3807 <th> 1 </th>
3808 <th> 2 </th>
3809 <th> 3
3810 </th></tr>
3811 <tr>
3812 <th> 1
3813 </th>
3814 <td> 1 </td>
3815 <td> 2 </td>
3816 <td> 3
3817 </td></tr>
3818 <tr>
3819 <th> 2
3820 </th>
3821 <td> 2 </td>
3822 <td> 4 </td>
3823 <td> 6
3824 </td></tr>
3825 <tr>
3826 <th> 3
3827 </th>
3828 <td> 3 </td>
3829 <td> 6 </td>
3830 <td> 9
3831 </td></tr>
3832 <tr>
3833 <th> 4
3834 </th>
3835 <td> 4 </td>
3836 <td> 8 </td>
3837 <td> 12
3838 </td></tr>
3839 <tr>
3840 <th> 5
3841 </th>
3842 <td> 5 </td>
3843 <td> 10 </td>
3844 <td> 15
3845 </td></tr></table>
3846
3847 !! end
3848
3849 !! test
3850 Accept "||" in table headings
3851 !! input
3852 {|
3853 !h1 || h2
3854 |}
3855 !! result
3856 <table>
3857 <tr>
3858 <th>h1 </th>
3859 <th> h2
3860 </th></tr></table>
3861
3862 !! end
3863
3864 !! test
3865 Accept "||" in indented table headings
3866 !! input
3867 :{|
3868 !h1 || h2
3869 |}
3870 !! result
3871 <dl><dd><table>
3872 <tr>
3873 <th>h1 </th>
3874 <th> h2
3875 </th></tr></table></dd></dl>
3876
3877 !! end
3878
3879 !! test
3880 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3881 !! input
3882 {|
3883 !| h1
3884 || a
3885 |}
3886 !! result
3887 <table>
3888 <tr>
3889 <th> h1
3890 </th>
3891 <td> a
3892 </td></tr></table>
3893
3894 !! end
3895
3896 !!test
3897 Accept "| !" at start of line in tables (ignore !-attribute)
3898 !!input
3899 {|
3900 |-
3901 | !style="color:red" | bar
3902 |}
3903 !!result
3904 <table>
3905
3906 <tr>
3907 <td> bar
3908 </td></tr></table>
3909
3910 !!end
3911
3912 !!test
3913 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 +/-
3914 !!input
3915 {|
3916 |-
3917 |style='color:red;'|+1
3918 |style='color:blue;'|-1
3919 |-
3920 | 1 || 2 || 3
3921 | 1 ||+2 ||-3
3922 |-
3923 | +1
3924 | -1
3925 |}
3926 !!result
3927 <table>
3928
3929 <tr>
3930 <td style="color:red;">+1
3931 </td>
3932 <td style="color:blue;">-1
3933 </td></tr>
3934 <tr>
3935 <td> 1 </td>
3936 <td> 2 </td>
3937 <td> 3
3938 </td>
3939 <td> 1 </td>
3940 <td>+2 </td>
3941 <td>-3
3942 </td></tr>
3943 <tr>
3944 <td> +1
3945 </td>
3946 <td> -1
3947 </td></tr></table>
3948
3949 !!end
3950
3951 !! test
3952 Table rowspan
3953 !! input
3954 {| border=1
3955 | Cell 1, row 1
3956 |rowspan=2| Cell 2, row 1 (and 2)
3957 | Cell 3, row 1
3958 |-
3959 | Cell 1, row 2
3960 | Cell 3, row 2
3961 |}
3962 !! result
3963 <table border="1">
3964 <tr>
3965 <td> Cell 1, row 1
3966 </td>
3967 <td rowspan="2"> Cell 2, row 1 (and 2)
3968 </td>
3969 <td> Cell 3, row 1
3970 </td></tr>
3971 <tr>
3972 <td> Cell 1, row 2
3973 </td>
3974 <td> Cell 3, row 2
3975 </td></tr></table>
3976
3977 !! end
3978
3979 !! test
3980 Nested table
3981 !! input
3982 {| border=1
3983 | &alpha;
3984 |
3985 {| bgcolor=#ABCDEF border=2
3986 |nested
3987 |-
3988 |table
3989 |}
3990 |the original table again
3991 |}
3992 !! result
3993 <table border="1">
3994 <tr>
3995 <td> &#945;
3996 </td>
3997 <td>
3998 <table bgcolor="#ABCDEF" border="2">
3999 <tr>
4000 <td>nested
4001 </td></tr>
4002 <tr>
4003 <td>table
4004 </td></tr></table>
4005 </td>
4006 <td>the original table again
4007 </td></tr></table>
4008
4009 !! end
4010
4011 !! test
4012 Invalid attributes in table cell (bug 1830)
4013 !! input
4014 {|
4015 |Cell:|broken
4016 |}
4017 !! result
4018 <table>
4019 <tr>
4020 <td>broken
4021 </td></tr></table>
4022
4023 !! end
4024
4025
4026 !! test
4027 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
4028 !! input
4029 {|
4030 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
4031 !! result
4032 <table>
4033 <tr>
4034 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
4035 <td>]" onmouseover="alert(document.cookie)"&gt;test
4036 </td>
4037 </tr>
4038 </table>
4039
4040 !! end
4041
4042
4043 !! test
4044 Indented table markup mixed with indented pre content (proposed in bug 6200)
4045 !! input
4046 <table>
4047 <tr>
4048 <td>
4049 Text that should be rendered preformatted
4050 </td>
4051 </tr>
4052 </table>
4053 !! result
4054 <table>
4055 <tr>
4056 <td>
4057 <pre>Text that should be rendered preformatted
4058 </pre>
4059 </td>
4060 </tr>
4061 </table>
4062
4063 !! end
4064
4065 !! test
4066 Template-generated table cell attributes and cell content
4067 !! input
4068 {|
4069 |{{table_attribs}}
4070 |}
4071 !! result
4072 <table>
4073 <tr>
4074 <td style="color: red"> Foo
4075 </td></tr></table>
4076
4077 !! end
4078
4079 !! test
4080 Template-generated table cell attributes and cell content (2)
4081 !! input
4082 {|
4083 |align=center {{table_attribs}}
4084 |}
4085 !! result
4086 <table>
4087 <tr>
4088 <td align="center" style="color: red"> Foo
4089 </td></tr></table>
4090
4091 !! end
4092
4093 !! test
4094 Template-generated table cell attributes and cell content (3)
4095 !! input
4096 {|
4097 |align=center {{table_cells}}
4098 |}
4099 !! result
4100 <table>
4101 <tr>
4102 <td align="center" style="color: red"> Foo </td>
4103 <td> Bar </td>
4104 <td> Baz
4105 </td></tr></table>
4106
4107 !! end
4108
4109 !! test
4110 Table with row followed by newlines and table heading
4111 !! input
4112 {|
4113 |-
4114
4115 ! foo
4116 |}
4117 !! result
4118 <table>
4119
4120
4121 <tr>
4122 <th> foo
4123 </th></tr></table>
4124
4125 !! end
4126
4127 !! test
4128 Table with empty line following the start tag
4129 !! input
4130 {|
4131
4132 |-
4133 | foo
4134 |}
4135 !! result
4136 <table>
4137
4138
4139 <tr>
4140 <td> foo
4141 </td></tr></table>
4142
4143 !! end
4144
4145 # FIXME: Preserve the attribute properly (with an empty string as value) in
4146 # the PHP parser. Parsoid implements the behavior below.
4147 !! test
4148 Table attributes with empty value
4149 !! options
4150 parsoid
4151 !! input
4152 {|
4153 | style=| hello
4154 |}
4155 !! result
4156 <table>
4157 <tbody>
4158 <tr>
4159 <td style=""> hello
4160 </td></tr></tbody></table>
4161
4162 !! end
4163
4164 !! test
4165 Wikitext table with a lot of comments
4166 !! input
4167 {|
4168 <!-- c0 -->
4169 | foo
4170 <!-- c1 -->
4171 |- <!-- c2 -->
4172 <!-- c3 -->
4173 |<!-- c4 -->
4174 <!-- c5 -->
4175 |}
4176 !! result
4177 <table>
4178 <tr>
4179 <td> foo
4180 </td></tr>
4181 <tr>
4182 <td>
4183 </td></tr></table>
4184
4185 !! end
4186
4187 !! test
4188 Wikitext table with double-line table cell
4189 !! input
4190 {|
4191 |a
4192 b
4193 |}
4194 !! result
4195 <table>
4196 <tr>
4197 <td>a
4198 <p>b
4199 </p>
4200 </td></tr></table>
4201
4202 !! end
4203
4204 !! test
4205 Table cell with a single comment
4206 !! input
4207 {|
4208 | <!-- c1 -->
4209 | a
4210 |}
4211 !! result
4212 <table>
4213 <tr>
4214 <td>
4215 </td>
4216 <td> a
4217 </td></tr></table>
4218
4219 !! end
4220
4221 # The expected HTML structure in this test is debatable. The PHP parser does
4222 # not parse this kind of table at all. The main focus for Parsoid is on
4223 # round-tripping, so this output is ok for now. TODO: revisit!
4224 !! test
4225 Wikitext table with html-syntax row (Parsoid)
4226 !! options
4227 parsoid
4228 !! input
4229 {|
4230 |-
4231 <td>foo</td>
4232 |}
4233 !! result
4234 <table>
4235 <tbody>
4236 <tr>
4237 <td>foo</td></tr></tbody></table>
4238 !! end
4239
4240 !! test
4241 Implicit <td> after a |-
4242 (PHP parser relies on Tidy to add the missing <td> tags)
4243 !! options
4244 parsoid=wt2html,wt2wt
4245 !! input
4246 {|
4247 |-
4248 a
4249 |}
4250 !! result
4251 <table>
4252 <tr><td>a</td></tr>
4253 </table>
4254 !! end
4255
4256 !! test
4257 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4258 (PHP parser relies on Tidy to add the missing <td> tags)
4259 !! options
4260 parsoid=wt2html,wt2wt
4261 !! input
4262 {|
4263 |-
4264 |
4265 a
4266 |-
4267 b
4268 |}
4269 !! result
4270 <table>
4271 <tbody>
4272 <tr><td><pre>a</pre></td></tr>
4273 <tr><td> b</td></tr>
4274 </tbody>
4275 </table>
4276 !! end
4277
4278 !! test
4279 Lists should be recognized in an implicit <td> context
4280 (PHP parser relies on Tidy to add the missing <td> tags)
4281 !! options
4282 parsoid=wt2html,wt2wt
4283 !! input
4284 {|
4285 |-
4286 *a
4287 |}
4288 !! result
4289 <table>
4290 <tr>
4291 <td><ul><li>a</li></ul></td>
4292 </tr>
4293 </table>
4294 !! end
4295
4296 !! test
4297 Parsoid: Round-trip tables directly followed by content (bug 51219)
4298 !! options
4299 parsoid=wt2html,wt2wt
4300 !! input
4301 {|
4302 |foo
4303 |} bar
4304
4305 {|
4306 |baz
4307 |}<b>quux</b>
4308 !! result
4309 <table><tbody>
4310 <tr>
4311 <td>foo</td></tr></tbody></table> bar
4312 <table>
4313 <tbody>
4314 <tr>
4315 <td>baz</td></tr></tbody></table><b>quux</b>
4316 !! end
4317
4318 !! test
4319 Parsoid: Default to a newline after tables in new content (bug 51219)
4320 !! options
4321 parsoid=html2wt
4322 !! input
4323 {|
4324 |-
4325 |foo
4326 |}
4327 <nowiki> </nowiki>bar
4328 {|
4329 |-
4330 |baz
4331 |}
4332 '''quux'''
4333 !! result
4334 <table><tbody>
4335 <tr>
4336 <td>foo</td></tr></tbody></table> bar
4337 <table><tbody>
4338 <tr>
4339 <td>baz</td></tr></tbody></table><b>quux</b>
4340 !! end
4341
4342 ###
4343 ### Internal links
4344 ###
4345 !! test
4346 Plain link, capitalized
4347 !! input
4348 [[Main Page]]
4349 !! result
4350 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4351 </p>
4352 !! end
4353
4354 !! test
4355 Plain link, uncapitalized
4356 !! input
4357 [[main Page]]
4358 !! result
4359 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4360 </p>
4361 !! end
4362
4363 !! test
4364 Piped link
4365 !! input
4366 [[Main Page|The Main Page]]
4367 !! result
4368 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4369 </p>
4370 !! end
4371
4372 !! test
4373 Piped link with comment in link text
4374 !! input
4375 [[Main Page|The Main<!--front--> Page]]
4376 !! result
4377 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4378 </p>
4379 !! end
4380
4381 !! test
4382 Broken link
4383 !! input
4384 [[Zigzagzogzagzig]]
4385 !! result
4386 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4387 </p>
4388 !! end
4389
4390 !! test
4391 Broken link with fragment
4392 !! input
4393 [[Zigzagzogzagzig#zug]]
4394 !! result
4395 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4396 </p>
4397 !! end
4398
4399 !! test
4400 Special page link with fragment
4401 !! input
4402 [[Special:Version#anchor]]
4403 !! result
4404 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4405 </p>
4406 !! end
4407
4408 !! test
4409 Nonexistent special page link with fragment
4410 !! input
4411 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4412 !! result
4413 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4414 </p>
4415 !! end
4416
4417 !! test
4418 Link with prefix
4419 !! input
4420 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4421 !! result
4422 <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>
4423 </p>
4424 !! end
4425
4426 !! test
4427 Link with suffix
4428 !! input
4429 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4430 !! result
4431 <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>!!!
4432 </p>
4433 !! end
4434
4435 !! article
4436 prefixed article
4437 !! text
4438 Some text
4439 !! endarticle
4440
4441 !! test
4442 Bug 43661: Piped links with identical prefixes
4443 !! input
4444 [[prefixed article|prefixed articles with spaces]]
4445
4446 [[prefixed article|prefixed articlesaoeu]]
4447
4448 [[Main Page|Main Page test]]
4449 !! result
4450 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4451 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4452 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4453 </p>
4454 !! end
4455
4456
4457 !! test
4458 Link with HTML entity in suffix / tail
4459 !! input
4460 [[Main Page]]&quot;, [[Main Page]]&#97;
4461 !! result
4462 <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;
4463 </p>
4464 !! end
4465
4466 !! test
4467 Link with 3 brackets
4468 !! input
4469 [[[main page]]]
4470 !! result
4471 <p>[[[main page]]]
4472 </p>
4473 !! end
4474
4475 !! test
4476 Piped link with 3 brackets
4477 !! input
4478 [[[main page|the main page]]]
4479 !! result
4480 <p>[[[main page|the main page]]]
4481 </p>
4482 !! end
4483
4484 !! test
4485 Link with multiple pipes
4486 !! input
4487 [[Main Page|The|Main|Page]]
4488 !! result
4489 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4490 </p>
4491 !! end
4492
4493 !! test
4494 Link to namespaces
4495 !! input
4496 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4497 !! result
4498 <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>
4499 </p>
4500 !! end
4501
4502 !! test
4503 Piped link to namespace
4504 !! input
4505 [[Meta:Disclaimers|The disclaimers]]
4506 !! result
4507 <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>
4508 </p>
4509 !! end
4510
4511 !! test
4512 Link containing }
4513 !! input
4514 [[Usually caused by a typo (oops}]]
4515 !! result
4516 <p>[[Usually caused by a typo (oops}]]
4517 </p>
4518 !! end
4519
4520 !! test
4521 Link containing % (not as a hex sequence)
4522 !! input
4523 [[7% Solution]]
4524 !! result
4525 <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>
4526 </p>
4527 !! end
4528
4529 !! test
4530 Link containing % as a single hex sequence interpreted to char
4531 !! input
4532 [[7%25 Solution]]
4533 !! result
4534 <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>
4535 </p>
4536 !!end
4537
4538 !! test
4539 Link containing % as a double hex sequence interpreted to hex sequence
4540 !! input
4541 [[7%2525 Solution]]
4542 !! result
4543 <p>[[7%2525 Solution]]
4544 </p>
4545 !!end
4546
4547 !! test
4548 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4549 Example for such a section: == < ==
4550 !! input
4551 [[%23%3c]][[%23%3e]]
4552 !! result
4553 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4554 </p>
4555 !! end
4556
4557 !! test
4558 Link containing "<#" and ">#" as a hex sequences
4559 !! input
4560 [[%3c%23]][[%3e%23]]
4561 !! result
4562 <p>[[%3c%23]][[%3e%23]]
4563 </p>
4564 !! end
4565
4566 !! test
4567 Link containing an equals sign
4568 !! input
4569 [[Special:BookSources/isbn=4-00-026157-6]]
4570 !! result
4571 <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>
4572 </p>
4573 !! end
4574
4575 !! article
4576 Foo~bar
4577 !! text
4578 Just a test of an article title containing a tilde.
4579 !! endarticle
4580
4581 # note that links containing signatures, like [[Foo~~~~]], are
4582 # massaged by the pre-save transform (PST) and so the tildes are never
4583 # seen by the parser.
4584 !! test
4585 Link containing a tilde
4586 !! input
4587 [[Foo~bar]]
4588 !! result
4589 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4590 </p>
4591 !! end
4592
4593 !! test
4594 Link containing double-single-quotes '' (bug 4598)
4595 !! input
4596 [[Lista d''e paise d''o munno]]
4597 !! result
4598 <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>
4599 </p>
4600 !! end
4601
4602 !! test
4603 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4604 !! input
4605 Some [[Link|pretty ''italics'' and stuff]]!
4606 !! result
4607 <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>!
4608 </p>
4609 !! end
4610
4611 !! test
4612 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4613 !! input
4614 ''Some [[Link|pretty ''italics'' and stuff]]!
4615 !! result
4616 <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>
4617 </p>
4618 !! end
4619
4620 !! test
4621 Link with double quotes in title part (literal) and alternate part (interpreted)
4622 !! input
4623 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4624
4625 [[''Pentecoste'']]
4626
4627 [[''Pentecoste''|Pentecoste]]
4628
4629 [[''Pentecoste''|''Pentecoste'']]
4630 !! result
4631 <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>
4632 </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>
4633 </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>
4634 </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>
4635 </p>
4636 !! end
4637
4638 !! test
4639 Broken image links with HTML captions (bug 39700)
4640 !! input
4641 [[File:Nonexistent|<script></script>]]
4642 [[File:Nonexistent|100px|<script></script>]]
4643 [[File:Nonexistent|&lt;]]
4644 [[File:Nonexistent|a<i>b</i>c]]
4645 !! result
4646 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4647 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4648 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4649 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4650 </p>
4651 !! end
4652
4653 !! test
4654 Plain link to URL
4655 !! input
4656 [[http://www.example.com]]
4657 !! result
4658 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4659 </p>
4660 !! end
4661
4662 !! test
4663 Plain link to URL with link text
4664 !! input
4665 [[http://www.example.com Link text]]
4666 !! result
4667 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4668 </p>
4669 !! end
4670
4671 !! test
4672 Plain link to protocol-relative URL
4673 !! input
4674 [[//www.example.com]]
4675 !! result
4676 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4677 </p>
4678 !! end
4679
4680 !! test
4681 Plain link to protocol-relative URL with link text
4682 !! input
4683 [[//www.example.com Link text]]
4684 !! result
4685 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4686 </p>
4687 !! end
4688
4689 !! test
4690 Plain link to page with question mark in title
4691 !! input
4692 [[A?b]]
4693
4694 [[A?b|Baz]]
4695 !! result
4696 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4697 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4698 </p>
4699 !! end
4700
4701
4702 # I'm fairly sure the expected result here is wrong.
4703 # We want these to be URL links, not pseudo-pages with URLs for titles....
4704 # However the current output is also pretty screwy.
4705 #
4706 # ----
4707 # I'm changing it to match the current output--it arguably makes more
4708 # sense in the light of the test above. Old expected result was:
4709 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4710 #</p>
4711 # But I think this test is bordering on "garbage in, garbage out" anyway.
4712 # -- wtm
4713 !! test
4714 Piped link to URL
4715 !! input
4716 Piped link to URL: [[http://www.example.com|an example URL]]
4717 !! result
4718 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4719 </p>
4720 !! end
4721
4722 !! test
4723 BUG 2: [[page|http://url/]] should link to page, not http://url/
4724 !! input
4725 [[Main Page|http://url/]]
4726 !! result
4727 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4728 </p>
4729 !! end
4730
4731 !! test
4732 BUG 337: Escaped self-links should be bold
4733 !! options
4734 title=[[Bug462]]
4735 !! input
4736 [[Bu&#103;462]] [[Bug462]]
4737 !! result
4738 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4739 </p>
4740 !! end
4741
4742 !! test
4743 Self-link to section should not be bold
4744 !! options
4745 title=[[Main Page]]
4746 !! input
4747 [[Main Page#section]]
4748 !! result
4749 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4750 </p>
4751 !! end
4752
4753 !! article
4754 00
4755 !! text
4756 This is 00.
4757 !! endarticle
4758
4759 !!test
4760 Self-link to numeric title
4761 !!options
4762 title=[[0]]
4763 !!input
4764 [[0]]
4765 !!result
4766 <p><strong class="selflink">0</strong>
4767 </p>
4768 !!end
4769
4770 !!test
4771 Link to numeric-equivalent title
4772 !!options
4773 title=[[0]]
4774 !!input
4775 [[00]]
4776 !!result
4777 <p><a href="/wiki/00" title="00">00</a>
4778 </p>
4779 !!end
4780
4781 !! test
4782 <nowiki> inside a link
4783 !! input
4784 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4785 !! result
4786 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4787 </p>
4788 !! end
4789
4790 !! test
4791 Non-breaking spaces in title
4792 !! input
4793 [[&nbsp; Main &nbsp; Page &nbsp;]]
4794 !! result
4795 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4796 </p>
4797 !!end
4798
4799 !! test
4800 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4801 !! options
4802 language=ca
4803 !! input
4804 '''[[Main Page]]'''
4805 !! result
4806 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4807 </p>
4808 !! end
4809
4810 !! test
4811 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4812 !! options
4813 language=ca
4814 !! input
4815 ''[[Main Page]]''
4816 !! result
4817 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4818 </p>
4819 !! end
4820
4821 !! test
4822 Internal link with en linktrail: no apostrophes (bug 27473)
4823 !! options
4824 language=en
4825 !! input
4826 [[Something]]'nice
4827 !! result
4828 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4829 </p>
4830 !! end
4831
4832 !! test
4833 Internal link with ca linktrail with apostrophes (bug 27473)
4834 !! options
4835 language=ca
4836 !! input
4837 [[Something]]'nice
4838 !! result
4839 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4840 </p>
4841 !! end
4842
4843 !! test
4844 Internal link with kaa linktrail with apostrophes (bug 27473)
4845 !! options
4846 language=kaa
4847 !! input
4848 [[Something]]'nice
4849 !! result
4850 <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>
4851 </p>
4852 !! end
4853
4854 !! article
4855 Söfnuður
4856 !! text
4857 Test.
4858 !! endarticle
4859
4860 !! test
4861 Internal link with is link prefix
4862 !! options
4863 language=is
4864 !! input
4865 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4866 !! result
4867 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4868 </p>
4869 !! end
4870
4871 !! article
4872 Mótmælendatrú
4873 !! text
4874 Test.
4875 !! endarticle
4876
4877 !! test
4878 Internal link with is link trail and link prefix
4879 !! options
4880 language=is
4881 !! input
4882 [[mótmælendatrú|xxx]]ar
4883 [[mótmælendatrú]]ar
4884 mótmælenda[[söfnuður]]
4885 mótmælenda[[söfnuður|söfnuðir]]
4886 mótmælenda[[söfnuður|söfnuðir]]xxx
4887 !! result
4888 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4889 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4890 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4891 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4892 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4893 </p>
4894 !! end
4895
4896 !! test
4897 Parsoid link trail escaping
4898 !! options
4899 parsoid=html2wt,html2html
4900 !! input
4901 [[apple]]<nowiki/>s
4902 !! result
4903 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4904 !! end
4905
4906 !! test
4907 Parsoid link prefix escaping
4908 !! options
4909 language=is
4910 parsoid=html2wt,html2html
4911 !! input
4912 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4913 !! result
4914 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4915 !! end
4916
4917 !! test
4918 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4919 !! input
4920 [[Foo| bar]]
4921
4922 [[Foo| ''bar'']]
4923
4924 [http://wp.org foo]
4925
4926 [http://wp.org ''foo'']
4927 !! result
4928 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4929 </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>
4930 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4931 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4932 </p>
4933 !! end
4934
4935 ###
4936 ### Interwiki links (see maintenance/interwiki.sql)
4937 ###
4938
4939 !! test
4940 Inline interwiki link
4941 !! input
4942 [[MeatBall:SoftSecurity]]
4943 !! result
4944 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4945 </p>
4946 !! end
4947
4948 !! test
4949 Inline interwiki link with empty title (bug 2372)
4950 !! input
4951 [[MeatBall:]]
4952 !! result
4953 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4954 </p>
4955 !! end
4956
4957 !! test
4958 Interwiki link encoding conversion (bug 1636)
4959 !! input
4960 *[[Wikipedia:ro:Olteni&#0355;a]]
4961 *[[Wikipedia:ro:Olteni&#355;a]]
4962 !! result
4963 <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>
4964 </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>
4965 </li></ul>
4966
4967 !! end
4968
4969 !! test
4970 Interwiki link with fragment (bug 2130)
4971 !! input
4972 [[MeatBall:SoftSecurity#foo]]
4973 !! result
4974 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4975 </p>
4976 !! end
4977
4978 !! test
4979 Interlanguage link
4980 !! input
4981 Blah blah blah
4982 [[zh:Chinese]]
4983 !!result
4984 <p>Blah blah blah
4985 </p>
4986 !! end
4987
4988 !! test
4989 Double interlanguage link
4990 !! input
4991 Blah blah blah
4992 [[es:Spanish]]
4993 [[zh:Chinese]]
4994 !!result
4995 <p>Blah blah blah
4996 </p>
4997 !! end
4998
4999 !! test
5000 Interlanguage link, with prefix links
5001 !! options
5002 language=ln
5003 !! input
5004 Blah blah blah
5005 [[zh:Chinese]]
5006 !!result
5007 <p>Blah blah blah
5008 </p>
5009 !! end
5010
5011 !! test
5012 Double interlanguage link, with prefix links (bug 8897)
5013 !! options
5014 language=ln
5015 !! input
5016 Blah blah blah
5017 [[es:Spanish]]
5018 [[zh:Chinese]]
5019 !!result
5020 <p>Blah blah blah
5021 </p>
5022 !! end
5023
5024 !! test
5025 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
5026 !! options
5027 language=ln
5028 !! input
5029 [[WW&nbsp;II]]
5030 !!result
5031 <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>
5032 </p>
5033 !! end
5034
5035 !! test
5036 Parsoid: handle constructor well
5037 !! options
5038 parsoid
5039 !! input
5040 [[constructor]]
5041
5042 [[constructor:foo]]
5043 !! result
5044 <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>
5045
5046
5047 <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>
5048 !! end
5049
5050 ##
5051 ## Redirects, Parsoid-only
5052 ##
5053 !! test
5054 Simple redirect to page
5055 !! options
5056 parsoid
5057 !! input
5058 #REDIRECT [[Main Page]]
5059 !! result
5060 <link rel="mw:PageProp/redirect" href="./Main_Page">
5061 !! end
5062
5063 !! test
5064 Optional colon in #REDIRECT
5065 !! options
5066 # the colon is archaic syntax. we support it for wt2html, but we
5067 # don't care that it roundtrips back to the modern syntax.
5068 parsoid=wt2html,html2html
5069 !! input
5070 #REDIRECT:[[Main Page]]
5071 !! result
5072 <link rel="mw:PageProp/redirect" href="./Main_Page">
5073 !! end
5074
5075 !! test
5076 Whitespace in #REDIRECT with optional colon
5077 !! options
5078 # the colon and gratuitous whitespace is archaic syntax. we support
5079 # it for wt2html, but we don't care that it roundtrips back to the
5080 # modern syntax (without extra whitespace)
5081 parsoid=wt2html,html2html
5082 !! input
5083
5084 #REDIRECT
5085 :
5086 [[Main Page]]
5087 !! result
5088 <link rel="mw:PageProp/redirect" href="./Main_Page">
5089 !! end
5090
5091 !! test
5092 Piped link in #REDIRECT
5093 !! options
5094 # content after piped link is ignored. we support this syntax,
5095 # but don't care that the piped link is lost when we roundtrip this.
5096 parsoid=wt2html
5097 !! input
5098 #REDIRECT [[Main Page|bar]]
5099 !! result
5100 <link rel="mw:PageProp/redirect" href="./Main_Page">
5101 !! end
5102
5103 !! test
5104 Redirect to category
5105 !! options
5106 parsoid=wt2html
5107 !! input
5108 #REDIRECT [[Category:Foo]]
5109 !! result
5110 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
5111 !! end
5112
5113 !! test
5114 Redirect to category with URL encoding
5115 !! options
5116 parsoid=wt2html
5117 !! input
5118 #REDIRECT [[Category%3AFoo]]
5119 !! result
5120 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
5121 !! end
5122
5123 !! test
5124 Redirect to category page
5125 !! options
5126 parsoid=wt2html,html2html
5127 !! input
5128 #REDIRECT [[:Category:Foo]]
5129 !! result
5130 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
5131 !! end
5132
5133 !! test
5134 Redirect to image page (1)
5135 !! options
5136 parsoid
5137 !! input
5138 #REDIRECT [[File:Wiki.png]]
5139 !! result
5140 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5141 !! end
5142
5143 !! test
5144 Redirect to image page (2)
5145 !! options
5146 parsoid
5147 !! input
5148 #REDIRECT [[Image:Wiki.png]]
5149 !! result
5150 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5151 !! end
5152
5153 !! test
5154 Redirect to language
5155 !! options
5156 parsoid
5157 !! input
5158 #REDIRECT [[en:File:Wiki.png]]
5159 !! result
5160 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5161 !! end
5162
5163 !! test
5164 Redirect to interwiki
5165 !! options
5166 parsoid
5167 !! input
5168 #REDIRECT [[meatball:File:Wiki.png]]
5169 !! result
5170 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5171 !! end
5172
5173 !! test
5174 Non-English #REDIRECT
5175 !! options
5176 parsoid
5177 language=is
5178 !! input
5179 #TILVÍSUN [[Main Page]]
5180 !! result
5181 <link rel="mw:PageProp/redirect" href="./Main_Page">
5182 !! end
5183
5184 ##
5185 ## XHTML tidiness
5186 ###
5187
5188 !! test
5189 <br> to <br />
5190 !! input
5191 1<br>2<br />3
5192 !! result
5193 <p>1<br />2<br />3
5194 </p>
5195 !! end
5196
5197 !! test
5198 Broken br tag sanitization
5199 !! options
5200 php
5201 !! input
5202 </br>
5203 !! result
5204 <p>&lt;/br&gt;
5205 </p>
5206 !! end
5207
5208 # TODO: Fix html2html mode (bug 51055)!
5209 !! test
5210 Parsoid: Broken br tag recognition
5211 !! options
5212 parsoid=wt2html
5213 !! input
5214 </br>
5215 !! result
5216 <p><br></p>
5217 !! end
5218
5219 !! test
5220 Incorrecly removing closing slashes from correctly formed XHTML
5221 !! input
5222 <br style="clear:both;" />
5223 !! result
5224 <p><br style="clear:both;" />
5225 </p>
5226 !! end
5227
5228 !! test
5229 Failing to transform badly formed HTML into correct XHTML
5230 !! input
5231 <br style="clear: left;">
5232 <br style="clear: right;">
5233 <br style="clear: both;">
5234 !! result
5235 <p><br style="clear: left;" />
5236 <br style="clear: right;" />
5237 <br style="clear: both;" />
5238 </p>
5239 !!end
5240
5241 !! test
5242 Handling html with a div self-closing tag
5243 !! input
5244 <div title />
5245 <div title/>
5246 <div title/ >
5247 <div title=bar />
5248 <div title=bar/>
5249 <div title=bar/ >
5250 !! result
5251 <p>&lt;div title /&gt;
5252 &lt;div title/&gt;
5253 </p>
5254 <div>
5255 <p>&lt;div title=bar /&gt;
5256 &lt;div title=bar/&gt;
5257 </p>
5258 <div title="bar/"></div>
5259 </div>
5260
5261 !! end
5262
5263 !! test
5264 Handling html with a br self-closing tag
5265 !! input
5266 <br title />
5267 <br title/>
5268 <br title/ >
5269 <br title=bar />
5270 <br title=bar/>
5271 <br title=bar/ >
5272 !! result
5273 <p><br title="title" />
5274 <br title="title" />
5275 <br />
5276 <br title="bar" />
5277 <br title="bar" />
5278 <br title="bar/" />
5279 </p>
5280 !! end
5281
5282 !! test
5283 Horizontal ruler (should it add that extra space?)
5284 !! input
5285 <hr>
5286 <hr >
5287 foo <hr
5288 > bar
5289 !! result
5290 <hr />
5291 <hr />
5292 foo <hr /> bar
5293
5294 !! end
5295
5296 !! test
5297 Horizontal ruler -- 4+ dashes render hr
5298 !! input
5299 ----
5300 !! result
5301 <hr />
5302
5303 !! end
5304
5305 !! test
5306 Horizontal ruler -- eats additional dashes on the same line
5307 !! input
5308 ---------
5309 !! result
5310 <hr />
5311
5312 !! end
5313
5314 !! test
5315 Horizontal ruler -- does not collapse dashes on consecutive lines
5316 !! input
5317 ----
5318 ----
5319 !! result
5320 <hr />
5321 <hr />
5322
5323 !! end
5324
5325 !! test
5326 Horizontal ruler -- <4 dashes render as plain text
5327 !! input
5328 ---
5329 !! result
5330 <p>---
5331 </p>
5332 !! end
5333
5334 !! test
5335 Horizontal ruler -- Supports content following dashes on same line
5336 !! input
5337 ---- Foo
5338 !! result
5339 <hr /> Foo
5340
5341 !! end
5342
5343 ###
5344 ### Block-level elements
5345 ###
5346 !! test
5347 Common list
5348 !! input
5349 *Common list
5350 * item 2
5351 *item 3
5352 !! result
5353 <ul><li>Common list
5354 </li><li> item 2
5355 </li><li>item 3
5356 </li></ul>
5357
5358 !! end
5359
5360 !! test
5361 Numbered list
5362 !! input
5363 #Numbered list
5364 #item 2
5365 # item 3
5366 !! result
5367 <ol><li>Numbered list
5368 </li><li>item 2
5369 </li><li> item 3
5370 </li></ol>
5371
5372 !! end
5373
5374 !! test
5375 Mixed list
5376 !! input
5377 *Mixed list
5378 *# with numbers
5379 ** and bullets
5380 *# and numbers
5381 *bullets again
5382 **bullet level 2
5383 ***bullet level 3
5384 ***#Number on level 4
5385 **bullet level 2
5386 **#Number on level 3
5387 **#Number on level 3
5388 *#number level 2
5389 *Level 1
5390 *** Level 3
5391 #** Level 3, but ordered
5392 !! result
5393 <ul><li>Mixed list
5394 <ol><li> with numbers
5395 </li></ol>
5396 <ul><li> and bullets
5397 </li></ul>
5398 <ol><li> and numbers
5399 </li></ol>
5400 </li><li>bullets again
5401 <ul><li>bullet level 2
5402 <ul><li>bullet level 3
5403 <ol><li>Number on level 4
5404 </li></ol>
5405 </li></ul>
5406 </li><li>bullet level 2
5407 <ol><li>Number on level 3
5408 </li><li>Number on level 3
5409 </li></ol>
5410 </li></ul>
5411 <ol><li>number level 2
5412 </li></ol>
5413 </li><li>Level 1
5414 <ul><li><ul><li> Level 3
5415 </li></ul>
5416 </li></ul>
5417 </li></ul>
5418 <ol><li><ul><li><ul><li> Level 3, but ordered
5419 </li></ul>
5420 </li></ul>
5421 </li></ol>
5422
5423 !! end
5424
5425 !! test
5426 Nested lists 1
5427 !! input
5428 *foo
5429 **bar
5430 !! result
5431 <ul><li>foo
5432 <ul><li>bar
5433 </li></ul>
5434 </li></ul>
5435
5436 !! end
5437
5438 !! test
5439 Nested lists 2
5440 !! input
5441 **foo
5442 *bar
5443 !! result
5444 <ul><li><ul><li>foo
5445 </li></ul>
5446 </li><li>bar
5447 </li></ul>
5448
5449 !! end
5450
5451 !! test
5452 Nested lists 3 (first element empty)
5453 !! input
5454 *
5455 **bar
5456 !! result
5457 <ul><li>
5458 <ul><li>bar
5459 </li></ul>
5460 </li></ul>
5461
5462 !! end
5463
5464 !! test
5465 Nested lists 4 (first element empty)
5466 !! input
5467 **
5468 *bar
5469 !! result
5470 <ul><li><ul><li>
5471 </li></ul>
5472 </li><li>bar
5473 </li></ul>
5474
5475 !! end
5476
5477 !! test
5478 Nested lists 5 (both elements empty)
5479 !! input
5480 **
5481 *
5482 !! result
5483 <ul><li><ul><li>
5484 </li></ul>
5485 </li><li>
5486 </li></ul>
5487
5488 !! end
5489
5490 !! test
5491 Nested lists 6 (both elements empty)
5492 !! input
5493 *
5494 **
5495 !! result
5496 <ul><li>
5497 <ul><li>
5498 </li></ul>
5499 </li></ul>
5500
5501 !! end
5502
5503 !! test
5504 Nested lists 7 (skip initial nesting levels)
5505 !! input
5506 *** foo
5507 !! result
5508 <ul><li><ul><li><ul><li> foo
5509 </li></ul>
5510 </li></ul>
5511 </li></ul>
5512
5513 !! end
5514
5515 !! test
5516 Nested lists 8 (multiple nesting transitions)
5517 !! input
5518 * foo
5519 *** bar
5520 ** baz
5521 * boo
5522 !! result
5523 <ul><li> foo
5524 <ul><li><ul><li> bar
5525 </li></ul>
5526 </li><li> baz
5527 </li></ul>
5528 </li><li> boo
5529 </li></ul>
5530
5531 !! end
5532
5533 !! test
5534 1. Lists with start-of-line-transparent tokens before bullets: Comments
5535 !! input
5536 *foo
5537 *<!--cmt-->bar
5538 <!--cmt-->*baz
5539 !! result
5540 <ul><li>foo
5541 </li><li>bar
5542 </li><li>baz
5543 </li></ul>
5544
5545 !! end
5546
5547 !! test
5548 2. Lists with start-of-line-transparent tokens before bullets: Template close
5549 !! input
5550 *foo {{echo|bar
5551 }}*baz
5552 !! result
5553 <ul><li>foo bar
5554 </li><li>baz
5555 </li></ul>
5556
5557 !! end
5558
5559 !! test
5560 List items are not parsed correctly following a <pre> block (bug 785)
5561 !! input
5562 * <pre>foo</pre>
5563 * <pre>bar</pre>
5564 * zar
5565 !! result
5566 <ul><li> <pre>foo</pre>
5567 </li><li> <pre>bar</pre>
5568 </li><li> zar
5569 </li></ul>
5570
5571 !! end
5572
5573 !! test
5574 List items from template
5575 !! input
5576
5577 {{inner list}}
5578 * item 2
5579
5580 * item 0
5581 {{inner list}}
5582 * item 2
5583
5584 * item 0
5585 * notSOL{{inner list}}
5586 * item 2
5587 !! result
5588 <ul><li> item 1
5589 </li><li> item 2
5590 </li></ul>
5591 <ul><li> item 0
5592 </li><li> item 1
5593 </li><li> item 2
5594 </li></ul>
5595 <ul><li> item 0
5596 </li><li> notSOL
5597 </li><li> item 1
5598 </li><li> item 2
5599 </li></ul>
5600
5601 !! end
5602
5603 !! test
5604 List interrupted by empty line or heading
5605 !! input
5606 * foo
5607
5608 ** bar
5609 == A heading ==
5610 * Another list item
5611 !! result
5612 <ul><li> foo
5613 </li></ul>
5614 <ul><li><ul><li> bar
5615 </li></ul>
5616 </li></ul>
5617 <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>
5618 <ul><li> Another list item
5619 </li></ul>
5620
5621 !!end
5622
5623 !!test
5624 Multiple list tags generated by templates
5625 !!input
5626 {{echo|<li>}}a
5627 {{echo|<li>}}b
5628 {{echo|<li>}}c
5629 !!result
5630 <li>a
5631 <li>b
5632 <li>c</li>
5633 </li>
5634 </li>
5635
5636 !!end
5637
5638 !!test
5639 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
5640 !!input
5641 *a
5642 <!--This line will NOT split the list-->
5643 *b
5644 <!--This line will NOT split the list either-->
5645 *c
5646 <!--foo--> <!----> <!--This line NOT split the list either-->
5647 *d
5648 !!result
5649 <ul><li>a
5650 </li><li>b
5651 </li><li>c
5652 </li><li>d
5653 </li></ul>
5654
5655 !!end
5656
5657 !!test
5658 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
5659 !!input
5660 *a
5661 <!--This line will NOT split the list-->
5662 *b
5663 <!--This line will NOT split the list either-->
5664 *c
5665 <!--foo--> <!----> <!--This line NOT split the list
5666 either-->
5667 *d
5668 !!result
5669 <ul><li>a
5670 </li><li>b
5671 </li><li>c
5672 </li><li>d
5673 </li></ul>
5674
5675 !!end
5676
5677 !!test
5678 Test the li-hack
5679 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5680 !!options
5681 parsoid=wt2html,wt2wt
5682 !!input
5683 * foo
5684 * <li>li-hack
5685 * {{echo|<li>templated li-hack}}
5686 * <!--foo--> <li> unsupported li-hack with preceding comments
5687
5688 <ul>
5689 <li><li>not a li-hack
5690 </li>
5691 </ul>
5692 !!result
5693 <ul><li> foo</li>
5694 <li>li-hack</li>
5695 <li about="#mwt1" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>templated li-hack"}}}'>templated li-hack</li>
5696 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5697
5698 <ul>
5699 <li></li><li>not a li-hack
5700 </li>
5701 </ul>
5702 !!end
5703
5704 !! test
5705 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5706 !! options
5707 parsoid
5708 !! input
5709 # foo
5710 ## bar
5711 * foo
5712 ** bar
5713 : foo
5714 :: bar
5715 !! result
5716 <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>
5717 !! end
5718
5719 !! test
5720 Parsoid: Test of whitespace serialization with Templated bullets
5721 !! options
5722 parsoid
5723 !! input
5724 * {{bullet}}
5725 !! result
5726 <ul>
5727 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}'> Bar</li>
5728 </ul>
5729 !! end
5730
5731 # ------------------------------------------------------------------------
5732 # The next set of tests are about Parsoid's ability to handle badly nested
5733 # tags (parse, minimize scope of fixup, and roundtrip back)
5734 # ------------------------------------------------------------------------
5735
5736 !! test
5737 Unbalanced closing block tags break a list
5738 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5739 !! options
5740 parsoid
5741 !! input
5742 <div>
5743 *a</div><div>
5744 *b</div>
5745 !! result
5746 <div>
5747 <ul><li>a
5748 </li></ul></div><div>
5749 <ul><li>b
5750 </li></ul></div>
5751 !! end
5752
5753 !! test
5754 Unbalanced closing non-block tags don't break a list
5755 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5756 !! options
5757 parsoid
5758 !! input
5759 <span>
5760 *a</span><span>
5761 *b</span>
5762 !! result
5763 <p><span></span>
5764 </p>
5765 <ul><li>a<span></span>
5766 </li><li>b
5767 </li></ul>
5768 !! end
5769
5770 !! test
5771 Unclosed formatting tags that straddle lists are closed and reopened
5772 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5773 !! options
5774 parsoid
5775 !! input
5776 # <s> a
5777 # b </s>
5778 !! result
5779 <ol><li> <s> a </s>
5780 </li><li> <s> b </s>
5781 </li></ol>
5782 !! end
5783
5784 !!test
5785 List embedded in a non-block tag
5786 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5787 !! options
5788 parsoid
5789 !!input
5790 <small>
5791 * foo
5792 </small>
5793 !!result
5794 <p><small></small></p>
5795 <small>
5796 <ul>
5797 <li> foo</li>
5798 </ul>
5799 </small>
5800 <p><small></small></p>
5801 !!end
5802
5803 ###
5804 ### Magic Words
5805 ###
5806
5807 # Note that the current date is hard-coded as
5808 # 1970-01-01T00:02:03Z (a Thursday)
5809 # when running parser tests. The timezone is also fixed to GMT, so
5810 # local date will be identical to current date.
5811
5812 !! test
5813 Magic Word: {{CURRENTDAY}}
5814 !! input
5815 {{CURRENTDAY}}
5816 !! result
5817 <p>1
5818 </p>
5819 !! end
5820
5821 !! test
5822 Magic Word: {{CURRENTDAY2}}
5823 !! input
5824 {{CURRENTDAY2}}
5825 !! result
5826 <p>01
5827 </p>
5828 !! end
5829
5830 !! test
5831 Magic Word: {{CURRENTDAYNAME}}
5832 !! input
5833 {{CURRENTDAYNAME}}
5834 !! result
5835 <p>Thursday
5836 </p>
5837 !! end
5838
5839 !! test
5840 Magic Word: {{CURRENTDOW}}
5841 !! input
5842 {{CURRENTDOW}}
5843 !! result
5844 <p>4
5845 </p>
5846 !! end
5847
5848 !! test
5849 Magic Word: {{CURRENTMONTH}}
5850 !! input
5851 {{CURRENTMONTH}}
5852 !! result
5853 <p>01
5854 </p>
5855 !! end
5856
5857 !! test
5858 Magic Word: {{CURRENTMONTH1}}
5859 !! input
5860 {{CURRENTMONTH1}}
5861 !! result
5862 <p>1
5863 </p>
5864 !! end
5865
5866 !! test
5867 Magic Word: {{CURRENTMONTHABBREV}}
5868 !! input
5869 {{CURRENTMONTHABBREV}}
5870 !! result
5871 <p>Jan
5872 </p>
5873 !! end
5874
5875 !! test
5876 Magic Word: {{CURRENTMONTHNAME}}
5877 !! input
5878 {{CURRENTMONTHNAME}}
5879 !! result
5880 <p>January
5881 </p>
5882 !! end
5883
5884 !! test
5885 Magic Word: {{CURRENTMONTHNAMEGEN}}
5886 !! input
5887 {{CURRENTMONTHNAMEGEN}}
5888 !! result
5889 <p>January
5890 </p>
5891 !! end
5892
5893 !! test
5894 Magic Word: {{CURRENTTIME}}
5895 !! input
5896 {{CURRENTTIME}}
5897 !! result
5898 <p>00:02
5899 </p>
5900 !! end
5901
5902 !! test
5903 Magic Word: {{CURRENTHOUR}}
5904 !! input
5905 {{CURRENTHOUR}}
5906 !! result
5907 <p>00
5908 </p>
5909 !! end
5910
5911 !! test
5912 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5913 !! input
5914 {{CURRENTWEEK}}
5915 !! result
5916 <p>1
5917 </p>
5918 !! end
5919
5920 !! test
5921 Magic Word: {{CURRENTYEAR}}
5922 !! input
5923 {{CURRENTYEAR}}
5924 !! result
5925 <p>1970
5926 </p>
5927 !! end
5928
5929 !! test
5930 Magic Word: {{CURRENTTIMESTAMP}}
5931 !! input
5932 {{CURRENTTIMESTAMP}}
5933 !! result
5934 <p>19700101000203
5935 </p>
5936 !! end
5937
5938 !! test
5939 Magic Words LOCAL (UTC)
5940 !! input
5941 * {{LOCALMONTH}}
5942 * {{LOCALMONTH1}}
5943 * {{LOCALMONTHNAME}}
5944 * {{LOCALMONTHNAMEGEN}}
5945 * {{LOCALMONTHABBREV}}
5946 * {{LOCALDAY}}
5947 * {{LOCALDAY2}}
5948 * {{LOCALDAYNAME}}
5949 * {{LOCALYEAR}}
5950 * {{LOCALTIME}}
5951 * {{LOCALHOUR}}
5952 * {{LOCALWEEK}}
5953 * {{LOCALDOW}}
5954 * {{LOCALTIMESTAMP}}
5955 !! result
5956 <ul><li> 01
5957 </li><li> 1
5958 </li><li> January
5959 </li><li> January
5960 </li><li> Jan
5961 </li><li> 1
5962 </li><li> 01
5963 </li><li> Thursday
5964 </li><li> 1970
5965 </li><li> 00:02
5966 </li><li> 00
5967 </li><li> 1
5968 </li><li> 4
5969 </li><li> 19700101000203
5970 </li></ul>
5971
5972 !! end
5973
5974 !! test
5975 Magic Word: {{FULLPAGENAME}}
5976 !! options
5977 title=[[User:Ævar Arnfjörð Bjarmason]]
5978 !! input
5979 {{FULLPAGENAME}}
5980 !! result
5981 <p>User:Ævar Arnfjörð Bjarmason
5982 </p>
5983 !! end
5984
5985 !! test
5986 Magic Word: {{FULLPAGENAMEE}}
5987 !! options
5988 title=[[User:Ævar Arnfjörð Bjarmason]]
5989 !! input
5990 {{FULLPAGENAMEE}}
5991 !! result
5992 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5993 </p>
5994 !! end
5995
5996 !! test
5997 Magic Word: {{TALKSPACE}}
5998 !! options
5999 title=[[User:Ævar Arnfjörð Bjarmason]]
6000 !! input
6001 {{TALKSPACE}}
6002 !! result
6003 <p>User talk
6004 </p>
6005 !! end
6006
6007 !! test
6008 Magic Word: {{TALKSPACE}}, same namespace
6009 !! options
6010 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6011 !! input
6012 {{TALKSPACE}}
6013 !! result
6014 <p>User talk
6015 </p>
6016 !! end
6017
6018 !! test
6019 Magic Word: {{TALKSPACE}}, main namespace
6020 !! options
6021 title=[[Parser Test]]
6022 !! input
6023 {{TALKSPACE}}
6024 !! result
6025 <p>Talk
6026 </p>
6027 !! end
6028
6029 !! test
6030 Magic Word: {{TALKSPACEE}}
6031 !! options
6032 title=[[User:Ævar Arnfjörð Bjarmason]]
6033 !! input
6034 {{TALKSPACEE}}
6035 !! result
6036 <p>User_talk
6037 </p>
6038 !! end
6039
6040 !! test
6041 Magic Word: {{SUBJECTSPACE}}
6042 !! options
6043 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6044 !! input
6045 {{SUBJECTSPACE}}
6046 !! result
6047 <p>User
6048 </p>
6049 !! end
6050
6051 !! test
6052 Magic Word: {{SUBJECTSPACE}}, same namespace
6053 !! options
6054 title=[[User:Ævar Arnfjörð Bjarmason]]
6055 !! input
6056 {{SUBJECTSPACE}}
6057 !! result
6058 <p>User
6059 </p>
6060 !! end
6061
6062 !! test
6063 Magic Word: {{SUBJECTSPACE}}, main namespace
6064 !! options
6065 title=[[Parser Test]]
6066 !! input
6067 {{SUBJECTSPACE}}
6068 !! result
6069
6070 !! end
6071
6072 !! test
6073 Magic Word: {{SUBJECTSPACEE}}
6074 !! options
6075 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6076 !! input
6077 {{SUBJECTSPACEE}}
6078 !! result
6079 <p>User
6080 </p>
6081 !! end
6082
6083 !! test
6084 Magic Word: {{NAMESPACE}}
6085 !! options
6086 title=[[User:Ævar Arnfjörð Bjarmason]]
6087 !! input
6088 {{NAMESPACE}}
6089 !! result
6090 <p>User
6091 </p>
6092 !! end
6093
6094 !! test
6095 Magic Word: {{NAMESPACEE}}
6096 !! options
6097 title=[[User:Ævar Arnfjörð Bjarmason]]
6098 !! input
6099 {{NAMESPACEE}}
6100 !! result
6101 <p>User
6102 </p>
6103 !! end
6104
6105 !! test
6106 Magic Word: {{NAMESPACENUMBER}}
6107 !! options
6108 title=[[User:Ævar Arnfjörð Bjarmason]]
6109 !! input
6110 {{NAMESPACENUMBER}}
6111 !! result
6112 <p>2
6113 </p>
6114 !! end
6115
6116 !! test
6117 Magic Word: {{SUBPAGENAME}}
6118 !! options
6119 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6120 !! input
6121 {{SUBPAGENAME}}
6122 !! result
6123 <p>sub ö
6124 </p>
6125 !! end
6126
6127 !! test
6128 Magic Word: {{SUBPAGENAMEE}}
6129 !! options
6130 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6131 !! input
6132 {{SUBPAGENAMEE}}
6133 !! result
6134 <p>sub_%C3%B6
6135 </p>
6136 !! end
6137
6138 !! test
6139 Magic Word: {{ROOTPAGENAME}}
6140 !! options
6141 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6142 !! input
6143 {{ROOTPAGENAME}}
6144 !! result
6145 <p>Ævar Arnfjörð Bjarmason
6146 </p>
6147 !! end
6148
6149 !! test
6150 Magic Word: {{ROOTPAGENAMEE}}
6151 !! options
6152 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6153 !! input
6154 {{ROOTPAGENAMEE}}
6155 !! result
6156 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6157 </p>
6158 !! end
6159
6160 !! test
6161 Magic Word: {{BASEPAGENAME}}
6162 !! options
6163 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6164 !! input
6165 {{BASEPAGENAME}}
6166 !! result
6167 <p>Ævar Arnfjörð Bjarmason
6168 </p>
6169 !! end
6170
6171 !! test
6172 Magic Word: {{BASEPAGENAMEE}}
6173 !! options
6174 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6175 !! input
6176 {{BASEPAGENAMEE}}
6177 !! result
6178 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6179 </p>
6180 !! end
6181
6182 !! test
6183 Magic Word: {{TALKPAGENAME}}
6184 !! options
6185 title=[[User:Ævar Arnfjörð Bjarmason]]
6186 !! input
6187 {{TALKPAGENAME}}
6188 !! result
6189 <p>User talk:Ævar Arnfjörð Bjarmason
6190 </p>
6191 !! end
6192
6193 !! test
6194 Magic Word: {{TALKPAGENAMEE}}
6195 !! options
6196 title=[[User:Ævar Arnfjörð Bjarmason]]
6197 !! input
6198 {{TALKPAGENAMEE}}
6199 !! result
6200 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6201 </p>
6202 !! end
6203
6204 !! test
6205 Magic Word: {{SUBJECTPAGENAME}}
6206 !! options
6207 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6208 !! input
6209 {{SUBJECTPAGENAME}}
6210 !! result
6211 <p>User:Ævar Arnfjörð Bjarmason
6212 </p>
6213 !! end
6214
6215 !! test
6216 Magic Word: {{SUBJECTPAGENAMEE}}
6217 !! options
6218 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6219 !! input
6220 {{SUBJECTPAGENAMEE}}
6221 !! result
6222 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6223 </p>
6224 !! end
6225
6226 !! test
6227 Magic Word: {{NUMBEROFFILES}}
6228 !! input
6229 {{NUMBEROFFILES}}
6230 !! result
6231 <p>4
6232 </p>
6233 !! end
6234
6235 !! test
6236 Magic Word: {{PAGENAME}}
6237 !! options
6238 title=[[User:Ævar Arnfjörð Bjarmason]]
6239 !! input
6240 {{PAGENAME}}
6241 !! result
6242 <p>Ævar Arnfjörð Bjarmason
6243 </p>
6244 !! end
6245
6246 !! test
6247 Magic Word: {{PAGENAME}} with metacharacters
6248 !! options
6249 title=[['foo & bar = baz']]
6250 !! input
6251 ''{{PAGENAME}}''
6252 !! result
6253 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
6254 </p>
6255 !! end
6256
6257 !! test
6258 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
6259 !! options
6260 title=[[*RFC 1234 http://example.com/]]
6261 !! input
6262 {{PAGENAME}}
6263 !! result
6264 <p>&#42;RFC&#32;1234 http&#58;//example.com/
6265 </p>
6266 !! end
6267
6268 !! test
6269 Magic Word: {{PAGENAMEE}}
6270 !! options
6271 title=[[User:Ævar Arnfjörð Bjarmason]]
6272 !! input
6273 {{PAGENAMEE}}
6274 !! result
6275 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6276 </p>
6277 !! end
6278
6279 !! test
6280 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
6281 !! options
6282 title=[[*RFC 1234 http://example.com/]]
6283 !! input
6284 {{PAGENAMEE}}
6285 !! result
6286 <p>&#42;RFC_1234_http&#58;//example.com/
6287 </p>
6288 !! end
6289
6290 !! test
6291 Magic Word: {{REVISIONID}}
6292 !! input
6293 {{REVISIONID}}
6294 !! result
6295 <p>1337
6296 </p>
6297 !! end
6298
6299 !! test
6300 Magic Word: {{SCRIPTPATH}}
6301 !! input
6302 {{SCRIPTPATH}}
6303 !! result
6304 <p>/
6305 </p>
6306 !! end
6307
6308 !! test
6309 Magic Word: {{STYLEPATH}}
6310 !! input
6311 {{STYLEPATH}}
6312 !! result
6313 <p>/skins
6314 </p>
6315 !! end
6316
6317 !! test
6318 Magic Word: {{SERVER}}
6319 !! input
6320 {{SERVER}}
6321 !! result
6322 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6323 </p>
6324 !! end
6325
6326 !! test
6327 Magic Word: {{SERVERNAME}}
6328 !! input
6329 {{SERVERNAME}}
6330 !! result
6331 <p>example.org
6332 </p>
6333 !! end
6334
6335 !! test
6336 Magic Word: {{SITENAME}}
6337 !! input
6338 {{SITENAME}}
6339 !! result
6340 <p>MediaWiki
6341 </p>
6342 !! end
6343
6344 !! test
6345 Case-sensitive magic words, when cased differently, should just be template transclusions
6346 !! input
6347 {{CurrentMonth}}
6348 {{currentday}}
6349 {{cURreNTweEK}}
6350 {{currentHour}}
6351 !! result
6352 <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>
6353 <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>
6354 <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>
6355 <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>
6356 </p>
6357 !! end
6358
6359 !! test
6360 Case-insensitive magic words should still work with weird casing.
6361 !! input
6362 {{sErVeRNaMe}}
6363 {{LCFirst:AOEU}}
6364 {{ucFIRST:aoeu}}
6365 {{SERver}}
6366 !! result
6367 <p>example.org
6368 aOEU
6369 Aoeu
6370 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6371 </p>
6372 !! end
6373
6374 !! test
6375 Namespace 1 {{ns:1}}
6376 !! input
6377 {{ns:1}}
6378 !! result
6379 <p>Talk
6380 </p>
6381 !! end
6382
6383 !! test
6384 Namespace 1 {{ns:01}}
6385 !! input
6386 {{ns:01}}
6387 !! result
6388 <p>Talk
6389 </p>
6390 !! end
6391
6392 !! test
6393 Namespace 0 {{ns:0}} (bug 4783)
6394 !! input
6395 {{ns:0}}
6396 !! result
6397
6398 !! end
6399
6400 !! test
6401 Namespace 0 {{ns:00}} (bug 4783)
6402 !! input
6403 {{ns:00}}
6404 !! result
6405
6406 !! end
6407
6408 !! test
6409 Namespace -1 {{ns:-1}}
6410 !! input
6411 {{ns:-1}}
6412 !! result
6413 <p>Special
6414 </p>
6415 !! end
6416
6417 !! test
6418 Namespace User {{ns:User}}
6419 !! input
6420 {{ns:User}}
6421 !! result
6422 <p>User
6423 </p>
6424 !! end
6425
6426 !! test
6427 Namespace User talk {{ns:User_talk}}
6428 !! input
6429 {{ns:User_talk}}
6430 !! result
6431 <p>User talk
6432 </p>
6433 !! end
6434
6435 !! test
6436 Namespace User talk {{ns:uSeR tAlK}}
6437 !! input
6438 {{ns:uSeR tAlK}}
6439 !! result
6440 <p>User talk
6441 </p>
6442 !! end
6443
6444 !! test
6445 Namespace File {{ns:File}}
6446 !! input
6447 {{ns:File}}
6448 !! result
6449 <p>File
6450 </p>
6451 !! end
6452
6453 !! test
6454 Namespace File {{ns:Image}}
6455 !! input
6456 {{ns:Image}}
6457 !! result
6458 <p>File
6459 </p>
6460 !! end
6461
6462 !! test
6463 Namespace (lang=de) Benutzer {{ns:User}}
6464 !! options
6465 language=de
6466 !! input
6467 {{ns:User}}
6468 !! result
6469 <p>Benutzer
6470 </p>
6471 !! end
6472
6473 !! test
6474 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
6475 !! options
6476 language=de
6477 !! input
6478 {{ns:3}}
6479 !! result
6480 <p>Benutzer Diskussion
6481 </p>
6482 !! end
6483
6484
6485 !! test
6486 Urlencode
6487 !! input
6488 {{urlencode:hi world?!}}
6489 {{urlencode:hi world?!|WIKI}}
6490 {{urlencode:hi world?!|PATH}}
6491 {{urlencode:hi world?!|QUERY}}
6492 !! result
6493 <p>hi+world%3F%21
6494 hi_world%3F!
6495 hi%20world%3F%21
6496 hi+world%3F%21
6497 </p>
6498 !! end
6499
6500 ###
6501 ### Magic links
6502 ###
6503 !! test
6504 Magic links: internal link to RFC (bug 479)
6505 !! input
6506 [[RFC 123]]
6507 !! result
6508 <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>
6509 </p>
6510 !! end
6511
6512 !! test
6513 Magic links: RFC (bug 479)
6514 !! input
6515 RFC 822
6516 !! result
6517 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
6518 </p>
6519 !! end
6520
6521 !! test
6522 Magic links: ISBN (bug 1937)
6523 !! input
6524 ISBN 0-306-40615-2
6525 !! result
6526 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
6527 </p>
6528 !! end
6529
6530 !! test
6531 Magic links: PMID incorrectly converts space to underscore
6532 !! input
6533 PMID 1234
6534 !! result
6535 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
6536 </p>
6537 !! end
6538
6539 ###
6540 ### Templates
6541 ####
6542
6543 !! test
6544 Nonexistent template
6545 !! input
6546 {{thistemplatedoesnotexist}}
6547 !! result
6548 <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>
6549 </p>
6550 !! end
6551
6552 !! test
6553 Template with invalid target containing tags
6554 !! input
6555 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6556 !! result
6557 <p>{{a<b>b</b>|foo|a=b|a = b}}
6558 </p>
6559 !! end
6560
6561 !! test
6562 Template with invalid target containing unclosed tag
6563 !! input
6564 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6565 !! result
6566 <p>{{a<b>|foo|a=b|a = b}}</b>
6567 </p>
6568 !! end
6569
6570 !! article
6571 Template:test
6572 !! text
6573 This is a test template
6574 !! endarticle
6575
6576 !! test
6577 Simple template
6578 !! input
6579 {{test}}
6580 !! result
6581 <p>This is a test template
6582 </p>
6583 !! end
6584
6585 !! test
6586 Template with explicit namespace
6587 !! input
6588 {{Template:test}}
6589 !! result
6590 <p>This is a test template
6591 </p>
6592 !! end
6593
6594
6595 !! article
6596 Template:paramtest
6597 !! text
6598 This is a test template with parameter {{{param}}}
6599 !! endarticle
6600
6601 !! test
6602 Template parameter
6603 !! input
6604 {{paramtest|param=foo}}
6605 !! result
6606 <p>This is a test template with parameter foo
6607 </p>
6608 !! end
6609
6610 !! article
6611 Template:paramtestnum
6612 !! text
6613 [[{{{1}}}|{{{2}}}]]
6614 !! endarticle
6615
6616 !! test
6617 Template unnamed parameter
6618 !! input
6619 {{paramtestnum|Main Page|the main page}}
6620 !! result
6621 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
6622 </p>
6623 !! end
6624
6625 !! article
6626 Template:templatesimple
6627 !! text
6628 (test)
6629 !! endarticle
6630
6631 !! article
6632 Template:templateredirect
6633 !! text
6634 #redirect [[Template:templatesimple]]
6635 !! endarticle
6636
6637 !! article
6638 Template:templateasargtestnum
6639 !! text
6640 {{{{{1}}}}}
6641 !! endarticle
6642
6643 !! article
6644 Template:templateasargtest
6645 !! text
6646 {{template{{{templ}}}}}
6647 !! endarticle
6648
6649 !! article
6650 Template:templateasargtest2
6651 !! text
6652 {{{{{templ}}}}}
6653 !! endarticle
6654
6655 !! test
6656 Template with template name as unnamed argument
6657 !! input
6658 {{templateasargtestnum|templatesimple}}
6659 !! result
6660 <p>(test)
6661 </p>
6662 !! end
6663
6664 !! test
6665 Template with template name as argument
6666 !! input
6667 {{templateasargtest|templ=simple}}
6668 !! result
6669 <p>(test)
6670 </p>
6671 !! end
6672
6673 !! test
6674 Template with template name as argument (2)
6675 !! input
6676 {{templateasargtest2|templ=templatesimple}}
6677 !! result
6678 <p>(test)
6679 </p>
6680 !! end
6681
6682 !! article
6683 Template:templateasargtestdefault
6684 !! text
6685 {{{{{templ|templatesimple}}}}}
6686 !! endarticle
6687
6688 !! article
6689 Template:templa
6690 !! text
6691 '''templ'''
6692 !! endarticle
6693
6694 !! test
6695 Template with default value
6696 !! input
6697 {{templateasargtestdefault}}
6698 !! result
6699 <p>(test)
6700 </p>
6701 !! end
6702
6703 !! test
6704 Template with default value (value set)
6705 !! input
6706 {{templateasargtestdefault|templ=templa}}
6707 !! result
6708 <p><b>templ</b>
6709 </p>
6710 !! end
6711
6712 !! test
6713 Template redirect
6714 !! input
6715 {{templateredirect}}
6716 !! result
6717 <p>(test)
6718 </p>
6719 !! end
6720
6721 !! test
6722 Template with argument in separate line
6723 !! input
6724 {{ templateasargtest |
6725 templ = simple }}
6726 !! result
6727 <p>(test)
6728 </p>
6729 !! end
6730
6731 !! test
6732 Template with complex template as argument
6733 !! input
6734 {{paramtest|
6735 param ={{ templateasargtest |
6736 templ = simple }}}}
6737 !! result
6738 <p>This is a test template with parameter (test)
6739 </p>
6740 !! end
6741
6742 !! test
6743 Template with thumb image (with link in description)
6744 !! input
6745 {{paramtest|
6746 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6747 !! result
6748 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>
6749
6750 !! end
6751
6752 !! article
6753 Template:complextemplate
6754 !! text
6755 {{{1}}} {{paramtest|
6756 param ={{{param}}}}}
6757 !! endarticle
6758
6759 !! test
6760 Template with complex arguments
6761 !! input
6762 {{complextemplate|
6763 param ={{ templateasargtest |
6764 templ = simple }}|[[Template:complextemplate|link]]}}
6765 !! result
6766 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6767 </p>
6768 !! end
6769
6770 !! test
6771 BUG 553: link with two variables in a piped link
6772 !! input
6773 {|
6774 |[[{{{1}}}|{{{2}}}]]
6775 |}
6776 !! result
6777 <table>
6778 <tr>
6779 <td>[[{{{1}}}|{{{2}}}]]
6780 </td></tr></table>
6781
6782 !! end
6783
6784 !! test
6785 Magic variable as template parameter
6786 !! input
6787 {{paramtest|param={{SITENAME}}}}
6788 !! result
6789 <p>This is a test template with parameter MediaWiki
6790 </p>
6791 !! end
6792
6793 !! article
6794 Template:linktest
6795 !! text
6796 [[{{{param}}}|link]]
6797 !! endarticle
6798
6799 !! test
6800 Template parameter as link source
6801 !! input
6802 {{linktest|param=Main Page}}
6803 !! result
6804 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
6805 </p>
6806 !! end
6807
6808 !!test
6809 Template-generated attribute string (k='v')
6810 !!input
6811 <span {{attr_str|id|v1}}>bar</span>
6812 !!result
6813 <p><span id="v1">bar</span>
6814 </p>
6815 !!end
6816
6817 !!article
6818 Template:paramtest2
6819 !! text
6820 including another template, {{paramtest|param={{{arg}}}}}
6821 !! endarticle
6822
6823 !! test
6824 Template passing argument to another template
6825 !! input
6826 {{paramtest2|arg='hmm'}}
6827 !! result
6828 <p>including another template, This is a test template with parameter 'hmm'
6829 </p>
6830 !! end
6831
6832 !! article
6833 Template:Linktest2
6834 !! text
6835 Main Page
6836 !! endarticle
6837
6838 !! test
6839 Template as link source
6840 !! input
6841 [[{{linktest2}}]]
6842
6843 [[{{linktest2}}|Main Page]]
6844
6845 [[{{linktest2}}]]Page
6846 !! result
6847 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6848 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6849 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
6850 </p>
6851 !! end
6852
6853
6854 !! article
6855 Template:loop1
6856 !! text
6857 {{loop2}}
6858 !! endarticle
6859
6860 !! article
6861 Template:loop2
6862 !! text
6863 {{loop1}}
6864 !! endarticle
6865
6866 !! test
6867 Template infinite loop
6868 !! input
6869 {{loop1}}
6870 !! result
6871 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
6872 </p>
6873 !! end
6874
6875 !! test
6876 Template from main namespace
6877 !! input
6878 {{:Main Page}}
6879 !! result
6880 <p>blah blah
6881 </p>
6882 !! end
6883
6884 !! article
6885 Template:table
6886 !! text
6887 {|
6888 | 1 || 2
6889 |-
6890 | 3 || 4
6891 |}
6892 !! endarticle
6893
6894 !! test
6895 BUG 529: Template with table, not included at beginning of line
6896 !! input
6897 foo {{table}}
6898 !! result
6899 <p>foo
6900 </p>
6901 <table>
6902 <tr>
6903 <td> 1 </td>
6904 <td> 2
6905 </td></tr>
6906 <tr>
6907 <td> 3 </td>
6908 <td> 4
6909 </td></tr></table>
6910
6911 !! end
6912
6913 !! test
6914 BUG 523: Template shouldn't eat newline (or add an extra one before table)
6915 !! input
6916 foo
6917 {{table}}
6918 !! result
6919 <p>foo
6920 </p>
6921 <table>
6922 <tr>
6923 <td> 1 </td>
6924 <td> 2
6925 </td></tr>
6926 <tr>
6927 <td> 3 </td>
6928 <td> 4
6929 </td></tr></table>
6930
6931 !! end
6932
6933 !! test
6934 BUG 41: Template parameters shown as broken links
6935 !! input
6936 {{{parameter}}}
6937 !! result
6938 <p>{{{parameter}}}
6939 </p>
6940 !! end
6941
6942 !! test
6943 Template with targets containing wikilinks
6944 !! input
6945 {{[[foo]]}}
6946
6947 {{[[{{echo|foo}}]]}}
6948
6949 {{{{echo|[[foo}}]]}}
6950 !! result
6951 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6952 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6953 </p><p>{{[[foo}}]]
6954 </p>
6955 !! end
6956
6957 !! article
6958 Template:MSGNW test
6959 !! text
6960 ''None'' of '''this''' should be
6961 * interpreted
6962 but rather passed unmodified
6963 {{test}}
6964 !! endarticle
6965
6966 # hmm, fix this or just deprecate msgnw and document its behavior?
6967 !! test
6968 msgnw keyword
6969 !! options
6970 disabled
6971 !! input
6972 {{msgnw:MSGNW test}}
6973 !! result
6974 <p>''None'' of '''this''' should be
6975 * interpreted
6976 but rather passed unmodified
6977 {{test}}
6978 </p>
6979 !! end
6980
6981 !! test
6982 int keyword
6983 !! input
6984 {{int:youhavenewmessages|lots of money|not!}}
6985 !! result
6986 <p>You have lots of money (not!).
6987 </p>
6988 !! end
6989
6990 !! article
6991 Template:Includes
6992 !! text
6993 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6994 !! endarticle
6995
6996 !! test
6997 <includeonly> and <noinclude> being included
6998 !! input
6999 {{Includes}}
7000 !! result
7001 <p>Foobar
7002 </p>
7003 !! end
7004
7005 !! article
7006 Template:Includes2
7007 !! text
7008 <onlyinclude>Foo</onlyinclude>bar
7009 !! endarticle
7010
7011 !! test
7012 <onlyinclude> being included
7013 !! input
7014 {{Includes2}}
7015 !! result
7016 <p>Foo
7017 </p>
7018 !! end
7019
7020
7021 !! article
7022 Template:Includes3
7023 !! text
7024 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
7025 !! endarticle
7026
7027 !! test
7028 <onlyinclude> and <includeonly> being included
7029 !! input
7030 {{Includes3}}
7031 !! result
7032 <p>Foo
7033 </p>
7034 !! end
7035
7036 !! test
7037 <includeonly> and <noinclude> on a page
7038 !! input
7039 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
7040 !! result
7041 <p>Foozar
7042 </p>
7043 !! end
7044
7045 !! test
7046 Un-closed <noinclude>
7047 !! input
7048 <noinclude>
7049 !! result
7050 !! end
7051
7052 !! test
7053 <onlyinclude> on a page
7054 !! input
7055 <onlyinclude>Foo</onlyinclude>bar
7056 !! result
7057 <p>Foobar
7058 </p>
7059 !! end
7060
7061 !! test
7062 Un-closed <onlyinclude>
7063 !! input
7064 <onlyinclude>
7065 !! result
7066 !! end
7067
7068 !!test
7069 Self-closed noinclude, includeonly, onlyinclude tags
7070 !!input
7071 <noinclude />
7072 <includeonly />
7073 <onlyinclude />
7074 !!result
7075 <p><br />
7076 </p>
7077 !!end
7078
7079 !!test
7080 Unbalanced includeonly and noinclude tags
7081 !!input
7082 {|
7083 |a</noinclude>
7084 |b</noinclude></noinclude>
7085 |c</noinclude></includeonly>
7086 |d</includeonly></includeonly>
7087 |}
7088 !!result
7089 <table>
7090 <tr>
7091 <td>a
7092 </td>
7093 <td>b
7094 </td>
7095 <td>c&lt;/includeonly&gt;
7096 </td>
7097 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
7098 </td></tr></table>
7099
7100 !!end
7101
7102 !! article
7103 Template:Includeonly section
7104 !! text
7105 <includeonly>
7106 ==Includeonly section==
7107 </includeonly>
7108 ==Section T-1==
7109 !!endarticle
7110
7111 !! test
7112 Bug 6563: Edit link generation for section shown by <includeonly>
7113 !! input
7114 {{includeonly section}}
7115 !! result
7116 <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>
7117 <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>
7118
7119 !! end
7120
7121 # Uses same input as the contents of [[Template:Includeonly section]]
7122 !! test
7123 Bug 6563: Section extraction for section shown by <includeonly>
7124 !! options
7125 section=T-2
7126 !! input
7127 <includeonly>
7128 ==Includeonly section==
7129 </includeonly>
7130 ==Section T-2==
7131 !! result
7132 ==Section T-2==
7133 !! end
7134
7135 !! test
7136 Bug 6563: Edit link generation for section suppressed by <includeonly>
7137 !! input
7138 <includeonly>
7139 ==Includeonly section==
7140 </includeonly>
7141 ==Section 1==
7142 !! result
7143 <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>
7144
7145 !! end
7146
7147 !! test
7148 Bug 6563: Section extraction for section suppressed by <includeonly>
7149 !! options
7150 section=1
7151 !! input
7152 <includeonly>
7153 ==Includeonly section==
7154 </includeonly>
7155 ==Section 1==
7156 !! result
7157 ==Section 1==
7158 !! end
7159
7160 !! test
7161 Un-closed <includeonly>
7162 !! input
7163 <includeonly>
7164 !! result
7165 !! end
7166
7167 # TODO: test with DOM fragment reuse!
7168 !! test
7169 Parsoid: DOM fragment reuse
7170 !! options
7171 parsoid=wt2wt,wt2html
7172 !! input
7173 a{{echo|b<table></table>c}}d
7174
7175 a{{echo|b
7176 <table></table>
7177 c}}d
7178
7179 {{echo|a
7180
7181 <table></table>
7182
7183 b}}
7184 !! result
7185 a<span typeof="mw:Transclusion">b</span>
7186 <table></table><span>c</span>d
7187 <p typeof="mw:Transclusion">ab</p>
7188 <table></table>
7189 <p>cd</p>
7190 <p typeof="mw:Transclusion">a</p>
7191 <table></table>
7192 <p>b</p>
7193 !! end
7194
7195 ###
7196 ### <includeonly> and <noinclude> in attributes
7197 ###
7198 !!test
7199 0. includeonly around the entire attribute
7200 !!input
7201 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
7202 !!result
7203 <p><span id="v2">bar</span>
7204 </p>
7205 !!end
7206
7207 !!test
7208 1. includeonly in html attr key
7209 !!input
7210 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
7211 !!result
7212 <p><span id="foo">bar</span>
7213 </p>
7214 !!end
7215
7216 !!test
7217 2. includeonly in html attr value
7218 !!input
7219 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
7220 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
7221 !!result
7222 <p><span id="v1">bar</span>
7223 <span id="v1">bar</span>
7224 </p>
7225 !!end
7226
7227 !!test
7228 3. includeonly in part of an attr value
7229 !!input
7230 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
7231 !!result
7232 <p><span style="color:red;">bar</span>
7233 </p>
7234 !!end
7235
7236 ###
7237 ### Testing parsing of templates where a template arg
7238 ### has the same name as the template itself.
7239 ###
7240
7241 !! article
7242 Template:quote
7243 !! text
7244 {{{quote|{{{1}}}}}}
7245 !! endarticle
7246
7247 !!test
7248 Templates: Template Name/Arg clash: 1. Use of positional param
7249 !!input
7250 {{quote|foo}}
7251 !!result
7252 <p>foo
7253 </p>
7254 !!end
7255
7256 !!test
7257 Templates: Template Name/Arg clash: 2. Use of named param
7258 !!input
7259 {{quote|quote=foo}}
7260 !!result
7261 <p>foo
7262 </p>
7263 !!end
7264
7265 !!test
7266 Templates: Template Name/Arg clash: 3. Use of named param with empty input
7267 !!input
7268 {{quote|quote}}
7269 !!result
7270 <p>quote
7271 </p>
7272 !!end
7273
7274 ###
7275 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
7276 ###
7277
7278 !!test
7279 Templates: 1. Simple use
7280 !!input
7281 {{echo|Foo}}
7282 !!result
7283 <p>Foo
7284 </p>
7285 !!end
7286
7287 !!test
7288 Templates: 2. Inside a block tag
7289 !!input
7290 <div>{{echo|Foo}}</div>
7291 !!result
7292 <div>Foo</div>
7293
7294 !!end
7295
7296 !!test
7297 Templates: P-wrapping: 1a. Templates on consecutive lines
7298 !!input
7299 {{echo|Foo}}
7300 {{echo|bar}}
7301 !!result
7302 <p>Foo
7303 bar
7304 </p>
7305 !!end
7306
7307 !!test
7308 Templates: P-wrapping: 1b. Templates on consecutive lines
7309 !!input
7310 Foo
7311
7312 {{echo|bar}}
7313 {{echo|baz}}
7314 !!result
7315 <p>Foo
7316 </p><p>bar
7317 baz
7318 </p>
7319 !!end
7320
7321 !!test
7322 Templates: P-wrapping: 1c. Templates on consecutive lines
7323 !!input
7324 {{echo|Foo}}
7325 {{echo|bar}} <div>baz</div>
7326 !!result
7327 <p>Foo
7328 </p>
7329 bar <div>baz</div>
7330
7331 !!end
7332
7333 !!test
7334 Templates: P-wrapping: 1d. Template preceded by comment-only line
7335 !!options
7336 parsoid=wt2html,wt2wt
7337 !!input
7338 <!-- foo -->
7339 {{echo|Bar}}
7340 !!result
7341 <!-- foo -->
7342 <p typeof="mw:Transclusion">Bar
7343 </p>
7344 !!end
7345
7346 !!test
7347 Templates: Inline Text: 1. Multiple tmeplate uses
7348 !!input
7349 {{echo|Foo}}bar{{echo|baz}}
7350 !!result
7351 <p>Foobarbaz
7352 </p>
7353 !!end
7354
7355 !!test
7356 Templates: Inline Text: 2. Back-to-back template uses
7357 !!input
7358 {{echo|Foo}}{{echo|bar}}
7359 !!result
7360 <p>Foobar
7361 </p>
7362 !!end
7363
7364 !!test
7365 Templates: Block Tags: 1. Multiple template uses
7366 !!input
7367 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
7368 !!result
7369 <div>Foo</div><div>bar</div><div>baz</div>
7370
7371 !!end
7372
7373 !!test
7374 Templates: Block Tags: 2. Back-to-back template uses
7375 !!input
7376 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
7377 !!result
7378 <div>Foo</div><div>bar</div>
7379
7380 !!end
7381
7382 !!test
7383 Templates: Links: 1. Simple example
7384 !!input
7385 {{echo|[[Foo|bar]]}}
7386 !!result
7387 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7388 </p>
7389 !!end
7390
7391 !!test
7392 Templates: Links: 2. Generation of link href
7393 !!input
7394 [[{{echo|Foo}}|bar]]
7395 !!result
7396 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7397 </p>
7398 !!end
7399
7400 !!test
7401 Templates: Links: 3. Generation of part of a link href
7402 !!input
7403 [[Fo{{echo|o}}|bar]]
7404
7405 [[Foo{{echo|bar}}]]
7406
7407 [[Foo{{echo|bar}}baz]]
7408
7409 [[Foo{{echo|bar}}|bar]]
7410
7411 [[:Foo{{echo|bar}}]]
7412
7413 [[:Foo{{echo|bar}}|bar]]
7414 !!result
7415 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7416 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7417 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
7418 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7419 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7420 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7421 </p>
7422 !!end
7423
7424 !!test
7425 Templates: Links: 4. Multiple templates generating link href
7426 !!input
7427 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
7428 !!result
7429 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7430 </p>
7431 !!end
7432
7433 !!test
7434 Templates: Links: 5. Generation of link text
7435 !!input
7436 [[Foo|{{echo|bar}}]]
7437 !!result
7438 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7439 </p>
7440 !!end
7441
7442 !!test
7443 Templates: Links: 5. Nested templates (only outermost template should be marked)
7444 !!input
7445 {{echo|[[{{echo|Foo}}|bar]]}}
7446 !!result
7447 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7448 </p>
7449 !!end
7450
7451 !!test
7452 Templates: HTML Tag: 1. Generation of HTML attr. key
7453 !!input
7454 <div {{echo|style}}="color:red;">foo</div>
7455 !!result
7456 <div style="color:red;">foo</div>
7457
7458 !!end
7459
7460 !!test
7461 Templates: HTML Tag: 2. Generation of HTML attr. value
7462 !!input
7463 <div style={{echo|'color:red;'}}>foo</div>
7464 !!result
7465 <div style="color:red;">foo</div>
7466
7467 !!end
7468
7469 !!test
7470 Templates: HTML Tag: 3. Generation of HTML attr key and value
7471 !!input
7472 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
7473 !!result
7474 <div style="color:red;">foo</div>
7475
7476 !!end
7477
7478 !!test
7479 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
7480 !!input
7481 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
7482 !!result
7483 <div title="This is a long title with just one piece templated">foo</div>
7484
7485 !!end
7486
7487 !!test
7488 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
7489 !!input
7490 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
7491 !!result
7492 <div title="This is a long title with just one piece templated">foo</div>
7493
7494 !!end
7495
7496 !!test
7497 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
7498 !!input
7499 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
7500 !!result
7501 <div title="This is a long title with just one piece templated">foo</div>
7502
7503 !!end
7504
7505 !!test
7506 Templates: HTML Tag: 7. Generation of partial attribute key string
7507 !!input
7508 <div st{{echo|yle}}="color:red;">foo</div>
7509 !!result
7510 <div style="color:red;">foo</div>
7511
7512 !!end
7513
7514 !!test
7515 Templates: HTML Tables: 1. Generating start of a HTML table
7516 !!input
7517 {{echo|<table><tr><td>foo</td>}}</tr></table>
7518 !!result
7519 <table><tr><td>foo</td></tr></table>
7520
7521 !!end
7522
7523 !!test
7524 Templates: HTML Tables: 2a. Generating middle of a HTML table
7525 !!input
7526 <table><tr>{{echo|<td>foo</td>}}</tr></table>
7527 !!result
7528 <table><tr><td>foo</td></tr></table>
7529
7530 !!end
7531
7532 !!test
7533 Templates: HTML Tables: 2b. Generating middle of a HTML table
7534 !!input
7535 <table>{{echo|<tr><td>foo</td></tr>}}</table>
7536 !!result
7537 <table><tr><td>foo</td></tr></table>
7538
7539 !!end
7540
7541 !!test
7542 Templates: HTML Tables: 3. Generating end of a HTML table
7543 !!input
7544 <table><tr>{{echo|<td>foo</td></tr></table>}}
7545 !!result
7546 <table><tr><td>foo</td></tr></table>
7547
7548 !!end
7549
7550 !!test
7551 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
7552 !!input
7553 {{echo|<table>}}<tr><td>foo</td></tr></table>
7554 !!result
7555 <table><tr><td>foo</td></tr></table>
7556
7557 !!end
7558
7559 !!test
7560 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
7561 !!input
7562 <table>{{echo|<tr>}}<td>foo</td></tr></table>
7563 !!result
7564 <table><tr><td>foo</td></tr></table>
7565
7566 !!end
7567
7568 !!test
7569 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
7570 !!input
7571 <table><tr>{{echo|<td>}}foo</td></tr></table>
7572 !!result
7573 <table><tr><td>foo</td></tr></table>
7574
7575 !!end
7576
7577 !!test
7578 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
7579 !!input
7580 <table><tr><td>foo{{echo|</td>}}</tr></table>
7581 !!result
7582 <table><tr><td>foo</td></tr></table>
7583
7584 !!end
7585
7586 !!test
7587 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
7588 !!input
7589 <table><tr><td>foo</td>{{echo|</tr>}}</table>
7590 !!result
7591 <table><tr><td>foo</td></tr></table>
7592
7593 !!end
7594
7595 !!test
7596 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
7597 !!input
7598 <table><tr><td>foo</td></tr>{{echo|</table>}}
7599 !!result
7600 <table><tr><td>foo</td></tr></table>
7601
7602 !!end
7603
7604 !!test
7605 Templates: HTML Tables: 5. Proper fostering of categories from inside
7606 !!options
7607 parsoid=wt2html,wt2wt
7608 !!input
7609 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
7610 <!--Two categories (Bug 50330)-->
7611 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
7612 !!result
7613 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
7614 <!--Two categories (Bug 50330)-->
7615 <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>
7616 !!end
7617
7618 !!test
7619 Templates: Wiki Tables: 1a. Fostering of entire template content
7620 !!input
7621 {|
7622 {{echo|a}}
7623 |}
7624 !!result
7625 <table>
7626 a
7627 <tr><td></td></tr></table>
7628
7629 !!end
7630
7631 !!test
7632 Templates: Wiki Tables: 1b. Fostering of entire template content
7633 !!input
7634 {|
7635 {{echo|<div>}}
7636 foo
7637 {{echo|</div>}}
7638 |}
7639 !!result
7640 <table>
7641 <div>
7642 <p>foo
7643 </p>
7644 </div>
7645 <tr><td></td></tr></table>
7646
7647 !!end
7648
7649 !!test
7650 Templates: Wiki Tables: 2. Fostering of partial template content
7651 !!input
7652 {|
7653 {{echo|a
7654 <div>b</div>}}
7655 |}
7656 !!result
7657 <table>
7658 a
7659 <div>b</div>
7660 <tr><td></td></tr></table>
7661
7662 !!end
7663
7664 !!test
7665 Templates: Wiki Tables: 3. td-content via multiple templates
7666 !!input
7667 {|
7668 {{echo|{{pipe}}a}}{{echo|b}}
7669 |}
7670 !!result
7671 <table>
7672 <tr>
7673 <td>ab
7674 </td></tr></table>
7675
7676 !!end
7677
7678 !!test
7679 Templates: Wiki Tables: 4. Templated tags, no content
7680 !!input
7681 {{tbl-start}}
7682 {{tbl-end}}
7683 !!result
7684 <table>
7685 <tr><td></td></tr></table>
7686
7687 !!end
7688
7689 !!test
7690 Templates: Wiki Tables: 5. Templated tags, regular td-tags
7691 !!input
7692 {{tbl-start}}
7693 |foo
7694 {{tbl-end}}
7695 !!result
7696 <table>
7697 <tr>
7698 <td>foo
7699 </td></tr></table>
7700
7701 !!end
7702
7703 !!test
7704 Templates: Wiki Tables: 6. Templated tags, templated td-tags
7705 !!input
7706 {{tbl-start}}
7707 {{!}}foo
7708 {{tbl-end}}
7709 !!result
7710 <table>
7711 <tr>
7712 <td>foo
7713 </td></tr></table>
7714
7715 !!end
7716
7717 !!test
7718 Templates: Lists: Multi-line list-items via templates
7719 !!input
7720 *{{echo|a {{nonexistent|
7721 unused}}}}
7722 *{{echo|b {{nonexistent|
7723 unused}}}}
7724 !!result
7725 <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>
7726 </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>
7727 </li></ul>
7728
7729 !!end
7730
7731 !!test
7732 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
7733 !!input
7734 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
7735 !!result
7736 <p><i>ab</i>c<i>d</i>e
7737 </p>
7738 !!end
7739
7740 !!test
7741 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7742 (PHP parser generates misnested html)
7743 !! options
7744 parsoid=wt2html,wt2wt
7745 !!input
7746 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
7747 !!result
7748 <p><span typeof="mw:Transclusion"><i>a</i></span><i typeof="mw:Transclusion"><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
7749 !!end
7750
7751 !!test
7752 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
7753 (PHP parser generates misnested html)
7754 !! options
7755 parsoid=wt2html,wt2wt
7756 !!input
7757 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
7758 !!result
7759 <div typeof="mw:Transclusion"><i>a</i></div>
7760 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
7761 <div typeof="mw:Transclusion">e</div>
7762 !!end
7763
7764 !!test
7765 Templates: Ugly nesting: 4. Divs opened/closed across templates
7766 !!input
7767 a<div>b{{echo|c</div>d}}e
7768 !!result
7769 a<div>bc</div>de
7770
7771 !!end
7772
7773 !!test
7774 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
7775 (Parsoid-centric)
7776 !! options
7777 parsoid
7778 !!input
7779 {|
7780 |{{echo|foo</table>}}
7781 |bar
7782 |}
7783 !!result
7784 <table typeof="mw:Transclusion">
7785 <tbody>
7786 <tr>
7787 <td>foo</td></tr></tbody></table><span>bar</span>
7788 !!end
7789
7790 !!test
7791 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
7792 (Parsoid-centric)
7793 !! options
7794 parsoid
7795 !!input
7796 <table>
7797 <tr>
7798 <td>
7799 <table>
7800 <tr>
7801 <td>1. {{echo|foo </table>}}</td>
7802 <td> bar </td>
7803 <td>2. {{echo|baz </table>}}</td>
7804 </tr>
7805 <tr>
7806 <td>abc</td>
7807 </tr>
7808 </table>
7809 </td>
7810 </tr>
7811 <tr>
7812 <td>xyz</td>
7813 </tr>
7814 </table>
7815 !!result
7816 <table about="#mwt1" typeof="mw:Transclusion">
7817 <tbody><tr >
7818 <td >
7819 <table >
7820 <tbody><tr >
7821 <td >1. foo </td></tr></tbody></table></td>
7822 <td > bar </td>
7823 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
7824 </span><span about="#mwt1">
7825
7826 abc</span><span about="#mwt1">
7827 </span><span about="#mwt1">
7828 </span><span about="#mwt1">
7829 </span><span about="#mwt1">
7830 </span><span about="#mwt1">
7831
7832 xyz</span><span about="#mwt1">
7833 </span><span about="#mwt1">
7834 </span>
7835 !!end
7836
7837 !! test
7838 Templates: Ugly templates: 3. newline-only template parameter
7839 !! input
7840 foo {{echo|
7841 }}
7842 !! result
7843 <p>foo
7844 </p>
7845 !! end
7846
7847 # This looks like a bug: a single newline triggers p/br for some reason.
7848 !! test
7849 Templates: Ugly templates: 4. newline-only template parameter inconsistency
7850 !! input
7851 {{echo|
7852 }}
7853 !! result
7854 <p><br />
7855 </p>
7856 !! end
7857
7858
7859 !!test
7860 Parser Functions: 1. Simple example
7861 !!input
7862 {{uc:foo}}
7863 !!result
7864 <p>FOO
7865 </p>
7866 !!end
7867
7868 !!test
7869 Parser Functions: 2. Nested use (only outermost should be marked up)
7870 !!input
7871 {{uc:{{lc:FOO}}}}
7872 !!result
7873 <p>FOO
7874 </p>
7875 !!end
7876
7877 ###
7878 ### Pre-save transform tests
7879 ###
7880 !! test
7881 pre-save transform: subst:
7882 !! options
7883 PST
7884 !! input
7885 {{subst:test}}
7886 !! result
7887 This is a test template
7888 !! end
7889
7890 !! test
7891 pre-save transform: normal template
7892 !! options
7893 PST
7894 !! input
7895 {{test}}
7896 !! result
7897 {{test}}
7898 !! end
7899
7900 !! test
7901 pre-save transform: nonexistent template
7902 !! options
7903 PST
7904 !! input
7905 {{thistemplatedoesnotexist}}
7906 !! result
7907 {{thistemplatedoesnotexist}}
7908 !! end
7909
7910
7911 !! test
7912 pre-save transform: subst magic variables
7913 !! options
7914 PST
7915 !! input
7916 {{subst:SITENAME}}
7917 !! result
7918 MediaWiki
7919 !! end
7920
7921 # This is bug 89, which I fixed. -- wtm
7922 !! test
7923 pre-save transform: subst: templates with parameters
7924 !! options
7925 pst
7926 !! input
7927 {{subst:paramtest|param="something else"}}
7928 !! result
7929 This is a test template with parameter "something else"
7930 !! end
7931
7932 !! article
7933 Template:nowikitest
7934 !! text
7935 <nowiki>'''not wiki'''</nowiki>
7936 !! endarticle
7937
7938 !! test
7939 pre-save transform: nowiki in subst (bug 1188)
7940 !! options
7941 pst
7942 !! input
7943 {{subst:nowikitest}}
7944 !! result
7945 <nowiki>'''not wiki'''</nowiki>
7946 !! end
7947
7948
7949 !! article
7950 Template:commenttest
7951 !! text
7952 This template has <!-- a comment --> in it.
7953 !! endarticle
7954
7955 !! test
7956 pre-save transform: comment in subst (bug 1936)
7957 !! options
7958 pst
7959 !! input
7960 {{subst:commenttest}}
7961 !! result
7962 This template has <!-- a comment --> in it.
7963 !! end
7964
7965 !! test
7966 pre-save transform: unclosed tag
7967 !! options
7968 pst noxml
7969 !! input
7970 <nowiki>'''not wiki'''
7971 !! result
7972 <nowiki>'''not wiki'''
7973 !! end
7974
7975 !! test
7976 pre-save transform: mixed tag case
7977 !! options
7978 pst noxml
7979 !! input
7980 <NOwiki>'''not wiki'''</noWIKI>
7981 !! result
7982 <NOwiki>'''not wiki'''</noWIKI>
7983 !! end
7984
7985 !! test
7986 pre-save transform: unclosed comment in <nowiki>
7987 !! options
7988 pst noxml
7989 !! input
7990 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7991 !! result
7992 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7993 !!end
7994
7995 # Leading @ in this template definition works around a limitation
7996 # in parsoid's parserTests which otherwise strips the <span> from the
7997 # result (confusing it for a template wrapper)
7998 !! article
7999 Template:dangerous
8000 !!text
8001 @<span onmouseover="alert('crap')">Oh no</span>
8002 !!endarticle
8003
8004 !!test
8005 (confirming safety of fix for subst bug 1936)
8006 !! input
8007 {{Template:dangerous}}
8008 !! result
8009 <p>@<span>Oh no</span>
8010 </p>
8011 !! end
8012
8013 !! test
8014 pre-save transform: comment containing gallery (bug 5024)
8015 !! options
8016 pst
8017 !! input
8018 <!-- <gallery>data</gallery> -->
8019 !!result
8020 <!-- <gallery>data</gallery> -->
8021 !!end
8022
8023 !! test
8024 pre-save transform: comment containing extension
8025 !! options
8026 pst
8027 !! input
8028 <!-- <tag>data</tag> -->
8029 !!result
8030 <!-- <tag>data</tag> -->
8031 !!end
8032
8033 !! test
8034 pre-save transform: comment containing nowiki
8035 !! options
8036 pst
8037 !! input
8038 <!-- <nowiki>data</nowiki> -->
8039 !!result
8040 <!-- <nowiki>data</nowiki> -->
8041 !!end
8042
8043 !! test
8044 pre-save transform: <noinclude> in subst (bug 3298)
8045 !! options
8046 pst
8047 !! input
8048 {{subst:Includes}}
8049 !! result
8050 Foobar
8051 !! end
8052
8053 !! test
8054 pre-save transform: <onlyinclude> in subst (bug 3298)
8055 !! options
8056 pst
8057 !! input
8058 {{subst:Includes2}}
8059 !! result
8060 Foo
8061 !! end
8062
8063 !! article
8064 Template:SubstTest
8065 !!text
8066 {{<includeonly>subst:</includeonly>Includes}}
8067 !! endarticle
8068
8069 !! article
8070 Template:SafeSubstTest
8071 !! text
8072 {{<includeonly>safesubst:</includeonly>Includes}}
8073 !! endarticle
8074
8075 !! test
8076 bug 22297: safesubst: works during PST
8077 !! options
8078 pst
8079 !! input
8080 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
8081 !! result
8082 FoobarFoobar
8083 !! end
8084
8085 !! test
8086 bug 22297: safesubst: works during normal parse
8087 !! input
8088 {{SafeSubstTest}}
8089 !! result
8090 <p>Foobar
8091 </p>
8092 !! end
8093
8094 !! test:
8095 subst: does not work during normal parse
8096 !! input
8097 {{SubstTest}}
8098 !! result
8099 <p>{{subst:Includes}}
8100 </p>
8101 !! end
8102
8103 !! test
8104 pre-save transform: context links ("pipe trick")
8105 !! options
8106 pst
8107 !! input
8108 [[Article (context)|]]
8109 [[Bar:Article|]]
8110 [[:Bar:Article|]]
8111 [[Bar:Article (context)|]]
8112 [[:Bar:Article (context)|]]
8113 [[|Article]]
8114 [[|Article (context)]]
8115 [[Bar:X (Y) Z|]]
8116 [[:Bar:X (Y) Z|]]
8117 !! result
8118 [[Article (context)|Article]]
8119 [[Bar:Article|Article]]
8120 [[:Bar:Article|Article]]
8121 [[Bar:Article (context)|Article]]
8122 [[:Bar:Article (context)|Article]]
8123 [[Article]]
8124 [[Article (context)]]
8125 [[Bar:X (Y) Z|X (Y) Z]]
8126 [[:Bar:X (Y) Z|X (Y) Z]]
8127 !! end
8128
8129 !! test
8130 pre-save transform: context links ("pipe trick") with interwiki prefix
8131 !! options
8132 pst
8133 !! input
8134 [[interwiki:Article|]]
8135 [[:interwiki:Article|]]
8136 [[interwiki:Bar:Article|]]
8137 [[:interwiki:Bar:Article|]]
8138 !! result
8139 [[interwiki:Article|Article]]
8140 [[:interwiki:Article|Article]]
8141 [[interwiki:Bar:Article|Bar:Article]]
8142 [[:interwiki:Bar:Article|Bar:Article]]
8143 !! end
8144
8145 !! test
8146 pre-save transform: context links ("pipe trick") with parens in title
8147 !! options
8148 pst title=[[Somearticle (context)]]
8149 !! input
8150 [[|Article]]
8151 !! result
8152 [[Article (context)|Article]]
8153 !! end
8154
8155 !! test
8156 pre-save transform: context links ("pipe trick") with comma in title
8157 !! options
8158 pst title=[[Someplace, Somewhere]]
8159 !! input
8160 [[|Otherplace]]
8161 [[Otherplace, Elsewhere|]]
8162 [[Otherplace, Elsewhere, Anywhere|]]
8163 !! result
8164 [[Otherplace, Somewhere|Otherplace]]
8165 [[Otherplace, Elsewhere|Otherplace]]
8166 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
8167 !! end
8168
8169 !! test
8170 pre-save transform: context links ("pipe trick") with parens and comma
8171 !! options
8172 pst title=[[Someplace (IGNORED), Somewhere]]
8173 !! input
8174 [[|Otherplace]]
8175 [[Otherplace (place), Elsewhere|]]
8176 !! result
8177 [[Otherplace, Somewhere|Otherplace]]
8178 [[Otherplace (place), Elsewhere|Otherplace]]
8179 !! end
8180
8181 !! test
8182 pre-save transform: context links ("pipe trick") with comma and parens
8183 !! options
8184 pst title=[[Who, me? (context)]]
8185 !! input
8186 [[|Yes, you.]]
8187 [[Me, Myself, and I (1937 song)|]]
8188 !! result
8189 [[Yes, you. (context)|Yes, you.]]
8190 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
8191 !! end
8192
8193 !! test
8194 pre-save transform: context links ("pipe trick") with namespace
8195 !! options
8196 pst title=[[Ns:Somearticle]]
8197 !! input
8198 [[|Article]]
8199 !! result
8200 [[Ns:Article|Article]]
8201 !! end
8202
8203 !! test
8204 pre-save transform: context links ("pipe trick") with namespace and parens
8205 !! options
8206 pst title=[[Ns:Somearticle (context)]]
8207 !! input
8208 [[|Article]]
8209 !! result
8210 [[Ns:Article (context)|Article]]
8211 !! end
8212
8213 !! test
8214 pre-save transform: context links ("pipe trick") with namespace and comma
8215 !! options
8216 pst title=[[Ns:Somearticle, Context, Whatever]]
8217 !! input
8218 [[|Article]]
8219 !! result
8220 [[Ns:Article, Context, Whatever|Article]]
8221 !! end
8222
8223 !! test
8224 pre-save transform: context links ("pipe trick") with namespace, comma and parens
8225 !! options
8226 pst title=[[Ns:Somearticle, Context (context)]]
8227 !! input
8228 [[|Article]]
8229 !! result
8230 [[Ns:Article (context)|Article]]
8231 !! end
8232
8233 !! test
8234 pre-save transform: context links ("pipe trick") with namespace, parens and comma
8235 !! options
8236 pst title=[[Ns:Somearticle (IGNORED), Context]]
8237 !! input
8238 [[|Article]]
8239 !! result
8240 [[Ns:Article, Context|Article]]
8241 !! end
8242
8243 !! test
8244 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
8245 !! options
8246 pst
8247 !! input
8248 [[Article(context)|]]
8249 [[Bar:Article(context)|]]
8250 [[:Bar:Article(context)|]]
8251 [[|Article(context)]]
8252 [[Bar:X(Y)Z|]]
8253 [[:Bar:X(Y)Z|]]
8254 !! result
8255 [[Article(context)|Article]]
8256 [[Bar:Article(context)|Article]]
8257 [[:Bar:Article(context)|Article]]
8258 [[Article(context)]]
8259 [[Bar:X(Y)Z|X(Y)Z]]
8260 [[:Bar:X(Y)Z|X(Y)Z]]
8261 !! end
8262
8263 !! test
8264 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
8265 !! options
8266 pst
8267 !! input
8268 [[Article (context)|]]
8269 [[Bar:Article (context)|]]
8270 [[:Bar:Article (context)|]]
8271 [[|Article (context)]]
8272 [[Bar:X (Y) Z|]]
8273 [[:Bar:X (Y) Z|]]
8274 !! result
8275 [[Article (context)|Article]]
8276 [[Bar:Article (context)|Article]]
8277 [[:Bar:Article (context)|Article]]
8278 [[Article (context)]]
8279 [[Bar:X (Y) Z|X (Y) Z]]
8280 [[:Bar:X (Y) Z|X (Y) Z]]
8281 !! end
8282
8283 !! test
8284 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
8285 !! options
8286 pst
8287 !! input
8288 [[Article(context)|]]
8289 [[Bar:Article(context)|]]
8290 [[:Bar:Article(context)|]]
8291 [[|Article(context)]]
8292 [[Bar:X(Y)Z|]]
8293 [[:Bar:X(Y)Z|]]
8294 !! result
8295 [[Article(context)|Article]]
8296 [[Bar:Article(context)|Article]]
8297 [[:Bar:Article(context)|Article]]
8298 [[Article(context)]]
8299 [[Bar:X(Y)Z|X(Y)Z]]
8300 [[:Bar:X(Y)Z|X(Y)Z]]
8301 !! end
8302
8303 !! test
8304 pre-save transform: context links ("pipe trick") with commas (bug 21660)
8305 !! options
8306 pst
8307 !! input
8308 [[Article (context), context|]]
8309 [[Article (context),context|]]
8310 [[Bar:Article (context), context|]]
8311 [[Bar:Article (context),context|]]
8312 [[:Bar:Article (context), context|]]
8313 [[:Bar:Article (context),context|]]
8314 !! result
8315 [[Article (context), context|Article]]
8316 [[Article (context),context|Article]]
8317 [[Bar:Article (context), context|Article]]
8318 [[Bar:Article (context),context|Article]]
8319 [[:Bar:Article (context), context|Article]]
8320 [[:Bar:Article (context),context|Article]]
8321 !! end
8322
8323 !! test
8324 pre-save transform: trim trailing empty lines
8325 !! options
8326 pst
8327 !! input
8328 Empty lines are trimmed
8329
8330
8331
8332
8333 !! result
8334 Empty lines are trimmed
8335 !! end
8336
8337 !! test
8338 pre-save transform: Signature expansion
8339 !! options
8340 pst
8341 !! input
8342 * ~~~
8343 * <noinclude>~~~</noinclude>
8344 * <includeonly>~~~</includeonly>
8345 * <onlyinclude>~~~</onlyinclude>
8346 !! result
8347 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
8348 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
8349 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
8350 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
8351 !! end
8352
8353
8354 !! test
8355 pre-save transform: Signature expansion in nowiki tags (bug 93)
8356 !! options
8357 pst disabled
8358 !! input
8359 Shall not expand:
8360
8361 <nowiki>~~~~</nowiki>
8362
8363 <includeonly><nowiki>~~~~</nowiki></includeonly>
8364
8365 <noinclude><nowiki>~~~~</nowiki></noinclude>
8366
8367 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8368
8369 {{subst:Foo}} shall be converted to FOO
8370
8371 As well as inside noinclude/onlyinclude
8372 <noinclude>{{subst:Foo}}</noinclude>
8373 <onlyinclude>{{subst:Foo}}</onlyinclude>
8374
8375 But not inside includeonly
8376 <includeonly>{{subst:Foo}}</includeonly>
8377 !! result
8378 Shall not expand:
8379
8380 <nowiki>~~~~</nowiki>
8381
8382 <includeonly><nowiki>~~~~</nowiki></includeonly>
8383
8384 <noinclude><nowiki>~~~~</nowiki></noinclude>
8385
8386 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8387
8388 FOO shall be converted to FOO
8389
8390 As well as inside noinclude/onlyinclude
8391 <noinclude>FOO</noinclude>
8392 <onlyinclude>FOO</onlyinclude>
8393
8394 But not inside includeonly
8395 <includeonly>{{subst:Foo}}</includeonly>
8396 !! end
8397
8398 !! test
8399 Parsoid: Recognize nowiki with trailing space in tags
8400 !! options
8401 parsoid=wt2html
8402 !! input
8403 <nowiki ><div>[[foo]]</nowiki >
8404
8405 a<nowiki / >b
8406
8407 c<nowiki />d
8408
8409 e<nowiki/ >f
8410 !! result
8411 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8412 <p>ab</p>
8413 <p>cd</p>
8414 <p>ef</p>
8415 !! end
8416
8417 !! test
8418 Parsoid: Recognize nowiki with odd capitalization
8419 !! options
8420 parsoid=wt2html
8421 !! input
8422 <noWikI ><div>[[foo]]</Nowiki >
8423 !! result
8424 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8425 !! end
8426
8427
8428 !! test
8429 Parsoid: Escape nowiki with trailing space in tags
8430 !! options
8431 parsoid=html2wt
8432 !! input
8433 &lt;nowiki &gt; foo &lt;/nowiki &gt;
8434
8435 a&lt;nowiki /&gt;b
8436
8437 c&lt;nowiki/ &gt;d
8438 !! result
8439 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
8440 <p>a&lt;nowiki /&gt;b</p>
8441 <p>c&lt;nowiki/ &gt;d</p>
8442 !! end
8443
8444 !! test
8445 Parsoid: Escape weird noWikI capitalizations
8446 !! options
8447 parsoid=html2wt
8448 !! input
8449 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
8450 !! result
8451 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
8452 !! end
8453
8454 ###
8455 ### Message transform tests
8456 ###
8457 !! test
8458 message transform: magic variables
8459 !! options
8460 msg
8461 !! input
8462 {{SITENAME}}
8463 !! result
8464 MediaWiki
8465 !! end
8466
8467 !! test
8468 message transform: should not transform wiki markup
8469 !! options
8470 msg
8471 !! input
8472 ''test''
8473 !! result
8474 ''test''
8475 !! end
8476
8477 !! test
8478 message transform: <noinclude> in transcluded template (bug 4926)
8479 !! options
8480 msg
8481 !! input
8482 {{Includes}}
8483 !! result
8484 Foobar
8485 !! end
8486
8487 !! test
8488 message transform: <onlyinclude> in transcluded template (bug 4926)
8489 !! options
8490 msg
8491 !! input
8492 {{Includes2}}
8493 !! result
8494 Foo
8495 !! end
8496
8497 !! test
8498 {{#special:}} page name, known
8499 !! options
8500 msg
8501 !! input
8502 {{#special:Recentchanges}}
8503 !! result
8504 Special:RecentChanges
8505 !! end
8506
8507 !! test
8508 {{#special:}} page name with subpage, known
8509 !! options
8510 msg
8511 !! input
8512 {{#special:Recentchanges/param}}
8513 !! result
8514 Special:RecentChanges/param
8515 !! end
8516
8517 !! test
8518 {{#special:}} page name, unknown
8519 !! options
8520 msg
8521 !! input
8522 {{#special:foobar nonexistent}}
8523 !! result
8524 Special:Foobar nonexistent
8525 !! end
8526
8527 !! test
8528 {{#speciale:}} page name, known
8529 !! options
8530 msg
8531 !! input
8532 {{#speciale:Recentchanges}}
8533 !! result
8534 Special:RecentChanges
8535 !! end
8536
8537 !! test
8538 {{#speciale:}} page name with subpage, known
8539 !! options
8540 msg
8541 !! input
8542 {{#speciale:Recentchanges/param}}
8543 !! result
8544 Special:RecentChanges/param
8545 !! end
8546
8547 !! test
8548 {{#speciale:}} page name, unknown
8549 !! options
8550 msg
8551 !! input
8552 {{#speciale:foobar nonexistent}}
8553 !! result
8554 Special:Foobar_nonexistent
8555 !! end
8556
8557 ###
8558 ### Images
8559 ###
8560 ### For Parsoid-specific tests, see
8561 #### http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8562
8563 !! test
8564 Simple image (php)
8565 !! options
8566 php
8567 !! input
8568 [[Image:foobar.jpg]]
8569 !! result
8570 <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>
8571 </p>
8572 !! end
8573
8574 !! test
8575 Simple image (parsoid)
8576 !! options
8577 parsoid=wt2html
8578 !! input
8579 [[Image:foobar.jpg]]
8580 !! result
8581 <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>
8582 </p>
8583 !! end
8584
8585 !! test
8586 Simple image (using File: namespace, now canonical) (php)
8587 !! options
8588 php
8589 !! input
8590 [[File:foobar.jpg]]
8591 !! result
8592 <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>
8593 </p>
8594 !! end
8595
8596 !! test
8597 Simple image (using File: namespace, now canonical) (parsoid)
8598 !! options
8599 parsoid
8600 !! input
8601 [[File:Foobar.jpg]]
8602 !! result
8603 <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>
8604 </p>
8605 !! end
8606
8607 !! test
8608 Right-aligned image (php)
8609 !! options
8610 php
8611 !! input
8612 [[Image:foobar.jpg|right]]
8613 !! result
8614 <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>
8615
8616 !! end
8617
8618 !! test
8619 Right-aligned image (parsoid)
8620 !! options
8621 parsoid
8622 !! input
8623 [[File:Foobar.jpg|right]]
8624 !! result
8625 <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>
8626 !! end
8627
8628 !! test
8629 Image with caption (php)
8630 !! options
8631 php
8632 !! input
8633 [[File:Foobar.jpg|right|Caption text]]
8634 !! result
8635 <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>
8636
8637 !! end
8638
8639 !! test
8640 Image with caption (parsoid)
8641 !! options
8642 parsoid
8643 !! input
8644 [[File:Foobar.jpg|right|Caption text]]
8645 !! result
8646 <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>
8647 !! end
8648
8649 !! test
8650 Image with empty attribute (php)
8651 !! options
8652 php
8653 !! input
8654 [[File:Foobar.jpg|right||Caption text]]
8655 !! result
8656 <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>
8657
8658 !! end
8659
8660 !! test
8661 Image with empty attribute (parsoid)
8662 !! options
8663 parsoid=wt2html
8664 !! input
8665 [[File:Foobar.jpg|right||Caption text]]
8666 !! result
8667 <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>
8668 !! end
8669
8670 !! test
8671 Image with attributes from template (php)
8672 !! options
8673 php
8674 !! input
8675 [[File:Foobar.jpg|{{image_attribs}}]]
8676 !! result
8677 <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>
8678
8679 !! end
8680
8681 !! test
8682 Image with attributes from template (parsoid)
8683 !! options
8684 parsoid
8685 !! input
8686 [[File:Foobar.jpg|{{image_attribs}}]]
8687 !! result
8688 <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>
8689 !! end
8690
8691 !! test
8692 Image with link tails (php)
8693 !! options
8694 php
8695 !! input
8696 123[[File:Foobar.jpg]]456
8697 123[[File:Foobar.jpg|right]]456
8698 123[[File:Foobar.jpg|thumb]]456
8699 !! result
8700 <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
8701 </p>
8702 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
8703 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
8704
8705 !! end
8706
8707 !! test
8708 Image with link tails (parsoid)
8709 !! options
8710 parsoid
8711 !! input
8712 123[[File:Foobar.jpg]]456
8713 123[[File:Foobar.jpg|right]]456
8714 123[[File:Foobar.jpg|thumb]]456
8715 !! result
8716 <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>
8717 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
8718 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
8719 !! end
8720
8721 !! test
8722 Image with multiple captions -- only last one is accepted (php)
8723 !! options
8724 php
8725 !! input
8726 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8727 !! result
8728 <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>
8729
8730 !! end
8731
8732 !! test
8733 Image with multiple captions -- only last one is accepted (parsoid)
8734 !! options
8735 parsoid
8736 !! input
8737 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8738 !! result
8739 <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>
8740 !! end
8741
8742 !! test
8743 Image with width attribute at different positions (php)
8744 !! options
8745 php
8746 !! input
8747 [[File:Foobar.jpg|200px|right|Caption]]
8748 [[File:Foobar.jpg|right|200px|Caption]]
8749 [[File:Foobar.jpg|right|Caption|200px]]
8750 !! result
8751 <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>
8752 <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>
8753 <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>
8754
8755 !! end
8756
8757 !! test
8758 Image with width attribute at different positions (parsoid)
8759 !! options
8760 parsoid
8761 !! input
8762 [[File:Foobar.jpg|200px|right|Caption]]
8763 [[File:Foobar.jpg|right|200px|Caption]]
8764 [[File:Foobar.jpg|right|Caption|200px]]
8765 !! result
8766 <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>
8767 <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>
8768 <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>
8769 !! end
8770
8771 !! test
8772 Image with link parameter, wiki target (php)
8773 !! options
8774 php
8775 !! input
8776 [[File:Foobar.jpg|link=Main Page]]
8777 !! result
8778 <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>
8779 </p>
8780 !! end
8781
8782 !! test
8783 Image with link parameter, wiki target (parsoid)
8784 !! options
8785 parsoid
8786 !! input
8787 [[File:Foobar.jpg|link=Main Page]]
8788 !! result
8789 <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>
8790 !! end
8791
8792 !! test
8793 Image with link parameter, URL target (php)
8794 !! options
8795 php
8796 !! input
8797 [[File:Foobar.jpg|link=http://example.com/]]
8798 !! result
8799 <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>
8800 </p>
8801 !! end
8802
8803 # parsoid bug 49293 (part 1)
8804 !! test
8805 Image with link parameter, URL target (parsoid)
8806 !! options
8807 parsoid
8808 !! input
8809 [[File:Foobar.jpg|link=http://example.com/]]
8810 !! result
8811 <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>
8812 !! end
8813
8814 !! test
8815 Image with link parameter, protocol-less URL target (php)
8816 !! options
8817 php
8818 !! input
8819 [[File:Foobar.jpg|link=//example.com/]]
8820 !! result
8821 <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>
8822 </p>
8823 !! end
8824
8825 # parsoid bug 49293 (part 2)
8826 !! test
8827 Image with link parameter, protocol-less URL target (parsoid)
8828 !! options
8829 parsoid
8830 !! input
8831 [[File:Foobar.jpg|link=//example.com/]]
8832 !! result
8833 <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>
8834 !! end
8835
8836 !! test
8837 Image with link parameter, wgExternalLinkTarget
8838 !! input
8839 [[Image:foobar.jpg|link=http://example.com/]]
8840 !! config
8841 wgExternalLinkTarget='foobar'
8842 !! result
8843 <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>
8844 </p>
8845 !! end
8846
8847 !! test
8848 Image with link parameter, wgNoFollowLinks set to false
8849 !! input
8850 [[Image:foobar.jpg|link=http://example.com/]]
8851 !! config
8852 wgNoFollowLinks=false
8853 !! result
8854 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8855 </p>
8856 !! end
8857
8858 !! test
8859 Image with link parameter, wgNoFollowDomainExceptions
8860 !! input
8861 [[Image:foobar.jpg|link=http://example.com/]]
8862 !! config
8863 wgNoFollowDomainExceptions='example.com'
8864 !! result
8865 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8866 </p>
8867 !! end
8868
8869 !! test
8870 Image with link parameter, wgExternalLinkTarget, unnamed parameter
8871 !! input
8872 [[Image:foobar.jpg|link=http://example.com/|Title]]
8873 !! config
8874 wgExternalLinkTarget='foobar'
8875 !! result
8876 <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>
8877 </p>
8878 !! end
8879
8880 !! test
8881 Image with empty link parameter (php)
8882 !! options
8883 php
8884 !! input
8885 [[File:Foobar.jpg|link=]]
8886 !! result
8887 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
8888 </p>
8889 !! end
8890
8891 !! test
8892 Image with empty link parameter (parsoid)
8893 !! options
8894 parsoid
8895 !! input
8896 [[File:Foobar.jpg|link=]]
8897 !! result
8898 <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>
8899 !! end
8900
8901 !! test
8902 Image with link parameter (wiki target) and unnamed parameter (php)
8903 !! options
8904 php
8905 !! input
8906 [[File:Foobar.jpg|link=Main Page|Title]]
8907 !! result
8908 <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>
8909 </p>
8910 !! end
8911
8912 !! test
8913 Image with link parameter (wiki target) and unnamed parameter (parsoid)
8914 !! options
8915 parsoid
8916 !! input
8917 [[File:Foobar.jpg|link=Main Page|Title]]
8918 !! result
8919 <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>
8920 !! end
8921
8922 !! test
8923 Image with link parameter (URL target) and unnamed parameter (php)
8924 !! options
8925 php
8926 !! input
8927 [[File:Foobar.jpg|link=http://example.com/|Title]]
8928 !! result
8929 <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>
8930 </p>
8931 !! end
8932
8933 !! test
8934 Image with link parameter (URL target) and unnamed parameter (parsoid)
8935 !! options
8936 parsoid
8937 !! input
8938 [[File:Foobar.jpg|link=http://example.com/|Title]]
8939 !! result
8940 <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>
8941 !! end
8942
8943 !! test
8944 Thumbnail image with link parameter
8945 !! options
8946 php
8947 !! input
8948 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
8949 !! result
8950 <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>
8951
8952 !! end
8953
8954 !! test
8955 Manually-specified thumbnail image
8956 !! options
8957 php
8958 !! input
8959 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
8960 !! result
8961 <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>
8962
8963 !! end
8964
8965 !! test
8966 Manually-specified thumbnail image with explicit link to wiki page
8967 !! options
8968 php
8969 !! input
8970 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
8971 !! result
8972 <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>
8973
8974 !! end
8975
8976 !! test
8977 Manually-specified thumbnail image with explicit link to url
8978 !! options
8979 php
8980 !! input
8981 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
8982 !! result
8983 <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>
8984
8985 !! end
8986
8987 !! test
8988 Manually-specified thumbnail image with explicit no link
8989 !! options
8990 php
8991 !! input
8992 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
8993 !! result
8994 <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>
8995
8996 !! end
8997
8998 !! test
8999 Manually-specified thumbnail image with explicit link and alt text
9000 !! options
9001 php
9002 !! input
9003 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
9004 !! result
9005 <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>
9006
9007 !! end
9008
9009 !! test
9010 Image with frame and link
9011 !! input
9012 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
9013 !! result
9014 <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>
9015
9016 !! end
9017
9018 !! test
9019 Image with frame and link and explicit alt
9020 !! input
9021 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
9022 !! result
9023 <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>
9024
9025 !! end
9026
9027 !! test
9028 Image with wiki markup in implicit alt
9029 !! input
9030 [[Image:Foobar.jpg|testing '''bold''' in alt]]
9031 !! result
9032 <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>
9033 </p>
9034 !! end
9035
9036 !! test
9037 Image with wiki markup in explicit alt
9038 !! input
9039 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
9040 !! result
9041 <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>
9042 </p>
9043 !! end
9044
9045 !! test
9046 Link to image page- image page normally doesn't exists, hence edit link
9047 Add test with existing image page
9048 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
9049 !! input
9050 [[:Image:test]]
9051 !! result
9052 <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>
9053 </p>
9054 !! end
9055
9056 !! test
9057 bug 18784 Link to non-existent image page with caption should use caption as link text
9058 !! input
9059 [[:Image:test|caption]]
9060 !! result
9061 <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>
9062 </p>
9063 !! end
9064
9065 !! test
9066 Frameless image caption with a free URL
9067 !! input
9068 [[Image:foobar.jpg|http://example.com]]
9069 !! result
9070 <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>
9071 </p>
9072 !! end
9073
9074 !! test
9075 Thumbnail image caption with a free URL
9076 !! input
9077 [[Image:foobar.jpg|thumb|http://example.com]]
9078 !! result
9079 <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>
9080
9081 !! end
9082
9083 !! test
9084 Thumbnail image caption with a free URL and explicit alt
9085 !! input
9086 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
9087 !! result
9088 <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>
9089
9090 !! end
9091
9092 !! test
9093 SVG thumbnails with no language set
9094 !! options
9095 !! input
9096 [[File:Foobar.svg|thumb|width=200]]
9097 !! result
9098 <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>
9099
9100 !! end
9101
9102 !! test
9103 SVG thumbnails with language de
9104 !! options
9105 !! input
9106 [[File:Foobar.svg|thumb|width=200|lang=de]]
9107 !! result
9108 <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>
9109
9110 !! end
9111
9112 !! test
9113 SVG thumbnails with invalid language code
9114 !! options
9115 !! input
9116 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
9117 !! result
9118 <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>
9119
9120 !! end
9121
9122 !! test
9123 BUG 1887: A ISBN with a thumbnail
9124 !! input
9125 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
9126 !! result
9127 <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>
9128
9129 !! end
9130
9131 !! test
9132 BUG 1887: A RFC with a thumbnail
9133 !! input
9134 [[Image:foobar.jpg|thumb|This is RFC 12354]]
9135 !! result
9136 <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>
9137
9138 !! end
9139
9140 !! test
9141 BUG 1887: A mailto link with a thumbnail
9142 !! input
9143 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
9144 !! result
9145 <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>
9146
9147 !! end
9148
9149 # Pending resolution to bug 368
9150 !! test
9151 BUG 648: Frameless image caption with a link
9152 !! input
9153 [[Image:foobar.jpg|text with a [[link]] in it]]
9154 !! result
9155 <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>
9156 </p>
9157 !! end
9158
9159 !! test
9160 BUG 648: Frameless image caption with a link (suffix)
9161 !! input
9162 [[Image:foobar.jpg|text with a [[link]]foo in it]]
9163 !! result
9164 <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>
9165 </p>
9166 !! end
9167
9168 !! test
9169 BUG 648: Frameless image caption with an interwiki link
9170 !! input
9171 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
9172 !! result
9173 <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>
9174 </p>
9175 !! end
9176
9177 !! test
9178 BUG 648: Frameless image caption with a piped interwiki link
9179 !! input
9180 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
9181 !! result
9182 <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>
9183 </p>
9184 !! end
9185
9186 !! test
9187 Escape HTML special chars in image alt text
9188 !! input
9189 [[Image:foobar.jpg|& < > "]]
9190 !! result
9191 <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>
9192 </p>
9193 !! end
9194
9195 !! test
9196 BUG 499: Alt text should have &#1234;, not &amp;1234;
9197 !! input
9198 [[Image:foobar.jpg|&#9792;]]
9199 !! result
9200 <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>
9201 </p>
9202 !! end
9203
9204 !! test
9205 Broken image caption with link
9206 !! input
9207 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
9208 !! result
9209 <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.
9210 </p>
9211 !! end
9212
9213 !! test
9214 Image caption containing another image
9215 !! input
9216 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
9217 !! result
9218 <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>
9219
9220 !! end
9221
9222 !! test
9223 Image caption containing a newline
9224 !! input
9225 [[Image:Foobar.jpg|This
9226 *is some text]]
9227 !! result
9228 <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>
9229 </p>
9230 !!end
9231
9232 !!test
9233 Parsoid: Image caption containing leading space
9234 (The leading space should not trigger nowiki escaping in wt2wt mode)
9235 !! input
9236 [[Image:Foobar.jpg|thumb| bar]]
9237 !! result
9238 <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>
9239
9240 !!end
9241
9242 !! test
9243 Bug 3090: External links other than http: in image captions
9244 !! input
9245 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
9246 !! result
9247 <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>
9248
9249 !! end
9250
9251 !! test
9252 Custom class
9253 !! input
9254 [[Image:foobar.jpg|a|class=b]]
9255 !! result
9256 <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>
9257 </p>
9258 !! end
9259
9260 !! test
9261 Localized image handling (1).
9262 !! options
9263 language=es
9264 !! input
9265 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
9266 !! result
9267 <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>
9268
9269 !! end
9270
9271 !! test
9272 Localized image handling (2).
9273 !! options
9274 language=es
9275 !! input
9276 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
9277 !! result
9278 <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>
9279
9280 !! end
9281
9282 !! test
9283 "border", "frameless" and "class" attributes on an image.
9284 !! input
9285 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
9286 !! result
9287 <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>
9288 </p>
9289 !! end
9290
9291 !! article
9292 File:Barfoo.jpg
9293 !! text
9294 #REDIRECT [[File:Barfoo.jpg]]
9295 !! endarticle
9296
9297 !! test
9298 Redirected image
9299 !! input
9300 [[Image:Barfoo.jpg]]
9301 !! result
9302 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
9303 </p>
9304 !! end
9305
9306 !! test
9307 Missing image with uploads disabled
9308 !! options
9309 wgEnableUploads=0
9310 !! input
9311 [[Image:Foobaz.jpg]]
9312 !! result
9313 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
9314 </p>
9315 !! end
9316
9317 # Parsoid-specific testing for images
9318 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9319 # Currently imperfect due to a flaw in the Parsoid testrunner
9320 # Work in progress
9321 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
9322 # image tests.
9323
9324 !! test
9325 Parsoid-specific image handling - simple image with size and middle alignment
9326 !! options
9327 parsoid
9328 !! input
9329 [[Image:Foobar.jpg|50px|middle]]
9330 !! result
9331 <p>
9332 <span class="mw-valign-middle" typeof="mw:Image">
9333 <a href="File:Foobar.jpg">
9334 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
9335 </a>
9336 </span>
9337 </p>
9338 !! end
9339
9340 !! test
9341 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
9342 !! options
9343 parsoid
9344 !! input
9345 [[Image:Foobar.jpg|500x10px|baseline|caption]]
9346 !! result
9347 <p>
9348 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9349 <a href="File:Foobar.jpg">
9350 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
9351 </a>
9352 </span>
9353 </p>
9354 !! end
9355
9356 !! test
9357 Parsoid-specific image handling - simple image with border and size spec
9358 !! options
9359 parsoid
9360 !! input
9361 [[Image:Foobar.jpg|50px|border|caption]]
9362 !! result
9363 <p>
9364 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9365 <a href="File:Foobar.jpg">
9366 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
9367 </a>
9368 </span>
9369 </p>
9370 !! end
9371
9372 !! test
9373 Parsoid-specific image handling - thumbnail with halign, valign, and caption
9374 !! options
9375 parsoid
9376 !! input
9377 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
9378 !! result
9379 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
9380 <a href="File:Foobar.jpg">
9381 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
9382 </a>
9383 <figcaption>caption content</figcaption>
9384 </figure>
9385 !! end
9386
9387 !! test
9388 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
9389 !! options
9390 parsoid
9391 !! input
9392 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
9393 !! result
9394 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
9395 <a href="File:Foobar.jpg">
9396 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
9397 </a>
9398 <figcaption>caption</figcaption>
9399 </figure>
9400 !! end
9401
9402 !! test
9403 Parsoid-specific image handling - framed image with specific size and caption
9404 !! options
9405 parsoid
9406 !! input
9407 [[Image:Foobar.jpg|500x50px|frame|caption]]
9408 !! result
9409 <figure typeof="mw:Image/Frame">
9410 <a href="File:Foobar.jpg">
9411 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9412 </a>
9413 <figcaption>caption</figcaption>
9414 </figure>
9415 !! end
9416
9417 !! test
9418 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
9419 !! options
9420 parsoid
9421 !! input
9422 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
9423 !! result
9424 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
9425 <a href="File:Foobar.jpg">
9426 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9427 </a>
9428 <figcaption>caption</figcaption>
9429 </figure>
9430 !! end
9431
9432 !! test
9433 Parsoid-specific image handling - frameless image with specific size, border, and caption
9434 !! options
9435 parsoid
9436 !! input
9437 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
9438 !! result
9439 <p>
9440 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9441 <a href="File:Foobar.jpg">
9442 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9443 </a>
9444 </p>
9445 !! end
9446
9447 #!! test
9448 #Parsoid-specific image handling - simple image with a formatted caption
9449 #!! options
9450 #parsoid
9451 #!! input
9452 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
9453 #!! result
9454 #<p>
9455 #<span typeof="mw:Image">
9456 #<a class="mw-default-size" href="Image:Foobar.jpg">
9457 #<img alt="Foobar.jpg" class="mw-default-size" src="http://example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
9458 #</a>
9459 #<span>abc</span>
9460 #</span>
9461 #</p>
9462
9463
9464 ###
9465 ### Subpages
9466 ###
9467 !! article
9468 Subpage test/subpage
9469 !! text
9470 foo
9471 !! endarticle
9472
9473 !! test
9474 Subpage link
9475 !! options
9476 subpage title=[[Subpage test]]
9477 !! input
9478 [[/subpage]]
9479 !! result
9480 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
9481 </p>
9482 !! end
9483
9484 !! test
9485 Subpage noslash link
9486 !! options
9487 subpage title=[[Subpage test]]
9488 !!input
9489 [[/subpage/]]
9490 !! result
9491 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
9492 </p>
9493 !! end
9494
9495 # TODO: make this PHP-parser compatible!
9496 !! test
9497 Relative subpage noslash link
9498 !! options
9499 parsoid=wt2wt,wt2html,html2html
9500 subpage title=[[Subpage test/1/2/3/4]]
9501 !!input
9502 [[../../subpage/]]
9503
9504 [[../../subpage]]
9505 !! result
9506 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
9507 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
9508 !! end
9509
9510 # TODO: make this PHP-parser compatible!
9511 !! test
9512 Parsoid: dot-slash prefixed wikilinks
9513 !! options
9514 parsoid=wt2wt,wt2html,html2html
9515 !!input
9516 [[./foo]]
9517
9518 [[././bar]]
9519
9520 [[././baz/]]
9521 !! result
9522 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
9523 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
9524 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
9525 !! end
9526
9527 !! test
9528 Disabled subpages
9529 !! input
9530 [[/subpage]]
9531 !! result
9532 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
9533 </p>
9534 !! end
9535
9536 !! test
9537 BUG 561: {{/Subpage}}
9538 !! options
9539 subpage title=[[Page]]
9540 !! input
9541 {{/Subpage}}
9542 !! result
9543 <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>
9544 </p>
9545 !! end
9546
9547 ###
9548 ### Categories
9549 ###
9550 !! article
9551 Category:MediaWiki User's Guide
9552 !! text
9553 blah
9554 !! endarticle
9555
9556 !! test
9557 Link to category
9558 !! input
9559 [[:Category:MediaWiki User's Guide]]
9560 !! result
9561 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
9562 </p>
9563 !! end
9564
9565 !! test
9566 Simple category
9567 !! options
9568 cat
9569 !! input
9570 [[Category:MediaWiki User's Guide]]
9571 !! result
9572 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9573 !! end
9574
9575 !! test
9576 PAGESINCATEGORY invalid title fatal (r33546 fix)
9577 !! input
9578 {{PAGESINCATEGORY:<bogus>}}
9579 !! result
9580 <p>0
9581 </p>
9582 !! end
9583
9584 !! test
9585 Category with different sort key
9586 !! options
9587 cat
9588 !! input
9589 [[Category:MediaWiki User's Guide|Foo]]
9590 !! result
9591 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9592 !! end
9593
9594 !! test
9595 Category with identical sort key
9596 !! options
9597 cat
9598 !! input
9599 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9600 !! result
9601 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9602 !! end
9603
9604 !! test
9605 Category with empty sort key
9606 !! options
9607 cat
9608 pst
9609 !! input
9610 [[Category:MediaWiki User's Guide|]]
9611 !! result
9612 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9613 !! end
9614
9615 !! test
9616 Category with empty sort key and parentheses
9617 !! options
9618 cat
9619 pst
9620 !! input
9621 [[Category:Foo (bar)|]]
9622 !! result
9623 [[Category:Foo (bar)|Foo]]
9624 !! end
9625
9626 !! test
9627 Category with link tail
9628 !! options
9629 cat
9630 pst
9631 !! input
9632 123[[Category:Foo]]456
9633 !! result
9634 123[[Category:Foo]]456
9635 !! end
9636
9637 !! test
9638 Category with template
9639 !! options
9640 cat
9641 pst
9642 !! input
9643 [[Category:{{echo|Foo}}]]
9644 !! result
9645 [[Category:{{echo|Foo}}]]
9646 !! end
9647
9648 !! test
9649 Category with template in sort key
9650 !! options
9651 cat
9652 pst
9653 !! input
9654 [[Category:Foo|{{echo|Bar}}]]
9655 !! result
9656 [[Category:Foo|{{echo|Bar}}]]
9657 !! end
9658
9659 !! test
9660 Category with template in sort key and title
9661 !! options
9662 cat
9663 pst
9664 !! input
9665 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9666 !! result
9667 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9668 !! end
9669
9670 !! test
9671 Category / paragraph interactions
9672 !! input
9673 Foo [[Category:Baz]] Bar
9674
9675 Foo [[Category:Baz]]
9676 Bar
9677
9678 Foo
9679 [[Category:Baz]]
9680 Bar
9681
9682 Foo
9683 [[Category:Baz]] Bar
9684
9685 Foo
9686 [[Category:Baz]]
9687 [[Category:Baz]]
9688 [[Category:Baz]]
9689 Bar
9690
9691 [[Category:Baz]]
9692 [[Category:Baz]]
9693 [[Category:Baz]]
9694
9695 [[Category:Baz]]
9696 {{echo|[[Category:Baz]]}}
9697 [[Category:Baz]]
9698 !! result
9699 <p>Foo Bar
9700 </p><p>Foo
9701 Bar
9702 </p><p>Foo
9703 Bar
9704 </p><p>Foo Bar
9705 </p><p>Foo
9706 Bar
9707 </p>
9708 !! end
9709
9710 !! test
9711 Parsoid: Serialize link to category page with colon escape
9712 !! options
9713 parsoid
9714 !! input
9715
9716 [[:Category:Foo]]
9717 [[:Category:Foo|Bar]]
9718 !! result
9719 <p>
9720 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
9721 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
9722 </p>
9723 !! end
9724
9725 !! test
9726 Parsoid: Link prefix/suffixes aren't applied to category links
9727 !! options
9728 parsoid=wt2html,wt2wt,html2html
9729 language=is
9730 !! input
9731 x[[Category:Foo]]y
9732 !! result
9733 <p>x<link rel="mw:WikiLink/Category" href="Category:Foo">y</p>
9734 !! end
9735
9736 !! test
9737 Parsoid: Serialize link to file page with colon escape
9738 !! options
9739 parsoid
9740 !! input
9741
9742 [[:File:Foo.png]]
9743 [[:File:Foo.png|Bar]]
9744 !! result
9745 <p>
9746 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
9747 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
9748 </p>
9749 !! end
9750
9751 !! test
9752 Parsoid: Serialize a genuine category link without colon escape
9753 !! options
9754 parsoid
9755 !! input
9756 [[Category:Foo]]
9757 [[Category:Foo|Bar]]
9758 !! result
9759 <link rel="mw:WikiLink/Category" href="Category:Foo">
9760 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
9761 !! end
9762
9763 ###
9764 ### Inter-language links
9765 ###
9766 !! test
9767 Inter-language links
9768 !! options
9769 ill
9770 !! input
9771 [[es:Alimento]]
9772 [[fr:Nourriture]]
9773 [[zh:&#39135;&#21697;]]
9774 !! result
9775 es:Alimento fr:Nourriture zh:食品
9776 !! end
9777
9778 !! test
9779 Duplicate interlanguage links (bug 24502)
9780 !! options
9781 ill
9782 !! input
9783 [[es:1]]
9784 [[es:2]]
9785 [[fr:1]]
9786 [[fr:2]]
9787 !! result
9788 es:1 fr:1
9789 !! end
9790
9791 ###
9792 ### Sections
9793 ###
9794 !! test
9795 Basic section headings
9796 !! input
9797 == Headline 1 ==
9798 Some text
9799
9800 ==Headline 2==
9801 More
9802 ===Smaller headline===
9803 Blah blah
9804 !! result
9805 <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>
9806 <p>Some text
9807 </p>
9808 <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>
9809 <p>More
9810 </p>
9811 <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>
9812 <p>Blah blah
9813 </p>
9814 !! end
9815
9816 !! test
9817 Section headings with TOC
9818 !! input
9819 == Headline 1 ==
9820 === Subheadline 1 ===
9821 ===== Skipping a level =====
9822 ====== Skipping a level ======
9823
9824 == Headline 2 ==
9825 Some text
9826 ===Another headline===
9827 !! result
9828 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9829 <ul>
9830 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
9831 <ul>
9832 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
9833 <ul>
9834 <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>
9835 <ul>
9836 <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>
9837 </ul>
9838 </li>
9839 </ul>
9840 </li>
9841 </ul>
9842 </li>
9843 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
9844 <ul>
9845 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
9846 </ul>
9847 </li>
9848 </ul>
9849 </div>
9850 <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>
9851 <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>
9852 <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>
9853 <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>
9854 <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>
9855 <p>Some text
9856 </p>
9857 <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>
9858
9859 !! end
9860
9861 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
9862 !! test
9863 Handling of sections up to level 6 and beyond
9864 !! input
9865 = Level 1 Heading=
9866 == Level 2 Heading==
9867 === Level 3 Heading===
9868 ==== Level 4 Heading====
9869 ===== Level 5 Heading=====
9870 ====== Level 6 Heading======
9871 ======= Level 7 Heading=======
9872 ======== Level 8 Heading========
9873 ========= Level 9 Heading=========
9874 ========== Level 10 Heading==========
9875 !! result
9876 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9877 <ul>
9878 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
9879 <ul>
9880 <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>
9881 <ul>
9882 <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>
9883 <ul>
9884 <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>
9885 <ul>
9886 <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>
9887 <ul>
9888 <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>
9889 <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>
9890 <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>
9891 <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>
9892 <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>
9893 </ul>
9894 </li>
9895 </ul>
9896 </li>
9897 </ul>
9898 </li>
9899 </ul>
9900 </li>
9901 </ul>
9902 </li>
9903 </ul>
9904 </div>
9905 <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>
9906 <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>
9907 <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>
9908 <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>
9909 <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>
9910 <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>
9911 <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>
9912 <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>
9913 <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>
9914 <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>
9915
9916 !! end
9917
9918 !! test
9919 TOC regression (bug 9764)
9920 !! input
9921 == title 1 ==
9922 === title 1.1 ===
9923 ==== title 1.1.1 ====
9924 === title 1.2 ===
9925 == title 2 ==
9926 === title 2.1 ===
9927 !! result
9928 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9929 <ul>
9930 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9931 <ul>
9932 <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>
9933 <ul>
9934 <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>
9935 </ul>
9936 </li>
9937 <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>
9938 </ul>
9939 </li>
9940 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9941 <ul>
9942 <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>
9943 </ul>
9944 </li>
9945 </ul>
9946 </div>
9947 <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>
9948 <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>
9949 <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>
9950 <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>
9951 <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>
9952 <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>
9953
9954 !! end
9955
9956 !! test
9957 TOC with wgMaxTocLevel=3 (bug 6204)
9958 !! options
9959 wgMaxTocLevel=3
9960 !! input
9961 == title 1 ==
9962 === title 1.1 ===
9963 ==== title 1.1.1 ====
9964 === title 1.2 ===
9965 == title 2 ==
9966 === title 2.1 ===
9967 !! result
9968 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9969 <ul>
9970 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9971 <ul>
9972 <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>
9973 <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>
9974 </ul>
9975 </li>
9976 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9977 <ul>
9978 <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>
9979 </ul>
9980 </li>
9981 </ul>
9982 </div>
9983 <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>
9984 <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>
9985 <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>
9986 <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>
9987 <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>
9988 <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>
9989
9990 !! end
9991
9992 !! test
9993 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
9994 !! options
9995 wgMaxTocLevel=3
9996 !! input
9997 ==Section 1==
9998 ===Section 1.1===
9999 ====Section 1.1.1====
10000 ====Section 1.1.1.1====
10001 ==Section 2==
10002 !! result
10003 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10004 <ul>
10005 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
10006 <ul>
10007 <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>
10008 </ul>
10009 </li>
10010 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
10011 </ul>
10012 </div>
10013 <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>
10014 <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>
10015 <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>
10016 <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>
10017 <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>
10018
10019 !! end
10020
10021
10022 !! test
10023 Resolving duplicate section names
10024 !! input
10025 == Foo bar ==
10026 == Foo bar ==
10027 !! result
10028 <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>
10029 <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>
10030
10031 !! end
10032
10033 !! test
10034 Resolving duplicate section names with differing case (bug 10721)
10035 !! input
10036 == Foo bar ==
10037 == Foo Bar ==
10038 !! result
10039 <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>
10040 <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>
10041
10042 !! end
10043
10044 !! article
10045 Template:sections
10046 !! text
10047 ===Section 1===
10048 ==Section 2==
10049 !! endarticle
10050
10051 !! test
10052 Template with sections, __NOTOC__
10053 !! input
10054 __NOTOC__
10055 ==Section 0==
10056 {{sections}}
10057 ==Section 4==
10058 !! result
10059 <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>
10060 <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>
10061 <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>
10062 <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>
10063
10064 !! end
10065
10066 !! test
10067 __NOEDITSECTION__ keyword
10068 !! input
10069 __NOEDITSECTION__
10070 ==Section 1==
10071 ==Section 2==
10072 !! result
10073 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
10074 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
10075
10076 !! end
10077
10078 !! test
10079 Link inside a section heading
10080 !! input
10081 ==Section with a [[Main Page|link]] in it==
10082 !! result
10083 <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>
10084
10085 !! end
10086
10087 !! test
10088 TOC regression (bug 12077)
10089 !! input
10090 __TOC__
10091 == title 1 ==
10092 === title 1.1 ===
10093 == title 2 ==
10094 !! result
10095 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10096 <ul>
10097 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10098 <ul>
10099 <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>
10100 </ul>
10101 </li>
10102 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
10103 </ul>
10104 </div>
10105 <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>
10106 <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>
10107 <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>
10108
10109 !! end
10110
10111 !! test
10112 BUG 1219 URL next to image (good)
10113 !! input
10114 http://example.com [[Image:foobar.jpg]]
10115 !! result
10116 <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>
10117 </p>
10118 !!end
10119
10120 !! test
10121 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
10122 !! input
10123 ===
10124 The line above must have a trailing space!
10125 === <!--
10126 --> <!-- -->
10127 But just in case it doesn't...
10128 !! result
10129 <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>
10130 <p>The line above must have a trailing space!
10131 </p>
10132 <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>
10133 <p>But just in case it doesn't...
10134 </p>
10135 !! end
10136
10137 !! test
10138 Header with special characters (bug 25462)
10139 !! input
10140 The tooltips shall not show entities to the user (ie. be double escaped)
10141
10142 == text > text ==
10143 section 1
10144
10145 == text < text ==
10146 section 2
10147
10148 == text & text ==
10149 section 3
10150
10151 == text ' text ==
10152 section 4
10153
10154 == text " text ==
10155 section 5
10156 !! result
10157 <p>The tooltips shall not show entities to the user (ie. be double escaped)
10158 </p>
10159 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10160 <ul>
10161 <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>
10162 <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>
10163 <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>
10164 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
10165 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
10166 </ul>
10167 </div>
10168 <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>
10169 <p>section 1
10170 </p>
10171 <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>
10172 <p>section 2
10173 </p>
10174 <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>
10175 <p>section 3
10176 </p>
10177 <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>
10178 <p>section 4
10179 </p>
10180 <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>
10181 <p>section 5
10182 </p>
10183 !! end
10184
10185 !! test
10186 Headers with excess '=' characters
10187 (Are similar tests necessary beyond the 1st level?)
10188 !! input
10189 =foo==
10190 ==foo=
10191 =''italic'' heading==
10192 ==''italic'' heading=
10193 !! result
10194 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10195 <ul>
10196 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
10197 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
10198 <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>
10199 <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>
10200 </ul>
10201 </div>
10202 <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>
10203 <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>
10204 <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>
10205 <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>
10206
10207 !! end
10208
10209 !! test
10210 HTML headers vs TOC (bug 23393)
10211 (__NOEDITSECTION__ for clearer output, doesn't matter here)
10212 !! input
10213 <h1>Header 1</h1>
10214 == Header 1.1 ==
10215 == Header 1.2 ==
10216
10217 <h1>Header 2
10218 </h1>
10219 == Header 2.1 ==
10220 == Header 2.2 ==
10221 __NOEDITSECTION__
10222 !! result
10223 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10224 <ul>
10225 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
10226 <ul>
10227 <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>
10228 <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>
10229 </ul>
10230 </li>
10231 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
10232 <ul>
10233 <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>
10234 <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>
10235 </ul>
10236 </li>
10237 </ul>
10238 </div>
10239 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
10240 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
10241 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
10242 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
10243 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
10244 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
10245
10246 !! end
10247
10248 !! test
10249 BUG 1219 URL next to image (broken)
10250 !! input
10251 http://example.com[[Image:foobar.jpg]]
10252 !! result
10253 <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>
10254 </p>
10255 !!end
10256
10257 !! test
10258 Bug 1186 news: in the middle of text
10259 !! input
10260 http://en.wikinews.org/wiki/Wikinews:Workplace
10261 !! result
10262 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
10263 </p>
10264 !!end
10265
10266
10267 !! test
10268 Namespaced link must have a title
10269 !! input
10270 [[Project:]]
10271 !! result
10272 <p>[[Project:]]
10273 </p>
10274 !!end
10275
10276 !! test
10277 Namespaced link must have a title (bad fragment version)
10278 !! input
10279 [[Project:#fragment]]
10280 !! result
10281 <p>[[Project:#fragment]]
10282 </p>
10283 !!end
10284
10285
10286 ###
10287 ### HTML tags and HTML attributes
10288 ###
10289
10290 !! test
10291 div with no attributes
10292 !! input
10293 <div>HTML rocks</div>
10294 !! result
10295 <div>HTML rocks</div>
10296
10297 !! end
10298
10299 !! test
10300 div with double-quoted attribute
10301 !! input
10302 <div id="rock">HTML rocks</div>
10303 !! result
10304 <div id="rock">HTML rocks</div>
10305
10306 !! end
10307
10308 !! test
10309 div with single-quoted attribute
10310 !! input
10311 <div id='rock'>HTML rocks</div>
10312 !! result
10313 <div id="rock">HTML rocks</div>
10314
10315 !! end
10316
10317 !! test
10318 div with unquoted attribute
10319 !! input
10320 <div id=rock>HTML rocks</div>
10321 !! result
10322 <div id="rock">HTML rocks</div>
10323
10324 !! end
10325
10326 !! test
10327 div with illegal double attributes
10328 !! input
10329 <div id="a" id="b">HTML rocks</div>
10330 !! result
10331 <div id="b">HTML rocks</div>
10332
10333 !!end
10334
10335 # FIXME: produce empty string instead of "class" in the PHP parser, following
10336 # the HTML5 spec.
10337 !! test
10338 div with empty attribute value, space before equals
10339 !! options
10340 parsoid
10341 !! input
10342 <div class =>HTML rocks</div>
10343 !! result
10344 <div class="">HTML rocks</div>
10345
10346 !! end
10347
10348 # The PHP parser escapes the opening brace to &#123; for some reason, so
10349 # disabled this test for it.
10350 !! test
10351 div with braces in attribute value
10352 !! options
10353 parsoid
10354 !! input
10355 <div title="{}">Foo</div>
10356 !! result
10357 <div title="{}">Foo</div>
10358 !! end
10359
10360 # This it very inconsistent in the PHP parser: it returns
10361 # class="class" if there is a space between the name and the equal sign (see
10362 # 'div with empty attribute value, space before equals'), but strips the
10363 # attribute completely if the space is missing. We hope that not much content
10364 # depends on this, so are implementing the behavior below in Parsoid for
10365 # consistencies' sake. Disabled for the PHP parser.
10366 # FIXME: fix this behavior in the PHP parser?
10367 !! test
10368 div with empty attribute value, no space before equals
10369 !! options
10370 parsoid
10371 !! input
10372 <div class=>HTML rocks</div>
10373 !! result
10374 <div class="">HTML rocks</div>
10375
10376 !! end
10377
10378 !! test
10379 HTML multiple attributes correction
10380 !! input
10381 <p class="error" class="awesome">Awesome!</p>
10382 !! result
10383 <p class="awesome">Awesome!</p>
10384
10385 !!end
10386
10387 !! test
10388 Table multiple attributes correction
10389 !! input
10390 {|
10391 !+ class="error" class="awesome"| status
10392 |}
10393 !! result
10394 <table>
10395 <tr>
10396 <th class="awesome"> status
10397 </th></tr></table>
10398
10399 !!end
10400
10401 !! test
10402 DIV IN UPPERCASE
10403 !! input
10404 <DIV ID="x">HTML ROCKS</DIV>
10405 !! result
10406 <div id="x">HTML ROCKS</div>
10407
10408 !!end
10409
10410 !! test
10411 Non-ASCII pseudo-tags are rendered as text
10412 !! input
10413 <khyô>
10414 !! result
10415 <p>&lt;khyô&gt;
10416 </p>
10417 !! end
10418
10419 !! test
10420 Pseudo-tag with URL 'name' renders as url link
10421 !! input
10422 <http://example.com/>
10423 !! result
10424 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
10425 </p>
10426 !! end
10427
10428 !! test
10429 text with amp in the middle of nowhere
10430 !! input
10431 Remember AT&T?
10432 !!result
10433 <p>Remember AT&amp;T?
10434 </p>
10435 !! end
10436
10437 !! test
10438 text with character entity: eacute
10439 !! input
10440 I always thought &eacute; was a cute letter.
10441 !! result
10442 <p>I always thought &#233; was a cute letter.
10443 </p>
10444 !! end
10445
10446 !! test
10447 text with entity-escaped character entity-like string: eacute
10448 !! input
10449 I always thought &amp;eacute; was a cute letter.
10450 !! result
10451 <p>I always thought &amp;eacute; was a cute letter.
10452 </p>
10453 !! end
10454
10455 !! test
10456 text with undefined character entity: xacute
10457 !! input
10458 I always thought &xacute; was a cute letter.
10459 !! result
10460 <p>I always thought &amp;xacute; was a cute letter.
10461 </p>
10462 !! end
10463
10464
10465 ###
10466 ### Nesting tests (see bug 41545, 50604, 51081)
10467 ###
10468
10469 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
10470 # Note that html2wt is considerably more difficult if we use <b> in
10471 # the test case, instead of <big>
10472 !! test
10473 Ensure that HTML adoption agency algorithm is properly implemented.
10474 !! input
10475 <big>X<big>Y</big>Z</big>
10476 !! result
10477 <p><big>X<big>Y</big>Z</big>
10478 </p>
10479 !! end
10480
10481 # This was bug 41545 in the PHP parser.
10482 !! test
10483 Nesting of <kbd>
10484 !! input
10485 <kbd>X<kbd>Y</kbd>Z</kbd>
10486 !! result
10487 <p><kbd>X<kbd>Y</kbd>Z</kbd>
10488 </p>
10489 !! end
10490
10491 # The following cases were bug 51081 in the PHP parser.
10492 # Note that there are some other nestable tags (b, i, etc) which are
10493 # not covered; see bug 51081 for discussion.
10494 !! test
10495 Nesting of <em>
10496 !! input
10497 <em>X<em>Y</em>Z</em>
10498 !! result
10499 <p><em>X<em>Y</em>Z</em>
10500 </p>
10501 !! end
10502
10503 !! test
10504 Nesting of <strong>
10505 !! input
10506 <strong>X<strong>Y</strong>Z</strong>
10507 !! result
10508 <p><strong>X<strong>Y</strong>Z</strong>
10509 </p>
10510 !! end
10511
10512 !! test
10513 Nesting of <q>
10514 !! input
10515 <q>X<q>Y</q>Z</q>
10516 !! result
10517 <p><q>X<q>Y</q>Z</q>
10518 </p>
10519 !! end
10520
10521 !! test
10522 Nesting of <ruby>
10523 !! input
10524 <ruby>X<ruby>Y</ruby>Z</ruby>
10525 !! result
10526 <p><ruby>X<ruby>Y</ruby>Z</ruby>
10527 </p>
10528 !! end
10529
10530 !! test
10531 Nesting of <bdo>
10532 !! input
10533 <bdo>X<bdo>Y</bdo>Z</bdo>
10534 !! result
10535 <p><bdo>X<bdo>Y</bdo>Z</bdo>
10536 </p>
10537 !! end
10538
10539
10540 ###
10541 ### Media links
10542 ###
10543
10544 !! test
10545 Media link
10546 !! input
10547 [[Media:Foobar.jpg]]
10548 !! result
10549 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
10550 </p>
10551 !! end
10552
10553 !! test
10554 Media link with text
10555 !! input
10556 [[Media:Foobar.jpg|A neat file to look at]]
10557 !! result
10558 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
10559 </p>
10560 !! end
10561
10562 # FIXME: this is still bad HTML tag nesting
10563 !! test
10564 Media link with nasty text
10565 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
10566 !! input
10567 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
10568 !! result
10569 <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>
10570
10571 !! end
10572
10573 !! test
10574 Media link to nonexistent file (bug 1702)
10575 !! input
10576 [[Media:No such.jpg]]
10577 !! result
10578 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
10579 </p>
10580 !! end
10581
10582 !! test
10583 Image link to nonexistent file (bug 1850 - good)
10584 !! input
10585 [[Image:No such.jpg]]
10586 !! result
10587 <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>
10588 </p>
10589 !! end
10590
10591 !! test
10592 :Image link to nonexistent file (bug 1850 - bad)
10593 !! input
10594 [[:Image:No such.jpg]]
10595 !! result
10596 <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>
10597 </p>
10598 !! end
10599
10600
10601
10602 !! test
10603 Character reference normalization in link text (bug 1938)
10604 !! input
10605 [[Main Page|this&that]]
10606 !! result
10607 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
10608 </p>
10609 !!end
10610
10611 !! article
10612 אַ
10613 !! text
10614 Test for unicode normalization
10615
10616 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
10617 !! endarticle
10618
10619 !! test
10620 (bug 19451) Links should refer to the normalized form.
10621 !! input
10622 [[&#xFB2E;]]
10623 [[&#x5d0;&#x5b7;]]
10624 [[&#x5d0;ַ]]
10625 [[א&#x5b7;]]
10626 [[אַ]]
10627 !! result
10628 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
10629 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
10630 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
10631 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
10632 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
10633 </p>
10634 !! end
10635
10636 !! test
10637 Empty attribute crash test (bug 2067)
10638 !! input
10639 <font color="">foo</font>
10640 !! result
10641 <p><font color="">foo</font>
10642 </p>
10643 !! end
10644
10645 !! test
10646 Empty attribute crash test single-quotes (bug 2067)
10647 !! input
10648 <font color=''>foo</font>
10649 !! result
10650 <p><font color="">foo</font>
10651 </p>
10652 !! end
10653
10654 !! test
10655 Attribute test: equals, then nothing
10656 !! input
10657 <font color=>foo</font>
10658 !! result
10659 <p><font>foo</font>
10660 </p>
10661 !! end
10662
10663 !! test
10664 Attribute test: unquoted value
10665 !! input
10666 <font color=x>foo</font>
10667 !! result
10668 <p><font color="x">foo</font>
10669 </p>
10670 !! end
10671
10672 !! test
10673 Attribute test: unquoted but illegal value (hash)
10674 !! input
10675 <font color=#x>foo</font>
10676 !! result
10677 <p><font color="#x">foo</font>
10678 </p>
10679 !! end
10680
10681 !! test
10682 Attribute test: no value
10683 !! input
10684 <font color>foo</font>
10685 !! result
10686 <p><font color="color">foo</font>
10687 </p>
10688 !! end
10689
10690 !! test
10691 Bug 2095: link with three closing brackets
10692 !! input
10693 [[Main Page]]]
10694 !! result
10695 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
10696 </p>
10697 !! end
10698
10699 !! test
10700 Bug 2095: link with pipe and three closing brackets
10701 !! input
10702 [[Main Page|link]]]
10703 !! result
10704 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
10705 </p>
10706 !! end
10707
10708 !! test
10709 Bug 2095: link with pipe and three closing brackets, version 2
10710 !! input
10711 [[Main Page|[http://example.com/]]]
10712 !! result
10713 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
10714 </p>
10715 !! end
10716
10717
10718 ###
10719 ### Safety
10720 ###
10721
10722 !! article
10723 Template:Dangerous attribute
10724 !! text
10725 " onmouseover="alert(document.cookie)
10726 !! endarticle
10727
10728 !! article
10729 Template:Dangerous style attribute
10730 !! text
10731 border-size: expression(alert(document.cookie))
10732 !! endarticle
10733
10734 !! article
10735 Template:Div style
10736 !! text
10737 <div style="float: right; {{{1}}}">Magic div</div>
10738 !! endarticle
10739
10740 !! test
10741 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
10742 !! input
10743 <div title="{{test}}"></div>
10744 !! result
10745 <div title="This is a test template"></div>
10746
10747 !! end
10748
10749 !! test
10750 Bug 2304: HTML attribute safety (dangerous template; 2309)
10751 !! input
10752 <div title="{{dangerous attribute}}"></div>
10753 !! result
10754 <div title=""></div>
10755
10756 !! end
10757
10758 !! test
10759 Bug 2304: HTML attribute safety (dangerous style template; 2309)
10760 !! input
10761 <div style="{{dangerous style attribute}}"></div>
10762 !! result
10763 <div style="/* insecure input */"></div>
10764
10765 !! end
10766
10767 !! test
10768 Bug 2304: HTML attribute safety (safe parameter; 2309)
10769 !! input
10770 {{div style|width: 200px}}
10771 !! result
10772 <div style="float: right; width: 200px">Magic div</div>
10773
10774 !! end
10775
10776 !! test
10777 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
10778 !! input
10779 {{div style|width: expression(alert(document.cookie))}}
10780 !! result
10781 <div style="/* insecure input */">Magic div</div>
10782
10783 !! end
10784
10785 !! test
10786 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
10787 !! input
10788 {{div style|"><script>alert(document.cookie)</script>}}
10789 !! result
10790 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10791
10792 !! end
10793
10794 !! test
10795 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
10796 !! input
10797 {{div style|" ><script>alert(document.cookie)</script>}}
10798 !! result
10799 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10800
10801 !! end
10802
10803 !! test
10804 Bug 2304: HTML attribute safety (link)
10805 !! input
10806 <div title="[[Main Page]]"></div>
10807 !! result
10808 <div title="&#91;&#91;Main Page]]"></div>
10809
10810 !! end
10811
10812 !! test
10813 Bug 2304: HTML attribute safety (italics)
10814 !! input
10815 <div title="''foobar''"></div>
10816 !! result
10817 <div title="&#39;&#39;foobar&#39;&#39;"></div>
10818
10819 !! end
10820
10821 !! test
10822 Bug 2304: HTML attribute safety (bold)
10823 !! input
10824 <div title="'''foobar'''"></div>
10825 !! result
10826 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
10827
10828 !! end
10829
10830
10831 !! test
10832 Bug 2304: HTML attribute safety (ISBN)
10833 !! input
10834 <div title="ISBN 1234567890"></div>
10835 !! result
10836 <div title="&#73;SBN 1234567890"></div>
10837
10838 !! end
10839
10840 !! test
10841 Bug 2304: HTML attribute safety (RFC)
10842 !! input
10843 <div title="RFC 1234"></div>
10844 !! result
10845 <div title="&#82;FC 1234"></div>
10846
10847 !! end
10848
10849 !! test
10850 Bug 2304: HTML attribute safety (PMID)
10851 !! input
10852 <div title="PMID 1234567890"></div>
10853 !! result
10854 <div title="&#80;MID 1234567890"></div>
10855
10856 !! end
10857
10858 !! test
10859 Bug 2304: HTML attribute safety (web link)
10860 !! input
10861 <div title="http://example.com/"></div>
10862 !! result
10863 <div title="http&#58;//example.com/"></div>
10864
10865 !! end
10866
10867 !! test
10868 Bug 2304: HTML attribute safety (named web link)
10869 !! input
10870 <div title="[http://example.com/ link]"></div>
10871 !! result
10872 <div title="&#91;http&#58;//example.com/ link]"></div>
10873
10874 !! end
10875
10876 !! test
10877 Bug 3244: HTML attribute safety (extension; safe)
10878 !! input
10879 <div style="<nowiki>background:blue</nowiki>"></div>
10880 !! result
10881 <div style="background:blue"></div>
10882
10883 !! end
10884
10885 !! test
10886 Bug 3244: HTML attribute safety (extension; unsafe)
10887 !! input
10888 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
10889 !! result
10890 <div style="/* insecure input */"></div>
10891
10892 !! end
10893
10894 # More MSIE fun discovered by Tom Gilder
10895
10896 !! test
10897 MSIE CSS safety test: spurious slash
10898 !! input
10899 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
10900 !! result
10901 <div style="/* insecure input */">evil</div>
10902
10903 !! end
10904
10905 !! test
10906 MSIE CSS safety test: hex code
10907 !! input
10908 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
10909 !! result
10910 <div style="/* insecure input */">evil</div>
10911
10912 !! end
10913
10914 !! test
10915 MSIE CSS safety test: comment in url
10916 !! input
10917 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
10918 !! result
10919 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
10920
10921 !! end
10922
10923 !! test
10924 MSIE CSS safety test: comment in expression
10925 !! input
10926 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
10927 !! result
10928 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
10929
10930 !! end
10931
10932
10933 !! test
10934 Table attribute legitimate extension
10935 !! input
10936 {|
10937 !+ style="<nowiki>color:blue</nowiki>"| status
10938 |}
10939 !! result
10940 <table>
10941 <tr>
10942 <th style="color:blue"> status
10943 </th></tr></table>
10944
10945 !!end
10946
10947 !! test
10948 Table attribute safety
10949 !! input
10950 {|
10951 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
10952 |}
10953 !! result
10954 <table>
10955 <tr>
10956 <th style="/* insecure input */"> status
10957 </th></tr></table>
10958
10959 !! end
10960
10961 !! test
10962 CSS line continuation 1
10963 !! input
10964 <div style="background-image: u\&#10;rl(test.jpg);"></div>
10965 !! result
10966 <div style="/* insecure input */"></div>
10967
10968 !! end
10969
10970 !! test
10971 CSS line continuation 2
10972 !! input
10973 <div style="background-image: u\&#13;rl(test.jpg); "></div>
10974 !! result
10975 <div style="/* insecure input */"></div>
10976
10977 !! end
10978
10979 !! article
10980 Template:Identity
10981 !! text
10982 {{{1}}}
10983 !! endarticle
10984
10985 !! test
10986 Expansion of multi-line templates in attribute values (bug 6255)
10987 !! input
10988 <div style="background: {{identity|#00FF00}}">-</div>
10989 !! result
10990 <div style="background: #00FF00">-</div>
10991
10992 !! end
10993
10994
10995 !! test
10996 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
10997 !! input
10998 <div style="background:
10999 #00FF00">-</div>
11000 !! result
11001 <div style="background: #00FF00">-</div>
11002
11003 !! end
11004
11005 !! test
11006 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
11007 !! input
11008 <div style="background: &#10;#00FF00">-</div>
11009 !! result
11010 <div style="background: &#10;#00FF00">-</div>
11011
11012 !! end
11013
11014 ###
11015 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
11016 ###
11017 !! test
11018 Parser hook: empty input
11019 !! input
11020 <tag></tag>
11021 !! result
11022 <pre>
11023 ''
11024 array (
11025 )
11026 </pre>
11027
11028 !! end
11029
11030 !! test
11031 Parser hook: empty input using terminated empty elements
11032 !! input
11033 <tag/>
11034 !! result
11035 <pre>
11036 NULL
11037 array (
11038 )
11039 </pre>
11040
11041 !! end
11042
11043 !! test
11044 Parser hook: empty input using terminated empty elements (space before)
11045 !! input
11046 <tag />
11047 !! result
11048 <pre>
11049 NULL
11050 array (
11051 )
11052 </pre>
11053
11054 !! end
11055
11056 !! test
11057 Parser hook: basic input
11058 !! input
11059 <tag>input</tag>
11060 !! result
11061 <pre>
11062 'input'
11063 array (
11064 )
11065 </pre>
11066
11067 !! end
11068
11069
11070 !! test
11071 Parser hook: case insensitive
11072 !! input
11073 <TAG>input</TAG>
11074 !! result
11075 <pre>
11076 'input'
11077 array (
11078 )
11079 </pre>
11080
11081 !! end
11082
11083
11084 !! test
11085 Parser hook: case insensitive, redux
11086 !! input
11087 <TaG>input</TAg>
11088 !! result
11089 <pre>
11090 'input'
11091 array (
11092 )
11093 </pre>
11094
11095 !! end
11096
11097 !! test
11098 Parser hook: nested tags
11099 !! options
11100 noxml
11101 !! input
11102 <tag><tag></tag></tag>
11103 !! result
11104 <pre>
11105 '<tag>'
11106 array (
11107 )
11108 </pre>&lt;/tag&gt;
11109
11110 !! end
11111
11112 !! test
11113 Parser hook: basic arguments
11114 !! input
11115 <tag width=200 height = "100" depth = '50' square></tag>
11116 !! result
11117 <pre>
11118 ''
11119 array (
11120 'width' => '200',
11121 'height' => '100',
11122 'depth' => '50',
11123 'square' => 'square',
11124 )
11125 </pre>
11126
11127 !! end
11128
11129 !! test
11130 Parser hook: argument containing a forward slash (bug 5344)
11131 !! input
11132 <tag filename='/tmp/bla'></tag>
11133 !! result
11134 <pre>
11135 ''
11136 array (
11137 'filename' => '/tmp/bla',
11138 )
11139 </pre>
11140
11141 !! end
11142
11143 !! test
11144 Parser hook: empty input using terminated empty elements (bug 2374)
11145 !! input
11146 <tag foo=bar/>text
11147 !! result
11148 <pre>
11149 NULL
11150 array (
11151 'foo' => 'bar',
11152 )
11153 </pre>text
11154
11155 !! end
11156
11157 # </tag> should be output literally since there is no matching tag that begins it
11158 !! test
11159 Parser hook: basic arguments using terminated empty elements (bug 2374)
11160 !! input
11161 <tag width=200 height = "100" depth = '50' square/>
11162 other stuff
11163 </tag>
11164 !! result
11165 <pre>
11166 NULL
11167 array (
11168 'width' => '200',
11169 'height' => '100',
11170 'depth' => '50',
11171 'square' => 'square',
11172 )
11173 </pre>
11174 <p>other stuff
11175 &lt;/tag&gt;
11176 </p>
11177 !! end
11178
11179 ###
11180 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
11181 ###
11182
11183 !! test
11184 Parser hook: static parser hook not inside a comment
11185 !! input
11186 <statictag>hello, world</statictag>
11187 <statictag action=flush/>
11188 !! result
11189 <p>hello, world
11190 </p>
11191 !! end
11192
11193
11194 !! test
11195 Parser hook: static parser hook inside a comment
11196 !! input
11197 <!-- <statictag>hello, world</statictag> -->
11198 <statictag action=flush/>
11199 !! result
11200 <p><br />
11201 </p>
11202 !! end
11203
11204 # Nested template calls; this case was broken by Parser.php rev 1.506,
11205 # since reverted.
11206
11207 !! article
11208 Template:One-parameter
11209 !! text
11210 (My parameter is: {{{1}}})
11211 !! endarticle
11212
11213 !! article
11214 Template:Map-one-parameter
11215 !! text
11216 {{{{{1}}}|{{{2}}}}}
11217 !! endarticle
11218
11219 !! test
11220 Nested template calls
11221 !! input
11222 {{Map-one-parameter|One-parameter|param}}
11223 !! result
11224 <p>(My parameter is: param)
11225 </p>
11226 !! end
11227
11228
11229 ###
11230 ### Sanitizer
11231 ###
11232 !! test
11233 Sanitizer: Closing of open tags
11234 !! input
11235 <s></s><table></table>
11236 !! result
11237 <s></s><table></table>
11238
11239 !! end
11240
11241 !! test
11242 Sanitizer: Closing of open but not closed tags
11243 !! input
11244 <s>foo
11245 !! result
11246 <p><s>foo</s>
11247 </p>
11248 !! end
11249
11250 !! test
11251 Sanitizer: Closing of closed but not open tags
11252 !! input
11253 </s>
11254 !! result
11255 <p>&lt;/s&gt;
11256 </p>
11257 !! end
11258
11259 !! test
11260 Sanitizer: Closing of closed but not open table tags
11261 !! input
11262 Table not started</td></tr></table>
11263 !! result
11264 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
11265 </p>
11266 !! end
11267
11268 !! test
11269 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
11270 !! input
11271 <span id="æ: v">byte</span>[[#æ: v|backlink]]
11272 !! result
11273 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
11274 </p>
11275 !! end
11276
11277 !! test
11278 Sanitizer: Validating the contents of the id attribute (bug 4515)
11279 !! options
11280 disabled
11281 !! input
11282 <br id=9 />
11283 !! result
11284 Something, but definitely not <br id="9" />...
11285 !! end
11286
11287 !! test
11288 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
11289 !! options
11290 disabled
11291 !! input
11292 <br id="foo" /><br id="foo" />
11293 !! result
11294 Something need to be done. foo-2 ?
11295 !! end
11296
11297 !! test
11298 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
11299 !! input
11300 <div itemscope>
11301 <meta itemprop="hello" content="world">
11302 <meta http-equiv="refresh" content="5">
11303 <meta itemprop="hello" http-equiv="refresh" content="5">
11304 <link itemprop="hello" href="{{SERVER}}">
11305 <link rel="stylesheet" href="{{SERVER}}">
11306 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
11307 </div>
11308 !! result
11309 <div itemscope="itemscope">
11310 <p> <meta itemprop="hello" content="world" />
11311 &lt;meta http-equiv="refresh" content="5"&gt;
11312 <meta itemprop="hello" content="5" />
11313 </p>
11314 <link itemprop="hello" href="http&#58;//example.org" />
11315 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
11316 <link itemprop="hello" href="http&#58;//example.org" />
11317 </div>
11318
11319 !! end
11320
11321 !! test
11322 Language converter: output gets cut off unexpectedly (bug 5757)
11323 !! options
11324 language=zh
11325 !! input
11326 this bit is safe: }-
11327
11328 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
11329
11330 then we get cut off here: }-
11331
11332 all additional text is vanished
11333 !! result
11334 <p>this bit is safe: }-
11335 </p><p>but if we add a conversion instance: xxx
11336 </p><p>then we get cut off here: }-
11337 </p><p>all additional text is vanished
11338 </p>
11339 !! end
11340
11341 !! test
11342 Self closed html pairs (bug 5487)
11343 !! options
11344 !! input
11345 <center><font id="bug" />Centered text</center>
11346 <div><font id="bug2" />In div text</div>
11347 !! result
11348 <center>&lt;font id="bug" /&gt;Centered text</center>
11349 <div>&lt;font id="bug2" /&gt;In div text</div>
11350
11351 !! end
11352
11353 #
11354 #
11355 #
11356
11357 !! test
11358 Punctuation: nbsp before exclamation
11359 !! input
11360 C'est grave !
11361 !! result
11362 <p>C'est grave&#160;!
11363 </p>
11364 !! end
11365
11366 !! test
11367 Punctuation: CSS !important (bug 11874)
11368 !! input
11369 <div style="width:50% !important">important</div>
11370 !! result
11371 <div style="width:50% !important">important</div>
11372
11373 !!end
11374
11375 !! test
11376 Punctuation: CSS ! important (bug 11874; with space after)
11377 !! input
11378 <div style="width:50% ! important">important</div>
11379 !! result
11380 <div style="width:50% ! important">important</div>
11381
11382 !!end
11383
11384
11385 !! test
11386 HTML bullet list, closed tags (bug 5497)
11387 !! input
11388 <ul>
11389 <li>One</li>
11390 <li>Two</li>
11391 </ul>
11392 !! result
11393 <ul>
11394 <li>One</li>
11395 <li>Two</li>
11396 </ul>
11397
11398 !! end
11399
11400 !! test
11401 HTML bullet list, unclosed tags (bug 5497)
11402 !! options
11403 disabled
11404 !! input
11405 <ul>
11406 <li>One
11407 <li>Two
11408 </ul>
11409 !! result
11410 <ul>
11411 <li>One
11412 </li><li>Two
11413 </li></ul>
11414
11415 !! end
11416
11417 !! test
11418 HTML ordered list, closed tags (bug 5497)
11419 !! input
11420 <ol>
11421 <li>One</li>
11422 <li>Two</li>
11423 </ol>
11424 !! result
11425 <ol>
11426 <li>One</li>
11427 <li>Two</li>
11428 </ol>
11429
11430 !! end
11431
11432 !! test
11433 HTML ordered list, unclosed tags (bug 5497)
11434 !! options
11435 disabled
11436 !! input
11437 <ol>
11438 <li>One
11439 <li>Two
11440 </ol>
11441 !! result
11442 <ol>
11443 <li>One
11444 </li><li>Two
11445 </li></ol>
11446
11447 !! end
11448
11449 !! test
11450 HTML nested bullet list, closed tags (bug 5497)
11451 !! input
11452 <ul>
11453 <li>One</li>
11454 <li>Two:
11455 <ul>
11456 <li>Sub-one</li>
11457 <li>Sub-two</li>
11458 </ul>
11459 </li>
11460 </ul>
11461 !! result
11462 <ul>
11463 <li>One</li>
11464 <li>Two:
11465 <ul>
11466 <li>Sub-one</li>
11467 <li>Sub-two</li>
11468 </ul>
11469 </li>
11470 </ul>
11471
11472 !! end
11473
11474 !! test
11475 HTML nested bullet list, open tags (bug 5497)
11476 !! options
11477 disabled
11478 !! input
11479 <ul>
11480 <li>One
11481 <li>Two:
11482 <ul>
11483 <li>Sub-one
11484 <li>Sub-two
11485 </ul>
11486 </ul>
11487 !! result
11488 <ul>
11489 <li>One
11490 </li><li>Two:
11491 <ul>
11492 <li>Sub-one
11493 </li><li>Sub-two
11494 </li></ul>
11495 </li></ul>
11496
11497 !! end
11498
11499 !! test
11500 HTML nested ordered list, closed tags (bug 5497)
11501 !! input
11502 <ol>
11503 <li>One</li>
11504 <li>Two:
11505 <ol>
11506 <li>Sub-one</li>
11507 <li>Sub-two</li>
11508 </ol>
11509 </li>
11510 </ol>
11511 !! result
11512 <ol>
11513 <li>One</li>
11514 <li>Two:
11515 <ol>
11516 <li>Sub-one</li>
11517 <li>Sub-two</li>
11518 </ol>
11519 </li>
11520 </ol>
11521
11522 !! end
11523
11524 !! test
11525 HTML nested ordered list, open tags (bug 5497)
11526 !! options
11527 disabled
11528 !! input
11529 <ol>
11530 <li>One
11531 <li>Two:
11532 <ol>
11533 <li>Sub-one
11534 <li>Sub-two
11535 </ol>
11536 </ol>
11537 !! result
11538 <ol>
11539 <li>One
11540 </li><li>Two:
11541 <ol>
11542 <li>Sub-one
11543 </li><li>Sub-two
11544 </li></ol>
11545 </li></ol>
11546
11547 !! end
11548
11549 !! test
11550 HTML ordered list item with parameters oddity
11551 !! input
11552 <ol><li id="fragment">One</li></ol>
11553 !! result
11554 <ol><li id="fragment">One</li></ol>
11555
11556 !! end
11557
11558 !!test
11559 bug 5918: autonumbering
11560 !! input
11561 [http://first/] [http://second] [ftp://ftp]
11562
11563 ftp://inlineftp
11564
11565 [mailto:enclosed@mail.tld With target]
11566
11567 [mailto:enclosed@mail.tld]
11568
11569 mailto:inline@mail.tld
11570 !! result
11571 <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>
11572 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
11573 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
11574 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
11575 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
11576 </p>
11577 !! end
11578
11579
11580 #
11581 # Security and HTML correctness
11582 # From Nick Jenkins' fuzz testing
11583 #
11584
11585 !! test
11586 Fuzz testing: Parser13
11587 !! input
11588 {|
11589 | http://a|
11590 !! result
11591 <table>
11592 <tr>
11593 <td>
11594 </td>
11595 </tr>
11596 </table>
11597
11598 !! end
11599
11600 !! test
11601 Fuzz testing: Parser14
11602 !! input
11603 == onmouseover= ==
11604 http://__TOC__
11605 !! result
11606 <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>
11607 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11608 <ul>
11609 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
11610 </ul>
11611 </div>
11612
11613 !! end
11614
11615 !! test
11616 Fuzz testing: Parser14-table
11617 !! input
11618 ==a==
11619 {| STYLE=__TOC__
11620 !! result
11621 <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>
11622 <table style="&#95;_TOC&#95;_">
11623 <tr><td></td></tr>
11624 </table>
11625
11626 !! end
11627
11628 # Known to produce bogus xml (extra </td>)
11629 !! test
11630 Fuzz testing: Parser16
11631 !! options
11632 noxml
11633 !! input
11634 {|
11635 !https://||||||
11636 !! result
11637 <table>
11638 <tr>
11639 <th>https://</th>
11640 <th></th>
11641 <th></th>
11642 <th>
11643 </td>
11644 </tr>
11645 </table>
11646
11647 !! end
11648
11649 !! test
11650 Fuzz testing: Parser21
11651 !! input
11652 {|
11653 ! irc://{{ftp://a" onmouseover="alert('hello world');"
11654 |
11655 !! result
11656 <table>
11657 <tr>
11658 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
11659 </th>
11660 <td>
11661 </td>
11662 </tr>
11663 </table>
11664
11665 !! end
11666
11667 !! test
11668 Fuzz testing: Parser22
11669 !! input
11670 http://===r:::https://b
11671
11672 {|
11673 !!result
11674 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
11675 </p>
11676 <table>
11677 <tr><td></td></tr>
11678 </table>
11679
11680 !! end
11681
11682 # Known to produce bad XML for now
11683 !! test
11684 Fuzz testing: Parser24
11685 !! options
11686 noxml
11687 !! input
11688 {|
11689 {{{|
11690 <u CLASS=
11691 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
11692 <br style="onmouseover='alert(document.cookie);' " />
11693
11694 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11695 |
11696 !! result
11697 <table>
11698 {{{|
11699 <u class="&#124;">}}}} &gt;
11700 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
11701
11702 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11703 <tr>
11704 <td></u>
11705 </td>
11706 </tr>
11707 </table>
11708
11709 !! end
11710
11711 # Note: the current result listed for this is not what the original one was,
11712 # but the original bug was JavaScript injection, which is fixed in any case.
11713 # It's not clear that the original result listed was any more correct than the
11714 # current one. Original result:
11715 # <p>{{{|
11716 # </p>
11717 # <li class="&#124;&#124;">
11718 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11719 !!test
11720 Fuzz testing: Parser25 (bug 6055)
11721 !! input
11722 {{{
11723 |
11724 <LI CLASS=||
11725 >
11726 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
11727 !! result
11728 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11729 </p>
11730 !! end
11731
11732 !!test
11733 Fuzz testing: URL adjacent extension (with space, clean)
11734 !! options
11735 !! input
11736 http://example.com <nowiki>junk</nowiki>
11737 !! result
11738 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
11739 </p>
11740 !!end
11741
11742 !!test
11743 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
11744 !! options
11745 !! input
11746 http://example.com<nowiki>junk</nowiki>
11747 !! result
11748 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
11749 </p>
11750 !!end
11751
11752 !!test
11753 Fuzz testing: URL adjacent extension (no space, dirty; pre)
11754 !! options
11755 !! input
11756 http://example.com<pre>junk</pre>
11757 !! result
11758 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
11759
11760 !!end
11761
11762 !!test
11763 Fuzz testing: image with bogus manual thumbnail
11764 !!input
11765 [[Image:foobar.jpg|thumbnail= ]]
11766 !!result
11767 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
11768
11769 !!end
11770
11771 !! test
11772 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
11773 !! input
11774 <pre dir="&#10;"></pre>
11775 !! result
11776 <pre dir="&#10;"></pre>
11777
11778 !! end
11779
11780 !! test
11781 Parsing optional HTML elements (Bug 6171)
11782 !! options
11783 !! input
11784 <table>
11785 <tr>
11786 <td> Some tabular data</td>
11787 <td> More tabular data ...
11788 <td> And yet som tabular data</td>
11789 </tr>
11790 </table>
11791 !! result
11792 <table>
11793 <tr>
11794 <td> Some tabular data</td>
11795 <td> More tabular data ...
11796 </td><td> And yet som tabular data</td>
11797 </tr>
11798 </table>
11799
11800 !! end
11801
11802 !! test
11803 Correct handling of <td>, <tr> (Bug 6171)
11804 !! options
11805 !! input
11806 <table>
11807 <tr>
11808 <td> Some tabular data</td>
11809 <td> More tabular data ...</td>
11810 <td> And yet som tabular data</td>
11811 </tr>
11812 </table>
11813 !! result
11814 <table>
11815 <tr>
11816 <td> Some tabular data</td>
11817 <td> More tabular data ...</td>
11818 <td> And yet som tabular data</td>
11819 </tr>
11820 </table>
11821
11822 !! end
11823
11824
11825 !! test
11826 Parsing crashing regression (fr:JavaScript)
11827 !! input
11828 </body></x>
11829 !! result
11830 <p>&lt;/body&gt;&lt;/x&gt;
11831 </p>
11832 !! end
11833
11834 !! test
11835 Inline wiki vs wiki block nesting
11836 !! input
11837 '''Bold paragraph
11838
11839 New wiki paragraph
11840 !! result
11841 <p><b>Bold paragraph</b>
11842 </p><p>New wiki paragraph
11843 </p>
11844 !! end
11845
11846 !! test
11847 Inline HTML vs wiki block nesting
11848 !! options
11849 disabled
11850 !! input
11851 <b>Bold paragraph
11852
11853 New wiki paragraph
11854 !! result
11855 <p><b>Bold paragraph</b>
11856 </p><p>New wiki paragraph
11857 </p>
11858 !! end
11859
11860 # Original result was this:
11861 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
11862 # </p>
11863 # While that might be marginally more intuitive, maybe, the six-apostrophe
11864 # construct is clearly pathological and the result stated here (which is what
11865 # the parser actually does) is about as reasonable as anything.
11866 !!test
11867 Mixing markup for italics and bold
11868 !! options
11869 !! input
11870 '''bold''''''bold''bolditalics'''''
11871 !! result
11872 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
11873 </p>
11874 !! end
11875
11876
11877 !! article
11878 Xyzzyx
11879 !! text
11880 Article for special page transclusion test
11881 !! endarticle
11882
11883 !! test
11884 Special page transclusion
11885 !! options
11886 !! input
11887 {{Special:Prefixindex/Xyzzyx}}
11888 !! result
11889 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11890
11891 !! end
11892
11893 !! test
11894 Special page transclusion twice (bug 5021)
11895 !! options
11896 !! input
11897 {{Special:Prefixindex/Xyzzyx}}
11898 {{Special:Prefixindex/Xyzzyx}}
11899 !! result
11900 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11901 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11902
11903 !! end
11904
11905 !! test
11906 Transclusion of default MediaWiki message
11907 !! input
11908 {{MediaWiki:Mainpage}}
11909 !!result
11910 <p>Main Page
11911 </p>
11912 !! end
11913
11914 !! test
11915 Transclusion of nonexistent MediaWiki message
11916 !! input
11917 {{MediaWiki:Mainpagexxx}}
11918 !!result
11919 <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>
11920 </p>
11921 !! end
11922
11923 !! test
11924 Transclusion of MediaWiki message with underscore
11925 !! input
11926 {{MediaWiki:history_short}}
11927 !! result
11928 <p>History
11929 </p>
11930 !! end
11931
11932 !! test
11933 Transclusion of MediaWiki message with space
11934 !! input
11935 {{MediaWiki:history short}}
11936 !! result
11937 <p>History
11938 </p>
11939 !! end
11940
11941 !! test
11942 Invalid header with following text
11943 !! input
11944 = x = y
11945 !! result
11946 <p>= x = y
11947 </p>
11948 !! end
11949
11950
11951 !! test
11952 Section extraction test (section 0)
11953 !! options
11954 section=0
11955 !! input
11956 start
11957 ==a==
11958 ===aa===
11959 ====aaa====
11960 ==b==
11961 ===ba===
11962 ===bb===
11963 ====bba====
11964 ===bc===
11965 ==c==
11966 ===ca===
11967 !! result
11968 start
11969 !! end
11970
11971 !! test
11972 Section extraction test (section 1)
11973 !! options
11974 section=1
11975 !! input
11976 start
11977 ==a==
11978 ===aa===
11979 ====aaa====
11980 ==b==
11981 ===ba===
11982 ===bb===
11983 ====bba====
11984 ===bc===
11985 ==c==
11986 ===ca===
11987 !! result
11988 ==a==
11989 ===aa===
11990 ====aaa====
11991 !! end
11992
11993 !! test
11994 Section extraction test (section 2)
11995 !! options
11996 section=2
11997 !! input
11998 start
11999 ==a==
12000 ===aa===
12001 ====aaa====
12002 ==b==
12003 ===ba===
12004 ===bb===
12005 ====bba====
12006 ===bc===
12007 ==c==
12008 ===ca===
12009 !! result
12010 ===aa===
12011 ====aaa====
12012 !! end
12013
12014 !! test
12015 Section extraction test (section 3)
12016 !! options
12017 section=3
12018 !! input
12019 start
12020 ==a==
12021 ===aa===
12022 ====aaa====
12023 ==b==
12024 ===ba===
12025 ===bb===
12026 ====bba====
12027 ===bc===
12028 ==c==
12029 ===ca===
12030 !! result
12031 ====aaa====
12032 !! end
12033
12034 !! test
12035 Section extraction test (section 4)
12036 !! options
12037 section=4
12038 !! input
12039 start
12040 ==a==
12041 ===aa===
12042 ====aaa====
12043 ==b==
12044 ===ba===
12045 ===bb===
12046 ====bba====
12047 ===bc===
12048 ==c==
12049 ===ca===
12050 !! result
12051 ==b==
12052 ===ba===
12053 ===bb===
12054 ====bba====
12055 ===bc===
12056 !! end
12057
12058 !! test
12059 Section extraction test (section 5)
12060 !! options
12061 section=5
12062 !! input
12063 start
12064 ==a==
12065 ===aa===
12066 ====aaa====
12067 ==b==
12068 ===ba===
12069 ===bb===
12070 ====bba====
12071 ===bc===
12072 ==c==
12073 ===ca===
12074 !! result
12075 ===ba===
12076 !! end
12077
12078 !! test
12079 Section extraction test (section 6)
12080 !! options
12081 section=6
12082 !! input
12083 start
12084 ==a==
12085 ===aa===
12086 ====aaa====
12087 ==b==
12088 ===ba===
12089 ===bb===
12090 ====bba====
12091 ===bc===
12092 ==c==
12093 ===ca===
12094 !! result
12095 ===bb===
12096 ====bba====
12097 !! end
12098
12099 !! test
12100 Section extraction test (section 7)
12101 !! options
12102 section=7
12103 !! input
12104 start
12105 ==a==
12106 ===aa===
12107 ====aaa====
12108 ==b==
12109 ===ba===
12110 ===bb===
12111 ====bba====
12112 ===bc===
12113 ==c==
12114 ===ca===
12115 !! result
12116 ====bba====
12117 !! end
12118
12119 !! test
12120 Section extraction test (section 8)
12121 !! options
12122 section=8
12123 !! input
12124 start
12125 ==a==
12126 ===aa===
12127 ====aaa====
12128 ==b==
12129 ===ba===
12130 ===bb===
12131 ====bba====
12132 ===bc===
12133 ==c==
12134 ===ca===
12135 !! result
12136 ===bc===
12137 !! end
12138
12139 !! test
12140 Section extraction test (section 9)
12141 !! options
12142 section=9
12143 !! input
12144 start
12145 ==a==
12146 ===aa===
12147 ====aaa====
12148 ==b==
12149 ===ba===
12150 ===bb===
12151 ====bba====
12152 ===bc===
12153 ==c==
12154 ===ca===
12155 !! result
12156 ==c==
12157 ===ca===
12158 !! end
12159
12160 !! test
12161 Section extraction test (section 10)
12162 !! options
12163 section=10
12164 !! input
12165 start
12166 ==a==
12167 ===aa===
12168 ====aaa====
12169 ==b==
12170 ===ba===
12171 ===bb===
12172 ====bba====
12173 ===bc===
12174 ==c==
12175 ===ca===
12176 !! result
12177 ===ca===
12178 !! end
12179
12180 !! test
12181 Section extraction test (nonexistent section 11)
12182 !! options
12183 section=11
12184 !! input
12185 start
12186 ==a==
12187 ===aa===
12188 ====aaa====
12189 ==b==
12190 ===ba===
12191 ===bb===
12192 ====bba====
12193 ===bc===
12194 ==c==
12195 ===ca===
12196 !! result
12197 !! end
12198
12199 !! test
12200 Section extraction test with bogus heading (section 1)
12201 !! options
12202 section=1
12203 !! input
12204 ==a==
12205 ==bogus== not a legal section
12206 ==b==
12207 !! result
12208 ==a==
12209 ==bogus== not a legal section
12210 !! end
12211
12212 !! test
12213 Section extraction test with bogus heading (section 2)
12214 !! options
12215 section=2
12216 !! input
12217 ==a==
12218 ==bogus== not a legal section
12219 ==b==
12220 !! result
12221 ==b==
12222 !! end
12223
12224 !! test
12225 Section extraction test with comment after heading (section 1)
12226 !! options
12227 section=1
12228 !! input
12229 ==a==
12230 ==b== <!-- -->
12231 ==c==
12232 !! result
12233 ==a==
12234 !! end
12235
12236 !! test
12237 Section extraction test with comment after heading (section 2)
12238 !! options
12239 section=2
12240 !! input
12241 ==a==
12242 ==b== <!-- -->
12243 ==c==
12244 !! result
12245 ==b== <!-- -->
12246 !! end
12247
12248 !! test
12249 Section extraction test with bogus <nowiki> heading (section 1)
12250 !! options
12251 section=1
12252 !! input
12253 ==a==
12254 ==bogus== <nowiki>not a legal section</nowiki>
12255 ==b==
12256 !! result
12257 ==a==
12258 ==bogus== <nowiki>not a legal section</nowiki>
12259 !! end
12260
12261 !! test
12262 Section extraction test with bogus <nowiki> heading (section 2)
12263 !! options
12264 section=2
12265 !! input
12266 ==a==
12267 ==bogus== <nowiki>not a legal section</nowiki>
12268 ==b==
12269 !! result
12270 ==b==
12271 !! end
12272
12273
12274 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
12275 # instead of respecting commented sections
12276 !! test
12277 Section extraction prefixed by comment (section 1)
12278 !! options
12279 section=1
12280 !! input
12281 <!-- -->==sec1==
12282 ==sec2==
12283 !!result
12284 ==sec2==
12285 !!end
12286
12287 !! test
12288 Section extraction prefixed by comment (section 2)
12289 !! options
12290 section=2
12291 !! input
12292 <!-- -->==sec1==
12293 ==sec2==
12294 !!result
12295
12296 !!end
12297
12298
12299 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
12300 # instead of respecting HTML-style headings
12301 !! test
12302 Section extraction, mixed wiki and html (section 1)
12303 !! options
12304 section=1
12305 !! input
12306 <h2>unmarked</h2>
12307 unmarked
12308 ==1==
12309 one
12310 ==2==
12311 two
12312 !! result
12313 ==1==
12314 one
12315 !! end
12316
12317 !! test
12318 Section extraction, mixed wiki and html (section 2)
12319 !! options
12320 section=2
12321 !! input
12322 <h2>unmarked</h2>
12323 unmarked
12324 ==1==
12325 one
12326 ==2==
12327 two
12328 !! result
12329 ==2==
12330 two
12331 !! end
12332
12333
12334 # Formerly testing for bug 3342
12335 !! test
12336 Section extraction, heading surrounded by <noinclude>
12337 !! options
12338 section=1
12339 !! input
12340 <noinclude>==unmarked==</noinclude>
12341 ==marked==
12342 !! result
12343 ==marked==
12344 !!end
12345
12346 # Test behavior of bug 19910
12347 !! test
12348 Sectiion with all-equals
12349 !! options
12350 section=2
12351 !! input
12352 ===
12353 The line above must have a trailing space
12354 === <!--
12355 --> <!-- -->
12356 But just in case it doesn't...
12357 !! result
12358 === <!--
12359 --> <!-- -->
12360 But just in case it doesn't...
12361 !! end
12362
12363 !! test
12364 Section replacement test (section 0)
12365 !! options
12366 replace=0,"xxx"
12367 !! input
12368 start
12369 ==a==
12370 ===aa===
12371 ====aaa====
12372 ==b==
12373 ===ba===
12374 ===bb===
12375 ====bba====
12376 ===bc===
12377 ==c==
12378 ===ca===
12379 !! result
12380 xxx
12381
12382 ==a==
12383 ===aa===
12384 ====aaa====
12385 ==b==
12386 ===ba===
12387 ===bb===
12388 ====bba====
12389 ===bc===
12390 ==c==
12391 ===ca===
12392 !! end
12393
12394 !! test
12395 Section replacement test (section 1)
12396 !! options
12397 replace=1,"xxx"
12398 !! input
12399 start
12400 ==a==
12401 ===aa===
12402 ====aaa====
12403 ==b==
12404 ===ba===
12405 ===bb===
12406 ====bba====
12407 ===bc===
12408 ==c==
12409 ===ca===
12410 !! result
12411 start
12412 xxx
12413
12414 ==b==
12415 ===ba===
12416 ===bb===
12417 ====bba====
12418 ===bc===
12419 ==c==
12420 ===ca===
12421 !! end
12422
12423 !! test
12424 Section replacement test (section 2)
12425 !! options
12426 replace=2,"xxx"
12427 !! input
12428 start
12429 ==a==
12430 ===aa===
12431 ====aaa====
12432 ==b==
12433 ===ba===
12434 ===bb===
12435 ====bba====
12436 ===bc===
12437 ==c==
12438 ===ca===
12439 !! result
12440 start
12441 ==a==
12442 xxx
12443
12444 ==b==
12445 ===ba===
12446 ===bb===
12447 ====bba====
12448 ===bc===
12449 ==c==
12450 ===ca===
12451 !! end
12452
12453 !! test
12454 Section replacement test (section 3)
12455 !! options
12456 replace=3,"xxx"
12457 !! input
12458 start
12459 ==a==
12460 ===aa===
12461 ====aaa====
12462 ==b==
12463 ===ba===
12464 ===bb===
12465 ====bba====
12466 ===bc===
12467 ==c==
12468 ===ca===
12469 !! result
12470 start
12471 ==a==
12472 ===aa===
12473 xxx
12474
12475 ==b==
12476 ===ba===
12477 ===bb===
12478 ====bba====
12479 ===bc===
12480 ==c==
12481 ===ca===
12482 !! end
12483
12484 !! test
12485 Section replacement test (section 4)
12486 !! options
12487 replace=4,"xxx"
12488 !! input
12489 start
12490 ==a==
12491 ===aa===
12492 ====aaa====
12493 ==b==
12494 ===ba===
12495 ===bb===
12496 ====bba====
12497 ===bc===
12498 ==c==
12499 ===ca===
12500 !! result
12501 start
12502 ==a==
12503 ===aa===
12504 ====aaa====
12505 xxx
12506
12507 ==c==
12508 ===ca===
12509 !! end
12510
12511 !! test
12512 Section replacement test (section 5)
12513 !! options
12514 replace=5,"xxx"
12515 !! input
12516 start
12517 ==a==
12518 ===aa===
12519 ====aaa====
12520 ==b==
12521 ===ba===
12522 ===bb===
12523 ====bba====
12524 ===bc===
12525 ==c==
12526 ===ca===
12527 !! result
12528 start
12529 ==a==
12530 ===aa===
12531 ====aaa====
12532 ==b==
12533 xxx
12534
12535 ===bb===
12536 ====bba====
12537 ===bc===
12538 ==c==
12539 ===ca===
12540 !! end
12541
12542 !! test
12543 Section replacement test (section 6)
12544 !! options
12545 replace=6,"xxx"
12546 !! input
12547 start
12548 ==a==
12549 ===aa===
12550 ====aaa====
12551 ==b==
12552 ===ba===
12553 ===bb===
12554 ====bba====
12555 ===bc===
12556 ==c==
12557 ===ca===
12558 !! result
12559 start
12560 ==a==
12561 ===aa===
12562 ====aaa====
12563 ==b==
12564 ===ba===
12565 xxx
12566
12567 ===bc===
12568 ==c==
12569 ===ca===
12570 !! end
12571
12572 !! test
12573 Section replacement test (section 7)
12574 !! options
12575 replace=7,"xxx"
12576 !! input
12577 start
12578 ==a==
12579 ===aa===
12580 ====aaa====
12581 ==b==
12582 ===ba===
12583 ===bb===
12584 ====bba====
12585 ===bc===
12586 ==c==
12587 ===ca===
12588 !! result
12589 start
12590 ==a==
12591 ===aa===
12592 ====aaa====
12593 ==b==
12594 ===ba===
12595 ===bb===
12596 xxx
12597
12598 ===bc===
12599 ==c==
12600 ===ca===
12601 !! end
12602
12603 !! test
12604 Section replacement test (section 8)
12605 !! options
12606 replace=8,"xxx"
12607 !! input
12608 start
12609 ==a==
12610 ===aa===
12611 ====aaa====
12612 ==b==
12613 ===ba===
12614 ===bb===
12615 ====bba====
12616 ===bc===
12617 ==c==
12618 ===ca===
12619 !! result
12620 start
12621 ==a==
12622 ===aa===
12623 ====aaa====
12624 ==b==
12625 ===ba===
12626 ===bb===
12627 ====bba====
12628 xxx
12629
12630 ==c==
12631 ===ca===
12632 !!end
12633
12634 !! test
12635 Section replacement test (section 9)
12636 !! options
12637 replace=9,"xxx"
12638 !! input
12639 start
12640 ==a==
12641 ===aa===
12642 ====aaa====
12643 ==b==
12644 ===ba===
12645 ===bb===
12646 ====bba====
12647 ===bc===
12648 ==c==
12649 ===ca===
12650 !! result
12651 start
12652 ==a==
12653 ===aa===
12654 ====aaa====
12655 ==b==
12656 ===ba===
12657 ===bb===
12658 ====bba====
12659 ===bc===
12660 xxx
12661 !! end
12662
12663 !! test
12664 Section replacement test (section 10)
12665 !! options
12666 replace=10,"xxx"
12667 !! input
12668 start
12669 ==a==
12670 ===aa===
12671 ====aaa====
12672 ==b==
12673 ===ba===
12674 ===bb===
12675 ====bba====
12676 ===bc===
12677 ==c==
12678 ===ca===
12679 !! result
12680 start
12681 ==a==
12682 ===aa===
12683 ====aaa====
12684 ==b==
12685 ===ba===
12686 ===bb===
12687 ====bba====
12688 ===bc===
12689 ==c==
12690 xxx
12691 !! end
12692
12693 !! test
12694 Section replacement test with initial whitespace (bug 13728)
12695 !! options
12696 replace=2,"xxx"
12697 !! input
12698 Preformatted initial line
12699 ==a==
12700 ===a===
12701 !! result
12702 Preformatted initial line
12703 ==a==
12704 xxx
12705 !! end
12706
12707
12708 !! test
12709 Section extraction, heading followed by pre with 20 spaces (bug 6398)
12710 !! options
12711 section=1
12712 !! input
12713 ==a==
12714 a
12715 !! result
12716 ==a==
12717 a
12718 !! end
12719
12720 !! test
12721 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
12722 !! options
12723 section=1
12724 !! input
12725 ==a==
12726 a
12727 !! result
12728 ==a==
12729 a
12730 !! end
12731
12732
12733 !! test
12734 Section extraction, <pre> around bogus header (bug 10309)
12735 !! options
12736 noxml section=2
12737 !! input
12738 == Section One ==
12739 <pre>
12740 =======
12741 </pre>
12742
12743 == Section Two ==
12744 stuff
12745 !! result
12746 == Section Two ==
12747 stuff
12748 !! end
12749
12750 !! test
12751 Section replacement, <pre> around bogus header (bug 10309)
12752 !! options
12753 noxml replace=2,"xxx"
12754 !! input
12755 == Section One ==
12756 <pre>
12757 =======
12758 </pre>
12759
12760 == Section Two ==
12761 stuff
12762 !! result
12763 == Section One ==
12764 <pre>
12765 =======
12766 </pre>
12767
12768 xxx
12769 !! end
12770
12771
12772
12773 !! test
12774 Handling of &#x0A; in URLs
12775 !! input
12776 **irc://&#x0A;a
12777 !! result
12778 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
12779 </li></ul>
12780 </li></ul>
12781
12782 !!end
12783
12784 !! test
12785 5 quotes, code coverage +1 line (php)
12786 !! options
12787 php
12788 !! input
12789 '''''
12790 !! result
12791 !! end
12792 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
12793 !! test
12794 5 quotes, code coverage +1 line (parsoid)
12795 !! options
12796 parsoid
12797 !! input
12798 '''''
12799 !! result
12800 <p><i><b></b></i></p>
12801 !! end
12802
12803 !! test
12804 Special:Search page linking.
12805 !! input
12806 {{Special:search}}
12807 !! result
12808 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
12809 </p>
12810 !! end
12811
12812 !! test
12813 Say the magic word
12814 !! options
12815 title=[[Parser test]]
12816 !! input
12817 * {{PAGENAME}}
12818 * {{PAGENAMEE}}
12819 * {{FULLPAGENAME}}
12820 * {{FULLPAGENAMEE}}
12821 * {{BASEPAGENAME}}
12822 * {{BASEPAGENAMEE}}
12823 * {{SUBPAGENAME}}
12824 * {{SUBPAGENAMEE}}
12825 * {{ROOTPAGENAME}}
12826 * {{ROOTPAGENAMEE}}
12827 * {{TALKPAGENAME}}
12828 * {{TALKPAGENAMEE}}
12829 * {{SUBJECTPAGENAME}}
12830 * {{SUBJECTPAGENAMEE}}
12831 * {{NAMESPACEE}}
12832 * {{NAMESPACE}}
12833 * {{NAMESPACENUMBER}}
12834 * {{TALKSPACE}}
12835 * {{TALKSPACEE}}
12836 * {{SUBJECTSPACE}}
12837 * {{SUBJECTSPACEE}}
12838 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
12839 !! result
12840 <ul><li> Parser test
12841 </li><li> Parser_test
12842 </li><li> Parser test
12843 </li><li> Parser_test
12844 </li><li> Parser test
12845 </li><li> Parser_test
12846 </li><li> Parser test
12847 </li><li> Parser_test
12848 </li><li> Parser test
12849 </li><li> Parser_test
12850 </li><li> Talk:Parser test
12851 </li><li> Talk:Parser_test
12852 </li><li> Parser test
12853 </li><li> Parser_test
12854 </li><li>
12855 </li><li>
12856 </li><li> 0
12857 </li><li> Talk
12858 </li><li> Talk
12859 </li><li>
12860 </li><li>
12861 </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>
12862 </li></ul>
12863
12864 !! end
12865 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
12866
12867 !! test
12868 Gallery
12869 !! input
12870 <gallery>
12871 image1.png |
12872 image2.gif|||||
12873
12874 image3|
12875 image4 |300px| centre
12876 image5.svg| http://///////
12877 [[x|xx]]]]
12878 * image6
12879 </gallery>
12880 !! result
12881 <ul class="gallery mw-gallery-traditional">
12882 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12883 <div class="thumb" style="height: 150px;">Image1.png</div>
12884 <div class="gallerytext">
12885 </div>
12886 </div></li>
12887 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12888 <div class="thumb" style="height: 150px;">Image2.gif</div>
12889 <div class="gallerytext">
12890 <p>||||
12891 </p>
12892 </div>
12893 </div></li>
12894 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12895 <div class="thumb" style="height: 150px;">Image3</div>
12896 <div class="gallerytext">
12897 </div>
12898 </div></li>
12899 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12900 <div class="thumb" style="height: 150px;">Image4</div>
12901 <div class="gallerytext">
12902 <p>300px| centre
12903 </p>
12904 </div>
12905 </div></li>
12906 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12907 <div class="thumb" style="height: 150px;">Image5.svg</div>
12908 <div class="gallerytext">
12909 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
12910 </p>
12911 </div>
12912 </div></li>
12913 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12914 <div class="thumb" style="height: 150px;">* image6</div>
12915 <div class="gallerytext">
12916 </div>
12917 </div></li>
12918 </ul>
12919
12920 !! end
12921
12922 !! test
12923 Gallery (with options)
12924 !! input
12925 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
12926 File:Nonexistant.jpg|caption
12927 File:Nonexistant.jpg
12928 image:foobar.jpg|some '''caption''' [[Main Page]]
12929 image:foobar.jpg
12930 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
12931 </gallery>
12932 !! result
12933 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
12934 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
12935 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12936 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
12937 <div class="gallerytext">
12938 <p>caption
12939 </p>
12940 </div>
12941 </div></li>
12942 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12943 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
12944 <div class="gallerytext">
12945 </div>
12946 </div></li>
12947 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12948 <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>
12949 <div class="gallerytext">
12950 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12951 </p>
12952 </div>
12953 </div></li>
12954 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12955 <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>
12956 <div class="gallerytext">
12957 </div>
12958 </div></li>
12959 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12960 <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>
12961 <div class="gallerytext">
12962 <p>Blabla|blabla.
12963 </p>
12964 </div>
12965 </div></li>
12966 </ul>
12967
12968 !! end
12969
12970 !! test
12971 Gallery with wikitext inside caption
12972 !! input
12973 <gallery>
12974 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
12975 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
12976 </gallery>
12977 !! result
12978 <ul class="gallery mw-gallery-traditional">
12979 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12980 <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>
12981 <div class="gallerytext">
12982 <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>
12983 </p>
12984 </div>
12985 </div></li>
12986 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12987 <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>
12988 <div class="gallerytext">
12989 <p>This is a test template
12990 </p>
12991 </div>
12992 </div></li>
12993 </ul>
12994
12995 !! end
12996
12997 !! test
12998 gallery (with showfilename option)
12999 !! input
13000 <gallery showfilename>
13001 File:Nonexistant.jpg|caption
13002 File:Nonexistant.jpg
13003 image:foobar.jpg|some '''caption''' [[Main Page]]
13004 File:Foobar.jpg
13005 </gallery>
13006 !! result
13007 <ul class="gallery mw-gallery-traditional">
13008 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13009 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13010 <div class="gallerytext">
13011 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
13012 caption
13013 </p>
13014 </div>
13015 </div></li>
13016 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13017 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13018 <div class="gallerytext">
13019 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
13020 </p>
13021 </div>
13022 </div></li>
13023 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13024 <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>
13025 <div class="gallerytext">
13026 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
13027 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13028 </p>
13029 </div>
13030 </div></li>
13031 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13032 <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>
13033 <div class="gallerytext">
13034 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
13035 </p>
13036 </div>
13037 </div></li>
13038 </ul>
13039
13040 !! end
13041
13042 !! test
13043 Gallery (with namespace-less filenames)
13044 !! input
13045 <gallery>
13046 File:Nonexistant.jpg
13047 Nonexistant.jpg
13048 image:foobar.jpg
13049 foobar.jpg
13050 </gallery>
13051 !! result
13052 <ul class="gallery mw-gallery-traditional">
13053 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13054 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13055 <div class="gallerytext">
13056 </div>
13057 </div></li>
13058 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13059 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13060 <div class="gallerytext">
13061 </div>
13062 </div></li>
13063 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13064 <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>
13065 <div class="gallerytext">
13066 </div>
13067 </div></li>
13068 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13069 <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>
13070 <div class="gallerytext">
13071 </div>
13072 </div></li>
13073 </ul>
13074
13075 !! end
13076
13077 !! test
13078 HTML Hex character encoding (spells the word "JavaScript")
13079 !! input
13080 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
13081 !! result
13082 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
13083 </p>
13084 !! end
13085
13086 !! test
13087 HTML Hex character encoding bogus encoding (bug 26437 regression check)
13088 !! input
13089 &#xsee;&#XSEE;
13090 !! result
13091 <p>&amp;#xsee;&amp;#XSEE;
13092 </p>
13093 !! end
13094
13095 !! test
13096 HTML Hex character encoding mixed case
13097 !! input
13098 &#xEE;&#Xee;
13099 !! result
13100 <p>&#xee;&#xee;
13101 </p>
13102 !! end
13103
13104 !! test
13105 __FORCETOC__ override
13106 !! input
13107 __NEWSECTIONLINK__
13108 __FORCETOC__
13109 !! result
13110 <p><br />
13111 </p>
13112 !! end
13113
13114 !! test
13115 ISBN code coverage
13116 !! input
13117 ISBN 978-0-1234-56&#x20;789
13118 !! result
13119 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
13120 </p>
13121 !! end
13122
13123 !! test
13124 ISBN followed by 5 spaces
13125 !! input
13126 ISBN
13127 !! result
13128 <p>ISBN
13129 </p>
13130 !! end
13131
13132 !! test
13133 Double ISBN
13134 !! input
13135 ISBN ISBN 1234567890
13136 !! result
13137 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13138 </p>
13139 !! end
13140
13141 !! test
13142 Bug 22905: <abbr> followed by ISBN followed by </a>
13143 !! input
13144 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
13145 !! result
13146 <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>
13147 </p>
13148 !! end
13149
13150 !! test
13151 Double RFC
13152 !! input
13153 RFC RFC 1234
13154 !! result
13155 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
13156 </p>
13157 !! end
13158
13159 !! test
13160 Double RFC with a wiki link
13161 !! input
13162 RFC [[RFC 1234]]
13163 !! result
13164 <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>
13165 </p>
13166 !! end
13167
13168 !! test
13169 RFC code coverage
13170 !! input
13171 RFC 983&#x20;987
13172 !! result
13173 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
13174 </p>
13175 !! end
13176
13177 !! test
13178 Centre-aligned image
13179 !! input
13180 [[Image:foobar.jpg|centre]]
13181 !! result
13182 <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>
13183
13184 !!end
13185
13186 !! test
13187 None-aligned image
13188 !! input
13189 [[Image:foobar.jpg|none]]
13190 !! result
13191 <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>
13192
13193 !!end
13194
13195 !! test
13196 Width + Height sized image (using px) (height is ignored)
13197 !! input
13198 [[Image:foobar.jpg|640x480px]]
13199 !! result
13200 <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>
13201 </p>
13202 !!end
13203
13204 !! test
13205 Width-sized image (using px, no following whitespace)
13206 !! input
13207 [[Image:foobar.jpg|640px]]
13208 !! result
13209 <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>
13210 </p>
13211 !!end
13212
13213 !! test
13214 Width-sized image (using px, with following whitespace - test regression from r39467)
13215 !! input
13216 [[Image:foobar.jpg|640px ]]
13217 !! result
13218 <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>
13219 </p>
13220 !!end
13221
13222 !! test
13223 Width-sized image (using px, with preceding whitespace - test regression from r39467)
13224 !! input
13225 [[Image:foobar.jpg| 640px]]
13226 !! result
13227 <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>
13228 </p>
13229 !!end
13230
13231 !! test
13232 Another italics / bold test
13233 !! input
13234 ''' ''x'
13235 !! result
13236 <pre>'<i> </i>x'
13237 </pre>
13238 !!end
13239
13240 # Note the results may be incorrect, as parserTest output included this:
13241 # XML error: Mismatched tag at byte 6120:
13242 # ...<dd> </dt></dl> </dd...
13243 !! test
13244 dt/dd/dl test
13245 !! options
13246 disabled
13247 !! input
13248 :;;;::
13249 !! result
13250 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
13251 </dd></dl>
13252 </dd></dl>
13253 </dt></dl>
13254 </dt></dl>
13255 </dt></dl>
13256 </dd></dl>
13257
13258 !!end
13259
13260
13261 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
13262 !! test
13263 Images with the "|" character in the comment
13264 !! input
13265 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
13266 !! result
13267 <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>
13268
13269 !!end
13270
13271 !! test
13272 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
13273 !! input
13274 <html><script>alert(1);</script></html>
13275 !! result
13276 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
13277 </p>
13278 !! end
13279
13280 !! test
13281 HTML with raw HTML ($wgRawHtml==true)
13282 !! options
13283 wgRawHtml=1
13284 !! input
13285 <html><script>alert(1);</script></html>
13286 !! result
13287 <p><script>alert(1);</script>
13288 </p>
13289 !! end
13290
13291 !! test
13292 Parents of subpages, one level up
13293 !! options
13294 subpage title=[[Subpage test/L1/L2/L3]]
13295 !! input
13296 [[../|L2]]
13297 !! result
13298 <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>
13299 </p>
13300 !! end
13301
13302
13303 !! test
13304 Parents of subpages, one level up, not named
13305 !! options
13306 subpage title=[[Subpage test/L1/L2/L3]]
13307 !! input
13308 [[../]]
13309 !! result
13310 <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>
13311 </p>
13312 !! end
13313
13314
13315
13316 !! test
13317 Parents of subpages, two levels up
13318 !! options
13319 subpage title=[[Subpage test/L1/L2/L3]]
13320 !! input
13321 [[../../|L1]]2
13322
13323 [[../../|L1]]l
13324 !! result
13325 <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
13326 </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>
13327 </p>
13328 !! end
13329
13330 !! test
13331 Parents of subpages, two levels up, without trailing slash or name.
13332 !! options
13333 subpage title=[[Subpage test/L1/L2/L3]]
13334 !! input
13335 [[../..]]
13336 !! result
13337 <p>[[../..]]
13338 </p>
13339 !! end
13340
13341 !! test
13342 Parents of subpages, two levels up, with lots of extra trailing slashes.
13343 !! options
13344 subpage title=[[Subpage test/L1/L2/L3]]
13345 !! input
13346 [[../../////]]
13347 !! result
13348 <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>
13349 </p>
13350 !! end
13351
13352 !! article
13353 Subpage test/L1/L2/L3Sibling
13354 !! text
13355 Sibling article
13356 !! endarticle
13357
13358 !! test
13359 Transclusion of a sibling page (one level up)
13360 !! options
13361 subpage title=[[Subpage test/L1/L2/L3]]
13362 !! input
13363 {{../L3Sibling}}
13364 !! result
13365 <p>Sibling article
13366 </p>
13367 !! end
13368
13369 !! test
13370 Transclusion of a child page
13371 !! options
13372 subpage title=[[Subpage test/L1/L2]]
13373 !! input
13374 {{/L3Sibling}}
13375 !! result
13376 <p>Sibling article
13377 </p>
13378 !! end
13379
13380 !! test
13381 Non-transclusion because of too many up levels
13382 !! options
13383 subpage title=[[Subpage test/L1/L2/L3]]
13384 !! input
13385 {{../../../../More than parent}}
13386 !! result
13387 <p>{{../../../../More than parent}}
13388 </p>
13389 !! end
13390
13391 !! test
13392 Definition list code coverage
13393 !! input
13394 ; title : def
13395 ; title : def
13396 ;title: def
13397 !! result
13398 <dl><dt> title &#160;</dt><dd> def
13399 </dd><dt> title&#160;</dt><dd> def
13400 </dd><dt>title</dt><dd> def
13401 </dd></dl>
13402
13403 !! end
13404
13405 !! test
13406 Don't fall for the self-closing div
13407 !! input
13408 <div>hello world</div/>
13409 !! result
13410 <div>hello world</div>
13411
13412 !! end
13413
13414 !! test
13415 MSGNW magic word
13416 !! input
13417 {{MSGNW:msg}}
13418 !! result
13419 <p>&#91;&#91;:Template:Msg&#93;&#93;
13420 </p>
13421 !! end
13422
13423 !! test
13424 RAW magic word
13425 !! input
13426 {{RAW:QUERTY}}
13427 !! result
13428 <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>
13429 </p>
13430 !! end
13431
13432 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
13433 !! test
13434 Always escape literal '>' in output, not just after '<'
13435 !! input
13436 ><>
13437 !! result
13438 <p>&gt;&lt;&gt;
13439 </p>
13440 !! end
13441
13442 !! test
13443 Template caching
13444 !! input
13445 {{Test}}
13446 {{Test}}
13447 !! result
13448 <p>This is a test template
13449 This is a test template
13450 </p>
13451 !! end
13452
13453
13454 !! article
13455 MediaWiki:Fake
13456 !! text
13457 ==header==
13458 !! endarticle
13459
13460 !! test
13461 Inclusion of !userCanEdit() content
13462 !! input
13463 {{MediaWiki:Fake}}
13464 !! result
13465 <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>
13466
13467 !! end
13468
13469
13470 !! test
13471 Out-of-order TOC heading levels
13472 !! input
13473 ==2==
13474 ======6======
13475 ===3===
13476 =1=
13477 =====5=====
13478 ==2==
13479 !! result
13480 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13481 <ul>
13482 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
13483 <ul>
13484 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
13485 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
13486 </ul>
13487 </li>
13488 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
13489 <ul>
13490 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
13491 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
13492 </ul>
13493 </li>
13494 </ul>
13495 </div>
13496 <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>
13497 <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>
13498 <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>
13499 <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>
13500 <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>
13501 <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>
13502
13503 !! end
13504
13505
13506 !! test
13507 ISBN with a dummy number
13508 !! input
13509 ISBN ---
13510 !! result
13511 <p>ISBN ---
13512 </p>
13513 !! end
13514
13515
13516 !! test
13517 ISBN with space-delimited number
13518 !! input
13519 ISBN 92 9017 032 8
13520 !! result
13521 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
13522 </p>
13523 !! end
13524
13525
13526 !! test
13527 ISBN with multiple spaces, no number
13528 !! input
13529 ISBN foo
13530 !! result
13531 <p>ISBN foo
13532 </p>
13533 !! end
13534
13535
13536 !! test
13537 ISBN length
13538 !! input
13539 ISBN 123456789
13540
13541 ISBN 1234567890
13542
13543 ISBN 12345678901
13544 !! result
13545 <p>ISBN 123456789
13546 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13547 </p><p>ISBN 12345678901
13548 </p>
13549 !! end
13550
13551
13552 !! test
13553 ISBN with trailing year (bug 8110)
13554 !! input
13555 ISBN 1-234-56789-0 - 2006
13556
13557 ISBN 1 234 56789 0 - 2006
13558 !! result
13559 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
13560 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
13561 </p>
13562 !! end
13563
13564
13565 !! test
13566 anchorencode
13567 !! input
13568 {{anchorencode:foo bar©#%n}}
13569 !! result
13570 <p>foo_bar.C2.A9.23.25n
13571 </p>
13572 !! end
13573
13574 !! test
13575 anchorencode trims spaces
13576 !! input
13577 {{anchorencode: __pretty__please__}}
13578 !! result
13579 <p>pretty_please
13580 </p>
13581 !! end
13582
13583 !! test
13584 anchorencode deals with links
13585 !! input
13586 {{anchorencode: [[hello|world]] [[hi]]}}
13587 !! result
13588 <p>world_hi
13589 </p>
13590 !! end
13591
13592 !! test
13593 anchorencode deals with templates
13594 !! input
13595 {{anchorencode: {{Foo}} }}
13596 !! result
13597 <p>FOO
13598 </p>
13599 !! end
13600
13601 !! test
13602 anchorencode encodes like the TOC generator: (bug 18431)
13603 !! input
13604 === _ +:.3A%3A&&amp;]] ===
13605 {{anchorencode: _ +:.3A%3A&&amp;]] }}
13606 __NOEDITSECTION__
13607 !! result
13608 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
13609 <p>.2B:.3A.253A.26.26.5D.5D
13610 </p>
13611 !! end
13612
13613 # Expected output in the following test is not necessarily expected (there
13614 # should probably be <p> tags inside the <blockquote> in the output) -- it's
13615 # only testing for well-formedness.
13616 !! test
13617 Bug 6200: blockquotes and paragraph formatting
13618 !! input
13619 <blockquote>
13620 foo
13621 </blockquote>
13622
13623 bar
13624
13625 baz
13626 !! result
13627 <blockquote>
13628 foo
13629 </blockquote>
13630 <p>bar
13631 </p>
13632 <pre>baz
13633 </pre>
13634 !! end
13635
13636 !! test
13637 Bug 8293: Use of center tag ruins paragraph formatting
13638 !! input
13639 <center>
13640 foo
13641 </center>
13642
13643 bar
13644
13645 baz
13646 !! result
13647 <center>
13648 <p>foo
13649 </p>
13650 </center>
13651 <p>bar
13652 </p>
13653 <pre>baz
13654 </pre>
13655 !! end
13656
13657 !!test
13658 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
13659 !!options
13660 php
13661 !!input
13662 <span><s>x</span></s>
13663 !!result
13664 <p><span><s>x&lt;/span&gt;</s></span>
13665 </p>
13666 !!end
13667
13668 !!test
13669 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
13670 !!options
13671 parsoid
13672 !!input
13673 <span><s>x</span></s>
13674 !!result
13675 <p><span><s>x</s></span><s></s>
13676 </p>
13677 !!end
13678
13679 ###
13680 ### Language variants related tests
13681 ###
13682 !! test
13683 Self-link in language variants
13684 !! options
13685 title=[[Dunav]] language=sr
13686 !! input
13687 Both [[Dunav]] and [[Дунав]] are names for this river.
13688 !! result
13689 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
13690 </p>
13691 !!end
13692
13693 !! article
13694 Дуна
13695 !! text
13696 content
13697 !! endarticle
13698
13699 !! test
13700 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
13701 !! options
13702 title=[[Duna]] language=sr
13703 !! input
13704 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
13705 !! result
13706 <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.
13707 </p>
13708 !! end
13709
13710 !! test
13711 Link to pages in language variants
13712 !! options
13713 language=sr
13714 !! input
13715 Main Page can be written as [[Маин Паге]]
13716 !! result
13717 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
13718 </p>
13719 !!end
13720
13721
13722 !! test
13723 Multiple links to pages in language variants
13724 !! options
13725 language=sr
13726 !! input
13727 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
13728 !! result
13729 <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>.
13730 </p>
13731 !!end
13732
13733
13734 !! test
13735 Simple template in language variants
13736 !! options
13737 language=sr
13738 !! input
13739 {{тест}}
13740 !! result
13741 <p>This is a test template
13742 </p>
13743 !! end
13744
13745
13746 !! test
13747 Template with explicit namespace in language variants
13748 !! options
13749 language=sr
13750 !! input
13751 {{Template:тест}}
13752 !! result
13753 <p>This is a test template
13754 </p>
13755 !! end
13756
13757
13758 !! test
13759 Basic test for template parameter in language variants
13760 !! options
13761 language=sr
13762 !! input
13763 {{парамтест|param=foo}}
13764 !! result
13765 <p>This is a test template with parameter foo
13766 </p>
13767 !! end
13768
13769
13770 !! test
13771 Simple category in language variants
13772 !! options
13773 language=sr cat
13774 !! input
13775 [[Category:МедиаWики Усер'с Гуиде]]
13776 !! result
13777 <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>
13778 !! end
13779
13780
13781 !! article
13782 Category:分类
13783 !! text
13784 blah
13785 !! endarticle
13786
13787 !! article
13788 Category:分類
13789 !! text
13790 blah
13791 !! endarticle
13792
13793 !! test
13794 Don't convert blue categorylinks to another variant (bug 33210)
13795 !! options
13796 language=zh cat
13797 !! input
13798 [[A]][[Category:分类]]
13799 !! result
13800 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
13801 !! end
13802
13803
13804 !! test
13805 Stripping -{}- tags (language variants)
13806 !! options
13807 language=sr
13808 !! input
13809 Latin proverb: -{Ne nuntium necare}-
13810 !! result
13811 <p>Latin proverb: Ne nuntium necare
13812 </p>
13813 !! end
13814
13815
13816 !! test
13817 Prevent conversion with -{}- tags (language variants)
13818 !! options
13819 language=sr variant=sr-ec
13820 !! input
13821 Latinski: -{Ne nuntium necare}-
13822 !! result
13823 <p>Латински: Ne nuntium necare
13824 </p>
13825 !! end
13826
13827
13828 !! test
13829 Prevent conversion of text with -{}- tags (language variants)
13830 !! options
13831 language=sr variant=sr-ec
13832 !! input
13833 Latinski: -{Ne nuntium necare}-
13834 !! result
13835 <p>Латински: Ne nuntium necare
13836 </p>
13837 !! end
13838
13839
13840 !! test
13841 Prevent conversion of links with -{}- tags (language variants)
13842 !! options
13843 language=sr variant=sr-ec
13844 !! input
13845 -{[[Main Page]]}-
13846 !! result
13847 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13848 </p>
13849 !! end
13850
13851
13852 !! test
13853 -{}- tags within headlines (within html for parserConvert())
13854 !! options
13855 language=sr variant=sr-ec
13856 !! input
13857 == -{Naslov}- ==
13858 !! result
13859 <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>
13860
13861 !! end
13862
13863
13864 !! test
13865 Explicit definition of language variant alternatives
13866 !! options
13867 language=zh variant=zh-tw
13868 !! input
13869 -{zh:China;zh-tw:Taiwan}-, not China
13870 !! result
13871 <p>Taiwan, not China
13872 </p>
13873 !! end
13874
13875
13876 !! test
13877 Conversion around HTML tags
13878 !! options
13879 language=sr variant=sr-ec
13880 !! input
13881 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
13882 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
13883 !! result
13884 <p>
13885 <span title="ЛаCтин">ски</span>
13886 </p>
13887 !! end
13888
13889
13890 !! test
13891 Explicit session-wise language variant mapping (A flag and - flag)
13892 !! options
13893 language=zh variant=zh-tw
13894 !! input
13895 Taiwan is not China.
13896 But -{A|zh:China;zh-tw:Taiwan}- is China,
13897 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
13898 and -{China}- is China.
13899 !! result
13900 <p>Taiwan is not China.
13901 But Taiwan is Taiwan,
13902 (This should be stripped!)
13903 and China is China.
13904 </p>
13905 !! end
13906
13907 !! test
13908 Explicit session-wise language variant mapping (H flag for hide)
13909 !! options
13910 language=zh variant=zh-tw
13911 !! input
13912 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
13913 Taiwan is China.
13914 !! result
13915 <p>(This should be stripped!)
13916 Taiwan is Taiwan.
13917 </p>
13918 !! end
13919
13920 !! test
13921 Adding explicit conversion rule for title (T flag)
13922 !! options
13923 language=zh variant=zh-tw showtitle
13924 !! input
13925 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13926 !! result
13927 Taiwan
13928 <p>Should be stripped!
13929 </p>
13930 !! end
13931
13932 !! test
13933 Testing that changing the language variant here in the tests actually works
13934 !! options
13935 language=zh variant=zh showtitle
13936 !! input
13937 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13938 !! result
13939 China
13940 <p>Should be stripped!
13941 </p>
13942 !! end
13943
13944 !! test
13945 Recursive conversion of alt and title attrs shouldn't clear converter state
13946 !! options
13947 language=zh variant=zh-cn showtitle
13948 !! input
13949 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
13950 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
13951 !! result
13952 China
13953 <p>
13954 Should be stripped<span title="Exclamation">!</span>
13955 </p>
13956 !! end
13957
13958 !! test
13959 Bug 24072: more test on conversion rule for title
13960 !! options
13961 language=zh variant=zh-tw showtitle
13962 !! input
13963 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13964 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
13965 !! result
13966 Taiwan
13967 <p>This should be stripped!
13968 This won't take interferes with the title rule.
13969 </p>
13970 !! end
13971
13972 !! test
13973 Partly disable title conversion if variant == main language code
13974 !! options
13975 language=zh variant=zh title=[[ZH]] showtitle
13976 !! input
13977 -{T|zh-cn:CN;zh-tw:TW}-
13978 !! result
13979 ZH
13980 <p>
13981 </p>
13982 !! end
13983
13984 !! test
13985 Partly disable title conversion if variant == main language code, more
13986 !! options
13987 language=zh variant=zh title=[[ZH]] showtitle
13988 !! input
13989 -{T|TW}-
13990 !! result
13991 ZH
13992 <p>
13993 </p>
13994 !! end
13995
13996 !! test
13997 Raw output of variant escape tags (R flag)
13998 !! options
13999 language=zh variant=zh-tw
14000 !! input
14001 Raw: -{R|zh:China;zh-tw:Taiwan}-
14002 !! result
14003 <p>Raw: zh:China;zh-tw:Taiwan
14004 </p>
14005 !! end
14006
14007 !! test
14008 Nested using of manual convert syntax
14009 !! options
14010 language=zh variant=zh-hk
14011 !! input
14012 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
14013 !! result
14014 <p>Nested: Hello Hong Kong!
14015 </p>
14016 !! end
14017
14018 !! test
14019 Proper conversion of text in external links
14020 !! options
14021 language=sr variant=sr-ec
14022 !! input
14023 http://www.google.com
14024 gopher://www.google.com
14025 [http://www.google.com http://www.google.com]
14026 [gopher://www.google.com gopher://www.google.com]
14027 [https://www.google.com irc://www.google.com]
14028 [ftp://www.google.com www.google.com/ftp://dir]
14029 [//www.google.com www.google.com]
14030 !! result
14031 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
14032 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
14033 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
14034 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
14035 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
14036 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
14037 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
14038 </p>
14039 !! end
14040
14041 !! test
14042 Do not convert roman numbers to language variants
14043 !! options
14044 language=sr variant=sr-ec
14045 !! input
14046 Fridrih IV je car.
14047 !! result
14048 <p>Фридрих IV је цар.
14049 </p>
14050 !! end
14051
14052 !! test
14053 Unclosed language converter markup "-{"
14054 !! options
14055 language=sr
14056 !! input
14057 -{T|hello
14058 !! result
14059 <p>-{T|hello
14060 </p>
14061 !! end
14062
14063 !! test
14064 Don't convert raw rule "-{R|=&gt;}-" to "=>"
14065 !! options
14066 language=sr
14067 !! input
14068 -{R|=&gt;}-
14069 !! result
14070 <p>=&gt;
14071 </p>
14072 !!end
14073
14074 !! test
14075 Bug 529: Uncovered bullet
14076 !! input
14077 * Foo {{bullet}}
14078 !! result
14079 <ul><li> Foo
14080 </li><li> Bar
14081 </li></ul>
14082
14083 !! end
14084
14085 # Plain MediaWiki does not remove empty lists, but tidy actually does.
14086 # Templates in Wikipedia rely on this behavior, as tidy has always been
14087 # enabled there. These tests are normally run *without* tidy, so specify the
14088 # full output here.
14089 # To test realistic parsing behavior, apply a tidy-like transformation to both
14090 # the expected output and your parser's output.
14091 !! test
14092 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
14093 !! input
14094 ******* Foo {{bullet}}
14095 !! result
14096 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
14097 </li></ul>
14098 </li></ul>
14099 </li></ul>
14100 </li></ul>
14101 </li></ul>
14102 </li></ul>
14103 </li><li> Bar
14104 </li></ul>
14105
14106 !! end
14107
14108 !! test
14109 Bug 529: Uncovered table already at line-start
14110 !! input
14111 x
14112
14113 {{table}}
14114 y
14115 !! result
14116 <p>x
14117 </p>
14118 <table>
14119 <tr>
14120 <td> 1 </td>
14121 <td> 2
14122 </td></tr>
14123 <tr>
14124 <td> 3 </td>
14125 <td> 4
14126 </td></tr></table>
14127 <p>y
14128 </p>
14129 !! end
14130
14131 !! test
14132 Bug 529: Uncovered bullet in parser function result
14133 !! input
14134 * Foo {{lc:{{bullet}} }}
14135 !! result
14136 <ul><li> Foo
14137 </li><li> bar
14138 </li></ul>
14139
14140 !! end
14141
14142 !! test
14143 Bug 5678: Double-parsed template argument
14144 !! input
14145 {{lc:{{{1}}}|hello}}
14146 !! result
14147 <p>{{{1}}}
14148 </p>
14149 !! end
14150
14151 !! test
14152 Bug 5678: Double-parsed template invocation
14153 !! input
14154 {{lc:{{paramtest {{!}} param = hello }} }}
14155 !! result
14156 <p>{{paramtest | param = hello }}
14157 </p>
14158 !! end
14159
14160 !! test
14161 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
14162 !! options
14163 language=cs
14164 title=[[Main Page]]
14165 !! input
14166 {{PRVNÍVELKÉ:ěščř}}
14167 {{prvnívelké:ěščř}}
14168 {{PRVNÍMALÉ:ěščř}}
14169 {{prvnímalé:ěščř}}
14170 {{MALÁ:ěščř}}
14171 {{malá:ěščř}}
14172 {{VELKÁ:ěščř}}
14173 {{velká:ěščř}}
14174 !! result
14175 <p>Ěščř
14176 Ěščř
14177 ěščř
14178 ěščř
14179 ěščř
14180 ěščř
14181 ĚŠČŘ
14182 ĚŠČŘ
14183 </p>
14184 !! end
14185
14186 !! test
14187 Morwen/13: Unclosed link followed by heading
14188 !! input
14189 [[link
14190 ==heading==
14191 !! result
14192 <p>[[link
14193 </p>
14194 <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>
14195
14196 !! end
14197
14198 !! test
14199 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
14200 !! input
14201 {{foo|
14202 =heading=
14203 !! result
14204 <p>{{foo|
14205 </p>
14206 <h1><span class="mw-headline" id="heading">heading</span></h1>
14207
14208 !! end
14209
14210 !! test
14211 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
14212 !! input
14213 {{foo|
14214 ==heading==
14215 !! result
14216 <p>{{foo|
14217 </p>
14218 <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>
14219
14220 !! end
14221
14222 !! test
14223 Tildes in comments
14224 !! options
14225 pst
14226 !! input
14227 <!-- ~~~~ -->
14228 !! result
14229 <!-- ~~~~ -->
14230 !! end
14231
14232 !! test
14233 Paragraphs inside divs (no extra line breaks)
14234 !! input
14235 <div>Line one
14236
14237 Line two</div>
14238 !! result
14239 <div>Line one
14240 Line two</div>
14241
14242 !! end
14243
14244 !! test
14245 Paragraphs inside divs (extra line break on open)
14246 !! input
14247 <div>
14248 Line one
14249
14250 Line two</div>
14251 !! result
14252 <div>
14253 <p>Line one
14254 </p>
14255 Line two</div>
14256
14257 !! end
14258
14259 !! test
14260 Paragraphs inside divs (extra line break on close)
14261 !! input
14262 <div>Line one
14263
14264 Line two
14265 </div>
14266 !! result
14267 <div>Line one
14268 <p>Line two
14269 </p>
14270 </div>
14271
14272 !! end
14273
14274 !! test
14275 Paragraphs inside divs (extra line break on open and close)
14276 !! input
14277 <div>
14278 Line one
14279
14280 Line two
14281 </div>
14282 !! result
14283 <div>
14284 <p>Line one
14285 </p><p>Line two
14286 </p>
14287 </div>
14288
14289 !! end
14290
14291 !! test
14292 Nesting tags, paragraphs on lines which begin with <div>
14293 !! options
14294 disabled
14295 !! input
14296 <div></div><strong>A
14297 B</strong>
14298 !! result
14299 <div></div>
14300 <p><strong>A
14301 B</strong>
14302 </p>
14303 !! end
14304
14305 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
14306 !! test
14307 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
14308 !! options
14309 disabled
14310 !! input
14311 <blockquote>Line one
14312
14313 Line two</blockquote>
14314 !! result
14315 <blockquote>Line one
14316 Line two</blockquote>
14317
14318 !! end
14319
14320 !! test
14321 Bug 6200: paragraphs inside blockquotes (extra line break on open)
14322 !! options
14323 disabled
14324 !! input
14325 <blockquote>
14326 Line one
14327
14328 Line two</blockquote>
14329 !! result
14330 <blockquote>
14331 <p>Line one
14332 </p>
14333 Line two</blockquote>
14334
14335 !! end
14336
14337 !! test
14338 Bug 6200: paragraphs inside blockquotes (extra line break on close)
14339 !! options
14340 disabled
14341 !! input
14342 <blockquote>Line one
14343
14344 Line two
14345 </blockquote>
14346 !! result
14347 <blockquote>Line one
14348 <p>Line two
14349 </p>
14350 </blockquote>
14351
14352 !! end
14353
14354 !! test
14355 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
14356 !! options
14357 disabled
14358 !! input
14359 <blockquote>
14360 Line one
14361
14362 Line two
14363 </blockquote>
14364 !! result
14365 <blockquote>
14366 <p>Line one
14367 </p><p>Line two
14368 </p>
14369 </blockquote>
14370
14371 !! end
14372
14373 !! test
14374 Paragraphs inside blockquotes/divs (no extra line breaks)
14375 !! input
14376 <blockquote><div>Line one
14377
14378 Line two</div></blockquote>
14379 !! result
14380 <blockquote><div>Line one
14381 Line two</div></blockquote>
14382
14383 !! end
14384
14385 !! test
14386 Paragraphs inside blockquotes/divs (extra line break on open)
14387 !! input
14388 <blockquote><div>
14389 Line one
14390
14391 Line two</div></blockquote>
14392 !! result
14393 <blockquote><div>
14394 <p>Line one
14395 </p>
14396 Line two</div></blockquote>
14397
14398 !! end
14399
14400 !! test
14401 Paragraphs inside blockquotes/divs (extra line break on close)
14402 !! input
14403 <blockquote><div>Line one
14404
14405 Line two
14406 </div></blockquote>
14407 !! result
14408 <blockquote><div>Line one
14409 <p>Line two
14410 </p>
14411 </div></blockquote>
14412
14413 !! end
14414
14415 !! test
14416 Paragraphs inside blockquotes/divs (extra line break on open and close)
14417 !! input
14418 <blockquote><div>
14419 Line one
14420
14421 Line two
14422 </div></blockquote>
14423 !! result
14424 <blockquote><div>
14425 <p>Line one
14426 </p><p>Line two
14427 </p>
14428 </div></blockquote>
14429
14430 !! end
14431
14432 !! test
14433 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
14434 !! options
14435 wgLinkHolderBatchSize=0
14436 !! input
14437 [[meatball:1]]
14438 [[meatball:2]]
14439 [[meatball:3]]
14440 !! result
14441 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
14442 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
14443 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
14444 </p>
14445 !! end
14446
14447 !! test
14448 Free external link invading image caption
14449 !! input
14450 [[Image:Foobar.jpg|thumb|http://x|hello]]
14451 !! result
14452 <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>
14453
14454 !! end
14455
14456 !! test
14457 Bug 15196: localised external link numbers
14458 !! options
14459 language=fa
14460 !! input
14461 [http://en.wikipedia.org/]
14462 !! result
14463 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
14464 </p>
14465 !! end
14466
14467 !! test
14468 Multibyte character in padleft
14469 !! input
14470 {{padleft:-Hello|7|Æ}}
14471 !! result
14472 <p>Æ-Hello
14473 </p>
14474 !! end
14475
14476 !! test
14477 Multibyte character in padright
14478 !! input
14479 {{padright:Hello-|7|Æ}}
14480 !! result
14481 <p>Hello-Æ
14482 </p>
14483 !! end
14484
14485 !!test
14486 formatdate parser function
14487 !!input
14488 {{#formatdate:2009-03-24}}
14489 !! result
14490 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
14491 </p>
14492 !! end
14493
14494 !!test
14495 formatdate parser function, with default format
14496 !!input
14497 {{#formatdate:2009-03-24|mdy}}
14498 !! result
14499 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
14500 </p>
14501 !! end
14502
14503 !! test
14504 Spacing of numbers in formatted dates
14505 !! input
14506 {{#formatdate:January 15}}
14507 !! result
14508 <p><span class="mw-formatted-date" title="01-15">January 15</span>
14509 </p>
14510 !! end
14511
14512 !! test
14513 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
14514 !! options
14515 language=nl title=[[MediaWiki:Common.css]]
14516 !! input
14517 {{#formatdate:2009-03-24|dmy}}
14518 !! result
14519 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
14520 </p>
14521 !! end
14522
14523 #
14524 #
14525 #
14526
14527 #
14528 # Edit comments
14529 #
14530
14531 !! test
14532 Edit comment with link
14533 !! options
14534 comment
14535 !! input
14536 I like the [[Main Page]] a lot
14537 !! result
14538 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
14539 !!end
14540
14541 !! test
14542 Edit comment with link and link text
14543 !! options
14544 comment
14545 !! input
14546 I like the [[Main Page|best pages]] a lot
14547 !! result
14548 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14549 !!end
14550
14551 !! test
14552 Edit comment with link and link text with suffix
14553 !! options
14554 comment
14555 !! input
14556 I like the [[Main Page|best page]]s a lot
14557 !! result
14558 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14559 !!end
14560
14561 !! test
14562 Edit comment with section link (non-local, eg in history list)
14563 !! options
14564 comment title=[[Main Page]]
14565 !! input
14566 /* External links */ removed bogus entries
14567 !! result
14568 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14569 !!end
14570
14571 !! test
14572 Edit comment with section link and text before it (non-local, eg in history list)
14573 !! options
14574 comment title=[[Main Page]]
14575 !! input
14576 pre-comment text /* External links */ removed bogus entries
14577 !! result
14578 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>
14579 !!end
14580
14581 !! test
14582 Edit comment with section link (local, eg in diff view)
14583 !! options
14584 comment local title=[[Main Page]]
14585 !! input
14586 /* External links */ removed bogus entries
14587 !! result
14588 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14589 !!end
14590
14591 !! test
14592 Edit comment with subpage link (bug 14080)
14593 !! options
14594 comment
14595 subpage
14596 title=[[Subpage test]]
14597 !! input
14598 Poked at a [[/subpage]] here...
14599 !! result
14600 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
14601 !!end
14602
14603 !! test
14604 Edit comment with subpage link and link text (bug 14080)
14605 !! options
14606 comment
14607 subpage
14608 title=[[Subpage test]]
14609 !! input
14610 Poked at a [[/subpage|neat little page]] here...
14611 !! result
14612 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
14613 !!end
14614
14615 !! test
14616 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
14617 !! options
14618 comment
14619 title=[[Subpage test]]
14620 !! input
14621 Poked at a [[/subpage]] here...
14622 !! result
14623 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...
14624 !!end
14625
14626 !! test
14627 Edit comment with bare anchor link (local, as on diff)
14628 !! options
14629 comment
14630 local
14631 title=[[Main Page]]
14632 !!input
14633 [[#section]]
14634 !! result
14635 <a href="#section">#section</a>
14636 !! end
14637
14638 !! test
14639 Edit comment with bare anchor link (non-local, as on history)
14640 !! options
14641 comment
14642 title=[[Main Page]]
14643 !!input
14644 [[#section]]
14645 !! result
14646 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
14647 !! end
14648
14649 !! test
14650 Anchor starting with underscore
14651 !!input
14652 [[#_ref|One]]
14653 !! result
14654 <p><a href="#_ref">One</a>
14655 </p>
14656 !! end
14657
14658 !! test
14659 Id starting with underscore
14660 !!input
14661 <div id="_ref"></div>
14662 !! result
14663 <div id="_ref"></div>
14664
14665 !! end
14666
14667 !! test
14668 Space normalisation on autocomment (bug 22784)
14669 !! options
14670 comment
14671 title=[[Main Page]]
14672 !!input
14673 /* __hello__world__ */
14674 !! result
14675 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
14676 !! end
14677
14678 !! test
14679 percent-encoding and + signs in comments (Bug 26410)
14680 !! options
14681 comment
14682 !!input
14683 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
14684 !! result
14685 <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>
14686 !! end
14687
14688 !! test
14689 Bad images - basic functionality
14690 !! options
14691 disabled
14692 !! input
14693 [[File:Bad.jpg]]
14694 !! result
14695 !! end
14696
14697 !! test
14698 Bad images - bug 16039: text after bad image disappears
14699 !! options
14700 disabled
14701 !! input
14702 Foo bar
14703 [[File:Bad.jpg]]
14704 Bar foo
14705 !! result
14706 <p>Foo bar
14707 </p><p>Bar foo
14708 </p>
14709 !! end
14710
14711 !! test
14712 Verify that displaytitle works (bug #22501) no displaytitle
14713 !! options
14714 showtitle
14715 !! config
14716 wgAllowDisplayTitle=true
14717 wgRestrictDisplayTitle=false
14718 !! input
14719 this is not the the title
14720 !! result
14721 Parser test
14722 <p>this is not the the title
14723 </p>
14724 !! end
14725
14726 !! test
14727 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
14728 !! options
14729 showtitle
14730 title=[[Screen]]
14731 !! config
14732 wgAllowDisplayTitle=true
14733 wgRestrictDisplayTitle=false
14734 !! input
14735 this is not the the title
14736 {{DISPLAYTITLE:whatever}}
14737 !! result
14738 whatever
14739 <p>this is not the the title
14740 </p>
14741 !! end
14742
14743 !! test
14744 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
14745 !! options
14746 showtitle
14747 title=[[Screen]]
14748 !! config
14749 wgAllowDisplayTitle=true
14750 wgRestrictDisplayTitle=true
14751 !! input
14752 this is not the the title
14753 {{DISPLAYTITLE:whatever}}
14754 !! result
14755 Screen
14756 <p>this is not the the title
14757 </p>
14758 !! end
14759
14760 !! test
14761 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
14762 !! options
14763 showtitle
14764 title=[[Screen]]
14765 !! config
14766 wgAllowDisplayTitle=true
14767 wgRestrictDisplayTitle=true
14768 !! input
14769 this is not the the title
14770 {{DISPLAYTITLE:screen}}
14771 !! result
14772 screen
14773 <p>this is not the the title
14774 </p>
14775 !! end
14776
14777 !! test
14778 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
14779 !! options
14780 showtitle
14781 title=[[Screen]]
14782 !! config
14783 wgAllowDisplayTitle=false
14784 !! input
14785 this is not the the title
14786 {{DISPLAYTITLE:screen}}
14787 !! result
14788 Screen
14789 <p>this is not the the title
14790 <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>
14791 </p>
14792 !! end
14793
14794 !! test
14795 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
14796 !! options
14797 showtitle
14798 title=[[Screen]]
14799 !! config
14800 wgAllowDisplayTitle=false
14801 !! input
14802 this is not the the title
14803 !! result
14804 Screen
14805 <p>this is not the the title
14806 </p>
14807 !! end
14808
14809 !! test
14810 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
14811 !! options
14812 showtitle
14813 title=[[Screen]]
14814 !! config
14815 wgAllowDisplayTitle=true
14816 wgRestrictDisplayTitle=true
14817 !! input
14818 this is not the the title
14819 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
14820 !! result
14821 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
14822 <p>this is not the the title
14823 </p>
14824 !! end
14825
14826 !! test
14827 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
14828 !! options
14829 showtitle
14830 title=[[Screen]]
14831 !! config
14832 wgAllowDisplayTitle=true
14833 wgRestrictDisplayTitle=true
14834 !! input
14835 this is not the the title
14836 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
14837 !! result
14838 <span style="color: red;">s</span>creen
14839 <p>this is not the the title
14840 </p>
14841 !! end
14842
14843 !! test
14844 preload: check <noinclude> and <includeonly>
14845 !! options
14846 preload
14847 !! input
14848 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
14849 !! result
14850 Hello kind world.
14851 !! end
14852
14853 !! test
14854 preload: check <onlyinclude>
14855 !! options
14856 preload
14857 !! input
14858 Goodbye <onlyinclude>Hello world</onlyinclude>
14859 !! result
14860 Hello world
14861 !! end
14862
14863 !! test
14864 preload: can pass tags through if we want to
14865 !! options
14866 preload
14867 !! input
14868 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
14869 !! result
14870 <includeonly>Hello world</includeonly>
14871 !! end
14872
14873 !! test
14874 preload: check that it doesn't try to do tricks
14875 !! options
14876 preload
14877 !! input
14878 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14879 !! result
14880 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14881 !! end
14882
14883 !! test
14884 Play a bit with r67090 and bug 3158
14885 !! options
14886 disabled
14887 !! input
14888 <div style="width:50% !important">&nbsp;</div>
14889 <div style="width:50%&nbsp;!important">&nbsp;</div>
14890 <div style="width:50%&#160;!important">&nbsp;</div>
14891 <div style="border : solid;">&nbsp;</div>
14892 !! result
14893 <div style="width:50% !important">&nbsp;</div>
14894 <div style="width:50% !important">&nbsp;</div>
14895 <div style="width:50% !important">&nbsp;</div>
14896 <div style="border&#160;: solid;">&nbsp;</div>
14897
14898 !! end
14899
14900 !! test
14901 HTML5 data attributes
14902 !! input
14903 <span data-foo="bar">Baz</span>
14904 <p data-abc-def_hij="">Quuz</p>
14905 !! result
14906 <p><span data-foo="bar">Baz</span>
14907 </p>
14908 <p data-abc-def_hij="">Quuz</p>
14909
14910 !! end
14911
14912 !! test
14913 percent-encoding and + signs in internal links (Bug 26410)
14914 !! input
14915 [[User:+%]] [[Page+title%]]
14916 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
14917 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
14918 [[%33%45]] [[%33%45+]]
14919 !! result
14920 <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>
14921 <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>
14922 <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>
14923 <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>
14924 </p>
14925 !! end
14926
14927 !! test
14928 Special characters in embedded file links (bug 27679)
14929 !! input
14930 [[File:Contains & ampersand.jpg]]
14931 [[File:Does not exist.jpg|Title with & ampersand]]
14932 !! result
14933 <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>
14934 <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>
14935 </p>
14936 !! end
14937
14938
14939 !! test
14940 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
14941 !! input
14942 Text&apos;s been normalized?
14943 !! result
14944 <p>Text&#39;s been normalized?
14945 </p>
14946 !! end
14947
14948 !! test
14949 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
14950 !! input
14951 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
14952 !! result
14953 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
14954 </p>
14955 !! end
14956
14957 !! test
14958 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
14959 !! input
14960 [http://www.example.org/ ideograms]
14961 !! result
14962 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
14963 </p>
14964 !! end
14965
14966 !! test
14967 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
14968 !! input
14969 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
14970 !! result
14971 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
14972 </p>
14973 !! end
14974
14975 !! article
14976 Mediawiki:loop1
14977 !! text
14978 {{Identical|A}}
14979 !! endarticle
14980
14981 !! article
14982 Mediawiki:loop2
14983 !! text
14984 {{Identical|B}}
14985 !! endarticle
14986
14987 !! article
14988 Template:Identical
14989 !! text
14990 {{int:loop1}}
14991 {{int:loop2}}
14992 !! endarticle
14993
14994 !! test
14995 Bug 31098 Template which includes system messages which includes the template
14996 !! input
14997 {{Identical}}
14998 !! result
14999 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
15000 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
15001 </p>
15002 !! end
15003
15004 !! test
15005 Bug31490 Turkish: ucfirst 'blah'
15006 !! options
15007 language=tr
15008 !! input
15009 {{ucfirst:blah}}
15010 !! result
15011 <p>Blah
15012 </p>
15013 !! end
15014
15015 !! test
15016 Bug31490 Turkish: ucfirst 'ix'
15017 !! options
15018 language=tr
15019 !! input
15020 {{ucfirst:ix}}
15021 !! result
15022 <p>İx
15023 </p>
15024 !! end
15025
15026 !! test
15027 Bug31490 Turkish: lcfirst 'BLAH'
15028 !! options
15029 language=tr
15030 !! input
15031 {{lcfirst:BLAH}}
15032 !! result
15033 <p>bLAH
15034 </p>
15035 !! end
15036
15037 !! test
15038 Bug31490 Turkish: ucfırst (with a dotless i)
15039 !! options
15040 language=tr
15041 !! input
15042 {{ucfırst:blah}}
15043 !! result
15044 <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>
15045 </p>
15046 !! end
15047
15048 !! test
15049 Bug31490 ucfırst (with a dotless i) with English language
15050 !! options
15051 language=en
15052 !! input
15053 {{ucfırst:blah}}
15054 !! result
15055 <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>
15056 </p>
15057 !! end
15058
15059 !! test
15060 Bug 26375: TOC with italics
15061 !! options
15062 title=[[Main Page]]
15063 !! input
15064 __TOC__
15065 == ''Lost'' episodes ==
15066 !! result
15067 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15068 <ul>
15069 <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>
15070 </ul>
15071 </div>
15072 <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>
15073
15074 !! end
15075
15076 !! test
15077 Bug 26375: TOC with bold
15078 !! options
15079 title=[[Main Page]]
15080 !! input
15081 __TOC__
15082 == '''should be bold''' then normal text ==
15083 !! result
15084 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15085 <ul>
15086 <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>
15087 </ul>
15088 </div>
15089 <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>
15090
15091 !! end
15092
15093 !! test
15094 Bug 33845: Headings become cursive in TOC when they contain an image
15095 !! options
15096 title=[[Main Page]]
15097 !! input
15098 __TOC__
15099 == Image [[Image:foobar.jpg]] ==
15100 !! result
15101 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15102 <ul>
15103 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
15104 </ul>
15105 </div>
15106 <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>
15107
15108 !! end
15109
15110 !! test
15111 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
15112 !! options
15113 title=[[Main Page]]
15114 !! input
15115 __TOC__
15116 == <blockquote>Quote</blockquote> ==
15117 !! result
15118 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15119 <ul>
15120 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
15121 </ul>
15122 </div>
15123 <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>
15124
15125 !! end
15126
15127 !! test
15128 Unclosed tags in TOC
15129 !! options
15130 title=[[Main Page]]
15131 !! input
15132 __TOC__
15133 == Proof: 2 < 3 ==
15134 <small>Hanc marginis exiguitas non caperet.</small>
15135 QED
15136 !! result
15137 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15138 <ul>
15139 <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>
15140 </ul>
15141 </div>
15142 <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>
15143 <p><small>Hanc marginis exiguitas non caperet.</small>
15144 QED
15145 </p>
15146 !! end
15147
15148 !! test
15149 Multiple tags in TOC
15150 !! input
15151 __TOC__
15152 == <i>Foo</i> <b>Bar</b> ==
15153
15154 == <i>Foo</i> <blockquote>Bar</blockquote> ==
15155 !! result
15156 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15157 <ul>
15158 <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>
15159 <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>
15160 </ul>
15161 </div>
15162 <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>
15163 <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>
15164
15165 !! end
15166
15167 !! test
15168 Tags with parameters in TOC
15169 !! input
15170 __TOC__
15171 == <sup class="in-h2">Hello</sup> ==
15172
15173 == <sup class="a > b">Evilbye</sup> ==
15174 !! result
15175 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15176 <ul>
15177 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
15178 <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>
15179 </ul>
15180 </div>
15181 <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>
15182 <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>
15183
15184 !! end
15185
15186 !! test
15187 span tags with directionality in TOC
15188 !! input
15189 __TOC__
15190 == <span dir="ltr">C++</span> ==
15191
15192 == <span dir="rtl">זבנג!</span> ==
15193
15194 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
15195
15196 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
15197
15198 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
15199 !! result
15200 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15201 <ul>
15202 <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>
15203 <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>
15204 <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>
15205 <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>
15206 <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>
15207 </ul>
15208 </div>
15209 <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>
15210 <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>
15211 <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>
15212 <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>
15213 <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>
15214
15215 !! end
15216
15217 !! article
15218 MediaWiki:Bug32057
15219 !! text
15220 == {{int:headline_sample}} ==
15221 !! endarticle
15222
15223 !! test
15224 Bug 32057: Title needed when expanding <h> nodes.
15225 !! options
15226 title=[[Main Page]]
15227 !! input
15228 {{int:Bug32057}}
15229 !! result
15230 <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>
15231
15232 !! end
15233
15234 !! test
15235 Strip marker in urlencode
15236 !! input
15237 {{urlencode:x<nowiki/>y}}
15238 {{urlencode:x<nowiki/>y|wiki}}
15239 {{urlencode:x<nowiki/>y|path}}
15240 !! result
15241 <p>xy
15242 xy
15243 xy
15244 </p>
15245 !! end
15246
15247 !! test
15248 Strip marker in lc
15249 !! input
15250 {{lc:x<nowiki/>y}}
15251 !! result
15252 <p>xy
15253 </p>
15254 !! end
15255
15256 !! test
15257 Strip marker in uc
15258 !! input
15259 {{uc:x<nowiki/>y}}
15260 !! result
15261 <p>XY
15262 </p>
15263 !! end
15264
15265 !! test
15266 Strip marker in formatNum
15267 !! input
15268 {{formatnum:1<nowiki/>2}}
15269 {{formatnum:1<nowiki/>2|R}}
15270 !! result
15271 <p>12
15272 12
15273 </p>
15274 !! end
15275
15276 !! test
15277 Check noCommafy in formatNum
15278 !! options
15279 language=be-tarask
15280 !! input
15281 {{formatnum:123456.78}}
15282 {{formatnum:123456.78|NOSEP}}
15283 !! result
15284 <p>123 456,78
15285 123456.78
15286 </p>
15287 !! end
15288
15289 !! test
15290 Strip marker in grammar
15291 !! options
15292 language=fi
15293 !! input
15294 {{grammar:elative|foo<nowiki/>bar}}
15295 !! result
15296 <p>foobarista
15297 </p>
15298 !! end
15299
15300 !! test
15301 Strip marker in padleft
15302 !! input
15303 {{padleft:|2|x<nowiki/>y}}
15304 !! result
15305 <p>xy
15306 </p>
15307 !! end
15308
15309 !! test
15310 Strip marker in padright
15311 !! input
15312 {{padright:|2|x<nowiki/>y}}
15313 !! result
15314 <p>xy
15315 </p>
15316 !! end
15317
15318 !! test
15319 Strip marker in anchorencode
15320 !! input
15321 {{anchorencode:x<nowiki/>y}}
15322 !! result
15323 <p>xy
15324 </p>
15325 !! end
15326
15327 !! test
15328 nowiki inside link inside heading (bug 18295)
15329 !! input
15330 ==[[foo|x<nowiki>y</nowiki>z]]==
15331 !! result
15332 <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>
15333
15334 !! end
15335
15336 !! test
15337 new support for bdi element (bug 31817)
15338 !! input
15339 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
15340 !! result
15341 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
15342
15343 !!end
15344
15345 !! test
15346 Ignore pipe between table row attributes
15347 !! input
15348 {|
15349 | quux
15350 |- id=foo | style='color: red'
15351 | bar
15352 |}
15353 !! result
15354 <table>
15355 <tr>
15356 <td> quux
15357 </td></tr>
15358 <tr id="foo" style="color: red">
15359 <td> bar
15360 </td></tr></table>
15361
15362 !! end
15363
15364 !!test
15365 Gallery override link with WikiLink (bug 34852)
15366 !! input
15367 <gallery>
15368 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
15369 </gallery>
15370 !! result
15371 <ul class="gallery mw-gallery-traditional">
15372 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15373 <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>
15374 <div class="gallerytext">
15375 <p>caption
15376 </p>
15377 </div>
15378 </div></li>
15379 </ul>
15380
15381 !! end
15382
15383 !!test
15384 Gallery override link with absolute external link (bug 34852)
15385 !! input
15386 <gallery>
15387 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
15388 </gallery>
15389 !! result
15390 <ul class="gallery mw-gallery-traditional">
15391 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15392 <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>
15393 <div class="gallerytext">
15394 <p>caption
15395 </p>
15396 </div>
15397 </div></li>
15398 </ul>
15399
15400 !! end
15401
15402 !!test
15403 Gallery override link with malicious javascript (bug 34852)
15404 !! input
15405 <gallery>
15406 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
15407 </gallery>
15408 !! result
15409 <ul class="gallery mw-gallery-traditional">
15410 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15411 <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>
15412 <div class="gallerytext">
15413 <p>caption
15414 </p>
15415 </div>
15416 </div></li>
15417 </ul>
15418
15419 !! end
15420
15421 !!test
15422 Gallery with invalid title as link (bug 43964)
15423 !! input
15424 <gallery>
15425 File:foobar.jpg|link=<
15426 </gallery>
15427 !! result
15428 <ul class="gallery mw-gallery-traditional">
15429 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15430 <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>
15431 <div class="gallerytext">
15432 </div>
15433 </div></li>
15434 </ul>
15435
15436 !! end
15437
15438 !!test
15439 Language parser function
15440 !! input
15441 {{#language:ar}}
15442 !! result
15443 <p>العربية
15444 </p>
15445 !! end
15446
15447 !!test
15448 Padleft and padright as substr
15449 !! input
15450 {{padleft:|3|abcde}}
15451 {{padright:|3|abcde}}
15452 !! result
15453 <p>abc
15454 abc
15455 </p>
15456 !! end
15457
15458 !!test
15459 Special parser function
15460 !! input
15461 {{#special:RandomPage}}
15462 {{#special:BaDtItLe}}
15463 {{#special:Foobar}}
15464 !! result
15465 <p>Special:Random
15466 Special:Badtitle
15467 Special:Foobar
15468 </p>
15469 !! end
15470
15471 !!test
15472 Bug 34939 - Case insensitive link parsing ([HttP://])
15473 !! input
15474 [HttP://MediaWiki.Org/]
15475 !! result
15476 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
15477 </p>
15478 !! end
15479
15480 !!test
15481 Bug 34939 - Case insensitive link parsing ([HttP:// title])
15482 !! input
15483 [HttP://MediaWiki.Org/ MediaWiki]
15484 !! result
15485 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
15486 </p>
15487 !! end
15488
15489 !!test
15490 Bug 34939 - Case insensitive link parsing (HttP://)
15491 !! input
15492 HttP://MediaWiki.Org/
15493 !! result
15494 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
15495 </p>
15496 !! end
15497
15498
15499 ###
15500 ### Parsoids-specific tests
15501 ### Parsoid-PHP parser incompatibilities
15502 ###
15503 !!test
15504 1. SOL-sensitive wikitext tokens as template-args
15505 !!options
15506 parsoid=wt2html,wt2wt
15507 !!input
15508 {{echo|*a}}
15509 {{echo|#a}}
15510 {{echo|:a}}
15511 !!result
15512 <span about="#mwt1" typeof="mw:Transclusion">
15513 </span><ul about="#mwt1"><li>a</li></ul>
15514 <span about="#mwt2" typeof="mw:Transclusion">
15515 </span><ol about="#mwt2"><li>a</li></ol>
15516 <span about="#mwt3" typeof="mw:Transclusion">
15517 </span><dl about="#mwt3"><dd>a</dd></dl>
15518 !!end
15519
15520 #### ----------------------------------------------------------------
15521 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
15522 #### tags. Parsoid's output for these tags differs from that of the
15523 #### PHP parser.
15524 #### ----------------------------------------------------------------
15525
15526 !!test
15527 Ref: 1. ref-location should be replaced with an index span
15528 !!options
15529 parsoid
15530 !!input
15531 A <ref>foo</ref>
15532 B <ref name="x">foo</ref>
15533 C <ref name="y" />
15534 !!result
15535 <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>
15536 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>
15537 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>
15538 !!end
15539
15540 !!test
15541 Ref: 2. ref-tags with identical names should all get the same index
15542 !!options
15543 parsoid
15544 !!input
15545 A <ref name="x">foo</ref>
15546 B <ref name="x" />
15547 !!result
15548 <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>
15549 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>
15550 !!end
15551
15552 !!test
15553 Ref: 3. spaces in ref-names should be ignored
15554 !!options
15555 parsoid
15556 !!input
15557 A <ref name="x">foo</ref>
15558 B <ref name=" x " />
15559 C <ref name= x />
15560 !!result
15561 <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>
15562 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>
15563 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>
15564 !!end
15565
15566 !!test
15567 Ref: 4. 'constructor' should be accepted as a valid ref-name
15568 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
15569 !!options
15570 parsoid
15571 !!input
15572 A <ref name="constructor">foo</ref>
15573 !!result
15574 <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>
15575 !!end
15576
15577 !!test
15578 Ref: 5. body should accept generic wikitext
15579 !!options
15580 parsoid
15581 !!input
15582 A <ref>
15583 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
15584 </ref>
15585
15586 <references />
15587 !!result
15588 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"This is a <b data-parsoid=\"{&amp;quot;dsr&amp;quot;:[19,40,3,3]}\"><a rel=\"mw:WikiLink\" href=\"./Bolded_link\" data-parsoid=\"{&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Bolded_link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;bolded link&amp;quot;},&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;dsr&amp;quot;:[22,37,2,2]}\">bolded link</a></b> and this is a <span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;transclusion&amp;quot;}}}\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;{{echo|transclusion}}&amp;quot;,&amp;quot;dsr&amp;quot;:[55,76,null,null]}\">transclusion</span>\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
15589
15590 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15591 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> This is a <b><a rel="mw:WikiLink" href="./Bolded_link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}}}'>transclusion</span>
15592 </li></ol>
15593 !!end
15594
15595 !!test
15596 Ref: 6. indent-pres should not be output in ref-body
15597 !!options
15598 parsoid
15599 !!input
15600 A <ref>
15601 foo
15602 bar
15603 baz
15604 </ref>
15605
15606 <references />
15607 !!result
15608 <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>
15609
15610 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15611 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15612 bar
15613 baz
15614 </li></ol>
15615 !!end
15616
15617 !!test
15618 Ref: 6. No p-wrapping in ref-body
15619 !!options
15620 parsoid
15621 !!input
15622 A <ref>
15623 foo
15624
15625 bar
15626
15627
15628 baz
15629
15630
15631
15632 booz
15633 </ref>
15634
15635 <references />
15636 !!result
15637 <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>
15638
15639 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15640 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15641
15642 bar
15643
15644
15645 baz
15646
15647
15648
15649 booz
15650 </li></ol>
15651 !!end
15652
15653 !!test
15654 Ref: 8. transclusion wikitext has lower precedence
15655 !!options
15656 parsoid
15657 !!input
15658 A <ref> foo {{echo|</ref> B C}}
15659
15660 <references />
15661 !!result
15662 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo <span typeof=\"mw:Nowiki\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;{{&amp;quot;,&amp;quot;dsr&amp;quot;:[12,14,2,null]}\">{{</span>echo|"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B C<span typeof="mw:Nowiki">}}</span></p>
15663
15664 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15665 <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>
15666 !!end
15667
15668 !!test
15669 Ref: 9. unclosed comments should not leak out of ref-body
15670 !!options
15671 parsoid
15672 !!input
15673 A <ref> foo <!--</ref> B C
15674
15675 <references />
15676 !!result
15677 <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>
15678
15679 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15680 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
15681 !!end
15682
15683 !!test
15684 Ref: 10. Unclosed HTML tags should not leak out of ref-body
15685 !!options
15686 parsoid
15687 !!input
15688 A <ref> <b> foo </ref> B C
15689
15690 <references />
15691 !!result
15692 <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>
15693
15694 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15695 <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>
15696 !!end
15697
15698 !!test
15699 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
15700 !!options
15701 parsoid
15702 !!input
15703 A <ref>foo</ref> B
15704 C <ref>bar</ref> D
15705 !!result
15706 <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
15707 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>
15708 !!end
15709
15710 !!test
15711 Ref: 12. ref-tags act as trailing newline migration barrier
15712 !!options
15713 parsoid
15714 !!input
15715 <!--the newline at the end of this line moves out of the p-tag-->a
15716
15717 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
15718 <ref />
15719
15720 c
15721 !!result
15722 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
15723
15724
15725 <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>
15726 <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>
15727
15728
15729 <p>c</p>
15730 !!end
15731
15732 !!test
15733 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
15734 !!options
15735 parsoid
15736 !!input
15737 <ref>foo</ref> A
15738 <ref>bar
15739 </ref> B
15740 !!result
15741 <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
15742 <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>
15743 !!end
15744
15745 !!test
15746 Ref: 14. A nested ref-tag should be emitted as plain text
15747 !!options
15748 parsoid
15749 !!input
15750 <ref>foo <ref>bar</ref> baz</ref>
15751
15752 <references />
15753 !!result
15754 <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>
15755
15756 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
15757 <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>
15758 !!end
15759
15760 !!test
15761 Ref: 15. ref-tags with identical names should get identical indexes
15762 !!options
15763 parsoid
15764 !!input
15765 A1 <ref name="a">foo</ref> A2 <ref name="a" />
15766 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
15767
15768 <references />
15769 !!result
15770 <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>
15771 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>
15772
15773 <ol about="#mwt10" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-a-1-0">1.0</a> <a href="#cite_ref-a-1-1">1.1</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy">↑ <a href="#cite_ref-b-2-0">2.0</a> <a href="#cite_ref-b-2-1">2.1</a></span> bar</li></ol>
15774 !!end
15775
15776 !!test
15777 References: 1. references tag without any refs should be handled properly
15778 !!options
15779 parsoid
15780 !!input
15781 <references />
15782 !!result
15783 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
15784 !!end
15785
15786 !!test
15787 References: 2. references tag with group only outputs references from that group
15788 !!options
15789 parsoid
15790 !!input
15791 A <ref group="a">foo</ref>
15792 B <ref group="b">bar</ref>
15793
15794 <references group='a' />
15795 !!result
15796 <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>
15797 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>
15798
15799 <ol about="#mwt6" class="references" data-mw='{"name":"references","attrs":{"group":"a"}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
15800 !!end
15801
15802 !!test
15803 References: 3. ref list should be cleared after processing references
15804 !!options
15805 parsoid
15806 !!input
15807 A <ref>foo</ref>
15808
15809 <references />
15810
15811 B <ref>bar</ref>
15812
15813 <references />
15814 !!result
15815 <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>
15816
15817 <ol about="#mwt4" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
15818
15819 <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>
15820
15821 <ol about="#mwt8" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> bar</li></ol>
15822 !!end
15823
15824 !!test
15825 References: 4. only referenced group should be cleared after processing references
15826 !!options
15827 parsoid
15828 !!input
15829 A <ref group="a">afoo</ref>
15830 B <ref>bfoo</ref>
15831
15832 <references group="a"/>
15833
15834 C <ref>cfoo</ref>
15835
15836 <references />
15837 !!result
15838 <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>
15839 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>
15840
15841 <ol about="#mwt6" class="references" data-mw='{"name":"references","attrs":{"group":"a"}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> afoo</li></ol>
15842
15843 <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>
15844
15845 <ol about="#mwt10" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> bfoo</li><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2-0">↑</a></span> cfoo</li></ol>
15846 !!end
15847
15848 !!test
15849 References: 5. ref tags in references should be processed while ignoring all other content
15850 !!options
15851 parsoid
15852 !!input
15853 A <ref name="a" />
15854 B <ref name="b">bar</ref>
15855
15856 <references>
15857 <ref name="a">foo</ref>
15858 This should just get lost.
15859 </references>
15860 !!result
15861 <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>
15862 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>
15863
15864 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","body":{"extsrc":"<ref name=\"a\">foo</ref>\nThis should just get lost.","html":"<span about=\"#mwt8\" class=\"reference\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;html&amp;quot;:&amp;quot;foo&amp;quot;},&amp;quot;attrs&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;a&amp;quot;}}\" rel=\"dc:references\" typeof=\"mw:Extension/ref\"><a href=\"#cite_note-a-1\">[1]</a></span>"},"attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="#cite_ref-a-1-0">↑</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> bar</li></ol>
15865 !!end
15866
15867 !!test
15868 References: 6. <references /> from a transclusion
15869 !!options
15870 parsoid
15871 !!input
15872 {{echo|<references />}}
15873 !!result
15874 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}'></ol>
15875 !!end
15876
15877 !! test
15878 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
15879 !! options
15880 parsoid
15881 !! input
15882 A <ref>foo bar for a</ref>
15883 B <ref name="b" />
15884
15885 <references />
15886
15887 <references>
15888 <ref name="b">foo</ref>
15889 </references>
15890 !! result
15891 <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>
15892 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>
15893
15894 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo bar for a</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> </li></ol>
15895
15896 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","body":{"extsrc":"<ref name=\"b\">foo</ref>","html":"\n<span about=\"#mwt10\" class=\"reference\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;html&amp;quot;:&amp;quot;foo&amp;quot;},&amp;quot;attrs&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;b&amp;quot;}}\" rel=\"dc:references\" typeof=\"mw:Extension/ref\"><a href=\"#cite_note-b-1\">[1]</a></span>\n"},"attrs":{}}'><li about="#cite_note-b-1" id="cite_note-b-1"><span rel="mw:referencedBy">↑</span> foo</li></ol>
15897
15898 !! end
15899
15900 #### ----------------------------------------------------------------
15901 #### The following section of tests are primarily to test
15902 #### wikitext escaping capabilities of Parsoid. Given that
15903 #### escaping can be done any number of ways, the wikitext (input)
15904 #### is always adjusted to reflect how Parsoid adds nowiki
15905 #### escape tags.
15906 ####
15907 #### We are marking several tests as parsoid-only since the
15908 #### HTML in the result section is different from what the
15909 #### PHP parser generates for it.
15910 #### ----------------------------------------------------------------
15911
15912
15913 #### --------------- Headings ---------------
15914 #### 0. Unnested
15915 #### 1. Nested inside html <h1>=foo=</h1>
15916 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
15917 #### 3. Nested inside html with wikitext split by html tags
15918 #### 4. No escape needed
15919 #### 5. Empty headings <h1></h1>
15920 #### 6. Heading chars in SOL context
15921 #### ----------------------------------------
15922 !! test
15923 Headings: 0. Unnested
15924 !! options
15925 parsoid
15926 !! input
15927 <nowiki>=foo=</nowiki>
15928
15929 <nowiki> =foo= </nowiki>
15930 <!--cmt-->
15931 <nowiki>=foo=</nowiki>
15932
15933 =foo''a''<nowiki>=</nowiki>
15934 !! result
15935 <p><span typeof="mw:Nowiki">=foo=</span></p>
15936
15937 <p><span typeof="mw:Nowiki"> =foo= </span>
15938 <!--cmt-->
15939 <span typeof="mw:Nowiki">=foo=</span></p>
15940
15941 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
15942 !!end
15943
15944 !! test
15945 Headings: 1. Nested inside html
15946 !! options
15947 parsoid
15948 !! input
15949 =<nowiki>=foo=</nowiki>=
15950
15951 ==<nowiki>=foo=</nowiki>==
15952
15953 ===<nowiki>=foo=</nowiki>===
15954
15955 ====<nowiki>=foo=</nowiki>====
15956
15957 =====<nowiki>=foo=</nowiki>=====
15958
15959 ======<nowiki>=foo=</nowiki>======
15960 !! result
15961 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
15962 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
15963 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
15964 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
15965 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
15966 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
15967 !!end
15968
15969 !! test
15970 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
15971 !! options
15972 parsoid
15973 !! input
15974 =foo=
15975 <nowiki>*</nowiki>bar
15976
15977 =foo=
15978 =bar
15979
15980 =foo=
15981 <nowiki>=bar=</nowiki>
15982 !! result
15983 <h1>foo</h1>*bar
15984 <h1>foo</h1>=bar
15985 <h1>foo</h1>=bar=
15986 !!end
15987
15988 !! test
15989 Headings: 3. Nested inside html with wikitext split by html tags
15990 !! options
15991 parsoid
15992 !! input
15993 =='''bold'''<nowiki>foo=</nowiki>=
15994 !! result
15995 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
15996 !!end
15997
15998 !! test
15999 Headings: 4a. No escaping needed (testing just h1 and h2)
16000 !! options
16001 parsoid
16002 !! input
16003 ==foo=
16004
16005 =foo==
16006
16007 = =foo= =
16008
16009 ==foo= bar=
16010
16011 ===foo==
16012
16013 ==foo===
16014
16015 =''=''foo==
16016
16017 =<nowiki>=</nowiki>=
16018 !! result
16019 <h1>=foo</h1>
16020 <h1>foo=</h1>
16021 <h1> =foo= </h1>
16022 <h1>=foo= bar</h1>
16023 <h2>=foo</h2>
16024 <h2>foo=</h2>
16025 <h1><i>=</i>foo=</h1>
16026 <h1><span typeof="mw:Nowiki">=</span></h1>
16027 !!end
16028
16029 !! test
16030 Headings: 4b. No escaping needed (inside p-tags)
16031 !! options
16032 parsoid
16033 !! input
16034 ===
16035 =foo= x
16036 =foo= <s></s>
16037 !! result
16038 <p>===
16039 =foo= x
16040 =foo= <s></s>
16041 </p>
16042 !!end
16043
16044 !! test
16045 Headings: 5. Empty headings
16046 !! options
16047 parsoid
16048 !! input
16049 =<nowiki/>=
16050
16051 ==<nowiki/>==
16052
16053 ===<nowiki/>===
16054
16055 ====<nowiki/>====
16056
16057 =====<nowiki/>=====
16058
16059 ======<nowiki/>======
16060 !! result
16061 <h1></h1>
16062 <h2></h2>
16063 <h3></h3>
16064 <h4></h4>
16065 <h5></h5>
16066 <h6></h6>
16067 !!end
16068
16069 !! test
16070 Headings: 6a. Heading chars in SOL context (with trailing spaces)
16071 !! options
16072 parsoid
16073 !! input
16074 <nowiki>=a=</nowiki>
16075
16076 <nowiki>=a=</nowiki>
16077
16078 <nowiki>=a=</nowiki>
16079
16080 <nowiki>=a=</nowiki>
16081 !! result
16082 <p>=a=</p>
16083 <p>=a= </p>
16084 <p>=a= </p>
16085 <p>=a= </p>
16086 !!end
16087
16088 !! test
16089 Headings: 6b. Heading chars in SOL context (with trailing newlines)
16090 !! options
16091 parsoid
16092 !! input
16093 <nowiki>=a=
16094 b</nowiki>
16095
16096 <nowiki>=a=
16097 b</nowiki>
16098
16099 <nowiki>=a=
16100 b</nowiki>
16101
16102 <nowiki>=a=
16103 b</nowiki>
16104 !! result
16105 <p>=a=
16106 b</p>
16107 <p>=a=
16108 b</p>
16109 <p>=a=
16110 b</p>
16111 <p>=a=
16112 b</p>
16113 </p>
16114 !!end
16115
16116 !! test
16117 Headings: 6c. Heading chars in SOL context (leading newline break)
16118 !! options
16119 parsoid
16120 !! input
16121 a
16122 <nowiki>=b=</nowiki>
16123 !! result
16124 <p>a
16125 =b=</p>
16126 !!end
16127
16128 !! test
16129 Headings: 6d. Heading chars in SOL context (with interspersed comments)
16130 !! options
16131 parsoid
16132 !! input
16133 <!--c0--><nowiki>=a=</nowiki>
16134 <!--c1-->
16135 <nowiki>=a=</nowiki> <!--c2--> <!--c3-->
16136 !! result
16137 <p><!--c0-->=a=</p>
16138 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
16139 !!end
16140
16141 !! test
16142 Headings: 6d. Heading chars in SOL context (No escaping needed)
16143 !! options
16144 parsoid=html2wt
16145 !! input
16146 =a=<div>b</div>
16147 !! result
16148 =a=<div>b</div>
16149 !!end
16150
16151 #### --------------- Lists ---------------
16152 #### 0. Outside nests (*foo, etc.)
16153 #### 1. Nested inside html <ul><li>*foo</li></ul>
16154 #### 2. Inside definition lists
16155 #### 3. Only bullets at start should be escaped
16156 #### 4. No escapes needed
16157 #### 5. No unnecessary escapes
16158 #### 6. Escape bullets in SOL position
16159 #### 7. Escape bullets in a multi-line context
16160 #### ----------------------------------------
16161
16162 !! test
16163 Lists: 0. Outside nests
16164 !! input
16165 <nowiki>*</nowiki>foo
16166
16167 <nowiki>#</nowiki>foo
16168 !! result
16169 <p>*foo
16170 </p><p>#foo
16171 </p>
16172 !!end
16173
16174 !! test
16175 Lists: 1. Nested inside html
16176 !! input
16177 *<nowiki>*foo</nowiki>
16178
16179 *<nowiki>#foo</nowiki>
16180
16181 *<nowiki>:foo</nowiki>
16182
16183 *<nowiki>;foo</nowiki>
16184
16185 #<nowiki>*foo</nowiki>
16186
16187 #<nowiki>#foo</nowiki>
16188
16189 #<nowiki>:foo</nowiki>
16190
16191 #<nowiki>;foo</nowiki>
16192 !! result
16193 <ul><li>*foo
16194 </li></ul>
16195 <ul><li>#foo
16196 </li></ul>
16197 <ul><li>:foo
16198 </li></ul>
16199 <ul><li>;foo
16200 </li></ul>
16201 <ol><li>*foo
16202 </li></ol>
16203 <ol><li>#foo
16204 </li></ol>
16205 <ol><li>:foo
16206 </li></ol>
16207 <ol><li>;foo
16208 </li></ol>
16209
16210 !!end
16211
16212 !! test
16213 Lists: 2. Inside definition lists
16214 !! input
16215 ;<nowiki>;foo</nowiki>
16216
16217 ;<nowiki>:foo</nowiki>
16218
16219 ;<nowiki>:foo</nowiki>
16220 :bar
16221
16222 :<nowiki>:foo</nowiki>
16223 !! result
16224 <dl><dt>;foo
16225 </dt></dl>
16226 <dl><dt>:foo
16227 </dt></dl>
16228 <dl><dt>:foo
16229 </dt><dd>bar
16230 </dd></dl>
16231 <dl><dd>:foo
16232 </dd></dl>
16233
16234 !!end
16235
16236 !! test
16237 Lists: 3. Only bullets at start of text should be escaped
16238 !! input
16239 *<nowiki>*foo*bar</nowiki>
16240
16241 *<nowiki>*foo</nowiki>''it''*bar
16242 !! result
16243 <ul><li>*foo*bar
16244 </li></ul>
16245 <ul><li>*foo<i>it</i>*bar
16246 </li></ul>
16247
16248 !!end
16249
16250 !! test
16251 Lists: 4. No escapes needed
16252 !! options
16253 parsoid
16254 !! input
16255 *foo*bar
16256
16257 *''foo''*bar
16258
16259 *[[Foo]]: bar
16260 !! result
16261 <ul><li>foo*bar
16262 </li></ul>
16263 <ul><li><i>foo</i>*bar
16264 </li></ul>
16265 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
16266 </li></ul>
16267 !!end
16268
16269 !! test
16270 Lists: 5. No unnecessary escapes
16271 !! input
16272 * bar <span><nowiki>[[foo]]</nowiki></span>
16273
16274 *=bar <span><nowiki>[[foo]]</nowiki></span>
16275
16276 *[[bar <span><nowiki>[[foo]]</nowiki></span>
16277
16278 *]]bar <span><nowiki>[[foo]]</nowiki></span>
16279
16280 *=bar <span>foo]]</span>=
16281
16282 * <s></s>: a
16283 !! result
16284 <ul><li> bar <span>[[foo]]</span>
16285 </li></ul>
16286 <ul><li>=bar <span>[[foo]]</span>
16287 </li></ul>
16288 <ul><li>[[bar <span>[[foo]]</span>
16289 </li></ul>
16290 <ul><li>]]bar <span>[[foo]]</span>
16291 </li></ul>
16292 <ul><li>=bar <span>foo]]</span>=
16293 </li></ul>
16294 <ul><li> <s></s>: a
16295 </li></ul>
16296
16297 !!end
16298
16299 !! test
16300 Lists: 6. Escape bullets in SOL position
16301 !! options
16302 parsoid
16303 !! input
16304 <!--cmt--><nowiki>*foo</nowiki>
16305 !! result
16306 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
16307 !!end
16308
16309 !! test
16310 Lists: 7. Escape bullets in a multi-line context
16311 !! input
16312 a
16313 <nowiki>*</nowiki>b
16314 !! result
16315 <p>a
16316 *b
16317 </p>
16318 !!end
16319
16320 #### --------------- HRs ---------------
16321 #### 1. Single line
16322 #### -----------------------------------
16323
16324 !! test
16325 HRs: 1. Single line
16326 !! options
16327 parsoid
16328 !! input
16329 ----<nowiki>----</nowiki>
16330 ----=foo=
16331 ----*foo
16332 !! result
16333 <hr><span typeof="mw:Nowiki">----</span>
16334 <hr>=foo=
16335 <hr>*foo
16336 !! end
16337
16338 #### --------------- Tables ---------------
16339 #### 1a. Simple example
16340 #### 1b. No escaping needed (!foo)
16341 #### 1c. No escaping needed (|foo)
16342 #### 1d. No escaping needed (|}foo)
16343 ####
16344 #### 2a. Nested in td (<td>foo|bar</td>)
16345 #### 2b. Nested in td (<td>foo||bar</td>)
16346 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
16347 ####
16348 #### 3a. Nested in th (<th>foo!bar</th>)
16349 #### 3b. Nested in th (<th>foo!!bar</th>)
16350 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
16351 ####
16352 #### 4a. Escape -
16353 #### 4b. Escape +
16354 #### 4c. No escaping needed
16355 #### --------------------------------------
16356
16357 !! test
16358 Tables: 1a. Simple example
16359 !! input
16360 <nowiki>{|
16361 |}</nowiki>
16362 !! result
16363 <p>{|
16364 |}
16365 </p>
16366 !! end
16367
16368 !! test
16369 Tables: 1b. No escaping needed
16370 !! input
16371 !foo
16372 !! result
16373 <p>!foo
16374 </p>
16375 !! end
16376
16377 !! test
16378 Tables: 1c. No escaping needed
16379 !! input
16380 |foo
16381 !! result
16382 <p>|foo
16383 </p>
16384 !! end
16385
16386 !! test
16387 Tables: 1d. No escaping needed
16388 !! input
16389 |}foo
16390 !! result
16391 <p>|}foo
16392 </p>
16393 !! end
16394
16395 !! test
16396 Tables: 2a. Nested in td
16397 !! options
16398 parsoid
16399 !! input
16400 {|
16401 |<nowiki>foo|bar</nowiki>
16402 |}
16403 !! result
16404 <table><tbody><tr>
16405 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
16406 !! end
16407
16408 !! test
16409 Tables: 2b. Nested in td
16410 !! options
16411 parsoid
16412 !! input
16413 {|
16414 |<nowiki>foo||bar</nowiki>
16415 |''it''<nowiki>foo||bar</nowiki>
16416 |}
16417 !! result
16418 <table><tbody><tr>
16419 <td><span typeof="mw:Nowiki">foo||bar</span></td>
16420 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
16421 !! end
16422
16423 !! test
16424 Tables: 2c. Nested in td -- no escaping needed
16425 !! options
16426 parsoid
16427 !! input
16428 {|
16429 |foo!!bar
16430 |}
16431 !! result
16432 <table><tbody><tr><td>foo!!bar
16433 </td></tr></tbody></table>
16434
16435 !! end
16436
16437 !! test
16438 Tables: 3a. Nested in th
16439 !! options
16440 parsoid
16441 !! input
16442 {|
16443 !foo!bar
16444 |}
16445 !! result
16446 <table><tbody><tr><th>foo!bar
16447 </th></tr></tbody></table>
16448
16449 !! end
16450
16451 !! test
16452 Tables: 3b. Nested in th
16453 !! options
16454 parsoid
16455 !! input
16456 {|
16457 !<nowiki>foo!!bar</nowiki>
16458 |}
16459 !! result
16460 <table>
16461 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
16462 </tbody></table>
16463 !! end
16464
16465 !! test
16466 Tables: 3c. Nested in th -- no escaping needed
16467 !! options
16468 parsoid
16469 !! input
16470 {|
16471 !<nowiki>foo||bar</nowiki>
16472 |}
16473 !! result
16474 <table><tbody><tr>
16475 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
16476 !! end
16477
16478 !! test
16479 Tables: 4a. Escape -
16480 !! options
16481 parsoid
16482 !! input
16483 {|
16484 |-
16485 !-bar
16486 |-
16487 |<nowiki>-bar</nowiki>
16488 |}
16489 !! result
16490 <table><tbody>
16491 <tr><th>-bar</th></tr>
16492 <tr>
16493 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
16494 !! end
16495
16496 !! test
16497 Tables: 4b. Escape +
16498 !! options
16499 parsoid
16500 !! input
16501 {|
16502 |-
16503 !+bar
16504 |-
16505 |<nowiki>+bar</nowiki>
16506 |}
16507 !! result
16508 <table><tbody>
16509 <tr><th>+bar</th></tr>
16510 <tr>
16511 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
16512 !! end
16513
16514 !! test
16515 Tables: 4c. No escaping needed
16516 !! options
16517 parsoid
16518 !! input
16519 {|
16520 |-
16521 |foo-bar
16522 |foo+bar
16523 |-
16524 |''foo''-bar
16525 |''foo''+bar
16526 |-
16527 |foo
16528 bar|baz
16529 +bar
16530 -bar
16531 |}
16532 !! result
16533 <table><tbody>
16534 <tr><td>foo-bar</td><td>foo+bar</td></tr>
16535 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
16536 <tr><td>foo
16537 <p>bar|baz
16538 +bar
16539 -bar</p></td></tr>
16540 </tbody></table>
16541 !! end
16542
16543 ### SSS FIXME: Disabled right now because accurate html2wt
16544 ### on this snippet requires data-parsoid flags that we've
16545 ### stripped out of these tests. We should scheme how we
16546 ### we want to handle these kind of tests that require
16547 ### data-parsoid flags for accurate html2wt serialization
16548
16549 !! test
16550 Tables: 4d. No escaping needed
16551 !! options
16552 disabled
16553 !! input
16554 {|
16555 ||+1
16556 ||-2
16557 |}
16558 !! result
16559 <table>
16560 <tr>
16561 <td>+1
16562 </td>
16563 <td>-2
16564 </td></tr></table>
16565
16566 !! end
16567
16568 #### --------------- Links ----------------
16569 #### 1. Quote marks in link text
16570 #### 2. Wikilinks: Escapes needed
16571 #### 3. Wikilinks: No escapes needed
16572 #### 4. Extlinks: Escapes needed
16573 #### 5. Extlinks: No escapes needed
16574 #### --------------------------------------
16575 !! test
16576 Links 1. Quote marks in link text
16577 !! options
16578 parsoid
16579 !! input
16580 [[Foo|Foo<nowiki>''boo''</nowiki>]]
16581 !! result
16582 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
16583 !! end
16584
16585 !! test
16586 Links 2. WikiLinks: Escapes needed
16587 !! options
16588 parsoid
16589 !! input
16590 [[Foo|<nowiki>[Foobar]</nowiki>]]
16591 [[Foo|<nowiki>Foobar]</nowiki>]]
16592 [[Foo|x [Foobar] x]]
16593 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
16594 [[Foo|<nowiki>[[Bar]]</nowiki>]]
16595 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
16596 [[Foo|<nowiki>|Bar</nowiki>]]
16597 [[Foo|<nowiki>]]bar</nowiki>]]
16598 [[Foo|<nowiki>[[bar</nowiki>]]
16599 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
16600 !! result
16601 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
16602 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
16603 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
16604 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
16605 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
16606 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
16607 <a href="Foo" rel="mw:WikiLink">|Bar</a>
16608 <a href="Foo" rel="mw:WikiLink">]]bar</a>
16609 <a href="Foo" rel="mw:WikiLink">[[bar</a>
16610 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
16611 !! end
16612
16613 !! test
16614 Links 3. WikiLinks: No escapes needed
16615 !! options
16616 parsoid
16617 !! input
16618 [[Foo|[Foobar]]
16619 [[Foo|foo|bar]]
16620 !! result
16621 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
16622 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
16623 !! end
16624
16625 !! test
16626 Links 4. ExtLinks: Escapes needed
16627 !! options
16628 parsoid
16629 !! input
16630 [http://google.com <nowiki>[google]</nowiki>]
16631 [http://google.com <nowiki>google]</nowiki>]
16632 !! result
16633 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
16634 <a href="http://google.com" rel="mw:ExtLink">google]</a>
16635 !! end
16636
16637 !! test
16638 Links 5. ExtLinks: No escapes needed
16639 !! options
16640 parsoid
16641 !! input
16642 [http://google.com [google]
16643 !! result
16644 <a href="http://google.com" rel="mw:ExtLink">[google</a>
16645 !! end
16646
16647 #### --------------- Quotes ---------------
16648 #### 1. Quotes inside <b> and <i>
16649 #### 2. Link fragments separated by <i> and <b> tags
16650 #### 3. Link fragments inside <i> and <b>
16651 #### 4. No escaping needed
16652 #### --------------------------------------
16653 !! test
16654 1. Quotes inside <b> and <i>
16655 !! options
16656 parsoid=html2wt,wt2wt
16657 !! input
16658 ''<nowiki>'foo'</nowiki>''
16659 ''<nowiki>''foo''</nowiki>''
16660 ''<nowiki>'''foo'''</nowiki>''
16661 ''foo''<nowiki/>'s
16662 '''<nowiki>'foo'</nowiki>'''
16663 '''<nowiki>''foo''</nowiki>'''
16664 '''<nowiki>'''foo'''</nowiki>'''
16665 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
16666 '''foo'''<nowiki/>'s
16667 '''foo''
16668 ''foo''<nowiki/>'
16669 '<nowiki/>''foo''<nowiki/>'
16670 ''''foo'''
16671 '''foo'''<nowiki/>'
16672 '<nowiki/>'''foo'''<nowiki/>'
16673 !! result
16674 <p><i>'foo'</i>
16675 <i>''foo''</i>
16676 <i>'''foo'''</i>
16677 <i>foo</i>'s
16678 <b>'foo'</b>
16679 <b>''foo''</b>
16680 <b>'''foo'''</b>
16681 <b>foo'<i>bar'</i>baz</b>
16682 <b>foo</b>'s
16683 '<i>foo</i>
16684 <i>foo</i>'
16685 '<i>foo</i>'
16686 '<b>foo</b>
16687 <b>foo</b>'
16688 '<b>foo</b>'</p>
16689 !! end
16690
16691 !! test
16692 2. Link fragments separated by <i> and <b> tags
16693 !! input
16694 [[''foo''<nowiki>hello]]</nowiki>
16695
16696 [['''foo'''<nowiki>hello]]</nowiki>
16697 !! result
16698 <p>[[<i>foo</i>hello]]
16699 </p><p>[[<b>foo</b>hello]]
16700 </p>
16701 !! end
16702
16703 !! test
16704 3. Link fragments inside <i> and <b>
16705 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
16706 this is one of the shortcomings of this format)
16707 !! input
16708 ''[[foo''<nowiki>]]</nowiki>
16709
16710 '''[[foo'''<nowiki>]]</nowiki>
16711 !! result
16712 <p><i>[[foo</i>]]
16713 </p><p><b>[[foo</b>]]
16714 </p>
16715 !! end
16716
16717 !! test
16718 4. No escaping needed
16719 !! input
16720 '<span>''bar''</span>'
16721 '<span>'''bar'''</span>'
16722 !! result
16723 <p>'<span><i>bar</i></span>'
16724 '<span><b>bar</b></span>'
16725 </p>
16726 !! end
16727
16728 #### ----------- Paragraphs ---------------
16729 #### 1. No unnecessary escapes
16730 #### --------------------------------------
16731
16732 !! test
16733 1. No unnecessary escapes
16734 !! input
16735 bar <span><nowiki>[[foo]]</nowiki></span>
16736
16737 =bar <span><nowiki>[[foo]]</nowiki></span>
16738
16739 [[bar <span><nowiki>[[foo]]</nowiki></span>
16740
16741 ]]bar <span><nowiki>[[foo]]</nowiki></span>
16742
16743 =bar <span>foo]]</span><nowiki>=</nowiki>
16744 !! result
16745 <p>bar <span>[[foo]]</span>
16746 </p><p>=bar <span>[[foo]]</span>
16747 </p><p>[[bar <span>[[foo]]</span>
16748 </p><p>]]bar <span>[[foo]]</span>
16749 </p><p>=bar <span>foo]]</span>=
16750 </p>
16751 !!end
16752
16753 #### ----------------------- PRE --------------------------
16754 #### 1. Leading whitespace in SOL context should be escaped
16755 #### ------------------------------------------------------
16756 !! test
16757 1. Leading whitespace in SOL context should be escaped
16758 !! options
16759 parsoid
16760 !! input
16761 <nowiki> </nowiki>a
16762
16763 <nowiki> </nowiki> a
16764
16765 <nowiki> </nowiki>a(tab)
16766
16767 <nowiki> </nowiki> a
16768 <!--cmt-->
16769 <nowiki> </nowiki> a
16770
16771 a
16772 <nowiki> </nowiki>b
16773
16774 a
16775 <nowiki> </nowiki>b
16776
16777 a
16778 <nowiki> </nowiki> b
16779 !! result
16780 <p> a</p>
16781 <p> a</p>
16782 <p> a(tab)</p>
16783 <p> a</p>
16784 <p><!--cmt--> a</p>
16785 <p>a
16786 b</p>
16787 <p>a
16788 b</p>
16789 <p>a
16790 b</p>
16791 !! end
16792
16793 #### --------------- HTML tags ---------------
16794 #### 1. a tags
16795 #### 2. other tags
16796 #### 3. multi-line html tag
16797 #### -----------------------------------------
16798 !! test
16799 1. a tags
16800 !! options
16801 parsoid
16802 !! input
16803 <a href="http://google.com">google</a>
16804 !! result
16805 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
16806 !! end
16807
16808 !! test
16809 2. other tags
16810 !! input
16811 <nowiki><div>foo</div>
16812 <div style="color:red">foo</div></nowiki>
16813 !! result
16814 <p>&lt;div&gt;foo&lt;/div&gt;
16815 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
16816 </p>
16817 !! end
16818
16819 !! test
16820 3. multi-line html tag
16821 !! input
16822 <nowiki><div
16823 >foo</div
16824 ></nowiki>
16825 !! result
16826 <p>&lt;div
16827 &gt;foo&lt;/div
16828 &gt;
16829 </p>
16830 !! end
16831
16832 !! test
16833 4. extension tags
16834 !! input
16835 <nowiki><ref>foo</ref></nowiki>
16836 !! result
16837 <p>&lt;ref&gt;foo&lt;/ref&gt;
16838 </p>
16839 !! end
16840
16841 #### --------------- Others ---------------
16842 !! test
16843 Escaping nowikis
16844 !! input
16845 &lt;nowiki&gt;foo&lt;/nowiki&gt;
16846 !! result
16847 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
16848 </p>
16849 !! end
16850
16851 ## The quote-char in the input is necessary for triggering the bug
16852 !! test
16853 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
16854 !! options
16855 parsoid=wt2wt,html2wt
16856 !! input
16857 foo's bar :
16858 !! result
16859 <p>foo's bar :</p>
16860 !! end
16861
16862 !! test
16863
16864 Tag-like HTML structures are passed through as text
16865 !! input
16866 <x y>
16867
16868 <x.y>
16869
16870 <x-y>
16871
16872 1>2
16873
16874 x<y
16875
16876 a>b
16877
16878 1<d e>f
16879 !! result
16880 <p>&lt;x y&gt;
16881 </p><p>&lt;x.y&gt;
16882 </p><p>&lt;x-y&gt;
16883 </p><p>1&gt;2
16884 </p><p>x&lt;y
16885 </p><p>a&gt;b
16886 </p><p>1&lt;d e&gt;f
16887 </p>
16888 !! end
16889
16890
16891 # This was a bug in the PHP parser (see bug 17663 and its dups,
16892 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
16893 !! test
16894 Tag names followed by punctuation should not be recognized as tags
16895 !! input
16896 <s.ome> text
16897 !! result
16898 <p>&lt;s.ome&gt; text
16899 </p>
16900 !! end
16901
16902 !! test
16903 HTML tag with necessary entities in attributes
16904 !! input
16905 <span title="&amp;amp;">foo</span>
16906 !! result
16907 <p><span title="&amp;amp;">foo</span>
16908 </p>
16909 !! end
16910
16911 !! test
16912 HTML tag with 'unnecessary' entity encoding in attributes
16913 !! input
16914 <span title="&amp;">foo</span>
16915 !! result
16916 <p><span title="&amp;">foo</span>
16917 </p>
16918 !! end
16919
16920 !! test
16921 HTML tag with broken attribute value quoting
16922 !! input
16923 <span title="Hello world>Foo</span>
16924 !! result
16925 <p><span>Foo</span>
16926 </p>
16927 !! end
16928
16929 !! test
16930 Parsoid-only: HTML tag with broken attribute value quoting
16931 !! options
16932 parsoid
16933 !! input
16934 <span title="Hello world>Foo</span>
16935 !! result
16936 <p><span title="Hello world">Foo</span>
16937 </p>
16938 !! end
16939
16940 !! test
16941 Table with broken attribute value quoting
16942 !! input
16943 {|
16944 | title="Hello world|Foo
16945 |}
16946 !! result
16947 <table>
16948 <tr>
16949 <td>Foo
16950 </td></tr></table>
16951
16952 !! end
16953
16954 !! test
16955 Table with broken attribute value quoting on consecutive lines
16956 !! input
16957 {|
16958 | title="Hello world|Foo
16959 | style="color:red|Bar
16960 |}
16961 !! result
16962 <table>
16963 <tr>
16964 <td>Foo
16965 </td>
16966 <td>Bar
16967 </td></tr></table>
16968
16969 !! end
16970
16971 !! test
16972 Parsoid-only: Table with broken attribute value quoting on consecutive lines
16973 !! options
16974 parsoid
16975 !! input
16976 {|
16977 | title="Hello world|Foo
16978 | style="color:red|Bar
16979 |}
16980 !! result
16981 <table><tbody>
16982 <tr>
16983 <td title="Hello world">Foo
16984 </td><td style="color: red">Bar
16985 </td></tr></tbody></table>
16986
16987 !! end
16988
16989 !! test
16990 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16991 !! options
16992 parsoid
16993 !! input
16994 {{}}
16995 !! result
16996 {{}}
16997 !! end
16998
16999 !! test
17000 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
17001 !! options
17002 parsoid
17003 !! input
17004 }}{{
17005 !! result
17006 }}{{
17007 !! end
17008
17009 !!test
17010 Accept empty td cell attribute
17011 !!input
17012 {|
17013 | align="center" | foo || |
17014 |}
17015 !!result
17016 <table>
17017 <tr>
17018 <td align="center"> foo </td>
17019 <td>
17020 </td></tr></table>
17021
17022 !!end
17023
17024 !!test
17025 Non-empty attributes in th-cells
17026 !!input
17027 {|
17028 ! Foo !! style="color: red" | Bar
17029 |}
17030 !!result
17031 <table>
17032 <tr>
17033 <th> Foo </th>
17034 <th style="color: red"> Bar
17035 </th></tr></table>
17036
17037 !!end
17038
17039 !!test
17040 Accept empty attributes in th-cells
17041 !!input
17042 {|
17043 !| foo !!| bar
17044 |}
17045 !!result
17046 <table>
17047 <tr>
17048 <th> foo </th>
17049 <th> bar
17050 </th></tr></table>
17051
17052 !!end
17053
17054 !!test
17055 Empty table rows go away
17056 !!input
17057 {|
17058 | Hello
17059 | there
17060 |- class="foo"
17061 |-
17062 |}
17063 !! result
17064 <table>
17065 <tr>
17066 <td> Hello
17067 </td>
17068 <td> there
17069 </td></tr>
17070
17071 </table>
17072
17073 !! end
17074
17075 ###
17076 ### Parsoid-centric tests for testing RTing of inter-element separators
17077 ### Edge cases not tested by existing parser tests and specific to
17078 ### Parsoid-specific serialization strategies.
17079 ###
17080
17081 !!test
17082 RT-ed inter-element separators should be valid separators
17083 !!input
17084 {|
17085 |- [[foo]]
17086 |}
17087 !!result
17088 <table>
17089
17090 </table>
17091
17092 !!end
17093
17094 !!test
17095 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
17096 (Parsoid-only since PHP parser relies on Tidy for correct output)
17097 !!options
17098 parsoid
17099 !!input
17100 {|
17101 |<small>foo
17102 bar
17103 |}
17104
17105 {|
17106 |<small>foo<small>
17107 |}
17108 !!result
17109 !!end
17110
17111 !!test
17112 Empty TD followed by TD with tpl-generated attribute
17113 !!input
17114 {|
17115 |-
17116 |
17117 |{{echo|style='color:red'}}|foo
17118 |}
17119 !!result
17120 <table>
17121
17122 <tr>
17123 <td>
17124 </td>
17125 <td>foo
17126 </td></tr></table>
17127
17128 !!end
17129
17130 !!test
17131 Indented table with an empty td
17132 !!input
17133 {|
17134 |-
17135 |
17136 |foo
17137 |}
17138 !!result
17139 <table>
17140
17141 <tr>
17142 <td>
17143 </td>
17144 <td>foo
17145 </td></tr></table>
17146
17147 !!end
17148
17149 !!test
17150 Empty TR followed by a template-generated TR
17151 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
17152 !!options
17153 parsoid=wt2html,wt2wt
17154 !!input
17155 {|
17156 |-
17157 {{echo|<tr><td>foo</td></tr>}}
17158 |}
17159 !!result
17160 <table>
17161 <tbody>
17162 <tr></tr>
17163 <tr typeof="mw:Transclusion">
17164 <td>foo</td></tr></tbody></table>
17165 !!end
17166
17167 ## PHP and parsoid output differ for this, and since this is primarily
17168 ## for testing Parsoid's serializer, marking this Parsoid only
17169 !!test
17170 Empty TR followed by mixed-ws-comment line should RT correctly
17171 !!options
17172 parsoid
17173 !!input
17174 {|
17175 |-
17176 <!--c-->
17177 |-
17178 <!--c--> <!--d-->
17179 |}
17180 !!result
17181 <table>
17182 <tbody>
17183 <tr>
17184 <td> <!--c--></td></tr>
17185 <tr>
17186 <td><!--c--> <!--d--></td></tr>
17187 </tbody></table>
17188
17189 !!end
17190
17191 !!test
17192 Multi-line image caption generated by templates with/without trailing newlines
17193 !!options
17194 parsoid
17195 !!input
17196 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
17197 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
17198 !!result
17199 <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>
17200 <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>
17201
17202 !!end
17203
17204 ## PHP emits broken html for this, and since this is primarily
17205 ## a Parsoid serializer test, marking this Parsoid only
17206 !!test
17207 Improperly nested inline or quotes tags with whitespace in between
17208 !!options
17209 parsoid
17210 !!input
17211 <span> <s>x</span> </s>
17212 ''' ''x''' ''
17213 !!result
17214 <p><span> <s>x</s></span><s> </s>
17215 <b> <i>x</i></b><i> </i>
17216 </p>
17217 !!end
17218
17219 !!test
17220 Encapsulate protected attributes from wt
17221 !!options
17222 parsoid
17223 !!input
17224 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
17225 !!result
17226 <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>
17227 </body>
17228 !!end
17229
17230 ## Currently the p-wrapper is fragile in how adds / removes transformations.
17231 ## Having nested or stray pre tags results in the attempt to add duplicates,
17232 ## causing an assertion fail. This test tries to prevent that situation.
17233 !!test
17234 Ensure ParagraphWrapper can deal with stray closing pre tags
17235 !!options
17236 parsoid=wt2html
17237 !!input
17238 plain text</pre>
17239 !!result
17240 plain text
17241 !!end
17242
17243 # -----------------------------------------------------------------
17244 # The following section of tests are primarily to spec requirements
17245 # around serialization of new/edited content.
17246 #
17247 # All these tests are marked Parsoid html2wt and html2html only
17248 # ----------------------------------------------------------------
17249
17250 !! test
17251 Image: Modifying size of an image
17252 !! options
17253 parsoid=html2wt
17254 !! input
17255 [[Image:Wiki.png|230x230px]]
17256 !! result
17257 <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>
17258 !!end
17259
17260 !! test
17261 Image: New block level image should have \n before and after
17262 !! options
17263 parsoid=html2wt
17264 !! input
17265 123
17266 [[File:Wiki.png|right|thumb|150x150px]]
17267 456
17268 !! result
17269 <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>
17270 !!end
17271
17272 # Wacky -- the leading newline in input is required because
17273 # that is what the serializer emits. To be fixed. Not fixing
17274 # the test because this test is required to test serialization of
17275 # new content and preferred whitespace style.
17276 !! test
17277 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
17278 !! options
17279 parsoid=html2wt
17280 !! input
17281
17282 * foo
17283 !! result
17284 <ul>
17285 <li><p>foo</p></li>
17286 </ul>
17287 !! end
17288
17289 # Wacky -- the leading newline in input is required because
17290 # that is what the serializer emits. To be fixed. Not fixing
17291 # the test because this test is required to test serialization of
17292 # new content and preferred whitespace style.
17293 !! test
17294 Lists: Add space after bullets
17295 !! options
17296 parsoid=html2wt
17297 !! input
17298
17299 * foo
17300 * bar
17301 * <span> baz</span>
17302 !! result
17303 <ul>
17304 <li>foo</li>
17305 <li> bar</li>
17306 <li><span> baz</span></li>
17307 </ul>
17308 !! end
17309
17310 !! test
17311 Parsoid: Serialize positional parameters with = in them as named parameter
17312 !! options
17313 parsoid=html2wt
17314 !! input
17315 {{echo|1 = f=oo}}
17316 !! result
17317 <p about="#mwt1" typeof="mw:Transclusion"
17318 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}'
17319 >foo</p>
17320 !! end
17321
17322 # -----------------------------------------------------------------
17323 # End of section for Parsoid-only html2wt tests for serialization
17324 # of new content
17325 # -----------------------------------------------------------------
17326
17327 TODO:
17328 more images
17329 more tables
17330 character entities
17331 and much more
17332 Try for 100% code coverage