Add parserTests for the interaction of italics and possessives.
[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 Ident preformatting with inline content
1336 !! input
1337 a
1338 ''b''
1339 !! result
1340 <pre>a
1341 <i>b</i>
1342 </pre>
1343 !! end
1344
1345 !! test
1346 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1347 !! input
1348 <pre><nowiki>
1349 <b>
1350 <cite>
1351 <em>
1352 </nowiki></pre>
1353 !! result
1354 <pre>
1355 &lt;b&gt;
1356 &lt;cite&gt;
1357 &lt;em&gt;
1358 </pre>
1359
1360 !! end
1361
1362 !! test
1363 Regression with preformatted in <center>
1364 !! input
1365 <center>
1366 Blah
1367 </center>
1368 !! result
1369 <center>
1370 <pre>Blah
1371 </pre>
1372 </center>
1373
1374 !! end
1375
1376 # Expected output in the following test is not really expected (there should be
1377 # <pre> in the output) -- it's only testing for well-formedness.
1378 !! test
1379 Bug 6200: Preformatted in <blockquote>
1380 !! input
1381 <blockquote>
1382 Blah
1383 </blockquote>
1384 !! result
1385 <blockquote>
1386 Blah
1387 </blockquote>
1388
1389 !! end
1390
1391 !! test
1392 <pre> with attributes (bug 3202)
1393 !! input
1394 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1395 !! result
1396 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1397
1398 !! end
1399
1400 !! test
1401 <pre> with width attribute (bug 3202)
1402 !! input
1403 <pre width="8">Narrow screen goodies</pre>
1404 !! result
1405 <pre width="8">Narrow screen goodies</pre>
1406
1407 !! end
1408
1409 !! test
1410 <pre> with forbidden attribute (bug 3202)
1411 !! input
1412 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1413 !! result
1414 <pre width="8">Narrow screen goodies</pre>
1415
1416 !! end
1417
1418 !! test
1419 Entities inside <pre>
1420 !! input
1421 <pre>&lt;</pre>
1422 !! result
1423 <pre>&lt;</pre>
1424
1425 !! end
1426
1427 !! test
1428 <pre> with forbidden attribute values (bug 3202)
1429 !! input
1430 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1431 !! result
1432 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1433
1434 !! end
1435
1436 !! test
1437 <nowiki> inside <pre> (bug 13238)
1438 !! input
1439 <pre>
1440 <nowiki>
1441 </pre>
1442 <pre>
1443 <nowiki></nowiki>
1444 </pre>
1445 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1446 !! result
1447 <pre>
1448 &lt;nowiki&gt;
1449 </pre>
1450 <pre>
1451
1452 </pre>
1453 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1454
1455 !! end
1456
1457 !! test
1458 <nowiki> and <pre> preference (first one wins)
1459 !! input
1460 <pre>
1461 <nowiki>
1462 </pre>
1463 </nowiki>
1464 </pre>
1465
1466 <nowiki>
1467 <pre>
1468 <nowiki>
1469 </pre>
1470 </nowiki>
1471 </pre>
1472
1473 !! result
1474 <pre>
1475 &lt;nowiki&gt;
1476 </pre>
1477 <p>&lt;/nowiki&gt;
1478 &lt;/pre&gt;
1479 </p><p>
1480 &lt;pre&gt;
1481 &lt;nowiki&gt;
1482 &lt;/pre&gt;
1483
1484 &lt;/pre&gt;
1485 </p>
1486 !! end
1487
1488 !! test
1489 </pre> inside nowiki
1490 !! input
1491 <nowiki></pre></nowiki>
1492 !! result
1493 <p>&lt;/pre&gt;
1494 </p>
1495 !! end
1496
1497 !!test
1498 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1499 !!input
1500 {{echo|}}
1501 !!result
1502
1503 !!end
1504
1505 !!test
1506 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1507 !!input
1508 {{echo|
1509 foo}}
1510 !!result
1511 <p>foo
1512 </p>
1513 !!end
1514
1515 !! test
1516 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1517 !! input
1518 {{echo|a
1519 b}}
1520 !!result
1521 <pre>a
1522 </pre>
1523 <p>b
1524 </p>
1525 !!end
1526
1527 !! test
1528 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1529 !! input
1530 {{echo|a
1531 b
1532 c
1533 d
1534 e
1535 }}
1536 !!result
1537 <pre>a
1538 </pre>
1539 <p>b
1540 c
1541 </p>
1542 <pre>d
1543 </pre>
1544 <p>e
1545 </p>
1546 !!end
1547
1548 !!test
1549 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1550 !!input
1551 {{echo| foo}}
1552
1553 {{echo| foo}}{{echo| bar}}
1554
1555 {{echo| foo}}
1556 {{echo| bar}}
1557
1558 {{echo|<!--cmt--> foo}}
1559
1560 <!--cmt-->{{echo| foo}}
1561
1562 {{echo|{{echo| }}bar}}
1563 !!result
1564 <pre>foo
1565 </pre>
1566 <pre>foo bar
1567 </pre>
1568 <pre>foo
1569 bar
1570 </pre>
1571 <pre>foo
1572 </pre>
1573 <pre>foo
1574 </pre>
1575 <pre>bar
1576 </pre>
1577 !!end
1578
1579 !! test
1580 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1581 !! input
1582 {{echo| }}a
1583
1584 {{echo|
1585 }}a
1586
1587 {{echo|
1588 b}}
1589
1590 {{echo|a
1591 }}b
1592
1593 {{echo|a
1594 }} b
1595 !!result
1596 <pre>a
1597 </pre>
1598 <p><br />
1599 </p>
1600 <pre>a
1601 </pre>
1602 <p><br />
1603 </p>
1604 <pre>b
1605 </pre>
1606 <p>a
1607 </p>
1608 <pre>b
1609 </pre>
1610 <p>a
1611 </p>
1612 <pre>b
1613 </pre>
1614 !!end
1615
1616 !! test
1617 Templates: Single-line variant of parameter whitespace stripping test
1618 !! input
1619 {{echo| a}}
1620
1621 {{echo|1= a}}
1622
1623 {{echo|{{echo| a}}}}
1624
1625 {{echo|1={{echo| a}}}}
1626 !! result
1627 <pre>a
1628 </pre>
1629 <p>a
1630 </p>
1631 <pre>a
1632 </pre>
1633 <p>a
1634 </p>
1635 !! end
1636
1637 !! test
1638 Templates: Strip whitespace from named parameters, but not positional ones
1639 !! input
1640 {{echo|
1641 foo}}
1642
1643 {{echo|
1644 * foo}}
1645
1646 {{echo| 1 =
1647 foo}}
1648
1649 {{echo| 1 =
1650 * foo}}
1651 !! result
1652 <pre>foo
1653 </pre>
1654 <p><br />
1655 </p>
1656 <ul><li> foo
1657 </li></ul>
1658 <p>foo
1659 </p>
1660 <ul><li> foo
1661 </li></ul>
1662
1663 !! end
1664
1665 !! test
1666 Templates: Dont strip whitespace from whitespace/comment-only arguments
1667 !! input
1668 {{echo| }}
1669 {{echo|<!--cmt-->}}
1670 {{echo| <!--cmt--> }}
1671 !! result
1672 <p><br />
1673 </p>
1674 !! end
1675
1676 !! test
1677 Templates: Parsoid parameter escaping test 1
1678 !! options
1679 parsoid
1680 !! input
1681 {{echo|[foo]|{{echo|[bar]}}}}
1682 !! result
1683 <p about="#mwt1" typeof="mw:Transclusion"
1684 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>
1685 !! end
1686
1687 !! test
1688 Parsoid: Pipes in external links in template parameter
1689 !! options
1690 parsoid
1691 !! input
1692 {{echo|[{{echo|http://example.com}} link]}}
1693 !! result
1694 <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>
1695 !! end
1696
1697 !! test
1698 Parsoid: pipe in transclusion parameter
1699 !! options
1700 parsoid
1701 !! input
1702 {{echo|http://foo.com/a&#124;b}}
1703 !! result
1704 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1705 typeof="mw:Transclusion"
1706 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>
1707 !! end
1708
1709 !! test
1710 Parsoid: Pipe in external link target and content in template parameter
1711 !! options
1712 parsoid=html2wt,wt2wt
1713 !! input
1714 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1715 !! result
1716 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1717 typeof="mw:Transclusion"
1718 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},
1719 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}'>a|b</a></p>
1720 !! end
1721
1722 !! test
1723 Templates: Dont escape already nowiki-escaped text in template parameters
1724 !! options
1725 parsoid=html2wt,wt2wt
1726 !! input
1727 {{echo|foo<nowiki>|</nowiki>bar}}
1728 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1729 {{echo|<nowiki></nowiki>}}
1730 !! result
1731 <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>
1732 <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>
1733 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}'></span>
1734 </p>
1735 !! end
1736
1737 ###
1738 ### Parsoid-centric tests for testing RT edge cases for pre
1739 ###
1740
1741 !!test
1742 1a. Indent-Pre and Comments
1743 !!input
1744 a
1745 <!--a-->
1746 c
1747 !!result
1748 <pre>a
1749 </pre>
1750 <p>c
1751 </p>
1752 !!end
1753
1754 !!test
1755 1b. Indent-Pre and Comments
1756 !!input
1757 a
1758 <!--a-->
1759 c
1760 !!result
1761 <pre>a
1762 </pre>
1763 <p>c
1764 </p>
1765 !!end
1766
1767 !!test
1768 1c. Indent-Pre and Comments
1769 !!input
1770 <!--a--> a
1771
1772 <!--a--> a
1773 !!result
1774 <pre> a
1775 </pre>
1776 <pre> a
1777 </pre>
1778 !!end
1779
1780 !!test
1781 1d. Indent-Pre and Comments
1782 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
1783 !!input
1784 <!--a--> a
1785
1786 <!--b-->b
1787 !!result
1788 <pre>a
1789 </pre>
1790 <pre>b
1791 </pre>
1792 !!end
1793
1794 !!test
1795 2a. Indent-Pre and tables
1796 !!input
1797 {|
1798 |-
1799 !h1!!h2
1800 |foo||bar
1801 |}
1802 !!result
1803 <table>
1804
1805 <tr>
1806 <th>h1</th>
1807 <th>h2
1808 </th>
1809 <td>foo</td>
1810 <td>bar
1811 </td></tr></table>
1812
1813 !!end
1814
1815 !!test
1816 2b. Indent-Pre and tables
1817 !!input
1818 {|
1819 |-
1820 |foo
1821 |}
1822 !!result
1823 <table>
1824
1825 <tr>
1826 <td>foo
1827 </td></tr></table>
1828
1829 !!end
1830
1831 !!test
1832 2c. Indent-Pre and tables (bug 42252)
1833 !!input
1834 {|
1835 |+ foo
1836 ! | bar
1837 |}
1838 !!result
1839 <table>
1840 <caption> foo
1841 </caption>
1842 <tr>
1843 <th> bar
1844 </th></tr></table>
1845
1846 !!end
1847
1848 !!test
1849 3a. Indent-Pre and block tags (single-line html)
1850 !!input
1851 <p> foo </p>
1852 <div> foo </div>
1853 <span> foo </span>
1854 !!result
1855 <p> foo </p>
1856 <div> foo </div>
1857 <pre><span> foo </span>
1858 </pre>
1859 !!end
1860
1861 !!test
1862 3b. Indent-Pre and block tags (pre-content on separate line)
1863 !!input
1864 <p>
1865 foo
1866 </p>
1867
1868 <div>
1869 foo
1870 </div>
1871
1872 <center>
1873 foo
1874 </center>
1875
1876 <blockquote>
1877 foo
1878 </blockquote>
1879
1880 <table><tr><td>
1881 foo
1882 </td></tr></table>
1883
1884 <ul><li>
1885 foo
1886 </li></ul>
1887
1888 !!result
1889 <p>
1890 foo
1891 </p>
1892 <div>
1893 <pre>foo
1894 </pre>
1895 </div>
1896 <center>
1897 <pre>foo
1898 </pre>
1899 </center>
1900 <blockquote>
1901 foo
1902 </blockquote>
1903 <table><tr><td>
1904 <pre>foo
1905 </pre>
1906 </td></tr></table>
1907 <ul><li>
1908 foo
1909 </li></ul>
1910
1911 !!end
1912
1913 !!test
1914 4. Multiple spaces at start-of-line
1915 !!input
1916 <p> foo </p>
1917 foo
1918 {|
1919 |foo
1920 |}
1921 !!result
1922 <p> foo </p>
1923 <pre> foo
1924 </pre>
1925 <table>
1926 <tr>
1927 <td>foo
1928 </td></tr></table>
1929
1930 !!end
1931
1932 !! test
1933 5. White-space in indent-pre
1934 NOTE: the white-space char on 2nd line is significant
1935 !! input
1936 a<br/>
1937
1938 b
1939 !! result
1940 <pre>a<br />
1941
1942 b
1943 </pre>
1944 !! end
1945
1946 !! test
1947 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
1948 !! input
1949 a
1950
1951 <!-- continue -->
1952 b
1953
1954 c
1955
1956 d
1957 !! result
1958 <pre>a
1959
1960 b
1961 </pre>
1962 <pre>c
1963
1964 </pre>
1965 <p>d
1966 </p>
1967 !! end
1968
1969 !! test
1970 7a. Indent-pre and category links
1971 !! options
1972 parsoid=wt2html,wt2wt
1973 !! input
1974 [[Category:foo]] <!-- No pre-wrapping -->
1975 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
1976 !! result
1977 <span typeof="mw:Transclusion"> </span>
1978 !! end
1979
1980 !! test
1981 7b. Indent-pre and category links
1982 !! options
1983 parsoid=wt2html,wt2wt
1984 !! input
1985 [[Category:foo]] a
1986 [[Category:foo]] {{echo|b}}
1987 !! result
1988 <pre> a <span typeof="mw:Transclusion">b</span>
1989 </pre>
1990 !! end
1991
1992 ###
1993 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1994 ###
1995
1996 !!test
1997 HTML-pre: 1. embedded newlines
1998 !!input
1999 <pre>foo</pre>
2000
2001 <pre>
2002 foo
2003 </pre>
2004
2005 <pre>
2006
2007 foo
2008 </pre>
2009
2010 <pre>
2011
2012
2013 foo
2014 </pre>
2015 !!result
2016 <pre>foo</pre>
2017 <pre>
2018 foo
2019 </pre>
2020 <pre>
2021
2022 foo
2023 </pre>
2024 <pre>
2025
2026
2027 foo
2028 </pre>
2029
2030 !!end
2031
2032 !!test
2033 HTML-pre: 2: indented text
2034 !!input
2035 <pre>
2036 foo
2037 </pre>
2038 !!result
2039 <pre>
2040 foo
2041 </pre>
2042
2043 !!end
2044
2045 !!test
2046 HTML-pre: 3: other wikitext
2047 !!input
2048 <pre>
2049 * foo
2050 # bar
2051 = no-h =
2052 '' no-italic ''
2053 [[ NoLink ]]
2054 </pre>
2055 !!result
2056 <pre>
2057 * foo
2058 # bar
2059 = no-h =
2060 '' no-italic ''
2061 [[ NoLink ]]
2062 </pre>
2063
2064 !!end
2065
2066 ###
2067 ### Definition lists
2068 ###
2069 !! test
2070 Simple definition
2071 !! input
2072 ; name : Definition
2073 !! result
2074 <dl><dt> name&#160;</dt><dd> Definition
2075 </dd></dl>
2076
2077 !! end
2078
2079 !! test
2080 Definition list for indentation only
2081 !! input
2082 : Indented text
2083 !! result
2084 <dl><dd> Indented text
2085 </dd></dl>
2086
2087 !! end
2088
2089 !! test
2090 Definition list with no space
2091 !! input
2092 ;name:Definition
2093 !! result
2094 <dl><dt>name</dt><dd>Definition
2095 </dd></dl>
2096
2097 !!end
2098
2099 !! test
2100 Definition list with URL link
2101 !! input
2102 ; http://example.com/ : definition
2103 !! result
2104 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
2105 </dd></dl>
2106
2107 !! end
2108
2109 !! test
2110 Definition list with bracketed URL link
2111 !! input
2112 ;[http://www.example.com/ Example]:Something about it
2113 !! result
2114 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
2115 </dd></dl>
2116
2117 !! end
2118
2119 !! test
2120 Definition list with wikilink containing colon
2121 !! input
2122 ; [[Help:FAQ]]: The least-read page on Wikipedia
2123 !! result
2124 <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
2125 </dd></dl>
2126
2127 !! end
2128
2129 # At Brion's and JeLuF's insistence... :)
2130 !! test
2131 Definition list with news link containing colon
2132 !! input
2133 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2134 !! result
2135 <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!
2136 </dd></dl>
2137
2138 !! end
2139
2140 !! test
2141 Malformed definition list with colon
2142 !! input
2143 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2144 !! result
2145 <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
2146 </dt></dl>
2147
2148 !! end
2149
2150 !! test
2151 Definition lists: colon in external link text
2152 !! input
2153 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2154 !! result
2155 <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
2156 </dd></dl>
2157
2158 !! end
2159
2160 !! test
2161 Definition lists: colon in HTML attribute
2162 !! input
2163 ;<b style="display: inline">bold</b>
2164 !! result
2165 <dl><dt><b style="display: inline">bold</b>
2166 </dt></dl>
2167
2168 !! end
2169
2170 !! test
2171 Definition lists: self-closed tag
2172 !! input
2173 ;one<br/>two : two-line fun
2174 !! result
2175 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
2176 </dd></dl>
2177
2178 !! end
2179
2180 !! test
2181 Bug 11748: Literal closing tags
2182 !! input
2183 <dl>
2184 <dt>test 1</dt>
2185 <dd>test test test test test</dd>
2186 <dt>test 2</dt>
2187 <dd>test test test test test</dd>
2188 </dl>
2189 !! result
2190 <dl>
2191 <dt>test 1</dt>
2192 <dd>test test test test test</dd>
2193 <dt>test 2</dt>
2194 <dd>test test test test test</dd>
2195 </dl>
2196
2197 !! end
2198
2199 !! test
2200 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2201 !! input
2202 <ul><li>
2203 ; term : description
2204 * unordered
2205 </li>
2206 </ul>
2207 !! result
2208 <ul><li>
2209 <dl><dt> term&#160;</dt><dd> description
2210 </dd></dl>
2211 <ul><li> unordered
2212 </li></ul>
2213 </li>
2214 </ul>
2215
2216 !! end
2217
2218 !! test
2219
2220 Definition list with empty definition and following paragraph
2221 !! input
2222 ; term:
2223 Paragraph text
2224 !! result
2225 <dl><dt> term</dt><dd>
2226 </dd></dl>
2227 <p>Paragraph text
2228 </p>
2229 !! end
2230
2231 !! test
2232 Nested definition lists using html syntax
2233 !! input
2234 <dl><dd>
2235 <dl>
2236 <dd>Foo</dd>
2237 </dl>
2238 </dd></dl>
2239 !! result
2240 <dl><dd>
2241 <dl>
2242 <dd>Foo</dd>
2243 </dl>
2244 </dd></dl>
2245
2246 !! end
2247
2248 !! test
2249 Definition Lists: No nesting: Multiple dd's
2250 !! input
2251 ;x
2252 :a
2253 :b
2254 !! result
2255 <dl><dt>x
2256 </dt><dd>a
2257 </dd><dd>b
2258 </dd></dl>
2259
2260 !! end
2261
2262 !! test
2263 Definition Lists: Indentation: Regular
2264 !! input
2265 :i1
2266 ::i2
2267 :::i3
2268 !! result
2269 <dl><dd>i1
2270 <dl><dd>i2
2271 <dl><dd>i3
2272 </dd></dl>
2273 </dd></dl>
2274 </dd></dl>
2275
2276 !! end
2277
2278 !! test
2279 Definition Lists: Indentation: Missing 1st level
2280 !! input
2281 ::i2
2282 :::i3
2283 !! result
2284 <dl><dd><dl><dd>i2
2285 <dl><dd>i3
2286 </dd></dl>
2287 </dd></dl>
2288 </dd></dl>
2289
2290 !! end
2291
2292 !! test
2293 Definition Lists: Indentation: Multi-level indent
2294 !! input
2295 :::i3
2296 !! result
2297 <dl><dd><dl><dd><dl><dd>i3
2298 </dd></dl>
2299 </dd></dl>
2300 </dd></dl>
2301
2302 !! end
2303
2304 !! test
2305 Definition Lists: Hacky use to indent tables
2306 !! input
2307 ::{|
2308 |foo
2309 |bar
2310 |}
2311 this text
2312 should be left alone
2313 !! result
2314 <dl><dd><dl><dd><table>
2315 <tr>
2316 <td>foo
2317 </td>
2318 <td>bar
2319 </td></tr></table></dd></dl></dd></dl>
2320 <p>this text
2321 should be left alone
2322 </p>
2323 !! end
2324 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2325 ## as an empty dt item. It also ignores all but the last ";" when followed
2326 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2327 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2328 ## ";"s.
2329 ##
2330 ## Ex: ";;t2 ::d2" is transformed into:
2331 ##
2332 ## <dl>
2333 ## <dt>t2 </dt>
2334 ## <dd>
2335 ## <dl>
2336 ## <dt></dt>
2337 ## <dd>d2</dd>
2338 ## </dl>
2339 ## </dd>
2340 ## </dl>
2341 ##
2342 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2343 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2344 ##
2345 ## <dl>
2346 ## <dt>
2347 ## <dl>
2348 ## <dt>t2 </dt>
2349 ## <dd>:d2</dd>
2350 ## </dl>
2351 ## </dt>
2352 ## </dl>
2353 ##
2354 ## All Parsoid only definition list tests have this difference.
2355 ##
2356 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2357 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2358
2359 !! test
2360 Table / list interaction: indented table with lists in table contents
2361 !! input
2362 :{|
2363 |-
2364 | a
2365 * b
2366 |-
2367 | c
2368 * d
2369 |}
2370 !! result
2371 <dl><dd><table>
2372
2373 <tr>
2374 <td> a
2375 <ul><li> b
2376 </li></ul>
2377 </td></tr>
2378 <tr>
2379 <td> c
2380 <ul><li> d
2381 </li></ul>
2382 </td></tr></table></dd></dl>
2383
2384 !! end
2385
2386 !!test
2387 Table / list interaction: lists nested in tables nested in indented lists
2388 !!input
2389 :{|
2390 |
2391 :a
2392 :b
2393 |
2394 *c
2395 *d
2396 |}
2397
2398 *e
2399 *f
2400 !!result
2401 <dl><dd><table>
2402 <tr>
2403 <td>
2404 <dl><dd>a
2405 </dd><dd>b
2406 </dd></dl>
2407 </td>
2408 <td>
2409 <ul><li>c
2410 </li><li>d
2411 </li></ul>
2412 </td></tr></table></dd></dl>
2413 <ul><li>e
2414 </li><li>f
2415 </li></ul>
2416
2417 !!end
2418
2419 !! test
2420 Definition Lists: Nesting: Multi-level (Parsoid only)
2421 !! options
2422 parsoid
2423 !! input
2424 ;t1 :d1
2425 ;;t2 ::d2
2426 ;;;t3 :::d3
2427 !! result
2428 <dl>
2429 <dt>t1 </dt>
2430 <dd>d1</dd>
2431 <dt>
2432 <dl>
2433 <dt>t2 </dt>
2434 <dd>:d2</dd>
2435 <dt>
2436 <dl>
2437 <dt>t3 </dt>
2438 <dd>::d3</dd>
2439 </dl>
2440 </dt>
2441 </dl>
2442 </dt>
2443 </dl>
2444
2445
2446 !! end
2447
2448
2449 !! test
2450 Definition Lists: Nesting: Test 2 (Parsoid only)
2451 !! options
2452 parsoid
2453 !! input
2454 ;t1
2455 ::d2
2456 !! result
2457 <dl>
2458 <dt>t1</dt>
2459 <dd>
2460 <dl>
2461 <dd>d2</dd>
2462 </dl>
2463 </dd>
2464 </dl>
2465
2466 !! end
2467
2468
2469 !! test
2470 Definition Lists: Nesting: Test 3 (Parsoid only)
2471 !! options
2472 parsoid
2473 !! input
2474 :;t1
2475 ::::d2
2476 !! result
2477 <dl>
2478 <dd>
2479 <dl>
2480 <dt>t1</dt>
2481 <dd>
2482 <dl>
2483 <dd>
2484 <dl>
2485 <dd>d2</dd>
2486 </dl>
2487 </dd>
2488 </dl>
2489 </dd>
2490 </dl>
2491 </dd>
2492 </dl>
2493
2494 !! end
2495
2496
2497 !! test
2498 Definition Lists: Nesting: Test 4
2499 !! input
2500 ::;t3
2501 :::d3
2502 !! result
2503 <dl><dd><dl><dd><dl><dt>t3
2504 </dt><dd>d3
2505 </dd></dl>
2506 </dd></dl>
2507 </dd></dl>
2508
2509 !! end
2510
2511
2512 ## The Parsoid team believes the following three test exposes a
2513 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2514 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2515 !! test
2516 Definition Lists: Mixed Lists: Test 1 (php)
2517 !! options
2518 php
2519 !! input
2520 :;* foo
2521 ::* bar
2522 :; baz
2523 !! result
2524 <dl><dd><dl><dt><ul><li> foo
2525 </li><li> bar
2526 </li></ul>
2527 </dt></dl>
2528 <dl><dt> baz
2529 </dt></dl>
2530 </dd></dl>
2531
2532 !! end
2533 !! test
2534 Definition Lists: Mixed Lists: Test 1 (parsoid)
2535 !! options
2536 parsoid
2537 !! input
2538 :;* foo
2539 ::* bar
2540 :; baz
2541 !! result
2542 <dl><dd><dl><dt><ul><li> foo
2543 </li></ul></dt><dd><ul><li> bar
2544 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2545 !! end
2546
2547 !! test
2548 Definition Lists: Mixed Lists: Test 2
2549 !! input
2550 *: d1
2551 *: d2
2552 !! result
2553 <ul><li><dl><dd> d1
2554 </dd><dd> d2
2555 </dd></dl>
2556 </li></ul>
2557
2558 !! end
2559
2560
2561 !! test
2562 Definition Lists: Mixed Lists: Test 3
2563 !! input
2564 *::: d1
2565 *::: d2
2566 !! result
2567 <ul><li><dl><dd><dl><dd><dl><dd> d1
2568 </dd><dd> d2
2569 </dd></dl>
2570 </dd></dl>
2571 </dd></dl>
2572 </li></ul>
2573
2574 !! end
2575
2576
2577 !! test
2578 Definition Lists: Mixed Lists: Test 4
2579 !! input
2580 *;d1 :d2
2581 *;d3 :d4
2582 !! result
2583 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2584 </dd><dt>d3&#160;</dt><dd>d4
2585 </dd></dl>
2586 </li></ul>
2587
2588 !! end
2589
2590
2591 !! test
2592 Definition Lists: Mixed Lists: Test 5
2593 !! input
2594 *:d1
2595 *:: d2
2596 !! result
2597 <ul><li><dl><dd>d1
2598 <dl><dd> d2
2599 </dd></dl>
2600 </dd></dl>
2601 </li></ul>
2602
2603 !! end
2604
2605
2606 !! test
2607 Definition Lists: Mixed Lists: Test 6
2608 !! input
2609 #*:d1
2610 #*::: d3
2611 !! result
2612 <ol><li><ul><li><dl><dd>d1
2613 <dl><dd><dl><dd> d3
2614 </dd></dl>
2615 </dd></dl>
2616 </dd></dl>
2617 </li></ul>
2618 </li></ol>
2619
2620 !! end
2621
2622
2623 !! test
2624 Definition Lists: Mixed Lists: Test 7
2625 !! input
2626 :* d1
2627 :* d2
2628 !! result
2629 <dl><dd><ul><li> d1
2630 </li><li> d2
2631 </li></ul>
2632 </dd></dl>
2633
2634 !! end
2635
2636
2637 !! test
2638 Definition Lists: Mixed Lists: Test 8
2639 !! input
2640 :* d1
2641 ::* d2
2642 !! result
2643 <dl><dd><ul><li> d1
2644 </li></ul>
2645 <dl><dd><ul><li> d2
2646 </li></ul>
2647 </dd></dl>
2648 </dd></dl>
2649
2650 !! end
2651
2652
2653 !! test
2654 Definition Lists: Mixed Lists: Test 9
2655 !! input
2656 *;foo :bar
2657 !! result
2658 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2659 </dd></dl>
2660 </li></ul>
2661
2662 !! end
2663
2664
2665 !! test
2666 Definition Lists: Mixed Lists: Test 10
2667 !! input
2668 *#;foo :bar
2669 !! result
2670 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2671 </dd></dl>
2672 </li></ol>
2673 </li></ul>
2674
2675 !! end
2676
2677 # The Parsoid team disagrees with the PHP parser's seemingly-random
2678 # rules regarding dd/dt on the next two tests. Parsoid is more
2679 # consistent, and recognizes the shared nesting and keeps the
2680 # still-open tags around until the nesting is complete.
2681
2682 !! test
2683 Definition Lists: Mixed Lists: Test 11 (php)
2684 !! options
2685 php
2686 !! input
2687 *#*#;*;;foo :bar
2688 *#*#;boo :baz
2689 !! result
2690 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2691 </dt></dl>
2692 </dd></dl>
2693 </li></ul>
2694 </dd></dl>
2695 <dl><dt>boo&#160;</dt><dd>baz
2696 </dd></dl>
2697 </li></ol>
2698 </li></ul>
2699 </li></ol>
2700 </li></ul>
2701
2702 !! end
2703 !! test
2704 Definition Lists: Mixed Lists: Test 11 (parsoid)
2705 !! options
2706 parsoid
2707 !! input
2708 *#*#;*;;foo :bar
2709 *#*#;boo :baz
2710 !! result
2711 <ul>
2712 <li>
2713 <ol>
2714 <li>
2715 <ul>
2716 <li>
2717 <ol>
2718 <li>
2719 <dl>
2720 <dt>
2721 <ul>
2722 <li>
2723 <dl>
2724 <dt>
2725 <dl>
2726 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2727 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2728 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2729 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2730 !! end
2731
2732
2733 !! test
2734 Definition Lists: Weird Ones: Test 1 (php)
2735 !! options
2736 php
2737 !! input
2738 *#;*::;; foo : bar (who uses this?)
2739 !! result
2740 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2741 </dt></dl>
2742 </dd></dl>
2743 </dd></dl>
2744 </dd></dl>
2745 </li></ul>
2746 </dd></dl>
2747 </li></ol>
2748 </li></ul>
2749
2750 !! end
2751 !! test
2752 Definition Lists: Weird Ones: Test 1 (parsoid)
2753 !! options
2754 parsoid
2755 !! input
2756 *#;*::;; foo : bar (who uses this?)
2757 !! result
2758 <ul>
2759 <li>
2760 <ol>
2761 <li>
2762 <dl>
2763 <dt>
2764 <ul>
2765 <li>
2766 <dl>
2767 <dd>
2768 <dl>
2769 <dd>
2770 <dl>
2771 <dt>
2772 <dl>
2773 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2774 <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>
2775 !! end
2776
2777 ###
2778 ### External links
2779 ###
2780 !! test
2781 External links: non-bracketed
2782 !! input
2783 Non-bracketed: http://example.com
2784 !! result
2785 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2786 </p>
2787 !! end
2788
2789 !! test
2790 External links: numbered
2791 !! input
2792 Numbered: [http://example.com]
2793 Numbered: [http://example.net]
2794 Numbered: [http://example.com]
2795 !! result
2796 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2797 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2798 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2799 </p>
2800 !!end
2801
2802 !! test
2803 External links: specified text
2804 !! input
2805 Specified text: [http://example.com link]
2806 !! result
2807 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2808 </p>
2809 !!end
2810
2811 !! test
2812 External links: trail
2813 !! input
2814 Linktrails should not work for external links: [http://example.com link]s
2815 !! result
2816 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2817 </p>
2818 !! end
2819
2820 !! test
2821 External links: dollar sign in URL
2822 !! input
2823 http://example.com/1$2345
2824 !! result
2825 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2826 </p>
2827 !! end
2828
2829 !! test
2830 External links: dollar sign in URL (named)
2831 !! input
2832 [http://example.com/1$2345]
2833 !! result
2834 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2835 </p>
2836 !!end
2837
2838 !! test
2839 External links: open square bracket forbidden in URL (bug 4377)
2840 !! input
2841 http://example.com/1[2345
2842 !! result
2843 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2844 </p>
2845 !! end
2846
2847 !! test
2848 External links: open square bracket forbidden in URL (named) (bug 4377)
2849 !! input
2850 [http://example.com/1[2345]
2851 !! result
2852 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2853 </p>
2854 !!end
2855
2856 !! test
2857 External links: nowiki in URL link text (bug 6230)
2858 !!input
2859 [http://example.com/ <nowiki>''example site''</nowiki>]
2860 !! result
2861 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2862 </p>
2863 !! end
2864
2865 !! test
2866 External links: newline forbidden in text (bug 6230 regression check)
2867 !! input
2868 [http://example.com/ first
2869 second]
2870 !! result
2871 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2872 second]
2873 </p>
2874 !!end
2875
2876 !! test
2877 External links: Pipe char between url and text
2878 !! input
2879 [http://example.com | link]
2880 !! result
2881 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2882 </p>
2883 !!end
2884
2885 !! test
2886 External links: protocol-relative URL in brackets
2887 !! input
2888 [//example.com/ Test]
2889 !! result
2890 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2891 </p>
2892 !! end
2893
2894 !! test
2895 External links: protocol-relative URL in brackets without text
2896 !! input
2897 [//example.com]
2898 !! result
2899 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2900 </p>
2901 !! end
2902
2903 !! test
2904 External links: protocol-relative URL in free text is left alone
2905 !! input
2906 //example.com/Foo
2907 !! result
2908 <p>//example.com/Foo
2909 </p>
2910 !!end
2911
2912 !! test
2913 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2914 !! input
2915 foo//example.com/Foo
2916 !! result
2917 <p>foo//example.com/Foo
2918 </p>
2919 !! end
2920
2921 !! test
2922 External image
2923 !! input
2924 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2925 !! result
2926 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2927 </p>
2928 !! end
2929
2930 !! test
2931 External image from https
2932 !! input
2933 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2934 !! result
2935 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2936 </p>
2937 !! end
2938
2939 !! test
2940 External image (when not allowed)
2941 !! options
2942 wgAllowExternalImages=0
2943 !! input
2944 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2945 !! result
2946 <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>
2947 </p>
2948 !! end
2949
2950 !! test
2951 Link to non-http image, no img tag
2952 !! input
2953 Link to non-http image, no img tag: ftp://example.com/test.jpg
2954 !! result
2955 <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>
2956 </p>
2957 !! end
2958
2959 !! test
2960 External links: terminating separator
2961 !! input
2962 Terminating separator: http://example.com/thing,
2963 !! result
2964 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2965 </p>
2966 !! end
2967
2968 !! test
2969 External links: intervening separator
2970 !! input
2971 Intervening separator: http://example.com/1,2,3
2972 !! result
2973 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2974 </p>
2975 !! end
2976
2977 !! test
2978 External links: old bug with URL in query
2979 !! input
2980 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2981 !! result
2982 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2983 </p>
2984 !! end
2985
2986 !! test
2987 External links: old URL-in-URL bug, mixed protocols
2988 !! input
2989 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2990 !! result
2991 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2992 </p>
2993 !!end
2994
2995 !! test
2996 External links: URL in text
2997 !! input
2998 URL in text: [http://example.com http://example.com]
2999 !! result
3000 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3001 </p>
3002 !! end
3003
3004 !! test
3005 External links: Clickable images
3006 !! input
3007 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3008 !! result
3009 <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>
3010 </p>
3011 !!end
3012
3013 !! test
3014 External links: raw ampersand
3015 !! input
3016 Old &amp; use: http://x&y
3017 !! result
3018 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3019 </p>
3020 !! end
3021
3022 !! test
3023 External links: encoded ampersand
3024 !! input
3025 Old &amp; use: http://x&amp;y
3026 !! result
3027 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3028 </p>
3029 !! end
3030
3031 !! test
3032 External links: encoded equals (bug 6102)
3033 !! input
3034 http://example.com/?foo&#61;bar
3035 !! result
3036 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3037 </p>
3038 !! end
3039
3040 !! test
3041 External links: [raw ampersand]
3042 !! input
3043 Old &amp; use: [http://x&y]
3044 !! result
3045 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3046 </p>
3047 !! end
3048
3049 !! test
3050 External links: [encoded ampersand]
3051 !! input
3052 Old &amp; use: [http://x&amp;y]
3053 !! result
3054 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3055 </p>
3056 !! end
3057
3058 !! test
3059 External links: [encoded equals] (bug 6102)
3060 !! input
3061 [http://example.com/?foo&#61;bar]
3062 !! result
3063 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3064 </p>
3065 !! end
3066
3067 !! test
3068 External links: [IDN ignored character reference in hostname; strip it right off]
3069 !! input
3070 [http://e&zwnj;xample.com/]
3071 !! result
3072 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3073 </p>
3074 !! end
3075
3076 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3077 # Where an external link could easily circumvent the sanitization of the text of
3078 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3079 # test demands a higher standard. That's a bit strange.
3080 #
3081 # Example:
3082 #
3083 # http://e‌xample.com -> [http://example.com|http://example.com]
3084 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3085 #
3086 # The first example is sanitized, but the second is not. Any security benefits
3087 # from this production are trivial to circumvent. Either remove this test and
3088 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3089 # the test accordingly.
3090 #
3091 # All our love,
3092 # The Parsoid team.
3093 !! test
3094 External links: IDN ignored character reference in hostname; strip it right off
3095 !! input
3096 http://e&zwnj;xample.com/
3097 !! result
3098 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3099 </p>
3100 !! end
3101
3102 !! test
3103 External links: www.jpeg.org (bug 554)
3104 !! input
3105 http://www.jpeg.org
3106 !!result
3107 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3108 </p>
3109 !! end
3110
3111 !! test
3112 External links: URL within URL (original bug 2)
3113 !! input
3114 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3115 !! result
3116 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3117 </p>
3118 !! end
3119
3120 !! test
3121 BUG 361: URL inside bracketed URL
3122 !! input
3123 [http://www.example.com/foo http://www.example.com/bar]
3124 !! result
3125 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3126 </p>
3127 !! end
3128
3129 !! test
3130 BUG 361: URL within URL, not bracketed
3131 !! input
3132 http://www.example.com/foo?=http://www.example.com/bar
3133 !! result
3134 <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>
3135 </p>
3136 !! end
3137
3138 !! test
3139 BUG 289: ">"-token in URL-tail
3140 !! input
3141 http://www.example.com/<hello>
3142 !! result
3143 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3144 </p>
3145 !!end
3146
3147 !! test
3148 BUG 289: literal ">"-token in URL-tail
3149 !! input
3150 http://www.example.com/<b>html</b>
3151 !! result
3152 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3153 </p>
3154 !!end
3155
3156 !! test
3157 BUG 289: ">"-token in bracketed URL
3158 !! input
3159 [http://www.example.com/<hello> stuff]
3160 !! result
3161 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3162 </p>
3163 !!end
3164
3165 !! test
3166 BUG 289: literal ">"-token in bracketed URL
3167 !! input
3168 [http://www.example.com/<b>html</b> stuff]
3169 !! result
3170 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3171 </p>
3172 !!end
3173
3174 !! test
3175 BUG 289: literal double quote at end of URL
3176 !! input
3177 http://www.example.com/"hello"
3178 !! result
3179 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3180 </p>
3181 !!end
3182
3183 !! test
3184 BUG 289: literal double quote in bracketed URL
3185 !! input
3186 [http://www.example.com/"hello" stuff]
3187 !! result
3188 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3189 </p>
3190 !!end
3191
3192 !! test
3193 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3194 !! input
3195 [http://www.example.com test]
3196 !! result
3197 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3198 </p>
3199 !! end
3200
3201 !! test
3202 External links: link text with spaces
3203 !! input
3204 [http://www.example.com a b c]
3205 [http://www.example.com ''a'' ''b'']
3206 !! result
3207 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3208 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3209 </p>
3210 !! end
3211
3212 !! test
3213 External links: wiki links within external link (Bug 3695)
3214 !! input
3215 [http://example.com [[wikilink]] embedded in ext link]
3216 !! result
3217 <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>
3218 </p>
3219 !! end
3220
3221 !! test
3222 BUG 787: Links with one slash after the url protocol are invalid
3223 !! input
3224 http:/example.com
3225
3226 [http:/example.com title]
3227 !! result
3228 <p>http:/example.com
3229 </p><p>[http:/example.com title]
3230 </p>
3231 !! end
3232
3233 !! test
3234 Bracketed external links with template-generated invalid target
3235 !! input
3236 [{{echo|http:/example.com}} title]
3237 !! result
3238 <p>[http:/example.com title]
3239 </p>
3240 !! end
3241
3242 !! test
3243 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3244 !! input
3245 ''[http://example.com text'']
3246 [http://example.com '''text]'''
3247 ''Something [http://example.com in italic'']
3248 ''Something [http://example.com mixed''''', even bold]'''
3249 '''''Now [http://example.com both''''']
3250 !! result
3251 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3252 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3253 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3254 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3255 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3256 </p>
3257 !! end
3258
3259
3260 !! test
3261 Bug 4781: %26 in URL
3262 !! input
3263 http://www.example.com/?title=AT%26T
3264 !! result
3265 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3266 </p>
3267 !! end
3268
3269 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3270 # % is actually legal in HTML5. Any change in output would need testing though.
3271 !! test
3272 Bug 4781, 5267: %25 in URL
3273 !! input
3274 http://www.example.com/?title=100%25_Bran
3275 !! result
3276 <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>
3277 </p>
3278 !! end
3279
3280 !! test
3281 Bug 4781, 5267: %28, %29 in URL
3282 !! input
3283 http://www.example.com/?title=Ben-Hur_%281959_film%29
3284 !! result
3285 <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>
3286 </p>
3287 !! end
3288
3289
3290 !! test
3291 Bug 4781: %26 in autonumber URL
3292 !! input
3293 [http://www.example.com/?title=AT%26T]
3294 !! result
3295 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3296 </p>
3297 !! end
3298
3299 !! test
3300 Bug 4781, 5267: %26 in autonumber URL
3301 !! input
3302 [http://www.example.com/?title=100%25_Bran]
3303 !! result
3304 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3305 </p>
3306 !! end
3307
3308 !! test
3309 Bug 4781, 5267: %28, %29 in autonumber URL
3310 !! input
3311 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3312 !! result
3313 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3314 </p>
3315 !! end
3316
3317
3318 !! test
3319 Bug 4781: %26 in bracketed URL
3320 !! input
3321 [http://www.example.com/?title=AT%26T link]
3322 !! result
3323 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3324 </p>
3325 !! end
3326
3327 !! test
3328 Bug 4781, 5267: %26 in bracketed URL
3329 !! input
3330 [http://www.example.com/?title=100%25_Bran link]
3331 !! result
3332 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3333 </p>
3334 !! end
3335
3336 !! test
3337 Bug 4781, 5267: %28, %29 in bracketed URL
3338 !! input
3339 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3340 !! result
3341 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3342 </p>
3343 !! end
3344
3345 !! test
3346 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3347 !! input
3348 Some [http://example.com/ pretty ''italics'' and stuff]!
3349 !! result
3350 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3351 </p>
3352 !! end
3353
3354 !! test
3355 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3356 !! input
3357 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3358 !! result
3359 <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>
3360 </p>
3361 !! end
3362
3363 !! test
3364 External link containing double-single-quotes with no space separating the url from text in italics
3365 !! input
3366 [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]].]
3367 !! result
3368 <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>
3369 </p>
3370 !! end
3371
3372 !! test
3373 External link with comments in link text
3374 !! input
3375 [http://www.google.com Google <!-- comment -->]
3376 !! result
3377 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3378 </p>
3379 !! end
3380
3381 !! test
3382 URL-encoding in URL functions (single parameter)
3383 !! input
3384 {{localurl:Some page|amp=&}}
3385 !! result
3386 <p>/index.php?title=Some_page&amp;amp=&amp;
3387 </p>
3388 !! end
3389
3390 !! test
3391 URL-encoding in URL functions (multiple parameters)
3392 !! input
3393 {{localurl:Some page|q=?&amp=&}}
3394 !! result
3395 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3396 </p>
3397 !! end
3398
3399 !! test
3400 Brackets in urls
3401 !! input
3402 http://example.com/index.php?foozoid%5B%5D=bar
3403
3404 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3405 !! result
3406 <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>
3407 </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>
3408 </p>
3409 !! end
3410
3411 !! test
3412 IPv6 urls (bug 21261)
3413 !! options
3414 disabled
3415 !! input
3416 http://[2404:130:0:1000::187:2]/index.php
3417 !! result
3418 <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>
3419 </p>
3420 !! end
3421
3422 !! test
3423 Non-extlinks in brackets
3424 !! input
3425 [foo]
3426 [foo bar]
3427 [foo ''bar'']
3428 [fool's] errand
3429 [fool's errand]
3430 [{{echo|foo}}]
3431 [{{echo|foo}} bar]
3432 [{{echo|foo}} ''bar'']
3433 [{{echo|foo}}l's] errand
3434 [{{echo|foo}}l's errand]
3435 [url={{echo|foo}}]
3436 [url=http://example.com]
3437 !! result
3438 <p>[foo]
3439 [foo bar]
3440 [foo <i>bar</i>]
3441 [fool's] errand
3442 [fool's errand]
3443 [foo]
3444 [foo bar]
3445 [foo <i>bar</i>]
3446 [fool's] errand
3447 [fool's errand]
3448 [url=foo]
3449 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3450 </p>
3451 !! end
3452
3453 !! test
3454 Parsoid: Percent encoding in external links
3455 !! options
3456 parsoid
3457 !! input
3458 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3459 !! result
3460 <p><a rel="mw:ExtLink"
3461 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3462 !! end
3463
3464 !! test
3465 Parsoid: use url link syntax for links where the content is equal the link
3466 target
3467 !! options
3468 parsoid
3469 !! input
3470 http://example.com
3471 !! result
3472 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3473 !! end
3474
3475 ###
3476 ### Quotes
3477 ###
3478
3479 !! test
3480 Quotes
3481 !! input
3482 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3483
3484 Normal text. '''''Bold italic text.''''' Normal text.
3485 !!result
3486 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3487 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3488 </p>
3489 !! end
3490
3491
3492 !! test
3493 Unclosed and unmatched quotes (php)
3494 !! options
3495 php
3496 !! input
3497 '''''Bold italic text '''with bold deactivated''' in between.'''''
3498
3499 '''''Bold italic text ''with italic deactivated'' in between.'''''
3500
3501 '''Bold text..
3502
3503 ..spanning two paragraphs (should not work).'''
3504
3505 '''Bold tag left open
3506
3507 ''Italic tag left open
3508
3509 Normal text.
3510
3511 <!-- Unmatching number of opening, closing tags: -->
3512 '''This year''''s election ''should'' beat '''last year''''s.
3513
3514 ''Tom'''s car is bigger than ''Susan'''s.
3515
3516 Plain ''italic'''s plain
3517 !! result
3518 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3519 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3520 </p><p><b>Bold text..</b>
3521 </p><p>..spanning two paragraphs (should not work).
3522 </p><p><b>Bold tag left open</b>
3523 </p><p><i>Italic tag left open</i>
3524 </p><p>Normal text.
3525 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3526 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3527 </p><p>Plain <i>italic'</i>s plain
3528 </p>
3529 !! end
3530 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3531 # parser strips. The wikitext contains just the first half of the bold
3532 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3533 # differently than the PHP parser.)
3534 !! test
3535 Unclosed and unmatched quotes (parsoid)
3536 !! options
3537 parsoid
3538 !! input
3539 '''''Bold italic text '''with bold deactivated''' in between.'''''
3540
3541 '''''Bold italic text ''with italic deactivated'' in between.'''''
3542
3543 '''Bold text..
3544
3545 ..spanning two paragraphs (should not work).'''
3546
3547 '''Bold tag left open
3548
3549 ''Italic tag left open
3550
3551 Normal text.
3552
3553 <!-- Unmatching number of opening, closing tags: -->
3554 '''This year''''s election ''should'' beat '''last year''''s.
3555
3556 ''Tom'''s car is bigger than ''Susan'''s.
3557
3558 Plain ''italic'''s plain
3559 !! result
3560 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3561 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3562 </p><p><b>Bold text..</b>
3563 </p><p>..spanning two paragraphs (should not work).<b></b>
3564 </p><p><b>Bold tag left open</b>
3565 </p><p><i>Italic tag left open</i>
3566 </p><p>Normal text.
3567 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3568 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3569 </p><p>Plain <i>italic'</i>s plain
3570 </p>
3571 !! end
3572
3573 ###
3574 ### Tables
3575 ###
3576 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3577 ###
3578
3579 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3580 # is the bare minimum required by the spec, see:
3581 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3582 !! test
3583 A table with no data. (php)
3584 !! options
3585 php
3586 !! input
3587 {||}
3588 !! result
3589 !! end
3590 # Parsoid team replies: empty table tags are legal in HTML5
3591 !! test
3592 A table with no data. (parsoid)
3593 !! options
3594 parsoid
3595 !! input
3596 {||}
3597 !! result
3598 <table></table>
3599 !! end
3600
3601 # A table with nothing but a caption is invalid XHTML, we might want to render
3602 # this as <p>caption</p>
3603 !! test
3604 A table with nothing but a caption (php)
3605 !! options
3606 php
3607 !! input
3608 {|
3609 |+ caption
3610 |}
3611 !! result
3612 <table>
3613 <caption> caption
3614 </caption><tr><td></td></tr></table>
3615
3616 !! end
3617 # Parsoid team replies: table with only a caption is legal in HTML5
3618 !! test
3619 A table with nothing but a caption (parsoid)
3620 !! options
3621 parsoid
3622 !! input
3623 {|
3624 |+ caption
3625 |}
3626 !! result
3627 <table><caption> caption</caption></table>
3628 !! end
3629
3630 !! test
3631 A table with caption with default-spaced attributes and a table row
3632 !! input
3633 {|
3634 |+ style="color: red;" | caption1
3635 |-
3636 | foo
3637 |}
3638 !! result
3639 <table>
3640 <caption style="color: red;"> caption1
3641 </caption>
3642 <tr>
3643 <td> foo
3644 </td></tr></table>
3645
3646 !! end
3647
3648 !! test
3649 A table with captions with non-default spaced attributes and a table row
3650 !! input
3651 {|
3652 |+style="color: red;"|caption2
3653 |+ style="color: red;"| caption3
3654 |-
3655 | foo
3656 |}
3657 !! result
3658 <table>
3659 <caption style="color: red;">caption2
3660 </caption>
3661 <caption style="color: red;"> caption3
3662 </caption>
3663 <tr>
3664 <td> foo
3665 </td></tr></table>
3666
3667 !! end
3668
3669 !! test
3670 Table td-cell syntax variations
3671 !! input
3672 {|
3673 | foo bar foo | baz
3674 | foo bar foo || baz
3675 | style='color:red;' | baz
3676 | style='color:red;' || baz
3677 |}
3678 !! result
3679 <table>
3680 <tr>
3681 <td> baz
3682 </td>
3683 <td> foo bar foo </td>
3684 <td> baz
3685 </td>
3686 <td style="color:red;"> baz
3687 </td>
3688 <td> style='color:red;' </td>
3689 <td> baz
3690 </td></tr></table>
3691
3692 !! end
3693
3694 !! test
3695 Simple table
3696 !! input
3697 {|
3698 | 1 || 2
3699 |-
3700 | 3 || 4
3701 |}
3702 !! result
3703 <table>
3704 <tr>
3705 <td> 1 </td>
3706 <td> 2
3707 </td></tr>
3708 <tr>
3709 <td> 3 </td>
3710 <td> 4
3711 </td></tr></table>
3712
3713 !! end
3714
3715 !! test
3716 Simple table but with multiple dashes for row wikitext
3717 !! input
3718 {|
3719 | foo
3720 |-----
3721 | bar
3722 |}
3723 !! result
3724 <table>
3725 <tr>
3726 <td> foo
3727 </td></tr>
3728 <tr>
3729 <td> bar
3730 </td></tr></table>
3731
3732 !! end
3733 !! test
3734 Multiplication table
3735 !! input
3736 {| border="1" cellpadding="2"
3737 |+Multiplication table
3738 |-
3739 ! &times; !! 1 !! 2 !! 3
3740 |-
3741 ! 1
3742 | 1 || 2 || 3
3743 |-
3744 ! 2
3745 | 2 || 4 || 6
3746 |-
3747 ! 3
3748 | 3 || 6 || 9
3749 |-
3750 ! 4
3751 | 4 || 8 || 12
3752 |-
3753 ! 5
3754 | 5 || 10 || 15
3755 |}
3756 !! result
3757 <table border="1" cellpadding="2">
3758 <caption>Multiplication table
3759 </caption>
3760 <tr>
3761 <th> &#215; </th>
3762 <th> 1 </th>
3763 <th> 2 </th>
3764 <th> 3
3765 </th></tr>
3766 <tr>
3767 <th> 1
3768 </th>
3769 <td> 1 </td>
3770 <td> 2 </td>
3771 <td> 3
3772 </td></tr>
3773 <tr>
3774 <th> 2
3775 </th>
3776 <td> 2 </td>
3777 <td> 4 </td>
3778 <td> 6
3779 </td></tr>
3780 <tr>
3781 <th> 3
3782 </th>
3783 <td> 3 </td>
3784 <td> 6 </td>
3785 <td> 9
3786 </td></tr>
3787 <tr>
3788 <th> 4
3789 </th>
3790 <td> 4 </td>
3791 <td> 8 </td>
3792 <td> 12
3793 </td></tr>
3794 <tr>
3795 <th> 5
3796 </th>
3797 <td> 5 </td>
3798 <td> 10 </td>
3799 <td> 15
3800 </td></tr></table>
3801
3802 !! end
3803
3804 !! test
3805 Accept "||" in table headings
3806 !! input
3807 {|
3808 !h1 || h2
3809 |}
3810 !! result
3811 <table>
3812 <tr>
3813 <th>h1 </th>
3814 <th> h2
3815 </th></tr></table>
3816
3817 !! end
3818
3819 !! test
3820 Accept "||" in indented table headings
3821 !! input
3822 :{|
3823 !h1 || h2
3824 |}
3825 !! result
3826 <dl><dd><table>
3827 <tr>
3828 <th>h1 </th>
3829 <th> h2
3830 </th></tr></table></dd></dl>
3831
3832 !! end
3833
3834 !! test
3835 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3836 !! input
3837 {|
3838 !| h1
3839 || a
3840 |}
3841 !! result
3842 <table>
3843 <tr>
3844 <th> h1
3845 </th>
3846 <td> a
3847 </td></tr></table>
3848
3849 !! end
3850
3851 !!test
3852 Accept "| !" at start of line in tables (ignore !-attribute)
3853 !!input
3854 {|
3855 |-
3856 | !style="color:red" | bar
3857 |}
3858 !!result
3859 <table>
3860
3861 <tr>
3862 <td> bar
3863 </td></tr></table>
3864
3865 !!end
3866
3867 !!test
3868 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 +/-
3869 !!input
3870 {|
3871 |-
3872 |style='color:red;'|+1
3873 |style='color:blue;'|-1
3874 |-
3875 | 1 || 2 || 3
3876 | 1 ||+2 ||-3
3877 |-
3878 | +1
3879 | -1
3880 |}
3881 !!result
3882 <table>
3883
3884 <tr>
3885 <td style="color:red;">+1
3886 </td>
3887 <td style="color:blue;">-1
3888 </td></tr>
3889 <tr>
3890 <td> 1 </td>
3891 <td> 2 </td>
3892 <td> 3
3893 </td>
3894 <td> 1 </td>
3895 <td>+2 </td>
3896 <td>-3
3897 </td></tr>
3898 <tr>
3899 <td> +1
3900 </td>
3901 <td> -1
3902 </td></tr></table>
3903
3904 !!end
3905
3906 !! test
3907 Table rowspan
3908 !! input
3909 {| border=1
3910 | Cell 1, row 1
3911 |rowspan=2| Cell 2, row 1 (and 2)
3912 | Cell 3, row 1
3913 |-
3914 | Cell 1, row 2
3915 | Cell 3, row 2
3916 |}
3917 !! result
3918 <table border="1">
3919 <tr>
3920 <td> Cell 1, row 1
3921 </td>
3922 <td rowspan="2"> Cell 2, row 1 (and 2)
3923 </td>
3924 <td> Cell 3, row 1
3925 </td></tr>
3926 <tr>
3927 <td> Cell 1, row 2
3928 </td>
3929 <td> Cell 3, row 2
3930 </td></tr></table>
3931
3932 !! end
3933
3934 !! test
3935 Nested table
3936 !! input
3937 {| border=1
3938 | &alpha;
3939 |
3940 {| bgcolor=#ABCDEF border=2
3941 |nested
3942 |-
3943 |table
3944 |}
3945 |the original table again
3946 |}
3947 !! result
3948 <table border="1">
3949 <tr>
3950 <td> &#945;
3951 </td>
3952 <td>
3953 <table bgcolor="#ABCDEF" border="2">
3954 <tr>
3955 <td>nested
3956 </td></tr>
3957 <tr>
3958 <td>table
3959 </td></tr></table>
3960 </td>
3961 <td>the original table again
3962 </td></tr></table>
3963
3964 !! end
3965
3966 !! test
3967 Invalid attributes in table cell (bug 1830)
3968 !! input
3969 {|
3970 |Cell:|broken
3971 |}
3972 !! result
3973 <table>
3974 <tr>
3975 <td>broken
3976 </td></tr></table>
3977
3978 !! end
3979
3980
3981 !! test
3982 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3983 !! input
3984 {|
3985 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3986 !! result
3987 <table>
3988 <tr>
3989 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3990 <td>]" onmouseover="alert(document.cookie)"&gt;test
3991 </td>
3992 </tr>
3993 </table>
3994
3995 !! end
3996
3997
3998 !! test
3999 Indented table markup mixed with indented pre content (proposed in bug 6200)
4000 !! input
4001 <table>
4002 <tr>
4003 <td>
4004 Text that should be rendered preformatted
4005 </td>
4006 </tr>
4007 </table>
4008 !! result
4009 <table>
4010 <tr>
4011 <td>
4012 <pre>Text that should be rendered preformatted
4013 </pre>
4014 </td>
4015 </tr>
4016 </table>
4017
4018 !! end
4019
4020 !! test
4021 Template-generated table cell attributes and cell content
4022 !! input
4023 {|
4024 |{{table_attribs}}
4025 |}
4026 !! result
4027 <table>
4028 <tr>
4029 <td style="color: red"> Foo
4030 </td></tr></table>
4031
4032 !! end
4033
4034 !! test
4035 Template-generated table cell attributes and cell content (2)
4036 !! input
4037 {|
4038 |align=center {{table_attribs}}
4039 |}
4040 !! result
4041 <table>
4042 <tr>
4043 <td align="center" style="color: red"> Foo
4044 </td></tr></table>
4045
4046 !! end
4047
4048 !! test
4049 Template-generated table cell attributes and cell content (3)
4050 !! input
4051 {|
4052 |align=center {{table_cells}}
4053 |}
4054 !! result
4055 <table>
4056 <tr>
4057 <td align="center" style="color: red"> Foo </td>
4058 <td> Bar </td>
4059 <td> Baz
4060 </td></tr></table>
4061
4062 !! end
4063
4064 !! test
4065 Table with row followed by newlines and table heading
4066 !! input
4067 {|
4068 |-
4069
4070 ! foo
4071 |}
4072 !! result
4073 <table>
4074
4075
4076 <tr>
4077 <th> foo
4078 </th></tr></table>
4079
4080 !! end
4081
4082 !! test
4083 Table with empty line following the start tag
4084 !! input
4085 {|
4086
4087 |-
4088 | foo
4089 |}
4090 !! result
4091 <table>
4092
4093
4094 <tr>
4095 <td> foo
4096 </td></tr></table>
4097
4098 !! end
4099
4100 # FIXME: Preserve the attribute properly (with an empty string as value) in
4101 # the PHP parser. Parsoid implements the behavior below.
4102 !! test
4103 Table attributes with empty value
4104 !! options
4105 parsoid
4106 !! input
4107 {|
4108 | style=| hello
4109 |}
4110 !! result
4111 <table>
4112 <tbody>
4113 <tr>
4114 <td style=""> hello
4115 </td></tr></tbody></table>
4116
4117 !! end
4118
4119 !! test
4120 Wikitext table with a lot of comments
4121 !! input
4122 {|
4123 <!-- c0 -->
4124 | foo
4125 <!-- c1 -->
4126 |- <!-- c2 -->
4127 <!-- c3 -->
4128 |<!-- c4 -->
4129 <!-- c5 -->
4130 |}
4131 !! result
4132 <table>
4133 <tr>
4134 <td> foo
4135 </td></tr>
4136 <tr>
4137 <td>
4138 </td></tr></table>
4139
4140 !! end
4141
4142 !! test
4143 Wikitext table with double-line table cell
4144 !! input
4145 {|
4146 |a
4147 b
4148 |}
4149 !! result
4150 <table>
4151 <tr>
4152 <td>a
4153 <p>b
4154 </p>
4155 </td></tr></table>
4156
4157 !! end
4158
4159 !! test
4160 Table cell with a single comment
4161 !! input
4162 {|
4163 | <!-- c1 -->
4164 | a
4165 |}
4166 !! result
4167 <table>
4168 <tr>
4169 <td>
4170 </td>
4171 <td> a
4172 </td></tr></table>
4173
4174 !! end
4175
4176 # The expected HTML structure in this test is debatable. The PHP parser does
4177 # not parse this kind of table at all. The main focus for Parsoid is on
4178 # round-tripping, so this output is ok for now. TODO: revisit!
4179 !! test
4180 Wikitext table with html-syntax row (Parsoid)
4181 !! options
4182 parsoid
4183 !! input
4184 {|
4185 |-
4186 <td>foo</td>
4187 |}
4188 !! result
4189 <table>
4190 <tbody>
4191 <tr>
4192 <td>foo</td></tr></tbody></table>
4193 !! end
4194
4195 !! test
4196 Implicit <td> after a |-
4197 (PHP parser relies on Tidy to add the missing <td> tags)
4198 !! options
4199 parsoid=wt2html,wt2wt
4200 !! input
4201 {|
4202 |-
4203 a
4204 |}
4205 !! result
4206 <table>
4207 <tr><td>a</td></tr>
4208 </table>
4209 !! end
4210
4211 !! test
4212 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4213 (PHP parser relies on Tidy to add the missing <td> tags)
4214 !! options
4215 parsoid=wt2html,wt2wt
4216 !! input
4217 {|
4218 |-
4219 |
4220 a
4221 |-
4222 b
4223 |}
4224 !! result
4225 <table>
4226 <tbody>
4227 <tr><td><pre>a</pre></td></tr>
4228 <tr><td> b</td></tr>
4229 </tbody>
4230 </table>
4231 !! end
4232
4233 !! test
4234 Lists should be recognized in an implicit <td> context
4235 (PHP parser relies on Tidy to add the missing <td> tags)
4236 !! options
4237 parsoid=wt2html,wt2wt
4238 !! input
4239 {|
4240 |-
4241 *a
4242 |}
4243 !! result
4244 <table>
4245 <tr>
4246 <td><ul><li>a</li></ul></td>
4247 </tr>
4248 </table>
4249 !! end
4250
4251 ###
4252 ### Internal links
4253 ###
4254 !! test
4255 Plain link, capitalized
4256 !! input
4257 [[Main Page]]
4258 !! result
4259 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4260 </p>
4261 !! end
4262
4263 !! test
4264 Plain link, uncapitalized
4265 !! input
4266 [[main Page]]
4267 !! result
4268 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4269 </p>
4270 !! end
4271
4272 !! test
4273 Piped link
4274 !! input
4275 [[Main Page|The Main Page]]
4276 !! result
4277 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4278 </p>
4279 !! end
4280
4281 !! test
4282 Piped link with comment in link text
4283 !! input
4284 [[Main Page|The Main<!--front--> Page]]
4285 !! result
4286 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4287 </p>
4288 !! end
4289
4290 !! test
4291 Broken link
4292 !! input
4293 [[Zigzagzogzagzig]]
4294 !! result
4295 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4296 </p>
4297 !! end
4298
4299 !! test
4300 Broken link with fragment
4301 !! input
4302 [[Zigzagzogzagzig#zug]]
4303 !! result
4304 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4305 </p>
4306 !! end
4307
4308 !! test
4309 Special page link with fragment
4310 !! input
4311 [[Special:Version#anchor]]
4312 !! result
4313 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4314 </p>
4315 !! end
4316
4317 !! test
4318 Nonexistent special page link with fragment
4319 !! input
4320 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4321 !! result
4322 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4323 </p>
4324 !! end
4325
4326 !! test
4327 Link with prefix
4328 !! input
4329 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4330 !! result
4331 <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>
4332 </p>
4333 !! end
4334
4335 !! test
4336 Link with suffix
4337 !! input
4338 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4339 !! result
4340 <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>!!!
4341 </p>
4342 !! end
4343
4344 !! article
4345 prefixed article
4346 !! text
4347 Some text
4348 !! endarticle
4349
4350 !! test
4351 Bug 43661: Piped links with identical prefixes
4352 !! input
4353 [[prefixed article|prefixed articles with spaces]]
4354
4355 [[prefixed article|prefixed articlesaoeu]]
4356
4357 [[Main Page|Main Page test]]
4358 !! result
4359 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4360 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4361 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4362 </p>
4363 !! end
4364
4365
4366 !! test
4367 Link with HTML entity in suffix / tail
4368 !! input
4369 [[Main Page]]&quot;, [[Main Page]]&#97;
4370 !! result
4371 <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;
4372 </p>
4373 !! end
4374
4375 !! test
4376 Link with 3 brackets
4377 !! input
4378 [[[main page]]]
4379 !! result
4380 <p>[[[main page]]]
4381 </p>
4382 !! end
4383
4384 !! test
4385 Piped link with 3 brackets
4386 !! input
4387 [[[main page|the main page]]]
4388 !! result
4389 <p>[[[main page|the main page]]]
4390 </p>
4391 !! end
4392
4393 !! test
4394 Link with multiple pipes
4395 !! input
4396 [[Main Page|The|Main|Page]]
4397 !! result
4398 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4399 </p>
4400 !! end
4401
4402 !! test
4403 Link to namespaces
4404 !! input
4405 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4406 !! result
4407 <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>
4408 </p>
4409 !! end
4410
4411 !! test
4412 Piped link to namespace
4413 !! input
4414 [[Meta:Disclaimers|The disclaimers]]
4415 !! result
4416 <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>
4417 </p>
4418 !! end
4419
4420 !! test
4421 Link containing }
4422 !! input
4423 [[Usually caused by a typo (oops}]]
4424 !! result
4425 <p>[[Usually caused by a typo (oops}]]
4426 </p>
4427 !! end
4428
4429 !! test
4430 Link containing % (not as a hex sequence)
4431 !! input
4432 [[7% Solution]]
4433 !! result
4434 <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>
4435 </p>
4436 !! end
4437
4438 !! test
4439 Link containing % as a single hex sequence interpreted to char
4440 !! input
4441 [[7%25 Solution]]
4442 !! result
4443 <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>
4444 </p>
4445 !!end
4446
4447 !! test
4448 Link containing % as a double hex sequence interpreted to hex sequence
4449 !! input
4450 [[7%2525 Solution]]
4451 !! result
4452 <p>[[7%2525 Solution]]
4453 </p>
4454 !!end
4455
4456 !! test
4457 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4458 Example for such a section: == < ==
4459 !! input
4460 [[%23%3c]][[%23%3e]]
4461 !! result
4462 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4463 </p>
4464 !! end
4465
4466 !! test
4467 Link containing "<#" and ">#" as a hex sequences
4468 !! input
4469 [[%3c%23]][[%3e%23]]
4470 !! result
4471 <p>[[%3c%23]][[%3e%23]]
4472 </p>
4473 !! end
4474
4475 !! test
4476 Link containing an equals sign
4477 !! input
4478 [[Special:BookSources/isbn=4-00-026157-6]]
4479 !! result
4480 <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>
4481 </p>
4482 !! end
4483
4484 !! article
4485 Foo~bar
4486 !! text
4487 Just a test of an article title containing a tilde.
4488 !! endarticle
4489
4490 # note that links containing signatures, like [[Foo~~~~]], are
4491 # massaged by the pre-save transform (PST) and so the tildes are never
4492 # seen by the parser.
4493 !! test
4494 Link containing a tilde
4495 !! input
4496 [[Foo~bar]]
4497 !! result
4498 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4499 </p>
4500 !! end
4501
4502 !! test
4503 Link containing double-single-quotes '' (bug 4598)
4504 !! input
4505 [[Lista d''e paise d''o munno]]
4506 !! result
4507 <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>
4508 </p>
4509 !! end
4510
4511 !! test
4512 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4513 !! input
4514 Some [[Link|pretty ''italics'' and stuff]]!
4515 !! result
4516 <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>!
4517 </p>
4518 !! end
4519
4520 !! test
4521 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4522 !! input
4523 ''Some [[Link|pretty ''italics'' and stuff]]!
4524 !! result
4525 <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>
4526 </p>
4527 !! end
4528
4529 !! test
4530 Link with double quotes in title part (literal) and alternate part (interpreted)
4531 !! input
4532 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4533
4534 [[''Pentecoste'']]
4535
4536 [[''Pentecoste''|Pentecoste]]
4537
4538 [[''Pentecoste''|''Pentecoste'']]
4539 !! result
4540 <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>
4541 </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>
4542 </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>
4543 </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>
4544 </p>
4545 !! end
4546
4547 !! test
4548 Broken image links with HTML captions (bug 39700)
4549 !! input
4550 [[File:Nonexistent|<script></script>]]
4551 [[File:Nonexistent|100px|<script></script>]]
4552 [[File:Nonexistent|&lt;]]
4553 [[File:Nonexistent|a<i>b</i>c]]
4554 !! result
4555 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4556 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4557 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4558 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4559 </p>
4560 !! end
4561
4562 !! test
4563 Plain link to URL
4564 !! input
4565 [[http://www.example.com]]
4566 !! result
4567 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4568 </p>
4569 !! end
4570
4571 !! test
4572 Plain link to URL with link text
4573 !! input
4574 [[http://www.example.com Link text]]
4575 !! result
4576 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4577 </p>
4578 !! end
4579
4580 !! test
4581 Plain link to protocol-relative URL
4582 !! input
4583 [[//www.example.com]]
4584 !! result
4585 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4586 </p>
4587 !! end
4588
4589 !! test
4590 Plain link to protocol-relative URL with link text
4591 !! input
4592 [[//www.example.com Link text]]
4593 !! result
4594 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4595 </p>
4596 !! end
4597
4598 !! test
4599 Plain link to page with question mark in title
4600 !! input
4601 [[A?b]]
4602
4603 [[A?b|Baz]]
4604 !! result
4605 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4606 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4607 </p>
4608 !! end
4609
4610
4611 # I'm fairly sure the expected result here is wrong.
4612 # We want these to be URL links, not pseudo-pages with URLs for titles....
4613 # However the current output is also pretty screwy.
4614 #
4615 # ----
4616 # I'm changing it to match the current output--it arguably makes more
4617 # sense in the light of the test above. Old expected result was:
4618 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4619 #</p>
4620 # But I think this test is bordering on "garbage in, garbage out" anyway.
4621 # -- wtm
4622 !! test
4623 Piped link to URL
4624 !! input
4625 Piped link to URL: [[http://www.example.com|an example URL]]
4626 !! result
4627 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4628 </p>
4629 !! end
4630
4631 !! test
4632 BUG 2: [[page|http://url/]] should link to page, not http://url/
4633 !! input
4634 [[Main Page|http://url/]]
4635 !! result
4636 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4637 </p>
4638 !! end
4639
4640 !! test
4641 BUG 337: Escaped self-links should be bold
4642 !! options
4643 title=[[Bug462]]
4644 !! input
4645 [[Bu&#103;462]] [[Bug462]]
4646 !! result
4647 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4648 </p>
4649 !! end
4650
4651 !! test
4652 Self-link to section should not be bold
4653 !! options
4654 title=[[Main Page]]
4655 !! input
4656 [[Main Page#section]]
4657 !! result
4658 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4659 </p>
4660 !! end
4661
4662 !! article
4663 00
4664 !! text
4665 This is 00.
4666 !! endarticle
4667
4668 !!test
4669 Self-link to numeric title
4670 !!options
4671 title=[[0]]
4672 !!input
4673 [[0]]
4674 !!result
4675 <p><strong class="selflink">0</strong>
4676 </p>
4677 !!end
4678
4679 !!test
4680 Link to numeric-equivalent title
4681 !!options
4682 title=[[0]]
4683 !!input
4684 [[00]]
4685 !!result
4686 <p><a href="/wiki/00" title="00">00</a>
4687 </p>
4688 !!end
4689
4690 !! test
4691 <nowiki> inside a link
4692 !! input
4693 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4694 !! result
4695 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4696 </p>
4697 !! end
4698
4699 !! test
4700 Non-breaking spaces in title
4701 !! input
4702 [[&nbsp; Main &nbsp; Page &nbsp;]]
4703 !! result
4704 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4705 </p>
4706 !!end
4707
4708 !! test
4709 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4710 !! options
4711 language=ca
4712 !! input
4713 '''[[Main Page]]'''
4714 !! result
4715 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4716 </p>
4717 !! end
4718
4719 !! test
4720 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4721 !! options
4722 language=ca
4723 !! input
4724 ''[[Main Page]]''
4725 !! result
4726 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4727 </p>
4728 !! end
4729
4730 !! test
4731 Internal link with en linktrail: no apostrophes (bug 27473)
4732 !! options
4733 language=en
4734 !! input
4735 [[Something]]'nice
4736 !! result
4737 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4738 </p>
4739 !! end
4740
4741 !! test
4742 Internal link with ca linktrail with apostrophes (bug 27473)
4743 !! options
4744 language=ca
4745 !! input
4746 [[Something]]'nice
4747 !! result
4748 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4749 </p>
4750 !! end
4751
4752 !! test
4753 Internal link with kaa linktrail with apostrophes (bug 27473)
4754 !! options
4755 language=kaa
4756 !! input
4757 [[Something]]'nice
4758 !! result
4759 <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>
4760 </p>
4761 !! end
4762
4763 !! article
4764 Söfnuður
4765 !! text
4766 Test.
4767 !! endarticle
4768
4769 !! test
4770 Internal link with is link prefix
4771 !! options
4772 language=is
4773 !! input
4774 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4775 !! result
4776 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4777 </p>
4778 !! end
4779
4780 !! article
4781 Mótmælendatrú
4782 !! text
4783 Test.
4784 !! endarticle
4785
4786 !! test
4787 Internal link with is link trail and link prefix
4788 !! options
4789 language=is
4790 !! input
4791 [[mótmælendatrú|xxx]]ar
4792 [[mótmælendatrú]]ar
4793 mótmælenda[[söfnuður]]
4794 mótmælenda[[söfnuður|söfnuðir]]
4795 mótmælenda[[söfnuður|söfnuðir]]xxx
4796 !! result
4797 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4798 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4799 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4800 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4801 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4802 </p>
4803 !! end
4804
4805 !! test
4806 Parsoid link trail escaping
4807 !! options
4808 parsoid=html2wt,html2html
4809 !! input
4810 [[apple]]<nowiki/>s
4811 !! result
4812 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4813 !! end
4814
4815 !! test
4816 Parsoid link prefix escaping
4817 !! options
4818 language=is
4819 parsoid=html2wt,html2html
4820 !! input
4821 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4822 !! result
4823 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4824 !! end
4825
4826 !! test
4827 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4828 !! input
4829 [[Foo| bar]]
4830
4831 [[Foo| ''bar'']]
4832
4833 [http://wp.org foo]
4834
4835 [http://wp.org ''foo'']
4836 !! result
4837 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4838 </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>
4839 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4840 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4841 </p>
4842 !! end
4843
4844 ###
4845 ### Interwiki links (see maintenance/interwiki.sql)
4846 ###
4847
4848 !! test
4849 Inline interwiki link
4850 !! input
4851 [[MeatBall:SoftSecurity]]
4852 !! result
4853 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4854 </p>
4855 !! end
4856
4857 !! test
4858 Inline interwiki link with empty title (bug 2372)
4859 !! input
4860 [[MeatBall:]]
4861 !! result
4862 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4863 </p>
4864 !! end
4865
4866 !! test
4867 Interwiki link encoding conversion (bug 1636)
4868 !! input
4869 *[[Wikipedia:ro:Olteni&#0355;a]]
4870 *[[Wikipedia:ro:Olteni&#355;a]]
4871 !! result
4872 <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>
4873 </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>
4874 </li></ul>
4875
4876 !! end
4877
4878 !! test
4879 Interwiki link with fragment (bug 2130)
4880 !! input
4881 [[MeatBall:SoftSecurity#foo]]
4882 !! result
4883 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4884 </p>
4885 !! end
4886
4887 !! test
4888 Interlanguage link
4889 !! input
4890 Blah blah blah
4891 [[zh:Chinese]]
4892 !!result
4893 <p>Blah blah blah
4894 </p>
4895 !! end
4896
4897 !! test
4898 Double interlanguage link
4899 !! input
4900 Blah blah blah
4901 [[es:Spanish]]
4902 [[zh:Chinese]]
4903 !!result
4904 <p>Blah blah blah
4905 </p>
4906 !! end
4907
4908 !! test
4909 Interlanguage link, with prefix links
4910 !! options
4911 language=ln
4912 !! input
4913 Blah blah blah
4914 [[zh:Chinese]]
4915 !!result
4916 <p>Blah blah blah
4917 </p>
4918 !! end
4919
4920 !! test
4921 Double interlanguage link, with prefix links (bug 8897)
4922 !! options
4923 language=ln
4924 !! input
4925 Blah blah blah
4926 [[es:Spanish]]
4927 [[zh:Chinese]]
4928 !!result
4929 <p>Blah blah blah
4930 </p>
4931 !! end
4932
4933 !! test
4934 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4935 !! options
4936 language=ln
4937 !! input
4938 [[WW&nbsp;II]]
4939 !!result
4940 <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>
4941 </p>
4942 !! end
4943
4944 !! test
4945 Parsoid: handle constructor well
4946 !! options
4947 parsoid
4948 !! input
4949 [[constructor]]
4950
4951 [[constructor:foo]]
4952 !! result
4953 <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>
4954
4955
4956 <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>
4957 !! end
4958
4959 ##
4960 ## Redirects, Parsoid-only
4961 ##
4962 !! test
4963 Simple redirect to page
4964 !! options
4965 parsoid
4966 !! input
4967 #REDIRECT [[Main Page]]
4968 !! result
4969 <link rel="mw:PageProp/redirect" href="./Main_Page">
4970 !! end
4971
4972 !! test
4973 Optional colon in #REDIRECT
4974 !! options
4975 # the colon is archaic syntax. we support it for wt2html, but we
4976 # don't care that it roundtrips back to the modern syntax.
4977 parsoid=wt2html,html2html
4978 !! input
4979 #REDIRECT:[[Main Page]]
4980 !! result
4981 <link rel="mw:PageProp/redirect" href="./Main_Page">
4982 !! end
4983
4984 !! test
4985 Whitespace in #REDIRECT with optional colon
4986 !! options
4987 # the colon and gratuitous whitespace is archaic syntax. we support
4988 # it for wt2html, but we don't care that it roundtrips back to the
4989 # modern syntax (without extra whitespace)
4990 parsoid=wt2html,html2html
4991 !! input
4992
4993 #REDIRECT
4994 :
4995 [[Main Page]]
4996 !! result
4997 <link rel="mw:PageProp/redirect" href="./Main_Page">
4998 !! end
4999
5000 !! test
5001 Piped link in #REDIRECT
5002 !! options
5003 # content after piped link is ignored. we support this syntax,
5004 # but don't care that the piped link is lost when we roundtrip this.
5005 parsoid=wt2html
5006 !! input
5007 #REDIRECT [[Main Page|bar]]
5008 !! result
5009 <link rel="mw:PageProp/redirect" href="./Main_Page">
5010 !! end
5011
5012 !! test
5013 Redirect to category
5014 !! options
5015 parsoid=wt2html
5016 !! input
5017 #REDIRECT [[Category:Foo]]
5018 !! result
5019 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
5020 !! end
5021
5022 !! test
5023 Redirect to category with URL encoding
5024 !! options
5025 parsoid=wt2html
5026 !! input
5027 #REDIRECT [[Category%3AFoo]]
5028 !! result
5029 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
5030 !! end
5031
5032 !! test
5033 Redirect to category page
5034 !! options
5035 parsoid=wt2html,html2html
5036 !! input
5037 #REDIRECT [[:Category:Foo]]
5038 !! result
5039 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
5040 !! end
5041
5042 !! test
5043 Redirect to image page (1)
5044 !! options
5045 parsoid
5046 !! input
5047 #REDIRECT [[File:Wiki.png]]
5048 !! result
5049 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5050 !! end
5051
5052 !! test
5053 Redirect to image page (2)
5054 !! options
5055 parsoid
5056 !! input
5057 #REDIRECT [[Image:Wiki.png]]
5058 !! result
5059 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5060 !! end
5061
5062 !! test
5063 Redirect to language
5064 !! options
5065 parsoid
5066 !! input
5067 #REDIRECT [[en:File:Wiki.png]]
5068 !! result
5069 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5070 !! end
5071
5072 !! test
5073 Redirect to interwiki
5074 !! options
5075 parsoid
5076 !! input
5077 #REDIRECT [[meatball:File:Wiki.png]]
5078 !! result
5079 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5080 !! end
5081
5082 !! test
5083 Non-English #REDIRECT
5084 !! options
5085 parsoid
5086 language=is
5087 !! input
5088 #TILVÍSUN [[Main Page]]
5089 !! result
5090 <link rel="mw:PageProp/redirect" href="./Main_Page">
5091 !! end
5092
5093 ##
5094 ## XHTML tidiness
5095 ###
5096
5097 !! test
5098 <br> to <br />
5099 !! input
5100 1<br>2<br />3
5101 !! result
5102 <p>1<br />2<br />3
5103 </p>
5104 !! end
5105
5106 !! test
5107 Broken br tag sanitization
5108 !! options
5109 php
5110 !! input
5111 </br>
5112 !! result
5113 <p>&lt;/br&gt;
5114 </p>
5115 !! end
5116
5117 # TODO: Fix html2html mode (bug 51055)!
5118 !! test
5119 Parsoid: Broken br tag recognition
5120 !! options
5121 parsoid=wt2html
5122 !! input
5123 </br>
5124 !! result
5125 <p><br></p>
5126 !! end
5127
5128 !! test
5129 Incorrecly removing closing slashes from correctly formed XHTML
5130 !! input
5131 <br style="clear:both;" />
5132 !! result
5133 <p><br style="clear:both;" />
5134 </p>
5135 !! end
5136
5137 !! test
5138 Failing to transform badly formed HTML into correct XHTML
5139 !! input
5140 <br style="clear: left;">
5141 <br style="clear: right;">
5142 <br style="clear: both;">
5143 !! result
5144 <p><br style="clear: left;" />
5145 <br style="clear: right;" />
5146 <br style="clear: both;" />
5147 </p>
5148 !!end
5149
5150 !! test
5151 Handling html with a div self-closing tag
5152 !! input
5153 <div title />
5154 <div title/>
5155 <div title/ >
5156 <div title=bar />
5157 <div title=bar/>
5158 <div title=bar/ >
5159 !! result
5160 <p>&lt;div title /&gt;
5161 &lt;div title/&gt;
5162 </p>
5163 <div>
5164 <p>&lt;div title=bar /&gt;
5165 &lt;div title=bar/&gt;
5166 </p>
5167 <div title="bar/"></div>
5168 </div>
5169
5170 !! end
5171
5172 !! test
5173 Handling html with a br self-closing tag
5174 !! input
5175 <br title />
5176 <br title/>
5177 <br title/ >
5178 <br title=bar />
5179 <br title=bar/>
5180 <br title=bar/ >
5181 !! result
5182 <p><br title="title" />
5183 <br title="title" />
5184 <br />
5185 <br title="bar" />
5186 <br title="bar" />
5187 <br title="bar/" />
5188 </p>
5189 !! end
5190
5191 !! test
5192 Horizontal ruler (should it add that extra space?)
5193 !! input
5194 <hr>
5195 <hr >
5196 foo <hr
5197 > bar
5198 !! result
5199 <hr />
5200 <hr />
5201 foo <hr /> bar
5202
5203 !! end
5204
5205 !! test
5206 Horizontal ruler -- 4+ dashes render hr
5207 !! input
5208 ----
5209 !! result
5210 <hr />
5211
5212 !! end
5213
5214 !! test
5215 Horizontal ruler -- eats additional dashes on the same line
5216 !! input
5217 ---------
5218 !! result
5219 <hr />
5220
5221 !! end
5222
5223 !! test
5224 Horizontal ruler -- does not collapse dashes on consecutive lines
5225 !! input
5226 ----
5227 ----
5228 !! result
5229 <hr />
5230 <hr />
5231
5232 !! end
5233
5234 !! test
5235 Horizontal ruler -- <4 dashes render as plain text
5236 !! input
5237 ---
5238 !! result
5239 <p>---
5240 </p>
5241 !! end
5242
5243 !! test
5244 Horizontal ruler -- Supports content following dashes on same line
5245 !! input
5246 ---- Foo
5247 !! result
5248 <hr /> Foo
5249
5250 !! end
5251
5252 ###
5253 ### Block-level elements
5254 ###
5255 !! test
5256 Common list
5257 !! input
5258 *Common list
5259 * item 2
5260 *item 3
5261 !! result
5262 <ul><li>Common list
5263 </li><li> item 2
5264 </li><li>item 3
5265 </li></ul>
5266
5267 !! end
5268
5269 !! test
5270 Numbered list
5271 !! input
5272 #Numbered list
5273 #item 2
5274 # item 3
5275 !! result
5276 <ol><li>Numbered list
5277 </li><li>item 2
5278 </li><li> item 3
5279 </li></ol>
5280
5281 !! end
5282
5283 !! test
5284 Mixed list
5285 !! input
5286 *Mixed list
5287 *# with numbers
5288 ** and bullets
5289 *# and numbers
5290 *bullets again
5291 **bullet level 2
5292 ***bullet level 3
5293 ***#Number on level 4
5294 **bullet level 2
5295 **#Number on level 3
5296 **#Number on level 3
5297 *#number level 2
5298 *Level 1
5299 *** Level 3
5300 #** Level 3, but ordered
5301 !! result
5302 <ul><li>Mixed list
5303 <ol><li> with numbers
5304 </li></ol>
5305 <ul><li> and bullets
5306 </li></ul>
5307 <ol><li> and numbers
5308 </li></ol>
5309 </li><li>bullets again
5310 <ul><li>bullet level 2
5311 <ul><li>bullet level 3
5312 <ol><li>Number on level 4
5313 </li></ol>
5314 </li></ul>
5315 </li><li>bullet level 2
5316 <ol><li>Number on level 3
5317 </li><li>Number on level 3
5318 </li></ol>
5319 </li></ul>
5320 <ol><li>number level 2
5321 </li></ol>
5322 </li><li>Level 1
5323 <ul><li><ul><li> Level 3
5324 </li></ul>
5325 </li></ul>
5326 </li></ul>
5327 <ol><li><ul><li><ul><li> Level 3, but ordered
5328 </li></ul>
5329 </li></ul>
5330 </li></ol>
5331
5332 !! end
5333
5334 !! test
5335 Nested lists 1
5336 !! input
5337 *foo
5338 **bar
5339 !! result
5340 <ul><li>foo
5341 <ul><li>bar
5342 </li></ul>
5343 </li></ul>
5344
5345 !! end
5346
5347 !! test
5348 Nested lists 2
5349 !! input
5350 **foo
5351 *bar
5352 !! result
5353 <ul><li><ul><li>foo
5354 </li></ul>
5355 </li><li>bar
5356 </li></ul>
5357
5358 !! end
5359
5360 !! test
5361 Nested lists 3 (first element empty)
5362 !! input
5363 *
5364 **bar
5365 !! result
5366 <ul><li>
5367 <ul><li>bar
5368 </li></ul>
5369 </li></ul>
5370
5371 !! end
5372
5373 !! test
5374 Nested lists 4 (first element empty)
5375 !! input
5376 **
5377 *bar
5378 !! result
5379 <ul><li><ul><li>
5380 </li></ul>
5381 </li><li>bar
5382 </li></ul>
5383
5384 !! end
5385
5386 !! test
5387 Nested lists 5 (both elements empty)
5388 !! input
5389 **
5390 *
5391 !! result
5392 <ul><li><ul><li>
5393 </li></ul>
5394 </li><li>
5395 </li></ul>
5396
5397 !! end
5398
5399 !! test
5400 Nested lists 6 (both elements empty)
5401 !! input
5402 *
5403 **
5404 !! result
5405 <ul><li>
5406 <ul><li>
5407 </li></ul>
5408 </li></ul>
5409
5410 !! end
5411
5412 !! test
5413 Nested lists 7 (skip initial nesting levels)
5414 !! input
5415 *** foo
5416 !! result
5417 <ul><li><ul><li><ul><li> foo
5418 </li></ul>
5419 </li></ul>
5420 </li></ul>
5421
5422 !! end
5423
5424 !! test
5425 Nested lists 8 (multiple nesting transitions)
5426 !! input
5427 * foo
5428 *** bar
5429 ** baz
5430 * boo
5431 !! result
5432 <ul><li> foo
5433 <ul><li><ul><li> bar
5434 </li></ul>
5435 </li><li> baz
5436 </li></ul>
5437 </li><li> boo
5438 </li></ul>
5439
5440 !! end
5441
5442 !! test
5443 1. Lists with start-of-line-transparent tokens before bullets: Comments
5444 !! input
5445 *foo
5446 *<!--cmt-->bar
5447 <!--cmt-->*baz
5448 !! result
5449 <ul><li>foo
5450 </li><li>bar
5451 </li><li>baz
5452 </li></ul>
5453
5454 !! end
5455
5456 !! test
5457 2. Lists with start-of-line-transparent tokens before bullets: Template close
5458 !! input
5459 *foo {{echo|bar
5460 }}*baz
5461 !! result
5462 <ul><li>foo bar
5463 </li><li>baz
5464 </li></ul>
5465
5466 !! end
5467
5468 !! test
5469 List items are not parsed correctly following a <pre> block (bug 785)
5470 !! input
5471 * <pre>foo</pre>
5472 * <pre>bar</pre>
5473 * zar
5474 !! result
5475 <ul><li> <pre>foo</pre>
5476 </li><li> <pre>bar</pre>
5477 </li><li> zar
5478 </li></ul>
5479
5480 !! end
5481
5482 !! test
5483 List items from template
5484 !! input
5485
5486 {{inner list}}
5487 * item 2
5488
5489 * item 0
5490 {{inner list}}
5491 * item 2
5492
5493 * item 0
5494 * notSOL{{inner list}}
5495 * item 2
5496 !! result
5497 <ul><li> item 1
5498 </li><li> item 2
5499 </li></ul>
5500 <ul><li> item 0
5501 </li><li> item 1
5502 </li><li> item 2
5503 </li></ul>
5504 <ul><li> item 0
5505 </li><li> notSOL
5506 </li><li> item 1
5507 </li><li> item 2
5508 </li></ul>
5509
5510 !! end
5511
5512 !! test
5513 List interrupted by empty line or heading
5514 !! input
5515 * foo
5516
5517 ** bar
5518 == A heading ==
5519 * Another list item
5520 !! result
5521 <ul><li> foo
5522 </li></ul>
5523 <ul><li><ul><li> bar
5524 </li></ul>
5525 </li></ul>
5526 <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>
5527 <ul><li> Another list item
5528 </li></ul>
5529
5530 !!end
5531
5532 !!test
5533 Multiple list tags generated by templates
5534 !!input
5535 {{echo|<li>}}a
5536 {{echo|<li>}}b
5537 {{echo|<li>}}c
5538 !!result
5539 <li>a
5540 <li>b
5541 <li>c</li>
5542 </li>
5543 </li>
5544
5545 !!end
5546
5547 !!test
5548 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
5549 !!input
5550 *a
5551 <!--This line will NOT split the list-->
5552 *b
5553 <!--This line will NOT split the list either-->
5554 *c
5555 <!--foo--> <!----> <!--This line NOT split the list either-->
5556 *d
5557 !!result
5558 <ul><li>a
5559 </li><li>b
5560 </li><li>c
5561 </li><li>d
5562 </li></ul>
5563
5564 !!end
5565
5566 !!test
5567 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
5568 !!input
5569 *a
5570 <!--This line will NOT split the list-->
5571 *b
5572 <!--This line will NOT split the list either-->
5573 *c
5574 <!--foo--> <!----> <!--This line NOT split the list
5575 either-->
5576 *d
5577 !!result
5578 <ul><li>a
5579 </li><li>b
5580 </li><li>c
5581 </li><li>d
5582 </li></ul>
5583
5584 !!end
5585
5586 !!test
5587 Test the li-hack
5588 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5589 !!options
5590 parsoid=wt2html,wt2wt
5591 !!input
5592 * foo
5593 * <li>li-hack
5594 * {{echo|<li>templated li-hack}}
5595 * <!--foo--> <li> unsupported li-hack with preceding comments
5596
5597 <ul>
5598 <li><li>not a li-hack
5599 </li>
5600 </ul>
5601 !!result
5602 <ul><li> foo</li>
5603 <li>li-hack</li>
5604 <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>
5605 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5606
5607 <ul>
5608 <li></li><li>not a li-hack
5609 </li>
5610 </ul>
5611 !!end
5612
5613 !! test
5614 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5615 !! options
5616 parsoid
5617 !! input
5618 # foo
5619 ## bar
5620 * foo
5621 ** bar
5622 : foo
5623 :: bar
5624 !! result
5625 <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>
5626 !! end
5627
5628 !! test
5629 Parsoid: Test of whitespace serialization with Templated bullets
5630 !! options
5631 parsoid
5632 !! input
5633 * {{bullet}}
5634 !! result
5635 <ul>
5636 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}'> Bar</li>
5637 </ul>
5638 !! end
5639
5640 # ------------------------------------------------------------------------
5641 # The next set of tests are about Parsoid's ability to handle badly nested
5642 # tags (parse, minimize scope of fixup, and roundtrip back)
5643 # ------------------------------------------------------------------------
5644
5645 !! test
5646 Unbalanced closing block tags break a list
5647 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5648 !! options
5649 parsoid
5650 !! input
5651 <div>
5652 *a</div><div>
5653 *b</div>
5654 !! result
5655 <div>
5656 <ul><li>a
5657 </li></ul></div><div>
5658 <ul><li>b
5659 </li></ul></div>
5660 !! end
5661
5662 !! test
5663 Unbalanced closing non-block tags don't break a list
5664 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5665 !! options
5666 parsoid
5667 !! input
5668 <span>
5669 *a</span><span>
5670 *b</span>
5671 !! result
5672 <p><span></span>
5673 </p>
5674 <ul><li>a<span></span>
5675 </li><li>b
5676 </li></ul>
5677 !! end
5678
5679 !! test
5680 Unclosed formatting tags that straddle lists are closed and reopened
5681 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5682 !! options
5683 parsoid
5684 !! input
5685 # <s> a
5686 # b </s>
5687 !! result
5688 <ol><li> <s> a </s>
5689 </li><li> <s> b </s>
5690 </li></ol>
5691 !! end
5692
5693 !!test
5694 List embedded in a non-block tag
5695 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5696 !! options
5697 parsoid
5698 !!input
5699 <small>
5700 * foo
5701 </small>
5702 !!result
5703 <p><small></small></p>
5704 <small>
5705 <ul>
5706 <li> foo</li>
5707 </ul>
5708 </small>
5709 <p><small></small></p>
5710 !!end
5711
5712 ###
5713 ### Magic Words
5714 ###
5715
5716 # Note that the current date is hard-coded as
5717 # 1970-01-01T00:02:03Z (a Thursday)
5718 # when running parser tests. The timezone is also fixed to GMT, so
5719 # local date will be identical to current date.
5720
5721 !! test
5722 Magic Word: {{CURRENTDAY}}
5723 !! input
5724 {{CURRENTDAY}}
5725 !! result
5726 <p>1
5727 </p>
5728 !! end
5729
5730 !! test
5731 Magic Word: {{CURRENTDAY2}}
5732 !! input
5733 {{CURRENTDAY2}}
5734 !! result
5735 <p>01
5736 </p>
5737 !! end
5738
5739 !! test
5740 Magic Word: {{CURRENTDAYNAME}}
5741 !! input
5742 {{CURRENTDAYNAME}}
5743 !! result
5744 <p>Thursday
5745 </p>
5746 !! end
5747
5748 !! test
5749 Magic Word: {{CURRENTDOW}}
5750 !! input
5751 {{CURRENTDOW}}
5752 !! result
5753 <p>4
5754 </p>
5755 !! end
5756
5757 !! test
5758 Magic Word: {{CURRENTMONTH}}
5759 !! input
5760 {{CURRENTMONTH}}
5761 !! result
5762 <p>01
5763 </p>
5764 !! end
5765
5766 !! test
5767 Magic Word: {{CURRENTMONTH1}}
5768 !! input
5769 {{CURRENTMONTH1}}
5770 !! result
5771 <p>1
5772 </p>
5773 !! end
5774
5775 !! test
5776 Magic Word: {{CURRENTMONTHABBREV}}
5777 !! input
5778 {{CURRENTMONTHABBREV}}
5779 !! result
5780 <p>Jan
5781 </p>
5782 !! end
5783
5784 !! test
5785 Magic Word: {{CURRENTMONTHNAME}}
5786 !! input
5787 {{CURRENTMONTHNAME}}
5788 !! result
5789 <p>January
5790 </p>
5791 !! end
5792
5793 !! test
5794 Magic Word: {{CURRENTMONTHNAMEGEN}}
5795 !! input
5796 {{CURRENTMONTHNAMEGEN}}
5797 !! result
5798 <p>January
5799 </p>
5800 !! end
5801
5802 !! test
5803 Magic Word: {{CURRENTTIME}}
5804 !! input
5805 {{CURRENTTIME}}
5806 !! result
5807 <p>00:02
5808 </p>
5809 !! end
5810
5811 !! test
5812 Magic Word: {{CURRENTHOUR}}
5813 !! input
5814 {{CURRENTHOUR}}
5815 !! result
5816 <p>00
5817 </p>
5818 !! end
5819
5820 !! test
5821 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5822 !! input
5823 {{CURRENTWEEK}}
5824 !! result
5825 <p>1
5826 </p>
5827 !! end
5828
5829 !! test
5830 Magic Word: {{CURRENTYEAR}}
5831 !! input
5832 {{CURRENTYEAR}}
5833 !! result
5834 <p>1970
5835 </p>
5836 !! end
5837
5838 !! test
5839 Magic Word: {{CURRENTTIMESTAMP}}
5840 !! input
5841 {{CURRENTTIMESTAMP}}
5842 !! result
5843 <p>19700101000203
5844 </p>
5845 !! end
5846
5847 !! test
5848 Magic Words LOCAL (UTC)
5849 !! input
5850 * {{LOCALMONTH}}
5851 * {{LOCALMONTH1}}
5852 * {{LOCALMONTHNAME}}
5853 * {{LOCALMONTHNAMEGEN}}
5854 * {{LOCALMONTHABBREV}}
5855 * {{LOCALDAY}}
5856 * {{LOCALDAY2}}
5857 * {{LOCALDAYNAME}}
5858 * {{LOCALYEAR}}
5859 * {{LOCALTIME}}
5860 * {{LOCALHOUR}}
5861 * {{LOCALWEEK}}
5862 * {{LOCALDOW}}
5863 * {{LOCALTIMESTAMP}}
5864 !! result
5865 <ul><li> 01
5866 </li><li> 1
5867 </li><li> January
5868 </li><li> January
5869 </li><li> Jan
5870 </li><li> 1
5871 </li><li> 01
5872 </li><li> Thursday
5873 </li><li> 1970
5874 </li><li> 00:02
5875 </li><li> 00
5876 </li><li> 1
5877 </li><li> 4
5878 </li><li> 19700101000203
5879 </li></ul>
5880
5881 !! end
5882
5883 !! test
5884 Magic Word: {{FULLPAGENAME}}
5885 !! options
5886 title=[[User:Ævar Arnfjörð Bjarmason]]
5887 !! input
5888 {{FULLPAGENAME}}
5889 !! result
5890 <p>User:Ævar Arnfjörð Bjarmason
5891 </p>
5892 !! end
5893
5894 !! test
5895 Magic Word: {{FULLPAGENAMEE}}
5896 !! options
5897 title=[[User:Ævar Arnfjörð Bjarmason]]
5898 !! input
5899 {{FULLPAGENAMEE}}
5900 !! result
5901 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5902 </p>
5903 !! end
5904
5905 !! test
5906 Magic Word: {{TALKSPACE}}
5907 !! options
5908 title=[[User:Ævar Arnfjörð Bjarmason]]
5909 !! input
5910 {{TALKSPACE}}
5911 !! result
5912 <p>User talk
5913 </p>
5914 !! end
5915
5916 !! test
5917 Magic Word: {{TALKSPACE}}, same namespace
5918 !! options
5919 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5920 !! input
5921 {{TALKSPACE}}
5922 !! result
5923 <p>User talk
5924 </p>
5925 !! end
5926
5927 !! test
5928 Magic Word: {{TALKSPACE}}, main namespace
5929 !! options
5930 title=[[Parser Test]]
5931 !! input
5932 {{TALKSPACE}}
5933 !! result
5934 <p>Talk
5935 </p>
5936 !! end
5937
5938 !! test
5939 Magic Word: {{TALKSPACEE}}
5940 !! options
5941 title=[[User:Ævar Arnfjörð Bjarmason]]
5942 !! input
5943 {{TALKSPACEE}}
5944 !! result
5945 <p>User_talk
5946 </p>
5947 !! end
5948
5949 !! test
5950 Magic Word: {{SUBJECTSPACE}}
5951 !! options
5952 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5953 !! input
5954 {{SUBJECTSPACE}}
5955 !! result
5956 <p>User
5957 </p>
5958 !! end
5959
5960 !! test
5961 Magic Word: {{SUBJECTSPACE}}, same namespace
5962 !! options
5963 title=[[User:Ævar Arnfjörð Bjarmason]]
5964 !! input
5965 {{SUBJECTSPACE}}
5966 !! result
5967 <p>User
5968 </p>
5969 !! end
5970
5971 !! test
5972 Magic Word: {{SUBJECTSPACE}}, main namespace
5973 !! options
5974 title=[[Parser Test]]
5975 !! input
5976 {{SUBJECTSPACE}}
5977 !! result
5978
5979 !! end
5980
5981 !! test
5982 Magic Word: {{SUBJECTSPACEE}}
5983 !! options
5984 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5985 !! input
5986 {{SUBJECTSPACEE}}
5987 !! result
5988 <p>User
5989 </p>
5990 !! end
5991
5992 !! test
5993 Magic Word: {{NAMESPACE}}
5994 !! options
5995 title=[[User:Ævar Arnfjörð Bjarmason]]
5996 !! input
5997 {{NAMESPACE}}
5998 !! result
5999 <p>User
6000 </p>
6001 !! end
6002
6003 !! test
6004 Magic Word: {{NAMESPACEE}}
6005 !! options
6006 title=[[User:Ævar Arnfjörð Bjarmason]]
6007 !! input
6008 {{NAMESPACEE}}
6009 !! result
6010 <p>User
6011 </p>
6012 !! end
6013
6014 !! test
6015 Magic Word: {{NAMESPACENUMBER}}
6016 !! options
6017 title=[[User:Ævar Arnfjörð Bjarmason]]
6018 !! input
6019 {{NAMESPACENUMBER}}
6020 !! result
6021 <p>2
6022 </p>
6023 !! end
6024
6025 !! test
6026 Magic Word: {{SUBPAGENAME}}
6027 !! options
6028 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6029 !! input
6030 {{SUBPAGENAME}}
6031 !! result
6032 <p>sub ö
6033 </p>
6034 !! end
6035
6036 !! test
6037 Magic Word: {{SUBPAGENAMEE}}
6038 !! options
6039 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6040 !! input
6041 {{SUBPAGENAMEE}}
6042 !! result
6043 <p>sub_%C3%B6
6044 </p>
6045 !! end
6046
6047 !! test
6048 Magic Word: {{ROOTPAGENAME}}
6049 !! options
6050 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6051 !! input
6052 {{ROOTPAGENAME}}
6053 !! result
6054 <p>Ævar Arnfjörð Bjarmason
6055 </p>
6056 !! end
6057
6058 !! test
6059 Magic Word: {{ROOTPAGENAMEE}}
6060 !! options
6061 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6062 !! input
6063 {{ROOTPAGENAMEE}}
6064 !! result
6065 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6066 </p>
6067 !! end
6068
6069 !! test
6070 Magic Word: {{BASEPAGENAME}}
6071 !! options
6072 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6073 !! input
6074 {{BASEPAGENAME}}
6075 !! result
6076 <p>Ævar Arnfjörð Bjarmason
6077 </p>
6078 !! end
6079
6080 !! test
6081 Magic Word: {{BASEPAGENAMEE}}
6082 !! options
6083 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6084 !! input
6085 {{BASEPAGENAMEE}}
6086 !! result
6087 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6088 </p>
6089 !! end
6090
6091 !! test
6092 Magic Word: {{TALKPAGENAME}}
6093 !! options
6094 title=[[User:Ævar Arnfjörð Bjarmason]]
6095 !! input
6096 {{TALKPAGENAME}}
6097 !! result
6098 <p>User talk:Ævar Arnfjörð Bjarmason
6099 </p>
6100 !! end
6101
6102 !! test
6103 Magic Word: {{TALKPAGENAMEE}}
6104 !! options
6105 title=[[User:Ævar Arnfjörð Bjarmason]]
6106 !! input
6107 {{TALKPAGENAMEE}}
6108 !! result
6109 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6110 </p>
6111 !! end
6112
6113 !! test
6114 Magic Word: {{SUBJECTPAGENAME}}
6115 !! options
6116 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6117 !! input
6118 {{SUBJECTPAGENAME}}
6119 !! result
6120 <p>User:Ævar Arnfjörð Bjarmason
6121 </p>
6122 !! end
6123
6124 !! test
6125 Magic Word: {{SUBJECTPAGENAMEE}}
6126 !! options
6127 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6128 !! input
6129 {{SUBJECTPAGENAMEE}}
6130 !! result
6131 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6132 </p>
6133 !! end
6134
6135 !! test
6136 Magic Word: {{NUMBEROFFILES}}
6137 !! input
6138 {{NUMBEROFFILES}}
6139 !! result
6140 <p>4
6141 </p>
6142 !! end
6143
6144 !! test
6145 Magic Word: {{PAGENAME}}
6146 !! options
6147 title=[[User:Ævar Arnfjörð Bjarmason]]
6148 !! input
6149 {{PAGENAME}}
6150 !! result
6151 <p>Ævar Arnfjörð Bjarmason
6152 </p>
6153 !! end
6154
6155 !! test
6156 Magic Word: {{PAGENAME}} with metacharacters
6157 !! options
6158 title=[['foo & bar = baz']]
6159 !! input
6160 ''{{PAGENAME}}''
6161 !! result
6162 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
6163 </p>
6164 !! end
6165
6166 !! test
6167 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
6168 !! options
6169 title=[[*RFC 1234 http://example.com/]]
6170 !! input
6171 {{PAGENAME}}
6172 !! result
6173 <p>&#42;RFC&#32;1234 http&#58;//example.com/
6174 </p>
6175 !! end
6176
6177 !! test
6178 Magic Word: {{PAGENAMEE}}
6179 !! options
6180 title=[[User:Ævar Arnfjörð Bjarmason]]
6181 !! input
6182 {{PAGENAMEE}}
6183 !! result
6184 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6185 </p>
6186 !! end
6187
6188 !! test
6189 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
6190 !! options
6191 title=[[*RFC 1234 http://example.com/]]
6192 !! input
6193 {{PAGENAMEE}}
6194 !! result
6195 <p>&#42;RFC_1234_http&#58;//example.com/
6196 </p>
6197 !! end
6198
6199 !! test
6200 Magic Word: {{REVISIONID}}
6201 !! input
6202 {{REVISIONID}}
6203 !! result
6204 <p>1337
6205 </p>
6206 !! end
6207
6208 !! test
6209 Magic Word: {{SCRIPTPATH}}
6210 !! input
6211 {{SCRIPTPATH}}
6212 !! result
6213 <p>/
6214 </p>
6215 !! end
6216
6217 !! test
6218 Magic Word: {{STYLEPATH}}
6219 !! input
6220 {{STYLEPATH}}
6221 !! result
6222 <p>/skins
6223 </p>
6224 !! end
6225
6226 !! test
6227 Magic Word: {{SERVER}}
6228 !! input
6229 {{SERVER}}
6230 !! result
6231 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6232 </p>
6233 !! end
6234
6235 !! test
6236 Magic Word: {{SERVERNAME}}
6237 !! input
6238 {{SERVERNAME}}
6239 !! result
6240 <p>example.org
6241 </p>
6242 !! end
6243
6244 !! test
6245 Magic Word: {{SITENAME}}
6246 !! input
6247 {{SITENAME}}
6248 !! result
6249 <p>MediaWiki
6250 </p>
6251 !! end
6252
6253 !! test
6254 Case-sensitive magic words, when cased differently, should just be template transclusions
6255 !! input
6256 {{CurrentMonth}}
6257 {{currentday}}
6258 {{cURreNTweEK}}
6259 {{currentHour}}
6260 !! result
6261 <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>
6262 <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>
6263 <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>
6264 <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>
6265 </p>
6266 !! end
6267
6268 !! test
6269 Case-insensitive magic words should still work with weird casing.
6270 !! input
6271 {{sErVeRNaMe}}
6272 {{LCFirst:AOEU}}
6273 {{ucFIRST:aoeu}}
6274 {{SERver}}
6275 !! result
6276 <p>example.org
6277 aOEU
6278 Aoeu
6279 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6280 </p>
6281 !! end
6282
6283 !! test
6284 Namespace 1 {{ns:1}}
6285 !! input
6286 {{ns:1}}
6287 !! result
6288 <p>Talk
6289 </p>
6290 !! end
6291
6292 !! test
6293 Namespace 1 {{ns:01}}
6294 !! input
6295 {{ns:01}}
6296 !! result
6297 <p>Talk
6298 </p>
6299 !! end
6300
6301 !! test
6302 Namespace 0 {{ns:0}} (bug 4783)
6303 !! input
6304 {{ns:0}}
6305 !! result
6306
6307 !! end
6308
6309 !! test
6310 Namespace 0 {{ns:00}} (bug 4783)
6311 !! input
6312 {{ns:00}}
6313 !! result
6314
6315 !! end
6316
6317 !! test
6318 Namespace -1 {{ns:-1}}
6319 !! input
6320 {{ns:-1}}
6321 !! result
6322 <p>Special
6323 </p>
6324 !! end
6325
6326 !! test
6327 Namespace User {{ns:User}}
6328 !! input
6329 {{ns:User}}
6330 !! result
6331 <p>User
6332 </p>
6333 !! end
6334
6335 !! test
6336 Namespace User talk {{ns:User_talk}}
6337 !! input
6338 {{ns:User_talk}}
6339 !! result
6340 <p>User talk
6341 </p>
6342 !! end
6343
6344 !! test
6345 Namespace User talk {{ns:uSeR tAlK}}
6346 !! input
6347 {{ns:uSeR tAlK}}
6348 !! result
6349 <p>User talk
6350 </p>
6351 !! end
6352
6353 !! test
6354 Namespace File {{ns:File}}
6355 !! input
6356 {{ns:File}}
6357 !! result
6358 <p>File
6359 </p>
6360 !! end
6361
6362 !! test
6363 Namespace File {{ns:Image}}
6364 !! input
6365 {{ns:Image}}
6366 !! result
6367 <p>File
6368 </p>
6369 !! end
6370
6371 !! test
6372 Namespace (lang=de) Benutzer {{ns:User}}
6373 !! options
6374 language=de
6375 !! input
6376 {{ns:User}}
6377 !! result
6378 <p>Benutzer
6379 </p>
6380 !! end
6381
6382 !! test
6383 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
6384 !! options
6385 language=de
6386 !! input
6387 {{ns:3}}
6388 !! result
6389 <p>Benutzer Diskussion
6390 </p>
6391 !! end
6392
6393
6394 !! test
6395 Urlencode
6396 !! input
6397 {{urlencode:hi world?!}}
6398 {{urlencode:hi world?!|WIKI}}
6399 {{urlencode:hi world?!|PATH}}
6400 {{urlencode:hi world?!|QUERY}}
6401 !! result
6402 <p>hi+world%3F%21
6403 hi_world%3F!
6404 hi%20world%3F%21
6405 hi+world%3F%21
6406 </p>
6407 !! end
6408
6409 ###
6410 ### Magic links
6411 ###
6412 !! test
6413 Magic links: internal link to RFC (bug 479)
6414 !! input
6415 [[RFC 123]]
6416 !! result
6417 <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>
6418 </p>
6419 !! end
6420
6421 !! test
6422 Magic links: RFC (bug 479)
6423 !! input
6424 RFC 822
6425 !! result
6426 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
6427 </p>
6428 !! end
6429
6430 !! test
6431 Magic links: ISBN (bug 1937)
6432 !! input
6433 ISBN 0-306-40615-2
6434 !! result
6435 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
6436 </p>
6437 !! end
6438
6439 !! test
6440 Magic links: PMID incorrectly converts space to underscore
6441 !! input
6442 PMID 1234
6443 !! result
6444 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
6445 </p>
6446 !! end
6447
6448 ###
6449 ### Templates
6450 ####
6451
6452 !! test
6453 Nonexistent template
6454 !! input
6455 {{thistemplatedoesnotexist}}
6456 !! result
6457 <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>
6458 </p>
6459 !! end
6460
6461 !! test
6462 Template with invalid target containing tags
6463 !! input
6464 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6465 !! result
6466 <p>{{a<b>b</b>|foo|a=b|a = b}}
6467 </p>
6468 !! end
6469
6470 !! test
6471 Template with invalid target containing unclosed tag
6472 !! input
6473 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6474 !! result
6475 <p>{{a<b>|foo|a=b|a = b}}</b>
6476 </p>
6477 !! end
6478
6479 !! article
6480 Template:test
6481 !! text
6482 This is a test template
6483 !! endarticle
6484
6485 !! test
6486 Simple template
6487 !! input
6488 {{test}}
6489 !! result
6490 <p>This is a test template
6491 </p>
6492 !! end
6493
6494 !! test
6495 Template with explicit namespace
6496 !! input
6497 {{Template:test}}
6498 !! result
6499 <p>This is a test template
6500 </p>
6501 !! end
6502
6503
6504 !! article
6505 Template:paramtest
6506 !! text
6507 This is a test template with parameter {{{param}}}
6508 !! endarticle
6509
6510 !! test
6511 Template parameter
6512 !! input
6513 {{paramtest|param=foo}}
6514 !! result
6515 <p>This is a test template with parameter foo
6516 </p>
6517 !! end
6518
6519 !! article
6520 Template:paramtestnum
6521 !! text
6522 [[{{{1}}}|{{{2}}}]]
6523 !! endarticle
6524
6525 !! test
6526 Template unnamed parameter
6527 !! input
6528 {{paramtestnum|Main Page|the main page}}
6529 !! result
6530 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
6531 </p>
6532 !! end
6533
6534 !! article
6535 Template:templatesimple
6536 !! text
6537 (test)
6538 !! endarticle
6539
6540 !! article
6541 Template:templateredirect
6542 !! text
6543 #redirect [[Template:templatesimple]]
6544 !! endarticle
6545
6546 !! article
6547 Template:templateasargtestnum
6548 !! text
6549 {{{{{1}}}}}
6550 !! endarticle
6551
6552 !! article
6553 Template:templateasargtest
6554 !! text
6555 {{template{{{templ}}}}}
6556 !! endarticle
6557
6558 !! article
6559 Template:templateasargtest2
6560 !! text
6561 {{{{{templ}}}}}
6562 !! endarticle
6563
6564 !! test
6565 Template with template name as unnamed argument
6566 !! input
6567 {{templateasargtestnum|templatesimple}}
6568 !! result
6569 <p>(test)
6570 </p>
6571 !! end
6572
6573 !! test
6574 Template with template name as argument
6575 !! input
6576 {{templateasargtest|templ=simple}}
6577 !! result
6578 <p>(test)
6579 </p>
6580 !! end
6581
6582 !! test
6583 Template with template name as argument (2)
6584 !! input
6585 {{templateasargtest2|templ=templatesimple}}
6586 !! result
6587 <p>(test)
6588 </p>
6589 !! end
6590
6591 !! article
6592 Template:templateasargtestdefault
6593 !! text
6594 {{{{{templ|templatesimple}}}}}
6595 !! endarticle
6596
6597 !! article
6598 Template:templa
6599 !! text
6600 '''templ'''
6601 !! endarticle
6602
6603 !! test
6604 Template with default value
6605 !! input
6606 {{templateasargtestdefault}}
6607 !! result
6608 <p>(test)
6609 </p>
6610 !! end
6611
6612 !! test
6613 Template with default value (value set)
6614 !! input
6615 {{templateasargtestdefault|templ=templa}}
6616 !! result
6617 <p><b>templ</b>
6618 </p>
6619 !! end
6620
6621 !! test
6622 Template redirect
6623 !! input
6624 {{templateredirect}}
6625 !! result
6626 <p>(test)
6627 </p>
6628 !! end
6629
6630 !! test
6631 Template with argument in separate line
6632 !! input
6633 {{ templateasargtest |
6634 templ = simple }}
6635 !! result
6636 <p>(test)
6637 </p>
6638 !! end
6639
6640 !! test
6641 Template with complex template as argument
6642 !! input
6643 {{paramtest|
6644 param ={{ templateasargtest |
6645 templ = simple }}}}
6646 !! result
6647 <p>This is a test template with parameter (test)
6648 </p>
6649 !! end
6650
6651 !! test
6652 Template with thumb image (with link in description)
6653 !! input
6654 {{paramtest|
6655 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6656 !! result
6657 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>
6658
6659 !! end
6660
6661 !! article
6662 Template:complextemplate
6663 !! text
6664 {{{1}}} {{paramtest|
6665 param ={{{param}}}}}
6666 !! endarticle
6667
6668 !! test
6669 Template with complex arguments
6670 !! input
6671 {{complextemplate|
6672 param ={{ templateasargtest |
6673 templ = simple }}|[[Template:complextemplate|link]]}}
6674 !! result
6675 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6676 </p>
6677 !! end
6678
6679 !! test
6680 BUG 553: link with two variables in a piped link
6681 !! input
6682 {|
6683 |[[{{{1}}}|{{{2}}}]]
6684 |}
6685 !! result
6686 <table>
6687 <tr>
6688 <td>[[{{{1}}}|{{{2}}}]]
6689 </td></tr></table>
6690
6691 !! end
6692
6693 !! test
6694 Magic variable as template parameter
6695 !! input
6696 {{paramtest|param={{SITENAME}}}}
6697 !! result
6698 <p>This is a test template with parameter MediaWiki
6699 </p>
6700 !! end
6701
6702 !! article
6703 Template:linktest
6704 !! text
6705 [[{{{param}}}|link]]
6706 !! endarticle
6707
6708 !! test
6709 Template parameter as link source
6710 !! input
6711 {{linktest|param=Main Page}}
6712 !! result
6713 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
6714 </p>
6715 !! end
6716
6717 !!test
6718 Template-generated attribute string (k='v')
6719 !!input
6720 <span {{attr_str|id|v1}}>bar</span>
6721 !!result
6722 <p><span id="v1">bar</span>
6723 </p>
6724 !!end
6725
6726 !!article
6727 Template:paramtest2
6728 !! text
6729 including another template, {{paramtest|param={{{arg}}}}}
6730 !! endarticle
6731
6732 !! test
6733 Template passing argument to another template
6734 !! input
6735 {{paramtest2|arg='hmm'}}
6736 !! result
6737 <p>including another template, This is a test template with parameter 'hmm'
6738 </p>
6739 !! end
6740
6741 !! article
6742 Template:Linktest2
6743 !! text
6744 Main Page
6745 !! endarticle
6746
6747 !! test
6748 Template as link source
6749 !! input
6750 [[{{linktest2}}]]
6751
6752 [[{{linktest2}}|Main Page]]
6753
6754 [[{{linktest2}}]]Page
6755 !! result
6756 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6757 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6758 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
6759 </p>
6760 !! end
6761
6762
6763 !! article
6764 Template:loop1
6765 !! text
6766 {{loop2}}
6767 !! endarticle
6768
6769 !! article
6770 Template:loop2
6771 !! text
6772 {{loop1}}
6773 !! endarticle
6774
6775 !! test
6776 Template infinite loop
6777 !! input
6778 {{loop1}}
6779 !! result
6780 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
6781 </p>
6782 !! end
6783
6784 !! test
6785 Template from main namespace
6786 !! input
6787 {{:Main Page}}
6788 !! result
6789 <p>blah blah
6790 </p>
6791 !! end
6792
6793 !! article
6794 Template:table
6795 !! text
6796 {|
6797 | 1 || 2
6798 |-
6799 | 3 || 4
6800 |}
6801 !! endarticle
6802
6803 !! test
6804 BUG 529: Template with table, not included at beginning of line
6805 !! input
6806 foo {{table}}
6807 !! result
6808 <p>foo
6809 </p>
6810 <table>
6811 <tr>
6812 <td> 1 </td>
6813 <td> 2
6814 </td></tr>
6815 <tr>
6816 <td> 3 </td>
6817 <td> 4
6818 </td></tr></table>
6819
6820 !! end
6821
6822 !! test
6823 BUG 523: Template shouldn't eat newline (or add an extra one before table)
6824 !! input
6825 foo
6826 {{table}}
6827 !! result
6828 <p>foo
6829 </p>
6830 <table>
6831 <tr>
6832 <td> 1 </td>
6833 <td> 2
6834 </td></tr>
6835 <tr>
6836 <td> 3 </td>
6837 <td> 4
6838 </td></tr></table>
6839
6840 !! end
6841
6842 !! test
6843 BUG 41: Template parameters shown as broken links
6844 !! input
6845 {{{parameter}}}
6846 !! result
6847 <p>{{{parameter}}}
6848 </p>
6849 !! end
6850
6851 !! test
6852 Template with targets containing wikilinks
6853 !! input
6854 {{[[foo]]}}
6855
6856 {{[[{{echo|foo}}]]}}
6857
6858 {{{{echo|[[foo}}]]}}
6859 !! result
6860 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6861 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6862 </p><p>{{[[foo}}]]
6863 </p>
6864 !! end
6865
6866 !! article
6867 Template:MSGNW test
6868 !! text
6869 ''None'' of '''this''' should be
6870 * interpreted
6871 but rather passed unmodified
6872 {{test}}
6873 !! endarticle
6874
6875 # hmm, fix this or just deprecate msgnw and document its behavior?
6876 !! test
6877 msgnw keyword
6878 !! options
6879 disabled
6880 !! input
6881 {{msgnw:MSGNW test}}
6882 !! result
6883 <p>''None'' of '''this''' should be
6884 * interpreted
6885 but rather passed unmodified
6886 {{test}}
6887 </p>
6888 !! end
6889
6890 !! test
6891 int keyword
6892 !! input
6893 {{int:youhavenewmessages|lots of money|not!}}
6894 !! result
6895 <p>You have lots of money (not!).
6896 </p>
6897 !! end
6898
6899 !! article
6900 Template:Includes
6901 !! text
6902 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6903 !! endarticle
6904
6905 !! test
6906 <includeonly> and <noinclude> being included
6907 !! input
6908 {{Includes}}
6909 !! result
6910 <p>Foobar
6911 </p>
6912 !! end
6913
6914 !! article
6915 Template:Includes2
6916 !! text
6917 <onlyinclude>Foo</onlyinclude>bar
6918 !! endarticle
6919
6920 !! test
6921 <onlyinclude> being included
6922 !! input
6923 {{Includes2}}
6924 !! result
6925 <p>Foo
6926 </p>
6927 !! end
6928
6929
6930 !! article
6931 Template:Includes3
6932 !! text
6933 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6934 !! endarticle
6935
6936 !! test
6937 <onlyinclude> and <includeonly> being included
6938 !! input
6939 {{Includes3}}
6940 !! result
6941 <p>Foo
6942 </p>
6943 !! end
6944
6945 !! test
6946 <includeonly> and <noinclude> on a page
6947 !! input
6948 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6949 !! result
6950 <p>Foozar
6951 </p>
6952 !! end
6953
6954 !! test
6955 Un-closed <noinclude>
6956 !! input
6957 <noinclude>
6958 !! result
6959 !! end
6960
6961 !! test
6962 <onlyinclude> on a page
6963 !! input
6964 <onlyinclude>Foo</onlyinclude>bar
6965 !! result
6966 <p>Foobar
6967 </p>
6968 !! end
6969
6970 !! test
6971 Un-closed <onlyinclude>
6972 !! input
6973 <onlyinclude>
6974 !! result
6975 !! end
6976
6977 !!test
6978 Self-closed noinclude, includeonly, onlyinclude tags
6979 !!input
6980 <noinclude />
6981 <includeonly />
6982 <onlyinclude />
6983 !!result
6984 <p><br />
6985 </p>
6986 !!end
6987
6988 !!test
6989 Unbalanced includeonly and noinclude tags
6990 !!input
6991 {|
6992 |a</noinclude>
6993 |b</noinclude></noinclude>
6994 |c</noinclude></includeonly>
6995 |d</includeonly></includeonly>
6996 |}
6997 !!result
6998 <table>
6999 <tr>
7000 <td>a
7001 </td>
7002 <td>b
7003 </td>
7004 <td>c&lt;/includeonly&gt;
7005 </td>
7006 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
7007 </td></tr></table>
7008
7009 !!end
7010
7011 !! article
7012 Template:Includeonly section
7013 !! text
7014 <includeonly>
7015 ==Includeonly section==
7016 </includeonly>
7017 ==Section T-1==
7018 !!endarticle
7019
7020 !! test
7021 Bug 6563: Edit link generation for section shown by <includeonly>
7022 !! input
7023 {{includeonly section}}
7024 !! result
7025 <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>
7026 <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>
7027
7028 !! end
7029
7030 # Uses same input as the contents of [[Template:Includeonly section]]
7031 !! test
7032 Bug 6563: Section extraction for section shown by <includeonly>
7033 !! options
7034 section=T-2
7035 !! input
7036 <includeonly>
7037 ==Includeonly section==
7038 </includeonly>
7039 ==Section T-2==
7040 !! result
7041 ==Section T-2==
7042 !! end
7043
7044 !! test
7045 Bug 6563: Edit link generation for section suppressed by <includeonly>
7046 !! input
7047 <includeonly>
7048 ==Includeonly section==
7049 </includeonly>
7050 ==Section 1==
7051 !! result
7052 <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>
7053
7054 !! end
7055
7056 !! test
7057 Bug 6563: Section extraction for section suppressed by <includeonly>
7058 !! options
7059 section=1
7060 !! input
7061 <includeonly>
7062 ==Includeonly section==
7063 </includeonly>
7064 ==Section 1==
7065 !! result
7066 ==Section 1==
7067 !! end
7068
7069 !! test
7070 Un-closed <includeonly>
7071 !! input
7072 <includeonly>
7073 !! result
7074 !! end
7075
7076 # TODO: test with DOM fragment reuse!
7077 !! test
7078 Parsoid: DOM fragment reuse
7079 !! options
7080 parsoid=wt2wt,wt2html
7081 !! input
7082 a{{echo|b<table></table>c}}d
7083
7084 a{{echo|b
7085 <table></table>
7086 c}}d
7087
7088 {{echo|a
7089
7090 <table></table>
7091
7092 b}}
7093 !! result
7094 a<span typeof="mw:Transclusion">b</span>
7095 <table></table><span>c</span>d
7096 <p typeof="mw:Transclusion">ab</p>
7097 <table></table>
7098 <p>cd</p>
7099 <p typeof="mw:Transclusion">a</p>
7100 <table></table>
7101 <p>b</p>
7102 !! end
7103
7104 ###
7105 ### <includeonly> and <noinclude> in attributes
7106 ###
7107 !!test
7108 0. includeonly around the entire attribute
7109 !!input
7110 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
7111 !!result
7112 <p><span id="v2">bar</span>
7113 </p>
7114 !!end
7115
7116 !!test
7117 1. includeonly in html attr key
7118 !!input
7119 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
7120 !!result
7121 <p><span id="foo">bar</span>
7122 </p>
7123 !!end
7124
7125 !!test
7126 2. includeonly in html attr value
7127 !!input
7128 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
7129 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
7130 !!result
7131 <p><span id="v1">bar</span>
7132 <span id="v1">bar</span>
7133 </p>
7134 !!end
7135
7136 !!test
7137 3. includeonly in part of an attr value
7138 !!input
7139 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
7140 !!result
7141 <p><span style="color:red;">bar</span>
7142 </p>
7143 !!end
7144
7145 ###
7146 ### Testing parsing of templates where a template arg
7147 ### has the same name as the template itself.
7148 ###
7149
7150 !! article
7151 Template:quote
7152 !! text
7153 {{{quote|{{{1}}}}}}
7154 !! endarticle
7155
7156 !!test
7157 Templates: Template Name/Arg clash: 1. Use of positional param
7158 !!input
7159 {{quote|foo}}
7160 !!result
7161 <p>foo
7162 </p>
7163 !!end
7164
7165 !!test
7166 Templates: Template Name/Arg clash: 2. Use of named param
7167 !!input
7168 {{quote|quote=foo}}
7169 !!result
7170 <p>foo
7171 </p>
7172 !!end
7173
7174 !!test
7175 Templates: Template Name/Arg clash: 3. Use of named param with empty input
7176 !!input
7177 {{quote|quote}}
7178 !!result
7179 <p>quote
7180 </p>
7181 !!end
7182
7183 ###
7184 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
7185 ###
7186
7187 !!test
7188 Templates: 1. Simple use
7189 !!input
7190 {{echo|Foo}}
7191 !!result
7192 <p>Foo
7193 </p>
7194 !!end
7195
7196 !!test
7197 Templates: 2. Inside a block tag
7198 !!input
7199 <div>{{echo|Foo}}</div>
7200 !!result
7201 <div>Foo</div>
7202
7203 !!end
7204
7205 !!test
7206 Templates: P-wrapping: 1a. Templates on consecutive lines
7207 !!input
7208 {{echo|Foo}}
7209 {{echo|bar}}
7210 !!result
7211 <p>Foo
7212 bar
7213 </p>
7214 !!end
7215
7216 !!test
7217 Templates: P-wrapping: 1b. Templates on consecutive lines
7218 !!input
7219 Foo
7220
7221 {{echo|bar}}
7222 {{echo|baz}}
7223 !!result
7224 <p>Foo
7225 </p><p>bar
7226 baz
7227 </p>
7228 !!end
7229
7230 !!test
7231 Templates: P-wrapping: 1c. Templates on consecutive lines
7232 !!input
7233 {{echo|Foo}}
7234 {{echo|bar}} <div>baz</div>
7235 !!result
7236 <p>Foo
7237 </p>
7238 bar <div>baz</div>
7239
7240 !!end
7241
7242 !!test
7243 Templates: P-wrapping: 1d. Template preceded by comment-only line
7244 !!options
7245 parsoid=wt2html,wt2wt
7246 !!input
7247 <!-- foo -->
7248 {{echo|Bar}}
7249 !!result
7250 <!-- foo -->
7251 <p typeof="mw:Transclusion">Bar
7252 </p>
7253 !!end
7254
7255 !!test
7256 Templates: Inline Text: 1. Multiple tmeplate uses
7257 !!input
7258 {{echo|Foo}}bar{{echo|baz}}
7259 !!result
7260 <p>Foobarbaz
7261 </p>
7262 !!end
7263
7264 !!test
7265 Templates: Inline Text: 2. Back-to-back template uses
7266 !!input
7267 {{echo|Foo}}{{echo|bar}}
7268 !!result
7269 <p>Foobar
7270 </p>
7271 !!end
7272
7273 !!test
7274 Templates: Block Tags: 1. Multiple template uses
7275 !!input
7276 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
7277 !!result
7278 <div>Foo</div><div>bar</div><div>baz</div>
7279
7280 !!end
7281
7282 !!test
7283 Templates: Block Tags: 2. Back-to-back template uses
7284 !!input
7285 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
7286 !!result
7287 <div>Foo</div><div>bar</div>
7288
7289 !!end
7290
7291 !!test
7292 Templates: Links: 1. Simple example
7293 !!input
7294 {{echo|[[Foo|bar]]}}
7295 !!result
7296 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7297 </p>
7298 !!end
7299
7300 !!test
7301 Templates: Links: 2. Generation of link href
7302 !!input
7303 [[{{echo|Foo}}|bar]]
7304 !!result
7305 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7306 </p>
7307 !!end
7308
7309 !!test
7310 Templates: Links: 3. Generation of part of a link href
7311 !!input
7312 [[Fo{{echo|o}}|bar]]
7313
7314 [[Foo{{echo|bar}}]]
7315
7316 [[Foo{{echo|bar}}baz]]
7317
7318 [[Foo{{echo|bar}}|bar]]
7319
7320 [[:Foo{{echo|bar}}]]
7321
7322 [[:Foo{{echo|bar}}|bar]]
7323 !!result
7324 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7325 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7326 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
7327 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7328 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7329 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7330 </p>
7331 !!end
7332
7333 !!test
7334 Templates: Links: 4. Multiple templates generating link href
7335 !!input
7336 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
7337 !!result
7338 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7339 </p>
7340 !!end
7341
7342 !!test
7343 Templates: Links: 5. Generation of link text
7344 !!input
7345 [[Foo|{{echo|bar}}]]
7346 !!result
7347 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7348 </p>
7349 !!end
7350
7351 !!test
7352 Templates: Links: 5. Nested templates (only outermost template should be marked)
7353 !!input
7354 {{echo|[[{{echo|Foo}}|bar]]}}
7355 !!result
7356 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7357 </p>
7358 !!end
7359
7360 !!test
7361 Templates: HTML Tag: 1. Generation of HTML attr. key
7362 !!input
7363 <div {{echo|style}}="color:red;">foo</div>
7364 !!result
7365 <div style="color:red;">foo</div>
7366
7367 !!end
7368
7369 !!test
7370 Templates: HTML Tag: 2. Generation of HTML attr. value
7371 !!input
7372 <div style={{echo|'color:red;'}}>foo</div>
7373 !!result
7374 <div style="color:red;">foo</div>
7375
7376 !!end
7377
7378 !!test
7379 Templates: HTML Tag: 3. Generation of HTML attr key and value
7380 !!input
7381 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
7382 !!result
7383 <div style="color:red;">foo</div>
7384
7385 !!end
7386
7387 !!test
7388 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
7389 !!input
7390 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
7391 !!result
7392 <div title="This is a long title with just one piece templated">foo</div>
7393
7394 !!end
7395
7396 !!test
7397 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
7398 !!input
7399 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
7400 !!result
7401 <div title="This is a long title with just one piece templated">foo</div>
7402
7403 !!end
7404
7405 !!test
7406 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
7407 !!input
7408 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
7409 !!result
7410 <div title="This is a long title with just one piece templated">foo</div>
7411
7412 !!end
7413
7414 !!test
7415 Templates: HTML Tag: 7. Generation of partial attribute key string
7416 !!input
7417 <div st{{echo|yle}}="color:red;">foo</div>
7418 !!result
7419 <div style="color:red;">foo</div>
7420
7421 !!end
7422
7423 !!test
7424 Templates: HTML Tables: 1. Generating start of a HTML table
7425 !!input
7426 {{echo|<table><tr><td>foo</td>}}</tr></table>
7427 !!result
7428 <table><tr><td>foo</td></tr></table>
7429
7430 !!end
7431
7432 !!test
7433 Templates: HTML Tables: 2a. Generating middle of a HTML table
7434 !!input
7435 <table><tr>{{echo|<td>foo</td>}}</tr></table>
7436 !!result
7437 <table><tr><td>foo</td></tr></table>
7438
7439 !!end
7440
7441 !!test
7442 Templates: HTML Tables: 2b. Generating middle of a HTML table
7443 !!input
7444 <table>{{echo|<tr><td>foo</td></tr>}}</table>
7445 !!result
7446 <table><tr><td>foo</td></tr></table>
7447
7448 !!end
7449
7450 !!test
7451 Templates: HTML Tables: 3. Generating end of a HTML table
7452 !!input
7453 <table><tr>{{echo|<td>foo</td></tr></table>}}
7454 !!result
7455 <table><tr><td>foo</td></tr></table>
7456
7457 !!end
7458
7459 !!test
7460 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
7461 !!input
7462 {{echo|<table>}}<tr><td>foo</td></tr></table>
7463 !!result
7464 <table><tr><td>foo</td></tr></table>
7465
7466 !!end
7467
7468 !!test
7469 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
7470 !!input
7471 <table>{{echo|<tr>}}<td>foo</td></tr></table>
7472 !!result
7473 <table><tr><td>foo</td></tr></table>
7474
7475 !!end
7476
7477 !!test
7478 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
7479 !!input
7480 <table><tr>{{echo|<td>}}foo</td></tr></table>
7481 !!result
7482 <table><tr><td>foo</td></tr></table>
7483
7484 !!end
7485
7486 !!test
7487 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
7488 !!input
7489 <table><tr><td>foo{{echo|</td>}}</tr></table>
7490 !!result
7491 <table><tr><td>foo</td></tr></table>
7492
7493 !!end
7494
7495 !!test
7496 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
7497 !!input
7498 <table><tr><td>foo</td>{{echo|</tr>}}</table>
7499 !!result
7500 <table><tr><td>foo</td></tr></table>
7501
7502 !!end
7503
7504 !!test
7505 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
7506 !!input
7507 <table><tr><td>foo</td></tr>{{echo|</table>}}
7508 !!result
7509 <table><tr><td>foo</td></tr></table>
7510
7511 !!end
7512
7513 !!test
7514 Templates: HTML Tables: 5. Proper fostering of categories from inside
7515 !!options
7516 parsoid=wt2html,wt2wt
7517 !!input
7518 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
7519 <!--Two categories (Bug 50330)-->
7520 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
7521 !!result
7522 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
7523 <!--Two categories (Bug 50330)-->
7524 <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>
7525 !!end
7526
7527 !!test
7528 Templates: Wiki Tables: 1a. Fostering of entire template content
7529 !!input
7530 {|
7531 {{echo|a}}
7532 |}
7533 !!result
7534 <table>
7535 a
7536 <tr><td></td></tr></table>
7537
7538 !!end
7539
7540 !!test
7541 Templates: Wiki Tables: 1b. Fostering of entire template content
7542 !!input
7543 {|
7544 {{echo|<div>}}
7545 foo
7546 {{echo|</div>}}
7547 |}
7548 !!result
7549 <table>
7550 <div>
7551 <p>foo
7552 </p>
7553 </div>
7554 <tr><td></td></tr></table>
7555
7556 !!end
7557
7558 !!test
7559 Templates: Wiki Tables: 2. Fostering of partial template content
7560 !!input
7561 {|
7562 {{echo|a
7563 <div>b</div>}}
7564 |}
7565 !!result
7566 <table>
7567 a
7568 <div>b</div>
7569 <tr><td></td></tr></table>
7570
7571 !!end
7572
7573 !!test
7574 Templates: Wiki Tables: 3. td-content via multiple templates
7575 !!input
7576 {|
7577 {{echo|{{pipe}}a}}{{echo|b}}
7578 |}
7579 !!result
7580 <table>
7581 <tr>
7582 <td>ab
7583 </td></tr></table>
7584
7585 !!end
7586
7587 !!test
7588 Templates: Wiki Tables: 4. Templated tags, no content
7589 !!input
7590 {{tbl-start}}
7591 {{tbl-end}}
7592 !!result
7593 <table>
7594 <tr><td></td></tr></table>
7595
7596 !!end
7597
7598 !!test
7599 Templates: Wiki Tables: 5. Templated tags, regular td-tags
7600 !!input
7601 {{tbl-start}}
7602 |foo
7603 {{tbl-end}}
7604 !!result
7605 <table>
7606 <tr>
7607 <td>foo
7608 </td></tr></table>
7609
7610 !!end
7611
7612 !!test
7613 Templates: Wiki Tables: 6. Templated tags, templated td-tags
7614 !!input
7615 {{tbl-start}}
7616 {{!}}foo
7617 {{tbl-end}}
7618 !!result
7619 <table>
7620 <tr>
7621 <td>foo
7622 </td></tr></table>
7623
7624 !!end
7625
7626 !!test
7627 Templates: Lists: Multi-line list-items via templates
7628 !!input
7629 *{{echo|a {{nonexistent|
7630 unused}}}}
7631 *{{echo|b {{nonexistent|
7632 unused}}}}
7633 !!result
7634 <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>
7635 </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>
7636 </li></ul>
7637
7638 !!end
7639
7640 !!test
7641 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
7642 !!input
7643 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
7644 !!result
7645 <p><i>ab</i>c<i>d</i>e
7646 </p>
7647 !!end
7648
7649 !!test
7650 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7651 (PHP parser generates misnested html)
7652 !! options
7653 parsoid=wt2html,wt2wt
7654 !!input
7655 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
7656 !!result
7657 <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>
7658 !!end
7659
7660 !!test
7661 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
7662 (PHP parser generates misnested html)
7663 !! options
7664 parsoid=wt2html,wt2wt
7665 !!input
7666 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
7667 !!result
7668 <div typeof="mw:Transclusion"><i>a</i></div>
7669 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
7670 <div typeof="mw:Transclusion">e</div>
7671 !!end
7672
7673 !!test
7674 Templates: Ugly nesting: 4. Divs opened/closed across templates
7675 !!input
7676 a<div>b{{echo|c</div>d}}e
7677 !!result
7678 a<div>bc</div>de
7679
7680 !!end
7681
7682 !!test
7683 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
7684 (Parsoid-centric)
7685 !! options
7686 parsoid
7687 !!input
7688 {|
7689 |{{echo|foo</table>}}
7690 |bar
7691 |}
7692 !!result
7693 <table typeof="mw:Transclusion">
7694 <tbody>
7695 <tr>
7696 <td>foo</td></tr></tbody></table><span>bar</span>
7697 !!end
7698
7699 !!test
7700 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
7701 (Parsoid-centric)
7702 !! options
7703 parsoid
7704 !!input
7705 <table>
7706 <tr>
7707 <td>
7708 <table>
7709 <tr>
7710 <td>1. {{echo|foo </table>}}</td>
7711 <td> bar </td>
7712 <td>2. {{echo|baz </table>}}</td>
7713 </tr>
7714 <tr>
7715 <td>abc</td>
7716 </tr>
7717 </table>
7718 </td>
7719 </tr>
7720 <tr>
7721 <td>xyz</td>
7722 </tr>
7723 </table>
7724 !!result
7725 <table about="#mwt1" typeof="mw:Transclusion">
7726 <tbody><tr >
7727 <td >
7728 <table >
7729 <tbody><tr >
7730 <td >1. foo </td></tr></tbody></table></td>
7731 <td > bar </td>
7732 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
7733 </span><span about="#mwt1">
7734
7735 abc</span><span about="#mwt1">
7736 </span><span about="#mwt1">
7737 </span><span about="#mwt1">
7738 </span><span about="#mwt1">
7739 </span><span about="#mwt1">
7740
7741 xyz</span><span about="#mwt1">
7742 </span><span about="#mwt1">
7743 </span>
7744 !!end
7745
7746 !! test
7747 Templates: Ugly templates: 3. newline-only template parameter
7748 !! input
7749 foo {{echo|
7750 }}
7751 !! result
7752 <p>foo
7753 </p>
7754 !! end
7755
7756 # This looks like a bug: a single newline triggers p/br for some reason.
7757 !! test
7758 Templates: Ugly templates: 4. newline-only template parameter inconsistency
7759 !! input
7760 {{echo|
7761 }}
7762 !! result
7763 <p><br />
7764 </p>
7765 !! end
7766
7767
7768 !!test
7769 Parser Functions: 1. Simple example
7770 !!input
7771 {{uc:foo}}
7772 !!result
7773 <p>FOO
7774 </p>
7775 !!end
7776
7777 !!test
7778 Parser Functions: 2. Nested use (only outermost should be marked up)
7779 !!input
7780 {{uc:{{lc:FOO}}}}
7781 !!result
7782 <p>FOO
7783 </p>
7784 !!end
7785
7786 ###
7787 ### Pre-save transform tests
7788 ###
7789 !! test
7790 pre-save transform: subst:
7791 !! options
7792 PST
7793 !! input
7794 {{subst:test}}
7795 !! result
7796 This is a test template
7797 !! end
7798
7799 !! test
7800 pre-save transform: normal template
7801 !! options
7802 PST
7803 !! input
7804 {{test}}
7805 !! result
7806 {{test}}
7807 !! end
7808
7809 !! test
7810 pre-save transform: nonexistent template
7811 !! options
7812 PST
7813 !! input
7814 {{thistemplatedoesnotexist}}
7815 !! result
7816 {{thistemplatedoesnotexist}}
7817 !! end
7818
7819
7820 !! test
7821 pre-save transform: subst magic variables
7822 !! options
7823 PST
7824 !! input
7825 {{subst:SITENAME}}
7826 !! result
7827 MediaWiki
7828 !! end
7829
7830 # This is bug 89, which I fixed. -- wtm
7831 !! test
7832 pre-save transform: subst: templates with parameters
7833 !! options
7834 pst
7835 !! input
7836 {{subst:paramtest|param="something else"}}
7837 !! result
7838 This is a test template with parameter "something else"
7839 !! end
7840
7841 !! article
7842 Template:nowikitest
7843 !! text
7844 <nowiki>'''not wiki'''</nowiki>
7845 !! endarticle
7846
7847 !! test
7848 pre-save transform: nowiki in subst (bug 1188)
7849 !! options
7850 pst
7851 !! input
7852 {{subst:nowikitest}}
7853 !! result
7854 <nowiki>'''not wiki'''</nowiki>
7855 !! end
7856
7857
7858 !! article
7859 Template:commenttest
7860 !! text
7861 This template has <!-- a comment --> in it.
7862 !! endarticle
7863
7864 !! test
7865 pre-save transform: comment in subst (bug 1936)
7866 !! options
7867 pst
7868 !! input
7869 {{subst:commenttest}}
7870 !! result
7871 This template has <!-- a comment --> in it.
7872 !! end
7873
7874 !! test
7875 pre-save transform: unclosed tag
7876 !! options
7877 pst noxml
7878 !! input
7879 <nowiki>'''not wiki'''
7880 !! result
7881 <nowiki>'''not wiki'''
7882 !! end
7883
7884 !! test
7885 pre-save transform: mixed tag case
7886 !! options
7887 pst noxml
7888 !! input
7889 <NOwiki>'''not wiki'''</noWIKI>
7890 !! result
7891 <NOwiki>'''not wiki'''</noWIKI>
7892 !! end
7893
7894 !! test
7895 pre-save transform: unclosed comment in <nowiki>
7896 !! options
7897 pst noxml
7898 !! input
7899 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7900 !! result
7901 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7902 !!end
7903
7904 # Leading @ in this template definition works around a limitation
7905 # in parsoid's parserTests which otherwise strips the <span> from the
7906 # result (confusing it for a template wrapper)
7907 !! article
7908 Template:dangerous
7909 !!text
7910 @<span onmouseover="alert('crap')">Oh no</span>
7911 !!endarticle
7912
7913 !!test
7914 (confirming safety of fix for subst bug 1936)
7915 !! input
7916 {{Template:dangerous}}
7917 !! result
7918 <p>@<span>Oh no</span>
7919 </p>
7920 !! end
7921
7922 !! test
7923 pre-save transform: comment containing gallery (bug 5024)
7924 !! options
7925 pst
7926 !! input
7927 <!-- <gallery>data</gallery> -->
7928 !!result
7929 <!-- <gallery>data</gallery> -->
7930 !!end
7931
7932 !! test
7933 pre-save transform: comment containing extension
7934 !! options
7935 pst
7936 !! input
7937 <!-- <tag>data</tag> -->
7938 !!result
7939 <!-- <tag>data</tag> -->
7940 !!end
7941
7942 !! test
7943 pre-save transform: comment containing nowiki
7944 !! options
7945 pst
7946 !! input
7947 <!-- <nowiki>data</nowiki> -->
7948 !!result
7949 <!-- <nowiki>data</nowiki> -->
7950 !!end
7951
7952 !! test
7953 pre-save transform: <noinclude> in subst (bug 3298)
7954 !! options
7955 pst
7956 !! input
7957 {{subst:Includes}}
7958 !! result
7959 Foobar
7960 !! end
7961
7962 !! test
7963 pre-save transform: <onlyinclude> in subst (bug 3298)
7964 !! options
7965 pst
7966 !! input
7967 {{subst:Includes2}}
7968 !! result
7969 Foo
7970 !! end
7971
7972 !! article
7973 Template:SubstTest
7974 !!text
7975 {{<includeonly>subst:</includeonly>Includes}}
7976 !! endarticle
7977
7978 !! article
7979 Template:SafeSubstTest
7980 !! text
7981 {{<includeonly>safesubst:</includeonly>Includes}}
7982 !! endarticle
7983
7984 !! test
7985 bug 22297: safesubst: works during PST
7986 !! options
7987 pst
7988 !! input
7989 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
7990 !! result
7991 FoobarFoobar
7992 !! end
7993
7994 !! test
7995 bug 22297: safesubst: works during normal parse
7996 !! input
7997 {{SafeSubstTest}}
7998 !! result
7999 <p>Foobar
8000 </p>
8001 !! end
8002
8003 !! test:
8004 subst: does not work during normal parse
8005 !! input
8006 {{SubstTest}}
8007 !! result
8008 <p>{{subst:Includes}}
8009 </p>
8010 !! end
8011
8012 !! test
8013 pre-save transform: context links ("pipe trick")
8014 !! options
8015 pst
8016 !! input
8017 [[Article (context)|]]
8018 [[Bar:Article|]]
8019 [[:Bar:Article|]]
8020 [[Bar:Article (context)|]]
8021 [[:Bar:Article (context)|]]
8022 [[|Article]]
8023 [[|Article (context)]]
8024 [[Bar:X (Y) Z|]]
8025 [[:Bar:X (Y) Z|]]
8026 !! result
8027 [[Article (context)|Article]]
8028 [[Bar:Article|Article]]
8029 [[:Bar:Article|Article]]
8030 [[Bar:Article (context)|Article]]
8031 [[:Bar:Article (context)|Article]]
8032 [[Article]]
8033 [[Article (context)]]
8034 [[Bar:X (Y) Z|X (Y) Z]]
8035 [[:Bar:X (Y) Z|X (Y) Z]]
8036 !! end
8037
8038 !! test
8039 pre-save transform: context links ("pipe trick") with interwiki prefix
8040 !! options
8041 pst
8042 !! input
8043 [[interwiki:Article|]]
8044 [[:interwiki:Article|]]
8045 [[interwiki:Bar:Article|]]
8046 [[:interwiki:Bar:Article|]]
8047 !! result
8048 [[interwiki:Article|Article]]
8049 [[:interwiki:Article|Article]]
8050 [[interwiki:Bar:Article|Bar:Article]]
8051 [[:interwiki:Bar:Article|Bar:Article]]
8052 !! end
8053
8054 !! test
8055 pre-save transform: context links ("pipe trick") with parens in title
8056 !! options
8057 pst title=[[Somearticle (context)]]
8058 !! input
8059 [[|Article]]
8060 !! result
8061 [[Article (context)|Article]]
8062 !! end
8063
8064 !! test
8065 pre-save transform: context links ("pipe trick") with comma in title
8066 !! options
8067 pst title=[[Someplace, Somewhere]]
8068 !! input
8069 [[|Otherplace]]
8070 [[Otherplace, Elsewhere|]]
8071 [[Otherplace, Elsewhere, Anywhere|]]
8072 !! result
8073 [[Otherplace, Somewhere|Otherplace]]
8074 [[Otherplace, Elsewhere|Otherplace]]
8075 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
8076 !! end
8077
8078 !! test
8079 pre-save transform: context links ("pipe trick") with parens and comma
8080 !! options
8081 pst title=[[Someplace (IGNORED), Somewhere]]
8082 !! input
8083 [[|Otherplace]]
8084 [[Otherplace (place), Elsewhere|]]
8085 !! result
8086 [[Otherplace, Somewhere|Otherplace]]
8087 [[Otherplace (place), Elsewhere|Otherplace]]
8088 !! end
8089
8090 !! test
8091 pre-save transform: context links ("pipe trick") with comma and parens
8092 !! options
8093 pst title=[[Who, me? (context)]]
8094 !! input
8095 [[|Yes, you.]]
8096 [[Me, Myself, and I (1937 song)|]]
8097 !! result
8098 [[Yes, you. (context)|Yes, you.]]
8099 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
8100 !! end
8101
8102 !! test
8103 pre-save transform: context links ("pipe trick") with namespace
8104 !! options
8105 pst title=[[Ns:Somearticle]]
8106 !! input
8107 [[|Article]]
8108 !! result
8109 [[Ns:Article|Article]]
8110 !! end
8111
8112 !! test
8113 pre-save transform: context links ("pipe trick") with namespace and parens
8114 !! options
8115 pst title=[[Ns:Somearticle (context)]]
8116 !! input
8117 [[|Article]]
8118 !! result
8119 [[Ns:Article (context)|Article]]
8120 !! end
8121
8122 !! test
8123 pre-save transform: context links ("pipe trick") with namespace and comma
8124 !! options
8125 pst title=[[Ns:Somearticle, Context, Whatever]]
8126 !! input
8127 [[|Article]]
8128 !! result
8129 [[Ns:Article, Context, Whatever|Article]]
8130 !! end
8131
8132 !! test
8133 pre-save transform: context links ("pipe trick") with namespace, comma and parens
8134 !! options
8135 pst title=[[Ns:Somearticle, Context (context)]]
8136 !! input
8137 [[|Article]]
8138 !! result
8139 [[Ns:Article (context)|Article]]
8140 !! end
8141
8142 !! test
8143 pre-save transform: context links ("pipe trick") with namespace, parens and comma
8144 !! options
8145 pst title=[[Ns:Somearticle (IGNORED), Context]]
8146 !! input
8147 [[|Article]]
8148 !! result
8149 [[Ns:Article, Context|Article]]
8150 !! end
8151
8152 !! test
8153 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
8154 !! options
8155 pst
8156 !! input
8157 [[Article(context)|]]
8158 [[Bar:Article(context)|]]
8159 [[:Bar:Article(context)|]]
8160 [[|Article(context)]]
8161 [[Bar:X(Y)Z|]]
8162 [[:Bar:X(Y)Z|]]
8163 !! result
8164 [[Article(context)|Article]]
8165 [[Bar:Article(context)|Article]]
8166 [[:Bar:Article(context)|Article]]
8167 [[Article(context)]]
8168 [[Bar:X(Y)Z|X(Y)Z]]
8169 [[:Bar:X(Y)Z|X(Y)Z]]
8170 !! end
8171
8172 !! test
8173 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
8174 !! options
8175 pst
8176 !! input
8177 [[Article (context)|]]
8178 [[Bar:Article (context)|]]
8179 [[:Bar:Article (context)|]]
8180 [[|Article (context)]]
8181 [[Bar:X (Y) Z|]]
8182 [[:Bar:X (Y) Z|]]
8183 !! result
8184 [[Article (context)|Article]]
8185 [[Bar:Article (context)|Article]]
8186 [[:Bar:Article (context)|Article]]
8187 [[Article (context)]]
8188 [[Bar:X (Y) Z|X (Y) Z]]
8189 [[:Bar:X (Y) Z|X (Y) Z]]
8190 !! end
8191
8192 !! test
8193 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
8194 !! options
8195 pst
8196 !! input
8197 [[Article(context)|]]
8198 [[Bar:Article(context)|]]
8199 [[:Bar:Article(context)|]]
8200 [[|Article(context)]]
8201 [[Bar:X(Y)Z|]]
8202 [[:Bar:X(Y)Z|]]
8203 !! result
8204 [[Article(context)|Article]]
8205 [[Bar:Article(context)|Article]]
8206 [[:Bar:Article(context)|Article]]
8207 [[Article(context)]]
8208 [[Bar:X(Y)Z|X(Y)Z]]
8209 [[:Bar:X(Y)Z|X(Y)Z]]
8210 !! end
8211
8212 !! test
8213 pre-save transform: context links ("pipe trick") with commas (bug 21660)
8214 !! options
8215 pst
8216 !! input
8217 [[Article (context), context|]]
8218 [[Article (context),context|]]
8219 [[Bar:Article (context), context|]]
8220 [[Bar:Article (context),context|]]
8221 [[:Bar:Article (context), context|]]
8222 [[:Bar:Article (context),context|]]
8223 !! result
8224 [[Article (context), context|Article]]
8225 [[Article (context),context|Article]]
8226 [[Bar:Article (context), context|Article]]
8227 [[Bar:Article (context),context|Article]]
8228 [[:Bar:Article (context), context|Article]]
8229 [[:Bar:Article (context),context|Article]]
8230 !! end
8231
8232 !! test
8233 pre-save transform: trim trailing empty lines
8234 !! options
8235 pst
8236 !! input
8237 Empty lines are trimmed
8238
8239
8240
8241
8242 !! result
8243 Empty lines are trimmed
8244 !! end
8245
8246 !! test
8247 pre-save transform: Signature expansion
8248 !! options
8249 pst
8250 !! input
8251 * ~~~
8252 * <noinclude>~~~</noinclude>
8253 * <includeonly>~~~</includeonly>
8254 * <onlyinclude>~~~</onlyinclude>
8255 !! result
8256 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
8257 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
8258 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
8259 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
8260 !! end
8261
8262
8263 !! test
8264 pre-save transform: Signature expansion in nowiki tags (bug 93)
8265 !! options
8266 pst disabled
8267 !! input
8268 Shall not expand:
8269
8270 <nowiki>~~~~</nowiki>
8271
8272 <includeonly><nowiki>~~~~</nowiki></includeonly>
8273
8274 <noinclude><nowiki>~~~~</nowiki></noinclude>
8275
8276 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8277
8278 {{subst:Foo}} shall be converted to FOO
8279
8280 As well as inside noinclude/onlyinclude
8281 <noinclude>{{subst:Foo}}</noinclude>
8282 <onlyinclude>{{subst:Foo}}</onlyinclude>
8283
8284 But not inside includeonly
8285 <includeonly>{{subst:Foo}}</includeonly>
8286 !! result
8287 Shall not expand:
8288
8289 <nowiki>~~~~</nowiki>
8290
8291 <includeonly><nowiki>~~~~</nowiki></includeonly>
8292
8293 <noinclude><nowiki>~~~~</nowiki></noinclude>
8294
8295 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8296
8297 FOO shall be converted to FOO
8298
8299 As well as inside noinclude/onlyinclude
8300 <noinclude>FOO</noinclude>
8301 <onlyinclude>FOO</onlyinclude>
8302
8303 But not inside includeonly
8304 <includeonly>{{subst:Foo}}</includeonly>
8305 !! end
8306
8307 !! test
8308 Parsoid: Recognize nowiki with trailing space in tags
8309 !! options
8310 parsoid=wt2html
8311 !! input
8312 <nowiki ><div>[[foo]]</nowiki >
8313
8314 a<nowiki / >b
8315
8316 c<nowiki />d
8317
8318 e<nowiki/ >f
8319 !! result
8320 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8321 <p>ab</p>
8322 <p>cd</p>
8323 <p>ef</p>
8324 !! end
8325
8326 !! test
8327 Parsoid: Recognize nowiki with odd capitalization
8328 !! options
8329 parsoid=wt2html
8330 !! input
8331 <noWikI ><div>[[foo]]</Nowiki >
8332 !! result
8333 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8334 !! end
8335
8336
8337 !! test
8338 Parsoid: Escape nowiki with trailing space in tags
8339 !! options
8340 parsoid=html2wt
8341 !! input
8342 &lt;nowiki &gt; foo &lt;/nowiki &gt;
8343
8344 a&lt;nowiki /&gt;b
8345
8346 c&lt;nowiki/ &gt;d
8347 !! result
8348 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
8349 <p>a&lt;nowiki /&gt;b</p>
8350 <p>c&lt;nowiki/ &gt;d</p>
8351 !! end
8352
8353 !! test
8354 Parsoid: Escape weird noWikI capitalizations
8355 !! options
8356 parsoid=html2wt
8357 !! input
8358 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
8359 !! result
8360 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
8361 !! end
8362
8363 ###
8364 ### Message transform tests
8365 ###
8366 !! test
8367 message transform: magic variables
8368 !! options
8369 msg
8370 !! input
8371 {{SITENAME}}
8372 !! result
8373 MediaWiki
8374 !! end
8375
8376 !! test
8377 message transform: should not transform wiki markup
8378 !! options
8379 msg
8380 !! input
8381 ''test''
8382 !! result
8383 ''test''
8384 !! end
8385
8386 !! test
8387 message transform: <noinclude> in transcluded template (bug 4926)
8388 !! options
8389 msg
8390 !! input
8391 {{Includes}}
8392 !! result
8393 Foobar
8394 !! end
8395
8396 !! test
8397 message transform: <onlyinclude> in transcluded template (bug 4926)
8398 !! options
8399 msg
8400 !! input
8401 {{Includes2}}
8402 !! result
8403 Foo
8404 !! end
8405
8406 !! test
8407 {{#special:}} page name, known
8408 !! options
8409 msg
8410 !! input
8411 {{#special:Recentchanges}}
8412 !! result
8413 Special:RecentChanges
8414 !! end
8415
8416 !! test
8417 {{#special:}} page name with subpage, known
8418 !! options
8419 msg
8420 !! input
8421 {{#special:Recentchanges/param}}
8422 !! result
8423 Special:RecentChanges/param
8424 !! end
8425
8426 !! test
8427 {{#special:}} page name, unknown
8428 !! options
8429 msg
8430 !! input
8431 {{#special:foobar nonexistent}}
8432 !! result
8433 Special:Foobar nonexistent
8434 !! end
8435
8436 !! test
8437 {{#speciale:}} page name, known
8438 !! options
8439 msg
8440 !! input
8441 {{#speciale:Recentchanges}}
8442 !! result
8443 Special:RecentChanges
8444 !! end
8445
8446 !! test
8447 {{#speciale:}} page name with subpage, known
8448 !! options
8449 msg
8450 !! input
8451 {{#speciale:Recentchanges/param}}
8452 !! result
8453 Special:RecentChanges/param
8454 !! end
8455
8456 !! test
8457 {{#speciale:}} page name, unknown
8458 !! options
8459 msg
8460 !! input
8461 {{#speciale:foobar nonexistent}}
8462 !! result
8463 Special:Foobar_nonexistent
8464 !! end
8465
8466 ###
8467 ### Images
8468 ###
8469 ### For Parsoid-specific tests, see
8470 #### http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8471
8472 !! test
8473 Simple image (php)
8474 !! options
8475 php
8476 !! input
8477 [[Image:foobar.jpg]]
8478 !! result
8479 <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>
8480 </p>
8481 !! end
8482
8483 !! test
8484 Simple image (parsoid)
8485 !! options
8486 parsoid=wt2html
8487 !! input
8488 [[Image:foobar.jpg]]
8489 !! result
8490 <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>
8491 </p>
8492 !! end
8493
8494 !! test
8495 Simple image (using File: namespace, now canonical) (php)
8496 !! options
8497 php
8498 !! input
8499 [[File:foobar.jpg]]
8500 !! result
8501 <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>
8502 </p>
8503 !! end
8504
8505 !! test
8506 Simple image (using File: namespace, now canonical) (parsoid)
8507 !! options
8508 parsoid
8509 !! input
8510 [[File:Foobar.jpg]]
8511 !! result
8512 <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>
8513 </p>
8514 !! end
8515
8516 !! test
8517 Right-aligned image (php)
8518 !! options
8519 php
8520 !! input
8521 [[Image:foobar.jpg|right]]
8522 !! result
8523 <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>
8524
8525 !! end
8526
8527 !! test
8528 Right-aligned image (parsoid)
8529 !! options
8530 parsoid
8531 !! input
8532 [[File:Foobar.jpg|right]]
8533 !! result
8534 <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>
8535 !! end
8536
8537 !! test
8538 Image with caption (php)
8539 !! options
8540 php
8541 !! input
8542 [[File:Foobar.jpg|right|Caption text]]
8543 !! result
8544 <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>
8545
8546 !! end
8547
8548 !! test
8549 Image with caption (parsoid)
8550 !! options
8551 parsoid
8552 !! input
8553 [[File:Foobar.jpg|right|Caption text]]
8554 !! result
8555 <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>
8556 !! end
8557
8558 !! test
8559 Image with empty attribute (php)
8560 !! options
8561 php
8562 !! input
8563 [[File:Foobar.jpg|right||Caption text]]
8564 !! result
8565 <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>
8566
8567 !! end
8568
8569 !! test
8570 Image with empty attribute (parsoid)
8571 !! options
8572 parsoid=wt2html
8573 !! input
8574 [[File:Foobar.jpg|right||Caption text]]
8575 !! result
8576 <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>
8577 !! end
8578
8579 !! test
8580 Image with attributes from template (php)
8581 !! options
8582 php
8583 !! input
8584 [[File:Foobar.jpg|{{image_attribs}}]]
8585 !! result
8586 <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>
8587
8588 !! end
8589
8590 !! test
8591 Image with attributes from template (parsoid)
8592 !! options
8593 parsoid
8594 !! input
8595 [[File:Foobar.jpg|{{image_attribs}}]]
8596 !! result
8597 <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>
8598 !! end
8599
8600 !! test
8601 Image with link tails (php)
8602 !! options
8603 php
8604 !! input
8605 123[[File:Foobar.jpg]]456
8606 123[[File:Foobar.jpg|right]]456
8607 123[[File:Foobar.jpg|thumb]]456
8608 !! result
8609 <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
8610 </p>
8611 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
8612 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
8613
8614 !! end
8615
8616 !! test
8617 Image with link tails (parsoid)
8618 !! options
8619 parsoid
8620 !! input
8621 123[[File:Foobar.jpg]]456
8622 123[[File:Foobar.jpg|right]]456
8623 123[[File:Foobar.jpg|thumb]]456
8624 !! result
8625 <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>
8626 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
8627 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
8628 !! end
8629
8630 !! test
8631 Image with multiple captions -- only last one is accepted (php)
8632 !! options
8633 php
8634 !! input
8635 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8636 !! result
8637 <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>
8638
8639 !! end
8640
8641 !! test
8642 Image with multiple captions -- only last one is accepted (parsoid)
8643 !! options
8644 parsoid
8645 !! input
8646 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8647 !! result
8648 <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>
8649 !! end
8650
8651 !! test
8652 Image with width attribute at different positions (php)
8653 !! options
8654 php
8655 !! input
8656 [[File:Foobar.jpg|200px|right|Caption]]
8657 [[File:Foobar.jpg|right|200px|Caption]]
8658 [[File:Foobar.jpg|right|Caption|200px]]
8659 !! result
8660 <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>
8661 <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>
8662 <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>
8663
8664 !! end
8665
8666 !! test
8667 Image with width attribute at different positions (parsoid)
8668 !! options
8669 parsoid
8670 !! input
8671 [[File:Foobar.jpg|200px|right|Caption]]
8672 [[File:Foobar.jpg|right|200px|Caption]]
8673 [[File:Foobar.jpg|right|Caption|200px]]
8674 !! result
8675 <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>
8676 <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>
8677 <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>
8678 !! end
8679
8680 !! test
8681 Image with link parameter, wiki target (php)
8682 !! options
8683 php
8684 !! input
8685 [[File:Foobar.jpg|link=Main Page]]
8686 !! result
8687 <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>
8688 </p>
8689 !! end
8690
8691 !! test
8692 Image with link parameter, wiki target (parsoid)
8693 !! options
8694 parsoid
8695 !! input
8696 [[File:Foobar.jpg|link=Main Page]]
8697 !! result
8698 <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>
8699 !! end
8700
8701 !! test
8702 Image with link parameter, URL target (php)
8703 !! options
8704 php
8705 !! input
8706 [[File:Foobar.jpg|link=http://example.com/]]
8707 !! result
8708 <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>
8709 </p>
8710 !! end
8711
8712 # parsoid bug 49293 (part 1)
8713 !! test
8714 Image with link parameter, URL target (parsoid)
8715 !! options
8716 parsoid
8717 !! input
8718 [[File:Foobar.jpg|link=http://example.com/]]
8719 !! result
8720 <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>
8721 !! end
8722
8723 !! test
8724 Image with link parameter, protocol-less URL target (php)
8725 !! options
8726 php
8727 !! input
8728 [[File:Foobar.jpg|link=//example.com/]]
8729 !! result
8730 <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>
8731 </p>
8732 !! end
8733
8734 # parsoid bug 49293 (part 2)
8735 !! test
8736 Image with link parameter, protocol-less URL target (parsoid)
8737 !! options
8738 parsoid
8739 !! input
8740 [[File:Foobar.jpg|link=//example.com/]]
8741 !! result
8742 <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>
8743 !! end
8744
8745 !! test
8746 Image with link parameter, wgExternalLinkTarget
8747 !! input
8748 [[Image:foobar.jpg|link=http://example.com/]]
8749 !! config
8750 wgExternalLinkTarget='foobar'
8751 !! result
8752 <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>
8753 </p>
8754 !! end
8755
8756 !! test
8757 Image with link parameter, wgNoFollowLinks set to false
8758 !! input
8759 [[Image:foobar.jpg|link=http://example.com/]]
8760 !! config
8761 wgNoFollowLinks=false
8762 !! result
8763 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8764 </p>
8765 !! end
8766
8767 !! test
8768 Image with link parameter, wgNoFollowDomainExceptions
8769 !! input
8770 [[Image:foobar.jpg|link=http://example.com/]]
8771 !! config
8772 wgNoFollowDomainExceptions='example.com'
8773 !! result
8774 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8775 </p>
8776 !! end
8777
8778 !! test
8779 Image with link parameter, wgExternalLinkTarget, unnamed parameter
8780 !! input
8781 [[Image:foobar.jpg|link=http://example.com/|Title]]
8782 !! config
8783 wgExternalLinkTarget='foobar'
8784 !! result
8785 <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>
8786 </p>
8787 !! end
8788
8789 !! test
8790 Image with empty link parameter (php)
8791 !! options
8792 php
8793 !! input
8794 [[File:Foobar.jpg|link=]]
8795 !! result
8796 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
8797 </p>
8798 !! end
8799
8800 !! test
8801 Image with empty link parameter (parsoid)
8802 !! options
8803 parsoid
8804 !! input
8805 [[File:Foobar.jpg|link=]]
8806 !! result
8807 <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>
8808 !! end
8809
8810 !! test
8811 Image with link parameter (wiki target) and unnamed parameter (php)
8812 !! options
8813 php
8814 !! input
8815 [[File:Foobar.jpg|link=Main Page|Title]]
8816 !! result
8817 <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>
8818 </p>
8819 !! end
8820
8821 !! test
8822 Image with link parameter (wiki target) and unnamed parameter (parsoid)
8823 !! options
8824 parsoid
8825 !! input
8826 [[File:Foobar.jpg|link=Main Page|Title]]
8827 !! result
8828 <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>
8829 !! end
8830
8831 !! test
8832 Image with link parameter (URL target) and unnamed parameter (php)
8833 !! options
8834 php
8835 !! input
8836 [[File:Foobar.jpg|link=http://example.com/|Title]]
8837 !! result
8838 <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>
8839 </p>
8840 !! end
8841
8842 !! test
8843 Image with link parameter (URL target) and unnamed parameter (parsoid)
8844 !! options
8845 parsoid
8846 !! input
8847 [[File:Foobar.jpg|link=http://example.com/|Title]]
8848 !! result
8849 <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>
8850 !! end
8851
8852 !! test
8853 Thumbnail image with link parameter
8854 !! options
8855 php
8856 !! input
8857 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
8858 !! result
8859 <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>
8860
8861 !! end
8862
8863 !! test
8864 Manually-specified thumbnail image
8865 !! options
8866 php
8867 !! input
8868 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
8869 !! result
8870 <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>
8871
8872 !! end
8873
8874 !! test
8875 Manually-specified thumbnail image with explicit link to wiki page
8876 !! options
8877 php
8878 !! input
8879 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
8880 !! result
8881 <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>
8882
8883 !! end
8884
8885 !! test
8886 Manually-specified thumbnail image with explicit link to url
8887 !! options
8888 php
8889 !! input
8890 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
8891 !! result
8892 <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>
8893
8894 !! end
8895
8896 !! test
8897 Manually-specified thumbnail image with explicit no link
8898 !! options
8899 php
8900 !! input
8901 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
8902 !! result
8903 <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>
8904
8905 !! end
8906
8907 !! test
8908 Manually-specified thumbnail image with explicit link and alt text
8909 !! options
8910 php
8911 !! input
8912 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
8913 !! result
8914 <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>
8915
8916 !! end
8917
8918 !! test
8919 Image with frame and link
8920 !! input
8921 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
8922 !! result
8923 <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>
8924
8925 !! end
8926
8927 !! test
8928 Image with frame and link and explicit alt
8929 !! input
8930 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
8931 !! result
8932 <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>
8933
8934 !! end
8935
8936 !! test
8937 Image with wiki markup in implicit alt
8938 !! input
8939 [[Image:Foobar.jpg|testing '''bold''' in alt]]
8940 !! result
8941 <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>
8942 </p>
8943 !! end
8944
8945 !! test
8946 Image with wiki markup in explicit alt
8947 !! input
8948 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
8949 !! result
8950 <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>
8951 </p>
8952 !! end
8953
8954 !! test
8955 Link to image page- image page normally doesn't exists, hence edit link
8956 Add test with existing image page
8957 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
8958 !! input
8959 [[:Image:test]]
8960 !! result
8961 <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>
8962 </p>
8963 !! end
8964
8965 !! test
8966 bug 18784 Link to non-existent image page with caption should use caption as link text
8967 !! input
8968 [[:Image:test|caption]]
8969 !! result
8970 <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>
8971 </p>
8972 !! end
8973
8974 !! test
8975 Frameless image caption with a free URL
8976 !! input
8977 [[Image:foobar.jpg|http://example.com]]
8978 !! result
8979 <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>
8980 </p>
8981 !! end
8982
8983 !! test
8984 Thumbnail image caption with a free URL
8985 !! input
8986 [[Image:foobar.jpg|thumb|http://example.com]]
8987 !! result
8988 <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>
8989
8990 !! end
8991
8992 !! test
8993 Thumbnail image caption with a free URL and explicit alt
8994 !! input
8995 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
8996 !! result
8997 <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>
8998
8999 !! end
9000
9001 !! test
9002 SVG thumbnails with no language set
9003 !! options
9004 !! input
9005 [[File:Foobar.svg|thumb|width=200]]
9006 !! result
9007 <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>
9008
9009 !! end
9010
9011 !! test
9012 SVG thumbnails with language de
9013 !! options
9014 !! input
9015 [[File:Foobar.svg|thumb|width=200|lang=de]]
9016 !! result
9017 <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>
9018
9019 !! end
9020
9021 !! test
9022 SVG thumbnails with invalid language code
9023 !! options
9024 !! input
9025 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
9026 !! result
9027 <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>
9028
9029 !! end
9030
9031 !! test
9032 BUG 1887: A ISBN with a thumbnail
9033 !! input
9034 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
9035 !! result
9036 <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>
9037
9038 !! end
9039
9040 !! test
9041 BUG 1887: A RFC with a thumbnail
9042 !! input
9043 [[Image:foobar.jpg|thumb|This is RFC 12354]]
9044 !! result
9045 <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>
9046
9047 !! end
9048
9049 !! test
9050 BUG 1887: A mailto link with a thumbnail
9051 !! input
9052 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
9053 !! result
9054 <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>
9055
9056 !! end
9057
9058 # Pending resolution to bug 368
9059 !! test
9060 BUG 648: Frameless image caption with a link
9061 !! input
9062 [[Image:foobar.jpg|text with a [[link]] in it]]
9063 !! result
9064 <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>
9065 </p>
9066 !! end
9067
9068 !! test
9069 BUG 648: Frameless image caption with a link (suffix)
9070 !! input
9071 [[Image:foobar.jpg|text with a [[link]]foo in it]]
9072 !! result
9073 <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>
9074 </p>
9075 !! end
9076
9077 !! test
9078 BUG 648: Frameless image caption with an interwiki link
9079 !! input
9080 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
9081 !! result
9082 <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>
9083 </p>
9084 !! end
9085
9086 !! test
9087 BUG 648: Frameless image caption with a piped interwiki link
9088 !! input
9089 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
9090 !! result
9091 <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>
9092 </p>
9093 !! end
9094
9095 !! test
9096 Escape HTML special chars in image alt text
9097 !! input
9098 [[Image:foobar.jpg|& < > "]]
9099 !! result
9100 <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>
9101 </p>
9102 !! end
9103
9104 !! test
9105 BUG 499: Alt text should have &#1234;, not &amp;1234;
9106 !! input
9107 [[Image:foobar.jpg|&#9792;]]
9108 !! result
9109 <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>
9110 </p>
9111 !! end
9112
9113 !! test
9114 Broken image caption with link
9115 !! input
9116 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
9117 !! result
9118 <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.
9119 </p>
9120 !! end
9121
9122 !! test
9123 Image caption containing another image
9124 !! input
9125 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
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>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>
9128
9129 !! end
9130
9131 !! test
9132 Image caption containing a newline
9133 !! input
9134 [[Image:Foobar.jpg|This
9135 *is some text]]
9136 !! result
9137 <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>
9138 </p>
9139 !!end
9140
9141 !!test
9142 Parsoid: Image caption containing leading space
9143 (The leading space should not trigger nowiki escaping in wt2wt mode)
9144 !! input
9145 [[Image:Foobar.jpg|thumb| bar]]
9146 !! result
9147 <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>
9148
9149 !!end
9150
9151 !! test
9152 Bug 3090: External links other than http: in image captions
9153 !! input
9154 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
9155 !! result
9156 <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>
9157
9158 !! end
9159
9160 !! test
9161 Custom class
9162 !! input
9163 [[Image:foobar.jpg|a|class=b]]
9164 !! result
9165 <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>
9166 </p>
9167 !! end
9168
9169 !! test
9170 Localized image handling (1).
9171 !! options
9172 language=es
9173 !! input
9174 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
9175 !! result
9176 <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>
9177
9178 !! end
9179
9180 !! test
9181 Localized image handling (2).
9182 !! options
9183 language=es
9184 !! input
9185 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
9186 !! result
9187 <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>
9188
9189 !! end
9190
9191 !! test
9192 "border", "frameless" and "class" attributes on an image.
9193 !! input
9194 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
9195 !! result
9196 <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>
9197 </p>
9198 !! end
9199
9200 !! article
9201 File:Barfoo.jpg
9202 !! text
9203 #REDIRECT [[File:Barfoo.jpg]]
9204 !! endarticle
9205
9206 !! test
9207 Redirected image
9208 !! input
9209 [[Image:Barfoo.jpg]]
9210 !! result
9211 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
9212 </p>
9213 !! end
9214
9215 !! test
9216 Missing image with uploads disabled
9217 !! options
9218 wgEnableUploads=0
9219 !! input
9220 [[Image:Foobaz.jpg]]
9221 !! result
9222 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
9223 </p>
9224 !! end
9225
9226 # Parsoid-specific testing for images
9227 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9228 # Currently imperfect due to a flaw in the Parsoid testrunner
9229 # Work in progress
9230 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
9231 # image tests.
9232
9233 !! test
9234 Parsoid-specific image handling - simple image with size and middle alignment
9235 !! options
9236 parsoid
9237 !! input
9238 [[Image:Foobar.jpg|50px|middle]]
9239 !! result
9240 <p>
9241 <span class="mw-valign-middle" typeof="mw:Image">
9242 <a href="File:Foobar.jpg">
9243 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
9244 </a>
9245 </span>
9246 </p>
9247 !! end
9248
9249 !! test
9250 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
9251 !! options
9252 parsoid
9253 !! input
9254 [[Image:Foobar.jpg|500x10px|baseline|caption]]
9255 !! result
9256 <p>
9257 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9258 <a href="File:Foobar.jpg">
9259 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
9260 </a>
9261 </span>
9262 </p>
9263 !! end
9264
9265 !! test
9266 Parsoid-specific image handling - simple image with border and size spec
9267 !! options
9268 parsoid
9269 !! input
9270 [[Image:Foobar.jpg|50px|border|caption]]
9271 !! result
9272 <p>
9273 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9274 <a href="File:Foobar.jpg">
9275 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
9276 </a>
9277 </span>
9278 </p>
9279 !! end
9280
9281 !! test
9282 Parsoid-specific image handling - thumbnail with halign, valign, and caption
9283 !! options
9284 parsoid
9285 !! input
9286 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
9287 !! result
9288 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
9289 <a href="File:Foobar.jpg">
9290 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
9291 </a>
9292 <figcaption>caption content</figcaption>
9293 </figure>
9294 !! end
9295
9296 !! test
9297 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
9298 !! options
9299 parsoid
9300 !! input
9301 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
9302 !! result
9303 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
9304 <a href="File:Foobar.jpg">
9305 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
9306 </a>
9307 <figcaption>caption</figcaption>
9308 </figure>
9309 !! end
9310
9311 !! test
9312 Parsoid-specific image handling - framed image with specific size and caption
9313 !! options
9314 parsoid
9315 !! input
9316 [[Image:Foobar.jpg|500x50px|frame|caption]]
9317 !! result
9318 <figure typeof="mw:Image/Frame">
9319 <a href="File:Foobar.jpg">
9320 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9321 </a>
9322 <figcaption>caption</figcaption>
9323 </figure>
9324 !! end
9325
9326 !! test
9327 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
9328 !! options
9329 parsoid
9330 !! input
9331 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
9332 !! result
9333 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
9334 <a href="File:Foobar.jpg">
9335 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9336 </a>
9337 <figcaption>caption</figcaption>
9338 </figure>
9339 !! end
9340
9341 !! test
9342 Parsoid-specific image handling - frameless image with specific size, border, and caption
9343 !! options
9344 parsoid
9345 !! input
9346 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
9347 !! result
9348 <p>
9349 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9350 <a href="File:Foobar.jpg">
9351 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9352 </a>
9353 </p>
9354 !! end
9355
9356 #!! test
9357 #Parsoid-specific image handling - simple image with a formatted caption
9358 #!! options
9359 #parsoid
9360 #!! input
9361 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
9362 #!! result
9363 #<p>
9364 #<span typeof="mw:Image">
9365 #<a class="mw-default-size" href="Image:Foobar.jpg">
9366 #<img alt="Foobar.jpg" class="mw-default-size" src="http://example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
9367 #</a>
9368 #<span>abc</span>
9369 #</span>
9370 #</p>
9371
9372
9373 ###
9374 ### Subpages
9375 ###
9376 !! article
9377 Subpage test/subpage
9378 !! text
9379 foo
9380 !! endarticle
9381
9382 !! test
9383 Subpage link
9384 !! options
9385 subpage title=[[Subpage test]]
9386 !! input
9387 [[/subpage]]
9388 !! result
9389 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
9390 </p>
9391 !! end
9392
9393 !! test
9394 Subpage noslash link
9395 !! options
9396 subpage title=[[Subpage test]]
9397 !!input
9398 [[/subpage/]]
9399 !! result
9400 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
9401 </p>
9402 !! end
9403
9404 # TODO: make this PHP-parser compatible!
9405 !! test
9406 Relative subpage noslash link
9407 !! options
9408 parsoid=wt2wt,wt2html,html2html
9409 subpage title=[[Subpage test/1/2/3/4]]
9410 !!input
9411 [[../../subpage/]]
9412
9413 [[../../subpage]]
9414 !! result
9415 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
9416 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
9417 !! end
9418
9419 # TODO: make this PHP-parser compatible!
9420 !! test
9421 Parsoid: dot-slash prefixed wikilinks
9422 !! options
9423 parsoid=wt2wt,wt2html,html2html
9424 !!input
9425 [[./foo]]
9426
9427 [[././bar]]
9428
9429 [[././baz/]]
9430 !! result
9431 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
9432 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
9433 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
9434 !! end
9435
9436 !! test
9437 Disabled subpages
9438 !! input
9439 [[/subpage]]
9440 !! result
9441 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
9442 </p>
9443 !! end
9444
9445 !! test
9446 BUG 561: {{/Subpage}}
9447 !! options
9448 subpage title=[[Page]]
9449 !! input
9450 {{/Subpage}}
9451 !! result
9452 <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>
9453 </p>
9454 !! end
9455
9456 ###
9457 ### Categories
9458 ###
9459 !! article
9460 Category:MediaWiki User's Guide
9461 !! text
9462 blah
9463 !! endarticle
9464
9465 !! test
9466 Link to category
9467 !! input
9468 [[:Category:MediaWiki User's Guide]]
9469 !! result
9470 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
9471 </p>
9472 !! end
9473
9474 !! test
9475 Simple category
9476 !! options
9477 cat
9478 !! input
9479 [[Category:MediaWiki User's Guide]]
9480 !! result
9481 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9482 !! end
9483
9484 !! test
9485 PAGESINCATEGORY invalid title fatal (r33546 fix)
9486 !! input
9487 {{PAGESINCATEGORY:<bogus>}}
9488 !! result
9489 <p>0
9490 </p>
9491 !! end
9492
9493 !! test
9494 Category with different sort key
9495 !! options
9496 cat
9497 !! input
9498 [[Category:MediaWiki User's Guide|Foo]]
9499 !! result
9500 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9501 !! end
9502
9503 !! test
9504 Category with identical sort key
9505 !! options
9506 cat
9507 !! input
9508 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9509 !! result
9510 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9511 !! end
9512
9513 !! test
9514 Category with empty sort key
9515 !! options
9516 cat
9517 pst
9518 !! input
9519 [[Category:MediaWiki User's Guide|]]
9520 !! result
9521 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9522 !! end
9523
9524 !! test
9525 Category with empty sort key and parentheses
9526 !! options
9527 cat
9528 pst
9529 !! input
9530 [[Category:Foo (bar)|]]
9531 !! result
9532 [[Category:Foo (bar)|Foo]]
9533 !! end
9534
9535 !! test
9536 Category with link tail
9537 !! options
9538 cat
9539 pst
9540 !! input
9541 123[[Category:Foo]]456
9542 !! result
9543 123[[Category:Foo]]456
9544 !! end
9545
9546 !! test
9547 Category with template
9548 !! options
9549 cat
9550 pst
9551 !! input
9552 [[Category:{{echo|Foo}}]]
9553 !! result
9554 [[Category:{{echo|Foo}}]]
9555 !! end
9556
9557 !! test
9558 Category with template in sort key
9559 !! options
9560 cat
9561 pst
9562 !! input
9563 [[Category:Foo|{{echo|Bar}}]]
9564 !! result
9565 [[Category:Foo|{{echo|Bar}}]]
9566 !! end
9567
9568 !! test
9569 Category with template in sort key and title
9570 !! options
9571 cat
9572 pst
9573 !! input
9574 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9575 !! result
9576 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9577 !! end
9578
9579 !! test
9580 Category / paragraph interactions
9581 !! input
9582 Foo [[Category:Baz]] Bar
9583
9584 Foo [[Category:Baz]]
9585 Bar
9586
9587 Foo
9588 [[Category:Baz]]
9589 Bar
9590
9591 Foo
9592 [[Category:Baz]] Bar
9593
9594 Foo
9595 [[Category:Baz]]
9596 [[Category:Baz]]
9597 [[Category:Baz]]
9598 Bar
9599
9600 [[Category:Baz]]
9601 [[Category:Baz]]
9602 [[Category:Baz]]
9603
9604 [[Category:Baz]]
9605 {{echo|[[Category:Baz]]}}
9606 [[Category:Baz]]
9607 !! result
9608 <p>Foo Bar
9609 </p><p>Foo
9610 Bar
9611 </p><p>Foo
9612 Bar
9613 </p><p>Foo Bar
9614 </p><p>Foo
9615 Bar
9616 </p>
9617 !! end
9618
9619 !! test
9620 Parsoid: Serialize link to category page with colon escape
9621 !! options
9622 parsoid
9623 !! input
9624
9625 [[:Category:Foo]]
9626 [[:Category:Foo|Bar]]
9627 !! result
9628 <p>
9629 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
9630 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
9631 </p>
9632 !! end
9633
9634 !! test
9635 Parsoid: Link prefix/suffixes aren't applied to category links
9636 !! options
9637 parsoid=wt2html,wt2wt,html2html
9638 language=is
9639 !! input
9640 x[[Category:Foo]]y
9641 !! result
9642 <p>x<link rel="mw:WikiLink/Category" href="Category:Foo">y</p>
9643 !! end
9644
9645 !! test
9646 Parsoid: Serialize link to file page with colon escape
9647 !! options
9648 parsoid
9649 !! input
9650
9651 [[:File:Foo.png]]
9652 [[:File:Foo.png|Bar]]
9653 !! result
9654 <p>
9655 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
9656 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
9657 </p>
9658 !! end
9659
9660 !! test
9661 Parsoid: Serialize a genuine category link without colon escape
9662 !! options
9663 parsoid
9664 !! input
9665 [[Category:Foo]]
9666 [[Category:Foo|Bar]]
9667 !! result
9668 <link rel="mw:WikiLink/Category" href="Category:Foo">
9669 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
9670 !! end
9671
9672 ###
9673 ### Inter-language links
9674 ###
9675 !! test
9676 Inter-language links
9677 !! options
9678 ill
9679 !! input
9680 [[es:Alimento]]
9681 [[fr:Nourriture]]
9682 [[zh:&#39135;&#21697;]]
9683 !! result
9684 es:Alimento fr:Nourriture zh:食品
9685 !! end
9686
9687 !! test
9688 Duplicate interlanguage links (bug 24502)
9689 !! options
9690 ill
9691 !! input
9692 [[es:1]]
9693 [[es:2]]
9694 [[fr:1]]
9695 [[fr:2]]
9696 !! result
9697 es:1 fr:1
9698 !! end
9699
9700 ###
9701 ### Sections
9702 ###
9703 !! test
9704 Basic section headings
9705 !! input
9706 == Headline 1 ==
9707 Some text
9708
9709 ==Headline 2==
9710 More
9711 ===Smaller headline===
9712 Blah blah
9713 !! result
9714 <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>
9715 <p>Some text
9716 </p>
9717 <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>
9718 <p>More
9719 </p>
9720 <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>
9721 <p>Blah blah
9722 </p>
9723 !! end
9724
9725 !! test
9726 Section headings with TOC
9727 !! input
9728 == Headline 1 ==
9729 === Subheadline 1 ===
9730 ===== Skipping a level =====
9731 ====== Skipping a level ======
9732
9733 == Headline 2 ==
9734 Some text
9735 ===Another headline===
9736 !! result
9737 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9738 <ul>
9739 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
9740 <ul>
9741 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
9742 <ul>
9743 <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>
9744 <ul>
9745 <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>
9746 </ul>
9747 </li>
9748 </ul>
9749 </li>
9750 </ul>
9751 </li>
9752 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
9753 <ul>
9754 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
9755 </ul>
9756 </li>
9757 </ul>
9758 </div>
9759 <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>
9760 <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>
9761 <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>
9762 <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>
9763 <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>
9764 <p>Some text
9765 </p>
9766 <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>
9767
9768 !! end
9769
9770 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
9771 !! test
9772 Handling of sections up to level 6 and beyond
9773 !! input
9774 = Level 1 Heading=
9775 == Level 2 Heading==
9776 === Level 3 Heading===
9777 ==== Level 4 Heading====
9778 ===== Level 5 Heading=====
9779 ====== Level 6 Heading======
9780 ======= Level 7 Heading=======
9781 ======== Level 8 Heading========
9782 ========= Level 9 Heading=========
9783 ========== Level 10 Heading==========
9784 !! result
9785 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9786 <ul>
9787 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
9788 <ul>
9789 <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>
9790 <ul>
9791 <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>
9792 <ul>
9793 <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>
9794 <ul>
9795 <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>
9796 <ul>
9797 <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>
9798 <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>
9799 <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>
9800 <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>
9801 <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>
9802 </ul>
9803 </li>
9804 </ul>
9805 </li>
9806 </ul>
9807 </li>
9808 </ul>
9809 </li>
9810 </ul>
9811 </li>
9812 </ul>
9813 </div>
9814 <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>
9815 <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>
9816 <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>
9817 <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>
9818 <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>
9819 <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>
9820 <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>
9821 <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>
9822 <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>
9823 <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>
9824
9825 !! end
9826
9827 !! test
9828 TOC regression (bug 9764)
9829 !! input
9830 == title 1 ==
9831 === title 1.1 ===
9832 ==== title 1.1.1 ====
9833 === title 1.2 ===
9834 == title 2 ==
9835 === title 2.1 ===
9836 !! result
9837 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9838 <ul>
9839 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9840 <ul>
9841 <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>
9842 <ul>
9843 <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>
9844 </ul>
9845 </li>
9846 <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>
9847 </ul>
9848 </li>
9849 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9850 <ul>
9851 <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>
9852 </ul>
9853 </li>
9854 </ul>
9855 </div>
9856 <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>
9857 <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>
9858 <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>
9859 <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>
9860 <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>
9861 <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>
9862
9863 !! end
9864
9865 !! test
9866 TOC with wgMaxTocLevel=3 (bug 6204)
9867 !! options
9868 wgMaxTocLevel=3
9869 !! input
9870 == title 1 ==
9871 === title 1.1 ===
9872 ==== title 1.1.1 ====
9873 === title 1.2 ===
9874 == title 2 ==
9875 === title 2.1 ===
9876 !! result
9877 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9878 <ul>
9879 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9880 <ul>
9881 <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>
9882 <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>
9883 </ul>
9884 </li>
9885 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9886 <ul>
9887 <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>
9888 </ul>
9889 </li>
9890 </ul>
9891 </div>
9892 <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>
9893 <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>
9894 <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>
9895 <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>
9896 <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>
9897 <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>
9898
9899 !! end
9900
9901 !! test
9902 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
9903 !! options
9904 wgMaxTocLevel=3
9905 !! input
9906 ==Section 1==
9907 ===Section 1.1===
9908 ====Section 1.1.1====
9909 ====Section 1.1.1.1====
9910 ==Section 2==
9911 !! result
9912 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9913 <ul>
9914 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
9915 <ul>
9916 <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>
9917 </ul>
9918 </li>
9919 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
9920 </ul>
9921 </div>
9922 <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>
9923 <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>
9924 <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>
9925 <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>
9926 <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>
9927
9928 !! end
9929
9930
9931 !! test
9932 Resolving duplicate section names
9933 !! input
9934 == Foo bar ==
9935 == Foo bar ==
9936 !! result
9937 <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>
9938 <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>
9939
9940 !! end
9941
9942 !! test
9943 Resolving duplicate section names with differing case (bug 10721)
9944 !! input
9945 == Foo bar ==
9946 == Foo Bar ==
9947 !! result
9948 <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>
9949 <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>
9950
9951 !! end
9952
9953 !! article
9954 Template:sections
9955 !! text
9956 ===Section 1===
9957 ==Section 2==
9958 !! endarticle
9959
9960 !! test
9961 Template with sections, __NOTOC__
9962 !! input
9963 __NOTOC__
9964 ==Section 0==
9965 {{sections}}
9966 ==Section 4==
9967 !! result
9968 <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>
9969 <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>
9970 <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>
9971 <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>
9972
9973 !! end
9974
9975 !! test
9976 __NOEDITSECTION__ keyword
9977 !! input
9978 __NOEDITSECTION__
9979 ==Section 1==
9980 ==Section 2==
9981 !! result
9982 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
9983 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
9984
9985 !! end
9986
9987 !! test
9988 Link inside a section heading
9989 !! input
9990 ==Section with a [[Main Page|link]] in it==
9991 !! result
9992 <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>
9993
9994 !! end
9995
9996 !! test
9997 TOC regression (bug 12077)
9998 !! input
9999 __TOC__
10000 == title 1 ==
10001 === title 1.1 ===
10002 == title 2 ==
10003 !! result
10004 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10005 <ul>
10006 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10007 <ul>
10008 <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>
10009 </ul>
10010 </li>
10011 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
10012 </ul>
10013 </div>
10014 <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>
10015 <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>
10016 <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>
10017
10018 !! end
10019
10020 !! test
10021 BUG 1219 URL next to image (good)
10022 !! input
10023 http://example.com [[Image:foobar.jpg]]
10024 !! result
10025 <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>
10026 </p>
10027 !!end
10028
10029 !! test
10030 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
10031 !! input
10032 ===
10033 The line above must have a trailing space!
10034 === <!--
10035 --> <!-- -->
10036 But just in case it doesn't...
10037 !! result
10038 <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>
10039 <p>The line above must have a trailing space!
10040 </p>
10041 <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>
10042 <p>But just in case it doesn't...
10043 </p>
10044 !! end
10045
10046 !! test
10047 Header with special characters (bug 25462)
10048 !! input
10049 The tooltips shall not show entities to the user (ie. be double escaped)
10050
10051 == text > text ==
10052 section 1
10053
10054 == text < text ==
10055 section 2
10056
10057 == text & text ==
10058 section 3
10059
10060 == text ' text ==
10061 section 4
10062
10063 == text " text ==
10064 section 5
10065 !! result
10066 <p>The tooltips shall not show entities to the user (ie. be double escaped)
10067 </p>
10068 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10069 <ul>
10070 <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>
10071 <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>
10072 <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>
10073 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
10074 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
10075 </ul>
10076 </div>
10077 <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>
10078 <p>section 1
10079 </p>
10080 <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>
10081 <p>section 2
10082 </p>
10083 <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>
10084 <p>section 3
10085 </p>
10086 <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>
10087 <p>section 4
10088 </p>
10089 <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>
10090 <p>section 5
10091 </p>
10092 !! end
10093
10094 !! test
10095 Headers with excess '=' characters
10096 (Are similar tests necessary beyond the 1st level?)
10097 !! input
10098 =foo==
10099 ==foo=
10100 =''italic'' heading==
10101 ==''italic'' heading=
10102 !! result
10103 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10104 <ul>
10105 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
10106 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
10107 <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>
10108 <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>
10109 </ul>
10110 </div>
10111 <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>
10112 <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>
10113 <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>
10114 <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>
10115
10116 !! end
10117
10118 !! test
10119 HTML headers vs TOC (bug 23393)
10120 (__NOEDITSECTION__ for clearer output, doesn't matter here)
10121 !! input
10122 <h1>Header 1</h1>
10123 == Header 1.1 ==
10124 == Header 1.2 ==
10125
10126 <h1>Header 2
10127 </h1>
10128 == Header 2.1 ==
10129 == Header 2.2 ==
10130 __NOEDITSECTION__
10131 !! result
10132 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10133 <ul>
10134 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
10135 <ul>
10136 <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>
10137 <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>
10138 </ul>
10139 </li>
10140 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
10141 <ul>
10142 <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>
10143 <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>
10144 </ul>
10145 </li>
10146 </ul>
10147 </div>
10148 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
10149 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
10150 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
10151 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
10152 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
10153 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
10154
10155 !! end
10156
10157 !! test
10158 BUG 1219 URL next to image (broken)
10159 !! input
10160 http://example.com[[Image:foobar.jpg]]
10161 !! result
10162 <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>
10163 </p>
10164 !!end
10165
10166 !! test
10167 Bug 1186 news: in the middle of text
10168 !! input
10169 http://en.wikinews.org/wiki/Wikinews:Workplace
10170 !! result
10171 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
10172 </p>
10173 !!end
10174
10175
10176 !! test
10177 Namespaced link must have a title
10178 !! input
10179 [[Project:]]
10180 !! result
10181 <p>[[Project:]]
10182 </p>
10183 !!end
10184
10185 !! test
10186 Namespaced link must have a title (bad fragment version)
10187 !! input
10188 [[Project:#fragment]]
10189 !! result
10190 <p>[[Project:#fragment]]
10191 </p>
10192 !!end
10193
10194
10195 ###
10196 ### HTML tags and HTML attributes
10197 ###
10198
10199 !! test
10200 div with no attributes
10201 !! input
10202 <div>HTML rocks</div>
10203 !! result
10204 <div>HTML rocks</div>
10205
10206 !! end
10207
10208 !! test
10209 div with double-quoted attribute
10210 !! input
10211 <div id="rock">HTML rocks</div>
10212 !! result
10213 <div id="rock">HTML rocks</div>
10214
10215 !! end
10216
10217 !! test
10218 div with single-quoted attribute
10219 !! input
10220 <div id='rock'>HTML rocks</div>
10221 !! result
10222 <div id="rock">HTML rocks</div>
10223
10224 !! end
10225
10226 !! test
10227 div with unquoted attribute
10228 !! input
10229 <div id=rock>HTML rocks</div>
10230 !! result
10231 <div id="rock">HTML rocks</div>
10232
10233 !! end
10234
10235 !! test
10236 div with illegal double attributes
10237 !! input
10238 <div id="a" id="b">HTML rocks</div>
10239 !! result
10240 <div id="b">HTML rocks</div>
10241
10242 !!end
10243
10244 # FIXME: produce empty string instead of "class" in the PHP parser, following
10245 # the HTML5 spec.
10246 !! test
10247 div with empty attribute value, space before equals
10248 !! options
10249 parsoid
10250 !! input
10251 <div class =>HTML rocks</div>
10252 !! result
10253 <div class="">HTML rocks</div>
10254
10255 !! end
10256
10257 # The PHP parser escapes the opening brace to &#123; for some reason, so
10258 # disabled this test for it.
10259 !! test
10260 div with braces in attribute value
10261 !! options
10262 parsoid
10263 !! input
10264 <div title="{}">Foo</div>
10265 !! result
10266 <div title="{}">Foo</div>
10267 !! end
10268
10269 # This it very inconsistent in the PHP parser: it returns
10270 # class="class" if there is a space between the name and the equal sign (see
10271 # 'div with empty attribute value, space before equals'), but strips the
10272 # attribute completely if the space is missing. We hope that not much content
10273 # depends on this, so are implementing the behavior below in Parsoid for
10274 # consistencies' sake. Disabled for the PHP parser.
10275 # FIXME: fix this behavior in the PHP parser?
10276 !! test
10277 div with empty attribute value, no space before equals
10278 !! options
10279 parsoid
10280 !! input
10281 <div class=>HTML rocks</div>
10282 !! result
10283 <div class="">HTML rocks</div>
10284
10285 !! end
10286
10287 !! test
10288 HTML multiple attributes correction
10289 !! input
10290 <p class="error" class="awesome">Awesome!</p>
10291 !! result
10292 <p class="awesome">Awesome!</p>
10293
10294 !!end
10295
10296 !! test
10297 Table multiple attributes correction
10298 !! input
10299 {|
10300 !+ class="error" class="awesome"| status
10301 |}
10302 !! result
10303 <table>
10304 <tr>
10305 <th class="awesome"> status
10306 </th></tr></table>
10307
10308 !!end
10309
10310 !! test
10311 DIV IN UPPERCASE
10312 !! input
10313 <DIV ID="x">HTML ROCKS</DIV>
10314 !! result
10315 <div id="x">HTML ROCKS</div>
10316
10317 !!end
10318
10319 !! test
10320 Non-ASCII pseudo-tags are rendered as text
10321 !! input
10322 <khyô>
10323 !! result
10324 <p>&lt;khyô&gt;
10325 </p>
10326 !! end
10327
10328 !! test
10329 Pseudo-tag with URL 'name' renders as url link
10330 !! input
10331 <http://example.com/>
10332 !! result
10333 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
10334 </p>
10335 !! end
10336
10337 !! test
10338 text with amp in the middle of nowhere
10339 !! input
10340 Remember AT&T?
10341 !!result
10342 <p>Remember AT&amp;T?
10343 </p>
10344 !! end
10345
10346 !! test
10347 text with character entity: eacute
10348 !! input
10349 I always thought &eacute; was a cute letter.
10350 !! result
10351 <p>I always thought &#233; was a cute letter.
10352 </p>
10353 !! end
10354
10355 !! test
10356 text with entity-escaped character entity-like string: eacute
10357 !! input
10358 I always thought &amp;eacute; was a cute letter.
10359 !! result
10360 <p>I always thought &amp;eacute; was a cute letter.
10361 </p>
10362 !! end
10363
10364 !! test
10365 text with undefined character entity: xacute
10366 !! input
10367 I always thought &xacute; was a cute letter.
10368 !! result
10369 <p>I always thought &amp;xacute; was a cute letter.
10370 </p>
10371 !! end
10372
10373
10374 ###
10375 ### Nesting tests (see bug 41545, 50604, 51081)
10376 ###
10377
10378 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
10379 # Note that html2wt is considerably more difficult if we use <b> in
10380 # the test case, instead of <big>
10381 !! test
10382 Ensure that HTML adoption agency algorithm is properly implemented.
10383 !! input
10384 <big>X<big>Y</big>Z</big>
10385 !! result
10386 <p><big>X<big>Y</big>Z</big>
10387 </p>
10388 !! end
10389
10390 # This was bug 41545 in the PHP parser.
10391 !! test
10392 Nesting of <kbd>
10393 !! input
10394 <kbd>X<kbd>Y</kbd>Z</kbd>
10395 !! result
10396 <p><kbd>X<kbd>Y</kbd>Z</kbd>
10397 </p>
10398 !! end
10399
10400 # The following cases were bug 51081 in the PHP parser.
10401 # Note that there are some other nestable tags (b, i, etc) which are
10402 # not covered; see bug 51081 for discussion.
10403 !! test
10404 Nesting of <em>
10405 !! input
10406 <em>X<em>Y</em>Z</em>
10407 !! result
10408 <p><em>X<em>Y</em>Z</em>
10409 </p>
10410 !! end
10411
10412 !! test
10413 Nesting of <strong>
10414 !! input
10415 <strong>X<strong>Y</strong>Z</strong>
10416 !! result
10417 <p><strong>X<strong>Y</strong>Z</strong>
10418 </p>
10419 !! end
10420
10421 !! test
10422 Nesting of <q>
10423 !! input
10424 <q>X<q>Y</q>Z</q>
10425 !! result
10426 <p><q>X<q>Y</q>Z</q>
10427 </p>
10428 !! end
10429
10430 !! test
10431 Nesting of <ruby>
10432 !! input
10433 <ruby>X<ruby>Y</ruby>Z</ruby>
10434 !! result
10435 <p><ruby>X<ruby>Y</ruby>Z</ruby>
10436 </p>
10437 !! end
10438
10439 !! test
10440 Nesting of <bdo>
10441 !! input
10442 <bdo>X<bdo>Y</bdo>Z</bdo>
10443 !! result
10444 <p><bdo>X<bdo>Y</bdo>Z</bdo>
10445 </p>
10446 !! end
10447
10448
10449 ###
10450 ### Media links
10451 ###
10452
10453 !! test
10454 Media link
10455 !! input
10456 [[Media:Foobar.jpg]]
10457 !! result
10458 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
10459 </p>
10460 !! end
10461
10462 !! test
10463 Media link with text
10464 !! input
10465 [[Media:Foobar.jpg|A neat file to look at]]
10466 !! result
10467 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
10468 </p>
10469 !! end
10470
10471 # FIXME: this is still bad HTML tag nesting
10472 !! test
10473 Media link with nasty text
10474 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
10475 !! input
10476 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
10477 !! result
10478 <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>
10479
10480 !! end
10481
10482 !! test
10483 Media link to nonexistent file (bug 1702)
10484 !! input
10485 [[Media:No such.jpg]]
10486 !! result
10487 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
10488 </p>
10489 !! end
10490
10491 !! test
10492 Image link to nonexistent file (bug 1850 - good)
10493 !! input
10494 [[Image:No such.jpg]]
10495 !! result
10496 <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>
10497 </p>
10498 !! end
10499
10500 !! test
10501 :Image link to nonexistent file (bug 1850 - bad)
10502 !! input
10503 [[:Image:No such.jpg]]
10504 !! result
10505 <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>
10506 </p>
10507 !! end
10508
10509
10510
10511 !! test
10512 Character reference normalization in link text (bug 1938)
10513 !! input
10514 [[Main Page|this&that]]
10515 !! result
10516 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
10517 </p>
10518 !!end
10519
10520 !! article
10521 אַ
10522 !! text
10523 Test for unicode normalization
10524
10525 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
10526 !! endarticle
10527
10528 !! test
10529 (bug 19451) Links should refer to the normalized form.
10530 !! input
10531 [[&#xFB2E;]]
10532 [[&#x5d0;&#x5b7;]]
10533 [[&#x5d0;ַ]]
10534 [[א&#x5b7;]]
10535 [[אַ]]
10536 !! result
10537 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
10538 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
10539 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
10540 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
10541 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
10542 </p>
10543 !! end
10544
10545 !! test
10546 Empty attribute crash test (bug 2067)
10547 !! input
10548 <font color="">foo</font>
10549 !! result
10550 <p><font color="">foo</font>
10551 </p>
10552 !! end
10553
10554 !! test
10555 Empty attribute crash test single-quotes (bug 2067)
10556 !! input
10557 <font color=''>foo</font>
10558 !! result
10559 <p><font color="">foo</font>
10560 </p>
10561 !! end
10562
10563 !! test
10564 Attribute test: equals, then nothing
10565 !! input
10566 <font color=>foo</font>
10567 !! result
10568 <p><font>foo</font>
10569 </p>
10570 !! end
10571
10572 !! test
10573 Attribute test: unquoted value
10574 !! input
10575 <font color=x>foo</font>
10576 !! result
10577 <p><font color="x">foo</font>
10578 </p>
10579 !! end
10580
10581 !! test
10582 Attribute test: unquoted but illegal value (hash)
10583 !! input
10584 <font color=#x>foo</font>
10585 !! result
10586 <p><font color="#x">foo</font>
10587 </p>
10588 !! end
10589
10590 !! test
10591 Attribute test: no value
10592 !! input
10593 <font color>foo</font>
10594 !! result
10595 <p><font color="color">foo</font>
10596 </p>
10597 !! end
10598
10599 !! test
10600 Bug 2095: link with three closing brackets
10601 !! input
10602 [[Main Page]]]
10603 !! result
10604 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
10605 </p>
10606 !! end
10607
10608 !! test
10609 Bug 2095: link with pipe and three closing brackets
10610 !! input
10611 [[Main Page|link]]]
10612 !! result
10613 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
10614 </p>
10615 !! end
10616
10617 !! test
10618 Bug 2095: link with pipe and three closing brackets, version 2
10619 !! input
10620 [[Main Page|[http://example.com/]]]
10621 !! result
10622 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
10623 </p>
10624 !! end
10625
10626
10627 ###
10628 ### Safety
10629 ###
10630
10631 !! article
10632 Template:Dangerous attribute
10633 !! text
10634 " onmouseover="alert(document.cookie)
10635 !! endarticle
10636
10637 !! article
10638 Template:Dangerous style attribute
10639 !! text
10640 border-size: expression(alert(document.cookie))
10641 !! endarticle
10642
10643 !! article
10644 Template:Div style
10645 !! text
10646 <div style="float: right; {{{1}}}">Magic div</div>
10647 !! endarticle
10648
10649 !! test
10650 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
10651 !! input
10652 <div title="{{test}}"></div>
10653 !! result
10654 <div title="This is a test template"></div>
10655
10656 !! end
10657
10658 !! test
10659 Bug 2304: HTML attribute safety (dangerous template; 2309)
10660 !! input
10661 <div title="{{dangerous attribute}}"></div>
10662 !! result
10663 <div title=""></div>
10664
10665 !! end
10666
10667 !! test
10668 Bug 2304: HTML attribute safety (dangerous style template; 2309)
10669 !! input
10670 <div style="{{dangerous style attribute}}"></div>
10671 !! result
10672 <div style="/* insecure input */"></div>
10673
10674 !! end
10675
10676 !! test
10677 Bug 2304: HTML attribute safety (safe parameter; 2309)
10678 !! input
10679 {{div style|width: 200px}}
10680 !! result
10681 <div style="float: right; width: 200px">Magic div</div>
10682
10683 !! end
10684
10685 !! test
10686 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
10687 !! input
10688 {{div style|width: expression(alert(document.cookie))}}
10689 !! result
10690 <div style="/* insecure input */">Magic div</div>
10691
10692 !! end
10693
10694 !! test
10695 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
10696 !! input
10697 {{div style|"><script>alert(document.cookie)</script>}}
10698 !! result
10699 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10700
10701 !! end
10702
10703 !! test
10704 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
10705 !! input
10706 {{div style|" ><script>alert(document.cookie)</script>}}
10707 !! result
10708 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10709
10710 !! end
10711
10712 !! test
10713 Bug 2304: HTML attribute safety (link)
10714 !! input
10715 <div title="[[Main Page]]"></div>
10716 !! result
10717 <div title="&#91;&#91;Main Page]]"></div>
10718
10719 !! end
10720
10721 !! test
10722 Bug 2304: HTML attribute safety (italics)
10723 !! input
10724 <div title="''foobar''"></div>
10725 !! result
10726 <div title="&#39;&#39;foobar&#39;&#39;"></div>
10727
10728 !! end
10729
10730 !! test
10731 Bug 2304: HTML attribute safety (bold)
10732 !! input
10733 <div title="'''foobar'''"></div>
10734 !! result
10735 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
10736
10737 !! end
10738
10739
10740 !! test
10741 Bug 2304: HTML attribute safety (ISBN)
10742 !! input
10743 <div title="ISBN 1234567890"></div>
10744 !! result
10745 <div title="&#73;SBN 1234567890"></div>
10746
10747 !! end
10748
10749 !! test
10750 Bug 2304: HTML attribute safety (RFC)
10751 !! input
10752 <div title="RFC 1234"></div>
10753 !! result
10754 <div title="&#82;FC 1234"></div>
10755
10756 !! end
10757
10758 !! test
10759 Bug 2304: HTML attribute safety (PMID)
10760 !! input
10761 <div title="PMID 1234567890"></div>
10762 !! result
10763 <div title="&#80;MID 1234567890"></div>
10764
10765 !! end
10766
10767 !! test
10768 Bug 2304: HTML attribute safety (web link)
10769 !! input
10770 <div title="http://example.com/"></div>
10771 !! result
10772 <div title="http&#58;//example.com/"></div>
10773
10774 !! end
10775
10776 !! test
10777 Bug 2304: HTML attribute safety (named web link)
10778 !! input
10779 <div title="[http://example.com/ link]"></div>
10780 !! result
10781 <div title="&#91;http&#58;//example.com/ link]"></div>
10782
10783 !! end
10784
10785 !! test
10786 Bug 3244: HTML attribute safety (extension; safe)
10787 !! input
10788 <div style="<nowiki>background:blue</nowiki>"></div>
10789 !! result
10790 <div style="background:blue"></div>
10791
10792 !! end
10793
10794 !! test
10795 Bug 3244: HTML attribute safety (extension; unsafe)
10796 !! input
10797 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
10798 !! result
10799 <div style="/* insecure input */"></div>
10800
10801 !! end
10802
10803 # More MSIE fun discovered by Tom Gilder
10804
10805 !! test
10806 MSIE CSS safety test: spurious slash
10807 !! input
10808 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
10809 !! result
10810 <div style="/* insecure input */">evil</div>
10811
10812 !! end
10813
10814 !! test
10815 MSIE CSS safety test: hex code
10816 !! input
10817 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
10818 !! result
10819 <div style="/* insecure input */">evil</div>
10820
10821 !! end
10822
10823 !! test
10824 MSIE CSS safety test: comment in url
10825 !! input
10826 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
10827 !! result
10828 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
10829
10830 !! end
10831
10832 !! test
10833 MSIE CSS safety test: comment in expression
10834 !! input
10835 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
10836 !! result
10837 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
10838
10839 !! end
10840
10841
10842 !! test
10843 Table attribute legitimate extension
10844 !! input
10845 {|
10846 !+ style="<nowiki>color:blue</nowiki>"| status
10847 |}
10848 !! result
10849 <table>
10850 <tr>
10851 <th style="color:blue"> status
10852 </th></tr></table>
10853
10854 !!end
10855
10856 !! test
10857 Table attribute safety
10858 !! input
10859 {|
10860 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
10861 |}
10862 !! result
10863 <table>
10864 <tr>
10865 <th style="/* insecure input */"> status
10866 </th></tr></table>
10867
10868 !! end
10869
10870 !! test
10871 CSS line continuation 1
10872 !! input
10873 <div style="background-image: u\&#10;rl(test.jpg);"></div>
10874 !! result
10875 <div style="/* insecure input */"></div>
10876
10877 !! end
10878
10879 !! test
10880 CSS line continuation 2
10881 !! input
10882 <div style="background-image: u\&#13;rl(test.jpg); "></div>
10883 !! result
10884 <div style="/* insecure input */"></div>
10885
10886 !! end
10887
10888 !! article
10889 Template:Identity
10890 !! text
10891 {{{1}}}
10892 !! endarticle
10893
10894 !! test
10895 Expansion of multi-line templates in attribute values (bug 6255)
10896 !! input
10897 <div style="background: {{identity|#00FF00}}">-</div>
10898 !! result
10899 <div style="background: #00FF00">-</div>
10900
10901 !! end
10902
10903
10904 !! test
10905 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
10906 !! input
10907 <div style="background:
10908 #00FF00">-</div>
10909 !! result
10910 <div style="background: #00FF00">-</div>
10911
10912 !! end
10913
10914 !! test
10915 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
10916 !! input
10917 <div style="background: &#10;#00FF00">-</div>
10918 !! result
10919 <div style="background: &#10;#00FF00">-</div>
10920
10921 !! end
10922
10923 ###
10924 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
10925 ###
10926 !! test
10927 Parser hook: empty input
10928 !! input
10929 <tag></tag>
10930 !! result
10931 <pre>
10932 ''
10933 array (
10934 )
10935 </pre>
10936
10937 !! end
10938
10939 !! test
10940 Parser hook: empty input using terminated empty elements
10941 !! input
10942 <tag/>
10943 !! result
10944 <pre>
10945 NULL
10946 array (
10947 )
10948 </pre>
10949
10950 !! end
10951
10952 !! test
10953 Parser hook: empty input using terminated empty elements (space before)
10954 !! input
10955 <tag />
10956 !! result
10957 <pre>
10958 NULL
10959 array (
10960 )
10961 </pre>
10962
10963 !! end
10964
10965 !! test
10966 Parser hook: basic input
10967 !! input
10968 <tag>input</tag>
10969 !! result
10970 <pre>
10971 'input'
10972 array (
10973 )
10974 </pre>
10975
10976 !! end
10977
10978
10979 !! test
10980 Parser hook: case insensitive
10981 !! input
10982 <TAG>input</TAG>
10983 !! result
10984 <pre>
10985 'input'
10986 array (
10987 )
10988 </pre>
10989
10990 !! end
10991
10992
10993 !! test
10994 Parser hook: case insensitive, redux
10995 !! input
10996 <TaG>input</TAg>
10997 !! result
10998 <pre>
10999 'input'
11000 array (
11001 )
11002 </pre>
11003
11004 !! end
11005
11006 !! test
11007 Parser hook: nested tags
11008 !! options
11009 noxml
11010 !! input
11011 <tag><tag></tag></tag>
11012 !! result
11013 <pre>
11014 '<tag>'
11015 array (
11016 )
11017 </pre>&lt;/tag&gt;
11018
11019 !! end
11020
11021 !! test
11022 Parser hook: basic arguments
11023 !! input
11024 <tag width=200 height = "100" depth = '50' square></tag>
11025 !! result
11026 <pre>
11027 ''
11028 array (
11029 'width' => '200',
11030 'height' => '100',
11031 'depth' => '50',
11032 'square' => 'square',
11033 )
11034 </pre>
11035
11036 !! end
11037
11038 !! test
11039 Parser hook: argument containing a forward slash (bug 5344)
11040 !! input
11041 <tag filename='/tmp/bla'></tag>
11042 !! result
11043 <pre>
11044 ''
11045 array (
11046 'filename' => '/tmp/bla',
11047 )
11048 </pre>
11049
11050 !! end
11051
11052 !! test
11053 Parser hook: empty input using terminated empty elements (bug 2374)
11054 !! input
11055 <tag foo=bar/>text
11056 !! result
11057 <pre>
11058 NULL
11059 array (
11060 'foo' => 'bar',
11061 )
11062 </pre>text
11063
11064 !! end
11065
11066 # </tag> should be output literally since there is no matching tag that begins it
11067 !! test
11068 Parser hook: basic arguments using terminated empty elements (bug 2374)
11069 !! input
11070 <tag width=200 height = "100" depth = '50' square/>
11071 other stuff
11072 </tag>
11073 !! result
11074 <pre>
11075 NULL
11076 array (
11077 'width' => '200',
11078 'height' => '100',
11079 'depth' => '50',
11080 'square' => 'square',
11081 )
11082 </pre>
11083 <p>other stuff
11084 &lt;/tag&gt;
11085 </p>
11086 !! end
11087
11088 ###
11089 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
11090 ###
11091
11092 !! test
11093 Parser hook: static parser hook not inside a comment
11094 !! input
11095 <statictag>hello, world</statictag>
11096 <statictag action=flush/>
11097 !! result
11098 <p>hello, world
11099 </p>
11100 !! end
11101
11102
11103 !! test
11104 Parser hook: static parser hook inside a comment
11105 !! input
11106 <!-- <statictag>hello, world</statictag> -->
11107 <statictag action=flush/>
11108 !! result
11109 <p><br />
11110 </p>
11111 !! end
11112
11113 # Nested template calls; this case was broken by Parser.php rev 1.506,
11114 # since reverted.
11115
11116 !! article
11117 Template:One-parameter
11118 !! text
11119 (My parameter is: {{{1}}})
11120 !! endarticle
11121
11122 !! article
11123 Template:Map-one-parameter
11124 !! text
11125 {{{{{1}}}|{{{2}}}}}
11126 !! endarticle
11127
11128 !! test
11129 Nested template calls
11130 !! input
11131 {{Map-one-parameter|One-parameter|param}}
11132 !! result
11133 <p>(My parameter is: param)
11134 </p>
11135 !! end
11136
11137
11138 ###
11139 ### Sanitizer
11140 ###
11141 !! test
11142 Sanitizer: Closing of open tags
11143 !! input
11144 <s></s><table></table>
11145 !! result
11146 <s></s><table></table>
11147
11148 !! end
11149
11150 !! test
11151 Sanitizer: Closing of open but not closed tags
11152 !! input
11153 <s>foo
11154 !! result
11155 <p><s>foo</s>
11156 </p>
11157 !! end
11158
11159 !! test
11160 Sanitizer: Closing of closed but not open tags
11161 !! input
11162 </s>
11163 !! result
11164 <p>&lt;/s&gt;
11165 </p>
11166 !! end
11167
11168 !! test
11169 Sanitizer: Closing of closed but not open table tags
11170 !! input
11171 Table not started</td></tr></table>
11172 !! result
11173 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
11174 </p>
11175 !! end
11176
11177 !! test
11178 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
11179 !! input
11180 <span id="æ: v">byte</span>[[#æ: v|backlink]]
11181 !! result
11182 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
11183 </p>
11184 !! end
11185
11186 !! test
11187 Sanitizer: Validating the contents of the id attribute (bug 4515)
11188 !! options
11189 disabled
11190 !! input
11191 <br id=9 />
11192 !! result
11193 Something, but definitely not <br id="9" />...
11194 !! end
11195
11196 !! test
11197 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
11198 !! options
11199 disabled
11200 !! input
11201 <br id="foo" /><br id="foo" />
11202 !! result
11203 Something need to be done. foo-2 ?
11204 !! end
11205
11206 !! test
11207 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
11208 !! input
11209 <div itemscope>
11210 <meta itemprop="hello" content="world">
11211 <meta http-equiv="refresh" content="5">
11212 <meta itemprop="hello" http-equiv="refresh" content="5">
11213 <link itemprop="hello" href="{{SERVER}}">
11214 <link rel="stylesheet" href="{{SERVER}}">
11215 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
11216 </div>
11217 !! result
11218 <div itemscope="itemscope">
11219 <p> <meta itemprop="hello" content="world" />
11220 &lt;meta http-equiv="refresh" content="5"&gt;
11221 <meta itemprop="hello" content="5" />
11222 </p>
11223 <link itemprop="hello" href="http&#58;//example.org" />
11224 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
11225 <link itemprop="hello" href="http&#58;//example.org" />
11226 </div>
11227
11228 !! end
11229
11230 !! test
11231 Language converter: output gets cut off unexpectedly (bug 5757)
11232 !! options
11233 language=zh
11234 !! input
11235 this bit is safe: }-
11236
11237 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
11238
11239 then we get cut off here: }-
11240
11241 all additional text is vanished
11242 !! result
11243 <p>this bit is safe: }-
11244 </p><p>but if we add a conversion instance: xxx
11245 </p><p>then we get cut off here: }-
11246 </p><p>all additional text is vanished
11247 </p>
11248 !! end
11249
11250 !! test
11251 Self closed html pairs (bug 5487)
11252 !! options
11253 !! input
11254 <center><font id="bug" />Centered text</center>
11255 <div><font id="bug2" />In div text</div>
11256 !! result
11257 <center>&lt;font id="bug" /&gt;Centered text</center>
11258 <div>&lt;font id="bug2" /&gt;In div text</div>
11259
11260 !! end
11261
11262 #
11263 #
11264 #
11265
11266 !! test
11267 Punctuation: nbsp before exclamation
11268 !! input
11269 C'est grave !
11270 !! result
11271 <p>C'est grave&#160;!
11272 </p>
11273 !! end
11274
11275 !! test
11276 Punctuation: CSS !important (bug 11874)
11277 !! input
11278 <div style="width:50% !important">important</div>
11279 !! result
11280 <div style="width:50% !important">important</div>
11281
11282 !!end
11283
11284 !! test
11285 Punctuation: CSS ! important (bug 11874; with space after)
11286 !! input
11287 <div style="width:50% ! important">important</div>
11288 !! result
11289 <div style="width:50% ! important">important</div>
11290
11291 !!end
11292
11293
11294 !! test
11295 HTML bullet list, closed tags (bug 5497)
11296 !! input
11297 <ul>
11298 <li>One</li>
11299 <li>Two</li>
11300 </ul>
11301 !! result
11302 <ul>
11303 <li>One</li>
11304 <li>Two</li>
11305 </ul>
11306
11307 !! end
11308
11309 !! test
11310 HTML bullet list, unclosed tags (bug 5497)
11311 !! options
11312 disabled
11313 !! input
11314 <ul>
11315 <li>One
11316 <li>Two
11317 </ul>
11318 !! result
11319 <ul>
11320 <li>One
11321 </li><li>Two
11322 </li></ul>
11323
11324 !! end
11325
11326 !! test
11327 HTML ordered list, closed tags (bug 5497)
11328 !! input
11329 <ol>
11330 <li>One</li>
11331 <li>Two</li>
11332 </ol>
11333 !! result
11334 <ol>
11335 <li>One</li>
11336 <li>Two</li>
11337 </ol>
11338
11339 !! end
11340
11341 !! test
11342 HTML ordered list, unclosed tags (bug 5497)
11343 !! options
11344 disabled
11345 !! input
11346 <ol>
11347 <li>One
11348 <li>Two
11349 </ol>
11350 !! result
11351 <ol>
11352 <li>One
11353 </li><li>Two
11354 </li></ol>
11355
11356 !! end
11357
11358 !! test
11359 HTML nested bullet list, closed tags (bug 5497)
11360 !! input
11361 <ul>
11362 <li>One</li>
11363 <li>Two:
11364 <ul>
11365 <li>Sub-one</li>
11366 <li>Sub-two</li>
11367 </ul>
11368 </li>
11369 </ul>
11370 !! result
11371 <ul>
11372 <li>One</li>
11373 <li>Two:
11374 <ul>
11375 <li>Sub-one</li>
11376 <li>Sub-two</li>
11377 </ul>
11378 </li>
11379 </ul>
11380
11381 !! end
11382
11383 !! test
11384 HTML nested bullet list, open tags (bug 5497)
11385 !! options
11386 disabled
11387 !! input
11388 <ul>
11389 <li>One
11390 <li>Two:
11391 <ul>
11392 <li>Sub-one
11393 <li>Sub-two
11394 </ul>
11395 </ul>
11396 !! result
11397 <ul>
11398 <li>One
11399 </li><li>Two:
11400 <ul>
11401 <li>Sub-one
11402 </li><li>Sub-two
11403 </li></ul>
11404 </li></ul>
11405
11406 !! end
11407
11408 !! test
11409 HTML nested ordered list, closed tags (bug 5497)
11410 !! input
11411 <ol>
11412 <li>One</li>
11413 <li>Two:
11414 <ol>
11415 <li>Sub-one</li>
11416 <li>Sub-two</li>
11417 </ol>
11418 </li>
11419 </ol>
11420 !! result
11421 <ol>
11422 <li>One</li>
11423 <li>Two:
11424 <ol>
11425 <li>Sub-one</li>
11426 <li>Sub-two</li>
11427 </ol>
11428 </li>
11429 </ol>
11430
11431 !! end
11432
11433 !! test
11434 HTML nested ordered list, open tags (bug 5497)
11435 !! options
11436 disabled
11437 !! input
11438 <ol>
11439 <li>One
11440 <li>Two:
11441 <ol>
11442 <li>Sub-one
11443 <li>Sub-two
11444 </ol>
11445 </ol>
11446 !! result
11447 <ol>
11448 <li>One
11449 </li><li>Two:
11450 <ol>
11451 <li>Sub-one
11452 </li><li>Sub-two
11453 </li></ol>
11454 </li></ol>
11455
11456 !! end
11457
11458 !! test
11459 HTML ordered list item with parameters oddity
11460 !! input
11461 <ol><li id="fragment">One</li></ol>
11462 !! result
11463 <ol><li id="fragment">One</li></ol>
11464
11465 !! end
11466
11467 !!test
11468 bug 5918: autonumbering
11469 !! input
11470 [http://first/] [http://second] [ftp://ftp]
11471
11472 ftp://inlineftp
11473
11474 [mailto:enclosed@mail.tld With target]
11475
11476 [mailto:enclosed@mail.tld]
11477
11478 mailto:inline@mail.tld
11479 !! result
11480 <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>
11481 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
11482 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
11483 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
11484 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
11485 </p>
11486 !! end
11487
11488
11489 #
11490 # Security and HTML correctness
11491 # From Nick Jenkins' fuzz testing
11492 #
11493
11494 !! test
11495 Fuzz testing: Parser13
11496 !! input
11497 {|
11498 | http://a|
11499 !! result
11500 <table>
11501 <tr>
11502 <td>
11503 </td>
11504 </tr>
11505 </table>
11506
11507 !! end
11508
11509 !! test
11510 Fuzz testing: Parser14
11511 !! input
11512 == onmouseover= ==
11513 http://__TOC__
11514 !! result
11515 <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>
11516 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11517 <ul>
11518 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
11519 </ul>
11520 </div>
11521
11522 !! end
11523
11524 !! test
11525 Fuzz testing: Parser14-table
11526 !! input
11527 ==a==
11528 {| STYLE=__TOC__
11529 !! result
11530 <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>
11531 <table style="&#95;_TOC&#95;_">
11532 <tr><td></td></tr>
11533 </table>
11534
11535 !! end
11536
11537 # Known to produce bogus xml (extra </td>)
11538 !! test
11539 Fuzz testing: Parser16
11540 !! options
11541 noxml
11542 !! input
11543 {|
11544 !https://||||||
11545 !! result
11546 <table>
11547 <tr>
11548 <th>https://</th>
11549 <th></th>
11550 <th></th>
11551 <th>
11552 </td>
11553 </tr>
11554 </table>
11555
11556 !! end
11557
11558 !! test
11559 Fuzz testing: Parser21
11560 !! input
11561 {|
11562 ! irc://{{ftp://a" onmouseover="alert('hello world');"
11563 |
11564 !! result
11565 <table>
11566 <tr>
11567 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
11568 </th>
11569 <td>
11570 </td>
11571 </tr>
11572 </table>
11573
11574 !! end
11575
11576 !! test
11577 Fuzz testing: Parser22
11578 !! input
11579 http://===r:::https://b
11580
11581 {|
11582 !!result
11583 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
11584 </p>
11585 <table>
11586 <tr><td></td></tr>
11587 </table>
11588
11589 !! end
11590
11591 # Known to produce bad XML for now
11592 !! test
11593 Fuzz testing: Parser24
11594 !! options
11595 noxml
11596 !! input
11597 {|
11598 {{{|
11599 <u CLASS=
11600 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
11601 <br style="onmouseover='alert(document.cookie);' " />
11602
11603 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11604 |
11605 !! result
11606 <table>
11607 {{{|
11608 <u class="&#124;">}}}} &gt;
11609 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
11610
11611 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11612 <tr>
11613 <td></u>
11614 </td>
11615 </tr>
11616 </table>
11617
11618 !! end
11619
11620 # Note: the current result listed for this is not what the original one was,
11621 # but the original bug was JavaScript injection, which is fixed in any case.
11622 # It's not clear that the original result listed was any more correct than the
11623 # current one. Original result:
11624 # <p>{{{|
11625 # </p>
11626 # <li class="&#124;&#124;">
11627 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11628 !!test
11629 Fuzz testing: Parser25 (bug 6055)
11630 !! input
11631 {{{
11632 |
11633 <LI CLASS=||
11634 >
11635 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
11636 !! result
11637 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11638 </p>
11639 !! end
11640
11641 !!test
11642 Fuzz testing: URL adjacent extension (with space, clean)
11643 !! options
11644 !! input
11645 http://example.com <nowiki>junk</nowiki>
11646 !! result
11647 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
11648 </p>
11649 !!end
11650
11651 !!test
11652 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
11653 !! options
11654 !! input
11655 http://example.com<nowiki>junk</nowiki>
11656 !! result
11657 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
11658 </p>
11659 !!end
11660
11661 !!test
11662 Fuzz testing: URL adjacent extension (no space, dirty; pre)
11663 !! options
11664 !! input
11665 http://example.com<pre>junk</pre>
11666 !! result
11667 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
11668
11669 !!end
11670
11671 !!test
11672 Fuzz testing: image with bogus manual thumbnail
11673 !!input
11674 [[Image:foobar.jpg|thumbnail= ]]
11675 !!result
11676 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
11677
11678 !!end
11679
11680 !! test
11681 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
11682 !! input
11683 <pre dir="&#10;"></pre>
11684 !! result
11685 <pre dir="&#10;"></pre>
11686
11687 !! end
11688
11689 !! test
11690 Parsing optional HTML elements (Bug 6171)
11691 !! options
11692 !! input
11693 <table>
11694 <tr>
11695 <td> Some tabular data</td>
11696 <td> More tabular data ...
11697 <td> And yet som tabular data</td>
11698 </tr>
11699 </table>
11700 !! result
11701 <table>
11702 <tr>
11703 <td> Some tabular data</td>
11704 <td> More tabular data ...
11705 </td><td> And yet som tabular data</td>
11706 </tr>
11707 </table>
11708
11709 !! end
11710
11711 !! test
11712 Correct handling of <td>, <tr> (Bug 6171)
11713 !! options
11714 !! input
11715 <table>
11716 <tr>
11717 <td> Some tabular data</td>
11718 <td> More tabular data ...</td>
11719 <td> And yet som tabular data</td>
11720 </tr>
11721 </table>
11722 !! result
11723 <table>
11724 <tr>
11725 <td> Some tabular data</td>
11726 <td> More tabular data ...</td>
11727 <td> And yet som tabular data</td>
11728 </tr>
11729 </table>
11730
11731 !! end
11732
11733
11734 !! test
11735 Parsing crashing regression (fr:JavaScript)
11736 !! input
11737 </body></x>
11738 !! result
11739 <p>&lt;/body&gt;&lt;/x&gt;
11740 </p>
11741 !! end
11742
11743 !! test
11744 Inline wiki vs wiki block nesting
11745 !! input
11746 '''Bold paragraph
11747
11748 New wiki paragraph
11749 !! result
11750 <p><b>Bold paragraph</b>
11751 </p><p>New wiki paragraph
11752 </p>
11753 !! end
11754
11755 !! test
11756 Inline HTML vs wiki block nesting
11757 !! options
11758 disabled
11759 !! input
11760 <b>Bold paragraph
11761
11762 New wiki paragraph
11763 !! result
11764 <p><b>Bold paragraph</b>
11765 </p><p>New wiki paragraph
11766 </p>
11767 !! end
11768
11769 # Original result was this:
11770 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
11771 # </p>
11772 # While that might be marginally more intuitive, maybe, the six-apostrophe
11773 # construct is clearly pathological and the result stated here (which is what
11774 # the parser actually does) is about as reasonable as anything.
11775 !!test
11776 Mixing markup for italics and bold
11777 !! options
11778 !! input
11779 '''bold''''''bold''bolditalics'''''
11780 !! result
11781 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
11782 </p>
11783 !! end
11784
11785
11786 !! article
11787 Xyzzyx
11788 !! text
11789 Article for special page transclusion test
11790 !! endarticle
11791
11792 !! test
11793 Special page transclusion
11794 !! options
11795 !! input
11796 {{Special:Prefixindex/Xyzzyx}}
11797 !! result
11798 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11799
11800 !! end
11801
11802 !! test
11803 Special page transclusion twice (bug 5021)
11804 !! options
11805 !! input
11806 {{Special:Prefixindex/Xyzzyx}}
11807 {{Special:Prefixindex/Xyzzyx}}
11808 !! result
11809 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11810 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11811
11812 !! end
11813
11814 !! test
11815 Transclusion of default MediaWiki message
11816 !! input
11817 {{MediaWiki:Mainpage}}
11818 !!result
11819 <p>Main Page
11820 </p>
11821 !! end
11822
11823 !! test
11824 Transclusion of nonexistent MediaWiki message
11825 !! input
11826 {{MediaWiki:Mainpagexxx}}
11827 !!result
11828 <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>
11829 </p>
11830 !! end
11831
11832 !! test
11833 Transclusion of MediaWiki message with underscore
11834 !! input
11835 {{MediaWiki:history_short}}
11836 !! result
11837 <p>History
11838 </p>
11839 !! end
11840
11841 !! test
11842 Transclusion of MediaWiki message with space
11843 !! input
11844 {{MediaWiki:history short}}
11845 !! result
11846 <p>History
11847 </p>
11848 !! end
11849
11850 !! test
11851 Invalid header with following text
11852 !! input
11853 = x = y
11854 !! result
11855 <p>= x = y
11856 </p>
11857 !! end
11858
11859
11860 !! test
11861 Section extraction test (section 0)
11862 !! options
11863 section=0
11864 !! input
11865 start
11866 ==a==
11867 ===aa===
11868 ====aaa====
11869 ==b==
11870 ===ba===
11871 ===bb===
11872 ====bba====
11873 ===bc===
11874 ==c==
11875 ===ca===
11876 !! result
11877 start
11878 !! end
11879
11880 !! test
11881 Section extraction test (section 1)
11882 !! options
11883 section=1
11884 !! input
11885 start
11886 ==a==
11887 ===aa===
11888 ====aaa====
11889 ==b==
11890 ===ba===
11891 ===bb===
11892 ====bba====
11893 ===bc===
11894 ==c==
11895 ===ca===
11896 !! result
11897 ==a==
11898 ===aa===
11899 ====aaa====
11900 !! end
11901
11902 !! test
11903 Section extraction test (section 2)
11904 !! options
11905 section=2
11906 !! input
11907 start
11908 ==a==
11909 ===aa===
11910 ====aaa====
11911 ==b==
11912 ===ba===
11913 ===bb===
11914 ====bba====
11915 ===bc===
11916 ==c==
11917 ===ca===
11918 !! result
11919 ===aa===
11920 ====aaa====
11921 !! end
11922
11923 !! test
11924 Section extraction test (section 3)
11925 !! options
11926 section=3
11927 !! input
11928 start
11929 ==a==
11930 ===aa===
11931 ====aaa====
11932 ==b==
11933 ===ba===
11934 ===bb===
11935 ====bba====
11936 ===bc===
11937 ==c==
11938 ===ca===
11939 !! result
11940 ====aaa====
11941 !! end
11942
11943 !! test
11944 Section extraction test (section 4)
11945 !! options
11946 section=4
11947 !! input
11948 start
11949 ==a==
11950 ===aa===
11951 ====aaa====
11952 ==b==
11953 ===ba===
11954 ===bb===
11955 ====bba====
11956 ===bc===
11957 ==c==
11958 ===ca===
11959 !! result
11960 ==b==
11961 ===ba===
11962 ===bb===
11963 ====bba====
11964 ===bc===
11965 !! end
11966
11967 !! test
11968 Section extraction test (section 5)
11969 !! options
11970 section=5
11971 !! input
11972 start
11973 ==a==
11974 ===aa===
11975 ====aaa====
11976 ==b==
11977 ===ba===
11978 ===bb===
11979 ====bba====
11980 ===bc===
11981 ==c==
11982 ===ca===
11983 !! result
11984 ===ba===
11985 !! end
11986
11987 !! test
11988 Section extraction test (section 6)
11989 !! options
11990 section=6
11991 !! input
11992 start
11993 ==a==
11994 ===aa===
11995 ====aaa====
11996 ==b==
11997 ===ba===
11998 ===bb===
11999 ====bba====
12000 ===bc===
12001 ==c==
12002 ===ca===
12003 !! result
12004 ===bb===
12005 ====bba====
12006 !! end
12007
12008 !! test
12009 Section extraction test (section 7)
12010 !! options
12011 section=7
12012 !! input
12013 start
12014 ==a==
12015 ===aa===
12016 ====aaa====
12017 ==b==
12018 ===ba===
12019 ===bb===
12020 ====bba====
12021 ===bc===
12022 ==c==
12023 ===ca===
12024 !! result
12025 ====bba====
12026 !! end
12027
12028 !! test
12029 Section extraction test (section 8)
12030 !! options
12031 section=8
12032 !! input
12033 start
12034 ==a==
12035 ===aa===
12036 ====aaa====
12037 ==b==
12038 ===ba===
12039 ===bb===
12040 ====bba====
12041 ===bc===
12042 ==c==
12043 ===ca===
12044 !! result
12045 ===bc===
12046 !! end
12047
12048 !! test
12049 Section extraction test (section 9)
12050 !! options
12051 section=9
12052 !! input
12053 start
12054 ==a==
12055 ===aa===
12056 ====aaa====
12057 ==b==
12058 ===ba===
12059 ===bb===
12060 ====bba====
12061 ===bc===
12062 ==c==
12063 ===ca===
12064 !! result
12065 ==c==
12066 ===ca===
12067 !! end
12068
12069 !! test
12070 Section extraction test (section 10)
12071 !! options
12072 section=10
12073 !! input
12074 start
12075 ==a==
12076 ===aa===
12077 ====aaa====
12078 ==b==
12079 ===ba===
12080 ===bb===
12081 ====bba====
12082 ===bc===
12083 ==c==
12084 ===ca===
12085 !! result
12086 ===ca===
12087 !! end
12088
12089 !! test
12090 Section extraction test (nonexistent section 11)
12091 !! options
12092 section=11
12093 !! input
12094 start
12095 ==a==
12096 ===aa===
12097 ====aaa====
12098 ==b==
12099 ===ba===
12100 ===bb===
12101 ====bba====
12102 ===bc===
12103 ==c==
12104 ===ca===
12105 !! result
12106 !! end
12107
12108 !! test
12109 Section extraction test with bogus heading (section 1)
12110 !! options
12111 section=1
12112 !! input
12113 ==a==
12114 ==bogus== not a legal section
12115 ==b==
12116 !! result
12117 ==a==
12118 ==bogus== not a legal section
12119 !! end
12120
12121 !! test
12122 Section extraction test with bogus heading (section 2)
12123 !! options
12124 section=2
12125 !! input
12126 ==a==
12127 ==bogus== not a legal section
12128 ==b==
12129 !! result
12130 ==b==
12131 !! end
12132
12133 !! test
12134 Section extraction test with comment after heading (section 1)
12135 !! options
12136 section=1
12137 !! input
12138 ==a==
12139 ==b== <!-- -->
12140 ==c==
12141 !! result
12142 ==a==
12143 !! end
12144
12145 !! test
12146 Section extraction test with comment after heading (section 2)
12147 !! options
12148 section=2
12149 !! input
12150 ==a==
12151 ==b== <!-- -->
12152 ==c==
12153 !! result
12154 ==b== <!-- -->
12155 !! end
12156
12157 !! test
12158 Section extraction test with bogus <nowiki> heading (section 1)
12159 !! options
12160 section=1
12161 !! input
12162 ==a==
12163 ==bogus== <nowiki>not a legal section</nowiki>
12164 ==b==
12165 !! result
12166 ==a==
12167 ==bogus== <nowiki>not a legal section</nowiki>
12168 !! end
12169
12170 !! test
12171 Section extraction test with bogus <nowiki> heading (section 2)
12172 !! options
12173 section=2
12174 !! input
12175 ==a==
12176 ==bogus== <nowiki>not a legal section</nowiki>
12177 ==b==
12178 !! result
12179 ==b==
12180 !! end
12181
12182
12183 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
12184 # instead of respecting commented sections
12185 !! test
12186 Section extraction prefixed by comment (section 1)
12187 !! options
12188 section=1
12189 !! input
12190 <!-- -->==sec1==
12191 ==sec2==
12192 !!result
12193 ==sec2==
12194 !!end
12195
12196 !! test
12197 Section extraction prefixed by comment (section 2)
12198 !! options
12199 section=2
12200 !! input
12201 <!-- -->==sec1==
12202 ==sec2==
12203 !!result
12204
12205 !!end
12206
12207
12208 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
12209 # instead of respecting HTML-style headings
12210 !! test
12211 Section extraction, mixed wiki and html (section 1)
12212 !! options
12213 section=1
12214 !! input
12215 <h2>unmarked</h2>
12216 unmarked
12217 ==1==
12218 one
12219 ==2==
12220 two
12221 !! result
12222 ==1==
12223 one
12224 !! end
12225
12226 !! test
12227 Section extraction, mixed wiki and html (section 2)
12228 !! options
12229 section=2
12230 !! input
12231 <h2>unmarked</h2>
12232 unmarked
12233 ==1==
12234 one
12235 ==2==
12236 two
12237 !! result
12238 ==2==
12239 two
12240 !! end
12241
12242
12243 # Formerly testing for bug 3342
12244 !! test
12245 Section extraction, heading surrounded by <noinclude>
12246 !! options
12247 section=1
12248 !! input
12249 <noinclude>==unmarked==</noinclude>
12250 ==marked==
12251 !! result
12252 ==marked==
12253 !!end
12254
12255 # Test behavior of bug 19910
12256 !! test
12257 Sectiion with all-equals
12258 !! options
12259 section=2
12260 !! input
12261 ===
12262 The line above must have a trailing space
12263 === <!--
12264 --> <!-- -->
12265 But just in case it doesn't...
12266 !! result
12267 === <!--
12268 --> <!-- -->
12269 But just in case it doesn't...
12270 !! end
12271
12272 !! test
12273 Section replacement test (section 0)
12274 !! options
12275 replace=0,"xxx"
12276 !! input
12277 start
12278 ==a==
12279 ===aa===
12280 ====aaa====
12281 ==b==
12282 ===ba===
12283 ===bb===
12284 ====bba====
12285 ===bc===
12286 ==c==
12287 ===ca===
12288 !! result
12289 xxx
12290
12291 ==a==
12292 ===aa===
12293 ====aaa====
12294 ==b==
12295 ===ba===
12296 ===bb===
12297 ====bba====
12298 ===bc===
12299 ==c==
12300 ===ca===
12301 !! end
12302
12303 !! test
12304 Section replacement test (section 1)
12305 !! options
12306 replace=1,"xxx"
12307 !! input
12308 start
12309 ==a==
12310 ===aa===
12311 ====aaa====
12312 ==b==
12313 ===ba===
12314 ===bb===
12315 ====bba====
12316 ===bc===
12317 ==c==
12318 ===ca===
12319 !! result
12320 start
12321 xxx
12322
12323 ==b==
12324 ===ba===
12325 ===bb===
12326 ====bba====
12327 ===bc===
12328 ==c==
12329 ===ca===
12330 !! end
12331
12332 !! test
12333 Section replacement test (section 2)
12334 !! options
12335 replace=2,"xxx"
12336 !! input
12337 start
12338 ==a==
12339 ===aa===
12340 ====aaa====
12341 ==b==
12342 ===ba===
12343 ===bb===
12344 ====bba====
12345 ===bc===
12346 ==c==
12347 ===ca===
12348 !! result
12349 start
12350 ==a==
12351 xxx
12352
12353 ==b==
12354 ===ba===
12355 ===bb===
12356 ====bba====
12357 ===bc===
12358 ==c==
12359 ===ca===
12360 !! end
12361
12362 !! test
12363 Section replacement test (section 3)
12364 !! options
12365 replace=3,"xxx"
12366 !! input
12367 start
12368 ==a==
12369 ===aa===
12370 ====aaa====
12371 ==b==
12372 ===ba===
12373 ===bb===
12374 ====bba====
12375 ===bc===
12376 ==c==
12377 ===ca===
12378 !! result
12379 start
12380 ==a==
12381 ===aa===
12382 xxx
12383
12384 ==b==
12385 ===ba===
12386 ===bb===
12387 ====bba====
12388 ===bc===
12389 ==c==
12390 ===ca===
12391 !! end
12392
12393 !! test
12394 Section replacement test (section 4)
12395 !! options
12396 replace=4,"xxx"
12397 !! input
12398 start
12399 ==a==
12400 ===aa===
12401 ====aaa====
12402 ==b==
12403 ===ba===
12404 ===bb===
12405 ====bba====
12406 ===bc===
12407 ==c==
12408 ===ca===
12409 !! result
12410 start
12411 ==a==
12412 ===aa===
12413 ====aaa====
12414 xxx
12415
12416 ==c==
12417 ===ca===
12418 !! end
12419
12420 !! test
12421 Section replacement test (section 5)
12422 !! options
12423 replace=5,"xxx"
12424 !! input
12425 start
12426 ==a==
12427 ===aa===
12428 ====aaa====
12429 ==b==
12430 ===ba===
12431 ===bb===
12432 ====bba====
12433 ===bc===
12434 ==c==
12435 ===ca===
12436 !! result
12437 start
12438 ==a==
12439 ===aa===
12440 ====aaa====
12441 ==b==
12442 xxx
12443
12444 ===bb===
12445 ====bba====
12446 ===bc===
12447 ==c==
12448 ===ca===
12449 !! end
12450
12451 !! test
12452 Section replacement test (section 6)
12453 !! options
12454 replace=6,"xxx"
12455 !! input
12456 start
12457 ==a==
12458 ===aa===
12459 ====aaa====
12460 ==b==
12461 ===ba===
12462 ===bb===
12463 ====bba====
12464 ===bc===
12465 ==c==
12466 ===ca===
12467 !! result
12468 start
12469 ==a==
12470 ===aa===
12471 ====aaa====
12472 ==b==
12473 ===ba===
12474 xxx
12475
12476 ===bc===
12477 ==c==
12478 ===ca===
12479 !! end
12480
12481 !! test
12482 Section replacement test (section 7)
12483 !! options
12484 replace=7,"xxx"
12485 !! input
12486 start
12487 ==a==
12488 ===aa===
12489 ====aaa====
12490 ==b==
12491 ===ba===
12492 ===bb===
12493 ====bba====
12494 ===bc===
12495 ==c==
12496 ===ca===
12497 !! result
12498 start
12499 ==a==
12500 ===aa===
12501 ====aaa====
12502 ==b==
12503 ===ba===
12504 ===bb===
12505 xxx
12506
12507 ===bc===
12508 ==c==
12509 ===ca===
12510 !! end
12511
12512 !! test
12513 Section replacement test (section 8)
12514 !! options
12515 replace=8,"xxx"
12516 !! input
12517 start
12518 ==a==
12519 ===aa===
12520 ====aaa====
12521 ==b==
12522 ===ba===
12523 ===bb===
12524 ====bba====
12525 ===bc===
12526 ==c==
12527 ===ca===
12528 !! result
12529 start
12530 ==a==
12531 ===aa===
12532 ====aaa====
12533 ==b==
12534 ===ba===
12535 ===bb===
12536 ====bba====
12537 xxx
12538
12539 ==c==
12540 ===ca===
12541 !!end
12542
12543 !! test
12544 Section replacement test (section 9)
12545 !! options
12546 replace=9,"xxx"
12547 !! input
12548 start
12549 ==a==
12550 ===aa===
12551 ====aaa====
12552 ==b==
12553 ===ba===
12554 ===bb===
12555 ====bba====
12556 ===bc===
12557 ==c==
12558 ===ca===
12559 !! result
12560 start
12561 ==a==
12562 ===aa===
12563 ====aaa====
12564 ==b==
12565 ===ba===
12566 ===bb===
12567 ====bba====
12568 ===bc===
12569 xxx
12570 !! end
12571
12572 !! test
12573 Section replacement test (section 10)
12574 !! options
12575 replace=10,"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 ====bba====
12597 ===bc===
12598 ==c==
12599 xxx
12600 !! end
12601
12602 !! test
12603 Section replacement test with initial whitespace (bug 13728)
12604 !! options
12605 replace=2,"xxx"
12606 !! input
12607 Preformatted initial line
12608 ==a==
12609 ===a===
12610 !! result
12611 Preformatted initial line
12612 ==a==
12613 xxx
12614 !! end
12615
12616
12617 !! test
12618 Section extraction, heading followed by pre with 20 spaces (bug 6398)
12619 !! options
12620 section=1
12621 !! input
12622 ==a==
12623 a
12624 !! result
12625 ==a==
12626 a
12627 !! end
12628
12629 !! test
12630 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
12631 !! options
12632 section=1
12633 !! input
12634 ==a==
12635 a
12636 !! result
12637 ==a==
12638 a
12639 !! end
12640
12641
12642 !! test
12643 Section extraction, <pre> around bogus header (bug 10309)
12644 !! options
12645 noxml section=2
12646 !! input
12647 == Section One ==
12648 <pre>
12649 =======
12650 </pre>
12651
12652 == Section Two ==
12653 stuff
12654 !! result
12655 == Section Two ==
12656 stuff
12657 !! end
12658
12659 !! test
12660 Section replacement, <pre> around bogus header (bug 10309)
12661 !! options
12662 noxml replace=2,"xxx"
12663 !! input
12664 == Section One ==
12665 <pre>
12666 =======
12667 </pre>
12668
12669 == Section Two ==
12670 stuff
12671 !! result
12672 == Section One ==
12673 <pre>
12674 =======
12675 </pre>
12676
12677 xxx
12678 !! end
12679
12680
12681
12682 !! test
12683 Handling of &#x0A; in URLs
12684 !! input
12685 **irc://&#x0A;a
12686 !! result
12687 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
12688 </li></ul>
12689 </li></ul>
12690
12691 !!end
12692
12693 !! test
12694 5 quotes, code coverage +1 line (php)
12695 !! options
12696 php
12697 !! input
12698 '''''
12699 !! result
12700 !! end
12701 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
12702 !! test
12703 5 quotes, code coverage +1 line (parsoid)
12704 !! options
12705 parsoid
12706 !! input
12707 '''''
12708 !! result
12709 <p><i><b></b></i></p>
12710 !! end
12711
12712 !! test
12713 Special:Search page linking.
12714 !! input
12715 {{Special:search}}
12716 !! result
12717 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
12718 </p>
12719 !! end
12720
12721 !! test
12722 Say the magic word
12723 !! options
12724 title=[[Parser test]]
12725 !! input
12726 * {{PAGENAME}}
12727 * {{PAGENAMEE}}
12728 * {{FULLPAGENAME}}
12729 * {{FULLPAGENAMEE}}
12730 * {{BASEPAGENAME}}
12731 * {{BASEPAGENAMEE}}
12732 * {{SUBPAGENAME}}
12733 * {{SUBPAGENAMEE}}
12734 * {{ROOTPAGENAME}}
12735 * {{ROOTPAGENAMEE}}
12736 * {{TALKPAGENAME}}
12737 * {{TALKPAGENAMEE}}
12738 * {{SUBJECTPAGENAME}}
12739 * {{SUBJECTPAGENAMEE}}
12740 * {{NAMESPACEE}}
12741 * {{NAMESPACE}}
12742 * {{NAMESPACENUMBER}}
12743 * {{TALKSPACE}}
12744 * {{TALKSPACEE}}
12745 * {{SUBJECTSPACE}}
12746 * {{SUBJECTSPACEE}}
12747 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
12748 !! result
12749 <ul><li> Parser test
12750 </li><li> Parser_test
12751 </li><li> Parser test
12752 </li><li> Parser_test
12753 </li><li> Parser test
12754 </li><li> Parser_test
12755 </li><li> Parser test
12756 </li><li> Parser_test
12757 </li><li> Parser test
12758 </li><li> Parser_test
12759 </li><li> Talk:Parser test
12760 </li><li> Talk:Parser_test
12761 </li><li> Parser test
12762 </li><li> Parser_test
12763 </li><li>
12764 </li><li>
12765 </li><li> 0
12766 </li><li> Talk
12767 </li><li> Talk
12768 </li><li>
12769 </li><li>
12770 </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>
12771 </li></ul>
12772
12773 !! end
12774 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
12775
12776 !! test
12777 Gallery
12778 !! input
12779 <gallery>
12780 image1.png |
12781 image2.gif|||||
12782
12783 image3|
12784 image4 |300px| centre
12785 image5.svg| http://///////
12786 [[x|xx]]]]
12787 * image6
12788 </gallery>
12789 !! result
12790 <ul class="gallery mw-gallery-traditional">
12791 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12792 <div class="thumb" style="height: 150px;">Image1.png</div>
12793 <div class="gallerytext">
12794 </div>
12795 </div></li>
12796 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12797 <div class="thumb" style="height: 150px;">Image2.gif</div>
12798 <div class="gallerytext">
12799 <p>||||
12800 </p>
12801 </div>
12802 </div></li>
12803 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12804 <div class="thumb" style="height: 150px;">Image3</div>
12805 <div class="gallerytext">
12806 </div>
12807 </div></li>
12808 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12809 <div class="thumb" style="height: 150px;">Image4</div>
12810 <div class="gallerytext">
12811 <p>300px| centre
12812 </p>
12813 </div>
12814 </div></li>
12815 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12816 <div class="thumb" style="height: 150px;">Image5.svg</div>
12817 <div class="gallerytext">
12818 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
12819 </p>
12820 </div>
12821 </div></li>
12822 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12823 <div class="thumb" style="height: 150px;">* image6</div>
12824 <div class="gallerytext">
12825 </div>
12826 </div></li>
12827 </ul>
12828
12829 !! end
12830
12831 !! test
12832 Gallery (with options)
12833 !! input
12834 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
12835 File:Nonexistant.jpg|caption
12836 File:Nonexistant.jpg
12837 image:foobar.jpg|some '''caption''' [[Main Page]]
12838 image:foobar.jpg
12839 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
12840 </gallery>
12841 !! result
12842 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
12843 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
12844 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12845 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
12846 <div class="gallerytext">
12847 <p>caption
12848 </p>
12849 </div>
12850 </div></li>
12851 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12852 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
12853 <div class="gallerytext">
12854 </div>
12855 </div></li>
12856 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12857 <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>
12858 <div class="gallerytext">
12859 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12860 </p>
12861 </div>
12862 </div></li>
12863 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12864 <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>
12865 <div class="gallerytext">
12866 </div>
12867 </div></li>
12868 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12869 <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>
12870 <div class="gallerytext">
12871 <p>Blabla|blabla.
12872 </p>
12873 </div>
12874 </div></li>
12875 </ul>
12876
12877 !! end
12878
12879 !! test
12880 Gallery with wikitext inside caption
12881 !! input
12882 <gallery>
12883 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
12884 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
12885 </gallery>
12886 !! result
12887 <ul class="gallery mw-gallery-traditional">
12888 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12889 <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>
12890 <div class="gallerytext">
12891 <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>
12892 </p>
12893 </div>
12894 </div></li>
12895 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12896 <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>
12897 <div class="gallerytext">
12898 <p>This is a test template
12899 </p>
12900 </div>
12901 </div></li>
12902 </ul>
12903
12904 !! end
12905
12906 !! test
12907 gallery (with showfilename option)
12908 !! input
12909 <gallery showfilename>
12910 File:Nonexistant.jpg|caption
12911 File:Nonexistant.jpg
12912 image:foobar.jpg|some '''caption''' [[Main Page]]
12913 File:Foobar.jpg
12914 </gallery>
12915 !! result
12916 <ul class="gallery mw-gallery-traditional">
12917 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12918 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
12919 <div class="gallerytext">
12920 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12921 caption
12922 </p>
12923 </div>
12924 </div></li>
12925 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12926 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
12927 <div class="gallerytext">
12928 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12929 </p>
12930 </div>
12931 </div></li>
12932 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12933 <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>
12934 <div class="gallerytext">
12935 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12936 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12937 </p>
12938 </div>
12939 </div></li>
12940 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12941 <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>
12942 <div class="gallerytext">
12943 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12944 </p>
12945 </div>
12946 </div></li>
12947 </ul>
12948
12949 !! end
12950
12951 !! test
12952 Gallery (with namespace-less filenames)
12953 !! input
12954 <gallery>
12955 File:Nonexistant.jpg
12956 Nonexistant.jpg
12957 image:foobar.jpg
12958 foobar.jpg
12959 </gallery>
12960 !! result
12961 <ul class="gallery mw-gallery-traditional">
12962 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12963 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
12964 <div class="gallerytext">
12965 </div>
12966 </div></li>
12967 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12968 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
12969 <div class="gallerytext">
12970 </div>
12971 </div></li>
12972 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12973 <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>
12974 <div class="gallerytext">
12975 </div>
12976 </div></li>
12977 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12978 <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>
12979 <div class="gallerytext">
12980 </div>
12981 </div></li>
12982 </ul>
12983
12984 !! end
12985
12986 !! test
12987 HTML Hex character encoding (spells the word "JavaScript")
12988 !! input
12989 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
12990 !! result
12991 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
12992 </p>
12993 !! end
12994
12995 !! test
12996 HTML Hex character encoding bogus encoding (bug 26437 regression check)
12997 !! input
12998 &#xsee;&#XSEE;
12999 !! result
13000 <p>&amp;#xsee;&amp;#XSEE;
13001 </p>
13002 !! end
13003
13004 !! test
13005 HTML Hex character encoding mixed case
13006 !! input
13007 &#xEE;&#Xee;
13008 !! result
13009 <p>&#xee;&#xee;
13010 </p>
13011 !! end
13012
13013 !! test
13014 __FORCETOC__ override
13015 !! input
13016 __NEWSECTIONLINK__
13017 __FORCETOC__
13018 !! result
13019 <p><br />
13020 </p>
13021 !! end
13022
13023 !! test
13024 ISBN code coverage
13025 !! input
13026 ISBN 978-0-1234-56&#x20;789
13027 !! result
13028 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
13029 </p>
13030 !! end
13031
13032 !! test
13033 ISBN followed by 5 spaces
13034 !! input
13035 ISBN
13036 !! result
13037 <p>ISBN
13038 </p>
13039 !! end
13040
13041 !! test
13042 Double ISBN
13043 !! input
13044 ISBN ISBN 1234567890
13045 !! result
13046 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13047 </p>
13048 !! end
13049
13050 !! test
13051 Bug 22905: <abbr> followed by ISBN followed by </a>
13052 !! input
13053 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
13054 !! result
13055 <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>
13056 </p>
13057 !! end
13058
13059 !! test
13060 Double RFC
13061 !! input
13062 RFC RFC 1234
13063 !! result
13064 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
13065 </p>
13066 !! end
13067
13068 !! test
13069 Double RFC with a wiki link
13070 !! input
13071 RFC [[RFC 1234]]
13072 !! result
13073 <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>
13074 </p>
13075 !! end
13076
13077 !! test
13078 RFC code coverage
13079 !! input
13080 RFC 983&#x20;987
13081 !! result
13082 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
13083 </p>
13084 !! end
13085
13086 !! test
13087 Centre-aligned image
13088 !! input
13089 [[Image:foobar.jpg|centre]]
13090 !! result
13091 <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>
13092
13093 !!end
13094
13095 !! test
13096 None-aligned image
13097 !! input
13098 [[Image:foobar.jpg|none]]
13099 !! result
13100 <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>
13101
13102 !!end
13103
13104 !! test
13105 Width + Height sized image (using px) (height is ignored)
13106 !! input
13107 [[Image:foobar.jpg|640x480px]]
13108 !! result
13109 <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>
13110 </p>
13111 !!end
13112
13113 !! test
13114 Width-sized image (using px, no following whitespace)
13115 !! input
13116 [[Image:foobar.jpg|640px]]
13117 !! result
13118 <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>
13119 </p>
13120 !!end
13121
13122 !! test
13123 Width-sized image (using px, with following whitespace - test regression from r39467)
13124 !! input
13125 [[Image:foobar.jpg|640px ]]
13126 !! result
13127 <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>
13128 </p>
13129 !!end
13130
13131 !! test
13132 Width-sized image (using px, with preceding whitespace - test regression from r39467)
13133 !! input
13134 [[Image:foobar.jpg| 640px]]
13135 !! result
13136 <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>
13137 </p>
13138 !!end
13139
13140 !! test
13141 Another italics / bold test
13142 !! input
13143 ''' ''x'
13144 !! result
13145 <pre>'<i> </i>x'
13146 </pre>
13147 !!end
13148
13149 # Note the results may be incorrect, as parserTest output included this:
13150 # XML error: Mismatched tag at byte 6120:
13151 # ...<dd> </dt></dl> </dd...
13152 !! test
13153 dt/dd/dl test
13154 !! options
13155 disabled
13156 !! input
13157 :;;;::
13158 !! result
13159 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
13160 </dd></dl>
13161 </dd></dl>
13162 </dt></dl>
13163 </dt></dl>
13164 </dt></dl>
13165 </dd></dl>
13166
13167 !!end
13168
13169
13170 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
13171 !! test
13172 Images with the "|" character in the comment
13173 !! input
13174 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
13175 !! result
13176 <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>
13177
13178 !!end
13179
13180 !! test
13181 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
13182 !! input
13183 <html><script>alert(1);</script></html>
13184 !! result
13185 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
13186 </p>
13187 !! end
13188
13189 !! test
13190 HTML with raw HTML ($wgRawHtml==true)
13191 !! options
13192 wgRawHtml=1
13193 !! input
13194 <html><script>alert(1);</script></html>
13195 !! result
13196 <p><script>alert(1);</script>
13197 </p>
13198 !! end
13199
13200 !! test
13201 Parents of subpages, one level up
13202 !! options
13203 subpage title=[[Subpage test/L1/L2/L3]]
13204 !! input
13205 [[../|L2]]
13206 !! result
13207 <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>
13208 </p>
13209 !! end
13210
13211
13212 !! test
13213 Parents of subpages, one level up, not named
13214 !! options
13215 subpage title=[[Subpage test/L1/L2/L3]]
13216 !! input
13217 [[../]]
13218 !! result
13219 <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>
13220 </p>
13221 !! end
13222
13223
13224
13225 !! test
13226 Parents of subpages, two levels up
13227 !! options
13228 subpage title=[[Subpage test/L1/L2/L3]]
13229 !! input
13230 [[../../|L1]]2
13231
13232 [[../../|L1]]l
13233 !! result
13234 <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
13235 </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>
13236 </p>
13237 !! end
13238
13239 !! test
13240 Parents of subpages, two levels up, without trailing slash or name.
13241 !! options
13242 subpage title=[[Subpage test/L1/L2/L3]]
13243 !! input
13244 [[../..]]
13245 !! result
13246 <p>[[../..]]
13247 </p>
13248 !! end
13249
13250 !! test
13251 Parents of subpages, two levels up, with lots of extra trailing slashes.
13252 !! options
13253 subpage title=[[Subpage test/L1/L2/L3]]
13254 !! input
13255 [[../../////]]
13256 !! result
13257 <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>
13258 </p>
13259 !! end
13260
13261 !! article
13262 Subpage test/L1/L2/L3Sibling
13263 !! text
13264 Sibling article
13265 !! endarticle
13266
13267 !! test
13268 Transclusion of a sibling page (one level up)
13269 !! options
13270 subpage title=[[Subpage test/L1/L2/L3]]
13271 !! input
13272 {{../L3Sibling}}
13273 !! result
13274 <p>Sibling article
13275 </p>
13276 !! end
13277
13278 !! test
13279 Transclusion of a child page
13280 !! options
13281 subpage title=[[Subpage test/L1/L2]]
13282 !! input
13283 {{/L3Sibling}}
13284 !! result
13285 <p>Sibling article
13286 </p>
13287 !! end
13288
13289 !! test
13290 Non-transclusion because of too many up levels
13291 !! options
13292 subpage title=[[Subpage test/L1/L2/L3]]
13293 !! input
13294 {{../../../../More than parent}}
13295 !! result
13296 <p>{{../../../../More than parent}}
13297 </p>
13298 !! end
13299
13300 !! test
13301 Definition list code coverage
13302 !! input
13303 ; title : def
13304 ; title : def
13305 ;title: def
13306 !! result
13307 <dl><dt> title &#160;</dt><dd> def
13308 </dd><dt> title&#160;</dt><dd> def
13309 </dd><dt>title</dt><dd> def
13310 </dd></dl>
13311
13312 !! end
13313
13314 !! test
13315 Don't fall for the self-closing div
13316 !! input
13317 <div>hello world</div/>
13318 !! result
13319 <div>hello world</div>
13320
13321 !! end
13322
13323 !! test
13324 MSGNW magic word
13325 !! input
13326 {{MSGNW:msg}}
13327 !! result
13328 <p>&#91;&#91;:Template:Msg&#93;&#93;
13329 </p>
13330 !! end
13331
13332 !! test
13333 RAW magic word
13334 !! input
13335 {{RAW:QUERTY}}
13336 !! result
13337 <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>
13338 </p>
13339 !! end
13340
13341 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
13342 !! test
13343 Always escape literal '>' in output, not just after '<'
13344 !! input
13345 ><>
13346 !! result
13347 <p>&gt;&lt;&gt;
13348 </p>
13349 !! end
13350
13351 !! test
13352 Template caching
13353 !! input
13354 {{Test}}
13355 {{Test}}
13356 !! result
13357 <p>This is a test template
13358 This is a test template
13359 </p>
13360 !! end
13361
13362
13363 !! article
13364 MediaWiki:Fake
13365 !! text
13366 ==header==
13367 !! endarticle
13368
13369 !! test
13370 Inclusion of !userCanEdit() content
13371 !! input
13372 {{MediaWiki:Fake}}
13373 !! result
13374 <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>
13375
13376 !! end
13377
13378
13379 !! test
13380 Out-of-order TOC heading levels
13381 !! input
13382 ==2==
13383 ======6======
13384 ===3===
13385 =1=
13386 =====5=====
13387 ==2==
13388 !! result
13389 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13390 <ul>
13391 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
13392 <ul>
13393 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
13394 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
13395 </ul>
13396 </li>
13397 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
13398 <ul>
13399 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
13400 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
13401 </ul>
13402 </li>
13403 </ul>
13404 </div>
13405 <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>
13406 <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>
13407 <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>
13408 <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>
13409 <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>
13410 <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>
13411
13412 !! end
13413
13414
13415 !! test
13416 ISBN with a dummy number
13417 !! input
13418 ISBN ---
13419 !! result
13420 <p>ISBN ---
13421 </p>
13422 !! end
13423
13424
13425 !! test
13426 ISBN with space-delimited number
13427 !! input
13428 ISBN 92 9017 032 8
13429 !! result
13430 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
13431 </p>
13432 !! end
13433
13434
13435 !! test
13436 ISBN with multiple spaces, no number
13437 !! input
13438 ISBN foo
13439 !! result
13440 <p>ISBN foo
13441 </p>
13442 !! end
13443
13444
13445 !! test
13446 ISBN length
13447 !! input
13448 ISBN 123456789
13449
13450 ISBN 1234567890
13451
13452 ISBN 12345678901
13453 !! result
13454 <p>ISBN 123456789
13455 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13456 </p><p>ISBN 12345678901
13457 </p>
13458 !! end
13459
13460
13461 !! test
13462 ISBN with trailing year (bug 8110)
13463 !! input
13464 ISBN 1-234-56789-0 - 2006
13465
13466 ISBN 1 234 56789 0 - 2006
13467 !! result
13468 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
13469 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
13470 </p>
13471 !! end
13472
13473
13474 !! test
13475 anchorencode
13476 !! input
13477 {{anchorencode:foo bar©#%n}}
13478 !! result
13479 <p>foo_bar.C2.A9.23.25n
13480 </p>
13481 !! end
13482
13483 !! test
13484 anchorencode trims spaces
13485 !! input
13486 {{anchorencode: __pretty__please__}}
13487 !! result
13488 <p>pretty_please
13489 </p>
13490 !! end
13491
13492 !! test
13493 anchorencode deals with links
13494 !! input
13495 {{anchorencode: [[hello|world]] [[hi]]}}
13496 !! result
13497 <p>world_hi
13498 </p>
13499 !! end
13500
13501 !! test
13502 anchorencode deals with templates
13503 !! input
13504 {{anchorencode: {{Foo}} }}
13505 !! result
13506 <p>FOO
13507 </p>
13508 !! end
13509
13510 !! test
13511 anchorencode encodes like the TOC generator: (bug 18431)
13512 !! input
13513 === _ +:.3A%3A&&amp;]] ===
13514 {{anchorencode: _ +:.3A%3A&&amp;]] }}
13515 __NOEDITSECTION__
13516 !! result
13517 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
13518 <p>.2B:.3A.253A.26.26.5D.5D
13519 </p>
13520 !! end
13521
13522 # Expected output in the following test is not necessarily expected (there
13523 # should probably be <p> tags inside the <blockquote> in the output) -- it's
13524 # only testing for well-formedness.
13525 !! test
13526 Bug 6200: blockquotes and paragraph formatting
13527 !! input
13528 <blockquote>
13529 foo
13530 </blockquote>
13531
13532 bar
13533
13534 baz
13535 !! result
13536 <blockquote>
13537 foo
13538 </blockquote>
13539 <p>bar
13540 </p>
13541 <pre>baz
13542 </pre>
13543 !! end
13544
13545 !! test
13546 Bug 8293: Use of center tag ruins paragraph formatting
13547 !! input
13548 <center>
13549 foo
13550 </center>
13551
13552 bar
13553
13554 baz
13555 !! result
13556 <center>
13557 <p>foo
13558 </p>
13559 </center>
13560 <p>bar
13561 </p>
13562 <pre>baz
13563 </pre>
13564 !! end
13565
13566 !!test
13567 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
13568 !!options
13569 php
13570 !!input
13571 <span><s>x</span></s>
13572 !!result
13573 <p><span><s>x&lt;/span&gt;</s></span>
13574 </p>
13575 !!end
13576
13577 !!test
13578 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
13579 !!options
13580 parsoid
13581 !!input
13582 <span><s>x</span></s>
13583 !!result
13584 <p><span><s>x</s></span><s></s>
13585 </p>
13586 !!end
13587
13588 ###
13589 ### Language variants related tests
13590 ###
13591 !! test
13592 Self-link in language variants
13593 !! options
13594 title=[[Dunav]] language=sr
13595 !! input
13596 Both [[Dunav]] and [[Дунав]] are names for this river.
13597 !! result
13598 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
13599 </p>
13600 !!end
13601
13602 !! article
13603 Дуна
13604 !! text
13605 content
13606 !! endarticle
13607
13608 !! test
13609 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
13610 !! options
13611 title=[[Duna]] language=sr
13612 !! input
13613 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
13614 !! result
13615 <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.
13616 </p>
13617 !! end
13618
13619 !! test
13620 Link to pages in language variants
13621 !! options
13622 language=sr
13623 !! input
13624 Main Page can be written as [[Маин Паге]]
13625 !! result
13626 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
13627 </p>
13628 !!end
13629
13630
13631 !! test
13632 Multiple links to pages in language variants
13633 !! options
13634 language=sr
13635 !! input
13636 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
13637 !! result
13638 <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>.
13639 </p>
13640 !!end
13641
13642
13643 !! test
13644 Simple template in language variants
13645 !! options
13646 language=sr
13647 !! input
13648 {{тест}}
13649 !! result
13650 <p>This is a test template
13651 </p>
13652 !! end
13653
13654
13655 !! test
13656 Template with explicit namespace in language variants
13657 !! options
13658 language=sr
13659 !! input
13660 {{Template:тест}}
13661 !! result
13662 <p>This is a test template
13663 </p>
13664 !! end
13665
13666
13667 !! test
13668 Basic test for template parameter in language variants
13669 !! options
13670 language=sr
13671 !! input
13672 {{парамтест|param=foo}}
13673 !! result
13674 <p>This is a test template with parameter foo
13675 </p>
13676 !! end
13677
13678
13679 !! test
13680 Simple category in language variants
13681 !! options
13682 language=sr cat
13683 !! input
13684 [[Category:МедиаWики Усер'с Гуиде]]
13685 !! result
13686 <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>
13687 !! end
13688
13689
13690 !! article
13691 Category:分类
13692 !! text
13693 blah
13694 !! endarticle
13695
13696 !! article
13697 Category:分類
13698 !! text
13699 blah
13700 !! endarticle
13701
13702 !! test
13703 Don't convert blue categorylinks to another variant (bug 33210)
13704 !! options
13705 language=zh cat
13706 !! input
13707 [[A]][[Category:分类]]
13708 !! result
13709 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
13710 !! end
13711
13712
13713 !! test
13714 Stripping -{}- tags (language variants)
13715 !! options
13716 language=sr
13717 !! input
13718 Latin proverb: -{Ne nuntium necare}-
13719 !! result
13720 <p>Latin proverb: Ne nuntium necare
13721 </p>
13722 !! end
13723
13724
13725 !! test
13726 Prevent conversion with -{}- tags (language variants)
13727 !! options
13728 language=sr variant=sr-ec
13729 !! input
13730 Latinski: -{Ne nuntium necare}-
13731 !! result
13732 <p>Латински: Ne nuntium necare
13733 </p>
13734 !! end
13735
13736
13737 !! test
13738 Prevent conversion of text with -{}- tags (language variants)
13739 !! options
13740 language=sr variant=sr-ec
13741 !! input
13742 Latinski: -{Ne nuntium necare}-
13743 !! result
13744 <p>Латински: Ne nuntium necare
13745 </p>
13746 !! end
13747
13748
13749 !! test
13750 Prevent conversion of links with -{}- tags (language variants)
13751 !! options
13752 language=sr variant=sr-ec
13753 !! input
13754 -{[[Main Page]]}-
13755 !! result
13756 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13757 </p>
13758 !! end
13759
13760
13761 !! test
13762 -{}- tags within headlines (within html for parserConvert())
13763 !! options
13764 language=sr variant=sr-ec
13765 !! input
13766 == -{Naslov}- ==
13767 !! result
13768 <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>
13769
13770 !! end
13771
13772
13773 !! test
13774 Explicit definition of language variant alternatives
13775 !! options
13776 language=zh variant=zh-tw
13777 !! input
13778 -{zh:China;zh-tw:Taiwan}-, not China
13779 !! result
13780 <p>Taiwan, not China
13781 </p>
13782 !! end
13783
13784
13785 !! test
13786 Conversion around HTML tags
13787 !! options
13788 language=sr variant=sr-ec
13789 !! input
13790 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
13791 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
13792 !! result
13793 <p>
13794 <span title="ЛаCтин">ски</span>
13795 </p>
13796 !! end
13797
13798
13799 !! test
13800 Explicit session-wise language variant mapping (A flag and - flag)
13801 !! options
13802 language=zh variant=zh-tw
13803 !! input
13804 Taiwan is not China.
13805 But -{A|zh:China;zh-tw:Taiwan}- is China,
13806 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
13807 and -{China}- is China.
13808 !! result
13809 <p>Taiwan is not China.
13810 But Taiwan is Taiwan,
13811 (This should be stripped!)
13812 and China is China.
13813 </p>
13814 !! end
13815
13816 !! test
13817 Explicit session-wise language variant mapping (H flag for hide)
13818 !! options
13819 language=zh variant=zh-tw
13820 !! input
13821 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
13822 Taiwan is China.
13823 !! result
13824 <p>(This should be stripped!)
13825 Taiwan is Taiwan.
13826 </p>
13827 !! end
13828
13829 !! test
13830 Adding explicit conversion rule for title (T flag)
13831 !! options
13832 language=zh variant=zh-tw showtitle
13833 !! input
13834 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13835 !! result
13836 Taiwan
13837 <p>Should be stripped!
13838 </p>
13839 !! end
13840
13841 !! test
13842 Testing that changing the language variant here in the tests actually works
13843 !! options
13844 language=zh variant=zh showtitle
13845 !! input
13846 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13847 !! result
13848 China
13849 <p>Should be stripped!
13850 </p>
13851 !! end
13852
13853 !! test
13854 Recursive conversion of alt and title attrs shouldn't clear converter state
13855 !! options
13856 language=zh variant=zh-cn showtitle
13857 !! input
13858 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
13859 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
13860 !! result
13861 China
13862 <p>
13863 Should be stripped<span title="Exclamation">!</span>
13864 </p>
13865 !! end
13866
13867 !! test
13868 Bug 24072: more test on conversion rule for title
13869 !! options
13870 language=zh variant=zh-tw showtitle
13871 !! input
13872 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13873 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
13874 !! result
13875 Taiwan
13876 <p>This should be stripped!
13877 This won't take interferes with the title rule.
13878 </p>
13879 !! end
13880
13881 !! test
13882 Partly disable title conversion if variant == main language code
13883 !! options
13884 language=zh variant=zh title=[[ZH]] showtitle
13885 !! input
13886 -{T|zh-cn:CN;zh-tw:TW}-
13887 !! result
13888 ZH
13889 <p>
13890 </p>
13891 !! end
13892
13893 !! test
13894 Partly disable title conversion if variant == main language code, more
13895 !! options
13896 language=zh variant=zh title=[[ZH]] showtitle
13897 !! input
13898 -{T|TW}-
13899 !! result
13900 ZH
13901 <p>
13902 </p>
13903 !! end
13904
13905 !! test
13906 Raw output of variant escape tags (R flag)
13907 !! options
13908 language=zh variant=zh-tw
13909 !! input
13910 Raw: -{R|zh:China;zh-tw:Taiwan}-
13911 !! result
13912 <p>Raw: zh:China;zh-tw:Taiwan
13913 </p>
13914 !! end
13915
13916 !! test
13917 Nested using of manual convert syntax
13918 !! options
13919 language=zh variant=zh-hk
13920 !! input
13921 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
13922 !! result
13923 <p>Nested: Hello Hong Kong!
13924 </p>
13925 !! end
13926
13927 !! test
13928 Proper conversion of text in external links
13929 !! options
13930 language=sr variant=sr-ec
13931 !! input
13932 http://www.google.com
13933 gopher://www.google.com
13934 [http://www.google.com http://www.google.com]
13935 [gopher://www.google.com gopher://www.google.com]
13936 [https://www.google.com irc://www.google.com]
13937 [ftp://www.google.com www.google.com/ftp://dir]
13938 [//www.google.com www.google.com]
13939 !! result
13940 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13941 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13942 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13943 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13944 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
13945 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
13946 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
13947 </p>
13948 !! end
13949
13950 !! test
13951 Do not convert roman numbers to language variants
13952 !! options
13953 language=sr variant=sr-ec
13954 !! input
13955 Fridrih IV je car.
13956 !! result
13957 <p>Фридрих IV је цар.
13958 </p>
13959 !! end
13960
13961 !! test
13962 Unclosed language converter markup "-{"
13963 !! options
13964 language=sr
13965 !! input
13966 -{T|hello
13967 !! result
13968 <p>-{T|hello
13969 </p>
13970 !! end
13971
13972 !! test
13973 Don't convert raw rule "-{R|=&gt;}-" to "=>"
13974 !! options
13975 language=sr
13976 !! input
13977 -{R|=&gt;}-
13978 !! result
13979 <p>=&gt;
13980 </p>
13981 !!end
13982
13983 !! test
13984 Bug 529: Uncovered bullet
13985 !! input
13986 * Foo {{bullet}}
13987 !! result
13988 <ul><li> Foo
13989 </li><li> Bar
13990 </li></ul>
13991
13992 !! end
13993
13994 # Plain MediaWiki does not remove empty lists, but tidy actually does.
13995 # Templates in Wikipedia rely on this behavior, as tidy has always been
13996 # enabled there. These tests are normally run *without* tidy, so specify the
13997 # full output here.
13998 # To test realistic parsing behavior, apply a tidy-like transformation to both
13999 # the expected output and your parser's output.
14000 !! test
14001 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
14002 !! input
14003 ******* Foo {{bullet}}
14004 !! result
14005 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
14006 </li></ul>
14007 </li></ul>
14008 </li></ul>
14009 </li></ul>
14010 </li></ul>
14011 </li></ul>
14012 </li><li> Bar
14013 </li></ul>
14014
14015 !! end
14016
14017 !! test
14018 Bug 529: Uncovered table already at line-start
14019 !! input
14020 x
14021
14022 {{table}}
14023 y
14024 !! result
14025 <p>x
14026 </p>
14027 <table>
14028 <tr>
14029 <td> 1 </td>
14030 <td> 2
14031 </td></tr>
14032 <tr>
14033 <td> 3 </td>
14034 <td> 4
14035 </td></tr></table>
14036 <p>y
14037 </p>
14038 !! end
14039
14040 !! test
14041 Bug 529: Uncovered bullet in parser function result
14042 !! input
14043 * Foo {{lc:{{bullet}} }}
14044 !! result
14045 <ul><li> Foo
14046 </li><li> bar
14047 </li></ul>
14048
14049 !! end
14050
14051 !! test
14052 Bug 5678: Double-parsed template argument
14053 !! input
14054 {{lc:{{{1}}}|hello}}
14055 !! result
14056 <p>{{{1}}}
14057 </p>
14058 !! end
14059
14060 !! test
14061 Bug 5678: Double-parsed template invocation
14062 !! input
14063 {{lc:{{paramtest {{!}} param = hello }} }}
14064 !! result
14065 <p>{{paramtest | param = hello }}
14066 </p>
14067 !! end
14068
14069 !! test
14070 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
14071 !! options
14072 language=cs
14073 title=[[Main Page]]
14074 !! input
14075 {{PRVNÍVELKÉ:ěščř}}
14076 {{prvnívelké:ěščř}}
14077 {{PRVNÍMALÉ:ěščř}}
14078 {{prvnímalé:ěščř}}
14079 {{MALÁ:ěščř}}
14080 {{malá:ěščř}}
14081 {{VELKÁ:ěščř}}
14082 {{velká:ěščř}}
14083 !! result
14084 <p>Ěščř
14085 Ěščř
14086 ěščř
14087 ěščř
14088 ěščř
14089 ěščř
14090 ĚŠČŘ
14091 ĚŠČŘ
14092 </p>
14093 !! end
14094
14095 !! test
14096 Morwen/13: Unclosed link followed by heading
14097 !! input
14098 [[link
14099 ==heading==
14100 !! result
14101 <p>[[link
14102 </p>
14103 <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>
14104
14105 !! end
14106
14107 !! test
14108 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
14109 !! input
14110 {{foo|
14111 =heading=
14112 !! result
14113 <p>{{foo|
14114 </p>
14115 <h1><span class="mw-headline" id="heading">heading</span></h1>
14116
14117 !! end
14118
14119 !! test
14120 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
14121 !! input
14122 {{foo|
14123 ==heading==
14124 !! result
14125 <p>{{foo|
14126 </p>
14127 <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>
14128
14129 !! end
14130
14131 !! test
14132 Tildes in comments
14133 !! options
14134 pst
14135 !! input
14136 <!-- ~~~~ -->
14137 !! result
14138 <!-- ~~~~ -->
14139 !! end
14140
14141 !! test
14142 Paragraphs inside divs (no extra line breaks)
14143 !! input
14144 <div>Line one
14145
14146 Line two</div>
14147 !! result
14148 <div>Line one
14149 Line two</div>
14150
14151 !! end
14152
14153 !! test
14154 Paragraphs inside divs (extra line break on open)
14155 !! input
14156 <div>
14157 Line one
14158
14159 Line two</div>
14160 !! result
14161 <div>
14162 <p>Line one
14163 </p>
14164 Line two</div>
14165
14166 !! end
14167
14168 !! test
14169 Paragraphs inside divs (extra line break on close)
14170 !! input
14171 <div>Line one
14172
14173 Line two
14174 </div>
14175 !! result
14176 <div>Line one
14177 <p>Line two
14178 </p>
14179 </div>
14180
14181 !! end
14182
14183 !! test
14184 Paragraphs inside divs (extra line break on open and close)
14185 !! input
14186 <div>
14187 Line one
14188
14189 Line two
14190 </div>
14191 !! result
14192 <div>
14193 <p>Line one
14194 </p><p>Line two
14195 </p>
14196 </div>
14197
14198 !! end
14199
14200 !! test
14201 Nesting tags, paragraphs on lines which begin with <div>
14202 !! options
14203 disabled
14204 !! input
14205 <div></div><strong>A
14206 B</strong>
14207 !! result
14208 <div></div>
14209 <p><strong>A
14210 B</strong>
14211 </p>
14212 !! end
14213
14214 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
14215 !! test
14216 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
14217 !! options
14218 disabled
14219 !! input
14220 <blockquote>Line one
14221
14222 Line two</blockquote>
14223 !! result
14224 <blockquote>Line one
14225 Line two</blockquote>
14226
14227 !! end
14228
14229 !! test
14230 Bug 6200: paragraphs inside blockquotes (extra line break on open)
14231 !! options
14232 disabled
14233 !! input
14234 <blockquote>
14235 Line one
14236
14237 Line two</blockquote>
14238 !! result
14239 <blockquote>
14240 <p>Line one
14241 </p>
14242 Line two</blockquote>
14243
14244 !! end
14245
14246 !! test
14247 Bug 6200: paragraphs inside blockquotes (extra line break on close)
14248 !! options
14249 disabled
14250 !! input
14251 <blockquote>Line one
14252
14253 Line two
14254 </blockquote>
14255 !! result
14256 <blockquote>Line one
14257 <p>Line two
14258 </p>
14259 </blockquote>
14260
14261 !! end
14262
14263 !! test
14264 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
14265 !! options
14266 disabled
14267 !! input
14268 <blockquote>
14269 Line one
14270
14271 Line two
14272 </blockquote>
14273 !! result
14274 <blockquote>
14275 <p>Line one
14276 </p><p>Line two
14277 </p>
14278 </blockquote>
14279
14280 !! end
14281
14282 !! test
14283 Paragraphs inside blockquotes/divs (no extra line breaks)
14284 !! input
14285 <blockquote><div>Line one
14286
14287 Line two</div></blockquote>
14288 !! result
14289 <blockquote><div>Line one
14290 Line two</div></blockquote>
14291
14292 !! end
14293
14294 !! test
14295 Paragraphs inside blockquotes/divs (extra line break on open)
14296 !! input
14297 <blockquote><div>
14298 Line one
14299
14300 Line two</div></blockquote>
14301 !! result
14302 <blockquote><div>
14303 <p>Line one
14304 </p>
14305 Line two</div></blockquote>
14306
14307 !! end
14308
14309 !! test
14310 Paragraphs inside blockquotes/divs (extra line break on close)
14311 !! input
14312 <blockquote><div>Line one
14313
14314 Line two
14315 </div></blockquote>
14316 !! result
14317 <blockquote><div>Line one
14318 <p>Line two
14319 </p>
14320 </div></blockquote>
14321
14322 !! end
14323
14324 !! test
14325 Paragraphs inside blockquotes/divs (extra line break on open and close)
14326 !! input
14327 <blockquote><div>
14328 Line one
14329
14330 Line two
14331 </div></blockquote>
14332 !! result
14333 <blockquote><div>
14334 <p>Line one
14335 </p><p>Line two
14336 </p>
14337 </div></blockquote>
14338
14339 !! end
14340
14341 !! test
14342 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
14343 !! options
14344 wgLinkHolderBatchSize=0
14345 !! input
14346 [[meatball:1]]
14347 [[meatball:2]]
14348 [[meatball:3]]
14349 !! result
14350 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
14351 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
14352 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
14353 </p>
14354 !! end
14355
14356 !! test
14357 Free external link invading image caption
14358 !! input
14359 [[Image:Foobar.jpg|thumb|http://x|hello]]
14360 !! result
14361 <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>
14362
14363 !! end
14364
14365 !! test
14366 Bug 15196: localised external link numbers
14367 !! options
14368 language=fa
14369 !! input
14370 [http://en.wikipedia.org/]
14371 !! result
14372 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
14373 </p>
14374 !! end
14375
14376 !! test
14377 Multibyte character in padleft
14378 !! input
14379 {{padleft:-Hello|7|Æ}}
14380 !! result
14381 <p>Æ-Hello
14382 </p>
14383 !! end
14384
14385 !! test
14386 Multibyte character in padright
14387 !! input
14388 {{padright:Hello-|7|Æ}}
14389 !! result
14390 <p>Hello-Æ
14391 </p>
14392 !! end
14393
14394 !!test
14395 formatdate parser function
14396 !!input
14397 {{#formatdate:2009-03-24}}
14398 !! result
14399 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
14400 </p>
14401 !! end
14402
14403 !!test
14404 formatdate parser function, with default format
14405 !!input
14406 {{#formatdate:2009-03-24|mdy}}
14407 !! result
14408 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
14409 </p>
14410 !! end
14411
14412 !! test
14413 Spacing of numbers in formatted dates
14414 !! input
14415 {{#formatdate:January 15}}
14416 !! result
14417 <p><span class="mw-formatted-date" title="01-15">January 15</span>
14418 </p>
14419 !! end
14420
14421 !! test
14422 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
14423 !! options
14424 language=nl title=[[MediaWiki:Common.css]]
14425 !! input
14426 {{#formatdate:2009-03-24|dmy}}
14427 !! result
14428 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
14429 </p>
14430 !! end
14431
14432 #
14433 #
14434 #
14435
14436 #
14437 # Edit comments
14438 #
14439
14440 !! test
14441 Edit comment with link
14442 !! options
14443 comment
14444 !! input
14445 I like the [[Main Page]] a lot
14446 !! result
14447 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
14448 !!end
14449
14450 !! test
14451 Edit comment with link and link text
14452 !! options
14453 comment
14454 !! input
14455 I like the [[Main Page|best pages]] a lot
14456 !! result
14457 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14458 !!end
14459
14460 !! test
14461 Edit comment with link and link text with suffix
14462 !! options
14463 comment
14464 !! input
14465 I like the [[Main Page|best page]]s a lot
14466 !! result
14467 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14468 !!end
14469
14470 !! test
14471 Edit comment with section link (non-local, eg in history list)
14472 !! options
14473 comment title=[[Main Page]]
14474 !! input
14475 /* External links */ removed bogus entries
14476 !! result
14477 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14478 !!end
14479
14480 !! test
14481 Edit comment with section link and text before it (non-local, eg in history list)
14482 !! options
14483 comment title=[[Main Page]]
14484 !! input
14485 pre-comment text /* External links */ removed bogus entries
14486 !! result
14487 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>
14488 !!end
14489
14490 !! test
14491 Edit comment with section link (local, eg in diff view)
14492 !! options
14493 comment local title=[[Main Page]]
14494 !! input
14495 /* External links */ removed bogus entries
14496 !! result
14497 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14498 !!end
14499
14500 !! test
14501 Edit comment with subpage link (bug 14080)
14502 !! options
14503 comment
14504 subpage
14505 title=[[Subpage test]]
14506 !! input
14507 Poked at a [[/subpage]] here...
14508 !! result
14509 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
14510 !!end
14511
14512 !! test
14513 Edit comment with subpage link and link text (bug 14080)
14514 !! options
14515 comment
14516 subpage
14517 title=[[Subpage test]]
14518 !! input
14519 Poked at a [[/subpage|neat little page]] here...
14520 !! result
14521 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
14522 !!end
14523
14524 !! test
14525 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
14526 !! options
14527 comment
14528 title=[[Subpage test]]
14529 !! input
14530 Poked at a [[/subpage]] here...
14531 !! result
14532 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...
14533 !!end
14534
14535 !! test
14536 Edit comment with bare anchor link (local, as on diff)
14537 !! options
14538 comment
14539 local
14540 title=[[Main Page]]
14541 !!input
14542 [[#section]]
14543 !! result
14544 <a href="#section">#section</a>
14545 !! end
14546
14547 !! test
14548 Edit comment with bare anchor link (non-local, as on history)
14549 !! options
14550 comment
14551 title=[[Main Page]]
14552 !!input
14553 [[#section]]
14554 !! result
14555 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
14556 !! end
14557
14558 !! test
14559 Anchor starting with underscore
14560 !!input
14561 [[#_ref|One]]
14562 !! result
14563 <p><a href="#_ref">One</a>
14564 </p>
14565 !! end
14566
14567 !! test
14568 Id starting with underscore
14569 !!input
14570 <div id="_ref"></div>
14571 !! result
14572 <div id="_ref"></div>
14573
14574 !! end
14575
14576 !! test
14577 Space normalisation on autocomment (bug 22784)
14578 !! options
14579 comment
14580 title=[[Main Page]]
14581 !!input
14582 /* __hello__world__ */
14583 !! result
14584 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
14585 !! end
14586
14587 !! test
14588 percent-encoding and + signs in comments (Bug 26410)
14589 !! options
14590 comment
14591 !!input
14592 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
14593 !! result
14594 <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>
14595 !! end
14596
14597 !! test
14598 Bad images - basic functionality
14599 !! options
14600 disabled
14601 !! input
14602 [[File:Bad.jpg]]
14603 !! result
14604 !! end
14605
14606 !! test
14607 Bad images - bug 16039: text after bad image disappears
14608 !! options
14609 disabled
14610 !! input
14611 Foo bar
14612 [[File:Bad.jpg]]
14613 Bar foo
14614 !! result
14615 <p>Foo bar
14616 </p><p>Bar foo
14617 </p>
14618 !! end
14619
14620 !! test
14621 Verify that displaytitle works (bug #22501) no displaytitle
14622 !! options
14623 showtitle
14624 !! config
14625 wgAllowDisplayTitle=true
14626 wgRestrictDisplayTitle=false
14627 !! input
14628 this is not the the title
14629 !! result
14630 Parser test
14631 <p>this is not the the title
14632 </p>
14633 !! end
14634
14635 !! test
14636 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
14637 !! options
14638 showtitle
14639 title=[[Screen]]
14640 !! config
14641 wgAllowDisplayTitle=true
14642 wgRestrictDisplayTitle=false
14643 !! input
14644 this is not the the title
14645 {{DISPLAYTITLE:whatever}}
14646 !! result
14647 whatever
14648 <p>this is not the the title
14649 </p>
14650 !! end
14651
14652 !! test
14653 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
14654 !! options
14655 showtitle
14656 title=[[Screen]]
14657 !! config
14658 wgAllowDisplayTitle=true
14659 wgRestrictDisplayTitle=true
14660 !! input
14661 this is not the the title
14662 {{DISPLAYTITLE:whatever}}
14663 !! result
14664 Screen
14665 <p>this is not the the title
14666 </p>
14667 !! end
14668
14669 !! test
14670 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
14671 !! options
14672 showtitle
14673 title=[[Screen]]
14674 !! config
14675 wgAllowDisplayTitle=true
14676 wgRestrictDisplayTitle=true
14677 !! input
14678 this is not the the title
14679 {{DISPLAYTITLE:screen}}
14680 !! result
14681 screen
14682 <p>this is not the the title
14683 </p>
14684 !! end
14685
14686 !! test
14687 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
14688 !! options
14689 showtitle
14690 title=[[Screen]]
14691 !! config
14692 wgAllowDisplayTitle=false
14693 !! input
14694 this is not the the title
14695 {{DISPLAYTITLE:screen}}
14696 !! result
14697 Screen
14698 <p>this is not the the title
14699 <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>
14700 </p>
14701 !! end
14702
14703 !! test
14704 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
14705 !! options
14706 showtitle
14707 title=[[Screen]]
14708 !! config
14709 wgAllowDisplayTitle=false
14710 !! input
14711 this is not the the title
14712 !! result
14713 Screen
14714 <p>this is not the the title
14715 </p>
14716 !! end
14717
14718 !! test
14719 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
14720 !! options
14721 showtitle
14722 title=[[Screen]]
14723 !! config
14724 wgAllowDisplayTitle=true
14725 wgRestrictDisplayTitle=true
14726 !! input
14727 this is not the the title
14728 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
14729 !! result
14730 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
14731 <p>this is not the the title
14732 </p>
14733 !! end
14734
14735 !! test
14736 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
14737 !! options
14738 showtitle
14739 title=[[Screen]]
14740 !! config
14741 wgAllowDisplayTitle=true
14742 wgRestrictDisplayTitle=true
14743 !! input
14744 this is not the the title
14745 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
14746 !! result
14747 <span style="color: red;">s</span>creen
14748 <p>this is not the the title
14749 </p>
14750 !! end
14751
14752 !! test
14753 preload: check <noinclude> and <includeonly>
14754 !! options
14755 preload
14756 !! input
14757 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
14758 !! result
14759 Hello kind world.
14760 !! end
14761
14762 !! test
14763 preload: check <onlyinclude>
14764 !! options
14765 preload
14766 !! input
14767 Goodbye <onlyinclude>Hello world</onlyinclude>
14768 !! result
14769 Hello world
14770 !! end
14771
14772 !! test
14773 preload: can pass tags through if we want to
14774 !! options
14775 preload
14776 !! input
14777 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
14778 !! result
14779 <includeonly>Hello world</includeonly>
14780 !! end
14781
14782 !! test
14783 preload: check that it doesn't try to do tricks
14784 !! options
14785 preload
14786 !! input
14787 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14788 !! result
14789 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14790 !! end
14791
14792 !! test
14793 Play a bit with r67090 and bug 3158
14794 !! options
14795 disabled
14796 !! input
14797 <div style="width:50% !important">&nbsp;</div>
14798 <div style="width:50%&nbsp;!important">&nbsp;</div>
14799 <div style="width:50%&#160;!important">&nbsp;</div>
14800 <div style="border : solid;">&nbsp;</div>
14801 !! result
14802 <div style="width:50% !important">&nbsp;</div>
14803 <div style="width:50% !important">&nbsp;</div>
14804 <div style="width:50% !important">&nbsp;</div>
14805 <div style="border&#160;: solid;">&nbsp;</div>
14806
14807 !! end
14808
14809 !! test
14810 HTML5 data attributes
14811 !! input
14812 <span data-foo="bar">Baz</span>
14813 <p data-abc-def_hij="">Quuz</p>
14814 !! result
14815 <p><span data-foo="bar">Baz</span>
14816 </p>
14817 <p data-abc-def_hij="">Quuz</p>
14818
14819 !! end
14820
14821 !! test
14822 percent-encoding and + signs in internal links (Bug 26410)
14823 !! input
14824 [[User:+%]] [[Page+title%]]
14825 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
14826 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
14827 [[%33%45]] [[%33%45+]]
14828 !! result
14829 <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>
14830 <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>
14831 <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>
14832 <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>
14833 </p>
14834 !! end
14835
14836 !! test
14837 Special characters in embedded file links (bug 27679)
14838 !! input
14839 [[File:Contains & ampersand.jpg]]
14840 [[File:Does not exist.jpg|Title with & ampersand]]
14841 !! result
14842 <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>
14843 <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>
14844 </p>
14845 !! end
14846
14847
14848 !! test
14849 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
14850 !! input
14851 Text&apos;s been normalized?
14852 !! result
14853 <p>Text&#39;s been normalized?
14854 </p>
14855 !! end
14856
14857 !! test
14858 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
14859 !! input
14860 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
14861 !! result
14862 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
14863 </p>
14864 !! end
14865
14866 !! test
14867 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
14868 !! input
14869 [http://www.example.org/ ideograms]
14870 !! result
14871 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
14872 </p>
14873 !! end
14874
14875 !! test
14876 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
14877 !! input
14878 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
14879 !! result
14880 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
14881 </p>
14882 !! end
14883
14884 !! article
14885 Mediawiki:loop1
14886 !! text
14887 {{Identical|A}}
14888 !! endarticle
14889
14890 !! article
14891 Mediawiki:loop2
14892 !! text
14893 {{Identical|B}}
14894 !! endarticle
14895
14896 !! article
14897 Template:Identical
14898 !! text
14899 {{int:loop1}}
14900 {{int:loop2}}
14901 !! endarticle
14902
14903 !! test
14904 Bug 31098 Template which includes system messages which includes the template
14905 !! input
14906 {{Identical}}
14907 !! result
14908 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14909 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14910 </p>
14911 !! end
14912
14913 !! test
14914 Bug31490 Turkish: ucfirst 'blah'
14915 !! options
14916 language=tr
14917 !! input
14918 {{ucfirst:blah}}
14919 !! result
14920 <p>Blah
14921 </p>
14922 !! end
14923
14924 !! test
14925 Bug31490 Turkish: ucfirst 'ix'
14926 !! options
14927 language=tr
14928 !! input
14929 {{ucfirst:ix}}
14930 !! result
14931 <p>İx
14932 </p>
14933 !! end
14934
14935 !! test
14936 Bug31490 Turkish: lcfirst 'BLAH'
14937 !! options
14938 language=tr
14939 !! input
14940 {{lcfirst:BLAH}}
14941 !! result
14942 <p>bLAH
14943 </p>
14944 !! end
14945
14946 !! test
14947 Bug31490 Turkish: ucfırst (with a dotless i)
14948 !! options
14949 language=tr
14950 !! input
14951 {{ucfırst:blah}}
14952 !! result
14953 <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>
14954 </p>
14955 !! end
14956
14957 !! test
14958 Bug31490 ucfırst (with a dotless i) with English language
14959 !! options
14960 language=en
14961 !! input
14962 {{ucfırst:blah}}
14963 !! result
14964 <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>
14965 </p>
14966 !! end
14967
14968 !! test
14969 Bug 26375: TOC with italics
14970 !! options
14971 title=[[Main Page]]
14972 !! input
14973 __TOC__
14974 == ''Lost'' episodes ==
14975 !! result
14976 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14977 <ul>
14978 <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>
14979 </ul>
14980 </div>
14981 <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>
14982
14983 !! end
14984
14985 !! test
14986 Bug 26375: TOC with bold
14987 !! options
14988 title=[[Main Page]]
14989 !! input
14990 __TOC__
14991 == '''should be bold''' then normal text ==
14992 !! result
14993 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14994 <ul>
14995 <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>
14996 </ul>
14997 </div>
14998 <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>
14999
15000 !! end
15001
15002 !! test
15003 Bug 33845: Headings become cursive in TOC when they contain an image
15004 !! options
15005 title=[[Main Page]]
15006 !! input
15007 __TOC__
15008 == Image [[Image:foobar.jpg]] ==
15009 !! result
15010 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15011 <ul>
15012 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
15013 </ul>
15014 </div>
15015 <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>
15016
15017 !! end
15018
15019 !! test
15020 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
15021 !! options
15022 title=[[Main Page]]
15023 !! input
15024 __TOC__
15025 == <blockquote>Quote</blockquote> ==
15026 !! result
15027 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15028 <ul>
15029 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
15030 </ul>
15031 </div>
15032 <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>
15033
15034 !! end
15035
15036 !! test
15037 Unclosed tags in TOC
15038 !! options
15039 title=[[Main Page]]
15040 !! input
15041 __TOC__
15042 == Proof: 2 < 3 ==
15043 <small>Hanc marginis exiguitas non caperet.</small>
15044 QED
15045 !! result
15046 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15047 <ul>
15048 <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>
15049 </ul>
15050 </div>
15051 <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>
15052 <p><small>Hanc marginis exiguitas non caperet.</small>
15053 QED
15054 </p>
15055 !! end
15056
15057 !! test
15058 Multiple tags in TOC
15059 !! input
15060 __TOC__
15061 == <i>Foo</i> <b>Bar</b> ==
15062
15063 == <i>Foo</i> <blockquote>Bar</blockquote> ==
15064 !! result
15065 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15066 <ul>
15067 <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>
15068 <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>
15069 </ul>
15070 </div>
15071 <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>
15072 <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>
15073
15074 !! end
15075
15076 !! test
15077 Tags with parameters in TOC
15078 !! input
15079 __TOC__
15080 == <sup class="in-h2">Hello</sup> ==
15081
15082 == <sup class="a > b">Evilbye</sup> ==
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="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
15087 <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>
15088 </ul>
15089 </div>
15090 <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>
15091 <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>
15092
15093 !! end
15094
15095 !! test
15096 span tags with directionality in TOC
15097 !! input
15098 __TOC__
15099 == <span dir="ltr">C++</span> ==
15100
15101 == <span dir="rtl">זבנג!</span> ==
15102
15103 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
15104
15105 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
15106
15107 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
15108 !! result
15109 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15110 <ul>
15111 <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>
15112 <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>
15113 <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>
15114 <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>
15115 <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>
15116 </ul>
15117 </div>
15118 <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>
15119 <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>
15120 <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>
15121 <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>
15122 <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>
15123
15124 !! end
15125
15126 !! article
15127 MediaWiki:Bug32057
15128 !! text
15129 == {{int:headline_sample}} ==
15130 !! endarticle
15131
15132 !! test
15133 Bug 32057: Title needed when expanding <h> nodes.
15134 !! options
15135 title=[[Main Page]]
15136 !! input
15137 {{int:Bug32057}}
15138 !! result
15139 <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>
15140
15141 !! end
15142
15143 !! test
15144 Strip marker in urlencode
15145 !! input
15146 {{urlencode:x<nowiki/>y}}
15147 {{urlencode:x<nowiki/>y|wiki}}
15148 {{urlencode:x<nowiki/>y|path}}
15149 !! result
15150 <p>xy
15151 xy
15152 xy
15153 </p>
15154 !! end
15155
15156 !! test
15157 Strip marker in lc
15158 !! input
15159 {{lc:x<nowiki/>y}}
15160 !! result
15161 <p>xy
15162 </p>
15163 !! end
15164
15165 !! test
15166 Strip marker in uc
15167 !! input
15168 {{uc:x<nowiki/>y}}
15169 !! result
15170 <p>XY
15171 </p>
15172 !! end
15173
15174 !! test
15175 Strip marker in formatNum
15176 !! input
15177 {{formatnum:1<nowiki/>2}}
15178 {{formatnum:1<nowiki/>2|R}}
15179 !! result
15180 <p>12
15181 12
15182 </p>
15183 !! end
15184
15185 !! test
15186 Check noCommafy in formatNum
15187 !! options
15188 language=be-tarask
15189 !! input
15190 {{formatnum:123456.78}}
15191 {{formatnum:123456.78|NOSEP}}
15192 !! result
15193 <p>123 456,78
15194 123456.78
15195 </p>
15196 !! end
15197
15198 !! test
15199 Strip marker in grammar
15200 !! options
15201 language=fi
15202 !! input
15203 {{grammar:elative|foo<nowiki/>bar}}
15204 !! result
15205 <p>foobarista
15206 </p>
15207 !! end
15208
15209 !! test
15210 Strip marker in padleft
15211 !! input
15212 {{padleft:|2|x<nowiki/>y}}
15213 !! result
15214 <p>xy
15215 </p>
15216 !! end
15217
15218 !! test
15219 Strip marker in padright
15220 !! input
15221 {{padright:|2|x<nowiki/>y}}
15222 !! result
15223 <p>xy
15224 </p>
15225 !! end
15226
15227 !! test
15228 Strip marker in anchorencode
15229 !! input
15230 {{anchorencode:x<nowiki/>y}}
15231 !! result
15232 <p>xy
15233 </p>
15234 !! end
15235
15236 !! test
15237 nowiki inside link inside heading (bug 18295)
15238 !! input
15239 ==[[foo|x<nowiki>y</nowiki>z]]==
15240 !! result
15241 <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>
15242
15243 !! end
15244
15245 !! test
15246 new support for bdi element (bug 31817)
15247 !! input
15248 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
15249 !! result
15250 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
15251
15252 !!end
15253
15254 !! test
15255 Ignore pipe between table row attributes
15256 !! input
15257 {|
15258 | quux
15259 |- id=foo | style='color: red'
15260 | bar
15261 |}
15262 !! result
15263 <table>
15264 <tr>
15265 <td> quux
15266 </td></tr>
15267 <tr id="foo" style="color: red">
15268 <td> bar
15269 </td></tr></table>
15270
15271 !! end
15272
15273 !!test
15274 Gallery override link with WikiLink (bug 34852)
15275 !! input
15276 <gallery>
15277 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
15278 </gallery>
15279 !! result
15280 <ul class="gallery mw-gallery-traditional">
15281 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15282 <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>
15283 <div class="gallerytext">
15284 <p>caption
15285 </p>
15286 </div>
15287 </div></li>
15288 </ul>
15289
15290 !! end
15291
15292 !!test
15293 Gallery override link with absolute external link (bug 34852)
15294 !! input
15295 <gallery>
15296 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
15297 </gallery>
15298 !! result
15299 <ul class="gallery mw-gallery-traditional">
15300 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15301 <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>
15302 <div class="gallerytext">
15303 <p>caption
15304 </p>
15305 </div>
15306 </div></li>
15307 </ul>
15308
15309 !! end
15310
15311 !!test
15312 Gallery override link with malicious javascript (bug 34852)
15313 !! input
15314 <gallery>
15315 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
15316 </gallery>
15317 !! result
15318 <ul class="gallery mw-gallery-traditional">
15319 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15320 <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>
15321 <div class="gallerytext">
15322 <p>caption
15323 </p>
15324 </div>
15325 </div></li>
15326 </ul>
15327
15328 !! end
15329
15330 !!test
15331 Gallery with invalid title as link (bug 43964)
15332 !! input
15333 <gallery>
15334 File:foobar.jpg|link=<
15335 </gallery>
15336 !! result
15337 <ul class="gallery mw-gallery-traditional">
15338 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15339 <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>
15340 <div class="gallerytext">
15341 </div>
15342 </div></li>
15343 </ul>
15344
15345 !! end
15346
15347 !!test
15348 Language parser function
15349 !! input
15350 {{#language:ar}}
15351 !! result
15352 <p>العربية
15353 </p>
15354 !! end
15355
15356 !!test
15357 Padleft and padright as substr
15358 !! input
15359 {{padleft:|3|abcde}}
15360 {{padright:|3|abcde}}
15361 !! result
15362 <p>abc
15363 abc
15364 </p>
15365 !! end
15366
15367 !!test
15368 Special parser function
15369 !! input
15370 {{#special:RandomPage}}
15371 {{#special:BaDtItLe}}
15372 {{#special:Foobar}}
15373 !! result
15374 <p>Special:Random
15375 Special:Badtitle
15376 Special:Foobar
15377 </p>
15378 !! end
15379
15380 !!test
15381 Bug 34939 - Case insensitive link parsing ([HttP://])
15382 !! input
15383 [HttP://MediaWiki.Org/]
15384 !! result
15385 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
15386 </p>
15387 !! end
15388
15389 !!test
15390 Bug 34939 - Case insensitive link parsing ([HttP:// title])
15391 !! input
15392 [HttP://MediaWiki.Org/ MediaWiki]
15393 !! result
15394 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
15395 </p>
15396 !! end
15397
15398 !!test
15399 Bug 34939 - Case insensitive link parsing (HttP://)
15400 !! input
15401 HttP://MediaWiki.Org/
15402 !! result
15403 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
15404 </p>
15405 !! end
15406
15407
15408 ###
15409 ### Parsoids-specific tests
15410 ### Parsoid-PHP parser incompatibilities
15411 ###
15412 !!test
15413 1. SOL-sensitive wikitext tokens as template-args
15414 !!options
15415 parsoid=wt2html,wt2wt
15416 !!input
15417 {{echo|*a}}
15418 {{echo|#a}}
15419 {{echo|:a}}
15420 !!result
15421 <span about="#mwt1" typeof="mw:Transclusion">
15422 </span><ul about="#mwt1"><li>a</li></ul>
15423 <span about="#mwt2" typeof="mw:Transclusion">
15424 </span><ol about="#mwt2"><li>a</li></ol>
15425 <span about="#mwt3" typeof="mw:Transclusion">
15426 </span><dl about="#mwt3"><dd>a</dd></dl>
15427 !!end
15428
15429 #### ----------------------------------------------------------------
15430 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
15431 #### tags. Parsoid's output for these tags differs from that of the
15432 #### PHP parser.
15433 #### ----------------------------------------------------------------
15434
15435 !!test
15436 Ref: 1. ref-location should be replaced with an index span
15437 !!options
15438 parsoid
15439 !!input
15440 A <ref>foo</ref>
15441 B <ref name="x">foo</ref>
15442 C <ref name="y" />
15443 !!result
15444 <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>
15445 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>
15446 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>
15447 !!end
15448
15449 !!test
15450 Ref: 2. ref-tags with identical names should all get the same index
15451 !!options
15452 parsoid
15453 !!input
15454 A <ref name="x">foo</ref>
15455 B <ref name="x" />
15456 !!result
15457 <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>
15458 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>
15459 !!end
15460
15461 !!test
15462 Ref: 3. spaces in ref-names should be ignored
15463 !!options
15464 parsoid
15465 !!input
15466 A <ref name="x">foo</ref>
15467 B <ref name=" x " />
15468 C <ref name= x />
15469 !!result
15470 <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>
15471 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>
15472 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>
15473 !!end
15474
15475 !!test
15476 Ref: 4. 'constructor' should be accepted as a valid ref-name
15477 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
15478 !!options
15479 parsoid
15480 !!input
15481 A <ref name="constructor">foo</ref>
15482 !!result
15483 <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>
15484 !!end
15485
15486 !!test
15487 Ref: 5. body should accept generic wikitext
15488 !!options
15489 parsoid
15490 !!input
15491 A <ref>
15492 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
15493 </ref>
15494
15495 <references />
15496 !!result
15497 <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>
15498
15499 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15500 <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>
15501 </li></ol>
15502 !!end
15503
15504 !!test
15505 Ref: 6. indent-pres should not be output in ref-body
15506 !!options
15507 parsoid
15508 !!input
15509 A <ref>
15510 foo
15511 bar
15512 baz
15513 </ref>
15514
15515 <references />
15516 !!result
15517 <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>
15518
15519 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15520 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15521 bar
15522 baz
15523 </li></ol>
15524 !!end
15525
15526 !!test
15527 Ref: 6. No p-wrapping in ref-body
15528 !!options
15529 parsoid
15530 !!input
15531 A <ref>
15532 foo
15533
15534 bar
15535
15536
15537 baz
15538
15539
15540
15541 booz
15542 </ref>
15543
15544 <references />
15545 !!result
15546 <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>
15547
15548 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15549 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15550
15551 bar
15552
15553
15554 baz
15555
15556
15557
15558 booz
15559 </li></ol>
15560 !!end
15561
15562 !!test
15563 Ref: 8. transclusion wikitext has lower precedence
15564 !!options
15565 parsoid
15566 !!input
15567 A <ref> foo {{echo|</ref> B C}}
15568
15569 <references />
15570 !!result
15571 <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>
15572
15573 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15574 <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>
15575 !!end
15576
15577 !!test
15578 Ref: 9. unclosed comments should not leak out of ref-body
15579 !!options
15580 parsoid
15581 !!input
15582 A <ref> foo <!--</ref> B C
15583
15584 <references />
15585 !!result
15586 <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>
15587
15588 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15589 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
15590 !!end
15591
15592 !!test
15593 Ref: 10. Unclosed HTML tags should not leak out of ref-body
15594 !!options
15595 parsoid
15596 !!input
15597 A <ref> <b> foo </ref> B C
15598
15599 <references />
15600 !!result
15601 <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>
15602
15603 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15604 <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>
15605 !!end
15606
15607 !!test
15608 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
15609 !!options
15610 parsoid
15611 !!input
15612 A <ref>foo</ref> B
15613 C <ref>bar</ref> D
15614 !!result
15615 <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
15616 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>
15617 !!end
15618
15619 !!test
15620 Ref: 12. ref-tags act as trailing newline migration barrier
15621 !!options
15622 parsoid
15623 !!input
15624 <!--the newline at the end of this line moves out of the p-tag-->a
15625
15626 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
15627 <ref />
15628
15629 c
15630 !!result
15631 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
15632
15633
15634 <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>
15635 <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>
15636
15637
15638 <p>c</p>
15639 !!end
15640
15641 !!test
15642 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
15643 !!options
15644 parsoid
15645 !!input
15646 <ref>foo</ref> A
15647 <ref>bar
15648 </ref> B
15649 !!result
15650 <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
15651 <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>
15652 !!end
15653
15654 !!test
15655 Ref: 14. A nested ref-tag should be emitted as plain text
15656 !!options
15657 parsoid
15658 !!input
15659 <ref>foo <ref>bar</ref> baz</ref>
15660
15661 <references />
15662 !!result
15663 <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>
15664
15665 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
15666 <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>
15667 !!end
15668
15669 !!test
15670 Ref: 15. ref-tags with identical names should get identical indexes
15671 !!options
15672 parsoid
15673 !!input
15674 A1 <ref name="a">foo</ref> A2 <ref name="a" />
15675 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
15676
15677 <references />
15678 !!result
15679 <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>
15680 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>
15681
15682 <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>
15683 !!end
15684
15685 !!test
15686 References: 1. references tag without any refs should be handled properly
15687 !!options
15688 parsoid
15689 !!input
15690 <references />
15691 !!result
15692 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
15693 !!end
15694
15695 !!test
15696 References: 2. references tag with group only outputs references from that group
15697 !!options
15698 parsoid
15699 !!input
15700 A <ref group="a">foo</ref>
15701 B <ref group="b">bar</ref>
15702
15703 <references group='a' />
15704 !!result
15705 <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>
15706 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>
15707
15708 <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>
15709 !!end
15710
15711 !!test
15712 References: 3. ref list should be cleared after processing references
15713 !!options
15714 parsoid
15715 !!input
15716 A <ref>foo</ref>
15717
15718 <references />
15719
15720 B <ref>bar</ref>
15721
15722 <references />
15723 !!result
15724 <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>
15725
15726 <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>
15727
15728 <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>
15729
15730 <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>
15731 !!end
15732
15733 !!test
15734 References: 4. only referenced group should be cleared after processing references
15735 !!options
15736 parsoid
15737 !!input
15738 A <ref group="a">afoo</ref>
15739 B <ref>bfoo</ref>
15740
15741 <references group="a"/>
15742
15743 C <ref>cfoo</ref>
15744
15745 <references />
15746 !!result
15747 <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>
15748 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>
15749
15750 <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>
15751
15752 <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>
15753
15754 <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>
15755 !!end
15756
15757 !!test
15758 References: 5. ref tags in references should be processed while ignoring all other content
15759 !!options
15760 parsoid
15761 !!input
15762 A <ref name="a" />
15763 B <ref name="b">bar</ref>
15764
15765 <references>
15766 <ref name="a">foo</ref>
15767 This should just get lost.
15768 </references>
15769 !!result
15770 <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>
15771 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>
15772
15773 <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>
15774 !!end
15775
15776 !!test
15777 References: 6. <references /> from a transclusion
15778 !!options
15779 parsoid
15780 !!input
15781 {{echo|<references />}}
15782 !!result
15783 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}'></ol>
15784 !!end
15785
15786 !! test
15787 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
15788 !! options
15789 parsoid
15790 !! input
15791 A <ref>foo bar for a</ref>
15792 B <ref name="b" />
15793
15794 <references />
15795
15796 <references>
15797 <ref name="b">foo</ref>
15798 </references>
15799 !! result
15800 <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>
15801 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>
15802
15803 <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>
15804
15805 <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>
15806
15807 !! end
15808
15809 #### ----------------------------------------------------------------
15810 #### The following section of tests are primarily to test
15811 #### wikitext escaping capabilities of Parsoid. Given that
15812 #### escaping can be done any number of ways, the wikitext (input)
15813 #### is always adjusted to reflect how Parsoid adds nowiki
15814 #### escape tags.
15815 ####
15816 #### We are marking several tests as parsoid-only since the
15817 #### HTML in the result section is different from what the
15818 #### PHP parser generates for it.
15819 #### ----------------------------------------------------------------
15820
15821
15822 #### --------------- Headings ---------------
15823 #### 0. Unnested
15824 #### 1. Nested inside html <h1>=foo=</h1>
15825 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
15826 #### 3. Nested inside html with wikitext split by html tags
15827 #### 4. No escape needed
15828 #### 5. Empty headings <h1></h1>
15829 #### 6. Heading chars in SOL context
15830 #### ----------------------------------------
15831 !! test
15832 Headings: 0. Unnested
15833 !! options
15834 parsoid
15835 !! input
15836 <nowiki>=foo=</nowiki>
15837
15838 <nowiki> =foo= </nowiki>
15839 <!--cmt-->
15840 <nowiki>=foo=</nowiki>
15841
15842 =foo''a''<nowiki>=</nowiki>
15843 !! result
15844 <p><span typeof="mw:Nowiki">=foo=</span></p>
15845
15846 <p><span typeof="mw:Nowiki"> =foo= </span>
15847 <!--cmt-->
15848 <span typeof="mw:Nowiki">=foo=</span></p>
15849
15850 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
15851 !!end
15852
15853 !! test
15854 Headings: 1. Nested inside html
15855 !! options
15856 parsoid
15857 !! input
15858 =<nowiki>=foo=</nowiki>=
15859
15860 ==<nowiki>=foo=</nowiki>==
15861
15862 ===<nowiki>=foo=</nowiki>===
15863
15864 ====<nowiki>=foo=</nowiki>====
15865
15866 =====<nowiki>=foo=</nowiki>=====
15867
15868 ======<nowiki>=foo=</nowiki>======
15869 !! result
15870 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
15871 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
15872 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
15873 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
15874 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
15875 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
15876 !!end
15877
15878 !! test
15879 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
15880 !! options
15881 parsoid
15882 !! input
15883 =foo=
15884 <nowiki>*</nowiki>bar
15885
15886 =foo=
15887 =bar
15888
15889 =foo=
15890 <nowiki>=bar=</nowiki>
15891 !! result
15892 <h1>foo</h1>*bar
15893 <h1>foo</h1>=bar
15894 <h1>foo</h1>=bar=
15895 !!end
15896
15897 !! test
15898 Headings: 3. Nested inside html with wikitext split by html tags
15899 !! options
15900 parsoid
15901 !! input
15902 =='''bold'''<nowiki>foo=</nowiki>=
15903 !! result
15904 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
15905 !!end
15906
15907 !! test
15908 Headings: 4a. No escaping needed (testing just h1 and h2)
15909 !! options
15910 parsoid
15911 !! input
15912 ==foo=
15913
15914 =foo==
15915
15916 = =foo= =
15917
15918 ==foo= bar=
15919
15920 ===foo==
15921
15922 ==foo===
15923
15924 =''=''foo==
15925
15926 =<nowiki>=</nowiki>=
15927 !! result
15928 <h1>=foo</h1>
15929 <h1>foo=</h1>
15930 <h1> =foo= </h1>
15931 <h1>=foo= bar</h1>
15932 <h2>=foo</h2>
15933 <h2>foo=</h2>
15934 <h1><i>=</i>foo=</h1>
15935 <h1><span typeof="mw:Nowiki">=</span></h1>
15936 !!end
15937
15938 !! test
15939 Headings: 4b. No escaping needed (inside p-tags)
15940 !! options
15941 parsoid
15942 !! input
15943 ===
15944 =foo= x
15945 =foo= <s></s>
15946 !! result
15947 <p>===
15948 =foo= x
15949 =foo= <s></s>
15950 </p>
15951 !!end
15952
15953 !! test
15954 Headings: 5. Empty headings
15955 !! options
15956 parsoid
15957 !! input
15958 =<nowiki/>=
15959
15960 ==<nowiki/>==
15961
15962 ===<nowiki/>===
15963
15964 ====<nowiki/>====
15965
15966 =====<nowiki/>=====
15967
15968 ======<nowiki/>======
15969 !! result
15970 <h1></h1>
15971 <h2></h2>
15972 <h3></h3>
15973 <h4></h4>
15974 <h5></h5>
15975 <h6></h6>
15976 !!end
15977
15978 !! test
15979 Headings: 6a. Heading chars in SOL context (with trailing spaces)
15980 !! options
15981 parsoid
15982 !! input
15983 <nowiki>=a=</nowiki>
15984
15985 <nowiki>=a=</nowiki>
15986
15987 <nowiki>=a=</nowiki>
15988
15989 <nowiki>=a=</nowiki>
15990 !! result
15991 <p>=a=</p>
15992 <p>=a= </p>
15993 <p>=a= </p>
15994 <p>=a= </p>
15995 !!end
15996
15997 !! test
15998 Headings: 6b. Heading chars in SOL context (with trailing newlines)
15999 !! options
16000 parsoid
16001 !! input
16002 <nowiki>=a=
16003 b</nowiki>
16004
16005 <nowiki>=a=
16006 b</nowiki>
16007
16008 <nowiki>=a=
16009 b</nowiki>
16010
16011 <nowiki>=a=
16012 b</nowiki>
16013 !! result
16014 <p>=a=
16015 b</p>
16016 <p>=a=
16017 b</p>
16018 <p>=a=
16019 b</p>
16020 <p>=a=
16021 b</p>
16022 </p>
16023 !!end
16024
16025 !! test
16026 Headings: 6c. Heading chars in SOL context (leading newline break)
16027 !! options
16028 parsoid
16029 !! input
16030 a
16031 <nowiki>=b=</nowiki>
16032 !! result
16033 <p>a
16034 =b=</p>
16035 !!end
16036
16037 !! test
16038 Headings: 6d. Heading chars in SOL context (with interspersed comments)
16039 !! options
16040 parsoid
16041 !! input
16042 <!--c0--><nowiki>=a=</nowiki>
16043 <!--c1-->
16044 <nowiki>=a=</nowiki> <!--c2--> <!--c3-->
16045 !! result
16046 <p><!--c0-->=a=</p>
16047 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
16048 !!end
16049
16050 !! test
16051 Headings: 6d. Heading chars in SOL context (No escaping needed)
16052 !! options
16053 parsoid=html2wt
16054 !! input
16055 =a=<div>b</div>
16056 !! result
16057 =a=<div>b</div>
16058 !!end
16059
16060 #### --------------- Lists ---------------
16061 #### 0. Outside nests (*foo, etc.)
16062 #### 1. Nested inside html <ul><li>*foo</li></ul>
16063 #### 2. Inside definition lists
16064 #### 3. Only bullets at start should be escaped
16065 #### 4. No escapes needed
16066 #### 5. No unnecessary escapes
16067 #### 6. Escape bullets in SOL position
16068 #### 7. Escape bullets in a multi-line context
16069 #### ----------------------------------------
16070
16071 !! test
16072 Lists: 0. Outside nests
16073 !! input
16074 <nowiki>*</nowiki>foo
16075
16076 <nowiki>#</nowiki>foo
16077 !! result
16078 <p>*foo
16079 </p><p>#foo
16080 </p>
16081 !!end
16082
16083 !! test
16084 Lists: 1. Nested inside html
16085 !! input
16086 *<nowiki>*foo</nowiki>
16087
16088 *<nowiki>#foo</nowiki>
16089
16090 *<nowiki>:foo</nowiki>
16091
16092 *<nowiki>;foo</nowiki>
16093
16094 #<nowiki>*foo</nowiki>
16095
16096 #<nowiki>#foo</nowiki>
16097
16098 #<nowiki>:foo</nowiki>
16099
16100 #<nowiki>;foo</nowiki>
16101 !! result
16102 <ul><li>*foo
16103 </li></ul>
16104 <ul><li>#foo
16105 </li></ul>
16106 <ul><li>:foo
16107 </li></ul>
16108 <ul><li>;foo
16109 </li></ul>
16110 <ol><li>*foo
16111 </li></ol>
16112 <ol><li>#foo
16113 </li></ol>
16114 <ol><li>:foo
16115 </li></ol>
16116 <ol><li>;foo
16117 </li></ol>
16118
16119 !!end
16120
16121 !! test
16122 Lists: 2. Inside definition lists
16123 !! input
16124 ;<nowiki>;foo</nowiki>
16125
16126 ;<nowiki>:foo</nowiki>
16127
16128 ;<nowiki>:foo</nowiki>
16129 :bar
16130
16131 :<nowiki>:foo</nowiki>
16132 !! result
16133 <dl><dt>;foo
16134 </dt></dl>
16135 <dl><dt>:foo
16136 </dt></dl>
16137 <dl><dt>:foo
16138 </dt><dd>bar
16139 </dd></dl>
16140 <dl><dd>:foo
16141 </dd></dl>
16142
16143 !!end
16144
16145 !! test
16146 Lists: 3. Only bullets at start of text should be escaped
16147 !! input
16148 *<nowiki>*foo*bar</nowiki>
16149
16150 *<nowiki>*foo</nowiki>''it''*bar
16151 !! result
16152 <ul><li>*foo*bar
16153 </li></ul>
16154 <ul><li>*foo<i>it</i>*bar
16155 </li></ul>
16156
16157 !!end
16158
16159 !! test
16160 Lists: 4. No escapes needed
16161 !! options
16162 parsoid
16163 !! input
16164 *foo*bar
16165
16166 *''foo''*bar
16167
16168 *[[Foo]]: bar
16169 !! result
16170 <ul><li>foo*bar
16171 </li></ul>
16172 <ul><li><i>foo</i>*bar
16173 </li></ul>
16174 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
16175 </li></ul>
16176 !!end
16177
16178 !! test
16179 Lists: 5. No unnecessary escapes
16180 !! input
16181 * bar <span><nowiki>[[foo]]</nowiki></span>
16182
16183 *=bar <span><nowiki>[[foo]]</nowiki></span>
16184
16185 *[[bar <span><nowiki>[[foo]]</nowiki></span>
16186
16187 *]]bar <span><nowiki>[[foo]]</nowiki></span>
16188
16189 *=bar <span>foo]]</span>=
16190
16191 * <s></s>: a
16192 !! result
16193 <ul><li> bar <span>[[foo]]</span>
16194 </li></ul>
16195 <ul><li>=bar <span>[[foo]]</span>
16196 </li></ul>
16197 <ul><li>[[bar <span>[[foo]]</span>
16198 </li></ul>
16199 <ul><li>]]bar <span>[[foo]]</span>
16200 </li></ul>
16201 <ul><li>=bar <span>foo]]</span>=
16202 </li></ul>
16203 <ul><li> <s></s>: a
16204 </li></ul>
16205
16206 !!end
16207
16208 !! test
16209 Lists: 6. Escape bullets in SOL position
16210 !! options
16211 parsoid
16212 !! input
16213 <!--cmt--><nowiki>*foo</nowiki>
16214 !! result
16215 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
16216 !!end
16217
16218 !! test
16219 Lists: 7. Escape bullets in a multi-line context
16220 !! input
16221 a
16222 <nowiki>*</nowiki>b
16223 !! result
16224 <p>a
16225 *b
16226 </p>
16227 !!end
16228
16229 #### --------------- HRs ---------------
16230 #### 1. Single line
16231 #### -----------------------------------
16232
16233 !! test
16234 HRs: 1. Single line
16235 !! options
16236 parsoid
16237 !! input
16238 ----<nowiki>----</nowiki>
16239 ----=foo=
16240 ----*foo
16241 !! result
16242 <hr><span typeof="mw:Nowiki">----</span>
16243 <hr>=foo=
16244 <hr>*foo
16245 !! end
16246
16247 #### --------------- Tables ---------------
16248 #### 1a. Simple example
16249 #### 1b. No escaping needed (!foo)
16250 #### 1c. No escaping needed (|foo)
16251 #### 1d. No escaping needed (|}foo)
16252 ####
16253 #### 2a. Nested in td (<td>foo|bar</td>)
16254 #### 2b. Nested in td (<td>foo||bar</td>)
16255 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
16256 ####
16257 #### 3a. Nested in th (<th>foo!bar</th>)
16258 #### 3b. Nested in th (<th>foo!!bar</th>)
16259 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
16260 ####
16261 #### 4a. Escape -
16262 #### 4b. Escape +
16263 #### 4c. No escaping needed
16264 #### --------------------------------------
16265
16266 !! test
16267 Tables: 1a. Simple example
16268 !! input
16269 <nowiki>{|
16270 |}</nowiki>
16271 !! result
16272 <p>{|
16273 |}
16274 </p>
16275 !! end
16276
16277 !! test
16278 Tables: 1b. No escaping needed
16279 !! input
16280 !foo
16281 !! result
16282 <p>!foo
16283 </p>
16284 !! end
16285
16286 !! test
16287 Tables: 1c. No escaping needed
16288 !! input
16289 |foo
16290 !! result
16291 <p>|foo
16292 </p>
16293 !! end
16294
16295 !! test
16296 Tables: 1d. No escaping needed
16297 !! input
16298 |}foo
16299 !! result
16300 <p>|}foo
16301 </p>
16302 !! end
16303
16304 !! test
16305 Tables: 2a. Nested in td
16306 !! options
16307 parsoid
16308 !! input
16309 {|
16310 |<nowiki>foo|bar</nowiki>
16311 |}
16312 !! result
16313 <table><tbody><tr>
16314 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
16315 !! end
16316
16317 !! test
16318 Tables: 2b. Nested in td
16319 !! options
16320 parsoid
16321 !! input
16322 {|
16323 |<nowiki>foo||bar</nowiki>
16324 |''it''<nowiki>foo||bar</nowiki>
16325 |}
16326 !! result
16327 <table><tbody><tr>
16328 <td><span typeof="mw:Nowiki">foo||bar</span></td>
16329 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
16330 !! end
16331
16332 !! test
16333 Tables: 2c. Nested in td -- no escaping needed
16334 !! options
16335 parsoid
16336 !! input
16337 {|
16338 |foo!!bar
16339 |}
16340 !! result
16341 <table><tbody><tr><td>foo!!bar
16342 </td></tr></tbody></table>
16343
16344 !! end
16345
16346 !! test
16347 Tables: 3a. Nested in th
16348 !! options
16349 parsoid
16350 !! input
16351 {|
16352 !foo!bar
16353 |}
16354 !! result
16355 <table><tbody><tr><th>foo!bar
16356 </th></tr></tbody></table>
16357
16358 !! end
16359
16360 !! test
16361 Tables: 3b. Nested in th
16362 !! options
16363 parsoid
16364 !! input
16365 {|
16366 !<nowiki>foo!!bar</nowiki>
16367 |}
16368 !! result
16369 <table>
16370 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
16371 </tbody></table>
16372 !! end
16373
16374 !! test
16375 Tables: 3c. Nested in th -- no escaping needed
16376 !! options
16377 parsoid
16378 !! input
16379 {|
16380 !<nowiki>foo||bar</nowiki>
16381 |}
16382 !! result
16383 <table><tbody><tr>
16384 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
16385 !! end
16386
16387 !! test
16388 Tables: 4a. Escape -
16389 !! options
16390 parsoid
16391 !! input
16392 {|
16393 |-
16394 !-bar
16395 |-
16396 |<nowiki>-bar</nowiki>
16397 |}
16398 !! result
16399 <table><tbody>
16400 <tr><th>-bar</th></tr>
16401 <tr>
16402 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
16403 !! end
16404
16405 !! test
16406 Tables: 4b. Escape +
16407 !! options
16408 parsoid
16409 !! input
16410 {|
16411 |-
16412 !+bar
16413 |-
16414 |<nowiki>+bar</nowiki>
16415 |}
16416 !! result
16417 <table><tbody>
16418 <tr><th>+bar</th></tr>
16419 <tr>
16420 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
16421 !! end
16422
16423 !! test
16424 Tables: 4c. No escaping needed
16425 !! options
16426 parsoid
16427 !! input
16428 {|
16429 |-
16430 |foo-bar
16431 |foo+bar
16432 |-
16433 |''foo''-bar
16434 |''foo''+bar
16435 |-
16436 |foo
16437 bar|baz
16438 +bar
16439 -bar
16440 |}
16441 !! result
16442 <table><tbody>
16443 <tr><td>foo-bar</td><td>foo+bar</td></tr>
16444 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
16445 <tr><td>foo
16446 <p>bar|baz
16447 +bar
16448 -bar</p></td></tr>
16449 </tbody></table>
16450 !! end
16451
16452 ### SSS FIXME: Disabled right now because accurate html2wt
16453 ### on this snippet requires data-parsoid flags that we've
16454 ### stripped out of these tests. We should scheme how we
16455 ### we want to handle these kind of tests that require
16456 ### data-parsoid flags for accurate html2wt serialization
16457
16458 !! test
16459 Tables: 4d. No escaping needed
16460 !! options
16461 disabled
16462 !! input
16463 {|
16464 ||+1
16465 ||-2
16466 |}
16467 !! result
16468 <table>
16469 <tr>
16470 <td>+1
16471 </td>
16472 <td>-2
16473 </td></tr></table>
16474
16475 !! end
16476
16477 #### --------------- Links ----------------
16478 #### 1. Quote marks in link text
16479 #### 2. Wikilinks: Escapes needed
16480 #### 3. Wikilinks: No escapes needed
16481 #### 4. Extlinks: Escapes needed
16482 #### 5. Extlinks: No escapes needed
16483 #### --------------------------------------
16484 !! test
16485 Links 1. Quote marks in link text
16486 !! options
16487 parsoid
16488 !! input
16489 [[Foo|Foo<nowiki>''boo''</nowiki>]]
16490 !! result
16491 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
16492 !! end
16493
16494 !! test
16495 Links 2. WikiLinks: Escapes needed
16496 !! options
16497 parsoid
16498 !! input
16499 [[Foo|<nowiki>[Foobar]</nowiki>]]
16500 [[Foo|<nowiki>Foobar]</nowiki>]]
16501 [[Foo|x [Foobar] x]]
16502 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
16503 [[Foo|<nowiki>[[Bar]]</nowiki>]]
16504 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
16505 [[Foo|<nowiki>|Bar</nowiki>]]
16506 [[Foo|<nowiki>]]bar</nowiki>]]
16507 [[Foo|<nowiki>[[bar</nowiki>]]
16508 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
16509 !! result
16510 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
16511 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
16512 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
16513 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
16514 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
16515 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
16516 <a href="Foo" rel="mw:WikiLink">|Bar</a>
16517 <a href="Foo" rel="mw:WikiLink">]]bar</a>
16518 <a href="Foo" rel="mw:WikiLink">[[bar</a>
16519 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
16520 !! end
16521
16522 !! test
16523 Links 3. WikiLinks: No escapes needed
16524 !! options
16525 parsoid
16526 !! input
16527 [[Foo|[Foobar]]
16528 [[Foo|foo|bar]]
16529 !! result
16530 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
16531 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
16532 !! end
16533
16534 !! test
16535 Links 4. ExtLinks: Escapes needed
16536 !! options
16537 parsoid
16538 !! input
16539 [http://google.com <nowiki>[google]</nowiki>]
16540 [http://google.com <nowiki>google]</nowiki>]
16541 !! result
16542 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
16543 <a href="http://google.com" rel="mw:ExtLink">google]</a>
16544 !! end
16545
16546 !! test
16547 Links 5. ExtLinks: No escapes needed
16548 !! options
16549 parsoid
16550 !! input
16551 [http://google.com [google]
16552 !! result
16553 <a href="http://google.com" rel="mw:ExtLink">[google</a>
16554 !! end
16555
16556 #### --------------- Quotes ---------------
16557 #### 1. Quotes inside <b> and <i>
16558 #### 2. Link fragments separated by <i> and <b> tags
16559 #### 3. Link fragments inside <i> and <b>
16560 #### 4. No escaping needed
16561 #### --------------------------------------
16562 !! test
16563 1. Quotes inside <b> and <i>
16564 !! options
16565 parsoid=html2wt,wt2wt
16566 !! input
16567 ''<nowiki>'foo'</nowiki>''
16568 ''<nowiki>''foo''</nowiki>''
16569 ''<nowiki>'''foo'''</nowiki>''
16570 ''foo''<nowiki/>'s
16571 '''<nowiki>'foo'</nowiki>'''
16572 '''<nowiki>''foo''</nowiki>'''
16573 '''<nowiki>'''foo'''</nowiki>'''
16574 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
16575 '''foo'''<nowiki/>'s
16576 '''foo''
16577 ''foo''<nowiki/>'
16578 '<nowiki/>''foo''<nowiki/>'
16579 ''''foo'''
16580 '''foo'''<nowiki/>'
16581 '<nowiki/>'''foo'''<nowiki/>'
16582 !! result
16583 <p><i>'foo'</i>
16584 <i>''foo''</i>
16585 <i>'''foo'''</i>
16586 <i>foo</i>'s
16587 <b>'foo'</b>
16588 <b>''foo''</b>
16589 <b>'''foo'''</b>
16590 <b>foo'<i>bar'</i>baz</b>
16591 <b>foo</b>'s
16592 '<i>foo</i>
16593 <i>foo</i>'
16594 '<i>foo</i>'
16595 '<b>foo</b>
16596 <b>foo</b>'
16597 '<b>foo</b>'</p>
16598 !! end
16599
16600 !! test
16601 2. Link fragments separated by <i> and <b> tags
16602 !! input
16603 [[''foo''<nowiki>hello]]</nowiki>
16604
16605 [['''foo'''<nowiki>hello]]</nowiki>
16606 !! result
16607 <p>[[<i>foo</i>hello]]
16608 </p><p>[[<b>foo</b>hello]]
16609 </p>
16610 !! end
16611
16612 !! test
16613 3. Link fragments inside <i> and <b>
16614 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
16615 this is one of the shortcomings of this format)
16616 !! input
16617 ''[[foo''<nowiki>]]</nowiki>
16618
16619 '''[[foo'''<nowiki>]]</nowiki>
16620 !! result
16621 <p><i>[[foo</i>]]
16622 </p><p><b>[[foo</b>]]
16623 </p>
16624 !! end
16625
16626 !! test
16627 4. No escaping needed
16628 !! input
16629 '<span>''bar''</span>'
16630 '<span>'''bar'''</span>'
16631 !! result
16632 <p>'<span><i>bar</i></span>'
16633 '<span><b>bar</b></span>'
16634 </p>
16635 !! end
16636
16637 #### ----------- Paragraphs ---------------
16638 #### 1. No unnecessary escapes
16639 #### --------------------------------------
16640
16641 !! test
16642 1. No unnecessary escapes
16643 !! input
16644 bar <span><nowiki>[[foo]]</nowiki></span>
16645
16646 =bar <span><nowiki>[[foo]]</nowiki></span>
16647
16648 [[bar <span><nowiki>[[foo]]</nowiki></span>
16649
16650 ]]bar <span><nowiki>[[foo]]</nowiki></span>
16651
16652 =bar <span>foo]]</span><nowiki>=</nowiki>
16653 !! result
16654 <p>bar <span>[[foo]]</span>
16655 </p><p>=bar <span>[[foo]]</span>
16656 </p><p>[[bar <span>[[foo]]</span>
16657 </p><p>]]bar <span>[[foo]]</span>
16658 </p><p>=bar <span>foo]]</span>=
16659 </p>
16660 !!end
16661
16662 #### ----------------------- PRE --------------------------
16663 #### 1. Leading whitespace in SOL context should be escaped
16664 #### ------------------------------------------------------
16665 !! test
16666 1. Leading whitespace in SOL context should be escaped
16667 !! options
16668 parsoid
16669 !! input
16670 <nowiki> </nowiki>a
16671
16672 <nowiki> </nowiki> a
16673
16674 <nowiki> </nowiki>a(tab)
16675
16676 <nowiki> </nowiki> a
16677 <!--cmt-->
16678 <nowiki> </nowiki> a
16679
16680 a
16681 <nowiki> </nowiki>b
16682
16683 a
16684 <nowiki> </nowiki>b
16685
16686 a
16687 <nowiki> </nowiki> b
16688 !! result
16689 <p> a</p>
16690 <p> a</p>
16691 <p> a(tab)</p>
16692 <p> a</p>
16693 <p><!--cmt--> a</p>
16694 <p>a
16695 b</p>
16696 <p>a
16697 b</p>
16698 <p>a
16699 b</p>
16700 !! end
16701
16702 #### --------------- HTML tags ---------------
16703 #### 1. a tags
16704 #### 2. other tags
16705 #### 3. multi-line html tag
16706 #### -----------------------------------------
16707 !! test
16708 1. a tags
16709 !! options
16710 parsoid
16711 !! input
16712 <a href="http://google.com">google</a>
16713 !! result
16714 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
16715 !! end
16716
16717 !! test
16718 2. other tags
16719 !! input
16720 <nowiki><div>foo</div>
16721 <div style="color:red">foo</div></nowiki>
16722 !! result
16723 <p>&lt;div&gt;foo&lt;/div&gt;
16724 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
16725 </p>
16726 !! end
16727
16728 !! test
16729 3. multi-line html tag
16730 !! input
16731 <nowiki><div
16732 >foo</div
16733 ></nowiki>
16734 !! result
16735 <p>&lt;div
16736 &gt;foo&lt;/div
16737 &gt;
16738 </p>
16739 !! end
16740
16741 !! test
16742 4. extension tags
16743 !! input
16744 <nowiki><ref>foo</ref></nowiki>
16745 !! result
16746 <p>&lt;ref&gt;foo&lt;/ref&gt;
16747 </p>
16748 !! end
16749
16750 #### --------------- Others ---------------
16751 !! test
16752 Escaping nowikis
16753 !! input
16754 &lt;nowiki&gt;foo&lt;/nowiki&gt;
16755 !! result
16756 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
16757 </p>
16758 !! end
16759
16760 ## The quote-char in the input is necessary for triggering the bug
16761 !! test
16762 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
16763 !! options
16764 parsoid=wt2wt,html2wt
16765 !! input
16766 foo's bar :
16767 !! result
16768 <p>foo's bar :</p>
16769 !! end
16770
16771 !! test
16772
16773 Tag-like HTML structures are passed through as text
16774 !! input
16775 <x y>
16776
16777 <x.y>
16778
16779 <x-y>
16780
16781 1>2
16782
16783 x<y
16784
16785 a>b
16786
16787 1<d e>f
16788 !! result
16789 <p>&lt;x y&gt;
16790 </p><p>&lt;x.y&gt;
16791 </p><p>&lt;x-y&gt;
16792 </p><p>1&gt;2
16793 </p><p>x&lt;y
16794 </p><p>a&gt;b
16795 </p><p>1&lt;d e&gt;f
16796 </p>
16797 !! end
16798
16799
16800 # This was a bug in the PHP parser (see bug 17663 and its dups,
16801 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
16802 !! test
16803 Tag names followed by punctuation should not be recognized as tags
16804 !! input
16805 <s.ome> text
16806 !! result
16807 <p>&lt;s.ome&gt; text
16808 </p>
16809 !! end
16810
16811 !! test
16812 HTML tag with necessary entities in attributes
16813 !! input
16814 <span title="&amp;amp;">foo</span>
16815 !! result
16816 <p><span title="&amp;amp;">foo</span>
16817 </p>
16818 !! end
16819
16820 !! test
16821 HTML tag with 'unnecessary' entity encoding in attributes
16822 !! input
16823 <span title="&amp;">foo</span>
16824 !! result
16825 <p><span title="&amp;">foo</span>
16826 </p>
16827 !! end
16828
16829 !! test
16830 HTML tag with broken attribute value quoting
16831 !! input
16832 <span title="Hello world>Foo</span>
16833 !! result
16834 <p><span>Foo</span>
16835 </p>
16836 !! end
16837
16838 !! test
16839 Parsoid-only: HTML tag with broken attribute value quoting
16840 !! options
16841 parsoid
16842 !! input
16843 <span title="Hello world>Foo</span>
16844 !! result
16845 <p><span title="Hello world">Foo</span>
16846 </p>
16847 !! end
16848
16849 !! test
16850 Table with broken attribute value quoting
16851 !! input
16852 {|
16853 | title="Hello world|Foo
16854 |}
16855 !! result
16856 <table>
16857 <tr>
16858 <td>Foo
16859 </td></tr></table>
16860
16861 !! end
16862
16863 !! test
16864 Table with broken attribute value quoting on consecutive lines
16865 !! input
16866 {|
16867 | title="Hello world|Foo
16868 | style="color:red|Bar
16869 |}
16870 !! result
16871 <table>
16872 <tr>
16873 <td>Foo
16874 </td>
16875 <td>Bar
16876 </td></tr></table>
16877
16878 !! end
16879
16880 !! test
16881 Parsoid-only: Table with broken attribute value quoting on consecutive lines
16882 !! options
16883 parsoid
16884 !! input
16885 {|
16886 | title="Hello world|Foo
16887 | style="color:red|Bar
16888 |}
16889 !! result
16890 <table><tbody>
16891 <tr>
16892 <td title="Hello world">Foo
16893 </td><td style="color: red">Bar
16894 </td></tr></tbody></table>
16895
16896 !! end
16897
16898 !! test
16899 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16900 !! options
16901 parsoid
16902 !! input
16903 {{}}
16904 !! result
16905 {{}}
16906 !! end
16907
16908 !! test
16909 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16910 !! options
16911 parsoid
16912 !! input
16913 }}{{
16914 !! result
16915 }}{{
16916 !! end
16917
16918 !!test
16919 Accept empty td cell attribute
16920 !!input
16921 {|
16922 | align="center" | foo || |
16923 |}
16924 !!result
16925 <table>
16926 <tr>
16927 <td align="center"> foo </td>
16928 <td>
16929 </td></tr></table>
16930
16931 !!end
16932
16933 !!test
16934 Non-empty attributes in th-cells
16935 !!input
16936 {|
16937 ! Foo !! style="color: red" | Bar
16938 |}
16939 !!result
16940 <table>
16941 <tr>
16942 <th> Foo </th>
16943 <th style="color: red"> Bar
16944 </th></tr></table>
16945
16946 !!end
16947
16948 !!test
16949 Accept empty attributes in th-cells
16950 !!input
16951 {|
16952 !| foo !!| bar
16953 |}
16954 !!result
16955 <table>
16956 <tr>
16957 <th> foo </th>
16958 <th> bar
16959 </th></tr></table>
16960
16961 !!end
16962
16963 !!test
16964 Empty table rows go away
16965 !!input
16966 {|
16967 | Hello
16968 | there
16969 |- class="foo"
16970 |-
16971 |}
16972 !! result
16973 <table>
16974 <tr>
16975 <td> Hello
16976 </td>
16977 <td> there
16978 </td></tr>
16979
16980 </table>
16981
16982 !! end
16983
16984 ###
16985 ### Parsoid-centric tests for testing RTing of inter-element separators
16986 ### Edge cases not tested by existing parser tests and specific to
16987 ### Parsoid-specific serialization strategies.
16988 ###
16989
16990 !!test
16991 RT-ed inter-element separators should be valid separators
16992 !!input
16993 {|
16994 |- [[foo]]
16995 |}
16996 !!result
16997 <table>
16998
16999 </table>
17000
17001 !!end
17002
17003 !!test
17004 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
17005 (Parsoid-only since PHP parser relies on Tidy for correct output)
17006 !!options
17007 parsoid
17008 !!input
17009 {|
17010 |<small>foo
17011 bar
17012 |}
17013
17014 {|
17015 |<small>foo<small>
17016 |}
17017 !!result
17018 !!end
17019
17020 !!test
17021 Empty TD followed by TD with tpl-generated attribute
17022 !!input
17023 {|
17024 |-
17025 |
17026 |{{echo|style='color:red'}}|foo
17027 |}
17028 !!result
17029 <table>
17030
17031 <tr>
17032 <td>
17033 </td>
17034 <td>foo
17035 </td></tr></table>
17036
17037 !!end
17038
17039 !!test
17040 Indented table with an empty td
17041 !!input
17042 {|
17043 |-
17044 |
17045 |foo
17046 |}
17047 !!result
17048 <table>
17049
17050 <tr>
17051 <td>
17052 </td>
17053 <td>foo
17054 </td></tr></table>
17055
17056 !!end
17057
17058 !!test
17059 Empty TR followed by a template-generated TR
17060 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
17061 !!options
17062 parsoid=wt2html,wt2wt
17063 !!input
17064 {|
17065 |-
17066 {{echo|<tr><td>foo</td></tr>}}
17067 |}
17068 !!result
17069 <table>
17070 <tbody>
17071 <tr></tr>
17072 <tr typeof="mw:Transclusion">
17073 <td>foo</td></tr></tbody></table>
17074 !!end
17075
17076 ## PHP and parsoid output differ for this, and since this is primarily
17077 ## for testing Parsoid's serializer, marking this Parsoid only
17078 !!test
17079 Empty TR followed by mixed-ws-comment line should RT correctly
17080 !!options
17081 parsoid
17082 !!input
17083 {|
17084 |-
17085 <!--c-->
17086 |-
17087 <!--c--> <!--d-->
17088 |}
17089 !!result
17090 <table>
17091 <tbody>
17092 <tr>
17093 <td> <!--c--></td></tr>
17094 <tr>
17095 <td><!--c--> <!--d--></td></tr>
17096 </tbody></table>
17097
17098 !!end
17099
17100 !!test
17101 Multi-line image caption generated by templates with/without trailing newlines
17102 !!options
17103 parsoid
17104 !!input
17105 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
17106 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
17107 !!result
17108 <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>
17109 <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>
17110
17111 !!end
17112
17113 ## PHP emits broken html for this, and since this is primarily
17114 ## a Parsoid serializer test, marking this Parsoid only
17115 !!test
17116 Improperly nested inline or quotes tags with whitespace in between
17117 !!options
17118 parsoid
17119 !!input
17120 <span> <s>x</span> </s>
17121 ''' ''x''' ''
17122 !!result
17123 <p><span> <s>x</s></span><s> </s>
17124 <b> <i>x</i></b><i> </i>
17125 </p>
17126 !!end
17127
17128 !!test
17129 Encapsulate protected attributes from wt
17130 !!options
17131 parsoid
17132 !!input
17133 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
17134 !!result
17135 <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>
17136 </body>
17137 !!end
17138
17139 # -----------------------------------------------------------------
17140 # The following section of tests are primarily to spec requirements
17141 # around serialization of new/edited content.
17142 #
17143 # All these tests are marked Parsoid html2wt and html2html only
17144 # ----------------------------------------------------------------
17145
17146 !! test
17147 Image: Modifying size of an image
17148 !! options
17149 parsoid=html2wt
17150 !! input
17151 [[Image:Wiki.png|230x230px]]
17152 !! result
17153 <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>
17154 !!end
17155
17156 !! test
17157 Image: New block level image should have \n before and after
17158 !! options
17159 parsoid=html2wt
17160 !! input
17161 123
17162 [[File:Wiki.png|right|thumb|150x150px]]
17163 456
17164 !! result
17165 <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>
17166 !!end
17167
17168 # Wacky -- the leading newline in input is required because
17169 # that is what the serializer emits. To be fixed. Not fixing
17170 # the test because this test is required to test serialization of
17171 # new content and preferred whitespace style.
17172 !! test
17173 Lists: Add space after bullets
17174 !! options
17175 parsoid=html2wt
17176 !! input
17177
17178 * foo
17179 * bar
17180 * <span> baz</span>
17181 !! result
17182 <ul>
17183 <li>foo</li>
17184 <li> bar</li>
17185 <li><span> baz</span></li>
17186 </ul>
17187 !! end
17188
17189 !! test
17190 Parsoid: Serialize positional parameters with = in them as named parameter
17191 !! options
17192 parsoid=html2wt
17193 !! input
17194 {{echo|1 = f=oo}}
17195 !! result
17196 <p about="#mwt1" typeof="mw:Transclusion"
17197 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}'
17198 >foo</p>
17199 !! end
17200
17201 # -----------------------------------------------------------------
17202 # End of section for Parsoid-only html2wt tests for serialization
17203 # of new content
17204 # -----------------------------------------------------------------
17205
17206 TODO:
17207 more images
17208 more tables
17209 character entities
17210 and much more
17211 Try for 100% code coverage