Merge "Add a parserTest documenting interaction of tabs and preformatted text."
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 #
30 # You can also set the following parser properties via test options:
31 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
32 # wgLinkHolderBatchSize, wgRawHtml
33 #
34 # For testing purposes, temporary articles can created:
35 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
36 # where '/' denotes a newline.
37
38 # This is the standard article assumed to exist.
39 !! article
40 Main Page
41 !! text
42 blah blah
43 !! endarticle
44
45 !!article
46 Template:Foo
47 !!text
48 FOO
49 !!endarticle
50
51 !! article
52 Template:Blank
53 !! text
54 !! endarticle
55
56 !! article
57 Template:pipe
58 !! text
59 |
60 !! endarticle
61
62 !!article
63 MediaWiki:bad image list
64 !!text
65 * [[File:Bad.jpg]] except [[Nasty page]]
66 !!endarticle
67
68 !! article
69 Template:inner list
70 !! text
71 * item 1
72 !! endarticle
73
74 !! article
75 Template:tbl-start
76 !! text
77 {|
78 !! endarticle
79
80 !! article
81 Template:tbl-end
82 !! text
83 |}
84 !! endarticle
85
86 !! article
87 Template:!
88 !! text
89 |
90 !! endarticle
91
92 !! article
93 Template:echo
94 !! text
95 {{{1}}}
96 !! endarticle
97
98 !! article
99 Template:echo_with_span
100 !! text
101 <span>{{{1}}}</span>
102 !! endarticle
103
104 !! article
105 Template:echo_with_div
106 !! text
107 <div>{{{1}}}</div>
108 !! endarticle
109
110 !! article
111 Template:attr_str
112 !! text
113 {{{1}}}="{{{2}}}"
114 !! endarticle
115
116 !! article
117 Template:table_attribs
118 !! text
119 <noinclude>
120 |</noinclude>style="color: red"| Foo
121 !! endarticle
122
123 !! article
124 Template:table_cells
125 !! text
126 {{table_attribs}} || Bar || Baz
127 !! endarticle
128
129 !! article
130 Template:image_attribs
131 !! text
132 <noinclude>
133 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
134 !! endarticle
135
136 !! article
137 A?b
138 !! text
139 Weirdo titles!
140 !! endarticle
141
142 !!article
143 Template:Bullet
144 !!text
145 * Bar
146 !!endarticle
147
148 ###
149 ### Basic tests
150 ###
151 !! test
152 Blank input
153 !! input
154 !! result
155 !! end
156
157
158 !! test
159 Simple paragraph
160 !! input
161 This is a simple paragraph.
162 !! result
163 <p>This is a simple paragraph.
164 </p>
165 !! end
166
167 !! test
168 Paragraphs with extra newline spacing
169 !! input
170 foo
171
172 bar
173
174
175 baz
176
177
178
179 booz
180 !! result
181 <p>foo
182 </p><p>bar
183 </p><p><br />
184 baz
185 </p><p><br />
186 </p><p>booz
187 </p>
188 !! end
189
190 !! test
191 Paragraphs with newline spacing with comment lines in between
192 !! input
193 ----
194 a
195 <!--foo-->
196 b
197 ----
198 a
199 <!--foo--><!--More than 1 comment, still stripped-->
200 b
201 ----
202 a
203 <!--foo--> <!----> <!-- bar -->
204 b
205 ----
206 a
207 <!--foo-->
208
209 b
210 ----
211 a
212
213 <!--foo-->
214 b
215 ----
216 a
217 <!--foo-->
218
219
220 b
221 ----
222 a
223
224
225 <!--foo-->
226 b
227 ----
228 !! result
229 <hr />
230 <p>a
231 b
232 </p>
233 <hr />
234 <p>a
235 b
236 </p>
237 <hr />
238 <p>a
239 b
240 </p>
241 <hr />
242 <p>a
243 </p><p>b
244 </p>
245 <hr />
246 <p>a
247 </p><p>b
248 </p>
249 <hr />
250 <p>a
251 </p><p><br />
252 b
253 </p>
254 <hr />
255 <p>a
256 </p><p><br />
257 b
258 </p>
259 <hr />
260
261 !! end
262
263 !! test
264 Paragraphs with newline spacing with non-empty white-space lines in between
265 !! input
266 ----
267 a
268
269 b
270 ----
271 a
272
273
274 b
275 ----
276 !! result
277 <hr />
278 <p>a
279 </p><p>b
280 </p>
281 <hr />
282 <p>a
283 </p><p><br />
284 b
285 </p>
286 <hr />
287
288 !! end
289
290 !! test
291 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
292 !! input
293 ----
294 a
295 <!--foo-->
296 b
297 ----
298 a
299 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
300 b
301 ----
302 a
303
304 <!--foo-->
305 <!--bar-->
306 b
307 ----
308 a
309
310 <!--foo-->
311 <!--bar-->
312
313 b
314 ----
315 !! result
316 <hr />
317 <p>a
318 b
319 </p>
320 <hr />
321 <p>a
322 b
323 </p>
324 <hr />
325 <p>a
326 </p><p>b
327 </p>
328 <hr />
329 <p>a
330 </p><p><br />
331 b
332 </p>
333 <hr />
334
335 !! end
336
337 !! test
338 Extra newlines: More paragraphs with indented comment
339 !! input
340 a
341
342 <!--boo-->
343
344 b
345 !!result
346 <p>a
347 </p><p><br />
348 b
349 </p>
350 !!end
351
352 !! test
353 Extra newlines followed by heading
354 !! input
355 a
356
357
358
359 =b=
360 [[a]]
361
362
363 =b=
364 !! result
365 <p>a
366 </p><p><br />
367 </p>
368 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
369 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
370 </p><p><br />
371 </p>
372 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
373
374 !! end
375
376 !! test
377 Extra newlines between heading and content are swallowed
378 !! input
379 =b=
380
381
382
383 [[a]]
384 !! result
385 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
386 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
387 </p>
388 !! end
389
390 !! test
391 Parsing an URL
392 !! input
393 http://fr.wikipedia.org/wiki/🍺
394 <!-- EasterEgg we love beer, better be able be able to link to it -->
395 !! result
396 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
397 </p>
398 !! end
399
400 !! test
401 Simple list
402 !! input
403 * Item 1
404 * Item 2
405 !! result
406 <ul><li> Item 1
407 </li><li> Item 2
408 </li></ul>
409
410 !! end
411
412 !! test
413 Italics and bold
414 !! input
415 * plain
416 * plain''italic''plain
417 * plain''italic''plain''italic''plain
418 * plain'''bold'''plain
419 * plain'''bold'''plain'''bold'''plain
420 * plain''italic''plain'''bold'''plain
421 * plain'''bold'''plain''italic''plain
422 * plain''italic'''bold-italic'''italic''plain
423 * plain'''bold''bold-italic''bold'''plain
424 * plain'''''bold-italic'''italic''plain
425 * plain'''''bold-italic''bold'''plain
426 * plain''italic'''bold-italic'''''plain
427 * plain'''bold''bold-italic'''''plain
428 * plain l'''italic''plain
429 * plain l''''bold''' plain
430 !! result
431 <ul><li> plain
432 </li><li> plain<i>italic</i>plain
433 </li><li> plain<i>italic</i>plain<i>italic</i>plain
434 </li><li> plain<b>bold</b>plain
435 </li><li> plain<b>bold</b>plain<b>bold</b>plain
436 </li><li> plain<i>italic</i>plain<b>bold</b>plain
437 </li><li> plain<b>bold</b>plain<i>italic</i>plain
438 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
439 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
440 </li><li> plain<i><b>bold-italic</b>italic</i>plain
441 </li><li> plain<b><i>bold-italic</i>bold</b>plain
442 </li><li> plain<i>italic<b>bold-italic</b></i>plain
443 </li><li> plain<b>bold<i>bold-italic</i></b>plain
444 </li><li> plain l'<i>italic</i>plain
445 </li><li> plain l'<b>bold</b> plain
446 </li></ul>
447
448 !! end
449
450 # this example taken from the [[simple:Moon]] article (bug 47326)
451 !! test
452 Italics and possessives (1)
453 !! input
454 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
455 !! result
456 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
457 </p>
458 !! end
459
460 # this example taken from [[en:Flaming Pie]] (bug 49926)
461 !! test
462 Italics and possessives (2)
463 !! input
464 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
465 !! result
466 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
467 </p>
468 !! end
469
470 # this example taken from [[en:Dictionary]] (bug 49926)
471 !! test
472 Italics and possessives (3)
473 !! input
474 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
475 !! result
476 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
477 </p>
478 !! end
479
480
481 ###
482 ### 2-quote opening sequence tests
483 ###
484 !! test
485 Italics and bold: 2-quote opening sequence: (2,2)
486 !! input
487 ''foo''
488 !! result
489 <p><i>foo</i>
490 </p>
491 !!end
492
493
494 !! test
495 Italics and bold: 2-quote opening sequence: (2,3)
496 !! input
497 ''foo'''
498 !! result
499 <p><i>foo'</i>
500 </p>
501 !!end
502
503
504 !! test
505 Italics and bold: 2-quote opening sequence: (2,4)
506 !! input
507 ''foo''''
508 !! result
509 <p><i>foo''</i>
510 </p>
511 !!end
512
513
514 !! test
515 Italics and bold: 2-quote opening sequence: (2,5) (php)
516 !! options
517 php
518 !! input
519 ''foo'''''
520 !! result
521 <p><i>foo</i>
522 </p>
523 !!end
524 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
525 !! test
526 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
527 !! options
528 parsoid
529 !! input
530 ''foo'''''
531 !! result
532 <p><i>foo</i><b></b>
533 </p>
534 !!end
535
536
537 ###
538 ### 3-quote opening sequence tests
539 ###
540
541 !! test
542 Italics and bold: 3-quote opening sequence: (3,2)
543 !! input
544 '''foo''
545 !! result
546 <p>'<i>foo</i>
547 </p>
548 !!end
549
550
551 !! test
552 Italics and bold: 3-quote opening sequence: (3,3)
553 !! input
554 '''foo'''
555 !! result
556 <p><b>foo</b>
557 </p>
558 !!end
559
560
561 !! test
562 Italics and bold: 3-quote opening sequence: (3,4)
563 !! input
564 '''foo''''
565 !! result
566 <p><b>foo'</b>
567 </p>
568 !!end
569
570
571 !! test
572 Italics and bold: 3-quote opening sequence: (3,5) (php)
573 !! options
574 php
575 !! input
576 '''foo'''''
577 !! result
578 <p><b>foo</b>
579 </p>
580 !!end
581 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
582 !! test
583 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
584 !! options
585 parsoid
586 !! input
587 '''foo'''''
588 !! result
589 <p><b>foo<i></i></b>
590 </p>
591 !!end
592
593
594 ###
595 ### 4-quote opening sequence tests
596 ###
597
598 !! test
599 Italics and bold: 4-quote opening sequence: (4,2)
600 !! input
601 ''''foo''
602 !! result
603 <p>''<i>foo</i>
604 </p>
605 !!end
606
607
608 !! test
609 Italics and bold: 4-quote opening sequence: (4,3)
610 !! input
611 ''''foo'''
612 !! result
613 <p>'<b>foo</b>
614 </p>
615 !!end
616
617
618 !! test
619 Italics and bold: 4-quote opening sequence: (4,4)
620 !! input
621 ''''foo''''
622 !! result
623 <p>'<b>foo'</b>
624 </p>
625 !!end
626
627
628 !! test
629 Italics and bold: 4-quote opening sequence: (4,5) (php)
630 !! options
631 php
632 !! input
633 ''''foo'''''
634 !! result
635 <p>'<b>foo</b>
636 </p>
637 !!end
638 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
639 !! test
640 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
641 !! options
642 parsoid
643 !! input
644 ''''foo'''''
645 !! result
646 <p>'<b>foo<i></i></b>
647 </p>
648 !!end
649
650
651 ###
652 ### 5-quote opening sequence tests
653 ###
654
655 !! test
656 Italics and bold: 5-quote opening sequence: (5,2) (php)
657 !! options
658 php
659 !! input
660 '''''foo''
661 !! result
662 <p><b><i>foo</i></b>
663 </p>
664 !!end
665 # Parsoid reverses the nesting order, compared to the PHP parser
666 !! test
667 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
668 !! options
669 parsoid
670 !! input
671 '''''foo''
672 !! result
673 <p><i><b>foo</b></i>
674 </p>
675 !!end
676
677
678 !! test
679 Italics and bold: 5-quote opening sequence: (5,3)
680 !! input
681 '''''foo'''
682 !! result
683 <p><i><b>foo</b></i>
684 </p>
685 !!end
686
687
688 !! test
689 Italics and bold: 5-quote opening sequence: (5,4)
690 !! input
691 '''''foo''''
692 !! result
693 <p><i><b>foo'</b></i>
694 </p>
695 !!end
696
697
698 !! test
699 Italics and bold: 5-quote opening sequence: (5,5)
700 !! input
701 '''''foo'''''
702 !! result
703 <p><i><b>foo</b></i>
704 </p>
705 !!end
706
707 ###
708 ### multiple quote sequences in a line
709 ###
710 !! test
711 Italics and bold: multiple quote sequences: (2,4,2)
712 !! input
713 ''foo''''bar''
714 !! result
715 <p><i>foo'<b>bar</b></i>
716 </p>
717 !!end
718
719
720 !! test
721 Italics and bold: multiple quote sequences: (2,4,3)
722 !! input
723 ''foo''''bar'''
724 !! result
725 <p><i>foo'<b>bar</b></i>
726 </p>
727 !!end
728
729
730 !! test
731 Italics and bold: multiple quote sequences: (2,4,4)
732 !! input
733 ''foo''''bar''''
734 !! result
735 <p><i>foo'<b>bar'</b></i>
736 </p>
737 !!end
738
739
740 !! test
741 Italics and bold: multiple quote sequences: (3,4,2) (php)
742 !! options
743 php
744 !! input
745 '''foo''''bar''
746 !! result
747 <p><b>foo'</b>bar
748 </p>
749 !!end
750 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
751 !! test
752 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
753 !! options
754 parsoid
755 !! input
756 '''foo''''bar''
757 !! result
758 <p><b>foo'</b>bar<i></i>
759 </p>
760 !!end
761
762
763 !! test
764 Italics and bold: multiple quote sequences: (3,4,3) (php)
765 !! options
766 php
767 !! input
768 '''foo''''bar'''
769 !! result
770 <p><b>foo'</b>bar
771 </p>
772 !!end
773 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
774 !! test
775 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
776 !! options
777 parsoid
778 !! input
779 '''foo''''bar'''
780 !! result
781 <p><b>foo'</b>bar<b></b>
782 </p>
783 !!end
784
785 ###
786 ### other quote tests
787 ###
788 !! test
789 Italics and bold: other quote tests: (2,3,5)
790 !! input
791 ''this is about '''foo's family'''''
792 !! result
793 <p><i>this is about <b>foo's family</b></i>
794 </p>
795 !!end
796
797
798 !! test
799 Italics and bold: other quote tests: (2,(3,3),2)
800 !! input
801 ''this is about '''foo's''' family''
802 !! result
803 <p><i>this is about <b>foo's</b> family</i>
804 </p>
805 !!end
806
807
808 !! test
809 Italics and bold: other quote tests: (3,2,3,2)
810 !! input
811 '''this is about ''foo'''s family''
812 !! result
813 <p><b>this is about <i>foo</i></b><i>s family</i>
814 </p>
815 !!end
816
817
818 # The Parsoid team believes the PHP parser's output on this test is wrong.
819 # It only checks for convert-to-bold-on-single-character-word when the word
820 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
821 # This means that the bold token in position 2 (0-indexed) gets converted by
822 # parsoid, but doesn't get changed by the PHP parser.
823 !! test
824 Italics and bold: other quote tests: (3,2,3,3) (php)
825 !! options
826 php
827 !! input
828 '''this is about ''foo'''s family'''
829 !! result
830 <p>'<i>this is about </i>foo<b>s family</b>
831 </p>
832 !!end
833 # This is the output the Parsoid team believes to be correct.
834 !! test
835 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
836 !! options
837 parsoid
838 !! input
839 '''this is about ''foo'''s family'''
840 !! result
841 <p><b>this is about <i>foo'</i>s family</b>
842 </p>
843 !!end
844
845
846 !! test
847 Italics and bold: other quote tests: (3,(2,2),3)
848 !! input
849 '''this is about ''foo's'' family'''
850 !! result
851 <p><b>this is about <i>foo's</i> family</b>
852 </p>
853 !!end
854
855
856 !! test
857 Italicized possessive
858 !! input
859 The ''[[Main Page]]'''s talk page.
860 !! result
861 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
862 </p>
863 !! end
864
865 !! test
866 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
867 (Requires tidy for PHP parser output to be fixed up)
868 !! options
869 parsoid=wt2html,wt2wt
870 !! input
871 {|
872 !''a!!''b
873 |''a||''b
874 |}
875 !! result
876 <table>
877 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
878 <td><i>a</i></td><td><i>b</i></td></tr>
879 </tbody></table>
880 !! end
881
882 ###
883 ### Non-html5 tags
884 ###
885
886 !! test
887 Non-html5 tags should be accepted
888 !! input
889 <center>''foo''</center>
890 <big>''foo''</big>
891 <font>''foo''</font>
892 <strike>''foo''</strike>
893 <tt>''foo''</tt>
894 !! result
895 <center><i>foo</i></center>
896 <p><big><i>foo</i></big>
897 <font><i>foo</i></font>
898 <strike><i>foo</i></strike>
899 <tt><i>foo</i></tt>
900 </p>
901 !! end
902
903 !! test
904 <wbr> is valid wikitext (bug 52468)
905 !! input
906 <wbr>
907 !! result
908 <p><wbr />
909 </p>
910 !! end
911
912 # <strike> is HTML4, <s> is HTML4/5.
913 !! test
914 <s> or <strike> for strikethrough
915 !! input
916 <strike>strike</strike>
917
918 <s>s</s>
919 !! result
920 <p><strike>strike</strike>
921 </p><p><s>s</s>
922 </p>
923 !! end
924
925 !! test
926 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
927 !! input
928 <b→> doesn't work! </b>
929
930 <bä> doesn't work! </b>
931
932 <boo> works fine </b>
933
934 <s.foo>foo</s>
935
936 <s.foo>s.foo</s.foo>
937
938 <sub-ID#1>
939 !! result
940 <p>&lt;b→&gt; doesn't work! &lt;/b&gt;
941 </p><p>&lt;bä&gt; doesn't work! &lt;/b&gt;
942 </p><p>&lt;boo&gt; works fine &lt;/b&gt;
943 </p><p>&lt;s.foo&gt;foo&lt;/s&gt;
944 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
945 </p><p>&lt;sub-ID#1&gt;
946 </p>
947 !! end
948
949 ###
950 ### Special characters
951 ###
952
953 !! test
954 Bare pipe character (bug 52363)
955 !! input
956 |
957 !! result
958 <p>|
959 </p>
960 !! end
961
962 !! test
963 Bare pipe character from a template (bug 52363)
964 !! input
965 {{pipe}}
966 !! result
967 <p>|
968 </p>
969 !! end
970
971 ###
972 ### <nowiki> test cases
973 ###
974
975 !! test
976 <nowiki> unordered list
977 !! input
978 <nowiki>* This is not an unordered list item.</nowiki>
979 !! result
980 <p>* This is not an unordered list item.
981 </p>
982 !! end
983
984 !! test
985 <nowiki> spacing
986 !! input
987 <nowiki>Lorem ipsum dolor
988
989 sed abit.
990 sed nullum.
991
992 :and a colon
993 </nowiki>
994 !! result
995 <p>Lorem ipsum dolor
996
997 sed abit.
998 sed nullum.
999
1000 :and a colon
1001
1002 </p>
1003 !! end
1004
1005 !! test
1006 nowiki 3
1007 !! input
1008 :There is not nowiki.
1009 :There is <nowiki>nowiki</nowiki>.
1010
1011 #There is not nowiki.
1012 #There is <nowiki>nowiki</nowiki>.
1013
1014 *There is not nowiki.
1015 *There is <nowiki>nowiki</nowiki>.
1016 !! result
1017 <dl><dd>There is not nowiki.
1018 </dd><dd>There is nowiki.
1019 </dd></dl>
1020 <ol><li>There is not nowiki.
1021 </li><li>There is nowiki.
1022 </li></ol>
1023 <ul><li>There is not nowiki.
1024 </li><li>There is nowiki.
1025 </li></ul>
1026
1027 !! end
1028
1029 !! test
1030 Entities inside <nowiki>
1031 !! input
1032 <nowiki>&lt;</nowiki>
1033 !! result
1034 <p>&lt;
1035 </p>
1036 !! end
1037
1038 !! test
1039 Entities inside template parameters
1040 !! options
1041 parsoid
1042 !! input
1043 {{echo|&ndash;}}
1044 !! result
1045 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}'>&ndash;</span>
1046 </p>
1047 !! end
1048
1049 ###
1050 ### Comments
1051 ###
1052 !! test
1053 Comments and Indent-Pre
1054 !! input
1055 <!-- comment 1 --> asdf
1056
1057 <!-- comment 1 --> asdf
1058 <!-- comment 2 -->
1059
1060 <!-- comment 1 --> asdf
1061 <!-- comment 2 -->xyz
1062
1063 <!-- comment 1 --> asdf
1064 <!-- comment 2 --> xyz
1065 !! result
1066 <pre>asdf
1067 </pre>
1068 <pre>asdf
1069 </pre>
1070 <pre>asdf
1071 </pre>
1072 <p>xyz
1073 </p>
1074 <pre>asdf
1075 xyz
1076 </pre>
1077 !! end
1078
1079 !! test
1080 Comment test 2a
1081 !! input
1082 asdf
1083 <!-- comment 1 -->
1084 jkl
1085 !! result
1086 <p>asdf
1087 jkl
1088 </p>
1089 !! end
1090
1091 !! test
1092 Comment test 2b
1093 !! input
1094 asdf
1095 <!-- comment 1 -->
1096
1097 jkl
1098 !! result
1099 <p>asdf
1100 </p><p>jkl
1101 </p>
1102 !! end
1103
1104 !! test
1105 Comment test 3
1106 !! input
1107 asdf
1108 <!-- comment 1 -->
1109 <!-- comment 2 -->
1110 jkl
1111 !! result
1112 <p>asdf
1113 jkl
1114 </p>
1115 !! end
1116
1117 !! test
1118 Comment test 4
1119 !! input
1120 asdf<!-- comment 1 -->jkl
1121 !! result
1122 <p>asdfjkl
1123 </p>
1124 !! end
1125
1126 !! test
1127 Comment spacing
1128 !! input
1129 a
1130 <!-- foo --> b <!-- bar -->
1131 c
1132 !! result
1133 <p>a
1134 </p>
1135 <pre> b
1136 </pre>
1137 <p>c
1138 </p>
1139 !! end
1140
1141 !! test
1142 Comment whitespace
1143 !! input
1144 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1145 !! result
1146
1147 !! end
1148
1149 !! test
1150 Comment semantics and delimiters
1151 !! input
1152 <!-- --><!----><!-----><!------>
1153 !! result
1154
1155 !! end
1156
1157 !! test
1158 Comment semantics and delimiters, redux
1159 !! input
1160 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1161 -- foo -- funky huh? ... -->
1162 !! result
1163
1164 !! end
1165
1166 !! test
1167 Comment semantics and delimiters: directors cut
1168 !! input
1169 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1170 everything starting with < followed by !-- until the first -- and > we see,
1171 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1172 -->-->
1173 !! result
1174 <p>--&gt;
1175 </p>
1176 !! end
1177
1178 !! test
1179 Comment semantics: nesting
1180 !! input
1181 <!--<!-- no, we're not going to do anything fancy here -->-->
1182 !! result
1183 <p>--&gt;
1184 </p>
1185 !! end
1186
1187 !! test
1188 Comment semantics: unclosed comment at end
1189 !! input
1190 <!--This comment will run out to the end of the document
1191 !! result
1192
1193 !! end
1194
1195 !! test
1196 Comment in template title
1197 !! input
1198 {{f<!---->oo}}
1199 !! result
1200 <p>FOO
1201 </p>
1202 !! end
1203
1204 !! test
1205 Comment on its own line post-expand
1206 !! input
1207 a
1208 {{blank}}<!---->
1209 b
1210 !! result
1211 <p>a
1212 </p><p>b
1213 </p>
1214 !! end
1215
1216 !! test
1217 Comment on its own line post-expand with non-significant whitespace
1218 !! input
1219 a
1220 {{blank}} <!---->
1221 b
1222 !! result
1223 <p>a
1224 </p><p>b
1225 </p>
1226 !! end
1227
1228 ###
1229 ### paragraph wrapping tests
1230 ###
1231 !! test
1232 No block tags
1233 !! input
1234 a
1235
1236 b
1237 !! result
1238 <p>a
1239 </p><p>b
1240 </p>
1241 !! end
1242 !! test
1243 Block tag on one line
1244 !! input
1245 a <div>foo</div>
1246
1247 b
1248 !! result
1249 a <div>foo</div>
1250 <p>b
1251 </p>
1252 !! end
1253
1254 !! test
1255 Block tag on both lines
1256 !! input
1257 a <div>foo</div>
1258
1259 b <div>foo</div>
1260 !! result
1261 a <div>foo</div>
1262 b <div>foo</div>
1263
1264 !! end
1265
1266 !! test
1267 Multiple lines without block tags
1268 !! input
1269 <div>foo</div> a
1270 b
1271 c
1272 d<!--foo--> e
1273 x <div>foo</div> z
1274 !! result
1275 <div>foo</div> a
1276 <p>b
1277 c
1278 d e
1279 </p>
1280 x <div>foo</div> z
1281
1282 !! end
1283
1284 !! test
1285 Empty lines between lines with block tags
1286 !! input
1287 <div></div>
1288
1289
1290 <div></div>a
1291
1292 b
1293 <div>a</div>b
1294
1295 <div>b</div>d
1296
1297
1298 <div>e</div>
1299 !! result
1300 <div></div>
1301 <p><br />
1302 </p>
1303 <div></div>a
1304 <p>b
1305 </p>
1306 <div>a</div>b
1307 <div>b</div>d
1308 <p><br />
1309 </p>
1310 <div>e</div>
1311
1312 !! end
1313
1314 ###
1315 ### Preformatted text
1316 ###
1317 !! test
1318 Preformatted text
1319 !! input
1320 This is some
1321 Preformatted text
1322 With ''italic''
1323 And '''bold'''
1324 And a [[Main Page|link]]
1325 !! result
1326 <pre>This is some
1327 Preformatted text
1328 With <i>italic</i>
1329 And <b>bold</b>
1330 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1331 </pre>
1332 !! end
1333
1334 !! test
1335 Tabs don't trigger preformatted text
1336 !! input
1337 This is not
1338 preformatted text.
1339 This is preformatted text.
1340 So is this.
1341 !! result
1342 <p> This is not
1343 preformatted text.
1344 </p>
1345 <pre>This is preformatted text.
1346 So is this.
1347 </pre>
1348 !! end
1349
1350 !! test
1351 Ident preformatting with inline content
1352 !! input
1353 a
1354 ''b''
1355 !! result
1356 <pre>a
1357 <i>b</i>
1358 </pre>
1359 !! end
1360
1361 !! test
1362 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1363 !! input
1364 <pre><nowiki>
1365 <b>
1366 <cite>
1367 <em>
1368 </nowiki></pre>
1369 !! result
1370 <pre>
1371 &lt;b&gt;
1372 &lt;cite&gt;
1373 &lt;em&gt;
1374 </pre>
1375
1376 !! end
1377
1378 !! test
1379 Regression with preformatted in <center>
1380 !! input
1381 <center>
1382 Blah
1383 </center>
1384 !! result
1385 <center>
1386 <pre>Blah
1387 </pre>
1388 </center>
1389
1390 !! end
1391
1392 # Expected output in the following test is not really expected (there should be
1393 # <pre> in the output) -- it's only testing for well-formedness.
1394 !! test
1395 Bug 6200: Preformatted in <blockquote>
1396 !! input
1397 <blockquote>
1398 Blah
1399 </blockquote>
1400 !! result
1401 <blockquote>
1402 Blah
1403 </blockquote>
1404
1405 !! end
1406
1407 !! test
1408 <pre> with attributes (bug 3202)
1409 !! input
1410 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1411 !! result
1412 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1413
1414 !! end
1415
1416 !! test
1417 <pre> with width attribute (bug 3202)
1418 !! input
1419 <pre width="8">Narrow screen goodies</pre>
1420 !! result
1421 <pre width="8">Narrow screen goodies</pre>
1422
1423 !! end
1424
1425 !! test
1426 <pre> with forbidden attribute (bug 3202)
1427 !! input
1428 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1429 !! result
1430 <pre width="8">Narrow screen goodies</pre>
1431
1432 !! end
1433
1434 !! test
1435 Entities inside <pre>
1436 !! input
1437 <pre>&lt;</pre>
1438 !! result
1439 <pre>&lt;</pre>
1440
1441 !! end
1442
1443 !! test
1444 <pre> with forbidden attribute values (bug 3202)
1445 !! input
1446 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1447 !! result
1448 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1449
1450 !! end
1451
1452 !! test
1453 <nowiki> inside <pre> (bug 13238)
1454 !! input
1455 <pre>
1456 <nowiki>
1457 </pre>
1458 <pre>
1459 <nowiki></nowiki>
1460 </pre>
1461 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1462 !! result
1463 <pre>
1464 &lt;nowiki&gt;
1465 </pre>
1466 <pre>
1467
1468 </pre>
1469 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1470
1471 !! end
1472
1473 !! test
1474 <nowiki> and <pre> preference (first one wins)
1475 !! input
1476 <pre>
1477 <nowiki>
1478 </pre>
1479 </nowiki>
1480 </pre>
1481
1482 <nowiki>
1483 <pre>
1484 <nowiki>
1485 </pre>
1486 </nowiki>
1487 </pre>
1488
1489 !! result
1490 <pre>
1491 &lt;nowiki&gt;
1492 </pre>
1493 <p>&lt;/nowiki&gt;
1494 &lt;/pre&gt;
1495 </p><p>
1496 &lt;pre&gt;
1497 &lt;nowiki&gt;
1498 &lt;/pre&gt;
1499
1500 &lt;/pre&gt;
1501 </p>
1502 !! end
1503
1504 !! test
1505 </pre> inside nowiki
1506 !! input
1507 <nowiki></pre></nowiki>
1508 !! result
1509 <p>&lt;/pre&gt;
1510 </p>
1511 !! end
1512
1513 !!test
1514 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1515 !!input
1516 {{echo|}}
1517 !!result
1518
1519 !!end
1520
1521 !!test
1522 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1523 !!input
1524 {{echo|
1525 foo}}
1526 !!result
1527 <p>foo
1528 </p>
1529 !!end
1530
1531 !! test
1532 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1533 !! input
1534 {{echo|a
1535 b}}
1536 !!result
1537 <pre>a
1538 </pre>
1539 <p>b
1540 </p>
1541 !!end
1542
1543 !! test
1544 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1545 !! input
1546 {{echo|a
1547 b
1548 c
1549 d
1550 e
1551 }}
1552 !!result
1553 <pre>a
1554 </pre>
1555 <p>b
1556 c
1557 </p>
1558 <pre>d
1559 </pre>
1560 <p>e
1561 </p>
1562 !!end
1563
1564 !!test
1565 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1566 !!input
1567 {{echo| foo}}
1568
1569 {{echo| foo}}{{echo| bar}}
1570
1571 {{echo| foo}}
1572 {{echo| bar}}
1573
1574 {{echo|<!--cmt--> foo}}
1575
1576 <!--cmt-->{{echo| foo}}
1577
1578 {{echo|{{echo| }}bar}}
1579 !!result
1580 <pre>foo
1581 </pre>
1582 <pre>foo bar
1583 </pre>
1584 <pre>foo
1585 bar
1586 </pre>
1587 <pre>foo
1588 </pre>
1589 <pre>foo
1590 </pre>
1591 <pre>bar
1592 </pre>
1593 !!end
1594
1595 !! test
1596 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1597 !! input
1598 {{echo| }}a
1599
1600 {{echo|
1601 }}a
1602
1603 {{echo|
1604 b}}
1605
1606 {{echo|a
1607 }}b
1608
1609 {{echo|a
1610 }} b
1611 !!result
1612 <pre>a
1613 </pre>
1614 <p><br />
1615 </p>
1616 <pre>a
1617 </pre>
1618 <p><br />
1619 </p>
1620 <pre>b
1621 </pre>
1622 <p>a
1623 </p>
1624 <pre>b
1625 </pre>
1626 <p>a
1627 </p>
1628 <pre>b
1629 </pre>
1630 !!end
1631
1632 !! test
1633 Templates: Single-line variant of parameter whitespace stripping test
1634 !! input
1635 {{echo| a}}
1636
1637 {{echo|1= a}}
1638
1639 {{echo|{{echo| a}}}}
1640
1641 {{echo|1={{echo| a}}}}
1642 !! result
1643 <pre>a
1644 </pre>
1645 <p>a
1646 </p>
1647 <pre>a
1648 </pre>
1649 <p>a
1650 </p>
1651 !! end
1652
1653 !! test
1654 Templates: Strip whitespace from named parameters, but not positional ones
1655 !! input
1656 {{echo|
1657 foo}}
1658
1659 {{echo|
1660 * foo}}
1661
1662 {{echo| 1 =
1663 foo}}
1664
1665 {{echo| 1 =
1666 * foo}}
1667 !! result
1668 <pre>foo
1669 </pre>
1670 <p><br />
1671 </p>
1672 <ul><li> foo
1673 </li></ul>
1674 <p>foo
1675 </p>
1676 <ul><li> foo
1677 </li></ul>
1678
1679 !! end
1680
1681 !! test
1682 Templates: Dont strip whitespace from whitespace/comment-only arguments
1683 !! input
1684 {{echo| }}
1685 {{echo|<!--cmt-->}}
1686 {{echo| <!--cmt--> }}
1687 !! result
1688 <p><br />
1689 </p>
1690 !! end
1691
1692 !! test
1693 Templates: Parsoid parameter escaping test 1
1694 !! options
1695 parsoid
1696 !! input
1697 {{echo|[foo]|{{echo|[bar]}}}}
1698 !! result
1699 <p about="#mwt1" typeof="mw:Transclusion"
1700 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>
1701 !! end
1702
1703 !! test
1704 Parsoid: Pipes in external links in template parameter
1705 !! options
1706 parsoid
1707 !! input
1708 {{echo|[{{echo|http://example.com}} link]}}
1709 !! result
1710 <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>
1711 !! end
1712
1713 !! test
1714 Parsoid: pipe in transclusion parameter
1715 !! options
1716 parsoid
1717 !! input
1718 {{echo|http://foo.com/a&#124;b}}
1719 !! result
1720 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1721 typeof="mw:Transclusion"
1722 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>
1723 !! end
1724
1725 !! test
1726 Parsoid: Pipe in external link target and content in template parameter
1727 !! options
1728 parsoid=html2wt,wt2wt
1729 !! input
1730 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1731 !! result
1732 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1733 typeof="mw:Transclusion"
1734 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},
1735 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}'>a|b</a></p>
1736 !! end
1737
1738 !! test
1739 Templates: Dont escape already nowiki-escaped text in template parameters
1740 !! options
1741 parsoid=html2wt,wt2wt
1742 !! input
1743 {{echo|foo<nowiki>|</nowiki>bar}}
1744 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1745 {{echo|<nowiki></nowiki>}}
1746 !! result
1747 <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>
1748 <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>
1749 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}'></span>
1750 </p>
1751 !! end
1752
1753 ###
1754 ### Parsoid-centric tests for testing RT edge cases for pre
1755 ###
1756
1757 !!test
1758 1a. Indent-Pre and Comments
1759 !!input
1760 a
1761 <!--a-->
1762 c
1763 !!result
1764 <pre>a
1765 </pre>
1766 <p>c
1767 </p>
1768 !!end
1769
1770 !!test
1771 1b. Indent-Pre and Comments
1772 !!input
1773 a
1774 <!--a-->
1775 c
1776 !!result
1777 <pre>a
1778 </pre>
1779 <p>c
1780 </p>
1781 !!end
1782
1783 !!test
1784 1c. Indent-Pre and Comments
1785 !!input
1786 <!--a--> a
1787
1788 <!--a--> a
1789 !!result
1790 <pre> a
1791 </pre>
1792 <pre> a
1793 </pre>
1794 !!end
1795
1796 !!test
1797 1d. Indent-Pre and Comments
1798 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
1799 !!input
1800 <!--a--> a
1801
1802 <!--b-->b
1803 !!result
1804 <pre>a
1805 </pre>
1806 <pre>b
1807 </pre>
1808 !!end
1809
1810 !!test
1811 2a. Indent-Pre and tables
1812 !!input
1813 {|
1814 |-
1815 !h1!!h2
1816 |foo||bar
1817 |}
1818 !!result
1819 <table>
1820
1821 <tr>
1822 <th>h1</th>
1823 <th>h2
1824 </th>
1825 <td>foo</td>
1826 <td>bar
1827 </td></tr></table>
1828
1829 !!end
1830
1831 !!test
1832 2b. Indent-Pre and tables
1833 !!input
1834 {|
1835 |-
1836 |foo
1837 |}
1838 !!result
1839 <table>
1840
1841 <tr>
1842 <td>foo
1843 </td></tr></table>
1844
1845 !!end
1846
1847 !!test
1848 2c. Indent-Pre and tables (bug 42252)
1849 !!input
1850 {|
1851 |+ foo
1852 ! | bar
1853 |}
1854 !!result
1855 <table>
1856 <caption> foo
1857 </caption>
1858 <tr>
1859 <th> bar
1860 </th></tr></table>
1861
1862 !!end
1863
1864 !!test
1865 3a. Indent-Pre and block tags (single-line html)
1866 !!input
1867 <p> foo </p>
1868 <div> foo </div>
1869 <span> foo </span>
1870 !!result
1871 <p> foo </p>
1872 <div> foo </div>
1873 <pre><span> foo </span>
1874 </pre>
1875 !!end
1876
1877 !!test
1878 3b. Indent-Pre and block tags (pre-content on separate line)
1879 !!input
1880 <p>
1881 foo
1882 </p>
1883
1884 <div>
1885 foo
1886 </div>
1887
1888 <center>
1889 foo
1890 </center>
1891
1892 <blockquote>
1893 foo
1894 </blockquote>
1895
1896 <table><tr><td>
1897 foo
1898 </td></tr></table>
1899
1900 <ul><li>
1901 foo
1902 </li></ul>
1903
1904 !!result
1905 <p>
1906 foo
1907 </p>
1908 <div>
1909 <pre>foo
1910 </pre>
1911 </div>
1912 <center>
1913 <pre>foo
1914 </pre>
1915 </center>
1916 <blockquote>
1917 foo
1918 </blockquote>
1919 <table><tr><td>
1920 <pre>foo
1921 </pre>
1922 </td></tr></table>
1923 <ul><li>
1924 foo
1925 </li></ul>
1926
1927 !!end
1928
1929 !!test
1930 4. Multiple spaces at start-of-line
1931 !!input
1932 <p> foo </p>
1933 foo
1934 {|
1935 |foo
1936 |}
1937 !!result
1938 <p> foo </p>
1939 <pre> foo
1940 </pre>
1941 <table>
1942 <tr>
1943 <td>foo
1944 </td></tr></table>
1945
1946 !!end
1947
1948 !! test
1949 5. White-space in indent-pre
1950 NOTE: the white-space char on 2nd line is significant
1951 !! input
1952 a<br/>
1953
1954 b
1955 !! result
1956 <pre>a<br />
1957
1958 b
1959 </pre>
1960 !! end
1961
1962 !! test
1963 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
1964 !! input
1965 a
1966
1967 <!-- continue -->
1968 b
1969
1970 c
1971
1972 d
1973 !! result
1974 <pre>a
1975
1976 b
1977 </pre>
1978 <pre>c
1979
1980 </pre>
1981 <p>d
1982 </p>
1983 !! end
1984
1985 !! test
1986 7a. Indent-pre and category links
1987 !! options
1988 parsoid=wt2html,wt2wt
1989 !! input
1990 [[Category:foo]] <!-- No pre-wrapping -->
1991 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
1992 !! result
1993 <span typeof="mw:Transclusion"> </span>
1994 !! end
1995
1996 !! test
1997 7b. Indent-pre and category links
1998 !! options
1999 parsoid=wt2html,wt2wt
2000 !! input
2001 [[Category:foo]] a
2002 [[Category:foo]] {{echo|b}}
2003 !! result
2004 <pre> a <span typeof="mw:Transclusion">b</span>
2005 </pre>
2006 !! end
2007
2008 ###
2009 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2010 ###
2011
2012 !!test
2013 HTML-pre: 1. embedded newlines
2014 !!input
2015 <pre>foo</pre>
2016
2017 <pre>
2018 foo
2019 </pre>
2020
2021 <pre>
2022
2023 foo
2024 </pre>
2025
2026 <pre>
2027
2028
2029 foo
2030 </pre>
2031 !!result
2032 <pre>foo</pre>
2033 <pre>
2034 foo
2035 </pre>
2036 <pre>
2037
2038 foo
2039 </pre>
2040 <pre>
2041
2042
2043 foo
2044 </pre>
2045
2046 !!end
2047
2048 !!test
2049 HTML-pre: 2: indented text
2050 !!input
2051 <pre>
2052 foo
2053 </pre>
2054 !!result
2055 <pre>
2056 foo
2057 </pre>
2058
2059 !!end
2060
2061 !!test
2062 HTML-pre: 3: other wikitext
2063 !!input
2064 <pre>
2065 * foo
2066 # bar
2067 = no-h =
2068 '' no-italic ''
2069 [[ NoLink ]]
2070 </pre>
2071 !!result
2072 <pre>
2073 * foo
2074 # bar
2075 = no-h =
2076 '' no-italic ''
2077 [[ NoLink ]]
2078 </pre>
2079
2080 !!end
2081
2082 ###
2083 ### Definition lists
2084 ###
2085 !! test
2086 Simple definition
2087 !! input
2088 ; name : Definition
2089 !! result
2090 <dl><dt> name&#160;</dt><dd> Definition
2091 </dd></dl>
2092
2093 !! end
2094
2095 !! test
2096 Definition list for indentation only
2097 !! input
2098 : Indented text
2099 !! result
2100 <dl><dd> Indented text
2101 </dd></dl>
2102
2103 !! end
2104
2105 !! test
2106 Definition list with no space
2107 !! input
2108 ;name:Definition
2109 !! result
2110 <dl><dt>name</dt><dd>Definition
2111 </dd></dl>
2112
2113 !!end
2114
2115 !! test
2116 Definition list with URL link
2117 !! input
2118 ; http://example.com/ : definition
2119 !! result
2120 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
2121 </dd></dl>
2122
2123 !! end
2124
2125 !! test
2126 Definition list with bracketed URL link
2127 !! input
2128 ;[http://www.example.com/ Example]:Something about it
2129 !! result
2130 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
2131 </dd></dl>
2132
2133 !! end
2134
2135 !! test
2136 Definition list with wikilink containing colon
2137 !! input
2138 ; [[Help:FAQ]]: The least-read page on Wikipedia
2139 !! result
2140 <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
2141 </dd></dl>
2142
2143 !! end
2144
2145 # At Brion's and JeLuF's insistence... :)
2146 !! test
2147 Definition list with news link containing colon
2148 !! input
2149 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2150 !! result
2151 <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!
2152 </dd></dl>
2153
2154 !! end
2155
2156 !! test
2157 Malformed definition list with colon
2158 !! input
2159 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2160 !! result
2161 <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
2162 </dt></dl>
2163
2164 !! end
2165
2166 !! test
2167 Definition lists: colon in external link text
2168 !! input
2169 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2170 !! result
2171 <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
2172 </dd></dl>
2173
2174 !! end
2175
2176 !! test
2177 Definition lists: colon in HTML attribute
2178 !! input
2179 ;<b style="display: inline">bold</b>
2180 !! result
2181 <dl><dt><b style="display: inline">bold</b>
2182 </dt></dl>
2183
2184 !! end
2185
2186 !! test
2187 Definition lists: self-closed tag
2188 !! input
2189 ;one<br/>two : two-line fun
2190 !! result
2191 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
2192 </dd></dl>
2193
2194 !! end
2195
2196 !! test
2197 Bug 11748: Literal closing tags
2198 !! input
2199 <dl>
2200 <dt>test 1</dt>
2201 <dd>test test test test test</dd>
2202 <dt>test 2</dt>
2203 <dd>test test test test test</dd>
2204 </dl>
2205 !! result
2206 <dl>
2207 <dt>test 1</dt>
2208 <dd>test test test test test</dd>
2209 <dt>test 2</dt>
2210 <dd>test test test test test</dd>
2211 </dl>
2212
2213 !! end
2214
2215 !! test
2216 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2217 !! input
2218 <ul><li>
2219 ; term : description
2220 * unordered
2221 </li>
2222 </ul>
2223 !! result
2224 <ul><li>
2225 <dl><dt> term&#160;</dt><dd> description
2226 </dd></dl>
2227 <ul><li> unordered
2228 </li></ul>
2229 </li>
2230 </ul>
2231
2232 !! end
2233
2234 !! test
2235
2236 Definition list with empty definition and following paragraph
2237 !! input
2238 ; term:
2239 Paragraph text
2240 !! result
2241 <dl><dt> term</dt><dd>
2242 </dd></dl>
2243 <p>Paragraph text
2244 </p>
2245 !! end
2246
2247 !! test
2248 Nested definition lists using html syntax
2249 !! input
2250 <dl><dd>
2251 <dl>
2252 <dd>Foo</dd>
2253 </dl>
2254 </dd></dl>
2255 !! result
2256 <dl><dd>
2257 <dl>
2258 <dd>Foo</dd>
2259 </dl>
2260 </dd></dl>
2261
2262 !! end
2263
2264 !! test
2265 Definition Lists: No nesting: Multiple dd's
2266 !! input
2267 ;x
2268 :a
2269 :b
2270 !! result
2271 <dl><dt>x
2272 </dt><dd>a
2273 </dd><dd>b
2274 </dd></dl>
2275
2276 !! end
2277
2278 !! test
2279 Definition Lists: Indentation: Regular
2280 !! input
2281 :i1
2282 ::i2
2283 :::i3
2284 !! result
2285 <dl><dd>i1
2286 <dl><dd>i2
2287 <dl><dd>i3
2288 </dd></dl>
2289 </dd></dl>
2290 </dd></dl>
2291
2292 !! end
2293
2294 !! test
2295 Definition Lists: Indentation: Missing 1st level
2296 !! input
2297 ::i2
2298 :::i3
2299 !! result
2300 <dl><dd><dl><dd>i2
2301 <dl><dd>i3
2302 </dd></dl>
2303 </dd></dl>
2304 </dd></dl>
2305
2306 !! end
2307
2308 !! test
2309 Definition Lists: Indentation: Multi-level indent
2310 !! input
2311 :::i3
2312 !! result
2313 <dl><dd><dl><dd><dl><dd>i3
2314 </dd></dl>
2315 </dd></dl>
2316 </dd></dl>
2317
2318 !! end
2319
2320 !! test
2321 Definition Lists: Hacky use to indent tables
2322 !! input
2323 ::{|
2324 |foo
2325 |bar
2326 |}
2327 this text
2328 should be left alone
2329 !! result
2330 <dl><dd><dl><dd><table>
2331 <tr>
2332 <td>foo
2333 </td>
2334 <td>bar
2335 </td></tr></table></dd></dl></dd></dl>
2336 <p>this text
2337 should be left alone
2338 </p>
2339 !! end
2340 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2341 ## as an empty dt item. It also ignores all but the last ";" when followed
2342 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2343 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2344 ## ";"s.
2345 ##
2346 ## Ex: ";;t2 ::d2" is transformed into:
2347 ##
2348 ## <dl>
2349 ## <dt>t2 </dt>
2350 ## <dd>
2351 ## <dl>
2352 ## <dt></dt>
2353 ## <dd>d2</dd>
2354 ## </dl>
2355 ## </dd>
2356 ## </dl>
2357 ##
2358 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2359 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2360 ##
2361 ## <dl>
2362 ## <dt>
2363 ## <dl>
2364 ## <dt>t2 </dt>
2365 ## <dd>:d2</dd>
2366 ## </dl>
2367 ## </dt>
2368 ## </dl>
2369 ##
2370 ## All Parsoid only definition list tests have this difference.
2371 ##
2372 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2373 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2374
2375 !! test
2376 Table / list interaction: indented table with lists in table contents
2377 !! input
2378 :{|
2379 |-
2380 | a
2381 * b
2382 |-
2383 | c
2384 * d
2385 |}
2386 !! result
2387 <dl><dd><table>
2388
2389 <tr>
2390 <td> a
2391 <ul><li> b
2392 </li></ul>
2393 </td></tr>
2394 <tr>
2395 <td> c
2396 <ul><li> d
2397 </li></ul>
2398 </td></tr></table></dd></dl>
2399
2400 !! end
2401
2402 !!test
2403 Table / list interaction: lists nested in tables nested in indented lists
2404 !!input
2405 :{|
2406 |
2407 :a
2408 :b
2409 |
2410 *c
2411 *d
2412 |}
2413
2414 *e
2415 *f
2416 !!result
2417 <dl><dd><table>
2418 <tr>
2419 <td>
2420 <dl><dd>a
2421 </dd><dd>b
2422 </dd></dl>
2423 </td>
2424 <td>
2425 <ul><li>c
2426 </li><li>d
2427 </li></ul>
2428 </td></tr></table></dd></dl>
2429 <ul><li>e
2430 </li><li>f
2431 </li></ul>
2432
2433 !!end
2434
2435 !! test
2436 Definition Lists: Nesting: Multi-level (Parsoid only)
2437 !! options
2438 parsoid
2439 !! input
2440 ;t1 :d1
2441 ;;t2 ::d2
2442 ;;;t3 :::d3
2443 !! result
2444 <dl>
2445 <dt>t1 </dt>
2446 <dd>d1</dd>
2447 <dt>
2448 <dl>
2449 <dt>t2 </dt>
2450 <dd>:d2</dd>
2451 <dt>
2452 <dl>
2453 <dt>t3 </dt>
2454 <dd>::d3</dd>
2455 </dl>
2456 </dt>
2457 </dl>
2458 </dt>
2459 </dl>
2460
2461
2462 !! end
2463
2464
2465 !! test
2466 Definition Lists: Nesting: Test 2 (Parsoid only)
2467 !! options
2468 parsoid
2469 !! input
2470 ;t1
2471 ::d2
2472 !! result
2473 <dl>
2474 <dt>t1</dt>
2475 <dd>
2476 <dl>
2477 <dd>d2</dd>
2478 </dl>
2479 </dd>
2480 </dl>
2481
2482 !! end
2483
2484
2485 !! test
2486 Definition Lists: Nesting: Test 3 (Parsoid only)
2487 !! options
2488 parsoid
2489 !! input
2490 :;t1
2491 ::::d2
2492 !! result
2493 <dl>
2494 <dd>
2495 <dl>
2496 <dt>t1</dt>
2497 <dd>
2498 <dl>
2499 <dd>
2500 <dl>
2501 <dd>d2</dd>
2502 </dl>
2503 </dd>
2504 </dl>
2505 </dd>
2506 </dl>
2507 </dd>
2508 </dl>
2509
2510 !! end
2511
2512
2513 !! test
2514 Definition Lists: Nesting: Test 4
2515 !! input
2516 ::;t3
2517 :::d3
2518 !! result
2519 <dl><dd><dl><dd><dl><dt>t3
2520 </dt><dd>d3
2521 </dd></dl>
2522 </dd></dl>
2523 </dd></dl>
2524
2525 !! end
2526
2527
2528 ## The Parsoid team believes the following three test exposes a
2529 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2530 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2531 !! test
2532 Definition Lists: Mixed Lists: Test 1 (php)
2533 !! options
2534 php
2535 !! input
2536 :;* foo
2537 ::* bar
2538 :; baz
2539 !! result
2540 <dl><dd><dl><dt><ul><li> foo
2541 </li><li> bar
2542 </li></ul>
2543 </dt></dl>
2544 <dl><dt> baz
2545 </dt></dl>
2546 </dd></dl>
2547
2548 !! end
2549 !! test
2550 Definition Lists: Mixed Lists: Test 1 (parsoid)
2551 !! options
2552 parsoid
2553 !! input
2554 :;* foo
2555 ::* bar
2556 :; baz
2557 !! result
2558 <dl><dd><dl><dt><ul><li> foo
2559 </li></ul></dt><dd><ul><li> bar
2560 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2561 !! end
2562
2563 !! test
2564 Definition Lists: Mixed Lists: Test 2
2565 !! input
2566 *: d1
2567 *: d2
2568 !! result
2569 <ul><li><dl><dd> d1
2570 </dd><dd> d2
2571 </dd></dl>
2572 </li></ul>
2573
2574 !! end
2575
2576
2577 !! test
2578 Definition Lists: Mixed Lists: Test 3
2579 !! input
2580 *::: d1
2581 *::: d2
2582 !! result
2583 <ul><li><dl><dd><dl><dd><dl><dd> d1
2584 </dd><dd> d2
2585 </dd></dl>
2586 </dd></dl>
2587 </dd></dl>
2588 </li></ul>
2589
2590 !! end
2591
2592
2593 !! test
2594 Definition Lists: Mixed Lists: Test 4
2595 !! input
2596 *;d1 :d2
2597 *;d3 :d4
2598 !! result
2599 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2600 </dd><dt>d3&#160;</dt><dd>d4
2601 </dd></dl>
2602 </li></ul>
2603
2604 !! end
2605
2606
2607 !! test
2608 Definition Lists: Mixed Lists: Test 5
2609 !! input
2610 *:d1
2611 *:: d2
2612 !! result
2613 <ul><li><dl><dd>d1
2614 <dl><dd> d2
2615 </dd></dl>
2616 </dd></dl>
2617 </li></ul>
2618
2619 !! end
2620
2621
2622 !! test
2623 Definition Lists: Mixed Lists: Test 6
2624 !! input
2625 #*:d1
2626 #*::: d3
2627 !! result
2628 <ol><li><ul><li><dl><dd>d1
2629 <dl><dd><dl><dd> d3
2630 </dd></dl>
2631 </dd></dl>
2632 </dd></dl>
2633 </li></ul>
2634 </li></ol>
2635
2636 !! end
2637
2638
2639 !! test
2640 Definition Lists: Mixed Lists: Test 7
2641 !! input
2642 :* d1
2643 :* d2
2644 !! result
2645 <dl><dd><ul><li> d1
2646 </li><li> d2
2647 </li></ul>
2648 </dd></dl>
2649
2650 !! end
2651
2652
2653 !! test
2654 Definition Lists: Mixed Lists: Test 8
2655 !! input
2656 :* d1
2657 ::* d2
2658 !! result
2659 <dl><dd><ul><li> d1
2660 </li></ul>
2661 <dl><dd><ul><li> d2
2662 </li></ul>
2663 </dd></dl>
2664 </dd></dl>
2665
2666 !! end
2667
2668
2669 !! test
2670 Definition Lists: Mixed Lists: Test 9
2671 !! input
2672 *;foo :bar
2673 !! result
2674 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2675 </dd></dl>
2676 </li></ul>
2677
2678 !! end
2679
2680
2681 !! test
2682 Definition Lists: Mixed Lists: Test 10
2683 !! input
2684 *#;foo :bar
2685 !! result
2686 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2687 </dd></dl>
2688 </li></ol>
2689 </li></ul>
2690
2691 !! end
2692
2693 # The Parsoid team disagrees with the PHP parser's seemingly-random
2694 # rules regarding dd/dt on the next two tests. Parsoid is more
2695 # consistent, and recognizes the shared nesting and keeps the
2696 # still-open tags around until the nesting is complete.
2697
2698 !! test
2699 Definition Lists: Mixed Lists: Test 11 (php)
2700 !! options
2701 php
2702 !! input
2703 *#*#;*;;foo :bar
2704 *#*#;boo :baz
2705 !! result
2706 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2707 </dt></dl>
2708 </dd></dl>
2709 </li></ul>
2710 </dd></dl>
2711 <dl><dt>boo&#160;</dt><dd>baz
2712 </dd></dl>
2713 </li></ol>
2714 </li></ul>
2715 </li></ol>
2716 </li></ul>
2717
2718 !! end
2719 !! test
2720 Definition Lists: Mixed Lists: Test 11 (parsoid)
2721 !! options
2722 parsoid
2723 !! input
2724 *#*#;*;;foo :bar
2725 *#*#;boo :baz
2726 !! result
2727 <ul>
2728 <li>
2729 <ol>
2730 <li>
2731 <ul>
2732 <li>
2733 <ol>
2734 <li>
2735 <dl>
2736 <dt>
2737 <ul>
2738 <li>
2739 <dl>
2740 <dt>
2741 <dl>
2742 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2743 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2744 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2745 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2746 !! end
2747
2748
2749 !! test
2750 Definition Lists: Weird Ones: Test 1 (php)
2751 !! options
2752 php
2753 !! input
2754 *#;*::;; foo : bar (who uses this?)
2755 !! result
2756 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2757 </dt></dl>
2758 </dd></dl>
2759 </dd></dl>
2760 </dd></dl>
2761 </li></ul>
2762 </dd></dl>
2763 </li></ol>
2764 </li></ul>
2765
2766 !! end
2767 !! test
2768 Definition Lists: Weird Ones: Test 1 (parsoid)
2769 !! options
2770 parsoid
2771 !! input
2772 *#;*::;; foo : bar (who uses this?)
2773 !! result
2774 <ul>
2775 <li>
2776 <ol>
2777 <li>
2778 <dl>
2779 <dt>
2780 <ul>
2781 <li>
2782 <dl>
2783 <dd>
2784 <dl>
2785 <dd>
2786 <dl>
2787 <dt>
2788 <dl>
2789 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2790 <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>
2791 !! end
2792
2793 ###
2794 ### External links
2795 ###
2796 !! test
2797 External links: non-bracketed
2798 !! input
2799 Non-bracketed: http://example.com
2800 !! result
2801 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2802 </p>
2803 !! end
2804
2805 !! test
2806 External links: numbered
2807 !! input
2808 Numbered: [http://example.com]
2809 Numbered: [http://example.net]
2810 Numbered: [http://example.com]
2811 !! result
2812 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2813 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2814 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2815 </p>
2816 !!end
2817
2818 !! test
2819 External links: specified text
2820 !! input
2821 Specified text: [http://example.com link]
2822 !! result
2823 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2824 </p>
2825 !!end
2826
2827 !! test
2828 External links: trail
2829 !! input
2830 Linktrails should not work for external links: [http://example.com link]s
2831 !! result
2832 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2833 </p>
2834 !! end
2835
2836 !! test
2837 External links: dollar sign in URL
2838 !! input
2839 http://example.com/1$2345
2840 !! result
2841 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2842 </p>
2843 !! end
2844
2845 !! test
2846 External links: dollar sign in URL (named)
2847 !! input
2848 [http://example.com/1$2345]
2849 !! result
2850 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2851 </p>
2852 !!end
2853
2854 !! test
2855 External links: open square bracket forbidden in URL (bug 4377)
2856 !! input
2857 http://example.com/1[2345
2858 !! result
2859 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2860 </p>
2861 !! end
2862
2863 !! test
2864 External links: open square bracket forbidden in URL (named) (bug 4377)
2865 !! input
2866 [http://example.com/1[2345]
2867 !! result
2868 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2869 </p>
2870 !!end
2871
2872 !! test
2873 External links: nowiki in URL link text (bug 6230)
2874 !!input
2875 [http://example.com/ <nowiki>''example site''</nowiki>]
2876 !! result
2877 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2878 </p>
2879 !! end
2880
2881 !! test
2882 External links: newline forbidden in text (bug 6230 regression check)
2883 !! input
2884 [http://example.com/ first
2885 second]
2886 !! result
2887 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2888 second]
2889 </p>
2890 !!end
2891
2892 !! test
2893 External links: Pipe char between url and text
2894 !! input
2895 [http://example.com | link]
2896 !! result
2897 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2898 </p>
2899 !!end
2900
2901 !! test
2902 External links: protocol-relative URL in brackets
2903 !! input
2904 [//example.com/ Test]
2905 !! result
2906 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2907 </p>
2908 !! end
2909
2910 !! test
2911 External links: protocol-relative URL in brackets without text
2912 !! input
2913 [//example.com]
2914 !! result
2915 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2916 </p>
2917 !! end
2918
2919 !! test
2920 External links: protocol-relative URL in free text is left alone
2921 !! input
2922 //example.com/Foo
2923 !! result
2924 <p>//example.com/Foo
2925 </p>
2926 !!end
2927
2928 !! test
2929 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2930 !! input
2931 foo//example.com/Foo
2932 !! result
2933 <p>foo//example.com/Foo
2934 </p>
2935 !! end
2936
2937 !! test
2938 External image
2939 !! input
2940 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2941 !! result
2942 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2943 </p>
2944 !! end
2945
2946 !! test
2947 External image from https
2948 !! input
2949 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2950 !! result
2951 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2952 </p>
2953 !! end
2954
2955 !! test
2956 External image (when not allowed)
2957 !! options
2958 wgAllowExternalImages=0
2959 !! input
2960 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2961 !! result
2962 <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>
2963 </p>
2964 !! end
2965
2966 !! test
2967 Link to non-http image, no img tag
2968 !! input
2969 Link to non-http image, no img tag: ftp://example.com/test.jpg
2970 !! result
2971 <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>
2972 </p>
2973 !! end
2974
2975 !! test
2976 External links: terminating separator
2977 !! input
2978 Terminating separator: http://example.com/thing,
2979 !! result
2980 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2981 </p>
2982 !! end
2983
2984 !! test
2985 External links: intervening separator
2986 !! input
2987 Intervening separator: http://example.com/1,2,3
2988 !! result
2989 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2990 </p>
2991 !! end
2992
2993 !! test
2994 External links: old bug with URL in query
2995 !! input
2996 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2997 !! result
2998 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2999 </p>
3000 !! end
3001
3002 !! test
3003 External links: old URL-in-URL bug, mixed protocols
3004 !! input
3005 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3006 !! result
3007 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3008 </p>
3009 !!end
3010
3011 !! test
3012 External links: URL in text
3013 !! input
3014 URL in text: [http://example.com http://example.com]
3015 !! result
3016 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3017 </p>
3018 !! end
3019
3020 !! test
3021 External links: Clickable images
3022 !! input
3023 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3024 !! result
3025 <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>
3026 </p>
3027 !!end
3028
3029 !! test
3030 External links: raw ampersand
3031 !! input
3032 Old &amp; use: http://x&y
3033 !! result
3034 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3035 </p>
3036 !! end
3037
3038 !! test
3039 External links: encoded ampersand
3040 !! input
3041 Old &amp; use: http://x&amp;y
3042 !! result
3043 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3044 </p>
3045 !! end
3046
3047 !! test
3048 External links: encoded equals (bug 6102)
3049 !! input
3050 http://example.com/?foo&#61;bar
3051 !! result
3052 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3053 </p>
3054 !! end
3055
3056 !! test
3057 External links: [raw ampersand]
3058 !! input
3059 Old &amp; use: [http://x&y]
3060 !! result
3061 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3062 </p>
3063 !! end
3064
3065 !! test
3066 External links: [encoded ampersand]
3067 !! input
3068 Old &amp; use: [http://x&amp;y]
3069 !! result
3070 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3071 </p>
3072 !! end
3073
3074 !! test
3075 External links: [encoded equals] (bug 6102)
3076 !! input
3077 [http://example.com/?foo&#61;bar]
3078 !! result
3079 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3080 </p>
3081 !! end
3082
3083 !! test
3084 External links: [IDN ignored character reference in hostname; strip it right off]
3085 !! input
3086 [http://e&zwnj;xample.com/]
3087 !! result
3088 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3089 </p>
3090 !! end
3091
3092 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3093 # Where an external link could easily circumvent the sanitization of the text of
3094 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3095 # test demands a higher standard. That's a bit strange.
3096 #
3097 # Example:
3098 #
3099 # http://e‌xample.com -> [http://example.com|http://example.com]
3100 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3101 #
3102 # The first example is sanitized, but the second is not. Any security benefits
3103 # from this production are trivial to circumvent. Either remove this test and
3104 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3105 # the test accordingly.
3106 #
3107 # All our love,
3108 # The Parsoid team.
3109 !! test
3110 External links: IDN ignored character reference in hostname; strip it right off
3111 !! input
3112 http://e&zwnj;xample.com/
3113 !! result
3114 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3115 </p>
3116 !! end
3117
3118 !! test
3119 External links: www.jpeg.org (bug 554)
3120 !! input
3121 http://www.jpeg.org
3122 !!result
3123 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3124 </p>
3125 !! end
3126
3127 !! test
3128 External links: URL within URL (original bug 2)
3129 !! input
3130 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3131 !! result
3132 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3133 </p>
3134 !! end
3135
3136 !! test
3137 BUG 361: URL inside bracketed URL
3138 !! input
3139 [http://www.example.com/foo http://www.example.com/bar]
3140 !! result
3141 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3142 </p>
3143 !! end
3144
3145 !! test
3146 BUG 361: URL within URL, not bracketed
3147 !! input
3148 http://www.example.com/foo?=http://www.example.com/bar
3149 !! result
3150 <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>
3151 </p>
3152 !! end
3153
3154 !! test
3155 BUG 289: ">"-token in URL-tail
3156 !! input
3157 http://www.example.com/<hello>
3158 !! result
3159 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3160 </p>
3161 !!end
3162
3163 !! test
3164 BUG 289: literal ">"-token in URL-tail
3165 !! input
3166 http://www.example.com/<b>html</b>
3167 !! result
3168 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3169 </p>
3170 !!end
3171
3172 !! test
3173 BUG 289: ">"-token in bracketed URL
3174 !! input
3175 [http://www.example.com/<hello> stuff]
3176 !! result
3177 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3178 </p>
3179 !!end
3180
3181 !! test
3182 BUG 289: literal ">"-token in bracketed URL
3183 !! input
3184 [http://www.example.com/<b>html</b> stuff]
3185 !! result
3186 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3187 </p>
3188 !!end
3189
3190 !! test
3191 BUG 289: literal double quote at end of URL
3192 !! input
3193 http://www.example.com/"hello"
3194 !! result
3195 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3196 </p>
3197 !!end
3198
3199 !! test
3200 BUG 289: literal double quote in bracketed URL
3201 !! input
3202 [http://www.example.com/"hello" stuff]
3203 !! result
3204 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3205 </p>
3206 !!end
3207
3208 !! test
3209 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3210 !! input
3211 [http://www.example.com test]
3212 !! result
3213 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3214 </p>
3215 !! end
3216
3217 !! test
3218 External links: link text with spaces
3219 !! input
3220 [http://www.example.com a b c]
3221 [http://www.example.com ''a'' ''b'']
3222 !! result
3223 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3224 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3225 </p>
3226 !! end
3227
3228 !! test
3229 External links: wiki links within external link (Bug 3695)
3230 !! input
3231 [http://example.com [[wikilink]] embedded in ext link]
3232 !! result
3233 <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>
3234 </p>
3235 !! end
3236
3237 !! test
3238 BUG 787: Links with one slash after the url protocol are invalid
3239 !! input
3240 http:/example.com
3241
3242 [http:/example.com title]
3243 !! result
3244 <p>http:/example.com
3245 </p><p>[http:/example.com title]
3246 </p>
3247 !! end
3248
3249 !! test
3250 Bracketed external links with template-generated invalid target
3251 !! input
3252 [{{echo|http:/example.com}} title]
3253 !! result
3254 <p>[http:/example.com title]
3255 </p>
3256 !! end
3257
3258 !! test
3259 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3260 !! input
3261 ''[http://example.com text'']
3262 [http://example.com '''text]'''
3263 ''Something [http://example.com in italic'']
3264 ''Something [http://example.com mixed''''', even bold]'''
3265 '''''Now [http://example.com both''''']
3266 !! result
3267 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3268 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3269 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3270 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3271 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3272 </p>
3273 !! end
3274
3275
3276 !! test
3277 Bug 4781: %26 in URL
3278 !! input
3279 http://www.example.com/?title=AT%26T
3280 !! result
3281 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3282 </p>
3283 !! end
3284
3285 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3286 # % is actually legal in HTML5. Any change in output would need testing though.
3287 !! test
3288 Bug 4781, 5267: %25 in URL
3289 !! input
3290 http://www.example.com/?title=100%25_Bran
3291 !! result
3292 <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>
3293 </p>
3294 !! end
3295
3296 !! test
3297 Bug 4781, 5267: %28, %29 in URL
3298 !! input
3299 http://www.example.com/?title=Ben-Hur_%281959_film%29
3300 !! result
3301 <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>
3302 </p>
3303 !! end
3304
3305
3306 !! test
3307 Bug 4781: %26 in autonumber URL
3308 !! input
3309 [http://www.example.com/?title=AT%26T]
3310 !! result
3311 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3312 </p>
3313 !! end
3314
3315 !! test
3316 Bug 4781, 5267: %26 in autonumber URL
3317 !! input
3318 [http://www.example.com/?title=100%25_Bran]
3319 !! result
3320 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3321 </p>
3322 !! end
3323
3324 !! test
3325 Bug 4781, 5267: %28, %29 in autonumber URL
3326 !! input
3327 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3328 !! result
3329 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3330 </p>
3331 !! end
3332
3333
3334 !! test
3335 Bug 4781: %26 in bracketed URL
3336 !! input
3337 [http://www.example.com/?title=AT%26T link]
3338 !! result
3339 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3340 </p>
3341 !! end
3342
3343 !! test
3344 Bug 4781, 5267: %26 in bracketed URL
3345 !! input
3346 [http://www.example.com/?title=100%25_Bran link]
3347 !! result
3348 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3349 </p>
3350 !! end
3351
3352 !! test
3353 Bug 4781, 5267: %28, %29 in bracketed URL
3354 !! input
3355 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3356 !! result
3357 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3358 </p>
3359 !! end
3360
3361 !! test
3362 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3363 !! input
3364 Some [http://example.com/ pretty ''italics'' and stuff]!
3365 !! result
3366 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3367 </p>
3368 !! end
3369
3370 !! test
3371 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3372 !! input
3373 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3374 !! result
3375 <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>
3376 </p>
3377 !! end
3378
3379 !! test
3380 External link containing double-single-quotes with no space separating the url from text in italics
3381 !! input
3382 [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]].]
3383 !! result
3384 <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>
3385 </p>
3386 !! end
3387
3388 !! test
3389 External link with comments in link text
3390 !! input
3391 [http://www.google.com Google <!-- comment -->]
3392 !! result
3393 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3394 </p>
3395 !! end
3396
3397 !! test
3398 URL-encoding in URL functions (single parameter)
3399 !! input
3400 {{localurl:Some page|amp=&}}
3401 !! result
3402 <p>/index.php?title=Some_page&amp;amp=&amp;
3403 </p>
3404 !! end
3405
3406 !! test
3407 URL-encoding in URL functions (multiple parameters)
3408 !! input
3409 {{localurl:Some page|q=?&amp=&}}
3410 !! result
3411 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3412 </p>
3413 !! end
3414
3415 !! test
3416 Brackets in urls
3417 !! input
3418 http://example.com/index.php?foozoid%5B%5D=bar
3419
3420 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3421 !! result
3422 <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>
3423 </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>
3424 </p>
3425 !! end
3426
3427 !! test
3428 IPv6 urls (bug 21261)
3429 !! options
3430 disabled
3431 !! input
3432 http://[2404:130:0:1000::187:2]/index.php
3433 !! result
3434 <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>
3435 </p>
3436 !! end
3437
3438 !! test
3439 Non-extlinks in brackets
3440 !! input
3441 [foo]
3442 [foo bar]
3443 [foo ''bar'']
3444 [fool's] errand
3445 [fool's errand]
3446 [{{echo|foo}}]
3447 [{{echo|foo}} bar]
3448 [{{echo|foo}} ''bar'']
3449 [{{echo|foo}}l's] errand
3450 [{{echo|foo}}l's errand]
3451 [url={{echo|foo}}]
3452 [url=http://example.com]
3453 !! result
3454 <p>[foo]
3455 [foo bar]
3456 [foo <i>bar</i>]
3457 [fool's] errand
3458 [fool's errand]
3459 [foo]
3460 [foo bar]
3461 [foo <i>bar</i>]
3462 [fool's] errand
3463 [fool's errand]
3464 [url=foo]
3465 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3466 </p>
3467 !! end
3468
3469 !! test
3470 Parsoid: Percent encoding in external links
3471 !! options
3472 parsoid
3473 !! input
3474 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3475 !! result
3476 <p><a rel="mw:ExtLink"
3477 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3478 !! end
3479
3480 !! test
3481 Parsoid: use url link syntax for links where the content is equal the link
3482 target
3483 !! options
3484 parsoid
3485 !! input
3486 http://example.com
3487 !! result
3488 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3489 !! end
3490
3491 ###
3492 ### Quotes
3493 ###
3494
3495 !! test
3496 Quotes
3497 !! input
3498 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3499
3500 Normal text. '''''Bold italic text.''''' Normal text.
3501 !!result
3502 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3503 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3504 </p>
3505 !! end
3506
3507
3508 !! test
3509 Unclosed and unmatched quotes (php)
3510 !! options
3511 php
3512 !! input
3513 '''''Bold italic text '''with bold deactivated''' in between.'''''
3514
3515 '''''Bold italic text ''with italic deactivated'' in between.'''''
3516
3517 '''Bold text..
3518
3519 ..spanning two paragraphs (should not work).'''
3520
3521 '''Bold tag left open
3522
3523 ''Italic tag left open
3524
3525 Normal text.
3526
3527 <!-- Unmatching number of opening, closing tags: -->
3528 '''This year''''s election ''should'' beat '''last year''''s.
3529
3530 ''Tom'''s car is bigger than ''Susan'''s.
3531
3532 Plain ''italic'''s plain
3533 !! result
3534 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3535 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3536 </p><p><b>Bold text..</b>
3537 </p><p>..spanning two paragraphs (should not work).
3538 </p><p><b>Bold tag left open</b>
3539 </p><p><i>Italic tag left open</i>
3540 </p><p>Normal text.
3541 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3542 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3543 </p><p>Plain <i>italic'</i>s plain
3544 </p>
3545 !! end
3546 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3547 # parser strips. The wikitext contains just the first half of the bold
3548 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3549 # differently than the PHP parser.)
3550 !! test
3551 Unclosed and unmatched quotes (parsoid)
3552 !! options
3553 parsoid
3554 !! input
3555 '''''Bold italic text '''with bold deactivated''' in between.'''''
3556
3557 '''''Bold italic text ''with italic deactivated'' in between.'''''
3558
3559 '''Bold text..
3560
3561 ..spanning two paragraphs (should not work).'''
3562
3563 '''Bold tag left open
3564
3565 ''Italic tag left open
3566
3567 Normal text.
3568
3569 <!-- Unmatching number of opening, closing tags: -->
3570 '''This year''''s election ''should'' beat '''last year''''s.
3571
3572 ''Tom'''s car is bigger than ''Susan'''s.
3573
3574 Plain ''italic'''s plain
3575 !! result
3576 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3577 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3578 </p><p><b>Bold text..</b>
3579 </p><p>..spanning two paragraphs (should not work).<b></b>
3580 </p><p><b>Bold tag left open</b>
3581 </p><p><i>Italic tag left open</i>
3582 </p><p>Normal text.
3583 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3584 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3585 </p><p>Plain <i>italic'</i>s plain
3586 </p>
3587 !! end
3588
3589 ###
3590 ### Tables
3591 ###
3592 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3593 ###
3594
3595 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3596 # is the bare minimum required by the spec, see:
3597 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3598 !! test
3599 A table with no data. (php)
3600 !! options
3601 php
3602 !! input
3603 {||}
3604 !! result
3605 !! end
3606 # Parsoid team replies: empty table tags are legal in HTML5
3607 !! test
3608 A table with no data. (parsoid)
3609 !! options
3610 parsoid
3611 !! input
3612 {||}
3613 !! result
3614 <table></table>
3615 !! end
3616
3617 # A table with nothing but a caption is invalid XHTML, we might want to render
3618 # this as <p>caption</p>
3619 !! test
3620 A table with nothing but a caption (php)
3621 !! options
3622 php
3623 !! input
3624 {|
3625 |+ caption
3626 |}
3627 !! result
3628 <table>
3629 <caption> caption
3630 </caption><tr><td></td></tr></table>
3631
3632 !! end
3633 # Parsoid team replies: table with only a caption is legal in HTML5
3634 !! test
3635 A table with nothing but a caption (parsoid)
3636 !! options
3637 parsoid
3638 !! input
3639 {|
3640 |+ caption
3641 |}
3642 !! result
3643 <table><caption> caption</caption></table>
3644 !! end
3645
3646 !! test
3647 A table with caption with default-spaced attributes and a table row
3648 !! input
3649 {|
3650 |+ style="color: red;" | caption1
3651 |-
3652 | foo
3653 |}
3654 !! result
3655 <table>
3656 <caption style="color: red;"> caption1
3657 </caption>
3658 <tr>
3659 <td> foo
3660 </td></tr></table>
3661
3662 !! end
3663
3664 !! test
3665 A table with captions with non-default spaced attributes and a table row
3666 !! input
3667 {|
3668 |+style="color: red;"|caption2
3669 |+ style="color: red;"| caption3
3670 |-
3671 | foo
3672 |}
3673 !! result
3674 <table>
3675 <caption style="color: red;">caption2
3676 </caption>
3677 <caption style="color: red;"> caption3
3678 </caption>
3679 <tr>
3680 <td> foo
3681 </td></tr></table>
3682
3683 !! end
3684
3685 !! test
3686 Table td-cell syntax variations
3687 !! input
3688 {|
3689 | foo bar foo | baz
3690 | foo bar foo || baz
3691 | style='color:red;' | baz
3692 | style='color:red;' || baz
3693 |}
3694 !! result
3695 <table>
3696 <tr>
3697 <td> baz
3698 </td>
3699 <td> foo bar foo </td>
3700 <td> baz
3701 </td>
3702 <td style="color:red;"> baz
3703 </td>
3704 <td> style='color:red;' </td>
3705 <td> baz
3706 </td></tr></table>
3707
3708 !! end
3709
3710 !! test
3711 Simple table
3712 !! input
3713 {|
3714 | 1 || 2
3715 |-
3716 | 3 || 4
3717 |}
3718 !! result
3719 <table>
3720 <tr>
3721 <td> 1 </td>
3722 <td> 2
3723 </td></tr>
3724 <tr>
3725 <td> 3 </td>
3726 <td> 4
3727 </td></tr></table>
3728
3729 !! end
3730
3731 !! test
3732 Simple table but with multiple dashes for row wikitext
3733 !! input
3734 {|
3735 | foo
3736 |-----
3737 | bar
3738 |}
3739 !! result
3740 <table>
3741 <tr>
3742 <td> foo
3743 </td></tr>
3744 <tr>
3745 <td> bar
3746 </td></tr></table>
3747
3748 !! end
3749 !! test
3750 Multiplication table
3751 !! input
3752 {| border="1" cellpadding="2"
3753 |+Multiplication table
3754 |-
3755 ! &times; !! 1 !! 2 !! 3
3756 |-
3757 ! 1
3758 | 1 || 2 || 3
3759 |-
3760 ! 2
3761 | 2 || 4 || 6
3762 |-
3763 ! 3
3764 | 3 || 6 || 9
3765 |-
3766 ! 4
3767 | 4 || 8 || 12
3768 |-
3769 ! 5
3770 | 5 || 10 || 15
3771 |}
3772 !! result
3773 <table border="1" cellpadding="2">
3774 <caption>Multiplication table
3775 </caption>
3776 <tr>
3777 <th> &#215; </th>
3778 <th> 1 </th>
3779 <th> 2 </th>
3780 <th> 3
3781 </th></tr>
3782 <tr>
3783 <th> 1
3784 </th>
3785 <td> 1 </td>
3786 <td> 2 </td>
3787 <td> 3
3788 </td></tr>
3789 <tr>
3790 <th> 2
3791 </th>
3792 <td> 2 </td>
3793 <td> 4 </td>
3794 <td> 6
3795 </td></tr>
3796 <tr>
3797 <th> 3
3798 </th>
3799 <td> 3 </td>
3800 <td> 6 </td>
3801 <td> 9
3802 </td></tr>
3803 <tr>
3804 <th> 4
3805 </th>
3806 <td> 4 </td>
3807 <td> 8 </td>
3808 <td> 12
3809 </td></tr>
3810 <tr>
3811 <th> 5
3812 </th>
3813 <td> 5 </td>
3814 <td> 10 </td>
3815 <td> 15
3816 </td></tr></table>
3817
3818 !! end
3819
3820 !! test
3821 Accept "||" in table headings
3822 !! input
3823 {|
3824 !h1 || h2
3825 |}
3826 !! result
3827 <table>
3828 <tr>
3829 <th>h1 </th>
3830 <th> h2
3831 </th></tr></table>
3832
3833 !! end
3834
3835 !! test
3836 Accept "||" in indented table headings
3837 !! input
3838 :{|
3839 !h1 || h2
3840 |}
3841 !! result
3842 <dl><dd><table>
3843 <tr>
3844 <th>h1 </th>
3845 <th> h2
3846 </th></tr></table></dd></dl>
3847
3848 !! end
3849
3850 !! test
3851 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3852 !! input
3853 {|
3854 !| h1
3855 || a
3856 |}
3857 !! result
3858 <table>
3859 <tr>
3860 <th> h1
3861 </th>
3862 <td> a
3863 </td></tr></table>
3864
3865 !! end
3866
3867 !!test
3868 Accept "| !" at start of line in tables (ignore !-attribute)
3869 !!input
3870 {|
3871 |-
3872 | !style="color:red" | bar
3873 |}
3874 !!result
3875 <table>
3876
3877 <tr>
3878 <td> bar
3879 </td></tr></table>
3880
3881 !!end
3882
3883 !!test
3884 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 +/-
3885 !!input
3886 {|
3887 |-
3888 |style='color:red;'|+1
3889 |style='color:blue;'|-1
3890 |-
3891 | 1 || 2 || 3
3892 | 1 ||+2 ||-3
3893 |-
3894 | +1
3895 | -1
3896 |}
3897 !!result
3898 <table>
3899
3900 <tr>
3901 <td style="color:red;">+1
3902 </td>
3903 <td style="color:blue;">-1
3904 </td></tr>
3905 <tr>
3906 <td> 1 </td>
3907 <td> 2 </td>
3908 <td> 3
3909 </td>
3910 <td> 1 </td>
3911 <td>+2 </td>
3912 <td>-3
3913 </td></tr>
3914 <tr>
3915 <td> +1
3916 </td>
3917 <td> -1
3918 </td></tr></table>
3919
3920 !!end
3921
3922 !! test
3923 Table rowspan
3924 !! input
3925 {| border=1
3926 | Cell 1, row 1
3927 |rowspan=2| Cell 2, row 1 (and 2)
3928 | Cell 3, row 1
3929 |-
3930 | Cell 1, row 2
3931 | Cell 3, row 2
3932 |}
3933 !! result
3934 <table border="1">
3935 <tr>
3936 <td> Cell 1, row 1
3937 </td>
3938 <td rowspan="2"> Cell 2, row 1 (and 2)
3939 </td>
3940 <td> Cell 3, row 1
3941 </td></tr>
3942 <tr>
3943 <td> Cell 1, row 2
3944 </td>
3945 <td> Cell 3, row 2
3946 </td></tr></table>
3947
3948 !! end
3949
3950 !! test
3951 Nested table
3952 !! input
3953 {| border=1
3954 | &alpha;
3955 |
3956 {| bgcolor=#ABCDEF border=2
3957 |nested
3958 |-
3959 |table
3960 |}
3961 |the original table again
3962 |}
3963 !! result
3964 <table border="1">
3965 <tr>
3966 <td> &#945;
3967 </td>
3968 <td>
3969 <table bgcolor="#ABCDEF" border="2">
3970 <tr>
3971 <td>nested
3972 </td></tr>
3973 <tr>
3974 <td>table
3975 </td></tr></table>
3976 </td>
3977 <td>the original table again
3978 </td></tr></table>
3979
3980 !! end
3981
3982 !! test
3983 Invalid attributes in table cell (bug 1830)
3984 !! input
3985 {|
3986 |Cell:|broken
3987 |}
3988 !! result
3989 <table>
3990 <tr>
3991 <td>broken
3992 </td></tr></table>
3993
3994 !! end
3995
3996
3997 !! test
3998 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3999 !! input
4000 {|
4001 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
4002 !! result
4003 <table>
4004 <tr>
4005 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
4006 <td>]" onmouseover="alert(document.cookie)"&gt;test
4007 </td>
4008 </tr>
4009 </table>
4010
4011 !! end
4012
4013
4014 !! test
4015 Indented table markup mixed with indented pre content (proposed in bug 6200)
4016 !! input
4017 <table>
4018 <tr>
4019 <td>
4020 Text that should be rendered preformatted
4021 </td>
4022 </tr>
4023 </table>
4024 !! result
4025 <table>
4026 <tr>
4027 <td>
4028 <pre>Text that should be rendered preformatted
4029 </pre>
4030 </td>
4031 </tr>
4032 </table>
4033
4034 !! end
4035
4036 !! test
4037 Template-generated table cell attributes and cell content
4038 !! input
4039 {|
4040 |{{table_attribs}}
4041 |}
4042 !! result
4043 <table>
4044 <tr>
4045 <td style="color: red"> Foo
4046 </td></tr></table>
4047
4048 !! end
4049
4050 !! test
4051 Template-generated table cell attributes and cell content (2)
4052 !! input
4053 {|
4054 |align=center {{table_attribs}}
4055 |}
4056 !! result
4057 <table>
4058 <tr>
4059 <td align="center" style="color: red"> Foo
4060 </td></tr></table>
4061
4062 !! end
4063
4064 !! test
4065 Template-generated table cell attributes and cell content (3)
4066 !! input
4067 {|
4068 |align=center {{table_cells}}
4069 |}
4070 !! result
4071 <table>
4072 <tr>
4073 <td align="center" style="color: red"> Foo </td>
4074 <td> Bar </td>
4075 <td> Baz
4076 </td></tr></table>
4077
4078 !! end
4079
4080 !! test
4081 Table with row followed by newlines and table heading
4082 !! input
4083 {|
4084 |-
4085
4086 ! foo
4087 |}
4088 !! result
4089 <table>
4090
4091
4092 <tr>
4093 <th> foo
4094 </th></tr></table>
4095
4096 !! end
4097
4098 !! test
4099 Table with empty line following the start tag
4100 !! input
4101 {|
4102
4103 |-
4104 | foo
4105 |}
4106 !! result
4107 <table>
4108
4109
4110 <tr>
4111 <td> foo
4112 </td></tr></table>
4113
4114 !! end
4115
4116 # FIXME: Preserve the attribute properly (with an empty string as value) in
4117 # the PHP parser. Parsoid implements the behavior below.
4118 !! test
4119 Table attributes with empty value
4120 !! options
4121 parsoid
4122 !! input
4123 {|
4124 | style=| hello
4125 |}
4126 !! result
4127 <table>
4128 <tbody>
4129 <tr>
4130 <td style=""> hello
4131 </td></tr></tbody></table>
4132
4133 !! end
4134
4135 !! test
4136 Wikitext table with a lot of comments
4137 !! input
4138 {|
4139 <!-- c0 -->
4140 | foo
4141 <!-- c1 -->
4142 |- <!-- c2 -->
4143 <!-- c3 -->
4144 |<!-- c4 -->
4145 <!-- c5 -->
4146 |}
4147 !! result
4148 <table>
4149 <tr>
4150 <td> foo
4151 </td></tr>
4152 <tr>
4153 <td>
4154 </td></tr></table>
4155
4156 !! end
4157
4158 !! test
4159 Wikitext table with double-line table cell
4160 !! input
4161 {|
4162 |a
4163 b
4164 |}
4165 !! result
4166 <table>
4167 <tr>
4168 <td>a
4169 <p>b
4170 </p>
4171 </td></tr></table>
4172
4173 !! end
4174
4175 !! test
4176 Table cell with a single comment
4177 !! input
4178 {|
4179 | <!-- c1 -->
4180 | a
4181 |}
4182 !! result
4183 <table>
4184 <tr>
4185 <td>
4186 </td>
4187 <td> a
4188 </td></tr></table>
4189
4190 !! end
4191
4192 # The expected HTML structure in this test is debatable. The PHP parser does
4193 # not parse this kind of table at all. The main focus for Parsoid is on
4194 # round-tripping, so this output is ok for now. TODO: revisit!
4195 !! test
4196 Wikitext table with html-syntax row (Parsoid)
4197 !! options
4198 parsoid
4199 !! input
4200 {|
4201 |-
4202 <td>foo</td>
4203 |}
4204 !! result
4205 <table>
4206 <tbody>
4207 <tr>
4208 <td>foo</td></tr></tbody></table>
4209 !! end
4210
4211 !! test
4212 Implicit <td> after a |-
4213 (PHP parser relies on Tidy to add the missing <td> tags)
4214 !! options
4215 parsoid=wt2html,wt2wt
4216 !! input
4217 {|
4218 |-
4219 a
4220 |}
4221 !! result
4222 <table>
4223 <tr><td>a</td></tr>
4224 </table>
4225 !! end
4226
4227 !! test
4228 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4229 (PHP parser relies on Tidy to add the missing <td> tags)
4230 !! options
4231 parsoid=wt2html,wt2wt
4232 !! input
4233 {|
4234 |-
4235 |
4236 a
4237 |-
4238 b
4239 |}
4240 !! result
4241 <table>
4242 <tbody>
4243 <tr><td><pre>a</pre></td></tr>
4244 <tr><td> b</td></tr>
4245 </tbody>
4246 </table>
4247 !! end
4248
4249 !! test
4250 Lists should be recognized in an implicit <td> context
4251 (PHP parser relies on Tidy to add the missing <td> tags)
4252 !! options
4253 parsoid=wt2html,wt2wt
4254 !! input
4255 {|
4256 |-
4257 *a
4258 |}
4259 !! result
4260 <table>
4261 <tr>
4262 <td><ul><li>a</li></ul></td>
4263 </tr>
4264 </table>
4265 !! end
4266
4267 ###
4268 ### Internal links
4269 ###
4270 !! test
4271 Plain link, capitalized
4272 !! input
4273 [[Main Page]]
4274 !! result
4275 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4276 </p>
4277 !! end
4278
4279 !! test
4280 Plain link, uncapitalized
4281 !! input
4282 [[main Page]]
4283 !! result
4284 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4285 </p>
4286 !! end
4287
4288 !! test
4289 Piped link
4290 !! input
4291 [[Main Page|The Main Page]]
4292 !! result
4293 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4294 </p>
4295 !! end
4296
4297 !! test
4298 Piped link with comment in link text
4299 !! input
4300 [[Main Page|The Main<!--front--> Page]]
4301 !! result
4302 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4303 </p>
4304 !! end
4305
4306 !! test
4307 Broken link
4308 !! input
4309 [[Zigzagzogzagzig]]
4310 !! result
4311 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4312 </p>
4313 !! end
4314
4315 !! test
4316 Broken link with fragment
4317 !! input
4318 [[Zigzagzogzagzig#zug]]
4319 !! result
4320 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4321 </p>
4322 !! end
4323
4324 !! test
4325 Special page link with fragment
4326 !! input
4327 [[Special:Version#anchor]]
4328 !! result
4329 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4330 </p>
4331 !! end
4332
4333 !! test
4334 Nonexistent special page link with fragment
4335 !! input
4336 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4337 !! result
4338 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4339 </p>
4340 !! end
4341
4342 !! test
4343 Link with prefix
4344 !! input
4345 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4346 !! result
4347 <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>
4348 </p>
4349 !! end
4350
4351 !! test
4352 Link with suffix
4353 !! input
4354 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4355 !! result
4356 <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>!!!
4357 </p>
4358 !! end
4359
4360 !! article
4361 prefixed article
4362 !! text
4363 Some text
4364 !! endarticle
4365
4366 !! test
4367 Bug 43661: Piped links with identical prefixes
4368 !! input
4369 [[prefixed article|prefixed articles with spaces]]
4370
4371 [[prefixed article|prefixed articlesaoeu]]
4372
4373 [[Main Page|Main Page test]]
4374 !! result
4375 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4376 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4377 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4378 </p>
4379 !! end
4380
4381
4382 !! test
4383 Link with HTML entity in suffix / tail
4384 !! input
4385 [[Main Page]]&quot;, [[Main Page]]&#97;
4386 !! result
4387 <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;
4388 </p>
4389 !! end
4390
4391 !! test
4392 Link with 3 brackets
4393 !! input
4394 [[[main page]]]
4395 !! result
4396 <p>[[[main page]]]
4397 </p>
4398 !! end
4399
4400 !! test
4401 Piped link with 3 brackets
4402 !! input
4403 [[[main page|the main page]]]
4404 !! result
4405 <p>[[[main page|the main page]]]
4406 </p>
4407 !! end
4408
4409 !! test
4410 Link with multiple pipes
4411 !! input
4412 [[Main Page|The|Main|Page]]
4413 !! result
4414 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4415 </p>
4416 !! end
4417
4418 !! test
4419 Link to namespaces
4420 !! input
4421 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4422 !! result
4423 <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>
4424 </p>
4425 !! end
4426
4427 !! test
4428 Piped link to namespace
4429 !! input
4430 [[Meta:Disclaimers|The disclaimers]]
4431 !! result
4432 <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>
4433 </p>
4434 !! end
4435
4436 !! test
4437 Link containing }
4438 !! input
4439 [[Usually caused by a typo (oops}]]
4440 !! result
4441 <p>[[Usually caused by a typo (oops}]]
4442 </p>
4443 !! end
4444
4445 !! test
4446 Link containing % (not as a hex sequence)
4447 !! input
4448 [[7% Solution]]
4449 !! result
4450 <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>
4451 </p>
4452 !! end
4453
4454 !! test
4455 Link containing % as a single hex sequence interpreted to char
4456 !! input
4457 [[7%25 Solution]]
4458 !! result
4459 <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>
4460 </p>
4461 !!end
4462
4463 !! test
4464 Link containing % as a double hex sequence interpreted to hex sequence
4465 !! input
4466 [[7%2525 Solution]]
4467 !! result
4468 <p>[[7%2525 Solution]]
4469 </p>
4470 !!end
4471
4472 !! test
4473 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4474 Example for such a section: == < ==
4475 !! input
4476 [[%23%3c]][[%23%3e]]
4477 !! result
4478 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4479 </p>
4480 !! end
4481
4482 !! test
4483 Link containing "<#" and ">#" as a hex sequences
4484 !! input
4485 [[%3c%23]][[%3e%23]]
4486 !! result
4487 <p>[[%3c%23]][[%3e%23]]
4488 </p>
4489 !! end
4490
4491 !! test
4492 Link containing an equals sign
4493 !! input
4494 [[Special:BookSources/isbn=4-00-026157-6]]
4495 !! result
4496 <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>
4497 </p>
4498 !! end
4499
4500 !! article
4501 Foo~bar
4502 !! text
4503 Just a test of an article title containing a tilde.
4504 !! endarticle
4505
4506 # note that links containing signatures, like [[Foo~~~~]], are
4507 # massaged by the pre-save transform (PST) and so the tildes are never
4508 # seen by the parser.
4509 !! test
4510 Link containing a tilde
4511 !! input
4512 [[Foo~bar]]
4513 !! result
4514 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4515 </p>
4516 !! end
4517
4518 !! test
4519 Link containing double-single-quotes '' (bug 4598)
4520 !! input
4521 [[Lista d''e paise d''o munno]]
4522 !! result
4523 <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>
4524 </p>
4525 !! end
4526
4527 !! test
4528 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4529 !! input
4530 Some [[Link|pretty ''italics'' and stuff]]!
4531 !! result
4532 <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>!
4533 </p>
4534 !! end
4535
4536 !! test
4537 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4538 !! input
4539 ''Some [[Link|pretty ''italics'' and stuff]]!
4540 !! result
4541 <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>
4542 </p>
4543 !! end
4544
4545 !! test
4546 Link with double quotes in title part (literal) and alternate part (interpreted)
4547 !! input
4548 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4549
4550 [[''Pentecoste'']]
4551
4552 [[''Pentecoste''|Pentecoste]]
4553
4554 [[''Pentecoste''|''Pentecoste'']]
4555 !! result
4556 <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>
4557 </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>
4558 </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>
4559 </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>
4560 </p>
4561 !! end
4562
4563 !! test
4564 Broken image links with HTML captions (bug 39700)
4565 !! input
4566 [[File:Nonexistent|<script></script>]]
4567 [[File:Nonexistent|100px|<script></script>]]
4568 [[File:Nonexistent|&lt;]]
4569 [[File:Nonexistent|a<i>b</i>c]]
4570 !! result
4571 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4572 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4573 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4574 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4575 </p>
4576 !! end
4577
4578 !! test
4579 Plain link to URL
4580 !! input
4581 [[http://www.example.com]]
4582 !! result
4583 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4584 </p>
4585 !! end
4586
4587 !! test
4588 Plain link to URL with link text
4589 !! input
4590 [[http://www.example.com Link text]]
4591 !! result
4592 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4593 </p>
4594 !! end
4595
4596 !! test
4597 Plain link to protocol-relative URL
4598 !! input
4599 [[//www.example.com]]
4600 !! result
4601 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4602 </p>
4603 !! end
4604
4605 !! test
4606 Plain link to protocol-relative URL with link text
4607 !! input
4608 [[//www.example.com Link text]]
4609 !! result
4610 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4611 </p>
4612 !! end
4613
4614 !! test
4615 Plain link to page with question mark in title
4616 !! input
4617 [[A?b]]
4618
4619 [[A?b|Baz]]
4620 !! result
4621 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4622 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4623 </p>
4624 !! end
4625
4626
4627 # I'm fairly sure the expected result here is wrong.
4628 # We want these to be URL links, not pseudo-pages with URLs for titles....
4629 # However the current output is also pretty screwy.
4630 #
4631 # ----
4632 # I'm changing it to match the current output--it arguably makes more
4633 # sense in the light of the test above. Old expected result was:
4634 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4635 #</p>
4636 # But I think this test is bordering on "garbage in, garbage out" anyway.
4637 # -- wtm
4638 !! test
4639 Piped link to URL
4640 !! input
4641 Piped link to URL: [[http://www.example.com|an example URL]]
4642 !! result
4643 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4644 </p>
4645 !! end
4646
4647 !! test
4648 BUG 2: [[page|http://url/]] should link to page, not http://url/
4649 !! input
4650 [[Main Page|http://url/]]
4651 !! result
4652 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4653 </p>
4654 !! end
4655
4656 !! test
4657 BUG 337: Escaped self-links should be bold
4658 !! options
4659 title=[[Bug462]]
4660 !! input
4661 [[Bu&#103;462]] [[Bug462]]
4662 !! result
4663 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4664 </p>
4665 !! end
4666
4667 !! test
4668 Self-link to section should not be bold
4669 !! options
4670 title=[[Main Page]]
4671 !! input
4672 [[Main Page#section]]
4673 !! result
4674 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4675 </p>
4676 !! end
4677
4678 !! article
4679 00
4680 !! text
4681 This is 00.
4682 !! endarticle
4683
4684 !!test
4685 Self-link to numeric title
4686 !!options
4687 title=[[0]]
4688 !!input
4689 [[0]]
4690 !!result
4691 <p><strong class="selflink">0</strong>
4692 </p>
4693 !!end
4694
4695 !!test
4696 Link to numeric-equivalent title
4697 !!options
4698 title=[[0]]
4699 !!input
4700 [[00]]
4701 !!result
4702 <p><a href="/wiki/00" title="00">00</a>
4703 </p>
4704 !!end
4705
4706 !! test
4707 <nowiki> inside a link
4708 !! input
4709 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4710 !! result
4711 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4712 </p>
4713 !! end
4714
4715 !! test
4716 Non-breaking spaces in title
4717 !! input
4718 [[&nbsp; Main &nbsp; Page &nbsp;]]
4719 !! result
4720 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4721 </p>
4722 !!end
4723
4724 !! test
4725 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4726 !! options
4727 language=ca
4728 !! input
4729 '''[[Main Page]]'''
4730 !! result
4731 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4732 </p>
4733 !! end
4734
4735 !! test
4736 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4737 !! options
4738 language=ca
4739 !! input
4740 ''[[Main Page]]''
4741 !! result
4742 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4743 </p>
4744 !! end
4745
4746 !! test
4747 Internal link with en linktrail: no apostrophes (bug 27473)
4748 !! options
4749 language=en
4750 !! input
4751 [[Something]]'nice
4752 !! result
4753 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4754 </p>
4755 !! end
4756
4757 !! test
4758 Internal link with ca linktrail with apostrophes (bug 27473)
4759 !! options
4760 language=ca
4761 !! input
4762 [[Something]]'nice
4763 !! result
4764 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4765 </p>
4766 !! end
4767
4768 !! test
4769 Internal link with kaa linktrail with apostrophes (bug 27473)
4770 !! options
4771 language=kaa
4772 !! input
4773 [[Something]]'nice
4774 !! result
4775 <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>
4776 </p>
4777 !! end
4778
4779 !! article
4780 Söfnuður
4781 !! text
4782 Test.
4783 !! endarticle
4784
4785 !! test
4786 Internal link with is link prefix
4787 !! options
4788 language=is
4789 !! input
4790 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4791 !! result
4792 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4793 </p>
4794 !! end
4795
4796 !! article
4797 Mótmælendatrú
4798 !! text
4799 Test.
4800 !! endarticle
4801
4802 !! test
4803 Internal link with is link trail and link prefix
4804 !! options
4805 language=is
4806 !! input
4807 [[mótmælendatrú|xxx]]ar
4808 [[mótmælendatrú]]ar
4809 mótmælenda[[söfnuður]]
4810 mótmælenda[[söfnuður|söfnuðir]]
4811 mótmælenda[[söfnuður|söfnuðir]]xxx
4812 !! result
4813 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4814 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4815 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4816 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4817 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4818 </p>
4819 !! end
4820
4821 !! test
4822 Parsoid link trail escaping
4823 !! options
4824 parsoid=html2wt,html2html
4825 !! input
4826 [[apple]]<nowiki/>s
4827 !! result
4828 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4829 !! end
4830
4831 !! test
4832 Parsoid link prefix escaping
4833 !! options
4834 language=is
4835 parsoid=html2wt,html2html
4836 !! input
4837 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4838 !! result
4839 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4840 !! end
4841
4842 !! test
4843 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4844 !! input
4845 [[Foo| bar]]
4846
4847 [[Foo| ''bar'']]
4848
4849 [http://wp.org foo]
4850
4851 [http://wp.org ''foo'']
4852 !! result
4853 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4854 </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>
4855 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4856 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4857 </p>
4858 !! end
4859
4860 ###
4861 ### Interwiki links (see maintenance/interwiki.sql)
4862 ###
4863
4864 !! test
4865 Inline interwiki link
4866 !! input
4867 [[MeatBall:SoftSecurity]]
4868 !! result
4869 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4870 </p>
4871 !! end
4872
4873 !! test
4874 Inline interwiki link with empty title (bug 2372)
4875 !! input
4876 [[MeatBall:]]
4877 !! result
4878 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4879 </p>
4880 !! end
4881
4882 !! test
4883 Interwiki link encoding conversion (bug 1636)
4884 !! input
4885 *[[Wikipedia:ro:Olteni&#0355;a]]
4886 *[[Wikipedia:ro:Olteni&#355;a]]
4887 !! result
4888 <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>
4889 </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>
4890 </li></ul>
4891
4892 !! end
4893
4894 !! test
4895 Interwiki link with fragment (bug 2130)
4896 !! input
4897 [[MeatBall:SoftSecurity#foo]]
4898 !! result
4899 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4900 </p>
4901 !! end
4902
4903 !! test
4904 Interlanguage link
4905 !! input
4906 Blah blah blah
4907 [[zh:Chinese]]
4908 !!result
4909 <p>Blah blah blah
4910 </p>
4911 !! end
4912
4913 !! test
4914 Double interlanguage link
4915 !! input
4916 Blah blah blah
4917 [[es:Spanish]]
4918 [[zh:Chinese]]
4919 !!result
4920 <p>Blah blah blah
4921 </p>
4922 !! end
4923
4924 !! test
4925 Interlanguage link, with prefix links
4926 !! options
4927 language=ln
4928 !! input
4929 Blah blah blah
4930 [[zh:Chinese]]
4931 !!result
4932 <p>Blah blah blah
4933 </p>
4934 !! end
4935
4936 !! test
4937 Double interlanguage link, with prefix links (bug 8897)
4938 !! options
4939 language=ln
4940 !! input
4941 Blah blah blah
4942 [[es:Spanish]]
4943 [[zh:Chinese]]
4944 !!result
4945 <p>Blah blah blah
4946 </p>
4947 !! end
4948
4949 !! test
4950 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4951 !! options
4952 language=ln
4953 !! input
4954 [[WW&nbsp;II]]
4955 !!result
4956 <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>
4957 </p>
4958 !! end
4959
4960 !! test
4961 Parsoid: handle constructor well
4962 !! options
4963 parsoid
4964 !! input
4965 [[constructor]]
4966
4967 [[constructor:foo]]
4968 !! result
4969 <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>
4970
4971
4972 <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>
4973 !! end
4974
4975 ##
4976 ## Redirects, Parsoid-only
4977 ##
4978 !! test
4979 Simple redirect to page
4980 !! options
4981 parsoid
4982 !! input
4983 #REDIRECT [[Main Page]]
4984 !! result
4985 <link rel="mw:PageProp/redirect" href="./Main_Page">
4986 !! end
4987
4988 !! test
4989 Optional colon in #REDIRECT
4990 !! options
4991 # the colon is archaic syntax. we support it for wt2html, but we
4992 # don't care that it roundtrips back to the modern syntax.
4993 parsoid=wt2html,html2html
4994 !! input
4995 #REDIRECT:[[Main Page]]
4996 !! result
4997 <link rel="mw:PageProp/redirect" href="./Main_Page">
4998 !! end
4999
5000 !! test
5001 Whitespace in #REDIRECT with optional colon
5002 !! options
5003 # the colon and gratuitous whitespace is archaic syntax. we support
5004 # it for wt2html, but we don't care that it roundtrips back to the
5005 # modern syntax (without extra whitespace)
5006 parsoid=wt2html,html2html
5007 !! input
5008
5009 #REDIRECT
5010 :
5011 [[Main Page]]
5012 !! result
5013 <link rel="mw:PageProp/redirect" href="./Main_Page">
5014 !! end
5015
5016 !! test
5017 Piped link in #REDIRECT
5018 !! options
5019 # content after piped link is ignored. we support this syntax,
5020 # but don't care that the piped link is lost when we roundtrip this.
5021 parsoid=wt2html
5022 !! input
5023 #REDIRECT [[Main Page|bar]]
5024 !! result
5025 <link rel="mw:PageProp/redirect" href="./Main_Page">
5026 !! end
5027
5028 !! test
5029 Redirect to category
5030 !! options
5031 parsoid=wt2html
5032 !! input
5033 #REDIRECT [[Category:Foo]]
5034 !! result
5035 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
5036 !! end
5037
5038 !! test
5039 Redirect to category with URL encoding
5040 !! options
5041 parsoid=wt2html
5042 !! input
5043 #REDIRECT [[Category%3AFoo]]
5044 !! result
5045 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
5046 !! end
5047
5048 !! test
5049 Redirect to category page
5050 !! options
5051 parsoid=wt2html,html2html
5052 !! input
5053 #REDIRECT [[:Category:Foo]]
5054 !! result
5055 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
5056 !! end
5057
5058 !! test
5059 Redirect to image page (1)
5060 !! options
5061 parsoid
5062 !! input
5063 #REDIRECT [[File:Wiki.png]]
5064 !! result
5065 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5066 !! end
5067
5068 !! test
5069 Redirect to image page (2)
5070 !! options
5071 parsoid
5072 !! input
5073 #REDIRECT [[Image:Wiki.png]]
5074 !! result
5075 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5076 !! end
5077
5078 !! test
5079 Redirect to language
5080 !! options
5081 parsoid
5082 !! input
5083 #REDIRECT [[en:File:Wiki.png]]
5084 !! result
5085 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5086 !! end
5087
5088 !! test
5089 Redirect to interwiki
5090 !! options
5091 parsoid
5092 !! input
5093 #REDIRECT [[meatball:File:Wiki.png]]
5094 !! result
5095 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5096 !! end
5097
5098 !! test
5099 Non-English #REDIRECT
5100 !! options
5101 parsoid
5102 language=is
5103 !! input
5104 #TILVÍSUN [[Main Page]]
5105 !! result
5106 <link rel="mw:PageProp/redirect" href="./Main_Page">
5107 !! end
5108
5109 ##
5110 ## XHTML tidiness
5111 ###
5112
5113 !! test
5114 <br> to <br />
5115 !! input
5116 1<br>2<br />3
5117 !! result
5118 <p>1<br />2<br />3
5119 </p>
5120 !! end
5121
5122 !! test
5123 Broken br tag sanitization
5124 !! options
5125 php
5126 !! input
5127 </br>
5128 !! result
5129 <p>&lt;/br&gt;
5130 </p>
5131 !! end
5132
5133 # TODO: Fix html2html mode (bug 51055)!
5134 !! test
5135 Parsoid: Broken br tag recognition
5136 !! options
5137 parsoid=wt2html
5138 !! input
5139 </br>
5140 !! result
5141 <p><br></p>
5142 !! end
5143
5144 !! test
5145 Incorrecly removing closing slashes from correctly formed XHTML
5146 !! input
5147 <br style="clear:both;" />
5148 !! result
5149 <p><br style="clear:both;" />
5150 </p>
5151 !! end
5152
5153 !! test
5154 Failing to transform badly formed HTML into correct XHTML
5155 !! input
5156 <br style="clear: left;">
5157 <br style="clear: right;">
5158 <br style="clear: both;">
5159 !! result
5160 <p><br style="clear: left;" />
5161 <br style="clear: right;" />
5162 <br style="clear: both;" />
5163 </p>
5164 !!end
5165
5166 !! test
5167 Handling html with a div self-closing tag
5168 !! input
5169 <div title />
5170 <div title/>
5171 <div title/ >
5172 <div title=bar />
5173 <div title=bar/>
5174 <div title=bar/ >
5175 !! result
5176 <p>&lt;div title /&gt;
5177 &lt;div title/&gt;
5178 </p>
5179 <div>
5180 <p>&lt;div title=bar /&gt;
5181 &lt;div title=bar/&gt;
5182 </p>
5183 <div title="bar/"></div>
5184 </div>
5185
5186 !! end
5187
5188 !! test
5189 Handling html with a br self-closing tag
5190 !! input
5191 <br title />
5192 <br title/>
5193 <br title/ >
5194 <br title=bar />
5195 <br title=bar/>
5196 <br title=bar/ >
5197 !! result
5198 <p><br title="title" />
5199 <br title="title" />
5200 <br />
5201 <br title="bar" />
5202 <br title="bar" />
5203 <br title="bar/" />
5204 </p>
5205 !! end
5206
5207 !! test
5208 Horizontal ruler (should it add that extra space?)
5209 !! input
5210 <hr>
5211 <hr >
5212 foo <hr
5213 > bar
5214 !! result
5215 <hr />
5216 <hr />
5217 foo <hr /> bar
5218
5219 !! end
5220
5221 !! test
5222 Horizontal ruler -- 4+ dashes render hr
5223 !! input
5224 ----
5225 !! result
5226 <hr />
5227
5228 !! end
5229
5230 !! test
5231 Horizontal ruler -- eats additional dashes on the same line
5232 !! input
5233 ---------
5234 !! result
5235 <hr />
5236
5237 !! end
5238
5239 !! test
5240 Horizontal ruler -- does not collapse dashes on consecutive lines
5241 !! input
5242 ----
5243 ----
5244 !! result
5245 <hr />
5246 <hr />
5247
5248 !! end
5249
5250 !! test
5251 Horizontal ruler -- <4 dashes render as plain text
5252 !! input
5253 ---
5254 !! result
5255 <p>---
5256 </p>
5257 !! end
5258
5259 !! test
5260 Horizontal ruler -- Supports content following dashes on same line
5261 !! input
5262 ---- Foo
5263 !! result
5264 <hr /> Foo
5265
5266 !! end
5267
5268 ###
5269 ### Block-level elements
5270 ###
5271 !! test
5272 Common list
5273 !! input
5274 *Common list
5275 * item 2
5276 *item 3
5277 !! result
5278 <ul><li>Common list
5279 </li><li> item 2
5280 </li><li>item 3
5281 </li></ul>
5282
5283 !! end
5284
5285 !! test
5286 Numbered list
5287 !! input
5288 #Numbered list
5289 #item 2
5290 # item 3
5291 !! result
5292 <ol><li>Numbered list
5293 </li><li>item 2
5294 </li><li> item 3
5295 </li></ol>
5296
5297 !! end
5298
5299 !! test
5300 Mixed list
5301 !! input
5302 *Mixed list
5303 *# with numbers
5304 ** and bullets
5305 *# and numbers
5306 *bullets again
5307 **bullet level 2
5308 ***bullet level 3
5309 ***#Number on level 4
5310 **bullet level 2
5311 **#Number on level 3
5312 **#Number on level 3
5313 *#number level 2
5314 *Level 1
5315 *** Level 3
5316 #** Level 3, but ordered
5317 !! result
5318 <ul><li>Mixed list
5319 <ol><li> with numbers
5320 </li></ol>
5321 <ul><li> and bullets
5322 </li></ul>
5323 <ol><li> and numbers
5324 </li></ol>
5325 </li><li>bullets again
5326 <ul><li>bullet level 2
5327 <ul><li>bullet level 3
5328 <ol><li>Number on level 4
5329 </li></ol>
5330 </li></ul>
5331 </li><li>bullet level 2
5332 <ol><li>Number on level 3
5333 </li><li>Number on level 3
5334 </li></ol>
5335 </li></ul>
5336 <ol><li>number level 2
5337 </li></ol>
5338 </li><li>Level 1
5339 <ul><li><ul><li> Level 3
5340 </li></ul>
5341 </li></ul>
5342 </li></ul>
5343 <ol><li><ul><li><ul><li> Level 3, but ordered
5344 </li></ul>
5345 </li></ul>
5346 </li></ol>
5347
5348 !! end
5349
5350 !! test
5351 Nested lists 1
5352 !! input
5353 *foo
5354 **bar
5355 !! result
5356 <ul><li>foo
5357 <ul><li>bar
5358 </li></ul>
5359 </li></ul>
5360
5361 !! end
5362
5363 !! test
5364 Nested lists 2
5365 !! input
5366 **foo
5367 *bar
5368 !! result
5369 <ul><li><ul><li>foo
5370 </li></ul>
5371 </li><li>bar
5372 </li></ul>
5373
5374 !! end
5375
5376 !! test
5377 Nested lists 3 (first element empty)
5378 !! input
5379 *
5380 **bar
5381 !! result
5382 <ul><li>
5383 <ul><li>bar
5384 </li></ul>
5385 </li></ul>
5386
5387 !! end
5388
5389 !! test
5390 Nested lists 4 (first element empty)
5391 !! input
5392 **
5393 *bar
5394 !! result
5395 <ul><li><ul><li>
5396 </li></ul>
5397 </li><li>bar
5398 </li></ul>
5399
5400 !! end
5401
5402 !! test
5403 Nested lists 5 (both elements empty)
5404 !! input
5405 **
5406 *
5407 !! result
5408 <ul><li><ul><li>
5409 </li></ul>
5410 </li><li>
5411 </li></ul>
5412
5413 !! end
5414
5415 !! test
5416 Nested lists 6 (both elements empty)
5417 !! input
5418 *
5419 **
5420 !! result
5421 <ul><li>
5422 <ul><li>
5423 </li></ul>
5424 </li></ul>
5425
5426 !! end
5427
5428 !! test
5429 Nested lists 7 (skip initial nesting levels)
5430 !! input
5431 *** foo
5432 !! result
5433 <ul><li><ul><li><ul><li> foo
5434 </li></ul>
5435 </li></ul>
5436 </li></ul>
5437
5438 !! end
5439
5440 !! test
5441 Nested lists 8 (multiple nesting transitions)
5442 !! input
5443 * foo
5444 *** bar
5445 ** baz
5446 * boo
5447 !! result
5448 <ul><li> foo
5449 <ul><li><ul><li> bar
5450 </li></ul>
5451 </li><li> baz
5452 </li></ul>
5453 </li><li> boo
5454 </li></ul>
5455
5456 !! end
5457
5458 !! test
5459 1. Lists with start-of-line-transparent tokens before bullets: Comments
5460 !! input
5461 *foo
5462 *<!--cmt-->bar
5463 <!--cmt-->*baz
5464 !! result
5465 <ul><li>foo
5466 </li><li>bar
5467 </li><li>baz
5468 </li></ul>
5469
5470 !! end
5471
5472 !! test
5473 2. Lists with start-of-line-transparent tokens before bullets: Template close
5474 !! input
5475 *foo {{echo|bar
5476 }}*baz
5477 !! result
5478 <ul><li>foo bar
5479 </li><li>baz
5480 </li></ul>
5481
5482 !! end
5483
5484 !! test
5485 List items are not parsed correctly following a <pre> block (bug 785)
5486 !! input
5487 * <pre>foo</pre>
5488 * <pre>bar</pre>
5489 * zar
5490 !! result
5491 <ul><li> <pre>foo</pre>
5492 </li><li> <pre>bar</pre>
5493 </li><li> zar
5494 </li></ul>
5495
5496 !! end
5497
5498 !! test
5499 List items from template
5500 !! input
5501
5502 {{inner list}}
5503 * item 2
5504
5505 * item 0
5506 {{inner list}}
5507 * item 2
5508
5509 * item 0
5510 * notSOL{{inner list}}
5511 * item 2
5512 !! result
5513 <ul><li> item 1
5514 </li><li> item 2
5515 </li></ul>
5516 <ul><li> item 0
5517 </li><li> item 1
5518 </li><li> item 2
5519 </li></ul>
5520 <ul><li> item 0
5521 </li><li> notSOL
5522 </li><li> item 1
5523 </li><li> item 2
5524 </li></ul>
5525
5526 !! end
5527
5528 !! test
5529 List interrupted by empty line or heading
5530 !! input
5531 * foo
5532
5533 ** bar
5534 == A heading ==
5535 * Another list item
5536 !! result
5537 <ul><li> foo
5538 </li></ul>
5539 <ul><li><ul><li> bar
5540 </li></ul>
5541 </li></ul>
5542 <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>
5543 <ul><li> Another list item
5544 </li></ul>
5545
5546 !!end
5547
5548 !!test
5549 Multiple list tags generated by templates
5550 !!input
5551 {{echo|<li>}}a
5552 {{echo|<li>}}b
5553 {{echo|<li>}}c
5554 !!result
5555 <li>a
5556 <li>b
5557 <li>c</li>
5558 </li>
5559 </li>
5560
5561 !!end
5562
5563 !!test
5564 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
5565 !!input
5566 *a
5567 <!--This line will NOT split the list-->
5568 *b
5569 <!--This line will NOT split the list either-->
5570 *c
5571 <!--foo--> <!----> <!--This line NOT split the list either-->
5572 *d
5573 !!result
5574 <ul><li>a
5575 </li><li>b
5576 </li><li>c
5577 </li><li>d
5578 </li></ul>
5579
5580 !!end
5581
5582 !!test
5583 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
5584 !!input
5585 *a
5586 <!--This line will NOT split the list-->
5587 *b
5588 <!--This line will NOT split the list either-->
5589 *c
5590 <!--foo--> <!----> <!--This line NOT split the list
5591 either-->
5592 *d
5593 !!result
5594 <ul><li>a
5595 </li><li>b
5596 </li><li>c
5597 </li><li>d
5598 </li></ul>
5599
5600 !!end
5601
5602 !!test
5603 Test the li-hack
5604 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5605 !!options
5606 parsoid=wt2html,wt2wt
5607 !!input
5608 * foo
5609 * <li>li-hack
5610 * {{echo|<li>templated li-hack}}
5611 * <!--foo--> <li> unsupported li-hack with preceding comments
5612
5613 <ul>
5614 <li><li>not a li-hack
5615 </li>
5616 </ul>
5617 !!result
5618 <ul><li> foo</li>
5619 <li>li-hack</li>
5620 <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>
5621 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5622
5623 <ul>
5624 <li></li><li>not a li-hack
5625 </li>
5626 </ul>
5627 !!end
5628
5629 !! test
5630 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5631 !! options
5632 parsoid
5633 !! input
5634 # foo
5635 ## bar
5636 * foo
5637 ** bar
5638 : foo
5639 :: bar
5640 !! result
5641 <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>
5642 !! end
5643
5644 !! test
5645 Parsoid: Test of whitespace serialization with Templated bullets
5646 !! options
5647 parsoid
5648 !! input
5649 * {{bullet}}
5650 !! result
5651 <ul>
5652 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}'> Bar</li>
5653 </ul>
5654 !! end
5655
5656 # ------------------------------------------------------------------------
5657 # The next set of tests are about Parsoid's ability to handle badly nested
5658 # tags (parse, minimize scope of fixup, and roundtrip back)
5659 # ------------------------------------------------------------------------
5660
5661 !! test
5662 Unbalanced closing block tags break a list
5663 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5664 !! options
5665 parsoid
5666 !! input
5667 <div>
5668 *a</div><div>
5669 *b</div>
5670 !! result
5671 <div>
5672 <ul><li>a
5673 </li></ul></div><div>
5674 <ul><li>b
5675 </li></ul></div>
5676 !! end
5677
5678 !! test
5679 Unbalanced closing non-block tags don't break a list
5680 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5681 !! options
5682 parsoid
5683 !! input
5684 <span>
5685 *a</span><span>
5686 *b</span>
5687 !! result
5688 <p><span></span>
5689 </p>
5690 <ul><li>a<span></span>
5691 </li><li>b
5692 </li></ul>
5693 !! end
5694
5695 !! test
5696 Unclosed formatting tags that straddle lists are closed and reopened
5697 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5698 !! options
5699 parsoid
5700 !! input
5701 # <s> a
5702 # b </s>
5703 !! result
5704 <ol><li> <s> a </s>
5705 </li><li> <s> b </s>
5706 </li></ol>
5707 !! end
5708
5709 !!test
5710 List embedded in a non-block tag
5711 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5712 !! options
5713 parsoid
5714 !!input
5715 <small>
5716 * foo
5717 </small>
5718 !!result
5719 <p><small></small></p>
5720 <small>
5721 <ul>
5722 <li> foo</li>
5723 </ul>
5724 </small>
5725 <p><small></small></p>
5726 !!end
5727
5728 ###
5729 ### Magic Words
5730 ###
5731
5732 # Note that the current date is hard-coded as
5733 # 1970-01-01T00:02:03Z (a Thursday)
5734 # when running parser tests. The timezone is also fixed to GMT, so
5735 # local date will be identical to current date.
5736
5737 !! test
5738 Magic Word: {{CURRENTDAY}}
5739 !! input
5740 {{CURRENTDAY}}
5741 !! result
5742 <p>1
5743 </p>
5744 !! end
5745
5746 !! test
5747 Magic Word: {{CURRENTDAY2}}
5748 !! input
5749 {{CURRENTDAY2}}
5750 !! result
5751 <p>01
5752 </p>
5753 !! end
5754
5755 !! test
5756 Magic Word: {{CURRENTDAYNAME}}
5757 !! input
5758 {{CURRENTDAYNAME}}
5759 !! result
5760 <p>Thursday
5761 </p>
5762 !! end
5763
5764 !! test
5765 Magic Word: {{CURRENTDOW}}
5766 !! input
5767 {{CURRENTDOW}}
5768 !! result
5769 <p>4
5770 </p>
5771 !! end
5772
5773 !! test
5774 Magic Word: {{CURRENTMONTH}}
5775 !! input
5776 {{CURRENTMONTH}}
5777 !! result
5778 <p>01
5779 </p>
5780 !! end
5781
5782 !! test
5783 Magic Word: {{CURRENTMONTH1}}
5784 !! input
5785 {{CURRENTMONTH1}}
5786 !! result
5787 <p>1
5788 </p>
5789 !! end
5790
5791 !! test
5792 Magic Word: {{CURRENTMONTHABBREV}}
5793 !! input
5794 {{CURRENTMONTHABBREV}}
5795 !! result
5796 <p>Jan
5797 </p>
5798 !! end
5799
5800 !! test
5801 Magic Word: {{CURRENTMONTHNAME}}
5802 !! input
5803 {{CURRENTMONTHNAME}}
5804 !! result
5805 <p>January
5806 </p>
5807 !! end
5808
5809 !! test
5810 Magic Word: {{CURRENTMONTHNAMEGEN}}
5811 !! input
5812 {{CURRENTMONTHNAMEGEN}}
5813 !! result
5814 <p>January
5815 </p>
5816 !! end
5817
5818 !! test
5819 Magic Word: {{CURRENTTIME}}
5820 !! input
5821 {{CURRENTTIME}}
5822 !! result
5823 <p>00:02
5824 </p>
5825 !! end
5826
5827 !! test
5828 Magic Word: {{CURRENTHOUR}}
5829 !! input
5830 {{CURRENTHOUR}}
5831 !! result
5832 <p>00
5833 </p>
5834 !! end
5835
5836 !! test
5837 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5838 !! input
5839 {{CURRENTWEEK}}
5840 !! result
5841 <p>1
5842 </p>
5843 !! end
5844
5845 !! test
5846 Magic Word: {{CURRENTYEAR}}
5847 !! input
5848 {{CURRENTYEAR}}
5849 !! result
5850 <p>1970
5851 </p>
5852 !! end
5853
5854 !! test
5855 Magic Word: {{CURRENTTIMESTAMP}}
5856 !! input
5857 {{CURRENTTIMESTAMP}}
5858 !! result
5859 <p>19700101000203
5860 </p>
5861 !! end
5862
5863 !! test
5864 Magic Words LOCAL (UTC)
5865 !! input
5866 * {{LOCALMONTH}}
5867 * {{LOCALMONTH1}}
5868 * {{LOCALMONTHNAME}}
5869 * {{LOCALMONTHNAMEGEN}}
5870 * {{LOCALMONTHABBREV}}
5871 * {{LOCALDAY}}
5872 * {{LOCALDAY2}}
5873 * {{LOCALDAYNAME}}
5874 * {{LOCALYEAR}}
5875 * {{LOCALTIME}}
5876 * {{LOCALHOUR}}
5877 * {{LOCALWEEK}}
5878 * {{LOCALDOW}}
5879 * {{LOCALTIMESTAMP}}
5880 !! result
5881 <ul><li> 01
5882 </li><li> 1
5883 </li><li> January
5884 </li><li> January
5885 </li><li> Jan
5886 </li><li> 1
5887 </li><li> 01
5888 </li><li> Thursday
5889 </li><li> 1970
5890 </li><li> 00:02
5891 </li><li> 00
5892 </li><li> 1
5893 </li><li> 4
5894 </li><li> 19700101000203
5895 </li></ul>
5896
5897 !! end
5898
5899 !! test
5900 Magic Word: {{FULLPAGENAME}}
5901 !! options
5902 title=[[User:Ævar Arnfjörð Bjarmason]]
5903 !! input
5904 {{FULLPAGENAME}}
5905 !! result
5906 <p>User:Ævar Arnfjörð Bjarmason
5907 </p>
5908 !! end
5909
5910 !! test
5911 Magic Word: {{FULLPAGENAMEE}}
5912 !! options
5913 title=[[User:Ævar Arnfjörð Bjarmason]]
5914 !! input
5915 {{FULLPAGENAMEE}}
5916 !! result
5917 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5918 </p>
5919 !! end
5920
5921 !! test
5922 Magic Word: {{TALKSPACE}}
5923 !! options
5924 title=[[User:Ævar Arnfjörð Bjarmason]]
5925 !! input
5926 {{TALKSPACE}}
5927 !! result
5928 <p>User talk
5929 </p>
5930 !! end
5931
5932 !! test
5933 Magic Word: {{TALKSPACE}}, same namespace
5934 !! options
5935 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5936 !! input
5937 {{TALKSPACE}}
5938 !! result
5939 <p>User talk
5940 </p>
5941 !! end
5942
5943 !! test
5944 Magic Word: {{TALKSPACE}}, main namespace
5945 !! options
5946 title=[[Parser Test]]
5947 !! input
5948 {{TALKSPACE}}
5949 !! result
5950 <p>Talk
5951 </p>
5952 !! end
5953
5954 !! test
5955 Magic Word: {{TALKSPACEE}}
5956 !! options
5957 title=[[User:Ævar Arnfjörð Bjarmason]]
5958 !! input
5959 {{TALKSPACEE}}
5960 !! result
5961 <p>User_talk
5962 </p>
5963 !! end
5964
5965 !! test
5966 Magic Word: {{SUBJECTSPACE}}
5967 !! options
5968 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5969 !! input
5970 {{SUBJECTSPACE}}
5971 !! result
5972 <p>User
5973 </p>
5974 !! end
5975
5976 !! test
5977 Magic Word: {{SUBJECTSPACE}}, same namespace
5978 !! options
5979 title=[[User:Ævar Arnfjörð Bjarmason]]
5980 !! input
5981 {{SUBJECTSPACE}}
5982 !! result
5983 <p>User
5984 </p>
5985 !! end
5986
5987 !! test
5988 Magic Word: {{SUBJECTSPACE}}, main namespace
5989 !! options
5990 title=[[Parser Test]]
5991 !! input
5992 {{SUBJECTSPACE}}
5993 !! result
5994
5995 !! end
5996
5997 !! test
5998 Magic Word: {{SUBJECTSPACEE}}
5999 !! options
6000 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6001 !! input
6002 {{SUBJECTSPACEE}}
6003 !! result
6004 <p>User
6005 </p>
6006 !! end
6007
6008 !! test
6009 Magic Word: {{NAMESPACE}}
6010 !! options
6011 title=[[User:Ævar Arnfjörð Bjarmason]]
6012 !! input
6013 {{NAMESPACE}}
6014 !! result
6015 <p>User
6016 </p>
6017 !! end
6018
6019 !! test
6020 Magic Word: {{NAMESPACEE}}
6021 !! options
6022 title=[[User:Ævar Arnfjörð Bjarmason]]
6023 !! input
6024 {{NAMESPACEE}}
6025 !! result
6026 <p>User
6027 </p>
6028 !! end
6029
6030 !! test
6031 Magic Word: {{NAMESPACENUMBER}}
6032 !! options
6033 title=[[User:Ævar Arnfjörð Bjarmason]]
6034 !! input
6035 {{NAMESPACENUMBER}}
6036 !! result
6037 <p>2
6038 </p>
6039 !! end
6040
6041 !! test
6042 Magic Word: {{SUBPAGENAME}}
6043 !! options
6044 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6045 !! input
6046 {{SUBPAGENAME}}
6047 !! result
6048 <p>sub ö
6049 </p>
6050 !! end
6051
6052 !! test
6053 Magic Word: {{SUBPAGENAMEE}}
6054 !! options
6055 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6056 !! input
6057 {{SUBPAGENAMEE}}
6058 !! result
6059 <p>sub_%C3%B6
6060 </p>
6061 !! end
6062
6063 !! test
6064 Magic Word: {{ROOTPAGENAME}}
6065 !! options
6066 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6067 !! input
6068 {{ROOTPAGENAME}}
6069 !! result
6070 <p>Ævar Arnfjörð Bjarmason
6071 </p>
6072 !! end
6073
6074 !! test
6075 Magic Word: {{ROOTPAGENAMEE}}
6076 !! options
6077 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6078 !! input
6079 {{ROOTPAGENAMEE}}
6080 !! result
6081 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6082 </p>
6083 !! end
6084
6085 !! test
6086 Magic Word: {{BASEPAGENAME}}
6087 !! options
6088 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6089 !! input
6090 {{BASEPAGENAME}}
6091 !! result
6092 <p>Ævar Arnfjörð Bjarmason
6093 </p>
6094 !! end
6095
6096 !! test
6097 Magic Word: {{BASEPAGENAMEE}}
6098 !! options
6099 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6100 !! input
6101 {{BASEPAGENAMEE}}
6102 !! result
6103 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6104 </p>
6105 !! end
6106
6107 !! test
6108 Magic Word: {{TALKPAGENAME}}
6109 !! options
6110 title=[[User:Ævar Arnfjörð Bjarmason]]
6111 !! input
6112 {{TALKPAGENAME}}
6113 !! result
6114 <p>User talk:Ævar Arnfjörð Bjarmason
6115 </p>
6116 !! end
6117
6118 !! test
6119 Magic Word: {{TALKPAGENAMEE}}
6120 !! options
6121 title=[[User:Ævar Arnfjörð Bjarmason]]
6122 !! input
6123 {{TALKPAGENAMEE}}
6124 !! result
6125 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6126 </p>
6127 !! end
6128
6129 !! test
6130 Magic Word: {{SUBJECTPAGENAME}}
6131 !! options
6132 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6133 !! input
6134 {{SUBJECTPAGENAME}}
6135 !! result
6136 <p>User:Ævar Arnfjörð Bjarmason
6137 </p>
6138 !! end
6139
6140 !! test
6141 Magic Word: {{SUBJECTPAGENAMEE}}
6142 !! options
6143 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6144 !! input
6145 {{SUBJECTPAGENAMEE}}
6146 !! result
6147 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6148 </p>
6149 !! end
6150
6151 !! test
6152 Magic Word: {{NUMBEROFFILES}}
6153 !! input
6154 {{NUMBEROFFILES}}
6155 !! result
6156 <p>4
6157 </p>
6158 !! end
6159
6160 !! test
6161 Magic Word: {{PAGENAME}}
6162 !! options
6163 title=[[User:Ævar Arnfjörð Bjarmason]]
6164 !! input
6165 {{PAGENAME}}
6166 !! result
6167 <p>Ævar Arnfjörð Bjarmason
6168 </p>
6169 !! end
6170
6171 !! test
6172 Magic Word: {{PAGENAME}} with metacharacters
6173 !! options
6174 title=[['foo & bar = baz']]
6175 !! input
6176 ''{{PAGENAME}}''
6177 !! result
6178 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
6179 </p>
6180 !! end
6181
6182 !! test
6183 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
6184 !! options
6185 title=[[*RFC 1234 http://example.com/]]
6186 !! input
6187 {{PAGENAME}}
6188 !! result
6189 <p>&#42;RFC&#32;1234 http&#58;//example.com/
6190 </p>
6191 !! end
6192
6193 !! test
6194 Magic Word: {{PAGENAMEE}}
6195 !! options
6196 title=[[User:Ævar Arnfjörð Bjarmason]]
6197 !! input
6198 {{PAGENAMEE}}
6199 !! result
6200 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6201 </p>
6202 !! end
6203
6204 !! test
6205 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
6206 !! options
6207 title=[[*RFC 1234 http://example.com/]]
6208 !! input
6209 {{PAGENAMEE}}
6210 !! result
6211 <p>&#42;RFC_1234_http&#58;//example.com/
6212 </p>
6213 !! end
6214
6215 !! test
6216 Magic Word: {{REVISIONID}}
6217 !! input
6218 {{REVISIONID}}
6219 !! result
6220 <p>1337
6221 </p>
6222 !! end
6223
6224 !! test
6225 Magic Word: {{SCRIPTPATH}}
6226 !! input
6227 {{SCRIPTPATH}}
6228 !! result
6229 <p>/
6230 </p>
6231 !! end
6232
6233 !! test
6234 Magic Word: {{STYLEPATH}}
6235 !! input
6236 {{STYLEPATH}}
6237 !! result
6238 <p>/skins
6239 </p>
6240 !! end
6241
6242 !! test
6243 Magic Word: {{SERVER}}
6244 !! input
6245 {{SERVER}}
6246 !! result
6247 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6248 </p>
6249 !! end
6250
6251 !! test
6252 Magic Word: {{SERVERNAME}}
6253 !! input
6254 {{SERVERNAME}}
6255 !! result
6256 <p>example.org
6257 </p>
6258 !! end
6259
6260 !! test
6261 Magic Word: {{SITENAME}}
6262 !! input
6263 {{SITENAME}}
6264 !! result
6265 <p>MediaWiki
6266 </p>
6267 !! end
6268
6269 !! test
6270 Case-sensitive magic words, when cased differently, should just be template transclusions
6271 !! input
6272 {{CurrentMonth}}
6273 {{currentday}}
6274 {{cURreNTweEK}}
6275 {{currentHour}}
6276 !! result
6277 <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>
6278 <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>
6279 <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>
6280 <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>
6281 </p>
6282 !! end
6283
6284 !! test
6285 Case-insensitive magic words should still work with weird casing.
6286 !! input
6287 {{sErVeRNaMe}}
6288 {{LCFirst:AOEU}}
6289 {{ucFIRST:aoeu}}
6290 {{SERver}}
6291 !! result
6292 <p>example.org
6293 aOEU
6294 Aoeu
6295 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6296 </p>
6297 !! end
6298
6299 !! test
6300 Namespace 1 {{ns:1}}
6301 !! input
6302 {{ns:1}}
6303 !! result
6304 <p>Talk
6305 </p>
6306 !! end
6307
6308 !! test
6309 Namespace 1 {{ns:01}}
6310 !! input
6311 {{ns:01}}
6312 !! result
6313 <p>Talk
6314 </p>
6315 !! end
6316
6317 !! test
6318 Namespace 0 {{ns:0}} (bug 4783)
6319 !! input
6320 {{ns:0}}
6321 !! result
6322
6323 !! end
6324
6325 !! test
6326 Namespace 0 {{ns:00}} (bug 4783)
6327 !! input
6328 {{ns:00}}
6329 !! result
6330
6331 !! end
6332
6333 !! test
6334 Namespace -1 {{ns:-1}}
6335 !! input
6336 {{ns:-1}}
6337 !! result
6338 <p>Special
6339 </p>
6340 !! end
6341
6342 !! test
6343 Namespace User {{ns:User}}
6344 !! input
6345 {{ns:User}}
6346 !! result
6347 <p>User
6348 </p>
6349 !! end
6350
6351 !! test
6352 Namespace User talk {{ns:User_talk}}
6353 !! input
6354 {{ns:User_talk}}
6355 !! result
6356 <p>User talk
6357 </p>
6358 !! end
6359
6360 !! test
6361 Namespace User talk {{ns:uSeR tAlK}}
6362 !! input
6363 {{ns:uSeR tAlK}}
6364 !! result
6365 <p>User talk
6366 </p>
6367 !! end
6368
6369 !! test
6370 Namespace File {{ns:File}}
6371 !! input
6372 {{ns:File}}
6373 !! result
6374 <p>File
6375 </p>
6376 !! end
6377
6378 !! test
6379 Namespace File {{ns:Image}}
6380 !! input
6381 {{ns:Image}}
6382 !! result
6383 <p>File
6384 </p>
6385 !! end
6386
6387 !! test
6388 Namespace (lang=de) Benutzer {{ns:User}}
6389 !! options
6390 language=de
6391 !! input
6392 {{ns:User}}
6393 !! result
6394 <p>Benutzer
6395 </p>
6396 !! end
6397
6398 !! test
6399 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
6400 !! options
6401 language=de
6402 !! input
6403 {{ns:3}}
6404 !! result
6405 <p>Benutzer Diskussion
6406 </p>
6407 !! end
6408
6409
6410 !! test
6411 Urlencode
6412 !! input
6413 {{urlencode:hi world?!}}
6414 {{urlencode:hi world?!|WIKI}}
6415 {{urlencode:hi world?!|PATH}}
6416 {{urlencode:hi world?!|QUERY}}
6417 !! result
6418 <p>hi+world%3F%21
6419 hi_world%3F!
6420 hi%20world%3F%21
6421 hi+world%3F%21
6422 </p>
6423 !! end
6424
6425 ###
6426 ### Magic links
6427 ###
6428 !! test
6429 Magic links: internal link to RFC (bug 479)
6430 !! input
6431 [[RFC 123]]
6432 !! result
6433 <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>
6434 </p>
6435 !! end
6436
6437 !! test
6438 Magic links: RFC (bug 479)
6439 !! input
6440 RFC 822
6441 !! result
6442 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
6443 </p>
6444 !! end
6445
6446 !! test
6447 Magic links: ISBN (bug 1937)
6448 !! input
6449 ISBN 0-306-40615-2
6450 !! result
6451 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
6452 </p>
6453 !! end
6454
6455 !! test
6456 Magic links: PMID incorrectly converts space to underscore
6457 !! input
6458 PMID 1234
6459 !! result
6460 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
6461 </p>
6462 !! end
6463
6464 ###
6465 ### Templates
6466 ####
6467
6468 !! test
6469 Nonexistent template
6470 !! input
6471 {{thistemplatedoesnotexist}}
6472 !! result
6473 <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>
6474 </p>
6475 !! end
6476
6477 !! test
6478 Template with invalid target containing tags
6479 !! input
6480 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6481 !! result
6482 <p>{{a<b>b</b>|foo|a=b|a = b}}
6483 </p>
6484 !! end
6485
6486 !! test
6487 Template with invalid target containing unclosed tag
6488 !! input
6489 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6490 !! result
6491 <p>{{a<b>|foo|a=b|a = b}}</b>
6492 </p>
6493 !! end
6494
6495 !! article
6496 Template:test
6497 !! text
6498 This is a test template
6499 !! endarticle
6500
6501 !! test
6502 Simple template
6503 !! input
6504 {{test}}
6505 !! result
6506 <p>This is a test template
6507 </p>
6508 !! end
6509
6510 !! test
6511 Template with explicit namespace
6512 !! input
6513 {{Template:test}}
6514 !! result
6515 <p>This is a test template
6516 </p>
6517 !! end
6518
6519
6520 !! article
6521 Template:paramtest
6522 !! text
6523 This is a test template with parameter {{{param}}}
6524 !! endarticle
6525
6526 !! test
6527 Template parameter
6528 !! input
6529 {{paramtest|param=foo}}
6530 !! result
6531 <p>This is a test template with parameter foo
6532 </p>
6533 !! end
6534
6535 !! article
6536 Template:paramtestnum
6537 !! text
6538 [[{{{1}}}|{{{2}}}]]
6539 !! endarticle
6540
6541 !! test
6542 Template unnamed parameter
6543 !! input
6544 {{paramtestnum|Main Page|the main page}}
6545 !! result
6546 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
6547 </p>
6548 !! end
6549
6550 !! article
6551 Template:templatesimple
6552 !! text
6553 (test)
6554 !! endarticle
6555
6556 !! article
6557 Template:templateredirect
6558 !! text
6559 #redirect [[Template:templatesimple]]
6560 !! endarticle
6561
6562 !! article
6563 Template:templateasargtestnum
6564 !! text
6565 {{{{{1}}}}}
6566 !! endarticle
6567
6568 !! article
6569 Template:templateasargtest
6570 !! text
6571 {{template{{{templ}}}}}
6572 !! endarticle
6573
6574 !! article
6575 Template:templateasargtest2
6576 !! text
6577 {{{{{templ}}}}}
6578 !! endarticle
6579
6580 !! test
6581 Template with template name as unnamed argument
6582 !! input
6583 {{templateasargtestnum|templatesimple}}
6584 !! result
6585 <p>(test)
6586 </p>
6587 !! end
6588
6589 !! test
6590 Template with template name as argument
6591 !! input
6592 {{templateasargtest|templ=simple}}
6593 !! result
6594 <p>(test)
6595 </p>
6596 !! end
6597
6598 !! test
6599 Template with template name as argument (2)
6600 !! input
6601 {{templateasargtest2|templ=templatesimple}}
6602 !! result
6603 <p>(test)
6604 </p>
6605 !! end
6606
6607 !! article
6608 Template:templateasargtestdefault
6609 !! text
6610 {{{{{templ|templatesimple}}}}}
6611 !! endarticle
6612
6613 !! article
6614 Template:templa
6615 !! text
6616 '''templ'''
6617 !! endarticle
6618
6619 !! test
6620 Template with default value
6621 !! input
6622 {{templateasargtestdefault}}
6623 !! result
6624 <p>(test)
6625 </p>
6626 !! end
6627
6628 !! test
6629 Template with default value (value set)
6630 !! input
6631 {{templateasargtestdefault|templ=templa}}
6632 !! result
6633 <p><b>templ</b>
6634 </p>
6635 !! end
6636
6637 !! test
6638 Template redirect
6639 !! input
6640 {{templateredirect}}
6641 !! result
6642 <p>(test)
6643 </p>
6644 !! end
6645
6646 !! test
6647 Template with argument in separate line
6648 !! input
6649 {{ templateasargtest |
6650 templ = simple }}
6651 !! result
6652 <p>(test)
6653 </p>
6654 !! end
6655
6656 !! test
6657 Template with complex template as argument
6658 !! input
6659 {{paramtest|
6660 param ={{ templateasargtest |
6661 templ = simple }}}}
6662 !! result
6663 <p>This is a test template with parameter (test)
6664 </p>
6665 !! end
6666
6667 !! test
6668 Template with thumb image (with link in description)
6669 !! input
6670 {{paramtest|
6671 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6672 !! result
6673 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>
6674
6675 !! end
6676
6677 !! article
6678 Template:complextemplate
6679 !! text
6680 {{{1}}} {{paramtest|
6681 param ={{{param}}}}}
6682 !! endarticle
6683
6684 !! test
6685 Template with complex arguments
6686 !! input
6687 {{complextemplate|
6688 param ={{ templateasargtest |
6689 templ = simple }}|[[Template:complextemplate|link]]}}
6690 !! result
6691 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6692 </p>
6693 !! end
6694
6695 !! test
6696 BUG 553: link with two variables in a piped link
6697 !! input
6698 {|
6699 |[[{{{1}}}|{{{2}}}]]
6700 |}
6701 !! result
6702 <table>
6703 <tr>
6704 <td>[[{{{1}}}|{{{2}}}]]
6705 </td></tr></table>
6706
6707 !! end
6708
6709 !! test
6710 Magic variable as template parameter
6711 !! input
6712 {{paramtest|param={{SITENAME}}}}
6713 !! result
6714 <p>This is a test template with parameter MediaWiki
6715 </p>
6716 !! end
6717
6718 !! article
6719 Template:linktest
6720 !! text
6721 [[{{{param}}}|link]]
6722 !! endarticle
6723
6724 !! test
6725 Template parameter as link source
6726 !! input
6727 {{linktest|param=Main Page}}
6728 !! result
6729 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
6730 </p>
6731 !! end
6732
6733 !!test
6734 Template-generated attribute string (k='v')
6735 !!input
6736 <span {{attr_str|id|v1}}>bar</span>
6737 !!result
6738 <p><span id="v1">bar</span>
6739 </p>
6740 !!end
6741
6742 !!article
6743 Template:paramtest2
6744 !! text
6745 including another template, {{paramtest|param={{{arg}}}}}
6746 !! endarticle
6747
6748 !! test
6749 Template passing argument to another template
6750 !! input
6751 {{paramtest2|arg='hmm'}}
6752 !! result
6753 <p>including another template, This is a test template with parameter 'hmm'
6754 </p>
6755 !! end
6756
6757 !! article
6758 Template:Linktest2
6759 !! text
6760 Main Page
6761 !! endarticle
6762
6763 !! test
6764 Template as link source
6765 !! input
6766 [[{{linktest2}}]]
6767
6768 [[{{linktest2}}|Main Page]]
6769
6770 [[{{linktest2}}]]Page
6771 !! result
6772 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6773 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6774 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
6775 </p>
6776 !! end
6777
6778
6779 !! article
6780 Template:loop1
6781 !! text
6782 {{loop2}}
6783 !! endarticle
6784
6785 !! article
6786 Template:loop2
6787 !! text
6788 {{loop1}}
6789 !! endarticle
6790
6791 !! test
6792 Template infinite loop
6793 !! input
6794 {{loop1}}
6795 !! result
6796 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
6797 </p>
6798 !! end
6799
6800 !! test
6801 Template from main namespace
6802 !! input
6803 {{:Main Page}}
6804 !! result
6805 <p>blah blah
6806 </p>
6807 !! end
6808
6809 !! article
6810 Template:table
6811 !! text
6812 {|
6813 | 1 || 2
6814 |-
6815 | 3 || 4
6816 |}
6817 !! endarticle
6818
6819 !! test
6820 BUG 529: Template with table, not included at beginning of line
6821 !! input
6822 foo {{table}}
6823 !! result
6824 <p>foo
6825 </p>
6826 <table>
6827 <tr>
6828 <td> 1 </td>
6829 <td> 2
6830 </td></tr>
6831 <tr>
6832 <td> 3 </td>
6833 <td> 4
6834 </td></tr></table>
6835
6836 !! end
6837
6838 !! test
6839 BUG 523: Template shouldn't eat newline (or add an extra one before table)
6840 !! input
6841 foo
6842 {{table}}
6843 !! result
6844 <p>foo
6845 </p>
6846 <table>
6847 <tr>
6848 <td> 1 </td>
6849 <td> 2
6850 </td></tr>
6851 <tr>
6852 <td> 3 </td>
6853 <td> 4
6854 </td></tr></table>
6855
6856 !! end
6857
6858 !! test
6859 BUG 41: Template parameters shown as broken links
6860 !! input
6861 {{{parameter}}}
6862 !! result
6863 <p>{{{parameter}}}
6864 </p>
6865 !! end
6866
6867 !! test
6868 Template with targets containing wikilinks
6869 !! input
6870 {{[[foo]]}}
6871
6872 {{[[{{echo|foo}}]]}}
6873
6874 {{{{echo|[[foo}}]]}}
6875 !! result
6876 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6877 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6878 </p><p>{{[[foo}}]]
6879 </p>
6880 !! end
6881
6882 !! article
6883 Template:MSGNW test
6884 !! text
6885 ''None'' of '''this''' should be
6886 * interpreted
6887 but rather passed unmodified
6888 {{test}}
6889 !! endarticle
6890
6891 # hmm, fix this or just deprecate msgnw and document its behavior?
6892 !! test
6893 msgnw keyword
6894 !! options
6895 disabled
6896 !! input
6897 {{msgnw:MSGNW test}}
6898 !! result
6899 <p>''None'' of '''this''' should be
6900 * interpreted
6901 but rather passed unmodified
6902 {{test}}
6903 </p>
6904 !! end
6905
6906 !! test
6907 int keyword
6908 !! input
6909 {{int:youhavenewmessages|lots of money|not!}}
6910 !! result
6911 <p>You have lots of money (not!).
6912 </p>
6913 !! end
6914
6915 !! article
6916 Template:Includes
6917 !! text
6918 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6919 !! endarticle
6920
6921 !! test
6922 <includeonly> and <noinclude> being included
6923 !! input
6924 {{Includes}}
6925 !! result
6926 <p>Foobar
6927 </p>
6928 !! end
6929
6930 !! article
6931 Template:Includes2
6932 !! text
6933 <onlyinclude>Foo</onlyinclude>bar
6934 !! endarticle
6935
6936 !! test
6937 <onlyinclude> being included
6938 !! input
6939 {{Includes2}}
6940 !! result
6941 <p>Foo
6942 </p>
6943 !! end
6944
6945
6946 !! article
6947 Template:Includes3
6948 !! text
6949 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6950 !! endarticle
6951
6952 !! test
6953 <onlyinclude> and <includeonly> being included
6954 !! input
6955 {{Includes3}}
6956 !! result
6957 <p>Foo
6958 </p>
6959 !! end
6960
6961 !! test
6962 <includeonly> and <noinclude> on a page
6963 !! input
6964 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6965 !! result
6966 <p>Foozar
6967 </p>
6968 !! end
6969
6970 !! test
6971 Un-closed <noinclude>
6972 !! input
6973 <noinclude>
6974 !! result
6975 !! end
6976
6977 !! test
6978 <onlyinclude> on a page
6979 !! input
6980 <onlyinclude>Foo</onlyinclude>bar
6981 !! result
6982 <p>Foobar
6983 </p>
6984 !! end
6985
6986 !! test
6987 Un-closed <onlyinclude>
6988 !! input
6989 <onlyinclude>
6990 !! result
6991 !! end
6992
6993 !!test
6994 Self-closed noinclude, includeonly, onlyinclude tags
6995 !!input
6996 <noinclude />
6997 <includeonly />
6998 <onlyinclude />
6999 !!result
7000 <p><br />
7001 </p>
7002 !!end
7003
7004 !!test
7005 Unbalanced includeonly and noinclude tags
7006 !!input
7007 {|
7008 |a</noinclude>
7009 |b</noinclude></noinclude>
7010 |c</noinclude></includeonly>
7011 |d</includeonly></includeonly>
7012 |}
7013 !!result
7014 <table>
7015 <tr>
7016 <td>a
7017 </td>
7018 <td>b
7019 </td>
7020 <td>c&lt;/includeonly&gt;
7021 </td>
7022 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
7023 </td></tr></table>
7024
7025 !!end
7026
7027 !! article
7028 Template:Includeonly section
7029 !! text
7030 <includeonly>
7031 ==Includeonly section==
7032 </includeonly>
7033 ==Section T-1==
7034 !!endarticle
7035
7036 !! test
7037 Bug 6563: Edit link generation for section shown by <includeonly>
7038 !! input
7039 {{includeonly section}}
7040 !! result
7041 <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>
7042 <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>
7043
7044 !! end
7045
7046 # Uses same input as the contents of [[Template:Includeonly section]]
7047 !! test
7048 Bug 6563: Section extraction for section shown by <includeonly>
7049 !! options
7050 section=T-2
7051 !! input
7052 <includeonly>
7053 ==Includeonly section==
7054 </includeonly>
7055 ==Section T-2==
7056 !! result
7057 ==Section T-2==
7058 !! end
7059
7060 !! test
7061 Bug 6563: Edit link generation for section suppressed by <includeonly>
7062 !! input
7063 <includeonly>
7064 ==Includeonly section==
7065 </includeonly>
7066 ==Section 1==
7067 !! result
7068 <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>
7069
7070 !! end
7071
7072 !! test
7073 Bug 6563: Section extraction for section suppressed by <includeonly>
7074 !! options
7075 section=1
7076 !! input
7077 <includeonly>
7078 ==Includeonly section==
7079 </includeonly>
7080 ==Section 1==
7081 !! result
7082 ==Section 1==
7083 !! end
7084
7085 !! test
7086 Un-closed <includeonly>
7087 !! input
7088 <includeonly>
7089 !! result
7090 !! end
7091
7092 # TODO: test with DOM fragment reuse!
7093 !! test
7094 Parsoid: DOM fragment reuse
7095 !! options
7096 parsoid=wt2wt,wt2html
7097 !! input
7098 a{{echo|b<table></table>c}}d
7099
7100 a{{echo|b
7101 <table></table>
7102 c}}d
7103
7104 {{echo|a
7105
7106 <table></table>
7107
7108 b}}
7109 !! result
7110 a<span typeof="mw:Transclusion">b</span>
7111 <table></table><span>c</span>d
7112 <p typeof="mw:Transclusion">ab</p>
7113 <table></table>
7114 <p>cd</p>
7115 <p typeof="mw:Transclusion">a</p>
7116 <table></table>
7117 <p>b</p>
7118 !! end
7119
7120 ###
7121 ### <includeonly> and <noinclude> in attributes
7122 ###
7123 !!test
7124 0. includeonly around the entire attribute
7125 !!input
7126 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
7127 !!result
7128 <p><span id="v2">bar</span>
7129 </p>
7130 !!end
7131
7132 !!test
7133 1. includeonly in html attr key
7134 !!input
7135 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
7136 !!result
7137 <p><span id="foo">bar</span>
7138 </p>
7139 !!end
7140
7141 !!test
7142 2. includeonly in html attr value
7143 !!input
7144 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
7145 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
7146 !!result
7147 <p><span id="v1">bar</span>
7148 <span id="v1">bar</span>
7149 </p>
7150 !!end
7151
7152 !!test
7153 3. includeonly in part of an attr value
7154 !!input
7155 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
7156 !!result
7157 <p><span style="color:red;">bar</span>
7158 </p>
7159 !!end
7160
7161 ###
7162 ### Testing parsing of templates where a template arg
7163 ### has the same name as the template itself.
7164 ###
7165
7166 !! article
7167 Template:quote
7168 !! text
7169 {{{quote|{{{1}}}}}}
7170 !! endarticle
7171
7172 !!test
7173 Templates: Template Name/Arg clash: 1. Use of positional param
7174 !!input
7175 {{quote|foo}}
7176 !!result
7177 <p>foo
7178 </p>
7179 !!end
7180
7181 !!test
7182 Templates: Template Name/Arg clash: 2. Use of named param
7183 !!input
7184 {{quote|quote=foo}}
7185 !!result
7186 <p>foo
7187 </p>
7188 !!end
7189
7190 !!test
7191 Templates: Template Name/Arg clash: 3. Use of named param with empty input
7192 !!input
7193 {{quote|quote}}
7194 !!result
7195 <p>quote
7196 </p>
7197 !!end
7198
7199 ###
7200 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
7201 ###
7202
7203 !!test
7204 Templates: 1. Simple use
7205 !!input
7206 {{echo|Foo}}
7207 !!result
7208 <p>Foo
7209 </p>
7210 !!end
7211
7212 !!test
7213 Templates: 2. Inside a block tag
7214 !!input
7215 <div>{{echo|Foo}}</div>
7216 !!result
7217 <div>Foo</div>
7218
7219 !!end
7220
7221 !!test
7222 Templates: P-wrapping: 1a. Templates on consecutive lines
7223 !!input
7224 {{echo|Foo}}
7225 {{echo|bar}}
7226 !!result
7227 <p>Foo
7228 bar
7229 </p>
7230 !!end
7231
7232 !!test
7233 Templates: P-wrapping: 1b. Templates on consecutive lines
7234 !!input
7235 Foo
7236
7237 {{echo|bar}}
7238 {{echo|baz}}
7239 !!result
7240 <p>Foo
7241 </p><p>bar
7242 baz
7243 </p>
7244 !!end
7245
7246 !!test
7247 Templates: P-wrapping: 1c. Templates on consecutive lines
7248 !!input
7249 {{echo|Foo}}
7250 {{echo|bar}} <div>baz</div>
7251 !!result
7252 <p>Foo
7253 </p>
7254 bar <div>baz</div>
7255
7256 !!end
7257
7258 !!test
7259 Templates: P-wrapping: 1d. Template preceded by comment-only line
7260 !!options
7261 parsoid=wt2html,wt2wt
7262 !!input
7263 <!-- foo -->
7264 {{echo|Bar}}
7265 !!result
7266 <!-- foo -->
7267 <p typeof="mw:Transclusion">Bar
7268 </p>
7269 !!end
7270
7271 !!test
7272 Templates: Inline Text: 1. Multiple tmeplate uses
7273 !!input
7274 {{echo|Foo}}bar{{echo|baz}}
7275 !!result
7276 <p>Foobarbaz
7277 </p>
7278 !!end
7279
7280 !!test
7281 Templates: Inline Text: 2. Back-to-back template uses
7282 !!input
7283 {{echo|Foo}}{{echo|bar}}
7284 !!result
7285 <p>Foobar
7286 </p>
7287 !!end
7288
7289 !!test
7290 Templates: Block Tags: 1. Multiple template uses
7291 !!input
7292 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
7293 !!result
7294 <div>Foo</div><div>bar</div><div>baz</div>
7295
7296 !!end
7297
7298 !!test
7299 Templates: Block Tags: 2. Back-to-back template uses
7300 !!input
7301 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
7302 !!result
7303 <div>Foo</div><div>bar</div>
7304
7305 !!end
7306
7307 !!test
7308 Templates: Links: 1. Simple example
7309 !!input
7310 {{echo|[[Foo|bar]]}}
7311 !!result
7312 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7313 </p>
7314 !!end
7315
7316 !!test
7317 Templates: Links: 2. Generation of link href
7318 !!input
7319 [[{{echo|Foo}}|bar]]
7320 !!result
7321 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7322 </p>
7323 !!end
7324
7325 !!test
7326 Templates: Links: 3. Generation of part of a link href
7327 !!input
7328 [[Fo{{echo|o}}|bar]]
7329
7330 [[Foo{{echo|bar}}]]
7331
7332 [[Foo{{echo|bar}}baz]]
7333
7334 [[Foo{{echo|bar}}|bar]]
7335
7336 [[:Foo{{echo|bar}}]]
7337
7338 [[:Foo{{echo|bar}}|bar]]
7339 !!result
7340 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7341 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7342 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
7343 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7344 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7345 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7346 </p>
7347 !!end
7348
7349 !!test
7350 Templates: Links: 4. Multiple templates generating link href
7351 !!input
7352 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
7353 !!result
7354 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7355 </p>
7356 !!end
7357
7358 !!test
7359 Templates: Links: 5. Generation of link text
7360 !!input
7361 [[Foo|{{echo|bar}}]]
7362 !!result
7363 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7364 </p>
7365 !!end
7366
7367 !!test
7368 Templates: Links: 5. Nested templates (only outermost template should be marked)
7369 !!input
7370 {{echo|[[{{echo|Foo}}|bar]]}}
7371 !!result
7372 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7373 </p>
7374 !!end
7375
7376 !!test
7377 Templates: HTML Tag: 1. Generation of HTML attr. key
7378 !!input
7379 <div {{echo|style}}="color:red;">foo</div>
7380 !!result
7381 <div style="color:red;">foo</div>
7382
7383 !!end
7384
7385 !!test
7386 Templates: HTML Tag: 2. Generation of HTML attr. value
7387 !!input
7388 <div style={{echo|'color:red;'}}>foo</div>
7389 !!result
7390 <div style="color:red;">foo</div>
7391
7392 !!end
7393
7394 !!test
7395 Templates: HTML Tag: 3. Generation of HTML attr key and value
7396 !!input
7397 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
7398 !!result
7399 <div style="color:red;">foo</div>
7400
7401 !!end
7402
7403 !!test
7404 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
7405 !!input
7406 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
7407 !!result
7408 <div title="This is a long title with just one piece templated">foo</div>
7409
7410 !!end
7411
7412 !!test
7413 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
7414 !!input
7415 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
7416 !!result
7417 <div title="This is a long title with just one piece templated">foo</div>
7418
7419 !!end
7420
7421 !!test
7422 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
7423 !!input
7424 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
7425 !!result
7426 <div title="This is a long title with just one piece templated">foo</div>
7427
7428 !!end
7429
7430 !!test
7431 Templates: HTML Tag: 7. Generation of partial attribute key string
7432 !!input
7433 <div st{{echo|yle}}="color:red;">foo</div>
7434 !!result
7435 <div style="color:red;">foo</div>
7436
7437 !!end
7438
7439 !!test
7440 Templates: HTML Tables: 1. Generating start of a HTML table
7441 !!input
7442 {{echo|<table><tr><td>foo</td>}}</tr></table>
7443 !!result
7444 <table><tr><td>foo</td></tr></table>
7445
7446 !!end
7447
7448 !!test
7449 Templates: HTML Tables: 2a. Generating middle of a HTML table
7450 !!input
7451 <table><tr>{{echo|<td>foo</td>}}</tr></table>
7452 !!result
7453 <table><tr><td>foo</td></tr></table>
7454
7455 !!end
7456
7457 !!test
7458 Templates: HTML Tables: 2b. Generating middle of a HTML table
7459 !!input
7460 <table>{{echo|<tr><td>foo</td></tr>}}</table>
7461 !!result
7462 <table><tr><td>foo</td></tr></table>
7463
7464 !!end
7465
7466 !!test
7467 Templates: HTML Tables: 3. Generating end of a HTML table
7468 !!input
7469 <table><tr>{{echo|<td>foo</td></tr></table>}}
7470 !!result
7471 <table><tr><td>foo</td></tr></table>
7472
7473 !!end
7474
7475 !!test
7476 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
7477 !!input
7478 {{echo|<table>}}<tr><td>foo</td></tr></table>
7479 !!result
7480 <table><tr><td>foo</td></tr></table>
7481
7482 !!end
7483
7484 !!test
7485 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
7486 !!input
7487 <table>{{echo|<tr>}}<td>foo</td></tr></table>
7488 !!result
7489 <table><tr><td>foo</td></tr></table>
7490
7491 !!end
7492
7493 !!test
7494 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
7495 !!input
7496 <table><tr>{{echo|<td>}}foo</td></tr></table>
7497 !!result
7498 <table><tr><td>foo</td></tr></table>
7499
7500 !!end
7501
7502 !!test
7503 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
7504 !!input
7505 <table><tr><td>foo{{echo|</td>}}</tr></table>
7506 !!result
7507 <table><tr><td>foo</td></tr></table>
7508
7509 !!end
7510
7511 !!test
7512 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
7513 !!input
7514 <table><tr><td>foo</td>{{echo|</tr>}}</table>
7515 !!result
7516 <table><tr><td>foo</td></tr></table>
7517
7518 !!end
7519
7520 !!test
7521 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
7522 !!input
7523 <table><tr><td>foo</td></tr>{{echo|</table>}}
7524 !!result
7525 <table><tr><td>foo</td></tr></table>
7526
7527 !!end
7528
7529 !!test
7530 Templates: HTML Tables: 5. Proper fostering of categories from inside
7531 !!options
7532 parsoid=wt2html,wt2wt
7533 !!input
7534 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
7535 <!--Two categories (Bug 50330)-->
7536 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
7537 !!result
7538 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
7539 <!--Two categories (Bug 50330)-->
7540 <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>
7541 !!end
7542
7543 !!test
7544 Templates: Wiki Tables: 1a. Fostering of entire template content
7545 !!input
7546 {|
7547 {{echo|a}}
7548 |}
7549 !!result
7550 <table>
7551 a
7552 <tr><td></td></tr></table>
7553
7554 !!end
7555
7556 !!test
7557 Templates: Wiki Tables: 1b. Fostering of entire template content
7558 !!input
7559 {|
7560 {{echo|<div>}}
7561 foo
7562 {{echo|</div>}}
7563 |}
7564 !!result
7565 <table>
7566 <div>
7567 <p>foo
7568 </p>
7569 </div>
7570 <tr><td></td></tr></table>
7571
7572 !!end
7573
7574 !!test
7575 Templates: Wiki Tables: 2. Fostering of partial template content
7576 !!input
7577 {|
7578 {{echo|a
7579 <div>b</div>}}
7580 |}
7581 !!result
7582 <table>
7583 a
7584 <div>b</div>
7585 <tr><td></td></tr></table>
7586
7587 !!end
7588
7589 !!test
7590 Templates: Wiki Tables: 3. td-content via multiple templates
7591 !!input
7592 {|
7593 {{echo|{{pipe}}a}}{{echo|b}}
7594 |}
7595 !!result
7596 <table>
7597 <tr>
7598 <td>ab
7599 </td></tr></table>
7600
7601 !!end
7602
7603 !!test
7604 Templates: Wiki Tables: 4. Templated tags, no content
7605 !!input
7606 {{tbl-start}}
7607 {{tbl-end}}
7608 !!result
7609 <table>
7610 <tr><td></td></tr></table>
7611
7612 !!end
7613
7614 !!test
7615 Templates: Wiki Tables: 5. Templated tags, regular td-tags
7616 !!input
7617 {{tbl-start}}
7618 |foo
7619 {{tbl-end}}
7620 !!result
7621 <table>
7622 <tr>
7623 <td>foo
7624 </td></tr></table>
7625
7626 !!end
7627
7628 !!test
7629 Templates: Wiki Tables: 6. Templated tags, templated td-tags
7630 !!input
7631 {{tbl-start}}
7632 {{!}}foo
7633 {{tbl-end}}
7634 !!result
7635 <table>
7636 <tr>
7637 <td>foo
7638 </td></tr></table>
7639
7640 !!end
7641
7642 !!test
7643 Templates: Lists: Multi-line list-items via templates
7644 !!input
7645 *{{echo|a {{nonexistent|
7646 unused}}}}
7647 *{{echo|b {{nonexistent|
7648 unused}}}}
7649 !!result
7650 <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>
7651 </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>
7652 </li></ul>
7653
7654 !!end
7655
7656 !!test
7657 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
7658 !!input
7659 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
7660 !!result
7661 <p><i>ab</i>c<i>d</i>e
7662 </p>
7663 !!end
7664
7665 !!test
7666 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7667 (PHP parser generates misnested html)
7668 !! options
7669 parsoid=wt2html,wt2wt
7670 !!input
7671 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
7672 !!result
7673 <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>
7674 !!end
7675
7676 !!test
7677 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
7678 (PHP parser generates misnested html)
7679 !! options
7680 parsoid=wt2html,wt2wt
7681 !!input
7682 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
7683 !!result
7684 <div typeof="mw:Transclusion"><i>a</i></div>
7685 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
7686 <div typeof="mw:Transclusion">e</div>
7687 !!end
7688
7689 !!test
7690 Templates: Ugly nesting: 4. Divs opened/closed across templates
7691 !!input
7692 a<div>b{{echo|c</div>d}}e
7693 !!result
7694 a<div>bc</div>de
7695
7696 !!end
7697
7698 !!test
7699 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
7700 (Parsoid-centric)
7701 !! options
7702 parsoid
7703 !!input
7704 {|
7705 |{{echo|foo</table>}}
7706 |bar
7707 |}
7708 !!result
7709 <table typeof="mw:Transclusion">
7710 <tbody>
7711 <tr>
7712 <td>foo</td></tr></tbody></table><span>bar</span>
7713 !!end
7714
7715 !!test
7716 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
7717 (Parsoid-centric)
7718 !! options
7719 parsoid
7720 !!input
7721 <table>
7722 <tr>
7723 <td>
7724 <table>
7725 <tr>
7726 <td>1. {{echo|foo </table>}}</td>
7727 <td> bar </td>
7728 <td>2. {{echo|baz </table>}}</td>
7729 </tr>
7730 <tr>
7731 <td>abc</td>
7732 </tr>
7733 </table>
7734 </td>
7735 </tr>
7736 <tr>
7737 <td>xyz</td>
7738 </tr>
7739 </table>
7740 !!result
7741 <table about="#mwt1" typeof="mw:Transclusion">
7742 <tbody><tr >
7743 <td >
7744 <table >
7745 <tbody><tr >
7746 <td >1. foo </td></tr></tbody></table></td>
7747 <td > bar </td>
7748 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
7749 </span><span about="#mwt1">
7750
7751 abc</span><span about="#mwt1">
7752 </span><span about="#mwt1">
7753 </span><span about="#mwt1">
7754 </span><span about="#mwt1">
7755 </span><span about="#mwt1">
7756
7757 xyz</span><span about="#mwt1">
7758 </span><span about="#mwt1">
7759 </span>
7760 !!end
7761
7762 !! test
7763 Templates: Ugly templates: 3. newline-only template parameter
7764 !! input
7765 foo {{echo|
7766 }}
7767 !! result
7768 <p>foo
7769 </p>
7770 !! end
7771
7772 # This looks like a bug: a single newline triggers p/br for some reason.
7773 !! test
7774 Templates: Ugly templates: 4. newline-only template parameter inconsistency
7775 !! input
7776 {{echo|
7777 }}
7778 !! result
7779 <p><br />
7780 </p>
7781 !! end
7782
7783
7784 !!test
7785 Parser Functions: 1. Simple example
7786 !!input
7787 {{uc:foo}}
7788 !!result
7789 <p>FOO
7790 </p>
7791 !!end
7792
7793 !!test
7794 Parser Functions: 2. Nested use (only outermost should be marked up)
7795 !!input
7796 {{uc:{{lc:FOO}}}}
7797 !!result
7798 <p>FOO
7799 </p>
7800 !!end
7801
7802 ###
7803 ### Pre-save transform tests
7804 ###
7805 !! test
7806 pre-save transform: subst:
7807 !! options
7808 PST
7809 !! input
7810 {{subst:test}}
7811 !! result
7812 This is a test template
7813 !! end
7814
7815 !! test
7816 pre-save transform: normal template
7817 !! options
7818 PST
7819 !! input
7820 {{test}}
7821 !! result
7822 {{test}}
7823 !! end
7824
7825 !! test
7826 pre-save transform: nonexistent template
7827 !! options
7828 PST
7829 !! input
7830 {{thistemplatedoesnotexist}}
7831 !! result
7832 {{thistemplatedoesnotexist}}
7833 !! end
7834
7835
7836 !! test
7837 pre-save transform: subst magic variables
7838 !! options
7839 PST
7840 !! input
7841 {{subst:SITENAME}}
7842 !! result
7843 MediaWiki
7844 !! end
7845
7846 # This is bug 89, which I fixed. -- wtm
7847 !! test
7848 pre-save transform: subst: templates with parameters
7849 !! options
7850 pst
7851 !! input
7852 {{subst:paramtest|param="something else"}}
7853 !! result
7854 This is a test template with parameter "something else"
7855 !! end
7856
7857 !! article
7858 Template:nowikitest
7859 !! text
7860 <nowiki>'''not wiki'''</nowiki>
7861 !! endarticle
7862
7863 !! test
7864 pre-save transform: nowiki in subst (bug 1188)
7865 !! options
7866 pst
7867 !! input
7868 {{subst:nowikitest}}
7869 !! result
7870 <nowiki>'''not wiki'''</nowiki>
7871 !! end
7872
7873
7874 !! article
7875 Template:commenttest
7876 !! text
7877 This template has <!-- a comment --> in it.
7878 !! endarticle
7879
7880 !! test
7881 pre-save transform: comment in subst (bug 1936)
7882 !! options
7883 pst
7884 !! input
7885 {{subst:commenttest}}
7886 !! result
7887 This template has <!-- a comment --> in it.
7888 !! end
7889
7890 !! test
7891 pre-save transform: unclosed tag
7892 !! options
7893 pst noxml
7894 !! input
7895 <nowiki>'''not wiki'''
7896 !! result
7897 <nowiki>'''not wiki'''
7898 !! end
7899
7900 !! test
7901 pre-save transform: mixed tag case
7902 !! options
7903 pst noxml
7904 !! input
7905 <NOwiki>'''not wiki'''</noWIKI>
7906 !! result
7907 <NOwiki>'''not wiki'''</noWIKI>
7908 !! end
7909
7910 !! test
7911 pre-save transform: unclosed comment in <nowiki>
7912 !! options
7913 pst noxml
7914 !! input
7915 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7916 !! result
7917 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7918 !!end
7919
7920 # Leading @ in this template definition works around a limitation
7921 # in parsoid's parserTests which otherwise strips the <span> from the
7922 # result (confusing it for a template wrapper)
7923 !! article
7924 Template:dangerous
7925 !!text
7926 @<span onmouseover="alert('crap')">Oh no</span>
7927 !!endarticle
7928
7929 !!test
7930 (confirming safety of fix for subst bug 1936)
7931 !! input
7932 {{Template:dangerous}}
7933 !! result
7934 <p>@<span>Oh no</span>
7935 </p>
7936 !! end
7937
7938 !! test
7939 pre-save transform: comment containing gallery (bug 5024)
7940 !! options
7941 pst
7942 !! input
7943 <!-- <gallery>data</gallery> -->
7944 !!result
7945 <!-- <gallery>data</gallery> -->
7946 !!end
7947
7948 !! test
7949 pre-save transform: comment containing extension
7950 !! options
7951 pst
7952 !! input
7953 <!-- <tag>data</tag> -->
7954 !!result
7955 <!-- <tag>data</tag> -->
7956 !!end
7957
7958 !! test
7959 pre-save transform: comment containing nowiki
7960 !! options
7961 pst
7962 !! input
7963 <!-- <nowiki>data</nowiki> -->
7964 !!result
7965 <!-- <nowiki>data</nowiki> -->
7966 !!end
7967
7968 !! test
7969 pre-save transform: <noinclude> in subst (bug 3298)
7970 !! options
7971 pst
7972 !! input
7973 {{subst:Includes}}
7974 !! result
7975 Foobar
7976 !! end
7977
7978 !! test
7979 pre-save transform: <onlyinclude> in subst (bug 3298)
7980 !! options
7981 pst
7982 !! input
7983 {{subst:Includes2}}
7984 !! result
7985 Foo
7986 !! end
7987
7988 !! article
7989 Template:SubstTest
7990 !!text
7991 {{<includeonly>subst:</includeonly>Includes}}
7992 !! endarticle
7993
7994 !! article
7995 Template:SafeSubstTest
7996 !! text
7997 {{<includeonly>safesubst:</includeonly>Includes}}
7998 !! endarticle
7999
8000 !! test
8001 bug 22297: safesubst: works during PST
8002 !! options
8003 pst
8004 !! input
8005 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
8006 !! result
8007 FoobarFoobar
8008 !! end
8009
8010 !! test
8011 bug 22297: safesubst: works during normal parse
8012 !! input
8013 {{SafeSubstTest}}
8014 !! result
8015 <p>Foobar
8016 </p>
8017 !! end
8018
8019 !! test:
8020 subst: does not work during normal parse
8021 !! input
8022 {{SubstTest}}
8023 !! result
8024 <p>{{subst:Includes}}
8025 </p>
8026 !! end
8027
8028 !! test
8029 pre-save transform: context links ("pipe trick")
8030 !! options
8031 pst
8032 !! input
8033 [[Article (context)|]]
8034 [[Bar:Article|]]
8035 [[:Bar:Article|]]
8036 [[Bar:Article (context)|]]
8037 [[:Bar:Article (context)|]]
8038 [[|Article]]
8039 [[|Article (context)]]
8040 [[Bar:X (Y) Z|]]
8041 [[:Bar:X (Y) Z|]]
8042 !! result
8043 [[Article (context)|Article]]
8044 [[Bar:Article|Article]]
8045 [[:Bar:Article|Article]]
8046 [[Bar:Article (context)|Article]]
8047 [[:Bar:Article (context)|Article]]
8048 [[Article]]
8049 [[Article (context)]]
8050 [[Bar:X (Y) Z|X (Y) Z]]
8051 [[:Bar:X (Y) Z|X (Y) Z]]
8052 !! end
8053
8054 !! test
8055 pre-save transform: context links ("pipe trick") with interwiki prefix
8056 !! options
8057 pst
8058 !! input
8059 [[interwiki:Article|]]
8060 [[:interwiki:Article|]]
8061 [[interwiki:Bar:Article|]]
8062 [[:interwiki:Bar:Article|]]
8063 !! result
8064 [[interwiki:Article|Article]]
8065 [[:interwiki:Article|Article]]
8066 [[interwiki:Bar:Article|Bar:Article]]
8067 [[:interwiki:Bar:Article|Bar:Article]]
8068 !! end
8069
8070 !! test
8071 pre-save transform: context links ("pipe trick") with parens in title
8072 !! options
8073 pst title=[[Somearticle (context)]]
8074 !! input
8075 [[|Article]]
8076 !! result
8077 [[Article (context)|Article]]
8078 !! end
8079
8080 !! test
8081 pre-save transform: context links ("pipe trick") with comma in title
8082 !! options
8083 pst title=[[Someplace, Somewhere]]
8084 !! input
8085 [[|Otherplace]]
8086 [[Otherplace, Elsewhere|]]
8087 [[Otherplace, Elsewhere, Anywhere|]]
8088 !! result
8089 [[Otherplace, Somewhere|Otherplace]]
8090 [[Otherplace, Elsewhere|Otherplace]]
8091 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
8092 !! end
8093
8094 !! test
8095 pre-save transform: context links ("pipe trick") with parens and comma
8096 !! options
8097 pst title=[[Someplace (IGNORED), Somewhere]]
8098 !! input
8099 [[|Otherplace]]
8100 [[Otherplace (place), Elsewhere|]]
8101 !! result
8102 [[Otherplace, Somewhere|Otherplace]]
8103 [[Otherplace (place), Elsewhere|Otherplace]]
8104 !! end
8105
8106 !! test
8107 pre-save transform: context links ("pipe trick") with comma and parens
8108 !! options
8109 pst title=[[Who, me? (context)]]
8110 !! input
8111 [[|Yes, you.]]
8112 [[Me, Myself, and I (1937 song)|]]
8113 !! result
8114 [[Yes, you. (context)|Yes, you.]]
8115 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
8116 !! end
8117
8118 !! test
8119 pre-save transform: context links ("pipe trick") with namespace
8120 !! options
8121 pst title=[[Ns:Somearticle]]
8122 !! input
8123 [[|Article]]
8124 !! result
8125 [[Ns:Article|Article]]
8126 !! end
8127
8128 !! test
8129 pre-save transform: context links ("pipe trick") with namespace and parens
8130 !! options
8131 pst title=[[Ns:Somearticle (context)]]
8132 !! input
8133 [[|Article]]
8134 !! result
8135 [[Ns:Article (context)|Article]]
8136 !! end
8137
8138 !! test
8139 pre-save transform: context links ("pipe trick") with namespace and comma
8140 !! options
8141 pst title=[[Ns:Somearticle, Context, Whatever]]
8142 !! input
8143 [[|Article]]
8144 !! result
8145 [[Ns:Article, Context, Whatever|Article]]
8146 !! end
8147
8148 !! test
8149 pre-save transform: context links ("pipe trick") with namespace, comma and parens
8150 !! options
8151 pst title=[[Ns:Somearticle, Context (context)]]
8152 !! input
8153 [[|Article]]
8154 !! result
8155 [[Ns:Article (context)|Article]]
8156 !! end
8157
8158 !! test
8159 pre-save transform: context links ("pipe trick") with namespace, parens and comma
8160 !! options
8161 pst title=[[Ns:Somearticle (IGNORED), Context]]
8162 !! input
8163 [[|Article]]
8164 !! result
8165 [[Ns:Article, Context|Article]]
8166 !! end
8167
8168 !! test
8169 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
8170 !! options
8171 pst
8172 !! input
8173 [[Article(context)|]]
8174 [[Bar:Article(context)|]]
8175 [[:Bar:Article(context)|]]
8176 [[|Article(context)]]
8177 [[Bar:X(Y)Z|]]
8178 [[:Bar:X(Y)Z|]]
8179 !! result
8180 [[Article(context)|Article]]
8181 [[Bar:Article(context)|Article]]
8182 [[:Bar:Article(context)|Article]]
8183 [[Article(context)]]
8184 [[Bar:X(Y)Z|X(Y)Z]]
8185 [[:Bar:X(Y)Z|X(Y)Z]]
8186 !! end
8187
8188 !! test
8189 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
8190 !! options
8191 pst
8192 !! input
8193 [[Article (context)|]]
8194 [[Bar:Article (context)|]]
8195 [[:Bar:Article (context)|]]
8196 [[|Article (context)]]
8197 [[Bar:X (Y) Z|]]
8198 [[:Bar:X (Y) Z|]]
8199 !! result
8200 [[Article (context)|Article]]
8201 [[Bar:Article (context)|Article]]
8202 [[:Bar:Article (context)|Article]]
8203 [[Article (context)]]
8204 [[Bar:X (Y) Z|X (Y) Z]]
8205 [[:Bar:X (Y) Z|X (Y) Z]]
8206 !! end
8207
8208 !! test
8209 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
8210 !! options
8211 pst
8212 !! input
8213 [[Article(context)|]]
8214 [[Bar:Article(context)|]]
8215 [[:Bar:Article(context)|]]
8216 [[|Article(context)]]
8217 [[Bar:X(Y)Z|]]
8218 [[:Bar:X(Y)Z|]]
8219 !! result
8220 [[Article(context)|Article]]
8221 [[Bar:Article(context)|Article]]
8222 [[:Bar:Article(context)|Article]]
8223 [[Article(context)]]
8224 [[Bar:X(Y)Z|X(Y)Z]]
8225 [[:Bar:X(Y)Z|X(Y)Z]]
8226 !! end
8227
8228 !! test
8229 pre-save transform: context links ("pipe trick") with commas (bug 21660)
8230 !! options
8231 pst
8232 !! input
8233 [[Article (context), context|]]
8234 [[Article (context),context|]]
8235 [[Bar:Article (context), context|]]
8236 [[Bar:Article (context),context|]]
8237 [[:Bar:Article (context), context|]]
8238 [[:Bar:Article (context),context|]]
8239 !! result
8240 [[Article (context), context|Article]]
8241 [[Article (context),context|Article]]
8242 [[Bar:Article (context), context|Article]]
8243 [[Bar:Article (context),context|Article]]
8244 [[:Bar:Article (context), context|Article]]
8245 [[:Bar:Article (context),context|Article]]
8246 !! end
8247
8248 !! test
8249 pre-save transform: trim trailing empty lines
8250 !! options
8251 pst
8252 !! input
8253 Empty lines are trimmed
8254
8255
8256
8257
8258 !! result
8259 Empty lines are trimmed
8260 !! end
8261
8262 !! test
8263 pre-save transform: Signature expansion
8264 !! options
8265 pst
8266 !! input
8267 * ~~~
8268 * <noinclude>~~~</noinclude>
8269 * <includeonly>~~~</includeonly>
8270 * <onlyinclude>~~~</onlyinclude>
8271 !! result
8272 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
8273 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
8274 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
8275 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
8276 !! end
8277
8278
8279 !! test
8280 pre-save transform: Signature expansion in nowiki tags (bug 93)
8281 !! options
8282 pst disabled
8283 !! input
8284 Shall not expand:
8285
8286 <nowiki>~~~~</nowiki>
8287
8288 <includeonly><nowiki>~~~~</nowiki></includeonly>
8289
8290 <noinclude><nowiki>~~~~</nowiki></noinclude>
8291
8292 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8293
8294 {{subst:Foo}} shall be converted to FOO
8295
8296 As well as inside noinclude/onlyinclude
8297 <noinclude>{{subst:Foo}}</noinclude>
8298 <onlyinclude>{{subst:Foo}}</onlyinclude>
8299
8300 But not inside includeonly
8301 <includeonly>{{subst:Foo}}</includeonly>
8302 !! result
8303 Shall not expand:
8304
8305 <nowiki>~~~~</nowiki>
8306
8307 <includeonly><nowiki>~~~~</nowiki></includeonly>
8308
8309 <noinclude><nowiki>~~~~</nowiki></noinclude>
8310
8311 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8312
8313 FOO shall be converted to FOO
8314
8315 As well as inside noinclude/onlyinclude
8316 <noinclude>FOO</noinclude>
8317 <onlyinclude>FOO</onlyinclude>
8318
8319 But not inside includeonly
8320 <includeonly>{{subst:Foo}}</includeonly>
8321 !! end
8322
8323 !! test
8324 Parsoid: Recognize nowiki with trailing space in tags
8325 !! options
8326 parsoid=wt2html
8327 !! input
8328 <nowiki ><div>[[foo]]</nowiki >
8329
8330 a<nowiki / >b
8331
8332 c<nowiki />d
8333
8334 e<nowiki/ >f
8335 !! result
8336 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8337 <p>ab</p>
8338 <p>cd</p>
8339 <p>ef</p>
8340 !! end
8341
8342 !! test
8343 Parsoid: Recognize nowiki with odd capitalization
8344 !! options
8345 parsoid=wt2html
8346 !! input
8347 <noWikI ><div>[[foo]]</Nowiki >
8348 !! result
8349 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8350 !! end
8351
8352
8353 !! test
8354 Parsoid: Escape nowiki with trailing space in tags
8355 !! options
8356 parsoid=html2wt
8357 !! input
8358 &lt;nowiki &gt; foo &lt;/nowiki &gt;
8359
8360 a&lt;nowiki /&gt;b
8361
8362 c&lt;nowiki/ &gt;d
8363 !! result
8364 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
8365 <p>a&lt;nowiki /&gt;b</p>
8366 <p>c&lt;nowiki/ &gt;d</p>
8367 !! end
8368
8369 !! test
8370 Parsoid: Escape weird noWikI capitalizations
8371 !! options
8372 parsoid=html2wt
8373 !! input
8374 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
8375 !! result
8376 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
8377 !! end
8378
8379 ###
8380 ### Message transform tests
8381 ###
8382 !! test
8383 message transform: magic variables
8384 !! options
8385 msg
8386 !! input
8387 {{SITENAME}}
8388 !! result
8389 MediaWiki
8390 !! end
8391
8392 !! test
8393 message transform: should not transform wiki markup
8394 !! options
8395 msg
8396 !! input
8397 ''test''
8398 !! result
8399 ''test''
8400 !! end
8401
8402 !! test
8403 message transform: <noinclude> in transcluded template (bug 4926)
8404 !! options
8405 msg
8406 !! input
8407 {{Includes}}
8408 !! result
8409 Foobar
8410 !! end
8411
8412 !! test
8413 message transform: <onlyinclude> in transcluded template (bug 4926)
8414 !! options
8415 msg
8416 !! input
8417 {{Includes2}}
8418 !! result
8419 Foo
8420 !! end
8421
8422 !! test
8423 {{#special:}} page name, known
8424 !! options
8425 msg
8426 !! input
8427 {{#special:Recentchanges}}
8428 !! result
8429 Special:RecentChanges
8430 !! end
8431
8432 !! test
8433 {{#special:}} page name with subpage, known
8434 !! options
8435 msg
8436 !! input
8437 {{#special:Recentchanges/param}}
8438 !! result
8439 Special:RecentChanges/param
8440 !! end
8441
8442 !! test
8443 {{#special:}} page name, unknown
8444 !! options
8445 msg
8446 !! input
8447 {{#special:foobar nonexistent}}
8448 !! result
8449 Special:Foobar nonexistent
8450 !! end
8451
8452 !! test
8453 {{#speciale:}} page name, known
8454 !! options
8455 msg
8456 !! input
8457 {{#speciale:Recentchanges}}
8458 !! result
8459 Special:RecentChanges
8460 !! end
8461
8462 !! test
8463 {{#speciale:}} page name with subpage, known
8464 !! options
8465 msg
8466 !! input
8467 {{#speciale:Recentchanges/param}}
8468 !! result
8469 Special:RecentChanges/param
8470 !! end
8471
8472 !! test
8473 {{#speciale:}} page name, unknown
8474 !! options
8475 msg
8476 !! input
8477 {{#speciale:foobar nonexistent}}
8478 !! result
8479 Special:Foobar_nonexistent
8480 !! end
8481
8482 ###
8483 ### Images
8484 ###
8485 ### For Parsoid-specific tests, see
8486 #### http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8487
8488 !! test
8489 Simple image (php)
8490 !! options
8491 php
8492 !! input
8493 [[Image:foobar.jpg]]
8494 !! result
8495 <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>
8496 </p>
8497 !! end
8498
8499 !! test
8500 Simple image (parsoid)
8501 !! options
8502 parsoid=wt2html
8503 !! input
8504 [[Image:foobar.jpg]]
8505 !! result
8506 <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>
8507 </p>
8508 !! end
8509
8510 !! test
8511 Simple image (using File: namespace, now canonical) (php)
8512 !! options
8513 php
8514 !! input
8515 [[File:foobar.jpg]]
8516 !! result
8517 <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>
8518 </p>
8519 !! end
8520
8521 !! test
8522 Simple image (using File: namespace, now canonical) (parsoid)
8523 !! options
8524 parsoid
8525 !! input
8526 [[File:Foobar.jpg]]
8527 !! result
8528 <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>
8529 </p>
8530 !! end
8531
8532 !! test
8533 Right-aligned image (php)
8534 !! options
8535 php
8536 !! input
8537 [[Image:foobar.jpg|right]]
8538 !! result
8539 <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>
8540
8541 !! end
8542
8543 !! test
8544 Right-aligned image (parsoid)
8545 !! options
8546 parsoid
8547 !! input
8548 [[File:Foobar.jpg|right]]
8549 !! result
8550 <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>
8551 !! end
8552
8553 !! test
8554 Image with caption (php)
8555 !! options
8556 php
8557 !! input
8558 [[File:Foobar.jpg|right|Caption text]]
8559 !! result
8560 <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>
8561
8562 !! end
8563
8564 !! test
8565 Image with caption (parsoid)
8566 !! options
8567 parsoid
8568 !! input
8569 [[File:Foobar.jpg|right|Caption text]]
8570 !! result
8571 <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>
8572 !! end
8573
8574 !! test
8575 Image with empty attribute (php)
8576 !! options
8577 php
8578 !! input
8579 [[File:Foobar.jpg|right||Caption text]]
8580 !! result
8581 <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>
8582
8583 !! end
8584
8585 !! test
8586 Image with empty attribute (parsoid)
8587 !! options
8588 parsoid=wt2html
8589 !! input
8590 [[File:Foobar.jpg|right||Caption text]]
8591 !! result
8592 <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>
8593 !! end
8594
8595 !! test
8596 Image with attributes from template (php)
8597 !! options
8598 php
8599 !! input
8600 [[File:Foobar.jpg|{{image_attribs}}]]
8601 !! result
8602 <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>
8603
8604 !! end
8605
8606 !! test
8607 Image with attributes from template (parsoid)
8608 !! options
8609 parsoid
8610 !! input
8611 [[File:Foobar.jpg|{{image_attribs}}]]
8612 !! result
8613 <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>
8614 !! end
8615
8616 !! test
8617 Image with link tails (php)
8618 !! options
8619 php
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<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
8626 </p>
8627 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
8628 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
8629
8630 !! end
8631
8632 !! test
8633 Image with link tails (parsoid)
8634 !! options
8635 parsoid
8636 !! input
8637 123[[File:Foobar.jpg]]456
8638 123[[File:Foobar.jpg|right]]456
8639 123[[File:Foobar.jpg|thumb]]456
8640 !! result
8641 <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>
8642 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
8643 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
8644 !! end
8645
8646 !! test
8647 Image with multiple captions -- only last one is accepted (php)
8648 !! options
8649 php
8650 !! input
8651 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8652 !! result
8653 <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>
8654
8655 !! end
8656
8657 !! test
8658 Image with multiple captions -- only last one is accepted (parsoid)
8659 !! options
8660 parsoid
8661 !! input
8662 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8663 !! result
8664 <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>
8665 !! end
8666
8667 !! test
8668 Image with width attribute at different positions (php)
8669 !! options
8670 php
8671 !! input
8672 [[File:Foobar.jpg|200px|right|Caption]]
8673 [[File:Foobar.jpg|right|200px|Caption]]
8674 [[File:Foobar.jpg|right|Caption|200px]]
8675 !! result
8676 <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>
8677 <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>
8678 <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>
8679
8680 !! end
8681
8682 !! test
8683 Image with width attribute at different positions (parsoid)
8684 !! options
8685 parsoid
8686 !! input
8687 [[File:Foobar.jpg|200px|right|Caption]]
8688 [[File:Foobar.jpg|right|200px|Caption]]
8689 [[File:Foobar.jpg|right|Caption|200px]]
8690 !! result
8691 <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>
8692 <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>
8693 <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>
8694 !! end
8695
8696 !! test
8697 Image with link parameter, wiki target (php)
8698 !! options
8699 php
8700 !! input
8701 [[File:Foobar.jpg|link=Main Page]]
8702 !! result
8703 <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>
8704 </p>
8705 !! end
8706
8707 !! test
8708 Image with link parameter, wiki target (parsoid)
8709 !! options
8710 parsoid
8711 !! input
8712 [[File:Foobar.jpg|link=Main Page]]
8713 !! result
8714 <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>
8715 !! end
8716
8717 !! test
8718 Image with link parameter, URL target (php)
8719 !! options
8720 php
8721 !! input
8722 [[File:Foobar.jpg|link=http://example.com/]]
8723 !! result
8724 <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>
8725 </p>
8726 !! end
8727
8728 # parsoid bug 49293 (part 1)
8729 !! test
8730 Image with link parameter, URL target (parsoid)
8731 !! options
8732 parsoid
8733 !! input
8734 [[File:Foobar.jpg|link=http://example.com/]]
8735 !! result
8736 <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>
8737 !! end
8738
8739 !! test
8740 Image with link parameter, protocol-less URL target (php)
8741 !! options
8742 php
8743 !! input
8744 [[File:Foobar.jpg|link=//example.com/]]
8745 !! result
8746 <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>
8747 </p>
8748 !! end
8749
8750 # parsoid bug 49293 (part 2)
8751 !! test
8752 Image with link parameter, protocol-less URL target (parsoid)
8753 !! options
8754 parsoid
8755 !! input
8756 [[File:Foobar.jpg|link=//example.com/]]
8757 !! result
8758 <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>
8759 !! end
8760
8761 !! test
8762 Image with link parameter, wgExternalLinkTarget
8763 !! input
8764 [[Image:foobar.jpg|link=http://example.com/]]
8765 !! config
8766 wgExternalLinkTarget='foobar'
8767 !! result
8768 <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>
8769 </p>
8770 !! end
8771
8772 !! test
8773 Image with link parameter, wgNoFollowLinks set to false
8774 !! input
8775 [[Image:foobar.jpg|link=http://example.com/]]
8776 !! config
8777 wgNoFollowLinks=false
8778 !! result
8779 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8780 </p>
8781 !! end
8782
8783 !! test
8784 Image with link parameter, wgNoFollowDomainExceptions
8785 !! input
8786 [[Image:foobar.jpg|link=http://example.com/]]
8787 !! config
8788 wgNoFollowDomainExceptions='example.com'
8789 !! result
8790 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8791 </p>
8792 !! end
8793
8794 !! test
8795 Image with link parameter, wgExternalLinkTarget, unnamed parameter
8796 !! input
8797 [[Image:foobar.jpg|link=http://example.com/|Title]]
8798 !! config
8799 wgExternalLinkTarget='foobar'
8800 !! result
8801 <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>
8802 </p>
8803 !! end
8804
8805 !! test
8806 Image with empty link parameter (php)
8807 !! options
8808 php
8809 !! input
8810 [[File:Foobar.jpg|link=]]
8811 !! result
8812 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
8813 </p>
8814 !! end
8815
8816 !! test
8817 Image with empty link parameter (parsoid)
8818 !! options
8819 parsoid
8820 !! input
8821 [[File:Foobar.jpg|link=]]
8822 !! result
8823 <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>
8824 !! end
8825
8826 !! test
8827 Image with link parameter (wiki target) and unnamed parameter (php)
8828 !! options
8829 php
8830 !! input
8831 [[File:Foobar.jpg|link=Main Page|Title]]
8832 !! result
8833 <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>
8834 </p>
8835 !! end
8836
8837 !! test
8838 Image with link parameter (wiki target) and unnamed parameter (parsoid)
8839 !! options
8840 parsoid
8841 !! input
8842 [[File:Foobar.jpg|link=Main Page|Title]]
8843 !! result
8844 <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>
8845 !! end
8846
8847 !! test
8848 Image with link parameter (URL target) and unnamed parameter (php)
8849 !! options
8850 php
8851 !! input
8852 [[File:Foobar.jpg|link=http://example.com/|Title]]
8853 !! result
8854 <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>
8855 </p>
8856 !! end
8857
8858 !! test
8859 Image with link parameter (URL target) and unnamed parameter (parsoid)
8860 !! options
8861 parsoid
8862 !! input
8863 [[File:Foobar.jpg|link=http://example.com/|Title]]
8864 !! result
8865 <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>
8866 !! end
8867
8868 !! test
8869 Thumbnail image with link parameter
8870 !! options
8871 php
8872 !! input
8873 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
8874 !! result
8875 <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>
8876
8877 !! end
8878
8879 !! test
8880 Manually-specified thumbnail image
8881 !! options
8882 php
8883 !! input
8884 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
8885 !! result
8886 <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>
8887
8888 !! end
8889
8890 !! test
8891 Manually-specified thumbnail image with explicit link to wiki page
8892 !! options
8893 php
8894 !! input
8895 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
8896 !! result
8897 <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>
8898
8899 !! end
8900
8901 !! test
8902 Manually-specified thumbnail image with explicit link to url
8903 !! options
8904 php
8905 !! input
8906 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
8907 !! result
8908 <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>
8909
8910 !! end
8911
8912 !! test
8913 Manually-specified thumbnail image with explicit no link
8914 !! options
8915 php
8916 !! input
8917 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
8918 !! result
8919 <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>
8920
8921 !! end
8922
8923 !! test
8924 Manually-specified thumbnail image with explicit link and alt text
8925 !! options
8926 php
8927 !! input
8928 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
8929 !! result
8930 <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>
8931
8932 !! end
8933
8934 !! test
8935 Image with frame and link
8936 !! input
8937 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
8938 !! result
8939 <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>
8940
8941 !! end
8942
8943 !! test
8944 Image with frame and link and explicit alt
8945 !! input
8946 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
8947 !! result
8948 <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>
8949
8950 !! end
8951
8952 !! test
8953 Image with wiki markup in implicit alt
8954 !! input
8955 [[Image:Foobar.jpg|testing '''bold''' in alt]]
8956 !! result
8957 <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>
8958 </p>
8959 !! end
8960
8961 !! test
8962 Image with wiki markup in explicit alt
8963 !! input
8964 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
8965 !! result
8966 <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>
8967 </p>
8968 !! end
8969
8970 !! test
8971 Link to image page- image page normally doesn't exists, hence edit link
8972 Add test with existing image page
8973 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
8974 !! input
8975 [[:Image:test]]
8976 !! result
8977 <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>
8978 </p>
8979 !! end
8980
8981 !! test
8982 bug 18784 Link to non-existent image page with caption should use caption as link text
8983 !! input
8984 [[:Image:test|caption]]
8985 !! result
8986 <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>
8987 </p>
8988 !! end
8989
8990 !! test
8991 Frameless image caption with a free URL
8992 !! input
8993 [[Image:foobar.jpg|http://example.com]]
8994 !! result
8995 <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>
8996 </p>
8997 !! end
8998
8999 !! test
9000 Thumbnail image caption with a free URL
9001 !! input
9002 [[Image:foobar.jpg|thumb|http://example.com]]
9003 !! result
9004 <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>
9005
9006 !! end
9007
9008 !! test
9009 Thumbnail image caption with a free URL and explicit alt
9010 !! input
9011 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
9012 !! result
9013 <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>
9014
9015 !! end
9016
9017 !! test
9018 SVG thumbnails with no language set
9019 !! options
9020 !! input
9021 [[File:Foobar.svg|thumb|width=200]]
9022 !! result
9023 <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>
9024
9025 !! end
9026
9027 !! test
9028 SVG thumbnails with language de
9029 !! options
9030 !! input
9031 [[File:Foobar.svg|thumb|width=200|lang=de]]
9032 !! result
9033 <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>
9034
9035 !! end
9036
9037 !! test
9038 SVG thumbnails with invalid language code
9039 !! options
9040 !! input
9041 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
9042 !! result
9043 <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>
9044
9045 !! end
9046
9047 !! test
9048 BUG 1887: A ISBN with a thumbnail
9049 !! input
9050 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
9051 !! result
9052 <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>
9053
9054 !! end
9055
9056 !! test
9057 BUG 1887: A RFC with a thumbnail
9058 !! input
9059 [[Image:foobar.jpg|thumb|This is RFC 12354]]
9060 !! result
9061 <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>
9062
9063 !! end
9064
9065 !! test
9066 BUG 1887: A mailto link with a thumbnail
9067 !! input
9068 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
9069 !! result
9070 <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>
9071
9072 !! end
9073
9074 # Pending resolution to bug 368
9075 !! test
9076 BUG 648: Frameless image caption with a link
9077 !! input
9078 [[Image:foobar.jpg|text with a [[link]] in it]]
9079 !! result
9080 <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>
9081 </p>
9082 !! end
9083
9084 !! test
9085 BUG 648: Frameless image caption with a link (suffix)
9086 !! input
9087 [[Image:foobar.jpg|text with a [[link]]foo in it]]
9088 !! result
9089 <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>
9090 </p>
9091 !! end
9092
9093 !! test
9094 BUG 648: Frameless image caption with an interwiki link
9095 !! input
9096 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
9097 !! result
9098 <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>
9099 </p>
9100 !! end
9101
9102 !! test
9103 BUG 648: Frameless image caption with a piped interwiki link
9104 !! input
9105 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
9106 !! result
9107 <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>
9108 </p>
9109 !! end
9110
9111 !! test
9112 Escape HTML special chars in image alt text
9113 !! input
9114 [[Image:foobar.jpg|& < > "]]
9115 !! result
9116 <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>
9117 </p>
9118 !! end
9119
9120 !! test
9121 BUG 499: Alt text should have &#1234;, not &amp;1234;
9122 !! input
9123 [[Image:foobar.jpg|&#9792;]]
9124 !! result
9125 <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>
9126 </p>
9127 !! end
9128
9129 !! test
9130 Broken image caption with link
9131 !! input
9132 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
9133 !! result
9134 <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.
9135 </p>
9136 !! end
9137
9138 !! test
9139 Image caption containing another image
9140 !! input
9141 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
9142 !! result
9143 <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>
9144
9145 !! end
9146
9147 !! test
9148 Image caption containing a newline
9149 !! input
9150 [[Image:Foobar.jpg|This
9151 *is some text]]
9152 !! result
9153 <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>
9154 </p>
9155 !!end
9156
9157 !!test
9158 Parsoid: Image caption containing leading space
9159 (The leading space should not trigger nowiki escaping in wt2wt mode)
9160 !! input
9161 [[Image:Foobar.jpg|thumb| bar]]
9162 !! result
9163 <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>
9164
9165 !!end
9166
9167 !! test
9168 Bug 3090: External links other than http: in image captions
9169 !! input
9170 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
9171 !! result
9172 <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>
9173
9174 !! end
9175
9176 !! test
9177 Custom class
9178 !! input
9179 [[Image:foobar.jpg|a|class=b]]
9180 !! result
9181 <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>
9182 </p>
9183 !! end
9184
9185 !! test
9186 Localized image handling (1).
9187 !! options
9188 language=es
9189 !! input
9190 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
9191 !! result
9192 <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>
9193
9194 !! end
9195
9196 !! test
9197 Localized image handling (2).
9198 !! options
9199 language=es
9200 !! input
9201 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
9202 !! result
9203 <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>
9204
9205 !! end
9206
9207 !! test
9208 "border", "frameless" and "class" attributes on an image.
9209 !! input
9210 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
9211 !! result
9212 <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>
9213 </p>
9214 !! end
9215
9216 !! article
9217 File:Barfoo.jpg
9218 !! text
9219 #REDIRECT [[File:Barfoo.jpg]]
9220 !! endarticle
9221
9222 !! test
9223 Redirected image
9224 !! input
9225 [[Image:Barfoo.jpg]]
9226 !! result
9227 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
9228 </p>
9229 !! end
9230
9231 !! test
9232 Missing image with uploads disabled
9233 !! options
9234 wgEnableUploads=0
9235 !! input
9236 [[Image:Foobaz.jpg]]
9237 !! result
9238 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
9239 </p>
9240 !! end
9241
9242 # Parsoid-specific testing for images
9243 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9244 # Currently imperfect due to a flaw in the Parsoid testrunner
9245 # Work in progress
9246 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
9247 # image tests.
9248
9249 !! test
9250 Parsoid-specific image handling - simple image with size and middle alignment
9251 !! options
9252 parsoid
9253 !! input
9254 [[Image:Foobar.jpg|50px|middle]]
9255 !! result
9256 <p>
9257 <span class="mw-valign-middle" typeof="mw:Image">
9258 <a href="File:Foobar.jpg">
9259 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
9260 </a>
9261 </span>
9262 </p>
9263 !! end
9264
9265 !! test
9266 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
9267 !! options
9268 parsoid
9269 !! input
9270 [[Image:Foobar.jpg|500x10px|baseline|caption]]
9271 !! result
9272 <p>
9273 <span class="mw-valign-baseline" 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/89px-Foobar.jpg" height="10" width="89">
9276 </a>
9277 </span>
9278 </p>
9279 !! end
9280
9281 !! test
9282 Parsoid-specific image handling - simple image with border and size spec
9283 !! options
9284 parsoid
9285 !! input
9286 [[Image:Foobar.jpg|50px|border|caption]]
9287 !! result
9288 <p>
9289 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9290 <a href="File:Foobar.jpg">
9291 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
9292 </a>
9293 </span>
9294 </p>
9295 !! end
9296
9297 !! test
9298 Parsoid-specific image handling - thumbnail with halign, valign, and caption
9299 !! options
9300 parsoid
9301 !! input
9302 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
9303 !! result
9304 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
9305 <a href="File:Foobar.jpg">
9306 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
9307 </a>
9308 <figcaption>caption content</figcaption>
9309 </figure>
9310 !! end
9311
9312 !! test
9313 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
9314 !! options
9315 parsoid
9316 !! input
9317 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
9318 !! result
9319 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
9320 <a href="File:Foobar.jpg">
9321 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
9322 </a>
9323 <figcaption>caption</figcaption>
9324 </figure>
9325 !! end
9326
9327 !! test
9328 Parsoid-specific image handling - framed image with specific size and caption
9329 !! options
9330 parsoid
9331 !! input
9332 [[Image:Foobar.jpg|500x50px|frame|caption]]
9333 !! result
9334 <figure typeof="mw:Image/Frame">
9335 <a href="File:Foobar.jpg">
9336 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9337 </a>
9338 <figcaption>caption</figcaption>
9339 </figure>
9340 !! end
9341
9342 !! test
9343 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
9344 !! options
9345 parsoid
9346 !! input
9347 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
9348 !! result
9349 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
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 <figcaption>caption</figcaption>
9354 </figure>
9355 !! end
9356
9357 !! test
9358 Parsoid-specific image handling - frameless image with specific size, border, and caption
9359 !! options
9360 parsoid
9361 !! input
9362 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
9363 !! result
9364 <p>
9365 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9366 <a href="File:Foobar.jpg">
9367 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9368 </a>
9369 </p>
9370 !! end
9371
9372 #!! test
9373 #Parsoid-specific image handling - simple image with a formatted caption
9374 #!! options
9375 #parsoid
9376 #!! input
9377 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
9378 #!! result
9379 #<p>
9380 #<span typeof="mw:Image">
9381 #<a class="mw-default-size" href="Image:Foobar.jpg">
9382 #<img alt="Foobar.jpg" class="mw-default-size" src="http://example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
9383 #</a>
9384 #<span>abc</span>
9385 #</span>
9386 #</p>
9387
9388
9389 ###
9390 ### Subpages
9391 ###
9392 !! article
9393 Subpage test/subpage
9394 !! text
9395 foo
9396 !! endarticle
9397
9398 !! test
9399 Subpage link
9400 !! options
9401 subpage title=[[Subpage test]]
9402 !! input
9403 [[/subpage]]
9404 !! result
9405 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
9406 </p>
9407 !! end
9408
9409 !! test
9410 Subpage noslash link
9411 !! options
9412 subpage title=[[Subpage test]]
9413 !!input
9414 [[/subpage/]]
9415 !! result
9416 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
9417 </p>
9418 !! end
9419
9420 # TODO: make this PHP-parser compatible!
9421 !! test
9422 Relative subpage noslash link
9423 !! options
9424 parsoid=wt2wt,wt2html,html2html
9425 subpage title=[[Subpage test/1/2/3/4]]
9426 !!input
9427 [[../../subpage/]]
9428
9429 [[../../subpage]]
9430 !! result
9431 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
9432 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
9433 !! end
9434
9435 # TODO: make this PHP-parser compatible!
9436 !! test
9437 Parsoid: dot-slash prefixed wikilinks
9438 !! options
9439 parsoid=wt2wt,wt2html,html2html
9440 !!input
9441 [[./foo]]
9442
9443 [[././bar]]
9444
9445 [[././baz/]]
9446 !! result
9447 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
9448 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
9449 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
9450 !! end
9451
9452 !! test
9453 Disabled subpages
9454 !! input
9455 [[/subpage]]
9456 !! result
9457 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
9458 </p>
9459 !! end
9460
9461 !! test
9462 BUG 561: {{/Subpage}}
9463 !! options
9464 subpage title=[[Page]]
9465 !! input
9466 {{/Subpage}}
9467 !! result
9468 <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>
9469 </p>
9470 !! end
9471
9472 ###
9473 ### Categories
9474 ###
9475 !! article
9476 Category:MediaWiki User's Guide
9477 !! text
9478 blah
9479 !! endarticle
9480
9481 !! test
9482 Link to category
9483 !! input
9484 [[:Category:MediaWiki User's Guide]]
9485 !! result
9486 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
9487 </p>
9488 !! end
9489
9490 !! test
9491 Simple category
9492 !! options
9493 cat
9494 !! input
9495 [[Category:MediaWiki User's Guide]]
9496 !! result
9497 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9498 !! end
9499
9500 !! test
9501 PAGESINCATEGORY invalid title fatal (r33546 fix)
9502 !! input
9503 {{PAGESINCATEGORY:<bogus>}}
9504 !! result
9505 <p>0
9506 </p>
9507 !! end
9508
9509 !! test
9510 Category with different sort key
9511 !! options
9512 cat
9513 !! input
9514 [[Category:MediaWiki User's Guide|Foo]]
9515 !! result
9516 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9517 !! end
9518
9519 !! test
9520 Category with identical sort key
9521 !! options
9522 cat
9523 !! input
9524 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9525 !! result
9526 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9527 !! end
9528
9529 !! test
9530 Category with empty sort key
9531 !! options
9532 cat
9533 pst
9534 !! input
9535 [[Category:MediaWiki User's Guide|]]
9536 !! result
9537 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9538 !! end
9539
9540 !! test
9541 Category with empty sort key and parentheses
9542 !! options
9543 cat
9544 pst
9545 !! input
9546 [[Category:Foo (bar)|]]
9547 !! result
9548 [[Category:Foo (bar)|Foo]]
9549 !! end
9550
9551 !! test
9552 Category with link tail
9553 !! options
9554 cat
9555 pst
9556 !! input
9557 123[[Category:Foo]]456
9558 !! result
9559 123[[Category:Foo]]456
9560 !! end
9561
9562 !! test
9563 Category with template
9564 !! options
9565 cat
9566 pst
9567 !! input
9568 [[Category:{{echo|Foo}}]]
9569 !! result
9570 [[Category:{{echo|Foo}}]]
9571 !! end
9572
9573 !! test
9574 Category with template in sort key
9575 !! options
9576 cat
9577 pst
9578 !! input
9579 [[Category:Foo|{{echo|Bar}}]]
9580 !! result
9581 [[Category:Foo|{{echo|Bar}}]]
9582 !! end
9583
9584 !! test
9585 Category with template in sort key and title
9586 !! options
9587 cat
9588 pst
9589 !! input
9590 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9591 !! result
9592 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9593 !! end
9594
9595 !! test
9596 Category / paragraph interactions
9597 !! input
9598 Foo [[Category:Baz]] Bar
9599
9600 Foo [[Category:Baz]]
9601 Bar
9602
9603 Foo
9604 [[Category:Baz]]
9605 Bar
9606
9607 Foo
9608 [[Category:Baz]] Bar
9609
9610 Foo
9611 [[Category:Baz]]
9612 [[Category:Baz]]
9613 [[Category:Baz]]
9614 Bar
9615
9616 [[Category:Baz]]
9617 [[Category:Baz]]
9618 [[Category:Baz]]
9619
9620 [[Category:Baz]]
9621 {{echo|[[Category:Baz]]}}
9622 [[Category:Baz]]
9623 !! result
9624 <p>Foo Bar
9625 </p><p>Foo
9626 Bar
9627 </p><p>Foo
9628 Bar
9629 </p><p>Foo Bar
9630 </p><p>Foo
9631 Bar
9632 </p>
9633 !! end
9634
9635 !! test
9636 Parsoid: Serialize link to category page with colon escape
9637 !! options
9638 parsoid
9639 !! input
9640
9641 [[:Category:Foo]]
9642 [[:Category:Foo|Bar]]
9643 !! result
9644 <p>
9645 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
9646 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
9647 </p>
9648 !! end
9649
9650 !! test
9651 Parsoid: Link prefix/suffixes aren't applied to category links
9652 !! options
9653 parsoid=wt2html,wt2wt,html2html
9654 language=is
9655 !! input
9656 x[[Category:Foo]]y
9657 !! result
9658 <p>x<link rel="mw:WikiLink/Category" href="Category:Foo">y</p>
9659 !! end
9660
9661 !! test
9662 Parsoid: Serialize link to file page with colon escape
9663 !! options
9664 parsoid
9665 !! input
9666
9667 [[:File:Foo.png]]
9668 [[:File:Foo.png|Bar]]
9669 !! result
9670 <p>
9671 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
9672 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
9673 </p>
9674 !! end
9675
9676 !! test
9677 Parsoid: Serialize a genuine category link without colon escape
9678 !! options
9679 parsoid
9680 !! input
9681 [[Category:Foo]]
9682 [[Category:Foo|Bar]]
9683 !! result
9684 <link rel="mw:WikiLink/Category" href="Category:Foo">
9685 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
9686 !! end
9687
9688 ###
9689 ### Inter-language links
9690 ###
9691 !! test
9692 Inter-language links
9693 !! options
9694 ill
9695 !! input
9696 [[es:Alimento]]
9697 [[fr:Nourriture]]
9698 [[zh:&#39135;&#21697;]]
9699 !! result
9700 es:Alimento fr:Nourriture zh:食品
9701 !! end
9702
9703 !! test
9704 Duplicate interlanguage links (bug 24502)
9705 !! options
9706 ill
9707 !! input
9708 [[es:1]]
9709 [[es:2]]
9710 [[fr:1]]
9711 [[fr:2]]
9712 !! result
9713 es:1 fr:1
9714 !! end
9715
9716 ###
9717 ### Sections
9718 ###
9719 !! test
9720 Basic section headings
9721 !! input
9722 == Headline 1 ==
9723 Some text
9724
9725 ==Headline 2==
9726 More
9727 ===Smaller headline===
9728 Blah blah
9729 !! result
9730 <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>
9731 <p>Some text
9732 </p>
9733 <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>
9734 <p>More
9735 </p>
9736 <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>
9737 <p>Blah blah
9738 </p>
9739 !! end
9740
9741 !! test
9742 Section headings with TOC
9743 !! input
9744 == Headline 1 ==
9745 === Subheadline 1 ===
9746 ===== Skipping a level =====
9747 ====== Skipping a level ======
9748
9749 == Headline 2 ==
9750 Some text
9751 ===Another headline===
9752 !! result
9753 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9754 <ul>
9755 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
9756 <ul>
9757 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
9758 <ul>
9759 <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>
9760 <ul>
9761 <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>
9762 </ul>
9763 </li>
9764 </ul>
9765 </li>
9766 </ul>
9767 </li>
9768 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
9769 <ul>
9770 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
9771 </ul>
9772 </li>
9773 </ul>
9774 </div>
9775 <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>
9776 <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>
9777 <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>
9778 <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>
9779 <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>
9780 <p>Some text
9781 </p>
9782 <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>
9783
9784 !! end
9785
9786 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
9787 !! test
9788 Handling of sections up to level 6 and beyond
9789 !! input
9790 = Level 1 Heading=
9791 == Level 2 Heading==
9792 === Level 3 Heading===
9793 ==== Level 4 Heading====
9794 ===== Level 5 Heading=====
9795 ====== Level 6 Heading======
9796 ======= Level 7 Heading=======
9797 ======== Level 8 Heading========
9798 ========= Level 9 Heading=========
9799 ========== Level 10 Heading==========
9800 !! result
9801 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9802 <ul>
9803 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
9804 <ul>
9805 <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>
9806 <ul>
9807 <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>
9808 <ul>
9809 <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>
9810 <ul>
9811 <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>
9812 <ul>
9813 <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>
9814 <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>
9815 <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>
9816 <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>
9817 <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>
9818 </ul>
9819 </li>
9820 </ul>
9821 </li>
9822 </ul>
9823 </li>
9824 </ul>
9825 </li>
9826 </ul>
9827 </li>
9828 </ul>
9829 </div>
9830 <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>
9831 <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>
9832 <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>
9833 <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>
9834 <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>
9835 <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>
9836 <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>
9837 <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>
9838 <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>
9839 <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>
9840
9841 !! end
9842
9843 !! test
9844 TOC regression (bug 9764)
9845 !! input
9846 == title 1 ==
9847 === title 1.1 ===
9848 ==== title 1.1.1 ====
9849 === title 1.2 ===
9850 == title 2 ==
9851 === title 2.1 ===
9852 !! result
9853 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9854 <ul>
9855 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9856 <ul>
9857 <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>
9858 <ul>
9859 <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>
9860 </ul>
9861 </li>
9862 <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>
9863 </ul>
9864 </li>
9865 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9866 <ul>
9867 <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>
9868 </ul>
9869 </li>
9870 </ul>
9871 </div>
9872 <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>
9873 <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>
9874 <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>
9875 <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>
9876 <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>
9877 <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>
9878
9879 !! end
9880
9881 !! test
9882 TOC with wgMaxTocLevel=3 (bug 6204)
9883 !! options
9884 wgMaxTocLevel=3
9885 !! input
9886 == title 1 ==
9887 === title 1.1 ===
9888 ==== title 1.1.1 ====
9889 === title 1.2 ===
9890 == title 2 ==
9891 === title 2.1 ===
9892 !! result
9893 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9894 <ul>
9895 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9896 <ul>
9897 <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>
9898 <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>
9899 </ul>
9900 </li>
9901 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9902 <ul>
9903 <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>
9904 </ul>
9905 </li>
9906 </ul>
9907 </div>
9908 <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>
9909 <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>
9910 <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>
9911 <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>
9912 <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>
9913 <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>
9914
9915 !! end
9916
9917 !! test
9918 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
9919 !! options
9920 wgMaxTocLevel=3
9921 !! input
9922 ==Section 1==
9923 ===Section 1.1===
9924 ====Section 1.1.1====
9925 ====Section 1.1.1.1====
9926 ==Section 2==
9927 !! result
9928 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9929 <ul>
9930 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
9931 <ul>
9932 <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>
9933 </ul>
9934 </li>
9935 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
9936 </ul>
9937 </div>
9938 <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>
9939 <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>
9940 <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>
9941 <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>
9942 <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>
9943
9944 !! end
9945
9946
9947 !! test
9948 Resolving duplicate section names
9949 !! input
9950 == Foo bar ==
9951 == Foo bar ==
9952 !! result
9953 <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>
9954 <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>
9955
9956 !! end
9957
9958 !! test
9959 Resolving duplicate section names with differing case (bug 10721)
9960 !! input
9961 == Foo bar ==
9962 == Foo Bar ==
9963 !! result
9964 <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>
9965 <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>
9966
9967 !! end
9968
9969 !! article
9970 Template:sections
9971 !! text
9972 ===Section 1===
9973 ==Section 2==
9974 !! endarticle
9975
9976 !! test
9977 Template with sections, __NOTOC__
9978 !! input
9979 __NOTOC__
9980 ==Section 0==
9981 {{sections}}
9982 ==Section 4==
9983 !! result
9984 <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>
9985 <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>
9986 <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>
9987 <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>
9988
9989 !! end
9990
9991 !! test
9992 __NOEDITSECTION__ keyword
9993 !! input
9994 __NOEDITSECTION__
9995 ==Section 1==
9996 ==Section 2==
9997 !! result
9998 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
9999 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
10000
10001 !! end
10002
10003 !! test
10004 Link inside a section heading
10005 !! input
10006 ==Section with a [[Main Page|link]] in it==
10007 !! result
10008 <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>
10009
10010 !! end
10011
10012 !! test
10013 TOC regression (bug 12077)
10014 !! input
10015 __TOC__
10016 == title 1 ==
10017 === title 1.1 ===
10018 == title 2 ==
10019 !! result
10020 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10021 <ul>
10022 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10023 <ul>
10024 <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>
10025 </ul>
10026 </li>
10027 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
10028 </ul>
10029 </div>
10030 <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>
10031 <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>
10032 <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>
10033
10034 !! end
10035
10036 !! test
10037 BUG 1219 URL next to image (good)
10038 !! input
10039 http://example.com [[Image:foobar.jpg]]
10040 !! result
10041 <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>
10042 </p>
10043 !!end
10044
10045 !! test
10046 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
10047 !! input
10048 ===
10049 The line above must have a trailing space!
10050 === <!--
10051 --> <!-- -->
10052 But just in case it doesn't...
10053 !! result
10054 <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>
10055 <p>The line above must have a trailing space!
10056 </p>
10057 <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>
10058 <p>But just in case it doesn't...
10059 </p>
10060 !! end
10061
10062 !! test
10063 Header with special characters (bug 25462)
10064 !! input
10065 The tooltips shall not show entities to the user (ie. be double escaped)
10066
10067 == text > text ==
10068 section 1
10069
10070 == text < text ==
10071 section 2
10072
10073 == text & text ==
10074 section 3
10075
10076 == text ' text ==
10077 section 4
10078
10079 == text " text ==
10080 section 5
10081 !! result
10082 <p>The tooltips shall not show entities to the user (ie. be double escaped)
10083 </p>
10084 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10085 <ul>
10086 <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>
10087 <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>
10088 <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>
10089 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
10090 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
10091 </ul>
10092 </div>
10093 <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>
10094 <p>section 1
10095 </p>
10096 <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>
10097 <p>section 2
10098 </p>
10099 <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>
10100 <p>section 3
10101 </p>
10102 <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>
10103 <p>section 4
10104 </p>
10105 <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>
10106 <p>section 5
10107 </p>
10108 !! end
10109
10110 !! test
10111 Headers with excess '=' characters
10112 (Are similar tests necessary beyond the 1st level?)
10113 !! input
10114 =foo==
10115 ==foo=
10116 =''italic'' heading==
10117 ==''italic'' heading=
10118 !! result
10119 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10120 <ul>
10121 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
10122 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
10123 <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>
10124 <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>
10125 </ul>
10126 </div>
10127 <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>
10128 <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>
10129 <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>
10130 <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>
10131
10132 !! end
10133
10134 !! test
10135 HTML headers vs TOC (bug 23393)
10136 (__NOEDITSECTION__ for clearer output, doesn't matter here)
10137 !! input
10138 <h1>Header 1</h1>
10139 == Header 1.1 ==
10140 == Header 1.2 ==
10141
10142 <h1>Header 2
10143 </h1>
10144 == Header 2.1 ==
10145 == Header 2.2 ==
10146 __NOEDITSECTION__
10147 !! result
10148 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10149 <ul>
10150 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
10151 <ul>
10152 <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>
10153 <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>
10154 </ul>
10155 </li>
10156 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
10157 <ul>
10158 <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>
10159 <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>
10160 </ul>
10161 </li>
10162 </ul>
10163 </div>
10164 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
10165 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
10166 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
10167 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
10168 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
10169 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
10170
10171 !! end
10172
10173 !! test
10174 BUG 1219 URL next to image (broken)
10175 !! input
10176 http://example.com[[Image:foobar.jpg]]
10177 !! result
10178 <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>
10179 </p>
10180 !!end
10181
10182 !! test
10183 Bug 1186 news: in the middle of text
10184 !! input
10185 http://en.wikinews.org/wiki/Wikinews:Workplace
10186 !! result
10187 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
10188 </p>
10189 !!end
10190
10191
10192 !! test
10193 Namespaced link must have a title
10194 !! input
10195 [[Project:]]
10196 !! result
10197 <p>[[Project:]]
10198 </p>
10199 !!end
10200
10201 !! test
10202 Namespaced link must have a title (bad fragment version)
10203 !! input
10204 [[Project:#fragment]]
10205 !! result
10206 <p>[[Project:#fragment]]
10207 </p>
10208 !!end
10209
10210
10211 ###
10212 ### HTML tags and HTML attributes
10213 ###
10214
10215 !! test
10216 div with no attributes
10217 !! input
10218 <div>HTML rocks</div>
10219 !! result
10220 <div>HTML rocks</div>
10221
10222 !! end
10223
10224 !! test
10225 div with double-quoted attribute
10226 !! input
10227 <div id="rock">HTML rocks</div>
10228 !! result
10229 <div id="rock">HTML rocks</div>
10230
10231 !! end
10232
10233 !! test
10234 div with single-quoted attribute
10235 !! input
10236 <div id='rock'>HTML rocks</div>
10237 !! result
10238 <div id="rock">HTML rocks</div>
10239
10240 !! end
10241
10242 !! test
10243 div with unquoted attribute
10244 !! input
10245 <div id=rock>HTML rocks</div>
10246 !! result
10247 <div id="rock">HTML rocks</div>
10248
10249 !! end
10250
10251 !! test
10252 div with illegal double attributes
10253 !! input
10254 <div id="a" id="b">HTML rocks</div>
10255 !! result
10256 <div id="b">HTML rocks</div>
10257
10258 !!end
10259
10260 # FIXME: produce empty string instead of "class" in the PHP parser, following
10261 # the HTML5 spec.
10262 !! test
10263 div with empty attribute value, space before equals
10264 !! options
10265 parsoid
10266 !! input
10267 <div class =>HTML rocks</div>
10268 !! result
10269 <div class="">HTML rocks</div>
10270
10271 !! end
10272
10273 # The PHP parser escapes the opening brace to &#123; for some reason, so
10274 # disabled this test for it.
10275 !! test
10276 div with braces in attribute value
10277 !! options
10278 parsoid
10279 !! input
10280 <div title="{}">Foo</div>
10281 !! result
10282 <div title="{}">Foo</div>
10283 !! end
10284
10285 # This it very inconsistent in the PHP parser: it returns
10286 # class="class" if there is a space between the name and the equal sign (see
10287 # 'div with empty attribute value, space before equals'), but strips the
10288 # attribute completely if the space is missing. We hope that not much content
10289 # depends on this, so are implementing the behavior below in Parsoid for
10290 # consistencies' sake. Disabled for the PHP parser.
10291 # FIXME: fix this behavior in the PHP parser?
10292 !! test
10293 div with empty attribute value, no space before equals
10294 !! options
10295 parsoid
10296 !! input
10297 <div class=>HTML rocks</div>
10298 !! result
10299 <div class="">HTML rocks</div>
10300
10301 !! end
10302
10303 !! test
10304 HTML multiple attributes correction
10305 !! input
10306 <p class="error" class="awesome">Awesome!</p>
10307 !! result
10308 <p class="awesome">Awesome!</p>
10309
10310 !!end
10311
10312 !! test
10313 Table multiple attributes correction
10314 !! input
10315 {|
10316 !+ class="error" class="awesome"| status
10317 |}
10318 !! result
10319 <table>
10320 <tr>
10321 <th class="awesome"> status
10322 </th></tr></table>
10323
10324 !!end
10325
10326 !! test
10327 DIV IN UPPERCASE
10328 !! input
10329 <DIV ID="x">HTML ROCKS</DIV>
10330 !! result
10331 <div id="x">HTML ROCKS</div>
10332
10333 !!end
10334
10335 !! test
10336 Non-ASCII pseudo-tags are rendered as text
10337 !! input
10338 <khyô>
10339 !! result
10340 <p>&lt;khyô&gt;
10341 </p>
10342 !! end
10343
10344 !! test
10345 Pseudo-tag with URL 'name' renders as url link
10346 !! input
10347 <http://example.com/>
10348 !! result
10349 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
10350 </p>
10351 !! end
10352
10353 !! test
10354 text with amp in the middle of nowhere
10355 !! input
10356 Remember AT&T?
10357 !!result
10358 <p>Remember AT&amp;T?
10359 </p>
10360 !! end
10361
10362 !! test
10363 text with character entity: eacute
10364 !! input
10365 I always thought &eacute; was a cute letter.
10366 !! result
10367 <p>I always thought &#233; was a cute letter.
10368 </p>
10369 !! end
10370
10371 !! test
10372 text with entity-escaped character entity-like string: eacute
10373 !! input
10374 I always thought &amp;eacute; was a cute letter.
10375 !! result
10376 <p>I always thought &amp;eacute; was a cute letter.
10377 </p>
10378 !! end
10379
10380 !! test
10381 text with undefined character entity: xacute
10382 !! input
10383 I always thought &xacute; was a cute letter.
10384 !! result
10385 <p>I always thought &amp;xacute; was a cute letter.
10386 </p>
10387 !! end
10388
10389
10390 ###
10391 ### Nesting tests (see bug 41545, 50604, 51081)
10392 ###
10393
10394 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
10395 # Note that html2wt is considerably more difficult if we use <b> in
10396 # the test case, instead of <big>
10397 !! test
10398 Ensure that HTML adoption agency algorithm is properly implemented.
10399 !! input
10400 <big>X<big>Y</big>Z</big>
10401 !! result
10402 <p><big>X<big>Y</big>Z</big>
10403 </p>
10404 !! end
10405
10406 # This was bug 41545 in the PHP parser.
10407 !! test
10408 Nesting of <kbd>
10409 !! input
10410 <kbd>X<kbd>Y</kbd>Z</kbd>
10411 !! result
10412 <p><kbd>X<kbd>Y</kbd>Z</kbd>
10413 </p>
10414 !! end
10415
10416 # The following cases were bug 51081 in the PHP parser.
10417 # Note that there are some other nestable tags (b, i, etc) which are
10418 # not covered; see bug 51081 for discussion.
10419 !! test
10420 Nesting of <em>
10421 !! input
10422 <em>X<em>Y</em>Z</em>
10423 !! result
10424 <p><em>X<em>Y</em>Z</em>
10425 </p>
10426 !! end
10427
10428 !! test
10429 Nesting of <strong>
10430 !! input
10431 <strong>X<strong>Y</strong>Z</strong>
10432 !! result
10433 <p><strong>X<strong>Y</strong>Z</strong>
10434 </p>
10435 !! end
10436
10437 !! test
10438 Nesting of <q>
10439 !! input
10440 <q>X<q>Y</q>Z</q>
10441 !! result
10442 <p><q>X<q>Y</q>Z</q>
10443 </p>
10444 !! end
10445
10446 !! test
10447 Nesting of <ruby>
10448 !! input
10449 <ruby>X<ruby>Y</ruby>Z</ruby>
10450 !! result
10451 <p><ruby>X<ruby>Y</ruby>Z</ruby>
10452 </p>
10453 !! end
10454
10455 !! test
10456 Nesting of <bdo>
10457 !! input
10458 <bdo>X<bdo>Y</bdo>Z</bdo>
10459 !! result
10460 <p><bdo>X<bdo>Y</bdo>Z</bdo>
10461 </p>
10462 !! end
10463
10464
10465 ###
10466 ### Media links
10467 ###
10468
10469 !! test
10470 Media link
10471 !! input
10472 [[Media:Foobar.jpg]]
10473 !! result
10474 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
10475 </p>
10476 !! end
10477
10478 !! test
10479 Media link with text
10480 !! input
10481 [[Media:Foobar.jpg|A neat file to look at]]
10482 !! result
10483 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
10484 </p>
10485 !! end
10486
10487 # FIXME: this is still bad HTML tag nesting
10488 !! test
10489 Media link with nasty text
10490 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
10491 !! input
10492 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
10493 !! result
10494 <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>
10495
10496 !! end
10497
10498 !! test
10499 Media link to nonexistent file (bug 1702)
10500 !! input
10501 [[Media:No such.jpg]]
10502 !! result
10503 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
10504 </p>
10505 !! end
10506
10507 !! test
10508 Image link to nonexistent file (bug 1850 - good)
10509 !! input
10510 [[Image:No such.jpg]]
10511 !! result
10512 <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>
10513 </p>
10514 !! end
10515
10516 !! test
10517 :Image link to nonexistent file (bug 1850 - bad)
10518 !! input
10519 [[:Image:No such.jpg]]
10520 !! result
10521 <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>
10522 </p>
10523 !! end
10524
10525
10526
10527 !! test
10528 Character reference normalization in link text (bug 1938)
10529 !! input
10530 [[Main Page|this&that]]
10531 !! result
10532 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
10533 </p>
10534 !!end
10535
10536 !! article
10537 אַ
10538 !! text
10539 Test for unicode normalization
10540
10541 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
10542 !! endarticle
10543
10544 !! test
10545 (bug 19451) Links should refer to the normalized form.
10546 !! input
10547 [[&#xFB2E;]]
10548 [[&#x5d0;&#x5b7;]]
10549 [[&#x5d0;ַ]]
10550 [[א&#x5b7;]]
10551 [[אַ]]
10552 !! result
10553 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
10554 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
10555 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
10556 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
10557 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
10558 </p>
10559 !! end
10560
10561 !! test
10562 Empty attribute crash test (bug 2067)
10563 !! input
10564 <font color="">foo</font>
10565 !! result
10566 <p><font color="">foo</font>
10567 </p>
10568 !! end
10569
10570 !! test
10571 Empty attribute crash test single-quotes (bug 2067)
10572 !! input
10573 <font color=''>foo</font>
10574 !! result
10575 <p><font color="">foo</font>
10576 </p>
10577 !! end
10578
10579 !! test
10580 Attribute test: equals, then nothing
10581 !! input
10582 <font color=>foo</font>
10583 !! result
10584 <p><font>foo</font>
10585 </p>
10586 !! end
10587
10588 !! test
10589 Attribute test: unquoted value
10590 !! input
10591 <font color=x>foo</font>
10592 !! result
10593 <p><font color="x">foo</font>
10594 </p>
10595 !! end
10596
10597 !! test
10598 Attribute test: unquoted but illegal value (hash)
10599 !! input
10600 <font color=#x>foo</font>
10601 !! result
10602 <p><font color="#x">foo</font>
10603 </p>
10604 !! end
10605
10606 !! test
10607 Attribute test: no value
10608 !! input
10609 <font color>foo</font>
10610 !! result
10611 <p><font color="color">foo</font>
10612 </p>
10613 !! end
10614
10615 !! test
10616 Bug 2095: link with three closing brackets
10617 !! input
10618 [[Main Page]]]
10619 !! result
10620 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
10621 </p>
10622 !! end
10623
10624 !! test
10625 Bug 2095: link with pipe and three closing brackets
10626 !! input
10627 [[Main Page|link]]]
10628 !! result
10629 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
10630 </p>
10631 !! end
10632
10633 !! test
10634 Bug 2095: link with pipe and three closing brackets, version 2
10635 !! input
10636 [[Main Page|[http://example.com/]]]
10637 !! result
10638 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
10639 </p>
10640 !! end
10641
10642
10643 ###
10644 ### Safety
10645 ###
10646
10647 !! article
10648 Template:Dangerous attribute
10649 !! text
10650 " onmouseover="alert(document.cookie)
10651 !! endarticle
10652
10653 !! article
10654 Template:Dangerous style attribute
10655 !! text
10656 border-size: expression(alert(document.cookie))
10657 !! endarticle
10658
10659 !! article
10660 Template:Div style
10661 !! text
10662 <div style="float: right; {{{1}}}">Magic div</div>
10663 !! endarticle
10664
10665 !! test
10666 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
10667 !! input
10668 <div title="{{test}}"></div>
10669 !! result
10670 <div title="This is a test template"></div>
10671
10672 !! end
10673
10674 !! test
10675 Bug 2304: HTML attribute safety (dangerous template; 2309)
10676 !! input
10677 <div title="{{dangerous attribute}}"></div>
10678 !! result
10679 <div title=""></div>
10680
10681 !! end
10682
10683 !! test
10684 Bug 2304: HTML attribute safety (dangerous style template; 2309)
10685 !! input
10686 <div style="{{dangerous style attribute}}"></div>
10687 !! result
10688 <div style="/* insecure input */"></div>
10689
10690 !! end
10691
10692 !! test
10693 Bug 2304: HTML attribute safety (safe parameter; 2309)
10694 !! input
10695 {{div style|width: 200px}}
10696 !! result
10697 <div style="float: right; width: 200px">Magic div</div>
10698
10699 !! end
10700
10701 !! test
10702 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
10703 !! input
10704 {{div style|width: expression(alert(document.cookie))}}
10705 !! result
10706 <div style="/* insecure input */">Magic div</div>
10707
10708 !! end
10709
10710 !! test
10711 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
10712 !! input
10713 {{div style|"><script>alert(document.cookie)</script>}}
10714 !! result
10715 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10716
10717 !! end
10718
10719 !! test
10720 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
10721 !! input
10722 {{div style|" ><script>alert(document.cookie)</script>}}
10723 !! result
10724 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10725
10726 !! end
10727
10728 !! test
10729 Bug 2304: HTML attribute safety (link)
10730 !! input
10731 <div title="[[Main Page]]"></div>
10732 !! result
10733 <div title="&#91;&#91;Main Page]]"></div>
10734
10735 !! end
10736
10737 !! test
10738 Bug 2304: HTML attribute safety (italics)
10739 !! input
10740 <div title="''foobar''"></div>
10741 !! result
10742 <div title="&#39;&#39;foobar&#39;&#39;"></div>
10743
10744 !! end
10745
10746 !! test
10747 Bug 2304: HTML attribute safety (bold)
10748 !! input
10749 <div title="'''foobar'''"></div>
10750 !! result
10751 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
10752
10753 !! end
10754
10755
10756 !! test
10757 Bug 2304: HTML attribute safety (ISBN)
10758 !! input
10759 <div title="ISBN 1234567890"></div>
10760 !! result
10761 <div title="&#73;SBN 1234567890"></div>
10762
10763 !! end
10764
10765 !! test
10766 Bug 2304: HTML attribute safety (RFC)
10767 !! input
10768 <div title="RFC 1234"></div>
10769 !! result
10770 <div title="&#82;FC 1234"></div>
10771
10772 !! end
10773
10774 !! test
10775 Bug 2304: HTML attribute safety (PMID)
10776 !! input
10777 <div title="PMID 1234567890"></div>
10778 !! result
10779 <div title="&#80;MID 1234567890"></div>
10780
10781 !! end
10782
10783 !! test
10784 Bug 2304: HTML attribute safety (web link)
10785 !! input
10786 <div title="http://example.com/"></div>
10787 !! result
10788 <div title="http&#58;//example.com/"></div>
10789
10790 !! end
10791
10792 !! test
10793 Bug 2304: HTML attribute safety (named web link)
10794 !! input
10795 <div title="[http://example.com/ link]"></div>
10796 !! result
10797 <div title="&#91;http&#58;//example.com/ link]"></div>
10798
10799 !! end
10800
10801 !! test
10802 Bug 3244: HTML attribute safety (extension; safe)
10803 !! input
10804 <div style="<nowiki>background:blue</nowiki>"></div>
10805 !! result
10806 <div style="background:blue"></div>
10807
10808 !! end
10809
10810 !! test
10811 Bug 3244: HTML attribute safety (extension; unsafe)
10812 !! input
10813 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
10814 !! result
10815 <div style="/* insecure input */"></div>
10816
10817 !! end
10818
10819 # More MSIE fun discovered by Tom Gilder
10820
10821 !! test
10822 MSIE CSS safety test: spurious slash
10823 !! input
10824 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
10825 !! result
10826 <div style="/* insecure input */">evil</div>
10827
10828 !! end
10829
10830 !! test
10831 MSIE CSS safety test: hex code
10832 !! input
10833 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
10834 !! result
10835 <div style="/* insecure input */">evil</div>
10836
10837 !! end
10838
10839 !! test
10840 MSIE CSS safety test: comment in url
10841 !! input
10842 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
10843 !! result
10844 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
10845
10846 !! end
10847
10848 !! test
10849 MSIE CSS safety test: comment in expression
10850 !! input
10851 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
10852 !! result
10853 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
10854
10855 !! end
10856
10857
10858 !! test
10859 Table attribute legitimate extension
10860 !! input
10861 {|
10862 !+ style="<nowiki>color:blue</nowiki>"| status
10863 |}
10864 !! result
10865 <table>
10866 <tr>
10867 <th style="color:blue"> status
10868 </th></tr></table>
10869
10870 !!end
10871
10872 !! test
10873 Table attribute safety
10874 !! input
10875 {|
10876 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
10877 |}
10878 !! result
10879 <table>
10880 <tr>
10881 <th style="/* insecure input */"> status
10882 </th></tr></table>
10883
10884 !! end
10885
10886 !! test
10887 CSS line continuation 1
10888 !! input
10889 <div style="background-image: u\&#10;rl(test.jpg);"></div>
10890 !! result
10891 <div style="/* insecure input */"></div>
10892
10893 !! end
10894
10895 !! test
10896 CSS line continuation 2
10897 !! input
10898 <div style="background-image: u\&#13;rl(test.jpg); "></div>
10899 !! result
10900 <div style="/* insecure input */"></div>
10901
10902 !! end
10903
10904 !! article
10905 Template:Identity
10906 !! text
10907 {{{1}}}
10908 !! endarticle
10909
10910 !! test
10911 Expansion of multi-line templates in attribute values (bug 6255)
10912 !! input
10913 <div style="background: {{identity|#00FF00}}">-</div>
10914 !! result
10915 <div style="background: #00FF00">-</div>
10916
10917 !! end
10918
10919
10920 !! test
10921 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
10922 !! input
10923 <div style="background:
10924 #00FF00">-</div>
10925 !! result
10926 <div style="background: #00FF00">-</div>
10927
10928 !! end
10929
10930 !! test
10931 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
10932 !! input
10933 <div style="background: &#10;#00FF00">-</div>
10934 !! result
10935 <div style="background: &#10;#00FF00">-</div>
10936
10937 !! end
10938
10939 ###
10940 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
10941 ###
10942 !! test
10943 Parser hook: empty input
10944 !! input
10945 <tag></tag>
10946 !! result
10947 <pre>
10948 ''
10949 array (
10950 )
10951 </pre>
10952
10953 !! end
10954
10955 !! test
10956 Parser hook: empty input using terminated empty elements
10957 !! input
10958 <tag/>
10959 !! result
10960 <pre>
10961 NULL
10962 array (
10963 )
10964 </pre>
10965
10966 !! end
10967
10968 !! test
10969 Parser hook: empty input using terminated empty elements (space before)
10970 !! input
10971 <tag />
10972 !! result
10973 <pre>
10974 NULL
10975 array (
10976 )
10977 </pre>
10978
10979 !! end
10980
10981 !! test
10982 Parser hook: basic input
10983 !! input
10984 <tag>input</tag>
10985 !! result
10986 <pre>
10987 'input'
10988 array (
10989 )
10990 </pre>
10991
10992 !! end
10993
10994
10995 !! test
10996 Parser hook: case insensitive
10997 !! input
10998 <TAG>input</TAG>
10999 !! result
11000 <pre>
11001 'input'
11002 array (
11003 )
11004 </pre>
11005
11006 !! end
11007
11008
11009 !! test
11010 Parser hook: case insensitive, redux
11011 !! input
11012 <TaG>input</TAg>
11013 !! result
11014 <pre>
11015 'input'
11016 array (
11017 )
11018 </pre>
11019
11020 !! end
11021
11022 !! test
11023 Parser hook: nested tags
11024 !! options
11025 noxml
11026 !! input
11027 <tag><tag></tag></tag>
11028 !! result
11029 <pre>
11030 '<tag>'
11031 array (
11032 )
11033 </pre>&lt;/tag&gt;
11034
11035 !! end
11036
11037 !! test
11038 Parser hook: basic arguments
11039 !! input
11040 <tag width=200 height = "100" depth = '50' square></tag>
11041 !! result
11042 <pre>
11043 ''
11044 array (
11045 'width' => '200',
11046 'height' => '100',
11047 'depth' => '50',
11048 'square' => 'square',
11049 )
11050 </pre>
11051
11052 !! end
11053
11054 !! test
11055 Parser hook: argument containing a forward slash (bug 5344)
11056 !! input
11057 <tag filename='/tmp/bla'></tag>
11058 !! result
11059 <pre>
11060 ''
11061 array (
11062 'filename' => '/tmp/bla',
11063 )
11064 </pre>
11065
11066 !! end
11067
11068 !! test
11069 Parser hook: empty input using terminated empty elements (bug 2374)
11070 !! input
11071 <tag foo=bar/>text
11072 !! result
11073 <pre>
11074 NULL
11075 array (
11076 'foo' => 'bar',
11077 )
11078 </pre>text
11079
11080 !! end
11081
11082 # </tag> should be output literally since there is no matching tag that begins it
11083 !! test
11084 Parser hook: basic arguments using terminated empty elements (bug 2374)
11085 !! input
11086 <tag width=200 height = "100" depth = '50' square/>
11087 other stuff
11088 </tag>
11089 !! result
11090 <pre>
11091 NULL
11092 array (
11093 'width' => '200',
11094 'height' => '100',
11095 'depth' => '50',
11096 'square' => 'square',
11097 )
11098 </pre>
11099 <p>other stuff
11100 &lt;/tag&gt;
11101 </p>
11102 !! end
11103
11104 ###
11105 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
11106 ###
11107
11108 !! test
11109 Parser hook: static parser hook not inside a comment
11110 !! input
11111 <statictag>hello, world</statictag>
11112 <statictag action=flush/>
11113 !! result
11114 <p>hello, world
11115 </p>
11116 !! end
11117
11118
11119 !! test
11120 Parser hook: static parser hook inside a comment
11121 !! input
11122 <!-- <statictag>hello, world</statictag> -->
11123 <statictag action=flush/>
11124 !! result
11125 <p><br />
11126 </p>
11127 !! end
11128
11129 # Nested template calls; this case was broken by Parser.php rev 1.506,
11130 # since reverted.
11131
11132 !! article
11133 Template:One-parameter
11134 !! text
11135 (My parameter is: {{{1}}})
11136 !! endarticle
11137
11138 !! article
11139 Template:Map-one-parameter
11140 !! text
11141 {{{{{1}}}|{{{2}}}}}
11142 !! endarticle
11143
11144 !! test
11145 Nested template calls
11146 !! input
11147 {{Map-one-parameter|One-parameter|param}}
11148 !! result
11149 <p>(My parameter is: param)
11150 </p>
11151 !! end
11152
11153
11154 ###
11155 ### Sanitizer
11156 ###
11157 !! test
11158 Sanitizer: Closing of open tags
11159 !! input
11160 <s></s><table></table>
11161 !! result
11162 <s></s><table></table>
11163
11164 !! end
11165
11166 !! test
11167 Sanitizer: Closing of open but not closed tags
11168 !! input
11169 <s>foo
11170 !! result
11171 <p><s>foo</s>
11172 </p>
11173 !! end
11174
11175 !! test
11176 Sanitizer: Closing of closed but not open tags
11177 !! input
11178 </s>
11179 !! result
11180 <p>&lt;/s&gt;
11181 </p>
11182 !! end
11183
11184 !! test
11185 Sanitizer: Closing of closed but not open table tags
11186 !! input
11187 Table not started</td></tr></table>
11188 !! result
11189 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
11190 </p>
11191 !! end
11192
11193 !! test
11194 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
11195 !! input
11196 <span id="æ: v">byte</span>[[#æ: v|backlink]]
11197 !! result
11198 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
11199 </p>
11200 !! end
11201
11202 !! test
11203 Sanitizer: Validating the contents of the id attribute (bug 4515)
11204 !! options
11205 disabled
11206 !! input
11207 <br id=9 />
11208 !! result
11209 Something, but definitely not <br id="9" />...
11210 !! end
11211
11212 !! test
11213 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
11214 !! options
11215 disabled
11216 !! input
11217 <br id="foo" /><br id="foo" />
11218 !! result
11219 Something need to be done. foo-2 ?
11220 !! end
11221
11222 !! test
11223 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
11224 !! input
11225 <div itemscope>
11226 <meta itemprop="hello" content="world">
11227 <meta http-equiv="refresh" content="5">
11228 <meta itemprop="hello" http-equiv="refresh" content="5">
11229 <link itemprop="hello" href="{{SERVER}}">
11230 <link rel="stylesheet" href="{{SERVER}}">
11231 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
11232 </div>
11233 !! result
11234 <div itemscope="itemscope">
11235 <p> <meta itemprop="hello" content="world" />
11236 &lt;meta http-equiv="refresh" content="5"&gt;
11237 <meta itemprop="hello" content="5" />
11238 </p>
11239 <link itemprop="hello" href="http&#58;//example.org" />
11240 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
11241 <link itemprop="hello" href="http&#58;//example.org" />
11242 </div>
11243
11244 !! end
11245
11246 !! test
11247 Language converter: output gets cut off unexpectedly (bug 5757)
11248 !! options
11249 language=zh
11250 !! input
11251 this bit is safe: }-
11252
11253 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
11254
11255 then we get cut off here: }-
11256
11257 all additional text is vanished
11258 !! result
11259 <p>this bit is safe: }-
11260 </p><p>but if we add a conversion instance: xxx
11261 </p><p>then we get cut off here: }-
11262 </p><p>all additional text is vanished
11263 </p>
11264 !! end
11265
11266 !! test
11267 Self closed html pairs (bug 5487)
11268 !! options
11269 !! input
11270 <center><font id="bug" />Centered text</center>
11271 <div><font id="bug2" />In div text</div>
11272 !! result
11273 <center>&lt;font id="bug" /&gt;Centered text</center>
11274 <div>&lt;font id="bug2" /&gt;In div text</div>
11275
11276 !! end
11277
11278 #
11279 #
11280 #
11281
11282 !! test
11283 Punctuation: nbsp before exclamation
11284 !! input
11285 C'est grave !
11286 !! result
11287 <p>C'est grave&#160;!
11288 </p>
11289 !! end
11290
11291 !! test
11292 Punctuation: CSS !important (bug 11874)
11293 !! input
11294 <div style="width:50% !important">important</div>
11295 !! result
11296 <div style="width:50% !important">important</div>
11297
11298 !!end
11299
11300 !! test
11301 Punctuation: CSS ! important (bug 11874; with space after)
11302 !! input
11303 <div style="width:50% ! important">important</div>
11304 !! result
11305 <div style="width:50% ! important">important</div>
11306
11307 !!end
11308
11309
11310 !! test
11311 HTML bullet list, closed tags (bug 5497)
11312 !! input
11313 <ul>
11314 <li>One</li>
11315 <li>Two</li>
11316 </ul>
11317 !! result
11318 <ul>
11319 <li>One</li>
11320 <li>Two</li>
11321 </ul>
11322
11323 !! end
11324
11325 !! test
11326 HTML bullet list, unclosed tags (bug 5497)
11327 !! options
11328 disabled
11329 !! input
11330 <ul>
11331 <li>One
11332 <li>Two
11333 </ul>
11334 !! result
11335 <ul>
11336 <li>One
11337 </li><li>Two
11338 </li></ul>
11339
11340 !! end
11341
11342 !! test
11343 HTML ordered list, closed tags (bug 5497)
11344 !! input
11345 <ol>
11346 <li>One</li>
11347 <li>Two</li>
11348 </ol>
11349 !! result
11350 <ol>
11351 <li>One</li>
11352 <li>Two</li>
11353 </ol>
11354
11355 !! end
11356
11357 !! test
11358 HTML ordered list, unclosed tags (bug 5497)
11359 !! options
11360 disabled
11361 !! input
11362 <ol>
11363 <li>One
11364 <li>Two
11365 </ol>
11366 !! result
11367 <ol>
11368 <li>One
11369 </li><li>Two
11370 </li></ol>
11371
11372 !! end
11373
11374 !! test
11375 HTML nested bullet list, closed tags (bug 5497)
11376 !! input
11377 <ul>
11378 <li>One</li>
11379 <li>Two:
11380 <ul>
11381 <li>Sub-one</li>
11382 <li>Sub-two</li>
11383 </ul>
11384 </li>
11385 </ul>
11386 !! result
11387 <ul>
11388 <li>One</li>
11389 <li>Two:
11390 <ul>
11391 <li>Sub-one</li>
11392 <li>Sub-two</li>
11393 </ul>
11394 </li>
11395 </ul>
11396
11397 !! end
11398
11399 !! test
11400 HTML nested bullet list, open tags (bug 5497)
11401 !! options
11402 disabled
11403 !! input
11404 <ul>
11405 <li>One
11406 <li>Two:
11407 <ul>
11408 <li>Sub-one
11409 <li>Sub-two
11410 </ul>
11411 </ul>
11412 !! result
11413 <ul>
11414 <li>One
11415 </li><li>Two:
11416 <ul>
11417 <li>Sub-one
11418 </li><li>Sub-two
11419 </li></ul>
11420 </li></ul>
11421
11422 !! end
11423
11424 !! test
11425 HTML nested ordered list, closed tags (bug 5497)
11426 !! input
11427 <ol>
11428 <li>One</li>
11429 <li>Two:
11430 <ol>
11431 <li>Sub-one</li>
11432 <li>Sub-two</li>
11433 </ol>
11434 </li>
11435 </ol>
11436 !! result
11437 <ol>
11438 <li>One</li>
11439 <li>Two:
11440 <ol>
11441 <li>Sub-one</li>
11442 <li>Sub-two</li>
11443 </ol>
11444 </li>
11445 </ol>
11446
11447 !! end
11448
11449 !! test
11450 HTML nested ordered list, open tags (bug 5497)
11451 !! options
11452 disabled
11453 !! input
11454 <ol>
11455 <li>One
11456 <li>Two:
11457 <ol>
11458 <li>Sub-one
11459 <li>Sub-two
11460 </ol>
11461 </ol>
11462 !! result
11463 <ol>
11464 <li>One
11465 </li><li>Two:
11466 <ol>
11467 <li>Sub-one
11468 </li><li>Sub-two
11469 </li></ol>
11470 </li></ol>
11471
11472 !! end
11473
11474 !! test
11475 HTML ordered list item with parameters oddity
11476 !! input
11477 <ol><li id="fragment">One</li></ol>
11478 !! result
11479 <ol><li id="fragment">One</li></ol>
11480
11481 !! end
11482
11483 !!test
11484 bug 5918: autonumbering
11485 !! input
11486 [http://first/] [http://second] [ftp://ftp]
11487
11488 ftp://inlineftp
11489
11490 [mailto:enclosed@mail.tld With target]
11491
11492 [mailto:enclosed@mail.tld]
11493
11494 mailto:inline@mail.tld
11495 !! result
11496 <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>
11497 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
11498 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
11499 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
11500 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
11501 </p>
11502 !! end
11503
11504
11505 #
11506 # Security and HTML correctness
11507 # From Nick Jenkins' fuzz testing
11508 #
11509
11510 !! test
11511 Fuzz testing: Parser13
11512 !! input
11513 {|
11514 | http://a|
11515 !! result
11516 <table>
11517 <tr>
11518 <td>
11519 </td>
11520 </tr>
11521 </table>
11522
11523 !! end
11524
11525 !! test
11526 Fuzz testing: Parser14
11527 !! input
11528 == onmouseover= ==
11529 http://__TOC__
11530 !! result
11531 <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>
11532 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11533 <ul>
11534 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
11535 </ul>
11536 </div>
11537
11538 !! end
11539
11540 !! test
11541 Fuzz testing: Parser14-table
11542 !! input
11543 ==a==
11544 {| STYLE=__TOC__
11545 !! result
11546 <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>
11547 <table style="&#95;_TOC&#95;_">
11548 <tr><td></td></tr>
11549 </table>
11550
11551 !! end
11552
11553 # Known to produce bogus xml (extra </td>)
11554 !! test
11555 Fuzz testing: Parser16
11556 !! options
11557 noxml
11558 !! input
11559 {|
11560 !https://||||||
11561 !! result
11562 <table>
11563 <tr>
11564 <th>https://</th>
11565 <th></th>
11566 <th></th>
11567 <th>
11568 </td>
11569 </tr>
11570 </table>
11571
11572 !! end
11573
11574 !! test
11575 Fuzz testing: Parser21
11576 !! input
11577 {|
11578 ! irc://{{ftp://a" onmouseover="alert('hello world');"
11579 |
11580 !! result
11581 <table>
11582 <tr>
11583 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
11584 </th>
11585 <td>
11586 </td>
11587 </tr>
11588 </table>
11589
11590 !! end
11591
11592 !! test
11593 Fuzz testing: Parser22
11594 !! input
11595 http://===r:::https://b
11596
11597 {|
11598 !!result
11599 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
11600 </p>
11601 <table>
11602 <tr><td></td></tr>
11603 </table>
11604
11605 !! end
11606
11607 # Known to produce bad XML for now
11608 !! test
11609 Fuzz testing: Parser24
11610 !! options
11611 noxml
11612 !! input
11613 {|
11614 {{{|
11615 <u CLASS=
11616 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
11617 <br style="onmouseover='alert(document.cookie);' " />
11618
11619 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11620 |
11621 !! result
11622 <table>
11623 {{{|
11624 <u class="&#124;">}}}} &gt;
11625 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
11626
11627 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11628 <tr>
11629 <td></u>
11630 </td>
11631 </tr>
11632 </table>
11633
11634 !! end
11635
11636 # Note: the current result listed for this is not what the original one was,
11637 # but the original bug was JavaScript injection, which is fixed in any case.
11638 # It's not clear that the original result listed was any more correct than the
11639 # current one. Original result:
11640 # <p>{{{|
11641 # </p>
11642 # <li class="&#124;&#124;">
11643 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11644 !!test
11645 Fuzz testing: Parser25 (bug 6055)
11646 !! input
11647 {{{
11648 |
11649 <LI CLASS=||
11650 >
11651 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
11652 !! result
11653 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11654 </p>
11655 !! end
11656
11657 !!test
11658 Fuzz testing: URL adjacent extension (with space, clean)
11659 !! options
11660 !! input
11661 http://example.com <nowiki>junk</nowiki>
11662 !! result
11663 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
11664 </p>
11665 !!end
11666
11667 !!test
11668 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
11669 !! options
11670 !! input
11671 http://example.com<nowiki>junk</nowiki>
11672 !! result
11673 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
11674 </p>
11675 !!end
11676
11677 !!test
11678 Fuzz testing: URL adjacent extension (no space, dirty; pre)
11679 !! options
11680 !! input
11681 http://example.com<pre>junk</pre>
11682 !! result
11683 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
11684
11685 !!end
11686
11687 !!test
11688 Fuzz testing: image with bogus manual thumbnail
11689 !!input
11690 [[Image:foobar.jpg|thumbnail= ]]
11691 !!result
11692 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
11693
11694 !!end
11695
11696 !! test
11697 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
11698 !! input
11699 <pre dir="&#10;"></pre>
11700 !! result
11701 <pre dir="&#10;"></pre>
11702
11703 !! end
11704
11705 !! test
11706 Parsing optional HTML elements (Bug 6171)
11707 !! options
11708 !! input
11709 <table>
11710 <tr>
11711 <td> Some tabular data</td>
11712 <td> More tabular data ...
11713 <td> And yet som tabular data</td>
11714 </tr>
11715 </table>
11716 !! result
11717 <table>
11718 <tr>
11719 <td> Some tabular data</td>
11720 <td> More tabular data ...
11721 </td><td> And yet som tabular data</td>
11722 </tr>
11723 </table>
11724
11725 !! end
11726
11727 !! test
11728 Correct handling of <td>, <tr> (Bug 6171)
11729 !! options
11730 !! input
11731 <table>
11732 <tr>
11733 <td> Some tabular data</td>
11734 <td> More tabular data ...</td>
11735 <td> And yet som tabular data</td>
11736 </tr>
11737 </table>
11738 !! result
11739 <table>
11740 <tr>
11741 <td> Some tabular data</td>
11742 <td> More tabular data ...</td>
11743 <td> And yet som tabular data</td>
11744 </tr>
11745 </table>
11746
11747 !! end
11748
11749
11750 !! test
11751 Parsing crashing regression (fr:JavaScript)
11752 !! input
11753 </body></x>
11754 !! result
11755 <p>&lt;/body&gt;&lt;/x&gt;
11756 </p>
11757 !! end
11758
11759 !! test
11760 Inline wiki vs wiki block nesting
11761 !! input
11762 '''Bold paragraph
11763
11764 New wiki paragraph
11765 !! result
11766 <p><b>Bold paragraph</b>
11767 </p><p>New wiki paragraph
11768 </p>
11769 !! end
11770
11771 !! test
11772 Inline HTML vs wiki block nesting
11773 !! options
11774 disabled
11775 !! input
11776 <b>Bold paragraph
11777
11778 New wiki paragraph
11779 !! result
11780 <p><b>Bold paragraph</b>
11781 </p><p>New wiki paragraph
11782 </p>
11783 !! end
11784
11785 # Original result was this:
11786 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
11787 # </p>
11788 # While that might be marginally more intuitive, maybe, the six-apostrophe
11789 # construct is clearly pathological and the result stated here (which is what
11790 # the parser actually does) is about as reasonable as anything.
11791 !!test
11792 Mixing markup for italics and bold
11793 !! options
11794 !! input
11795 '''bold''''''bold''bolditalics'''''
11796 !! result
11797 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
11798 </p>
11799 !! end
11800
11801
11802 !! article
11803 Xyzzyx
11804 !! text
11805 Article for special page transclusion test
11806 !! endarticle
11807
11808 !! test
11809 Special page transclusion
11810 !! options
11811 !! input
11812 {{Special:Prefixindex/Xyzzyx}}
11813 !! result
11814 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11815
11816 !! end
11817
11818 !! test
11819 Special page transclusion twice (bug 5021)
11820 !! options
11821 !! input
11822 {{Special:Prefixindex/Xyzzyx}}
11823 {{Special:Prefixindex/Xyzzyx}}
11824 !! result
11825 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11826 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11827
11828 !! end
11829
11830 !! test
11831 Transclusion of default MediaWiki message
11832 !! input
11833 {{MediaWiki:Mainpage}}
11834 !!result
11835 <p>Main Page
11836 </p>
11837 !! end
11838
11839 !! test
11840 Transclusion of nonexistent MediaWiki message
11841 !! input
11842 {{MediaWiki:Mainpagexxx}}
11843 !!result
11844 <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>
11845 </p>
11846 !! end
11847
11848 !! test
11849 Transclusion of MediaWiki message with underscore
11850 !! input
11851 {{MediaWiki:history_short}}
11852 !! result
11853 <p>History
11854 </p>
11855 !! end
11856
11857 !! test
11858 Transclusion of MediaWiki message with space
11859 !! input
11860 {{MediaWiki:history short}}
11861 !! result
11862 <p>History
11863 </p>
11864 !! end
11865
11866 !! test
11867 Invalid header with following text
11868 !! input
11869 = x = y
11870 !! result
11871 <p>= x = y
11872 </p>
11873 !! end
11874
11875
11876 !! test
11877 Section extraction test (section 0)
11878 !! options
11879 section=0
11880 !! input
11881 start
11882 ==a==
11883 ===aa===
11884 ====aaa====
11885 ==b==
11886 ===ba===
11887 ===bb===
11888 ====bba====
11889 ===bc===
11890 ==c==
11891 ===ca===
11892 !! result
11893 start
11894 !! end
11895
11896 !! test
11897 Section extraction test (section 1)
11898 !! options
11899 section=1
11900 !! input
11901 start
11902 ==a==
11903 ===aa===
11904 ====aaa====
11905 ==b==
11906 ===ba===
11907 ===bb===
11908 ====bba====
11909 ===bc===
11910 ==c==
11911 ===ca===
11912 !! result
11913 ==a==
11914 ===aa===
11915 ====aaa====
11916 !! end
11917
11918 !! test
11919 Section extraction test (section 2)
11920 !! options
11921 section=2
11922 !! input
11923 start
11924 ==a==
11925 ===aa===
11926 ====aaa====
11927 ==b==
11928 ===ba===
11929 ===bb===
11930 ====bba====
11931 ===bc===
11932 ==c==
11933 ===ca===
11934 !! result
11935 ===aa===
11936 ====aaa====
11937 !! end
11938
11939 !! test
11940 Section extraction test (section 3)
11941 !! options
11942 section=3
11943 !! input
11944 start
11945 ==a==
11946 ===aa===
11947 ====aaa====
11948 ==b==
11949 ===ba===
11950 ===bb===
11951 ====bba====
11952 ===bc===
11953 ==c==
11954 ===ca===
11955 !! result
11956 ====aaa====
11957 !! end
11958
11959 !! test
11960 Section extraction test (section 4)
11961 !! options
11962 section=4
11963 !! input
11964 start
11965 ==a==
11966 ===aa===
11967 ====aaa====
11968 ==b==
11969 ===ba===
11970 ===bb===
11971 ====bba====
11972 ===bc===
11973 ==c==
11974 ===ca===
11975 !! result
11976 ==b==
11977 ===ba===
11978 ===bb===
11979 ====bba====
11980 ===bc===
11981 !! end
11982
11983 !! test
11984 Section extraction test (section 5)
11985 !! options
11986 section=5
11987 !! input
11988 start
11989 ==a==
11990 ===aa===
11991 ====aaa====
11992 ==b==
11993 ===ba===
11994 ===bb===
11995 ====bba====
11996 ===bc===
11997 ==c==
11998 ===ca===
11999 !! result
12000 ===ba===
12001 !! end
12002
12003 !! test
12004 Section extraction test (section 6)
12005 !! options
12006 section=6
12007 !! input
12008 start
12009 ==a==
12010 ===aa===
12011 ====aaa====
12012 ==b==
12013 ===ba===
12014 ===bb===
12015 ====bba====
12016 ===bc===
12017 ==c==
12018 ===ca===
12019 !! result
12020 ===bb===
12021 ====bba====
12022 !! end
12023
12024 !! test
12025 Section extraction test (section 7)
12026 !! options
12027 section=7
12028 !! input
12029 start
12030 ==a==
12031 ===aa===
12032 ====aaa====
12033 ==b==
12034 ===ba===
12035 ===bb===
12036 ====bba====
12037 ===bc===
12038 ==c==
12039 ===ca===
12040 !! result
12041 ====bba====
12042 !! end
12043
12044 !! test
12045 Section extraction test (section 8)
12046 !! options
12047 section=8
12048 !! input
12049 start
12050 ==a==
12051 ===aa===
12052 ====aaa====
12053 ==b==
12054 ===ba===
12055 ===bb===
12056 ====bba====
12057 ===bc===
12058 ==c==
12059 ===ca===
12060 !! result
12061 ===bc===
12062 !! end
12063
12064 !! test
12065 Section extraction test (section 9)
12066 !! options
12067 section=9
12068 !! input
12069 start
12070 ==a==
12071 ===aa===
12072 ====aaa====
12073 ==b==
12074 ===ba===
12075 ===bb===
12076 ====bba====
12077 ===bc===
12078 ==c==
12079 ===ca===
12080 !! result
12081 ==c==
12082 ===ca===
12083 !! end
12084
12085 !! test
12086 Section extraction test (section 10)
12087 !! options
12088 section=10
12089 !! input
12090 start
12091 ==a==
12092 ===aa===
12093 ====aaa====
12094 ==b==
12095 ===ba===
12096 ===bb===
12097 ====bba====
12098 ===bc===
12099 ==c==
12100 ===ca===
12101 !! result
12102 ===ca===
12103 !! end
12104
12105 !! test
12106 Section extraction test (nonexistent section 11)
12107 !! options
12108 section=11
12109 !! input
12110 start
12111 ==a==
12112 ===aa===
12113 ====aaa====
12114 ==b==
12115 ===ba===
12116 ===bb===
12117 ====bba====
12118 ===bc===
12119 ==c==
12120 ===ca===
12121 !! result
12122 !! end
12123
12124 !! test
12125 Section extraction test with bogus heading (section 1)
12126 !! options
12127 section=1
12128 !! input
12129 ==a==
12130 ==bogus== not a legal section
12131 ==b==
12132 !! result
12133 ==a==
12134 ==bogus== not a legal section
12135 !! end
12136
12137 !! test
12138 Section extraction test with bogus heading (section 2)
12139 !! options
12140 section=2
12141 !! input
12142 ==a==
12143 ==bogus== not a legal section
12144 ==b==
12145 !! result
12146 ==b==
12147 !! end
12148
12149 !! test
12150 Section extraction test with comment after heading (section 1)
12151 !! options
12152 section=1
12153 !! input
12154 ==a==
12155 ==b== <!-- -->
12156 ==c==
12157 !! result
12158 ==a==
12159 !! end
12160
12161 !! test
12162 Section extraction test with comment after heading (section 2)
12163 !! options
12164 section=2
12165 !! input
12166 ==a==
12167 ==b== <!-- -->
12168 ==c==
12169 !! result
12170 ==b== <!-- -->
12171 !! end
12172
12173 !! test
12174 Section extraction test with bogus <nowiki> heading (section 1)
12175 !! options
12176 section=1
12177 !! input
12178 ==a==
12179 ==bogus== <nowiki>not a legal section</nowiki>
12180 ==b==
12181 !! result
12182 ==a==
12183 ==bogus== <nowiki>not a legal section</nowiki>
12184 !! end
12185
12186 !! test
12187 Section extraction test with bogus <nowiki> heading (section 2)
12188 !! options
12189 section=2
12190 !! input
12191 ==a==
12192 ==bogus== <nowiki>not a legal section</nowiki>
12193 ==b==
12194 !! result
12195 ==b==
12196 !! end
12197
12198
12199 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
12200 # instead of respecting commented sections
12201 !! test
12202 Section extraction prefixed by comment (section 1)
12203 !! options
12204 section=1
12205 !! input
12206 <!-- -->==sec1==
12207 ==sec2==
12208 !!result
12209 ==sec2==
12210 !!end
12211
12212 !! test
12213 Section extraction prefixed by comment (section 2)
12214 !! options
12215 section=2
12216 !! input
12217 <!-- -->==sec1==
12218 ==sec2==
12219 !!result
12220
12221 !!end
12222
12223
12224 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
12225 # instead of respecting HTML-style headings
12226 !! test
12227 Section extraction, mixed wiki and html (section 1)
12228 !! options
12229 section=1
12230 !! input
12231 <h2>unmarked</h2>
12232 unmarked
12233 ==1==
12234 one
12235 ==2==
12236 two
12237 !! result
12238 ==1==
12239 one
12240 !! end
12241
12242 !! test
12243 Section extraction, mixed wiki and html (section 2)
12244 !! options
12245 section=2
12246 !! input
12247 <h2>unmarked</h2>
12248 unmarked
12249 ==1==
12250 one
12251 ==2==
12252 two
12253 !! result
12254 ==2==
12255 two
12256 !! end
12257
12258
12259 # Formerly testing for bug 3342
12260 !! test
12261 Section extraction, heading surrounded by <noinclude>
12262 !! options
12263 section=1
12264 !! input
12265 <noinclude>==unmarked==</noinclude>
12266 ==marked==
12267 !! result
12268 ==marked==
12269 !!end
12270
12271 # Test behavior of bug 19910
12272 !! test
12273 Sectiion with all-equals
12274 !! options
12275 section=2
12276 !! input
12277 ===
12278 The line above must have a trailing space
12279 === <!--
12280 --> <!-- -->
12281 But just in case it doesn't...
12282 !! result
12283 === <!--
12284 --> <!-- -->
12285 But just in case it doesn't...
12286 !! end
12287
12288 !! test
12289 Section replacement test (section 0)
12290 !! options
12291 replace=0,"xxx"
12292 !! input
12293 start
12294 ==a==
12295 ===aa===
12296 ====aaa====
12297 ==b==
12298 ===ba===
12299 ===bb===
12300 ====bba====
12301 ===bc===
12302 ==c==
12303 ===ca===
12304 !! result
12305 xxx
12306
12307 ==a==
12308 ===aa===
12309 ====aaa====
12310 ==b==
12311 ===ba===
12312 ===bb===
12313 ====bba====
12314 ===bc===
12315 ==c==
12316 ===ca===
12317 !! end
12318
12319 !! test
12320 Section replacement test (section 1)
12321 !! options
12322 replace=1,"xxx"
12323 !! input
12324 start
12325 ==a==
12326 ===aa===
12327 ====aaa====
12328 ==b==
12329 ===ba===
12330 ===bb===
12331 ====bba====
12332 ===bc===
12333 ==c==
12334 ===ca===
12335 !! result
12336 start
12337 xxx
12338
12339 ==b==
12340 ===ba===
12341 ===bb===
12342 ====bba====
12343 ===bc===
12344 ==c==
12345 ===ca===
12346 !! end
12347
12348 !! test
12349 Section replacement test (section 2)
12350 !! options
12351 replace=2,"xxx"
12352 !! input
12353 start
12354 ==a==
12355 ===aa===
12356 ====aaa====
12357 ==b==
12358 ===ba===
12359 ===bb===
12360 ====bba====
12361 ===bc===
12362 ==c==
12363 ===ca===
12364 !! result
12365 start
12366 ==a==
12367 xxx
12368
12369 ==b==
12370 ===ba===
12371 ===bb===
12372 ====bba====
12373 ===bc===
12374 ==c==
12375 ===ca===
12376 !! end
12377
12378 !! test
12379 Section replacement test (section 3)
12380 !! options
12381 replace=3,"xxx"
12382 !! input
12383 start
12384 ==a==
12385 ===aa===
12386 ====aaa====
12387 ==b==
12388 ===ba===
12389 ===bb===
12390 ====bba====
12391 ===bc===
12392 ==c==
12393 ===ca===
12394 !! result
12395 start
12396 ==a==
12397 ===aa===
12398 xxx
12399
12400 ==b==
12401 ===ba===
12402 ===bb===
12403 ====bba====
12404 ===bc===
12405 ==c==
12406 ===ca===
12407 !! end
12408
12409 !! test
12410 Section replacement test (section 4)
12411 !! options
12412 replace=4,"xxx"
12413 !! input
12414 start
12415 ==a==
12416 ===aa===
12417 ====aaa====
12418 ==b==
12419 ===ba===
12420 ===bb===
12421 ====bba====
12422 ===bc===
12423 ==c==
12424 ===ca===
12425 !! result
12426 start
12427 ==a==
12428 ===aa===
12429 ====aaa====
12430 xxx
12431
12432 ==c==
12433 ===ca===
12434 !! end
12435
12436 !! test
12437 Section replacement test (section 5)
12438 !! options
12439 replace=5,"xxx"
12440 !! input
12441 start
12442 ==a==
12443 ===aa===
12444 ====aaa====
12445 ==b==
12446 ===ba===
12447 ===bb===
12448 ====bba====
12449 ===bc===
12450 ==c==
12451 ===ca===
12452 !! result
12453 start
12454 ==a==
12455 ===aa===
12456 ====aaa====
12457 ==b==
12458 xxx
12459
12460 ===bb===
12461 ====bba====
12462 ===bc===
12463 ==c==
12464 ===ca===
12465 !! end
12466
12467 !! test
12468 Section replacement test (section 6)
12469 !! options
12470 replace=6,"xxx"
12471 !! input
12472 start
12473 ==a==
12474 ===aa===
12475 ====aaa====
12476 ==b==
12477 ===ba===
12478 ===bb===
12479 ====bba====
12480 ===bc===
12481 ==c==
12482 ===ca===
12483 !! result
12484 start
12485 ==a==
12486 ===aa===
12487 ====aaa====
12488 ==b==
12489 ===ba===
12490 xxx
12491
12492 ===bc===
12493 ==c==
12494 ===ca===
12495 !! end
12496
12497 !! test
12498 Section replacement test (section 7)
12499 !! options
12500 replace=7,"xxx"
12501 !! input
12502 start
12503 ==a==
12504 ===aa===
12505 ====aaa====
12506 ==b==
12507 ===ba===
12508 ===bb===
12509 ====bba====
12510 ===bc===
12511 ==c==
12512 ===ca===
12513 !! result
12514 start
12515 ==a==
12516 ===aa===
12517 ====aaa====
12518 ==b==
12519 ===ba===
12520 ===bb===
12521 xxx
12522
12523 ===bc===
12524 ==c==
12525 ===ca===
12526 !! end
12527
12528 !! test
12529 Section replacement test (section 8)
12530 !! options
12531 replace=8,"xxx"
12532 !! input
12533 start
12534 ==a==
12535 ===aa===
12536 ====aaa====
12537 ==b==
12538 ===ba===
12539 ===bb===
12540 ====bba====
12541 ===bc===
12542 ==c==
12543 ===ca===
12544 !! result
12545 start
12546 ==a==
12547 ===aa===
12548 ====aaa====
12549 ==b==
12550 ===ba===
12551 ===bb===
12552 ====bba====
12553 xxx
12554
12555 ==c==
12556 ===ca===
12557 !!end
12558
12559 !! test
12560 Section replacement test (section 9)
12561 !! options
12562 replace=9,"xxx"
12563 !! input
12564 start
12565 ==a==
12566 ===aa===
12567 ====aaa====
12568 ==b==
12569 ===ba===
12570 ===bb===
12571 ====bba====
12572 ===bc===
12573 ==c==
12574 ===ca===
12575 !! result
12576 start
12577 ==a==
12578 ===aa===
12579 ====aaa====
12580 ==b==
12581 ===ba===
12582 ===bb===
12583 ====bba====
12584 ===bc===
12585 xxx
12586 !! end
12587
12588 !! test
12589 Section replacement test (section 10)
12590 !! options
12591 replace=10,"xxx"
12592 !! input
12593 start
12594 ==a==
12595 ===aa===
12596 ====aaa====
12597 ==b==
12598 ===ba===
12599 ===bb===
12600 ====bba====
12601 ===bc===
12602 ==c==
12603 ===ca===
12604 !! result
12605 start
12606 ==a==
12607 ===aa===
12608 ====aaa====
12609 ==b==
12610 ===ba===
12611 ===bb===
12612 ====bba====
12613 ===bc===
12614 ==c==
12615 xxx
12616 !! end
12617
12618 !! test
12619 Section replacement test with initial whitespace (bug 13728)
12620 !! options
12621 replace=2,"xxx"
12622 !! input
12623 Preformatted initial line
12624 ==a==
12625 ===a===
12626 !! result
12627 Preformatted initial line
12628 ==a==
12629 xxx
12630 !! end
12631
12632
12633 !! test
12634 Section extraction, heading followed by pre with 20 spaces (bug 6398)
12635 !! options
12636 section=1
12637 !! input
12638 ==a==
12639 a
12640 !! result
12641 ==a==
12642 a
12643 !! end
12644
12645 !! test
12646 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
12647 !! options
12648 section=1
12649 !! input
12650 ==a==
12651 a
12652 !! result
12653 ==a==
12654 a
12655 !! end
12656
12657
12658 !! test
12659 Section extraction, <pre> around bogus header (bug 10309)
12660 !! options
12661 noxml section=2
12662 !! input
12663 == Section One ==
12664 <pre>
12665 =======
12666 </pre>
12667
12668 == Section Two ==
12669 stuff
12670 !! result
12671 == Section Two ==
12672 stuff
12673 !! end
12674
12675 !! test
12676 Section replacement, <pre> around bogus header (bug 10309)
12677 !! options
12678 noxml replace=2,"xxx"
12679 !! input
12680 == Section One ==
12681 <pre>
12682 =======
12683 </pre>
12684
12685 == Section Two ==
12686 stuff
12687 !! result
12688 == Section One ==
12689 <pre>
12690 =======
12691 </pre>
12692
12693 xxx
12694 !! end
12695
12696
12697
12698 !! test
12699 Handling of &#x0A; in URLs
12700 !! input
12701 **irc://&#x0A;a
12702 !! result
12703 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
12704 </li></ul>
12705 </li></ul>
12706
12707 !!end
12708
12709 !! test
12710 5 quotes, code coverage +1 line (php)
12711 !! options
12712 php
12713 !! input
12714 '''''
12715 !! result
12716 !! end
12717 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
12718 !! test
12719 5 quotes, code coverage +1 line (parsoid)
12720 !! options
12721 parsoid
12722 !! input
12723 '''''
12724 !! result
12725 <p><i><b></b></i></p>
12726 !! end
12727
12728 !! test
12729 Special:Search page linking.
12730 !! input
12731 {{Special:search}}
12732 !! result
12733 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
12734 </p>
12735 !! end
12736
12737 !! test
12738 Say the magic word
12739 !! options
12740 title=[[Parser test]]
12741 !! input
12742 * {{PAGENAME}}
12743 * {{PAGENAMEE}}
12744 * {{FULLPAGENAME}}
12745 * {{FULLPAGENAMEE}}
12746 * {{BASEPAGENAME}}
12747 * {{BASEPAGENAMEE}}
12748 * {{SUBPAGENAME}}
12749 * {{SUBPAGENAMEE}}
12750 * {{ROOTPAGENAME}}
12751 * {{ROOTPAGENAMEE}}
12752 * {{TALKPAGENAME}}
12753 * {{TALKPAGENAMEE}}
12754 * {{SUBJECTPAGENAME}}
12755 * {{SUBJECTPAGENAMEE}}
12756 * {{NAMESPACEE}}
12757 * {{NAMESPACE}}
12758 * {{NAMESPACENUMBER}}
12759 * {{TALKSPACE}}
12760 * {{TALKSPACEE}}
12761 * {{SUBJECTSPACE}}
12762 * {{SUBJECTSPACEE}}
12763 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
12764 !! result
12765 <ul><li> Parser test
12766 </li><li> Parser_test
12767 </li><li> Parser test
12768 </li><li> Parser_test
12769 </li><li> Parser test
12770 </li><li> Parser_test
12771 </li><li> Parser test
12772 </li><li> Parser_test
12773 </li><li> Parser test
12774 </li><li> Parser_test
12775 </li><li> Talk:Parser test
12776 </li><li> Talk:Parser_test
12777 </li><li> Parser test
12778 </li><li> Parser_test
12779 </li><li>
12780 </li><li>
12781 </li><li> 0
12782 </li><li> Talk
12783 </li><li> Talk
12784 </li><li>
12785 </li><li>
12786 </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>
12787 </li></ul>
12788
12789 !! end
12790 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
12791
12792 !! test
12793 Gallery
12794 !! input
12795 <gallery>
12796 image1.png |
12797 image2.gif|||||
12798
12799 image3|
12800 image4 |300px| centre
12801 image5.svg| http://///////
12802 [[x|xx]]]]
12803 * image6
12804 </gallery>
12805 !! result
12806 <ul class="gallery mw-gallery-traditional">
12807 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12808 <div class="thumb" style="height: 150px;">Image1.png</div>
12809 <div class="gallerytext">
12810 </div>
12811 </div></li>
12812 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12813 <div class="thumb" style="height: 150px;">Image2.gif</div>
12814 <div class="gallerytext">
12815 <p>||||
12816 </p>
12817 </div>
12818 </div></li>
12819 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12820 <div class="thumb" style="height: 150px;">Image3</div>
12821 <div class="gallerytext">
12822 </div>
12823 </div></li>
12824 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12825 <div class="thumb" style="height: 150px;">Image4</div>
12826 <div class="gallerytext">
12827 <p>300px| centre
12828 </p>
12829 </div>
12830 </div></li>
12831 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12832 <div class="thumb" style="height: 150px;">Image5.svg</div>
12833 <div class="gallerytext">
12834 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
12835 </p>
12836 </div>
12837 </div></li>
12838 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12839 <div class="thumb" style="height: 150px;">* image6</div>
12840 <div class="gallerytext">
12841 </div>
12842 </div></li>
12843 </ul>
12844
12845 !! end
12846
12847 !! test
12848 Gallery (with options)
12849 !! input
12850 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
12851 File:Nonexistant.jpg|caption
12852 File:Nonexistant.jpg
12853 image:foobar.jpg|some '''caption''' [[Main Page]]
12854 image:foobar.jpg
12855 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
12856 </gallery>
12857 !! result
12858 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
12859 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
12860 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12861 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
12862 <div class="gallerytext">
12863 <p>caption
12864 </p>
12865 </div>
12866 </div></li>
12867 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12868 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
12869 <div class="gallerytext">
12870 </div>
12871 </div></li>
12872 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12873 <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>
12874 <div class="gallerytext">
12875 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12876 </p>
12877 </div>
12878 </div></li>
12879 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12880 <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>
12881 <div class="gallerytext">
12882 </div>
12883 </div></li>
12884 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12885 <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>
12886 <div class="gallerytext">
12887 <p>Blabla|blabla.
12888 </p>
12889 </div>
12890 </div></li>
12891 </ul>
12892
12893 !! end
12894
12895 !! test
12896 Gallery with wikitext inside caption
12897 !! input
12898 <gallery>
12899 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
12900 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
12901 </gallery>
12902 !! result
12903 <ul class="gallery mw-gallery-traditional">
12904 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12905 <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>
12906 <div class="gallerytext">
12907 <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>
12908 </p>
12909 </div>
12910 </div></li>
12911 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12912 <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>
12913 <div class="gallerytext">
12914 <p>This is a test template
12915 </p>
12916 </div>
12917 </div></li>
12918 </ul>
12919
12920 !! end
12921
12922 !! test
12923 gallery (with showfilename option)
12924 !! input
12925 <gallery showfilename>
12926 File:Nonexistant.jpg|caption
12927 File:Nonexistant.jpg
12928 image:foobar.jpg|some '''caption''' [[Main Page]]
12929 File:Foobar.jpg
12930 </gallery>
12931 !! result
12932 <ul class="gallery mw-gallery-traditional">
12933 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12934 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
12935 <div class="gallerytext">
12936 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12937 caption
12938 </p>
12939 </div>
12940 </div></li>
12941 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12942 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
12943 <div class="gallerytext">
12944 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12945 </p>
12946 </div>
12947 </div></li>
12948 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12949 <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>
12950 <div class="gallerytext">
12951 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12952 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12953 </p>
12954 </div>
12955 </div></li>
12956 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12957 <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>
12958 <div class="gallerytext">
12959 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12960 </p>
12961 </div>
12962 </div></li>
12963 </ul>
12964
12965 !! end
12966
12967 !! test
12968 Gallery (with namespace-less filenames)
12969 !! input
12970 <gallery>
12971 File:Nonexistant.jpg
12972 Nonexistant.jpg
12973 image:foobar.jpg
12974 foobar.jpg
12975 </gallery>
12976 !! result
12977 <ul class="gallery mw-gallery-traditional">
12978 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12979 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
12980 <div class="gallerytext">
12981 </div>
12982 </div></li>
12983 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12984 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
12985 <div class="gallerytext">
12986 </div>
12987 </div></li>
12988 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12989 <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>
12990 <div class="gallerytext">
12991 </div>
12992 </div></li>
12993 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12994 <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>
12995 <div class="gallerytext">
12996 </div>
12997 </div></li>
12998 </ul>
12999
13000 !! end
13001
13002 !! test
13003 HTML Hex character encoding (spells the word "JavaScript")
13004 !! input
13005 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
13006 !! result
13007 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
13008 </p>
13009 !! end
13010
13011 !! test
13012 HTML Hex character encoding bogus encoding (bug 26437 regression check)
13013 !! input
13014 &#xsee;&#XSEE;
13015 !! result
13016 <p>&amp;#xsee;&amp;#XSEE;
13017 </p>
13018 !! end
13019
13020 !! test
13021 HTML Hex character encoding mixed case
13022 !! input
13023 &#xEE;&#Xee;
13024 !! result
13025 <p>&#xee;&#xee;
13026 </p>
13027 !! end
13028
13029 !! test
13030 __FORCETOC__ override
13031 !! input
13032 __NEWSECTIONLINK__
13033 __FORCETOC__
13034 !! result
13035 <p><br />
13036 </p>
13037 !! end
13038
13039 !! test
13040 ISBN code coverage
13041 !! input
13042 ISBN 978-0-1234-56&#x20;789
13043 !! result
13044 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
13045 </p>
13046 !! end
13047
13048 !! test
13049 ISBN followed by 5 spaces
13050 !! input
13051 ISBN
13052 !! result
13053 <p>ISBN
13054 </p>
13055 !! end
13056
13057 !! test
13058 Double ISBN
13059 !! input
13060 ISBN ISBN 1234567890
13061 !! result
13062 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13063 </p>
13064 !! end
13065
13066 !! test
13067 Bug 22905: <abbr> followed by ISBN followed by </a>
13068 !! input
13069 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
13070 !! result
13071 <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>
13072 </p>
13073 !! end
13074
13075 !! test
13076 Double RFC
13077 !! input
13078 RFC RFC 1234
13079 !! result
13080 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
13081 </p>
13082 !! end
13083
13084 !! test
13085 Double RFC with a wiki link
13086 !! input
13087 RFC [[RFC 1234]]
13088 !! result
13089 <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>
13090 </p>
13091 !! end
13092
13093 !! test
13094 RFC code coverage
13095 !! input
13096 RFC 983&#x20;987
13097 !! result
13098 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
13099 </p>
13100 !! end
13101
13102 !! test
13103 Centre-aligned image
13104 !! input
13105 [[Image:foobar.jpg|centre]]
13106 !! result
13107 <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>
13108
13109 !!end
13110
13111 !! test
13112 None-aligned image
13113 !! input
13114 [[Image:foobar.jpg|none]]
13115 !! result
13116 <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>
13117
13118 !!end
13119
13120 !! test
13121 Width + Height sized image (using px) (height is ignored)
13122 !! input
13123 [[Image:foobar.jpg|640x480px]]
13124 !! result
13125 <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>
13126 </p>
13127 !!end
13128
13129 !! test
13130 Width-sized image (using px, no following whitespace)
13131 !! input
13132 [[Image:foobar.jpg|640px]]
13133 !! result
13134 <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>
13135 </p>
13136 !!end
13137
13138 !! test
13139 Width-sized image (using px, with following whitespace - test regression from r39467)
13140 !! input
13141 [[Image:foobar.jpg|640px ]]
13142 !! result
13143 <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>
13144 </p>
13145 !!end
13146
13147 !! test
13148 Width-sized image (using px, with preceding whitespace - test regression from r39467)
13149 !! input
13150 [[Image:foobar.jpg| 640px]]
13151 !! result
13152 <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>
13153 </p>
13154 !!end
13155
13156 !! test
13157 Another italics / bold test
13158 !! input
13159 ''' ''x'
13160 !! result
13161 <pre>'<i> </i>x'
13162 </pre>
13163 !!end
13164
13165 # Note the results may be incorrect, as parserTest output included this:
13166 # XML error: Mismatched tag at byte 6120:
13167 # ...<dd> </dt></dl> </dd...
13168 !! test
13169 dt/dd/dl test
13170 !! options
13171 disabled
13172 !! input
13173 :;;;::
13174 !! result
13175 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
13176 </dd></dl>
13177 </dd></dl>
13178 </dt></dl>
13179 </dt></dl>
13180 </dt></dl>
13181 </dd></dl>
13182
13183 !!end
13184
13185
13186 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
13187 !! test
13188 Images with the "|" character in the comment
13189 !! input
13190 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
13191 !! result
13192 <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>
13193
13194 !!end
13195
13196 !! test
13197 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
13198 !! input
13199 <html><script>alert(1);</script></html>
13200 !! result
13201 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
13202 </p>
13203 !! end
13204
13205 !! test
13206 HTML with raw HTML ($wgRawHtml==true)
13207 !! options
13208 wgRawHtml=1
13209 !! input
13210 <html><script>alert(1);</script></html>
13211 !! result
13212 <p><script>alert(1);</script>
13213 </p>
13214 !! end
13215
13216 !! test
13217 Parents of subpages, one level up
13218 !! options
13219 subpage title=[[Subpage test/L1/L2/L3]]
13220 !! input
13221 [[../|L2]]
13222 !! result
13223 <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>
13224 </p>
13225 !! end
13226
13227
13228 !! test
13229 Parents of subpages, one level up, not named
13230 !! options
13231 subpage title=[[Subpage test/L1/L2/L3]]
13232 !! input
13233 [[../]]
13234 !! result
13235 <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>
13236 </p>
13237 !! end
13238
13239
13240
13241 !! test
13242 Parents of subpages, two levels up
13243 !! options
13244 subpage title=[[Subpage test/L1/L2/L3]]
13245 !! input
13246 [[../../|L1]]2
13247
13248 [[../../|L1]]l
13249 !! result
13250 <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
13251 </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>
13252 </p>
13253 !! end
13254
13255 !! test
13256 Parents of subpages, two levels up, without trailing slash or name.
13257 !! options
13258 subpage title=[[Subpage test/L1/L2/L3]]
13259 !! input
13260 [[../..]]
13261 !! result
13262 <p>[[../..]]
13263 </p>
13264 !! end
13265
13266 !! test
13267 Parents of subpages, two levels up, with lots of extra trailing slashes.
13268 !! options
13269 subpage title=[[Subpage test/L1/L2/L3]]
13270 !! input
13271 [[../../////]]
13272 !! result
13273 <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>
13274 </p>
13275 !! end
13276
13277 !! article
13278 Subpage test/L1/L2/L3Sibling
13279 !! text
13280 Sibling article
13281 !! endarticle
13282
13283 !! test
13284 Transclusion of a sibling page (one level up)
13285 !! options
13286 subpage title=[[Subpage test/L1/L2/L3]]
13287 !! input
13288 {{../L3Sibling}}
13289 !! result
13290 <p>Sibling article
13291 </p>
13292 !! end
13293
13294 !! test
13295 Transclusion of a child page
13296 !! options
13297 subpage title=[[Subpage test/L1/L2]]
13298 !! input
13299 {{/L3Sibling}}
13300 !! result
13301 <p>Sibling article
13302 </p>
13303 !! end
13304
13305 !! test
13306 Non-transclusion because of too many up levels
13307 !! options
13308 subpage title=[[Subpage test/L1/L2/L3]]
13309 !! input
13310 {{../../../../More than parent}}
13311 !! result
13312 <p>{{../../../../More than parent}}
13313 </p>
13314 !! end
13315
13316 !! test
13317 Definition list code coverage
13318 !! input
13319 ; title : def
13320 ; title : def
13321 ;title: def
13322 !! result
13323 <dl><dt> title &#160;</dt><dd> def
13324 </dd><dt> title&#160;</dt><dd> def
13325 </dd><dt>title</dt><dd> def
13326 </dd></dl>
13327
13328 !! end
13329
13330 !! test
13331 Don't fall for the self-closing div
13332 !! input
13333 <div>hello world</div/>
13334 !! result
13335 <div>hello world</div>
13336
13337 !! end
13338
13339 !! test
13340 MSGNW magic word
13341 !! input
13342 {{MSGNW:msg}}
13343 !! result
13344 <p>&#91;&#91;:Template:Msg&#93;&#93;
13345 </p>
13346 !! end
13347
13348 !! test
13349 RAW magic word
13350 !! input
13351 {{RAW:QUERTY}}
13352 !! result
13353 <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>
13354 </p>
13355 !! end
13356
13357 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
13358 !! test
13359 Always escape literal '>' in output, not just after '<'
13360 !! input
13361 ><>
13362 !! result
13363 <p>&gt;&lt;&gt;
13364 </p>
13365 !! end
13366
13367 !! test
13368 Template caching
13369 !! input
13370 {{Test}}
13371 {{Test}}
13372 !! result
13373 <p>This is a test template
13374 This is a test template
13375 </p>
13376 !! end
13377
13378
13379 !! article
13380 MediaWiki:Fake
13381 !! text
13382 ==header==
13383 !! endarticle
13384
13385 !! test
13386 Inclusion of !userCanEdit() content
13387 !! input
13388 {{MediaWiki:Fake}}
13389 !! result
13390 <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>
13391
13392 !! end
13393
13394
13395 !! test
13396 Out-of-order TOC heading levels
13397 !! input
13398 ==2==
13399 ======6======
13400 ===3===
13401 =1=
13402 =====5=====
13403 ==2==
13404 !! result
13405 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13406 <ul>
13407 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
13408 <ul>
13409 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
13410 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
13411 </ul>
13412 </li>
13413 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
13414 <ul>
13415 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
13416 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
13417 </ul>
13418 </li>
13419 </ul>
13420 </div>
13421 <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>
13422 <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>
13423 <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>
13424 <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>
13425 <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>
13426 <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>
13427
13428 !! end
13429
13430
13431 !! test
13432 ISBN with a dummy number
13433 !! input
13434 ISBN ---
13435 !! result
13436 <p>ISBN ---
13437 </p>
13438 !! end
13439
13440
13441 !! test
13442 ISBN with space-delimited number
13443 !! input
13444 ISBN 92 9017 032 8
13445 !! result
13446 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
13447 </p>
13448 !! end
13449
13450
13451 !! test
13452 ISBN with multiple spaces, no number
13453 !! input
13454 ISBN foo
13455 !! result
13456 <p>ISBN foo
13457 </p>
13458 !! end
13459
13460
13461 !! test
13462 ISBN length
13463 !! input
13464 ISBN 123456789
13465
13466 ISBN 1234567890
13467
13468 ISBN 12345678901
13469 !! result
13470 <p>ISBN 123456789
13471 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13472 </p><p>ISBN 12345678901
13473 </p>
13474 !! end
13475
13476
13477 !! test
13478 ISBN with trailing year (bug 8110)
13479 !! input
13480 ISBN 1-234-56789-0 - 2006
13481
13482 ISBN 1 234 56789 0 - 2006
13483 !! result
13484 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
13485 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
13486 </p>
13487 !! end
13488
13489
13490 !! test
13491 anchorencode
13492 !! input
13493 {{anchorencode:foo bar©#%n}}
13494 !! result
13495 <p>foo_bar.C2.A9.23.25n
13496 </p>
13497 !! end
13498
13499 !! test
13500 anchorencode trims spaces
13501 !! input
13502 {{anchorencode: __pretty__please__}}
13503 !! result
13504 <p>pretty_please
13505 </p>
13506 !! end
13507
13508 !! test
13509 anchorencode deals with links
13510 !! input
13511 {{anchorencode: [[hello|world]] [[hi]]}}
13512 !! result
13513 <p>world_hi
13514 </p>
13515 !! end
13516
13517 !! test
13518 anchorencode deals with templates
13519 !! input
13520 {{anchorencode: {{Foo}} }}
13521 !! result
13522 <p>FOO
13523 </p>
13524 !! end
13525
13526 !! test
13527 anchorencode encodes like the TOC generator: (bug 18431)
13528 !! input
13529 === _ +:.3A%3A&&amp;]] ===
13530 {{anchorencode: _ +:.3A%3A&&amp;]] }}
13531 __NOEDITSECTION__
13532 !! result
13533 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
13534 <p>.2B:.3A.253A.26.26.5D.5D
13535 </p>
13536 !! end
13537
13538 # Expected output in the following test is not necessarily expected (there
13539 # should probably be <p> tags inside the <blockquote> in the output) -- it's
13540 # only testing for well-formedness.
13541 !! test
13542 Bug 6200: blockquotes and paragraph formatting
13543 !! input
13544 <blockquote>
13545 foo
13546 </blockquote>
13547
13548 bar
13549
13550 baz
13551 !! result
13552 <blockquote>
13553 foo
13554 </blockquote>
13555 <p>bar
13556 </p>
13557 <pre>baz
13558 </pre>
13559 !! end
13560
13561 !! test
13562 Bug 8293: Use of center tag ruins paragraph formatting
13563 !! input
13564 <center>
13565 foo
13566 </center>
13567
13568 bar
13569
13570 baz
13571 !! result
13572 <center>
13573 <p>foo
13574 </p>
13575 </center>
13576 <p>bar
13577 </p>
13578 <pre>baz
13579 </pre>
13580 !! end
13581
13582 !!test
13583 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
13584 !!options
13585 php
13586 !!input
13587 <span><s>x</span></s>
13588 !!result
13589 <p><span><s>x&lt;/span&gt;</s></span>
13590 </p>
13591 !!end
13592
13593 !!test
13594 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
13595 !!options
13596 parsoid
13597 !!input
13598 <span><s>x</span></s>
13599 !!result
13600 <p><span><s>x</s></span><s></s>
13601 </p>
13602 !!end
13603
13604 ###
13605 ### Language variants related tests
13606 ###
13607 !! test
13608 Self-link in language variants
13609 !! options
13610 title=[[Dunav]] language=sr
13611 !! input
13612 Both [[Dunav]] and [[Дунав]] are names for this river.
13613 !! result
13614 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
13615 </p>
13616 !!end
13617
13618 !! article
13619 Дуна
13620 !! text
13621 content
13622 !! endarticle
13623
13624 !! test
13625 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
13626 !! options
13627 title=[[Duna]] language=sr
13628 !! input
13629 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
13630 !! result
13631 <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.
13632 </p>
13633 !! end
13634
13635 !! test
13636 Link to pages in language variants
13637 !! options
13638 language=sr
13639 !! input
13640 Main Page can be written as [[Маин Паге]]
13641 !! result
13642 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
13643 </p>
13644 !!end
13645
13646
13647 !! test
13648 Multiple links to pages in language variants
13649 !! options
13650 language=sr
13651 !! input
13652 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
13653 !! result
13654 <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>.
13655 </p>
13656 !!end
13657
13658
13659 !! test
13660 Simple template in language variants
13661 !! options
13662 language=sr
13663 !! input
13664 {{тест}}
13665 !! result
13666 <p>This is a test template
13667 </p>
13668 !! end
13669
13670
13671 !! test
13672 Template with explicit namespace in language variants
13673 !! options
13674 language=sr
13675 !! input
13676 {{Template:тест}}
13677 !! result
13678 <p>This is a test template
13679 </p>
13680 !! end
13681
13682
13683 !! test
13684 Basic test for template parameter in language variants
13685 !! options
13686 language=sr
13687 !! input
13688 {{парамтест|param=foo}}
13689 !! result
13690 <p>This is a test template with parameter foo
13691 </p>
13692 !! end
13693
13694
13695 !! test
13696 Simple category in language variants
13697 !! options
13698 language=sr cat
13699 !! input
13700 [[Category:МедиаWики Усер'с Гуиде]]
13701 !! result
13702 <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>
13703 !! end
13704
13705
13706 !! article
13707 Category:分类
13708 !! text
13709 blah
13710 !! endarticle
13711
13712 !! article
13713 Category:分類
13714 !! text
13715 blah
13716 !! endarticle
13717
13718 !! test
13719 Don't convert blue categorylinks to another variant (bug 33210)
13720 !! options
13721 language=zh cat
13722 !! input
13723 [[A]][[Category:分类]]
13724 !! result
13725 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
13726 !! end
13727
13728
13729 !! test
13730 Stripping -{}- tags (language variants)
13731 !! options
13732 language=sr
13733 !! input
13734 Latin proverb: -{Ne nuntium necare}-
13735 !! result
13736 <p>Latin proverb: Ne nuntium necare
13737 </p>
13738 !! end
13739
13740
13741 !! test
13742 Prevent conversion with -{}- tags (language variants)
13743 !! options
13744 language=sr variant=sr-ec
13745 !! input
13746 Latinski: -{Ne nuntium necare}-
13747 !! result
13748 <p>Латински: Ne nuntium necare
13749 </p>
13750 !! end
13751
13752
13753 !! test
13754 Prevent conversion of text with -{}- tags (language variants)
13755 !! options
13756 language=sr variant=sr-ec
13757 !! input
13758 Latinski: -{Ne nuntium necare}-
13759 !! result
13760 <p>Латински: Ne nuntium necare
13761 </p>
13762 !! end
13763
13764
13765 !! test
13766 Prevent conversion of links with -{}- tags (language variants)
13767 !! options
13768 language=sr variant=sr-ec
13769 !! input
13770 -{[[Main Page]]}-
13771 !! result
13772 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13773 </p>
13774 !! end
13775
13776
13777 !! test
13778 -{}- tags within headlines (within html for parserConvert())
13779 !! options
13780 language=sr variant=sr-ec
13781 !! input
13782 == -{Naslov}- ==
13783 !! result
13784 <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>
13785
13786 !! end
13787
13788
13789 !! test
13790 Explicit definition of language variant alternatives
13791 !! options
13792 language=zh variant=zh-tw
13793 !! input
13794 -{zh:China;zh-tw:Taiwan}-, not China
13795 !! result
13796 <p>Taiwan, not China
13797 </p>
13798 !! end
13799
13800
13801 !! test
13802 Conversion around HTML tags
13803 !! options
13804 language=sr variant=sr-ec
13805 !! input
13806 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
13807 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
13808 !! result
13809 <p>
13810 <span title="ЛаCтин">ски</span>
13811 </p>
13812 !! end
13813
13814
13815 !! test
13816 Explicit session-wise language variant mapping (A flag and - flag)
13817 !! options
13818 language=zh variant=zh-tw
13819 !! input
13820 Taiwan is not China.
13821 But -{A|zh:China;zh-tw:Taiwan}- is China,
13822 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
13823 and -{China}- is China.
13824 !! result
13825 <p>Taiwan is not China.
13826 But Taiwan is Taiwan,
13827 (This should be stripped!)
13828 and China is China.
13829 </p>
13830 !! end
13831
13832 !! test
13833 Explicit session-wise language variant mapping (H flag for hide)
13834 !! options
13835 language=zh variant=zh-tw
13836 !! input
13837 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
13838 Taiwan is China.
13839 !! result
13840 <p>(This should be stripped!)
13841 Taiwan is Taiwan.
13842 </p>
13843 !! end
13844
13845 !! test
13846 Adding explicit conversion rule for title (T flag)
13847 !! options
13848 language=zh variant=zh-tw showtitle
13849 !! input
13850 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13851 !! result
13852 Taiwan
13853 <p>Should be stripped!
13854 </p>
13855 !! end
13856
13857 !! test
13858 Testing that changing the language variant here in the tests actually works
13859 !! options
13860 language=zh variant=zh showtitle
13861 !! input
13862 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13863 !! result
13864 China
13865 <p>Should be stripped!
13866 </p>
13867 !! end
13868
13869 !! test
13870 Recursive conversion of alt and title attrs shouldn't clear converter state
13871 !! options
13872 language=zh variant=zh-cn showtitle
13873 !! input
13874 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
13875 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
13876 !! result
13877 China
13878 <p>
13879 Should be stripped<span title="Exclamation">!</span>
13880 </p>
13881 !! end
13882
13883 !! test
13884 Bug 24072: more test on conversion rule for title
13885 !! options
13886 language=zh variant=zh-tw showtitle
13887 !! input
13888 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13889 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
13890 !! result
13891 Taiwan
13892 <p>This should be stripped!
13893 This won't take interferes with the title rule.
13894 </p>
13895 !! end
13896
13897 !! test
13898 Partly disable title conversion if variant == main language code
13899 !! options
13900 language=zh variant=zh title=[[ZH]] showtitle
13901 !! input
13902 -{T|zh-cn:CN;zh-tw:TW}-
13903 !! result
13904 ZH
13905 <p>
13906 </p>
13907 !! end
13908
13909 !! test
13910 Partly disable title conversion if variant == main language code, more
13911 !! options
13912 language=zh variant=zh title=[[ZH]] showtitle
13913 !! input
13914 -{T|TW}-
13915 !! result
13916 ZH
13917 <p>
13918 </p>
13919 !! end
13920
13921 !! test
13922 Raw output of variant escape tags (R flag)
13923 !! options
13924 language=zh variant=zh-tw
13925 !! input
13926 Raw: -{R|zh:China;zh-tw:Taiwan}-
13927 !! result
13928 <p>Raw: zh:China;zh-tw:Taiwan
13929 </p>
13930 !! end
13931
13932 !! test
13933 Nested using of manual convert syntax
13934 !! options
13935 language=zh variant=zh-hk
13936 !! input
13937 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
13938 !! result
13939 <p>Nested: Hello Hong Kong!
13940 </p>
13941 !! end
13942
13943 !! test
13944 Proper conversion of text in external links
13945 !! options
13946 language=sr variant=sr-ec
13947 !! input
13948 http://www.google.com
13949 gopher://www.google.com
13950 [http://www.google.com http://www.google.com]
13951 [gopher://www.google.com gopher://www.google.com]
13952 [https://www.google.com irc://www.google.com]
13953 [ftp://www.google.com www.google.com/ftp://dir]
13954 [//www.google.com www.google.com]
13955 !! result
13956 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13957 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13958 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13959 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13960 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
13961 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
13962 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
13963 </p>
13964 !! end
13965
13966 !! test
13967 Do not convert roman numbers to language variants
13968 !! options
13969 language=sr variant=sr-ec
13970 !! input
13971 Fridrih IV je car.
13972 !! result
13973 <p>Фридрих IV је цар.
13974 </p>
13975 !! end
13976
13977 !! test
13978 Unclosed language converter markup "-{"
13979 !! options
13980 language=sr
13981 !! input
13982 -{T|hello
13983 !! result
13984 <p>-{T|hello
13985 </p>
13986 !! end
13987
13988 !! test
13989 Don't convert raw rule "-{R|=&gt;}-" to "=>"
13990 !! options
13991 language=sr
13992 !! input
13993 -{R|=&gt;}-
13994 !! result
13995 <p>=&gt;
13996 </p>
13997 !!end
13998
13999 !! test
14000 Bug 529: Uncovered bullet
14001 !! input
14002 * Foo {{bullet}}
14003 !! result
14004 <ul><li> Foo
14005 </li><li> Bar
14006 </li></ul>
14007
14008 !! end
14009
14010 # Plain MediaWiki does not remove empty lists, but tidy actually does.
14011 # Templates in Wikipedia rely on this behavior, as tidy has always been
14012 # enabled there. These tests are normally run *without* tidy, so specify the
14013 # full output here.
14014 # To test realistic parsing behavior, apply a tidy-like transformation to both
14015 # the expected output and your parser's output.
14016 !! test
14017 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
14018 !! input
14019 ******* Foo {{bullet}}
14020 !! result
14021 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
14022 </li></ul>
14023 </li></ul>
14024 </li></ul>
14025 </li></ul>
14026 </li></ul>
14027 </li></ul>
14028 </li><li> Bar
14029 </li></ul>
14030
14031 !! end
14032
14033 !! test
14034 Bug 529: Uncovered table already at line-start
14035 !! input
14036 x
14037
14038 {{table}}
14039 y
14040 !! result
14041 <p>x
14042 </p>
14043 <table>
14044 <tr>
14045 <td> 1 </td>
14046 <td> 2
14047 </td></tr>
14048 <tr>
14049 <td> 3 </td>
14050 <td> 4
14051 </td></tr></table>
14052 <p>y
14053 </p>
14054 !! end
14055
14056 !! test
14057 Bug 529: Uncovered bullet in parser function result
14058 !! input
14059 * Foo {{lc:{{bullet}} }}
14060 !! result
14061 <ul><li> Foo
14062 </li><li> bar
14063 </li></ul>
14064
14065 !! end
14066
14067 !! test
14068 Bug 5678: Double-parsed template argument
14069 !! input
14070 {{lc:{{{1}}}|hello}}
14071 !! result
14072 <p>{{{1}}}
14073 </p>
14074 !! end
14075
14076 !! test
14077 Bug 5678: Double-parsed template invocation
14078 !! input
14079 {{lc:{{paramtest {{!}} param = hello }} }}
14080 !! result
14081 <p>{{paramtest | param = hello }}
14082 </p>
14083 !! end
14084
14085 !! test
14086 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
14087 !! options
14088 language=cs
14089 title=[[Main Page]]
14090 !! input
14091 {{PRVNÍVELKÉ:ěščř}}
14092 {{prvnívelké:ěščř}}
14093 {{PRVNÍMALÉ:ěščř}}
14094 {{prvnímalé:ěščř}}
14095 {{MALÁ:ěščř}}
14096 {{malá:ěščř}}
14097 {{VELKÁ:ěščř}}
14098 {{velká:ěščř}}
14099 !! result
14100 <p>Ěščř
14101 Ěščř
14102 ěščř
14103 ěščř
14104 ěščř
14105 ěščř
14106 ĚŠČŘ
14107 ĚŠČŘ
14108 </p>
14109 !! end
14110
14111 !! test
14112 Morwen/13: Unclosed link followed by heading
14113 !! input
14114 [[link
14115 ==heading==
14116 !! result
14117 <p>[[link
14118 </p>
14119 <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>
14120
14121 !! end
14122
14123 !! test
14124 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
14125 !! input
14126 {{foo|
14127 =heading=
14128 !! result
14129 <p>{{foo|
14130 </p>
14131 <h1><span class="mw-headline" id="heading">heading</span></h1>
14132
14133 !! end
14134
14135 !! test
14136 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
14137 !! input
14138 {{foo|
14139 ==heading==
14140 !! result
14141 <p>{{foo|
14142 </p>
14143 <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>
14144
14145 !! end
14146
14147 !! test
14148 Tildes in comments
14149 !! options
14150 pst
14151 !! input
14152 <!-- ~~~~ -->
14153 !! result
14154 <!-- ~~~~ -->
14155 !! end
14156
14157 !! test
14158 Paragraphs inside divs (no extra line breaks)
14159 !! input
14160 <div>Line one
14161
14162 Line two</div>
14163 !! result
14164 <div>Line one
14165 Line two</div>
14166
14167 !! end
14168
14169 !! test
14170 Paragraphs inside divs (extra line break on open)
14171 !! input
14172 <div>
14173 Line one
14174
14175 Line two</div>
14176 !! result
14177 <div>
14178 <p>Line one
14179 </p>
14180 Line two</div>
14181
14182 !! end
14183
14184 !! test
14185 Paragraphs inside divs (extra line break on close)
14186 !! input
14187 <div>Line one
14188
14189 Line two
14190 </div>
14191 !! result
14192 <div>Line one
14193 <p>Line two
14194 </p>
14195 </div>
14196
14197 !! end
14198
14199 !! test
14200 Paragraphs inside divs (extra line break on open and close)
14201 !! input
14202 <div>
14203 Line one
14204
14205 Line two
14206 </div>
14207 !! result
14208 <div>
14209 <p>Line one
14210 </p><p>Line two
14211 </p>
14212 </div>
14213
14214 !! end
14215
14216 !! test
14217 Nesting tags, paragraphs on lines which begin with <div>
14218 !! options
14219 disabled
14220 !! input
14221 <div></div><strong>A
14222 B</strong>
14223 !! result
14224 <div></div>
14225 <p><strong>A
14226 B</strong>
14227 </p>
14228 !! end
14229
14230 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
14231 !! test
14232 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
14233 !! options
14234 disabled
14235 !! input
14236 <blockquote>Line one
14237
14238 Line two</blockquote>
14239 !! result
14240 <blockquote>Line one
14241 Line two</blockquote>
14242
14243 !! end
14244
14245 !! test
14246 Bug 6200: paragraphs inside blockquotes (extra line break on open)
14247 !! options
14248 disabled
14249 !! input
14250 <blockquote>
14251 Line one
14252
14253 Line two</blockquote>
14254 !! result
14255 <blockquote>
14256 <p>Line one
14257 </p>
14258 Line two</blockquote>
14259
14260 !! end
14261
14262 !! test
14263 Bug 6200: paragraphs inside blockquotes (extra line break on close)
14264 !! options
14265 disabled
14266 !! input
14267 <blockquote>Line one
14268
14269 Line two
14270 </blockquote>
14271 !! result
14272 <blockquote>Line one
14273 <p>Line two
14274 </p>
14275 </blockquote>
14276
14277 !! end
14278
14279 !! test
14280 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
14281 !! options
14282 disabled
14283 !! input
14284 <blockquote>
14285 Line one
14286
14287 Line two
14288 </blockquote>
14289 !! result
14290 <blockquote>
14291 <p>Line one
14292 </p><p>Line two
14293 </p>
14294 </blockquote>
14295
14296 !! end
14297
14298 !! test
14299 Paragraphs inside blockquotes/divs (no extra line breaks)
14300 !! input
14301 <blockquote><div>Line one
14302
14303 Line two</div></blockquote>
14304 !! result
14305 <blockquote><div>Line one
14306 Line two</div></blockquote>
14307
14308 !! end
14309
14310 !! test
14311 Paragraphs inside blockquotes/divs (extra line break on open)
14312 !! input
14313 <blockquote><div>
14314 Line one
14315
14316 Line two</div></blockquote>
14317 !! result
14318 <blockquote><div>
14319 <p>Line one
14320 </p>
14321 Line two</div></blockquote>
14322
14323 !! end
14324
14325 !! test
14326 Paragraphs inside blockquotes/divs (extra line break on close)
14327 !! input
14328 <blockquote><div>Line one
14329
14330 Line two
14331 </div></blockquote>
14332 !! result
14333 <blockquote><div>Line one
14334 <p>Line two
14335 </p>
14336 </div></blockquote>
14337
14338 !! end
14339
14340 !! test
14341 Paragraphs inside blockquotes/divs (extra line break on open and close)
14342 !! input
14343 <blockquote><div>
14344 Line one
14345
14346 Line two
14347 </div></blockquote>
14348 !! result
14349 <blockquote><div>
14350 <p>Line one
14351 </p><p>Line two
14352 </p>
14353 </div></blockquote>
14354
14355 !! end
14356
14357 !! test
14358 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
14359 !! options
14360 wgLinkHolderBatchSize=0
14361 !! input
14362 [[meatball:1]]
14363 [[meatball:2]]
14364 [[meatball:3]]
14365 !! result
14366 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
14367 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
14368 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
14369 </p>
14370 !! end
14371
14372 !! test
14373 Free external link invading image caption
14374 !! input
14375 [[Image:Foobar.jpg|thumb|http://x|hello]]
14376 !! result
14377 <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>
14378
14379 !! end
14380
14381 !! test
14382 Bug 15196: localised external link numbers
14383 !! options
14384 language=fa
14385 !! input
14386 [http://en.wikipedia.org/]
14387 !! result
14388 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
14389 </p>
14390 !! end
14391
14392 !! test
14393 Multibyte character in padleft
14394 !! input
14395 {{padleft:-Hello|7|Æ}}
14396 !! result
14397 <p>Æ-Hello
14398 </p>
14399 !! end
14400
14401 !! test
14402 Multibyte character in padright
14403 !! input
14404 {{padright:Hello-|7|Æ}}
14405 !! result
14406 <p>Hello-Æ
14407 </p>
14408 !! end
14409
14410 !!test
14411 formatdate parser function
14412 !!input
14413 {{#formatdate:2009-03-24}}
14414 !! result
14415 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
14416 </p>
14417 !! end
14418
14419 !!test
14420 formatdate parser function, with default format
14421 !!input
14422 {{#formatdate:2009-03-24|mdy}}
14423 !! result
14424 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
14425 </p>
14426 !! end
14427
14428 !! test
14429 Spacing of numbers in formatted dates
14430 !! input
14431 {{#formatdate:January 15}}
14432 !! result
14433 <p><span class="mw-formatted-date" title="01-15">January 15</span>
14434 </p>
14435 !! end
14436
14437 !! test
14438 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
14439 !! options
14440 language=nl title=[[MediaWiki:Common.css]]
14441 !! input
14442 {{#formatdate:2009-03-24|dmy}}
14443 !! result
14444 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
14445 </p>
14446 !! end
14447
14448 #
14449 #
14450 #
14451
14452 #
14453 # Edit comments
14454 #
14455
14456 !! test
14457 Edit comment with link
14458 !! options
14459 comment
14460 !! input
14461 I like the [[Main Page]] a lot
14462 !! result
14463 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
14464 !!end
14465
14466 !! test
14467 Edit comment with link and link text
14468 !! options
14469 comment
14470 !! input
14471 I like the [[Main Page|best pages]] a lot
14472 !! result
14473 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14474 !!end
14475
14476 !! test
14477 Edit comment with link and link text with suffix
14478 !! options
14479 comment
14480 !! input
14481 I like the [[Main Page|best page]]s a lot
14482 !! result
14483 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14484 !!end
14485
14486 !! test
14487 Edit comment with section link (non-local, eg in history list)
14488 !! options
14489 comment title=[[Main Page]]
14490 !! input
14491 /* External links */ removed bogus entries
14492 !! result
14493 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14494 !!end
14495
14496 !! test
14497 Edit comment with section link and text before it (non-local, eg in history list)
14498 !! options
14499 comment title=[[Main Page]]
14500 !! input
14501 pre-comment text /* External links */ removed bogus entries
14502 !! result
14503 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>
14504 !!end
14505
14506 !! test
14507 Edit comment with section link (local, eg in diff view)
14508 !! options
14509 comment local title=[[Main Page]]
14510 !! input
14511 /* External links */ removed bogus entries
14512 !! result
14513 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14514 !!end
14515
14516 !! test
14517 Edit comment with subpage link (bug 14080)
14518 !! options
14519 comment
14520 subpage
14521 title=[[Subpage test]]
14522 !! input
14523 Poked at a [[/subpage]] here...
14524 !! result
14525 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
14526 !!end
14527
14528 !! test
14529 Edit comment with subpage link and link text (bug 14080)
14530 !! options
14531 comment
14532 subpage
14533 title=[[Subpage test]]
14534 !! input
14535 Poked at a [[/subpage|neat little page]] here...
14536 !! result
14537 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
14538 !!end
14539
14540 !! test
14541 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
14542 !! options
14543 comment
14544 title=[[Subpage test]]
14545 !! input
14546 Poked at a [[/subpage]] here...
14547 !! result
14548 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...
14549 !!end
14550
14551 !! test
14552 Edit comment with bare anchor link (local, as on diff)
14553 !! options
14554 comment
14555 local
14556 title=[[Main Page]]
14557 !!input
14558 [[#section]]
14559 !! result
14560 <a href="#section">#section</a>
14561 !! end
14562
14563 !! test
14564 Edit comment with bare anchor link (non-local, as on history)
14565 !! options
14566 comment
14567 title=[[Main Page]]
14568 !!input
14569 [[#section]]
14570 !! result
14571 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
14572 !! end
14573
14574 !! test
14575 Anchor starting with underscore
14576 !!input
14577 [[#_ref|One]]
14578 !! result
14579 <p><a href="#_ref">One</a>
14580 </p>
14581 !! end
14582
14583 !! test
14584 Id starting with underscore
14585 !!input
14586 <div id="_ref"></div>
14587 !! result
14588 <div id="_ref"></div>
14589
14590 !! end
14591
14592 !! test
14593 Space normalisation on autocomment (bug 22784)
14594 !! options
14595 comment
14596 title=[[Main Page]]
14597 !!input
14598 /* __hello__world__ */
14599 !! result
14600 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
14601 !! end
14602
14603 !! test
14604 percent-encoding and + signs in comments (Bug 26410)
14605 !! options
14606 comment
14607 !!input
14608 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
14609 !! result
14610 <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>
14611 !! end
14612
14613 !! test
14614 Bad images - basic functionality
14615 !! options
14616 disabled
14617 !! input
14618 [[File:Bad.jpg]]
14619 !! result
14620 !! end
14621
14622 !! test
14623 Bad images - bug 16039: text after bad image disappears
14624 !! options
14625 disabled
14626 !! input
14627 Foo bar
14628 [[File:Bad.jpg]]
14629 Bar foo
14630 !! result
14631 <p>Foo bar
14632 </p><p>Bar foo
14633 </p>
14634 !! end
14635
14636 !! test
14637 Verify that displaytitle works (bug #22501) no displaytitle
14638 !! options
14639 showtitle
14640 !! config
14641 wgAllowDisplayTitle=true
14642 wgRestrictDisplayTitle=false
14643 !! input
14644 this is not the the title
14645 !! result
14646 Parser test
14647 <p>this is not the the title
14648 </p>
14649 !! end
14650
14651 !! test
14652 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
14653 !! options
14654 showtitle
14655 title=[[Screen]]
14656 !! config
14657 wgAllowDisplayTitle=true
14658 wgRestrictDisplayTitle=false
14659 !! input
14660 this is not the the title
14661 {{DISPLAYTITLE:whatever}}
14662 !! result
14663 whatever
14664 <p>this is not the the title
14665 </p>
14666 !! end
14667
14668 !! test
14669 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
14670 !! options
14671 showtitle
14672 title=[[Screen]]
14673 !! config
14674 wgAllowDisplayTitle=true
14675 wgRestrictDisplayTitle=true
14676 !! input
14677 this is not the the title
14678 {{DISPLAYTITLE:whatever}}
14679 !! result
14680 Screen
14681 <p>this is not the the title
14682 </p>
14683 !! end
14684
14685 !! test
14686 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
14687 !! options
14688 showtitle
14689 title=[[Screen]]
14690 !! config
14691 wgAllowDisplayTitle=true
14692 wgRestrictDisplayTitle=true
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 </p>
14700 !! end
14701
14702 !! test
14703 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
14704 !! options
14705 showtitle
14706 title=[[Screen]]
14707 !! config
14708 wgAllowDisplayTitle=false
14709 !! input
14710 this is not the the title
14711 {{DISPLAYTITLE:screen}}
14712 !! result
14713 Screen
14714 <p>this is not the the title
14715 <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>
14716 </p>
14717 !! end
14718
14719 !! test
14720 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
14721 !! options
14722 showtitle
14723 title=[[Screen]]
14724 !! config
14725 wgAllowDisplayTitle=false
14726 !! input
14727 this is not the the title
14728 !! result
14729 Screen
14730 <p>this is not the the title
14731 </p>
14732 !! end
14733
14734 !! test
14735 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
14736 !! options
14737 showtitle
14738 title=[[Screen]]
14739 !! config
14740 wgAllowDisplayTitle=true
14741 wgRestrictDisplayTitle=true
14742 !! input
14743 this is not the the title
14744 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
14745 !! result
14746 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
14747 <p>this is not the the title
14748 </p>
14749 !! end
14750
14751 !! test
14752 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
14753 !! options
14754 showtitle
14755 title=[[Screen]]
14756 !! config
14757 wgAllowDisplayTitle=true
14758 wgRestrictDisplayTitle=true
14759 !! input
14760 this is not the the title
14761 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
14762 !! result
14763 <span style="color: red;">s</span>creen
14764 <p>this is not the the title
14765 </p>
14766 !! end
14767
14768 !! test
14769 preload: check <noinclude> and <includeonly>
14770 !! options
14771 preload
14772 !! input
14773 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
14774 !! result
14775 Hello kind world.
14776 !! end
14777
14778 !! test
14779 preload: check <onlyinclude>
14780 !! options
14781 preload
14782 !! input
14783 Goodbye <onlyinclude>Hello world</onlyinclude>
14784 !! result
14785 Hello world
14786 !! end
14787
14788 !! test
14789 preload: can pass tags through if we want to
14790 !! options
14791 preload
14792 !! input
14793 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
14794 !! result
14795 <includeonly>Hello world</includeonly>
14796 !! end
14797
14798 !! test
14799 preload: check that it doesn't try to do tricks
14800 !! options
14801 preload
14802 !! input
14803 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14804 !! result
14805 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14806 !! end
14807
14808 !! test
14809 Play a bit with r67090 and bug 3158
14810 !! options
14811 disabled
14812 !! input
14813 <div style="width:50% !important">&nbsp;</div>
14814 <div style="width:50%&nbsp;!important">&nbsp;</div>
14815 <div style="width:50%&#160;!important">&nbsp;</div>
14816 <div style="border : solid;">&nbsp;</div>
14817 !! result
14818 <div style="width:50% !important">&nbsp;</div>
14819 <div style="width:50% !important">&nbsp;</div>
14820 <div style="width:50% !important">&nbsp;</div>
14821 <div style="border&#160;: solid;">&nbsp;</div>
14822
14823 !! end
14824
14825 !! test
14826 HTML5 data attributes
14827 !! input
14828 <span data-foo="bar">Baz</span>
14829 <p data-abc-def_hij="">Quuz</p>
14830 !! result
14831 <p><span data-foo="bar">Baz</span>
14832 </p>
14833 <p data-abc-def_hij="">Quuz</p>
14834
14835 !! end
14836
14837 !! test
14838 percent-encoding and + signs in internal links (Bug 26410)
14839 !! input
14840 [[User:+%]] [[Page+title%]]
14841 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
14842 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
14843 [[%33%45]] [[%33%45+]]
14844 !! result
14845 <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>
14846 <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>
14847 <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>
14848 <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>
14849 </p>
14850 !! end
14851
14852 !! test
14853 Special characters in embedded file links (bug 27679)
14854 !! input
14855 [[File:Contains & ampersand.jpg]]
14856 [[File:Does not exist.jpg|Title with & ampersand]]
14857 !! result
14858 <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>
14859 <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>
14860 </p>
14861 !! end
14862
14863
14864 !! test
14865 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
14866 !! input
14867 Text&apos;s been normalized?
14868 !! result
14869 <p>Text&#39;s been normalized?
14870 </p>
14871 !! end
14872
14873 !! test
14874 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
14875 !! input
14876 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
14877 !! result
14878 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
14879 </p>
14880 !! end
14881
14882 !! test
14883 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
14884 !! input
14885 [http://www.example.org/ ideograms]
14886 !! result
14887 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
14888 </p>
14889 !! end
14890
14891 !! test
14892 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
14893 !! input
14894 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
14895 !! result
14896 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
14897 </p>
14898 !! end
14899
14900 !! article
14901 Mediawiki:loop1
14902 !! text
14903 {{Identical|A}}
14904 !! endarticle
14905
14906 !! article
14907 Mediawiki:loop2
14908 !! text
14909 {{Identical|B}}
14910 !! endarticle
14911
14912 !! article
14913 Template:Identical
14914 !! text
14915 {{int:loop1}}
14916 {{int:loop2}}
14917 !! endarticle
14918
14919 !! test
14920 Bug 31098 Template which includes system messages which includes the template
14921 !! input
14922 {{Identical}}
14923 !! result
14924 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14925 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14926 </p>
14927 !! end
14928
14929 !! test
14930 Bug31490 Turkish: ucfirst 'blah'
14931 !! options
14932 language=tr
14933 !! input
14934 {{ucfirst:blah}}
14935 !! result
14936 <p>Blah
14937 </p>
14938 !! end
14939
14940 !! test
14941 Bug31490 Turkish: ucfirst 'ix'
14942 !! options
14943 language=tr
14944 !! input
14945 {{ucfirst:ix}}
14946 !! result
14947 <p>İx
14948 </p>
14949 !! end
14950
14951 !! test
14952 Bug31490 Turkish: lcfirst 'BLAH'
14953 !! options
14954 language=tr
14955 !! input
14956 {{lcfirst:BLAH}}
14957 !! result
14958 <p>bLAH
14959 </p>
14960 !! end
14961
14962 !! test
14963 Bug31490 Turkish: ucfırst (with a dotless i)
14964 !! options
14965 language=tr
14966 !! input
14967 {{ucfırst:blah}}
14968 !! result
14969 <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>
14970 </p>
14971 !! end
14972
14973 !! test
14974 Bug31490 ucfırst (with a dotless i) with English language
14975 !! options
14976 language=en
14977 !! input
14978 {{ucfırst:blah}}
14979 !! result
14980 <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>
14981 </p>
14982 !! end
14983
14984 !! test
14985 Bug 26375: TOC with italics
14986 !! options
14987 title=[[Main Page]]
14988 !! input
14989 __TOC__
14990 == ''Lost'' episodes ==
14991 !! result
14992 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14993 <ul>
14994 <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>
14995 </ul>
14996 </div>
14997 <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>
14998
14999 !! end
15000
15001 !! test
15002 Bug 26375: TOC with bold
15003 !! options
15004 title=[[Main Page]]
15005 !! input
15006 __TOC__
15007 == '''should be bold''' then normal text ==
15008 !! result
15009 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15010 <ul>
15011 <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>
15012 </ul>
15013 </div>
15014 <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>
15015
15016 !! end
15017
15018 !! test
15019 Bug 33845: Headings become cursive in TOC when they contain an image
15020 !! options
15021 title=[[Main Page]]
15022 !! input
15023 __TOC__
15024 == Image [[Image:foobar.jpg]] ==
15025 !! result
15026 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15027 <ul>
15028 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
15029 </ul>
15030 </div>
15031 <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>
15032
15033 !! end
15034
15035 !! test
15036 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
15037 !! options
15038 title=[[Main Page]]
15039 !! input
15040 __TOC__
15041 == <blockquote>Quote</blockquote> ==
15042 !! result
15043 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15044 <ul>
15045 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
15046 </ul>
15047 </div>
15048 <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>
15049
15050 !! end
15051
15052 !! test
15053 Unclosed tags in TOC
15054 !! options
15055 title=[[Main Page]]
15056 !! input
15057 __TOC__
15058 == Proof: 2 < 3 ==
15059 <small>Hanc marginis exiguitas non caperet.</small>
15060 QED
15061 !! result
15062 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15063 <ul>
15064 <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>
15065 </ul>
15066 </div>
15067 <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>
15068 <p><small>Hanc marginis exiguitas non caperet.</small>
15069 QED
15070 </p>
15071 !! end
15072
15073 !! test
15074 Multiple tags in TOC
15075 !! input
15076 __TOC__
15077 == <i>Foo</i> <b>Bar</b> ==
15078
15079 == <i>Foo</i> <blockquote>Bar</blockquote> ==
15080 !! result
15081 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15082 <ul>
15083 <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>
15084 <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>
15085 </ul>
15086 </div>
15087 <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>
15088 <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>
15089
15090 !! end
15091
15092 !! test
15093 Tags with parameters in TOC
15094 !! input
15095 __TOC__
15096 == <sup class="in-h2">Hello</sup> ==
15097
15098 == <sup class="a > b">Evilbye</sup> ==
15099 !! result
15100 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15101 <ul>
15102 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
15103 <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>
15104 </ul>
15105 </div>
15106 <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>
15107 <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>
15108
15109 !! end
15110
15111 !! test
15112 span tags with directionality in TOC
15113 !! input
15114 __TOC__
15115 == <span dir="ltr">C++</span> ==
15116
15117 == <span dir="rtl">זבנג!</span> ==
15118
15119 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
15120
15121 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
15122
15123 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
15124 !! result
15125 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15126 <ul>
15127 <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>
15128 <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>
15129 <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>
15130 <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>
15131 <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>
15132 </ul>
15133 </div>
15134 <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>
15135 <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>
15136 <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>
15137 <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>
15138 <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>
15139
15140 !! end
15141
15142 !! article
15143 MediaWiki:Bug32057
15144 !! text
15145 == {{int:headline_sample}} ==
15146 !! endarticle
15147
15148 !! test
15149 Bug 32057: Title needed when expanding <h> nodes.
15150 !! options
15151 title=[[Main Page]]
15152 !! input
15153 {{int:Bug32057}}
15154 !! result
15155 <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>
15156
15157 !! end
15158
15159 !! test
15160 Strip marker in urlencode
15161 !! input
15162 {{urlencode:x<nowiki/>y}}
15163 {{urlencode:x<nowiki/>y|wiki}}
15164 {{urlencode:x<nowiki/>y|path}}
15165 !! result
15166 <p>xy
15167 xy
15168 xy
15169 </p>
15170 !! end
15171
15172 !! test
15173 Strip marker in lc
15174 !! input
15175 {{lc:x<nowiki/>y}}
15176 !! result
15177 <p>xy
15178 </p>
15179 !! end
15180
15181 !! test
15182 Strip marker in uc
15183 !! input
15184 {{uc:x<nowiki/>y}}
15185 !! result
15186 <p>XY
15187 </p>
15188 !! end
15189
15190 !! test
15191 Strip marker in formatNum
15192 !! input
15193 {{formatnum:1<nowiki/>2}}
15194 {{formatnum:1<nowiki/>2|R}}
15195 !! result
15196 <p>12
15197 12
15198 </p>
15199 !! end
15200
15201 !! test
15202 Check noCommafy in formatNum
15203 !! options
15204 language=be-tarask
15205 !! input
15206 {{formatnum:123456.78}}
15207 {{formatnum:123456.78|NOSEP}}
15208 !! result
15209 <p>123 456,78
15210 123456.78
15211 </p>
15212 !! end
15213
15214 !! test
15215 Strip marker in grammar
15216 !! options
15217 language=fi
15218 !! input
15219 {{grammar:elative|foo<nowiki/>bar}}
15220 !! result
15221 <p>foobarista
15222 </p>
15223 !! end
15224
15225 !! test
15226 Strip marker in padleft
15227 !! input
15228 {{padleft:|2|x<nowiki/>y}}
15229 !! result
15230 <p>xy
15231 </p>
15232 !! end
15233
15234 !! test
15235 Strip marker in padright
15236 !! input
15237 {{padright:|2|x<nowiki/>y}}
15238 !! result
15239 <p>xy
15240 </p>
15241 !! end
15242
15243 !! test
15244 Strip marker in anchorencode
15245 !! input
15246 {{anchorencode:x<nowiki/>y}}
15247 !! result
15248 <p>xy
15249 </p>
15250 !! end
15251
15252 !! test
15253 nowiki inside link inside heading (bug 18295)
15254 !! input
15255 ==[[foo|x<nowiki>y</nowiki>z]]==
15256 !! result
15257 <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>
15258
15259 !! end
15260
15261 !! test
15262 new support for bdi element (bug 31817)
15263 !! input
15264 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
15265 !! result
15266 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
15267
15268 !!end
15269
15270 !! test
15271 Ignore pipe between table row attributes
15272 !! input
15273 {|
15274 | quux
15275 |- id=foo | style='color: red'
15276 | bar
15277 |}
15278 !! result
15279 <table>
15280 <tr>
15281 <td> quux
15282 </td></tr>
15283 <tr id="foo" style="color: red">
15284 <td> bar
15285 </td></tr></table>
15286
15287 !! end
15288
15289 !!test
15290 Gallery override link with WikiLink (bug 34852)
15291 !! input
15292 <gallery>
15293 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
15294 </gallery>
15295 !! result
15296 <ul class="gallery mw-gallery-traditional">
15297 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15298 <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>
15299 <div class="gallerytext">
15300 <p>caption
15301 </p>
15302 </div>
15303 </div></li>
15304 </ul>
15305
15306 !! end
15307
15308 !!test
15309 Gallery override link with absolute external link (bug 34852)
15310 !! input
15311 <gallery>
15312 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
15313 </gallery>
15314 !! result
15315 <ul class="gallery mw-gallery-traditional">
15316 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15317 <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>
15318 <div class="gallerytext">
15319 <p>caption
15320 </p>
15321 </div>
15322 </div></li>
15323 </ul>
15324
15325 !! end
15326
15327 !!test
15328 Gallery override link with malicious javascript (bug 34852)
15329 !! input
15330 <gallery>
15331 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
15332 </gallery>
15333 !! result
15334 <ul class="gallery mw-gallery-traditional">
15335 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15336 <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>
15337 <div class="gallerytext">
15338 <p>caption
15339 </p>
15340 </div>
15341 </div></li>
15342 </ul>
15343
15344 !! end
15345
15346 !!test
15347 Gallery with invalid title as link (bug 43964)
15348 !! input
15349 <gallery>
15350 File:foobar.jpg|link=<
15351 </gallery>
15352 !! result
15353 <ul class="gallery mw-gallery-traditional">
15354 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15355 <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>
15356 <div class="gallerytext">
15357 </div>
15358 </div></li>
15359 </ul>
15360
15361 !! end
15362
15363 !!test
15364 Language parser function
15365 !! input
15366 {{#language:ar}}
15367 !! result
15368 <p>العربية
15369 </p>
15370 !! end
15371
15372 !!test
15373 Padleft and padright as substr
15374 !! input
15375 {{padleft:|3|abcde}}
15376 {{padright:|3|abcde}}
15377 !! result
15378 <p>abc
15379 abc
15380 </p>
15381 !! end
15382
15383 !!test
15384 Special parser function
15385 !! input
15386 {{#special:RandomPage}}
15387 {{#special:BaDtItLe}}
15388 {{#special:Foobar}}
15389 !! result
15390 <p>Special:Random
15391 Special:Badtitle
15392 Special:Foobar
15393 </p>
15394 !! end
15395
15396 !!test
15397 Bug 34939 - Case insensitive link parsing ([HttP://])
15398 !! input
15399 [HttP://MediaWiki.Org/]
15400 !! result
15401 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
15402 </p>
15403 !! end
15404
15405 !!test
15406 Bug 34939 - Case insensitive link parsing ([HttP:// title])
15407 !! input
15408 [HttP://MediaWiki.Org/ MediaWiki]
15409 !! result
15410 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
15411 </p>
15412 !! end
15413
15414 !!test
15415 Bug 34939 - Case insensitive link parsing (HttP://)
15416 !! input
15417 HttP://MediaWiki.Org/
15418 !! result
15419 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
15420 </p>
15421 !! end
15422
15423
15424 ###
15425 ### Parsoids-specific tests
15426 ### Parsoid-PHP parser incompatibilities
15427 ###
15428 !!test
15429 1. SOL-sensitive wikitext tokens as template-args
15430 !!options
15431 parsoid=wt2html,wt2wt
15432 !!input
15433 {{echo|*a}}
15434 {{echo|#a}}
15435 {{echo|:a}}
15436 !!result
15437 <span about="#mwt1" typeof="mw:Transclusion">
15438 </span><ul about="#mwt1"><li>a</li></ul>
15439 <span about="#mwt2" typeof="mw:Transclusion">
15440 </span><ol about="#mwt2"><li>a</li></ol>
15441 <span about="#mwt3" typeof="mw:Transclusion">
15442 </span><dl about="#mwt3"><dd>a</dd></dl>
15443 !!end
15444
15445 #### ----------------------------------------------------------------
15446 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
15447 #### tags. Parsoid's output for these tags differs from that of the
15448 #### PHP parser.
15449 #### ----------------------------------------------------------------
15450
15451 !!test
15452 Ref: 1. ref-location should be replaced with an index span
15453 !!options
15454 parsoid
15455 !!input
15456 A <ref>foo</ref>
15457 B <ref name="x">foo</ref>
15458 C <ref name="y" />
15459 !!result
15460 <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>
15461 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>
15462 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>
15463 !!end
15464
15465 !!test
15466 Ref: 2. ref-tags with identical names should all get the same index
15467 !!options
15468 parsoid
15469 !!input
15470 A <ref name="x">foo</ref>
15471 B <ref name="x" />
15472 !!result
15473 <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>
15474 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>
15475 !!end
15476
15477 !!test
15478 Ref: 3. spaces in ref-names should be ignored
15479 !!options
15480 parsoid
15481 !!input
15482 A <ref name="x">foo</ref>
15483 B <ref name=" x " />
15484 C <ref name= x />
15485 !!result
15486 <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>
15487 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>
15488 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>
15489 !!end
15490
15491 !!test
15492 Ref: 4. 'constructor' should be accepted as a valid ref-name
15493 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
15494 !!options
15495 parsoid
15496 !!input
15497 A <ref name="constructor">foo</ref>
15498 !!result
15499 <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>
15500 !!end
15501
15502 !!test
15503 Ref: 5. body should accept generic wikitext
15504 !!options
15505 parsoid
15506 !!input
15507 A <ref>
15508 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
15509 </ref>
15510
15511 <references />
15512 !!result
15513 <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>
15514
15515 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15516 <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>
15517 </li></ol>
15518 !!end
15519
15520 !!test
15521 Ref: 6. indent-pres should not be output in ref-body
15522 !!options
15523 parsoid
15524 !!input
15525 A <ref>
15526 foo
15527 bar
15528 baz
15529 </ref>
15530
15531 <references />
15532 !!result
15533 <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>
15534
15535 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15536 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15537 bar
15538 baz
15539 </li></ol>
15540 !!end
15541
15542 !!test
15543 Ref: 6. No p-wrapping in ref-body
15544 !!options
15545 parsoid
15546 !!input
15547 A <ref>
15548 foo
15549
15550 bar
15551
15552
15553 baz
15554
15555
15556
15557 booz
15558 </ref>
15559
15560 <references />
15561 !!result
15562 <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>
15563
15564 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15565 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15566
15567 bar
15568
15569
15570 baz
15571
15572
15573
15574 booz
15575 </li></ol>
15576 !!end
15577
15578 !!test
15579 Ref: 8. transclusion wikitext has lower precedence
15580 !!options
15581 parsoid
15582 !!input
15583 A <ref> foo {{echo|</ref> B C}}
15584
15585 <references />
15586 !!result
15587 <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>
15588
15589 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15590 <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>
15591 !!end
15592
15593 !!test
15594 Ref: 9. unclosed comments should not leak out of ref-body
15595 !!options
15596 parsoid
15597 !!input
15598 A <ref> foo <!--</ref> B C
15599
15600 <references />
15601 !!result
15602 <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>
15603
15604 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15605 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
15606 !!end
15607
15608 !!test
15609 Ref: 10. Unclosed HTML tags should not leak out of ref-body
15610 !!options
15611 parsoid
15612 !!input
15613 A <ref> <b> foo </ref> B C
15614
15615 <references />
15616 !!result
15617 <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>
15618
15619 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15620 <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>
15621 !!end
15622
15623 !!test
15624 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
15625 !!options
15626 parsoid
15627 !!input
15628 A <ref>foo</ref> B
15629 C <ref>bar</ref> D
15630 !!result
15631 <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
15632 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>
15633 !!end
15634
15635 !!test
15636 Ref: 12. ref-tags act as trailing newline migration barrier
15637 !!options
15638 parsoid
15639 !!input
15640 <!--the newline at the end of this line moves out of the p-tag-->a
15641
15642 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
15643 <ref />
15644
15645 c
15646 !!result
15647 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
15648
15649
15650 <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>
15651 <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>
15652
15653
15654 <p>c</p>
15655 !!end
15656
15657 !!test
15658 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
15659 !!options
15660 parsoid
15661 !!input
15662 <ref>foo</ref> A
15663 <ref>bar
15664 </ref> B
15665 !!result
15666 <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
15667 <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>
15668 !!end
15669
15670 !!test
15671 Ref: 14. A nested ref-tag should be emitted as plain text
15672 !!options
15673 parsoid
15674 !!input
15675 <ref>foo <ref>bar</ref> baz</ref>
15676
15677 <references />
15678 !!result
15679 <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>
15680
15681 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
15682 <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>
15683 !!end
15684
15685 !!test
15686 Ref: 15. ref-tags with identical names should get identical indexes
15687 !!options
15688 parsoid
15689 !!input
15690 A1 <ref name="a">foo</ref> A2 <ref name="a" />
15691 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
15692
15693 <references />
15694 !!result
15695 <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>
15696 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>
15697
15698 <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>
15699 !!end
15700
15701 !!test
15702 References: 1. references tag without any refs should be handled properly
15703 !!options
15704 parsoid
15705 !!input
15706 <references />
15707 !!result
15708 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
15709 !!end
15710
15711 !!test
15712 References: 2. references tag with group only outputs references from that group
15713 !!options
15714 parsoid
15715 !!input
15716 A <ref group="a">foo</ref>
15717 B <ref group="b">bar</ref>
15718
15719 <references group='a' />
15720 !!result
15721 <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>
15722 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>
15723
15724 <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>
15725 !!end
15726
15727 !!test
15728 References: 3. ref list should be cleared after processing references
15729 !!options
15730 parsoid
15731 !!input
15732 A <ref>foo</ref>
15733
15734 <references />
15735
15736 B <ref>bar</ref>
15737
15738 <references />
15739 !!result
15740 <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>
15741
15742 <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>
15743
15744 <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>
15745
15746 <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>
15747 !!end
15748
15749 !!test
15750 References: 4. only referenced group should be cleared after processing references
15751 !!options
15752 parsoid
15753 !!input
15754 A <ref group="a">afoo</ref>
15755 B <ref>bfoo</ref>
15756
15757 <references group="a"/>
15758
15759 C <ref>cfoo</ref>
15760
15761 <references />
15762 !!result
15763 <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>
15764 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>
15765
15766 <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>
15767
15768 <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>
15769
15770 <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>
15771 !!end
15772
15773 !!test
15774 References: 5. ref tags in references should be processed while ignoring all other content
15775 !!options
15776 parsoid
15777 !!input
15778 A <ref name="a" />
15779 B <ref name="b">bar</ref>
15780
15781 <references>
15782 <ref name="a">foo</ref>
15783 This should just get lost.
15784 </references>
15785 !!result
15786 <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>
15787 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>
15788
15789 <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>
15790 !!end
15791
15792 !!test
15793 References: 6. <references /> from a transclusion
15794 !!options
15795 parsoid
15796 !!input
15797 {{echo|<references />}}
15798 !!result
15799 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}'></ol>
15800 !!end
15801
15802 !! test
15803 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
15804 !! options
15805 parsoid
15806 !! input
15807 A <ref>foo bar for a</ref>
15808 B <ref name="b" />
15809
15810 <references />
15811
15812 <references>
15813 <ref name="b">foo</ref>
15814 </references>
15815 !! result
15816 <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>
15817 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>
15818
15819 <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>
15820
15821 <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>
15822
15823 !! end
15824
15825 #### ----------------------------------------------------------------
15826 #### The following section of tests are primarily to test
15827 #### wikitext escaping capabilities of Parsoid. Given that
15828 #### escaping can be done any number of ways, the wikitext (input)
15829 #### is always adjusted to reflect how Parsoid adds nowiki
15830 #### escape tags.
15831 ####
15832 #### We are marking several tests as parsoid-only since the
15833 #### HTML in the result section is different from what the
15834 #### PHP parser generates for it.
15835 #### ----------------------------------------------------------------
15836
15837
15838 #### --------------- Headings ---------------
15839 #### 0. Unnested
15840 #### 1. Nested inside html <h1>=foo=</h1>
15841 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
15842 #### 3. Nested inside html with wikitext split by html tags
15843 #### 4. No escape needed
15844 #### 5. Empty headings <h1></h1>
15845 #### 6. Heading chars in SOL context
15846 #### ----------------------------------------
15847 !! test
15848 Headings: 0. Unnested
15849 !! options
15850 parsoid
15851 !! input
15852 <nowiki>=foo=</nowiki>
15853
15854 <nowiki> =foo= </nowiki>
15855 <!--cmt-->
15856 <nowiki>=foo=</nowiki>
15857
15858 =foo''a''<nowiki>=</nowiki>
15859 !! result
15860 <p><span typeof="mw:Nowiki">=foo=</span></p>
15861
15862 <p><span typeof="mw:Nowiki"> =foo= </span>
15863 <!--cmt-->
15864 <span typeof="mw:Nowiki">=foo=</span></p>
15865
15866 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
15867 !!end
15868
15869 !! test
15870 Headings: 1. Nested inside html
15871 !! options
15872 parsoid
15873 !! input
15874 =<nowiki>=foo=</nowiki>=
15875
15876 ==<nowiki>=foo=</nowiki>==
15877
15878 ===<nowiki>=foo=</nowiki>===
15879
15880 ====<nowiki>=foo=</nowiki>====
15881
15882 =====<nowiki>=foo=</nowiki>=====
15883
15884 ======<nowiki>=foo=</nowiki>======
15885 !! result
15886 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
15887 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
15888 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
15889 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
15890 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
15891 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
15892 !!end
15893
15894 !! test
15895 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
15896 !! options
15897 parsoid
15898 !! input
15899 =foo=
15900 <nowiki>*</nowiki>bar
15901
15902 =foo=
15903 =bar
15904
15905 =foo=
15906 <nowiki>=bar=</nowiki>
15907 !! result
15908 <h1>foo</h1>*bar
15909 <h1>foo</h1>=bar
15910 <h1>foo</h1>=bar=
15911 !!end
15912
15913 !! test
15914 Headings: 3. Nested inside html with wikitext split by html tags
15915 !! options
15916 parsoid
15917 !! input
15918 =='''bold'''<nowiki>foo=</nowiki>=
15919 !! result
15920 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
15921 !!end
15922
15923 !! test
15924 Headings: 4a. No escaping needed (testing just h1 and h2)
15925 !! options
15926 parsoid
15927 !! input
15928 ==foo=
15929
15930 =foo==
15931
15932 = =foo= =
15933
15934 ==foo= bar=
15935
15936 ===foo==
15937
15938 ==foo===
15939
15940 =''=''foo==
15941
15942 =<nowiki>=</nowiki>=
15943 !! result
15944 <h1>=foo</h1>
15945 <h1>foo=</h1>
15946 <h1> =foo= </h1>
15947 <h1>=foo= bar</h1>
15948 <h2>=foo</h2>
15949 <h2>foo=</h2>
15950 <h1><i>=</i>foo=</h1>
15951 <h1><span typeof="mw:Nowiki">=</span></h1>
15952 !!end
15953
15954 !! test
15955 Headings: 4b. No escaping needed (inside p-tags)
15956 !! options
15957 parsoid
15958 !! input
15959 ===
15960 =foo= x
15961 =foo= <s></s>
15962 !! result
15963 <p>===
15964 =foo= x
15965 =foo= <s></s>
15966 </p>
15967 !!end
15968
15969 !! test
15970 Headings: 5. Empty headings
15971 !! options
15972 parsoid
15973 !! input
15974 =<nowiki/>=
15975
15976 ==<nowiki/>==
15977
15978 ===<nowiki/>===
15979
15980 ====<nowiki/>====
15981
15982 =====<nowiki/>=====
15983
15984 ======<nowiki/>======
15985 !! result
15986 <h1></h1>
15987 <h2></h2>
15988 <h3></h3>
15989 <h4></h4>
15990 <h5></h5>
15991 <h6></h6>
15992 !!end
15993
15994 !! test
15995 Headings: 6a. Heading chars in SOL context (with trailing spaces)
15996 !! options
15997 parsoid
15998 !! input
15999 <nowiki>=a=</nowiki>
16000
16001 <nowiki>=a=</nowiki>
16002
16003 <nowiki>=a=</nowiki>
16004
16005 <nowiki>=a=</nowiki>
16006 !! result
16007 <p>=a=</p>
16008 <p>=a= </p>
16009 <p>=a= </p>
16010 <p>=a= </p>
16011 !!end
16012
16013 !! test
16014 Headings: 6b. Heading chars in SOL context (with trailing newlines)
16015 !! options
16016 parsoid
16017 !! input
16018 <nowiki>=a=
16019 b</nowiki>
16020
16021 <nowiki>=a=
16022 b</nowiki>
16023
16024 <nowiki>=a=
16025 b</nowiki>
16026
16027 <nowiki>=a=
16028 b</nowiki>
16029 !! result
16030 <p>=a=
16031 b</p>
16032 <p>=a=
16033 b</p>
16034 <p>=a=
16035 b</p>
16036 <p>=a=
16037 b</p>
16038 </p>
16039 !!end
16040
16041 !! test
16042 Headings: 6c. Heading chars in SOL context (leading newline break)
16043 !! options
16044 parsoid
16045 !! input
16046 a
16047 <nowiki>=b=</nowiki>
16048 !! result
16049 <p>a
16050 =b=</p>
16051 !!end
16052
16053 !! test
16054 Headings: 6d. Heading chars in SOL context (with interspersed comments)
16055 !! options
16056 parsoid
16057 !! input
16058 <!--c0--><nowiki>=a=</nowiki>
16059 <!--c1-->
16060 <nowiki>=a=</nowiki> <!--c2--> <!--c3-->
16061 !! result
16062 <p><!--c0-->=a=</p>
16063 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
16064 !!end
16065
16066 !! test
16067 Headings: 6d. Heading chars in SOL context (No escaping needed)
16068 !! options
16069 parsoid=html2wt
16070 !! input
16071 =a=<div>b</div>
16072 !! result
16073 =a=<div>b</div>
16074 !!end
16075
16076 #### --------------- Lists ---------------
16077 #### 0. Outside nests (*foo, etc.)
16078 #### 1. Nested inside html <ul><li>*foo</li></ul>
16079 #### 2. Inside definition lists
16080 #### 3. Only bullets at start should be escaped
16081 #### 4. No escapes needed
16082 #### 5. No unnecessary escapes
16083 #### 6. Escape bullets in SOL position
16084 #### 7. Escape bullets in a multi-line context
16085 #### ----------------------------------------
16086
16087 !! test
16088 Lists: 0. Outside nests
16089 !! input
16090 <nowiki>*</nowiki>foo
16091
16092 <nowiki>#</nowiki>foo
16093 !! result
16094 <p>*foo
16095 </p><p>#foo
16096 </p>
16097 !!end
16098
16099 !! test
16100 Lists: 1. Nested inside html
16101 !! input
16102 *<nowiki>*foo</nowiki>
16103
16104 *<nowiki>#foo</nowiki>
16105
16106 *<nowiki>:foo</nowiki>
16107
16108 *<nowiki>;foo</nowiki>
16109
16110 #<nowiki>*foo</nowiki>
16111
16112 #<nowiki>#foo</nowiki>
16113
16114 #<nowiki>:foo</nowiki>
16115
16116 #<nowiki>;foo</nowiki>
16117 !! result
16118 <ul><li>*foo
16119 </li></ul>
16120 <ul><li>#foo
16121 </li></ul>
16122 <ul><li>:foo
16123 </li></ul>
16124 <ul><li>;foo
16125 </li></ul>
16126 <ol><li>*foo
16127 </li></ol>
16128 <ol><li>#foo
16129 </li></ol>
16130 <ol><li>:foo
16131 </li></ol>
16132 <ol><li>;foo
16133 </li></ol>
16134
16135 !!end
16136
16137 !! test
16138 Lists: 2. Inside definition lists
16139 !! input
16140 ;<nowiki>;foo</nowiki>
16141
16142 ;<nowiki>:foo</nowiki>
16143
16144 ;<nowiki>:foo</nowiki>
16145 :bar
16146
16147 :<nowiki>:foo</nowiki>
16148 !! result
16149 <dl><dt>;foo
16150 </dt></dl>
16151 <dl><dt>:foo
16152 </dt></dl>
16153 <dl><dt>:foo
16154 </dt><dd>bar
16155 </dd></dl>
16156 <dl><dd>:foo
16157 </dd></dl>
16158
16159 !!end
16160
16161 !! test
16162 Lists: 3. Only bullets at start of text should be escaped
16163 !! input
16164 *<nowiki>*foo*bar</nowiki>
16165
16166 *<nowiki>*foo</nowiki>''it''*bar
16167 !! result
16168 <ul><li>*foo*bar
16169 </li></ul>
16170 <ul><li>*foo<i>it</i>*bar
16171 </li></ul>
16172
16173 !!end
16174
16175 !! test
16176 Lists: 4. No escapes needed
16177 !! options
16178 parsoid
16179 !! input
16180 *foo*bar
16181
16182 *''foo''*bar
16183
16184 *[[Foo]]: bar
16185 !! result
16186 <ul><li>foo*bar
16187 </li></ul>
16188 <ul><li><i>foo</i>*bar
16189 </li></ul>
16190 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
16191 </li></ul>
16192 !!end
16193
16194 !! test
16195 Lists: 5. No unnecessary escapes
16196 !! input
16197 * bar <span><nowiki>[[foo]]</nowiki></span>
16198
16199 *=bar <span><nowiki>[[foo]]</nowiki></span>
16200
16201 *[[bar <span><nowiki>[[foo]]</nowiki></span>
16202
16203 *]]bar <span><nowiki>[[foo]]</nowiki></span>
16204
16205 *=bar <span>foo]]</span>=
16206
16207 * <s></s>: a
16208 !! result
16209 <ul><li> bar <span>[[foo]]</span>
16210 </li></ul>
16211 <ul><li>=bar <span>[[foo]]</span>
16212 </li></ul>
16213 <ul><li>[[bar <span>[[foo]]</span>
16214 </li></ul>
16215 <ul><li>]]bar <span>[[foo]]</span>
16216 </li></ul>
16217 <ul><li>=bar <span>foo]]</span>=
16218 </li></ul>
16219 <ul><li> <s></s>: a
16220 </li></ul>
16221
16222 !!end
16223
16224 !! test
16225 Lists: 6. Escape bullets in SOL position
16226 !! options
16227 parsoid
16228 !! input
16229 <!--cmt--><nowiki>*foo</nowiki>
16230 !! result
16231 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
16232 !!end
16233
16234 !! test
16235 Lists: 7. Escape bullets in a multi-line context
16236 !! input
16237 a
16238 <nowiki>*</nowiki>b
16239 !! result
16240 <p>a
16241 *b
16242 </p>
16243 !!end
16244
16245 #### --------------- HRs ---------------
16246 #### 1. Single line
16247 #### -----------------------------------
16248
16249 !! test
16250 HRs: 1. Single line
16251 !! options
16252 parsoid
16253 !! input
16254 ----<nowiki>----</nowiki>
16255 ----=foo=
16256 ----*foo
16257 !! result
16258 <hr><span typeof="mw:Nowiki">----</span>
16259 <hr>=foo=
16260 <hr>*foo
16261 !! end
16262
16263 #### --------------- Tables ---------------
16264 #### 1a. Simple example
16265 #### 1b. No escaping needed (!foo)
16266 #### 1c. No escaping needed (|foo)
16267 #### 1d. No escaping needed (|}foo)
16268 ####
16269 #### 2a. Nested in td (<td>foo|bar</td>)
16270 #### 2b. Nested in td (<td>foo||bar</td>)
16271 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
16272 ####
16273 #### 3a. Nested in th (<th>foo!bar</th>)
16274 #### 3b. Nested in th (<th>foo!!bar</th>)
16275 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
16276 ####
16277 #### 4a. Escape -
16278 #### 4b. Escape +
16279 #### 4c. No escaping needed
16280 #### --------------------------------------
16281
16282 !! test
16283 Tables: 1a. Simple example
16284 !! input
16285 <nowiki>{|
16286 |}</nowiki>
16287 !! result
16288 <p>{|
16289 |}
16290 </p>
16291 !! end
16292
16293 !! test
16294 Tables: 1b. No escaping needed
16295 !! input
16296 !foo
16297 !! result
16298 <p>!foo
16299 </p>
16300 !! end
16301
16302 !! test
16303 Tables: 1c. No escaping needed
16304 !! input
16305 |foo
16306 !! result
16307 <p>|foo
16308 </p>
16309 !! end
16310
16311 !! test
16312 Tables: 1d. No escaping needed
16313 !! input
16314 |}foo
16315 !! result
16316 <p>|}foo
16317 </p>
16318 !! end
16319
16320 !! test
16321 Tables: 2a. Nested in td
16322 !! options
16323 parsoid
16324 !! input
16325 {|
16326 |<nowiki>foo|bar</nowiki>
16327 |}
16328 !! result
16329 <table><tbody><tr>
16330 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
16331 !! end
16332
16333 !! test
16334 Tables: 2b. Nested in td
16335 !! options
16336 parsoid
16337 !! input
16338 {|
16339 |<nowiki>foo||bar</nowiki>
16340 |''it''<nowiki>foo||bar</nowiki>
16341 |}
16342 !! result
16343 <table><tbody><tr>
16344 <td><span typeof="mw:Nowiki">foo||bar</span></td>
16345 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
16346 !! end
16347
16348 !! test
16349 Tables: 2c. Nested in td -- no escaping needed
16350 !! options
16351 parsoid
16352 !! input
16353 {|
16354 |foo!!bar
16355 |}
16356 !! result
16357 <table><tbody><tr><td>foo!!bar
16358 </td></tr></tbody></table>
16359
16360 !! end
16361
16362 !! test
16363 Tables: 3a. Nested in th
16364 !! options
16365 parsoid
16366 !! input
16367 {|
16368 !foo!bar
16369 |}
16370 !! result
16371 <table><tbody><tr><th>foo!bar
16372 </th></tr></tbody></table>
16373
16374 !! end
16375
16376 !! test
16377 Tables: 3b. Nested in th
16378 !! options
16379 parsoid
16380 !! input
16381 {|
16382 !<nowiki>foo!!bar</nowiki>
16383 |}
16384 !! result
16385 <table>
16386 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
16387 </tbody></table>
16388 !! end
16389
16390 !! test
16391 Tables: 3c. Nested in th -- no escaping needed
16392 !! options
16393 parsoid
16394 !! input
16395 {|
16396 !<nowiki>foo||bar</nowiki>
16397 |}
16398 !! result
16399 <table><tbody><tr>
16400 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
16401 !! end
16402
16403 !! test
16404 Tables: 4a. Escape -
16405 !! options
16406 parsoid
16407 !! input
16408 {|
16409 |-
16410 !-bar
16411 |-
16412 |<nowiki>-bar</nowiki>
16413 |}
16414 !! result
16415 <table><tbody>
16416 <tr><th>-bar</th></tr>
16417 <tr>
16418 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
16419 !! end
16420
16421 !! test
16422 Tables: 4b. Escape +
16423 !! options
16424 parsoid
16425 !! input
16426 {|
16427 |-
16428 !+bar
16429 |-
16430 |<nowiki>+bar</nowiki>
16431 |}
16432 !! result
16433 <table><tbody>
16434 <tr><th>+bar</th></tr>
16435 <tr>
16436 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
16437 !! end
16438
16439 !! test
16440 Tables: 4c. No escaping needed
16441 !! options
16442 parsoid
16443 !! input
16444 {|
16445 |-
16446 |foo-bar
16447 |foo+bar
16448 |-
16449 |''foo''-bar
16450 |''foo''+bar
16451 |-
16452 |foo
16453 bar|baz
16454 +bar
16455 -bar
16456 |}
16457 !! result
16458 <table><tbody>
16459 <tr><td>foo-bar</td><td>foo+bar</td></tr>
16460 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
16461 <tr><td>foo
16462 <p>bar|baz
16463 +bar
16464 -bar</p></td></tr>
16465 </tbody></table>
16466 !! end
16467
16468 ### SSS FIXME: Disabled right now because accurate html2wt
16469 ### on this snippet requires data-parsoid flags that we've
16470 ### stripped out of these tests. We should scheme how we
16471 ### we want to handle these kind of tests that require
16472 ### data-parsoid flags for accurate html2wt serialization
16473
16474 !! test
16475 Tables: 4d. No escaping needed
16476 !! options
16477 disabled
16478 !! input
16479 {|
16480 ||+1
16481 ||-2
16482 |}
16483 !! result
16484 <table>
16485 <tr>
16486 <td>+1
16487 </td>
16488 <td>-2
16489 </td></tr></table>
16490
16491 !! end
16492
16493 #### --------------- Links ----------------
16494 #### 1. Quote marks in link text
16495 #### 2. Wikilinks: Escapes needed
16496 #### 3. Wikilinks: No escapes needed
16497 #### 4. Extlinks: Escapes needed
16498 #### 5. Extlinks: No escapes needed
16499 #### --------------------------------------
16500 !! test
16501 Links 1. Quote marks in link text
16502 !! options
16503 parsoid
16504 !! input
16505 [[Foo|Foo<nowiki>''boo''</nowiki>]]
16506 !! result
16507 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
16508 !! end
16509
16510 !! test
16511 Links 2. WikiLinks: Escapes needed
16512 !! options
16513 parsoid
16514 !! input
16515 [[Foo|<nowiki>[Foobar]</nowiki>]]
16516 [[Foo|<nowiki>Foobar]</nowiki>]]
16517 [[Foo|x [Foobar] x]]
16518 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
16519 [[Foo|<nowiki>[[Bar]]</nowiki>]]
16520 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
16521 [[Foo|<nowiki>|Bar</nowiki>]]
16522 [[Foo|<nowiki>]]bar</nowiki>]]
16523 [[Foo|<nowiki>[[bar</nowiki>]]
16524 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
16525 !! result
16526 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
16527 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
16528 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
16529 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
16530 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
16531 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
16532 <a href="Foo" rel="mw:WikiLink">|Bar</a>
16533 <a href="Foo" rel="mw:WikiLink">]]bar</a>
16534 <a href="Foo" rel="mw:WikiLink">[[bar</a>
16535 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
16536 !! end
16537
16538 !! test
16539 Links 3. WikiLinks: No escapes needed
16540 !! options
16541 parsoid
16542 !! input
16543 [[Foo|[Foobar]]
16544 [[Foo|foo|bar]]
16545 !! result
16546 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
16547 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
16548 !! end
16549
16550 !! test
16551 Links 4. ExtLinks: Escapes needed
16552 !! options
16553 parsoid
16554 !! input
16555 [http://google.com <nowiki>[google]</nowiki>]
16556 [http://google.com <nowiki>google]</nowiki>]
16557 !! result
16558 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
16559 <a href="http://google.com" rel="mw:ExtLink">google]</a>
16560 !! end
16561
16562 !! test
16563 Links 5. ExtLinks: No escapes needed
16564 !! options
16565 parsoid
16566 !! input
16567 [http://google.com [google]
16568 !! result
16569 <a href="http://google.com" rel="mw:ExtLink">[google</a>
16570 !! end
16571
16572 #### --------------- Quotes ---------------
16573 #### 1. Quotes inside <b> and <i>
16574 #### 2. Link fragments separated by <i> and <b> tags
16575 #### 3. Link fragments inside <i> and <b>
16576 #### 4. No escaping needed
16577 #### --------------------------------------
16578 !! test
16579 1. Quotes inside <b> and <i>
16580 !! options
16581 parsoid=html2wt,wt2wt
16582 !! input
16583 ''<nowiki>'foo'</nowiki>''
16584 ''<nowiki>''foo''</nowiki>''
16585 ''<nowiki>'''foo'''</nowiki>''
16586 ''foo''<nowiki/>'s
16587 '''<nowiki>'foo'</nowiki>'''
16588 '''<nowiki>''foo''</nowiki>'''
16589 '''<nowiki>'''foo'''</nowiki>'''
16590 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
16591 '''foo'''<nowiki/>'s
16592 '''foo''
16593 ''foo''<nowiki/>'
16594 '<nowiki/>''foo''<nowiki/>'
16595 ''''foo'''
16596 '''foo'''<nowiki/>'
16597 '<nowiki/>'''foo'''<nowiki/>'
16598 !! result
16599 <p><i>'foo'</i>
16600 <i>''foo''</i>
16601 <i>'''foo'''</i>
16602 <i>foo</i>'s
16603 <b>'foo'</b>
16604 <b>''foo''</b>
16605 <b>'''foo'''</b>
16606 <b>foo'<i>bar'</i>baz</b>
16607 <b>foo</b>'s
16608 '<i>foo</i>
16609 <i>foo</i>'
16610 '<i>foo</i>'
16611 '<b>foo</b>
16612 <b>foo</b>'
16613 '<b>foo</b>'</p>
16614 !! end
16615
16616 !! test
16617 2. Link fragments separated by <i> and <b> tags
16618 !! input
16619 [[''foo''<nowiki>hello]]</nowiki>
16620
16621 [['''foo'''<nowiki>hello]]</nowiki>
16622 !! result
16623 <p>[[<i>foo</i>hello]]
16624 </p><p>[[<b>foo</b>hello]]
16625 </p>
16626 !! end
16627
16628 !! test
16629 3. Link fragments inside <i> and <b>
16630 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
16631 this is one of the shortcomings of this format)
16632 !! input
16633 ''[[foo''<nowiki>]]</nowiki>
16634
16635 '''[[foo'''<nowiki>]]</nowiki>
16636 !! result
16637 <p><i>[[foo</i>]]
16638 </p><p><b>[[foo</b>]]
16639 </p>
16640 !! end
16641
16642 !! test
16643 4. No escaping needed
16644 !! input
16645 '<span>''bar''</span>'
16646 '<span>'''bar'''</span>'
16647 !! result
16648 <p>'<span><i>bar</i></span>'
16649 '<span><b>bar</b></span>'
16650 </p>
16651 !! end
16652
16653 #### ----------- Paragraphs ---------------
16654 #### 1. No unnecessary escapes
16655 #### --------------------------------------
16656
16657 !! test
16658 1. No unnecessary escapes
16659 !! input
16660 bar <span><nowiki>[[foo]]</nowiki></span>
16661
16662 =bar <span><nowiki>[[foo]]</nowiki></span>
16663
16664 [[bar <span><nowiki>[[foo]]</nowiki></span>
16665
16666 ]]bar <span><nowiki>[[foo]]</nowiki></span>
16667
16668 =bar <span>foo]]</span><nowiki>=</nowiki>
16669 !! result
16670 <p>bar <span>[[foo]]</span>
16671 </p><p>=bar <span>[[foo]]</span>
16672 </p><p>[[bar <span>[[foo]]</span>
16673 </p><p>]]bar <span>[[foo]]</span>
16674 </p><p>=bar <span>foo]]</span>=
16675 </p>
16676 !!end
16677
16678 #### ----------------------- PRE --------------------------
16679 #### 1. Leading whitespace in SOL context should be escaped
16680 #### ------------------------------------------------------
16681 !! test
16682 1. Leading whitespace in SOL context should be escaped
16683 !! options
16684 parsoid
16685 !! input
16686 <nowiki> </nowiki>a
16687
16688 <nowiki> </nowiki> a
16689
16690 <nowiki> </nowiki>a(tab)
16691
16692 <nowiki> </nowiki> a
16693 <!--cmt-->
16694 <nowiki> </nowiki> a
16695
16696 a
16697 <nowiki> </nowiki>b
16698
16699 a
16700 <nowiki> </nowiki>b
16701
16702 a
16703 <nowiki> </nowiki> b
16704 !! result
16705 <p> a</p>
16706 <p> a</p>
16707 <p> a(tab)</p>
16708 <p> a</p>
16709 <p><!--cmt--> a</p>
16710 <p>a
16711 b</p>
16712 <p>a
16713 b</p>
16714 <p>a
16715 b</p>
16716 !! end
16717
16718 #### --------------- HTML tags ---------------
16719 #### 1. a tags
16720 #### 2. other tags
16721 #### 3. multi-line html tag
16722 #### -----------------------------------------
16723 !! test
16724 1. a tags
16725 !! options
16726 parsoid
16727 !! input
16728 <a href="http://google.com">google</a>
16729 !! result
16730 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
16731 !! end
16732
16733 !! test
16734 2. other tags
16735 !! input
16736 <nowiki><div>foo</div>
16737 <div style="color:red">foo</div></nowiki>
16738 !! result
16739 <p>&lt;div&gt;foo&lt;/div&gt;
16740 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
16741 </p>
16742 !! end
16743
16744 !! test
16745 3. multi-line html tag
16746 !! input
16747 <nowiki><div
16748 >foo</div
16749 ></nowiki>
16750 !! result
16751 <p>&lt;div
16752 &gt;foo&lt;/div
16753 &gt;
16754 </p>
16755 !! end
16756
16757 !! test
16758 4. extension tags
16759 !! input
16760 <nowiki><ref>foo</ref></nowiki>
16761 !! result
16762 <p>&lt;ref&gt;foo&lt;/ref&gt;
16763 </p>
16764 !! end
16765
16766 #### --------------- Others ---------------
16767 !! test
16768 Escaping nowikis
16769 !! input
16770 &lt;nowiki&gt;foo&lt;/nowiki&gt;
16771 !! result
16772 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
16773 </p>
16774 !! end
16775
16776 ## The quote-char in the input is necessary for triggering the bug
16777 !! test
16778 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
16779 !! options
16780 parsoid=wt2wt,html2wt
16781 !! input
16782 foo's bar :
16783 !! result
16784 <p>foo's bar :</p>
16785 !! end
16786
16787 !! test
16788
16789 Tag-like HTML structures are passed through as text
16790 !! input
16791 <x y>
16792
16793 <x.y>
16794
16795 <x-y>
16796
16797 1>2
16798
16799 x<y
16800
16801 a>b
16802
16803 1<d e>f
16804 !! result
16805 <p>&lt;x y&gt;
16806 </p><p>&lt;x.y&gt;
16807 </p><p>&lt;x-y&gt;
16808 </p><p>1&gt;2
16809 </p><p>x&lt;y
16810 </p><p>a&gt;b
16811 </p><p>1&lt;d e&gt;f
16812 </p>
16813 !! end
16814
16815
16816 # This was a bug in the PHP parser (see bug 17663 and its dups,
16817 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
16818 !! test
16819 Tag names followed by punctuation should not be recognized as tags
16820 !! input
16821 <s.ome> text
16822 !! result
16823 <p>&lt;s.ome&gt; text
16824 </p>
16825 !! end
16826
16827 !! test
16828 HTML tag with necessary entities in attributes
16829 !! input
16830 <span title="&amp;amp;">foo</span>
16831 !! result
16832 <p><span title="&amp;amp;">foo</span>
16833 </p>
16834 !! end
16835
16836 !! test
16837 HTML tag with 'unnecessary' entity encoding in attributes
16838 !! input
16839 <span title="&amp;">foo</span>
16840 !! result
16841 <p><span title="&amp;">foo</span>
16842 </p>
16843 !! end
16844
16845 !! test
16846 HTML tag with broken attribute value quoting
16847 !! input
16848 <span title="Hello world>Foo</span>
16849 !! result
16850 <p><span>Foo</span>
16851 </p>
16852 !! end
16853
16854 !! test
16855 Parsoid-only: HTML tag with broken attribute value quoting
16856 !! options
16857 parsoid
16858 !! input
16859 <span title="Hello world>Foo</span>
16860 !! result
16861 <p><span title="Hello world">Foo</span>
16862 </p>
16863 !! end
16864
16865 !! test
16866 Table with broken attribute value quoting
16867 !! input
16868 {|
16869 | title="Hello world|Foo
16870 |}
16871 !! result
16872 <table>
16873 <tr>
16874 <td>Foo
16875 </td></tr></table>
16876
16877 !! end
16878
16879 !! test
16880 Table with broken attribute value quoting on consecutive lines
16881 !! input
16882 {|
16883 | title="Hello world|Foo
16884 | style="color:red|Bar
16885 |}
16886 !! result
16887 <table>
16888 <tr>
16889 <td>Foo
16890 </td>
16891 <td>Bar
16892 </td></tr></table>
16893
16894 !! end
16895
16896 !! test
16897 Parsoid-only: Table with broken attribute value quoting on consecutive lines
16898 !! options
16899 parsoid
16900 !! input
16901 {|
16902 | title="Hello world|Foo
16903 | style="color:red|Bar
16904 |}
16905 !! result
16906 <table><tbody>
16907 <tr>
16908 <td title="Hello world">Foo
16909 </td><td style="color: red">Bar
16910 </td></tr></tbody></table>
16911
16912 !! end
16913
16914 !! test
16915 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16916 !! options
16917 parsoid
16918 !! input
16919 {{}}
16920 !! result
16921 {{}}
16922 !! end
16923
16924 !! test
16925 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16926 !! options
16927 parsoid
16928 !! input
16929 }}{{
16930 !! result
16931 }}{{
16932 !! end
16933
16934 !!test
16935 Accept empty td cell attribute
16936 !!input
16937 {|
16938 | align="center" | foo || |
16939 |}
16940 !!result
16941 <table>
16942 <tr>
16943 <td align="center"> foo </td>
16944 <td>
16945 </td></tr></table>
16946
16947 !!end
16948
16949 !!test
16950 Non-empty attributes in th-cells
16951 !!input
16952 {|
16953 ! Foo !! style="color: red" | Bar
16954 |}
16955 !!result
16956 <table>
16957 <tr>
16958 <th> Foo </th>
16959 <th style="color: red"> Bar
16960 </th></tr></table>
16961
16962 !!end
16963
16964 !!test
16965 Accept empty attributes in th-cells
16966 !!input
16967 {|
16968 !| foo !!| bar
16969 |}
16970 !!result
16971 <table>
16972 <tr>
16973 <th> foo </th>
16974 <th> bar
16975 </th></tr></table>
16976
16977 !!end
16978
16979 !!test
16980 Empty table rows go away
16981 !!input
16982 {|
16983 | Hello
16984 | there
16985 |- class="foo"
16986 |-
16987 |}
16988 !! result
16989 <table>
16990 <tr>
16991 <td> Hello
16992 </td>
16993 <td> there
16994 </td></tr>
16995
16996 </table>
16997
16998 !! end
16999
17000 ###
17001 ### Parsoid-centric tests for testing RTing of inter-element separators
17002 ### Edge cases not tested by existing parser tests and specific to
17003 ### Parsoid-specific serialization strategies.
17004 ###
17005
17006 !!test
17007 RT-ed inter-element separators should be valid separators
17008 !!input
17009 {|
17010 |- [[foo]]
17011 |}
17012 !!result
17013 <table>
17014
17015 </table>
17016
17017 !!end
17018
17019 !!test
17020 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
17021 (Parsoid-only since PHP parser relies on Tidy for correct output)
17022 !!options
17023 parsoid
17024 !!input
17025 {|
17026 |<small>foo
17027 bar
17028 |}
17029
17030 {|
17031 |<small>foo<small>
17032 |}
17033 !!result
17034 !!end
17035
17036 !!test
17037 Empty TD followed by TD with tpl-generated attribute
17038 !!input
17039 {|
17040 |-
17041 |
17042 |{{echo|style='color:red'}}|foo
17043 |}
17044 !!result
17045 <table>
17046
17047 <tr>
17048 <td>
17049 </td>
17050 <td>foo
17051 </td></tr></table>
17052
17053 !!end
17054
17055 !!test
17056 Indented table with an empty td
17057 !!input
17058 {|
17059 |-
17060 |
17061 |foo
17062 |}
17063 !!result
17064 <table>
17065
17066 <tr>
17067 <td>
17068 </td>
17069 <td>foo
17070 </td></tr></table>
17071
17072 !!end
17073
17074 !!test
17075 Empty TR followed by a template-generated TR
17076 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
17077 !!options
17078 parsoid=wt2html,wt2wt
17079 !!input
17080 {|
17081 |-
17082 {{echo|<tr><td>foo</td></tr>}}
17083 |}
17084 !!result
17085 <table>
17086 <tbody>
17087 <tr></tr>
17088 <tr typeof="mw:Transclusion">
17089 <td>foo</td></tr></tbody></table>
17090 !!end
17091
17092 ## PHP and parsoid output differ for this, and since this is primarily
17093 ## for testing Parsoid's serializer, marking this Parsoid only
17094 !!test
17095 Empty TR followed by mixed-ws-comment line should RT correctly
17096 !!options
17097 parsoid
17098 !!input
17099 {|
17100 |-
17101 <!--c-->
17102 |-
17103 <!--c--> <!--d-->
17104 |}
17105 !!result
17106 <table>
17107 <tbody>
17108 <tr>
17109 <td> <!--c--></td></tr>
17110 <tr>
17111 <td><!--c--> <!--d--></td></tr>
17112 </tbody></table>
17113
17114 !!end
17115
17116 !!test
17117 Multi-line image caption generated by templates with/without trailing newlines
17118 !!options
17119 parsoid
17120 !!input
17121 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
17122 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
17123 !!result
17124 <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>
17125 <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>
17126
17127 !!end
17128
17129 ## PHP emits broken html for this, and since this is primarily
17130 ## a Parsoid serializer test, marking this Parsoid only
17131 !!test
17132 Improperly nested inline or quotes tags with whitespace in between
17133 !!options
17134 parsoid
17135 !!input
17136 <span> <s>x</span> </s>
17137 ''' ''x''' ''
17138 !!result
17139 <p><span> <s>x</s></span><s> </s>
17140 <b> <i>x</i></b><i> </i>
17141 </p>
17142 !!end
17143
17144 !!test
17145 Encapsulate protected attributes from wt
17146 !!options
17147 parsoid
17148 !!input
17149 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
17150 !!result
17151 <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>
17152 </body>
17153 !!end
17154
17155 # -----------------------------------------------------------------
17156 # The following section of tests are primarily to spec requirements
17157 # around serialization of new/edited content.
17158 #
17159 # All these tests are marked Parsoid html2wt and html2html only
17160 # ----------------------------------------------------------------
17161
17162 !! test
17163 Image: Modifying size of an image
17164 !! options
17165 parsoid=html2wt
17166 !! input
17167 [[Image:Wiki.png|230x230px]]
17168 !! result
17169 <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>
17170 !!end
17171
17172 !! test
17173 Image: New block level image should have \n before and after
17174 !! options
17175 parsoid=html2wt
17176 !! input
17177 123
17178 [[File:Wiki.png|right|thumb|150x150px]]
17179 456
17180 !! result
17181 <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>
17182 !!end
17183
17184 # Wacky -- the leading newline in input is required because
17185 # that is what the serializer emits. To be fixed. Not fixing
17186 # the test because this test is required to test serialization of
17187 # new content and preferred whitespace style.
17188 !! test
17189 Lists: Add space after bullets
17190 !! options
17191 parsoid=html2wt
17192 !! input
17193
17194 * foo
17195 * bar
17196 * <span> baz</span>
17197 !! result
17198 <ul>
17199 <li>foo</li>
17200 <li> bar</li>
17201 <li><span> baz</span></li>
17202 </ul>
17203 !! end
17204
17205 !! test
17206 Parsoid: Serialize positional parameters with = in them as named parameter
17207 !! options
17208 parsoid=html2wt
17209 !! input
17210 {{echo|1 = f=oo}}
17211 !! result
17212 <p about="#mwt1" typeof="mw:Transclusion"
17213 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}'
17214 >foo</p>
17215 !! end
17216
17217 # -----------------------------------------------------------------
17218 # End of section for Parsoid-only html2wt tests for serialization
17219 # of new content
17220 # -----------------------------------------------------------------
17221
17222 TODO:
17223 more images
17224 more tables
17225 character entities
17226 and much more
17227 Try for 100% code coverage