Merge "Drop unnecessary CSS selectors for a.external[href^="gopher://"]"
[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
1243 !! test
1244 Block tag on one line (<div>)
1245 !! input
1246 a <div>foo</div>
1247
1248 b
1249 !! result
1250 a <div>foo</div>
1251 <p>b
1252 </p>
1253 !! end
1254
1255 !! test
1256 Block tag on one line (<blockquote>)
1257 !! input
1258 a <blockquote>foo</blockquote>
1259
1260 b
1261 !! result
1262 a <blockquote>foo</blockquote>
1263 <p>b
1264 </p>
1265 !! end
1266
1267 !! test
1268 Block tag on both lines (<div>)
1269 !! input
1270 a <div>foo</div>
1271
1272 b <div>foo</div>
1273 !! result
1274 a <div>foo</div>
1275 b <div>foo</div>
1276
1277 !! end
1278
1279 !! test
1280 Block tag on both lines (<blockquote>)
1281 !! input
1282 a <blockquote>foo</blockquote>
1283
1284 b <blockquote>foo</blockquote>
1285 !! result
1286 a <blockquote>foo</blockquote>
1287 b <blockquote>foo</blockquote>
1288
1289 !! end
1290
1291 !! test
1292 Multiple lines without block tags
1293 !! input
1294 <div>foo</div> a
1295 b
1296 c
1297 d<!--foo--> e
1298 x <div>foo</div> z
1299 !! result
1300 <div>foo</div> a
1301 <p>b
1302 c
1303 d e
1304 </p>
1305 x <div>foo</div> z
1306
1307 !! end
1308
1309 !! test
1310 Empty lines between lines with block tags
1311 !! input
1312 <div></div>
1313
1314
1315 <div></div>a
1316
1317 b
1318 <div>a</div>b
1319
1320 <div>b</div>d
1321
1322
1323 <div>e</div>
1324 !! result
1325 <div></div>
1326 <p><br />
1327 </p>
1328 <div></div>a
1329 <p>b
1330 </p>
1331 <div>a</div>b
1332 <div>b</div>d
1333 <p><br />
1334 </p>
1335 <div>e</div>
1336
1337 !! end
1338
1339 ###
1340 ### Preformatted text
1341 ###
1342 !! test
1343 Preformatted text
1344 !! input
1345 This is some
1346 Preformatted text
1347 With ''italic''
1348 And '''bold'''
1349 And a [[Main Page|link]]
1350 !! result
1351 <pre>This is some
1352 Preformatted text
1353 With <i>italic</i>
1354 And <b>bold</b>
1355 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1356 </pre>
1357 !! end
1358
1359 !! test
1360 Tabs don't trigger preformatted text
1361 !! input
1362 This is not
1363 preformatted text.
1364 This is preformatted text.
1365 So is this.
1366 !! result
1367 <p> This is not
1368 preformatted text.
1369 </p>
1370 <pre>This is preformatted text.
1371 So is this.
1372 </pre>
1373 !! end
1374
1375 !! test
1376 Ident preformatting with inline content
1377 !! input
1378 a
1379 ''b''
1380 !! result
1381 <pre>a
1382 <i>b</i>
1383 </pre>
1384 !! end
1385
1386 !! test
1387 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1388 !! input
1389 <pre><nowiki>
1390 <b>
1391 <cite>
1392 <em>
1393 </nowiki></pre>
1394 !! result
1395 <pre>
1396 &lt;b&gt;
1397 &lt;cite&gt;
1398 &lt;em&gt;
1399 </pre>
1400
1401 !! end
1402
1403 !! test
1404 Regression with preformatted in <center>
1405 !! input
1406 <center>
1407 Blah
1408 </center>
1409 !! result
1410 <center>
1411 <pre>Blah
1412 </pre>
1413 </center>
1414
1415 !! end
1416
1417 !! test
1418 Bug 52763: Preformatted in <blockquote>
1419 !! input
1420 <blockquote>
1421 Blah
1422 </blockquote>
1423 !! result
1424 <blockquote>
1425 <p> Blah
1426 </p>
1427 </blockquote>
1428
1429 !! end
1430
1431 !! test
1432 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1433 !! input
1434 <blockquote>
1435 Foo
1436
1437 Bar
1438 </blockquote>
1439 !! result
1440 <blockquote>
1441 <p>Foo
1442 </p><p>Bar
1443 </p>
1444 </blockquote>
1445
1446 !! end
1447
1448 !! test
1449 Bug 15491: <ins>/<del> in blockquote
1450 !! input
1451 <blockquote>
1452 Foo <del>bar</del> <ins>baz</ins> quux
1453 </blockquote>
1454 !! result
1455 <blockquote>
1456 <p>Foo <del>bar</del> <ins>baz</ins> quux
1457 </p>
1458 </blockquote>
1459
1460 !! end
1461
1462 # Note that the p-wrapping is newline sensitive, which could be
1463 # considered a bug: tidy will wrap only the 'Foo' in the example
1464 # below in a <p> tag. (see comment 23-25 of bug #6200)
1465 !! test
1466 Bug 15491: <ins>/<del> in blockquote (2)
1467 !! input
1468 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1469 </blockquote>
1470 !! result
1471 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1472 </blockquote>
1473
1474 !! end
1475
1476 !! test
1477 <pre> with attributes (bug 3202)
1478 !! input
1479 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1480 !! result
1481 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1482
1483 !! end
1484
1485 !! test
1486 <pre> with width attribute (bug 3202)
1487 !! input
1488 <pre width="8">Narrow screen goodies</pre>
1489 !! result
1490 <pre width="8">Narrow screen goodies</pre>
1491
1492 !! end
1493
1494 !! test
1495 <pre> with forbidden attribute (bug 3202)
1496 !! input
1497 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1498 !! result
1499 <pre width="8">Narrow screen goodies</pre>
1500
1501 !! end
1502
1503 !! test
1504 Entities inside <pre>
1505 !! input
1506 <pre>&lt;</pre>
1507 !! result
1508 <pre>&lt;</pre>
1509
1510 !! end
1511
1512 !! test
1513 <pre> with forbidden attribute values (bug 3202)
1514 !! input
1515 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1516 !! result
1517 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1518
1519 !! end
1520
1521 !! test
1522 <nowiki> inside <pre> (bug 13238)
1523 !! input
1524 <pre>
1525 <nowiki>
1526 </pre>
1527 <pre>
1528 <nowiki></nowiki>
1529 </pre>
1530 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1531 !! result
1532 <pre>
1533 &lt;nowiki&gt;
1534 </pre>
1535 <pre>
1536
1537 </pre>
1538 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1539
1540 !! end
1541
1542 !! test
1543 <nowiki> and <pre> preference (first one wins)
1544 !! input
1545 <pre>
1546 <nowiki>
1547 </pre>
1548 </nowiki>
1549 </pre>
1550
1551 <nowiki>
1552 <pre>
1553 <nowiki>
1554 </pre>
1555 </nowiki>
1556 </pre>
1557
1558 !! result
1559 <pre>
1560 &lt;nowiki&gt;
1561 </pre>
1562 <p>&lt;/nowiki&gt;
1563 &lt;/pre&gt;
1564 </p><p>
1565 &lt;pre&gt;
1566 &lt;nowiki&gt;
1567 &lt;/pre&gt;
1568
1569 &lt;/pre&gt;
1570 </p>
1571 !! end
1572
1573 !! test
1574 </pre> inside nowiki
1575 !! input
1576 <nowiki></pre></nowiki>
1577 !! result
1578 <p>&lt;/pre&gt;
1579 </p>
1580 !! end
1581
1582 !!test
1583 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1584 !!input
1585 {{echo|}}
1586 !!result
1587
1588 !!end
1589
1590 !!test
1591 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1592 !!input
1593 {{echo|
1594 foo}}
1595 !!result
1596 <p>foo
1597 </p>
1598 !!end
1599
1600 !! test
1601 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1602 !! input
1603 {{echo|a
1604 b}}
1605 !!result
1606 <pre>a
1607 </pre>
1608 <p>b
1609 </p>
1610 !!end
1611
1612 !! test
1613 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1614 !! input
1615 {{echo|a
1616 b
1617 c
1618 d
1619 e
1620 }}
1621 !!result
1622 <pre>a
1623 </pre>
1624 <p>b
1625 c
1626 </p>
1627 <pre>d
1628 </pre>
1629 <p>e
1630 </p>
1631 !!end
1632
1633 !!test
1634 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1635 !!input
1636 {{echo| foo}}
1637
1638 {{echo| foo}}{{echo| bar}}
1639
1640 {{echo| foo}}
1641 {{echo| bar}}
1642
1643 {{echo|<!--cmt--> foo}}
1644
1645 <!--cmt-->{{echo| foo}}
1646
1647 {{echo|{{echo| }}bar}}
1648 !!result
1649 <pre>foo
1650 </pre>
1651 <pre>foo bar
1652 </pre>
1653 <pre>foo
1654 bar
1655 </pre>
1656 <pre>foo
1657 </pre>
1658 <pre>foo
1659 </pre>
1660 <pre>bar
1661 </pre>
1662 !!end
1663
1664 !! test
1665 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1666 !! input
1667 {{echo| }}a
1668
1669 {{echo|
1670 }}a
1671
1672 {{echo|
1673 b}}
1674
1675 {{echo|a
1676 }}b
1677
1678 {{echo|a
1679 }} b
1680 !!result
1681 <pre>a
1682 </pre>
1683 <p><br />
1684 </p>
1685 <pre>a
1686 </pre>
1687 <p><br />
1688 </p>
1689 <pre>b
1690 </pre>
1691 <p>a
1692 </p>
1693 <pre>b
1694 </pre>
1695 <p>a
1696 </p>
1697 <pre>b
1698 </pre>
1699 !!end
1700
1701 #--------------------------------------------------------------------
1702 # Transclusion parameter whitespace stripping tests
1703 # Behavior is different for positional and named parameters
1704 #--------------------------------------------------------------------
1705 !! test
1706 Templates: Strip leading and trailing whitespace from named-param values
1707 !! input
1708 {{echo|1= a }}
1709
1710 {{echo|1= {{echo|b}} }}
1711
1712 {{echo| 1 =
1713 c }}
1714
1715 {{echo| 1 =
1716 * d
1717 }}
1718 !! result
1719 <p>a
1720 </p><p>b
1721 </p><p>c
1722 </p>
1723 <ul><li> d
1724 </li></ul>
1725
1726 !! end
1727
1728 !! test
1729 Templates: Don't strip whitespace from positional-param values
1730 !! options
1731 !! input
1732 {{echo|a }}
1733
1734 {{echo|{{echo|b}} }}
1735
1736 {{echo| c
1737 }}
1738
1739 {{echo| {{echo|d}}
1740 }}
1741
1742 {{echo|
1743 e}}
1744
1745 {{echo|
1746 * f}}
1747
1748 {{echo|
1749 }}g
1750 !! result
1751 <p>a
1752 </p><p>b
1753 </p>
1754 <pre>c
1755 </pre>
1756 <p><br />
1757 </p>
1758 <pre>d
1759 </pre>
1760 <p><br />
1761 </p>
1762 <pre>e
1763 </pre>
1764 <p><br />
1765 </p>
1766 <ul><li> f
1767 </li></ul>
1768 <p><br />
1769 </p>
1770 <pre>g
1771 </pre>
1772 !! end
1773
1774 #--------------------------------------------------------------------
1775 # Transclusion parameter escaping tests
1776 #--------------------------------------------------------------------
1777 !! test
1778 Templates: Parsoid parameter escaping test 1
1779 !! options
1780 parsoid
1781 !! input
1782 {{echo|[foo]|{{echo|[bar]}}}}
1783 !! result
1784 <p about="#mwt1" typeof="mw:Transclusion"
1785 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>
1786 !! end
1787
1788 !! test
1789 Parsoid: Pipes in external links in template parameter
1790 !! options
1791 parsoid
1792 !! input
1793 {{echo|[{{echo|http://example.com}} link]}}
1794 !! result
1795 <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>
1796 !! end
1797
1798 !! test
1799 Parsoid: pipe in transclusion parameter
1800 !! options
1801 parsoid
1802 !! input
1803 {{echo|http://foo.com/a&#124;b}}
1804 !! result
1805 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1806 typeof="mw:Transclusion"
1807 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>
1808 !! end
1809
1810 !! test
1811 Parsoid: Pipe in external link target and content in template parameter
1812 !! options
1813 parsoid=html2wt,wt2wt
1814 !! input
1815 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1816 !! result
1817 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1818 typeof="mw:Transclusion"
1819 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},
1820 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}'>a|b</a></p>
1821 !! end
1822
1823 !! test
1824 Templates: Dont escape already nowiki-escaped text in template parameters
1825 !! options
1826 parsoid=html2wt,wt2wt
1827 !! input
1828 {{echo|foo<nowiki>|</nowiki>bar}}
1829 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1830 {{echo|<nowiki></nowiki>}}
1831 !! result
1832 <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>
1833 <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>
1834 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}'></span>
1835 </p>
1836 !! end
1837
1838 ###
1839 ### Parsoid-centric tests for testing RT edge cases for pre
1840 ###
1841
1842 !!test
1843 1a. Indent-Pre and Comments
1844 !!input
1845 a
1846 <!--a-->
1847 c
1848 !!result
1849 <pre>a
1850 </pre>
1851 <p>c
1852 </p>
1853 !!end
1854
1855 !!test
1856 1b. Indent-Pre and Comments
1857 !!input
1858 a
1859 <!--a-->
1860 c
1861 !!result
1862 <pre>a
1863 </pre>
1864 <p>c
1865 </p>
1866 !!end
1867
1868 !!test
1869 1c. Indent-Pre and Comments
1870 !!input
1871 <!--a--> a
1872
1873 <!--a--> a
1874 !!result
1875 <pre> a
1876 </pre>
1877 <pre> a
1878 </pre>
1879 !!end
1880
1881 !!test
1882 1d. Indent-Pre and Comments
1883 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
1884 !!input
1885 <!--a--> a
1886
1887 <!--b-->b
1888 !!result
1889 <pre>a
1890 </pre>
1891 <pre>b
1892 </pre>
1893 !!end
1894
1895 !!test
1896 2a. Indent-Pre and tables
1897 !!input
1898 {|
1899 |-
1900 !h1!!h2
1901 |foo||bar
1902 |}
1903 !!result
1904 <table>
1905
1906 <tr>
1907 <th>h1</th>
1908 <th>h2
1909 </th>
1910 <td>foo</td>
1911 <td>bar
1912 </td></tr></table>
1913
1914 !!end
1915
1916 !!test
1917 2b. Indent-Pre and tables
1918 !!input
1919 {|
1920 |-
1921 |foo
1922 |}
1923 !!result
1924 <table>
1925
1926 <tr>
1927 <td>foo
1928 </td></tr></table>
1929
1930 !!end
1931
1932 !!test
1933 2c. Indent-Pre and tables (bug 42252)
1934 !!input
1935 {|
1936 |+ foo
1937 ! | bar
1938 |}
1939 !!result
1940 <table>
1941 <caption> foo
1942 </caption>
1943 <tr>
1944 <th> bar
1945 </th></tr></table>
1946
1947 !!end
1948
1949 !!test
1950 3a. Indent-Pre and block tags (single-line html)
1951 !!input
1952 <p> foo </p>
1953 <div> foo </div>
1954 <blockquote> foo </blockquote>
1955 <span> foo </span>
1956 !!result
1957 <p> foo </p>
1958 <div> foo </div>
1959 <blockquote> foo </blockquote>
1960 <pre><span> foo </span>
1961 </pre>
1962 !!end
1963
1964 !!test
1965 3b. Indent-Pre and block tags (pre-content on separate line)
1966 !!input
1967 <p>
1968 foo
1969 </p>
1970
1971 <div>
1972 foo
1973 </div>
1974
1975 <center>
1976 foo
1977 </center>
1978
1979 <blockquote>
1980 foo
1981 </blockquote>
1982
1983 <blockquote>
1984 <pre>
1985 foo
1986 </pre>
1987 </blockquote>
1988
1989 <table><tr><td>
1990 foo
1991 </td></tr></table>
1992
1993 <ul><li>
1994 foo
1995 </li></ul>
1996
1997 !!result
1998 <p>
1999 foo
2000 </p>
2001 <div>
2002 <pre>foo
2003 </pre>
2004 </div>
2005 <center>
2006 <pre>foo
2007 </pre>
2008 </center>
2009 <blockquote>
2010 <p> foo
2011 </p>
2012 </blockquote>
2013 <blockquote>
2014 <pre>
2015 foo
2016 </pre>
2017 </blockquote>
2018 <table><tr><td>
2019 <pre>foo
2020 </pre>
2021 </td></tr></table>
2022 <ul><li>
2023 foo
2024 </li></ul>
2025
2026 !!end
2027
2028 !!test
2029 4. Multiple spaces at start-of-line
2030 !!input
2031 <p> foo </p>
2032 foo
2033 {|
2034 |foo
2035 |}
2036 !!result
2037 <p> foo </p>
2038 <pre> foo
2039 </pre>
2040 <table>
2041 <tr>
2042 <td>foo
2043 </td></tr></table>
2044
2045 !!end
2046
2047 !! test
2048 5. White-space in indent-pre
2049 NOTE: the white-space char on 2nd line is significant
2050 !! input
2051 a<br/>
2052
2053 b
2054 !! result
2055 <pre>a<br />
2056
2057 b
2058 </pre>
2059 !! end
2060
2061 !! test
2062 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2063 !! input
2064 a
2065
2066 <!-- continue -->
2067 b
2068
2069 c
2070
2071 d
2072 !! result
2073 <pre>a
2074
2075 b
2076 </pre>
2077 <pre>c
2078
2079 </pre>
2080 <p>d
2081 </p>
2082 !! end
2083
2084 !! test
2085 7a. Indent-pre and category links
2086 !! options
2087 parsoid=wt2html,wt2wt
2088 !! input
2089 [[Category:foo]] <!-- No pre-wrapping -->
2090 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2091 !! result
2092 <span typeof="mw:Transclusion"> </span>
2093 !! end
2094
2095 !! test
2096 7b. Indent-pre and category links
2097 !! options
2098 parsoid=wt2html,wt2wt
2099 !! input
2100 [[Category:foo]] a
2101 [[Category:foo]] {{echo|b}}
2102 !! result
2103 <pre> a <span typeof="mw:Transclusion">b</span>
2104 </pre>
2105 !! end
2106
2107 ###
2108 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2109 ###
2110
2111 !!test
2112 HTML-pre: 1. embedded newlines
2113 !!input
2114 <pre>foo</pre>
2115
2116 <pre>
2117 foo
2118 </pre>
2119
2120 <pre>
2121
2122 foo
2123 </pre>
2124
2125 <pre>
2126
2127
2128 foo
2129 </pre>
2130 !!result
2131 <pre>foo</pre>
2132 <pre>
2133 foo
2134 </pre>
2135 <pre>
2136
2137 foo
2138 </pre>
2139 <pre>
2140
2141
2142 foo
2143 </pre>
2144
2145 !!end
2146
2147 !!test
2148 HTML-pre: 2: indented text
2149 !!input
2150 <pre>
2151 foo
2152 </pre>
2153 !!result
2154 <pre>
2155 foo
2156 </pre>
2157
2158 !!end
2159
2160 !!test
2161 HTML-pre: 3: other wikitext
2162 !!input
2163 <pre>
2164 * foo
2165 # bar
2166 = no-h =
2167 '' no-italic ''
2168 [[ NoLink ]]
2169 </pre>
2170 !!result
2171 <pre>
2172 * foo
2173 # bar
2174 = no-h =
2175 '' no-italic ''
2176 [[ NoLink ]]
2177 </pre>
2178
2179 !!end
2180
2181 ###
2182 ### Definition lists
2183 ###
2184 !! test
2185 Simple definition
2186 !! input
2187 ; name : Definition
2188 !! result
2189 <dl><dt> name&#160;</dt><dd> Definition
2190 </dd></dl>
2191
2192 !! end
2193
2194 !! test
2195 Definition list for indentation only
2196 !! input
2197 : Indented text
2198 !! result
2199 <dl><dd> Indented text
2200 </dd></dl>
2201
2202 !! end
2203
2204 !! test
2205 Definition list with no space
2206 !! input
2207 ;name:Definition
2208 !! result
2209 <dl><dt>name</dt><dd>Definition
2210 </dd></dl>
2211
2212 !!end
2213
2214 !! test
2215 Definition list with URL link
2216 !! input
2217 ; http://example.com/ : definition
2218 !! result
2219 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
2220 </dd></dl>
2221
2222 !! end
2223
2224 !! test
2225 Definition list with bracketed URL link
2226 !! input
2227 ;[http://www.example.com/ Example]:Something about it
2228 !! result
2229 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
2230 </dd></dl>
2231
2232 !! end
2233
2234 !! test
2235 Definition list with wikilink containing colon
2236 !! input
2237 ; [[Help:FAQ]]: The least-read page on Wikipedia
2238 !! result
2239 <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
2240 </dd></dl>
2241
2242 !! end
2243
2244 # At Brion's and JeLuF's insistence... :)
2245 !! test
2246 Definition list with news link containing colon
2247 !! input
2248 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2249 !! result
2250 <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!
2251 </dd></dl>
2252
2253 !! end
2254
2255 !! test
2256 Malformed definition list with colon
2257 !! input
2258 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2259 !! result
2260 <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
2261 </dt></dl>
2262
2263 !! end
2264
2265 !! test
2266 Definition lists: colon in external link text
2267 !! input
2268 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2269 !! result
2270 <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
2271 </dd></dl>
2272
2273 !! end
2274
2275 !! test
2276 Definition lists: colon in HTML attribute
2277 !! input
2278 ;<b style="display: inline">bold</b>
2279 !! result
2280 <dl><dt><b style="display: inline">bold</b>
2281 </dt></dl>
2282
2283 !! end
2284
2285 !! test
2286 Definition lists: self-closed tag
2287 !! input
2288 ;one<br/>two : two-line fun
2289 !! result
2290 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
2291 </dd></dl>
2292
2293 !! end
2294
2295 !! test
2296 Bug 11748: Literal closing tags
2297 !! input
2298 <dl>
2299 <dt>test 1</dt>
2300 <dd>test test test test test</dd>
2301 <dt>test 2</dt>
2302 <dd>test test test test test</dd>
2303 </dl>
2304 !! result
2305 <dl>
2306 <dt>test 1</dt>
2307 <dd>test test test test test</dd>
2308 <dt>test 2</dt>
2309 <dd>test test test test test</dd>
2310 </dl>
2311
2312 !! end
2313
2314 !! test
2315 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2316 !! input
2317 <ul><li>
2318 ; term : description
2319 * unordered
2320 </li>
2321 </ul>
2322 !! result
2323 <ul><li>
2324 <dl><dt> term&#160;</dt><dd> description
2325 </dd></dl>
2326 <ul><li> unordered
2327 </li></ul>
2328 </li>
2329 </ul>
2330
2331 !! end
2332
2333 !! test
2334
2335 Definition list with empty definition and following paragraph
2336 !! input
2337 ; term:
2338 Paragraph text
2339 !! result
2340 <dl><dt> term</dt><dd>
2341 </dd></dl>
2342 <p>Paragraph text
2343 </p>
2344 !! end
2345
2346 !! test
2347 Nested definition lists using html syntax
2348 !! input
2349 <dl><dd>
2350 <dl>
2351 <dd>Foo</dd>
2352 </dl>
2353 </dd></dl>
2354 !! result
2355 <dl><dd>
2356 <dl>
2357 <dd>Foo</dd>
2358 </dl>
2359 </dd></dl>
2360
2361 !! end
2362
2363 !! test
2364 Definition Lists: No nesting: Multiple dd's
2365 !! input
2366 ;x
2367 :a
2368 :b
2369 !! result
2370 <dl><dt>x
2371 </dt><dd>a
2372 </dd><dd>b
2373 </dd></dl>
2374
2375 !! end
2376
2377 !! test
2378 Definition Lists: Indentation: Regular
2379 !! input
2380 :i1
2381 ::i2
2382 :::i3
2383 !! result
2384 <dl><dd>i1
2385 <dl><dd>i2
2386 <dl><dd>i3
2387 </dd></dl>
2388 </dd></dl>
2389 </dd></dl>
2390
2391 !! end
2392
2393 !! test
2394 Definition Lists: Indentation: Missing 1st level
2395 !! input
2396 ::i2
2397 :::i3
2398 !! result
2399 <dl><dd><dl><dd>i2
2400 <dl><dd>i3
2401 </dd></dl>
2402 </dd></dl>
2403 </dd></dl>
2404
2405 !! end
2406
2407 !! test
2408 Definition Lists: Indentation: Multi-level indent
2409 !! input
2410 :::i3
2411 !! result
2412 <dl><dd><dl><dd><dl><dd>i3
2413 </dd></dl>
2414 </dd></dl>
2415 </dd></dl>
2416
2417 !! end
2418
2419 !! test
2420 Definition Lists: Hacky use to indent tables
2421 !! input
2422 ::{|
2423 |foo
2424 |bar
2425 |}
2426 this text
2427 should be left alone
2428 !! result
2429 <dl><dd><dl><dd><table>
2430 <tr>
2431 <td>foo
2432 </td>
2433 <td>bar
2434 </td></tr></table></dd></dl></dd></dl>
2435 <p>this text
2436 should be left alone
2437 </p>
2438 !! end
2439
2440 # Bug 52473
2441 !! test
2442 Definition Lists: Hacky use to indent tables (WS-insensitive)
2443 !! options
2444 parsoid
2445 !! input
2446 : {|
2447 |a
2448 |}
2449 !! result
2450 <dl><dd> <table><tr><td>a</td></tr></table> </dd></dl>
2451 !! end
2452 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2453 ## as an empty dt item. It also ignores all but the last ";" when followed
2454 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2455 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2456 ## ";"s.
2457 ##
2458 ## Ex: ";;t2 ::d2" is transformed into:
2459 ##
2460 ## <dl>
2461 ## <dt>t2 </dt>
2462 ## <dd>
2463 ## <dl>
2464 ## <dt></dt>
2465 ## <dd>d2</dd>
2466 ## </dl>
2467 ## </dd>
2468 ## </dl>
2469 ##
2470 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2471 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2472 ##
2473 ## <dl>
2474 ## <dt>
2475 ## <dl>
2476 ## <dt>t2 </dt>
2477 ## <dd>:d2</dd>
2478 ## </dl>
2479 ## </dt>
2480 ## </dl>
2481 ##
2482 ## All Parsoid only definition list tests have this difference.
2483 ##
2484 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2485 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2486
2487 !! test
2488 Table / list interaction: indented table with lists in table contents
2489 !! input
2490 :{|
2491 |-
2492 | a
2493 * b
2494 |-
2495 | c
2496 * d
2497 |}
2498 !! result
2499 <dl><dd><table>
2500
2501 <tr>
2502 <td> a
2503 <ul><li> b
2504 </li></ul>
2505 </td></tr>
2506 <tr>
2507 <td> c
2508 <ul><li> d
2509 </li></ul>
2510 </td></tr></table></dd></dl>
2511
2512 !! end
2513
2514 !!test
2515 Table / list interaction: lists nested in tables nested in indented lists
2516 !!input
2517 :{|
2518 |
2519 :a
2520 :b
2521 |
2522 *c
2523 *d
2524 |}
2525
2526 *e
2527 *f
2528 !!result
2529 <dl><dd><table>
2530 <tr>
2531 <td>
2532 <dl><dd>a
2533 </dd><dd>b
2534 </dd></dl>
2535 </td>
2536 <td>
2537 <ul><li>c
2538 </li><li>d
2539 </li></ul>
2540 </td></tr></table></dd></dl>
2541 <ul><li>e
2542 </li><li>f
2543 </li></ul>
2544
2545 !!end
2546
2547 !! test
2548 Definition Lists: Nesting: Multi-level (Parsoid only)
2549 !! options
2550 parsoid
2551 !! input
2552 ;t1 :d1
2553 ;;t2 ::d2
2554 ;;;t3 :::d3
2555 !! result
2556 <dl>
2557 <dt>t1 </dt>
2558 <dd>d1</dd>
2559 <dt>
2560 <dl>
2561 <dt>t2 </dt>
2562 <dd>:d2</dd>
2563 <dt>
2564 <dl>
2565 <dt>t3 </dt>
2566 <dd>::d3</dd>
2567 </dl>
2568 </dt>
2569 </dl>
2570 </dt>
2571 </dl>
2572
2573
2574 !! end
2575
2576
2577 !! test
2578 Definition Lists: Nesting: Test 2 (Parsoid only)
2579 !! options
2580 parsoid
2581 !! input
2582 ;t1
2583 ::d2
2584 !! result
2585 <dl>
2586 <dt>t1</dt>
2587 <dd>
2588 <dl>
2589 <dd>d2</dd>
2590 </dl>
2591 </dd>
2592 </dl>
2593
2594 !! end
2595
2596
2597 !! test
2598 Definition Lists: Nesting: Test 3 (Parsoid only)
2599 !! options
2600 parsoid
2601 !! input
2602 :;t1
2603 ::::d2
2604 !! result
2605 <dl>
2606 <dd>
2607 <dl>
2608 <dt>t1</dt>
2609 <dd>
2610 <dl>
2611 <dd>
2612 <dl>
2613 <dd>d2</dd>
2614 </dl>
2615 </dd>
2616 </dl>
2617 </dd>
2618 </dl>
2619 </dd>
2620 </dl>
2621
2622 !! end
2623
2624
2625 !! test
2626 Definition Lists: Nesting: Test 4
2627 !! input
2628 ::;t3
2629 :::d3
2630 !! result
2631 <dl><dd><dl><dd><dl><dt>t3
2632 </dt><dd>d3
2633 </dd></dl>
2634 </dd></dl>
2635 </dd></dl>
2636
2637 !! end
2638
2639
2640 ## The Parsoid team believes the following three test exposes a
2641 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2642 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2643 !! test
2644 Definition Lists: Mixed Lists: Test 1 (php)
2645 !! options
2646 php
2647 !! input
2648 :;* foo
2649 ::* bar
2650 :; baz
2651 !! result
2652 <dl><dd><dl><dt><ul><li> foo
2653 </li><li> bar
2654 </li></ul>
2655 </dt></dl>
2656 <dl><dt> baz
2657 </dt></dl>
2658 </dd></dl>
2659
2660 !! end
2661 !! test
2662 Definition Lists: Mixed Lists: Test 1 (parsoid)
2663 !! options
2664 parsoid
2665 !! input
2666 :;* foo
2667 ::* bar
2668 :; baz
2669 !! result
2670 <dl><dd><dl><dt><ul><li> foo
2671 </li></ul></dt><dd><ul><li> bar
2672 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2673 !! end
2674
2675 !! test
2676 Definition Lists: Mixed Lists: Test 2
2677 !! input
2678 *: d1
2679 *: d2
2680 !! result
2681 <ul><li><dl><dd> d1
2682 </dd><dd> d2
2683 </dd></dl>
2684 </li></ul>
2685
2686 !! end
2687
2688
2689 !! test
2690 Definition Lists: Mixed Lists: Test 3
2691 !! input
2692 *::: d1
2693 *::: d2
2694 !! result
2695 <ul><li><dl><dd><dl><dd><dl><dd> d1
2696 </dd><dd> d2
2697 </dd></dl>
2698 </dd></dl>
2699 </dd></dl>
2700 </li></ul>
2701
2702 !! end
2703
2704
2705 !! test
2706 Definition Lists: Mixed Lists: Test 4
2707 !! input
2708 *;d1 :d2
2709 *;d3 :d4
2710 !! result
2711 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2712 </dd><dt>d3&#160;</dt><dd>d4
2713 </dd></dl>
2714 </li></ul>
2715
2716 !! end
2717
2718
2719 !! test
2720 Definition Lists: Mixed Lists: Test 5
2721 !! input
2722 *:d1
2723 *:: d2
2724 !! result
2725 <ul><li><dl><dd>d1
2726 <dl><dd> d2
2727 </dd></dl>
2728 </dd></dl>
2729 </li></ul>
2730
2731 !! end
2732
2733
2734 !! test
2735 Definition Lists: Mixed Lists: Test 6
2736 !! input
2737 #*:d1
2738 #*::: d3
2739 !! result
2740 <ol><li><ul><li><dl><dd>d1
2741 <dl><dd><dl><dd> d3
2742 </dd></dl>
2743 </dd></dl>
2744 </dd></dl>
2745 </li></ul>
2746 </li></ol>
2747
2748 !! end
2749
2750
2751 !! test
2752 Definition Lists: Mixed Lists: Test 7
2753 !! input
2754 :* d1
2755 :* d2
2756 !! result
2757 <dl><dd><ul><li> d1
2758 </li><li> d2
2759 </li></ul>
2760 </dd></dl>
2761
2762 !! end
2763
2764
2765 !! test
2766 Definition Lists: Mixed Lists: Test 8
2767 !! input
2768 :* d1
2769 ::* d2
2770 !! result
2771 <dl><dd><ul><li> d1
2772 </li></ul>
2773 <dl><dd><ul><li> d2
2774 </li></ul>
2775 </dd></dl>
2776 </dd></dl>
2777
2778 !! end
2779
2780
2781 !! test
2782 Definition Lists: Mixed Lists: Test 9
2783 !! input
2784 *;foo :bar
2785 !! result
2786 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2787 </dd></dl>
2788 </li></ul>
2789
2790 !! end
2791
2792
2793 !! test
2794 Definition Lists: Mixed Lists: Test 10
2795 !! input
2796 *#;foo :bar
2797 !! result
2798 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2799 </dd></dl>
2800 </li></ol>
2801 </li></ul>
2802
2803 !! end
2804
2805 # The Parsoid team disagrees with the PHP parser's seemingly-random
2806 # rules regarding dd/dt on the next two tests. Parsoid is more
2807 # consistent, and recognizes the shared nesting and keeps the
2808 # still-open tags around until the nesting is complete.
2809
2810 !! test
2811 Definition Lists: Mixed Lists: Test 11 (php)
2812 !! options
2813 php
2814 !! input
2815 *#*#;*;;foo :bar
2816 *#*#;boo :baz
2817 !! result
2818 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2819 </dt></dl>
2820 </dd></dl>
2821 </li></ul>
2822 </dd></dl>
2823 <dl><dt>boo&#160;</dt><dd>baz
2824 </dd></dl>
2825 </li></ol>
2826 </li></ul>
2827 </li></ol>
2828 </li></ul>
2829
2830 !! end
2831 !! test
2832 Definition Lists: Mixed Lists: Test 11 (parsoid)
2833 !! options
2834 parsoid
2835 !! input
2836 *#*#;*;;foo :bar
2837 *#*#;boo :baz
2838 !! result
2839 <ul>
2840 <li>
2841 <ol>
2842 <li>
2843 <ul>
2844 <li>
2845 <ol>
2846 <li>
2847 <dl>
2848 <dt>
2849 <ul>
2850 <li>
2851 <dl>
2852 <dt>
2853 <dl>
2854 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2855 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2856 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2857 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2858 !! end
2859
2860
2861 !! test
2862 Definition Lists: Weird Ones: Test 1 (php)
2863 !! options
2864 php
2865 !! input
2866 *#;*::;; foo : bar (who uses this?)
2867 !! result
2868 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2869 </dt></dl>
2870 </dd></dl>
2871 </dd></dl>
2872 </dd></dl>
2873 </li></ul>
2874 </dd></dl>
2875 </li></ol>
2876 </li></ul>
2877
2878 !! end
2879 !! test
2880 Definition Lists: Weird Ones: Test 1 (parsoid)
2881 !! options
2882 parsoid
2883 !! input
2884 *#;*::;; foo : bar (who uses this?)
2885 !! result
2886 <ul>
2887 <li>
2888 <ol>
2889 <li>
2890 <dl>
2891 <dt>
2892 <ul>
2893 <li>
2894 <dl>
2895 <dd>
2896 <dl>
2897 <dd>
2898 <dl>
2899 <dt>
2900 <dl>
2901 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2902 <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>
2903 !! end
2904
2905 ###
2906 ### External links
2907 ###
2908 !! test
2909 External links: non-bracketed
2910 !! input
2911 Non-bracketed: http://example.com
2912 !! result
2913 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2914 </p>
2915 !! end
2916
2917 !! test
2918 External links: numbered
2919 !! input
2920 Numbered: [http://example.com]
2921 Numbered: [http://example.net]
2922 Numbered: [http://example.com]
2923 !! result
2924 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2925 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2926 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2927 </p>
2928 !!end
2929
2930 !! test
2931 External links: specified text
2932 !! input
2933 Specified text: [http://example.com link]
2934 !! result
2935 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2936 </p>
2937 !!end
2938
2939 !! test
2940 External links: trail
2941 !! input
2942 Linktrails should not work for external links: [http://example.com link]s
2943 !! result
2944 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2945 </p>
2946 !! end
2947
2948 !! test
2949 External links: dollar sign in URL
2950 !! input
2951 http://example.com/1$2345
2952 !! result
2953 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2954 </p>
2955 !! end
2956
2957 !! test
2958 External links: dollar sign in URL (named)
2959 !! input
2960 [http://example.com/1$2345]
2961 !! result
2962 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2963 </p>
2964 !!end
2965
2966 !! test
2967 External links: open square bracket forbidden in URL (bug 4377)
2968 !! input
2969 http://example.com/1[2345
2970 !! result
2971 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2972 </p>
2973 !! end
2974
2975 !! test
2976 External links: open square bracket forbidden in URL (named) (bug 4377)
2977 !! input
2978 [http://example.com/1[2345]
2979 !! result
2980 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2981 </p>
2982 !!end
2983
2984 !! test
2985 External links: nowiki in URL link text (bug 6230)
2986 !!input
2987 [http://example.com/ <nowiki>''example site''</nowiki>]
2988 !! result
2989 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2990 </p>
2991 !! end
2992
2993 !! test
2994 External links: newline forbidden in text (bug 6230 regression check)
2995 !! input
2996 [http://example.com/ first
2997 second]
2998 !! result
2999 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3000 second]
3001 </p>
3002 !!end
3003
3004 !! test
3005 External links: Pipe char between url and text
3006 !! input
3007 [http://example.com | link]
3008 !! result
3009 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3010 </p>
3011 !!end
3012
3013 !! test
3014 External links: protocol-relative URL in brackets
3015 !! input
3016 [//example.com/ Test]
3017 !! result
3018 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3019 </p>
3020 !! end
3021
3022 !! test
3023 External links: protocol-relative URL in brackets without text
3024 !! input
3025 [//example.com]
3026 !! result
3027 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3028 </p>
3029 !! end
3030
3031 !! test
3032 External links: protocol-relative URL in free text is left alone
3033 !! input
3034 //example.com/Foo
3035 !! result
3036 <p>//example.com/Foo
3037 </p>
3038 !!end
3039
3040 !! test
3041 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3042 !! input
3043 foo//example.com/Foo
3044 !! result
3045 <p>foo//example.com/Foo
3046 </p>
3047 !! end
3048
3049 !! test
3050 External image
3051 !! input
3052 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3053 !! result
3054 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3055 </p>
3056 !! end
3057
3058 !! test
3059 External image from https
3060 !! input
3061 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3062 !! result
3063 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3064 </p>
3065 !! end
3066
3067 !! test
3068 External image (when not allowed)
3069 !! options
3070 wgAllowExternalImages=0
3071 !! input
3072 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3073 !! result
3074 <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>
3075 </p>
3076 !! end
3077
3078 !! test
3079 Link to non-http image, no img tag
3080 !! input
3081 Link to non-http image, no img tag: ftp://example.com/test.jpg
3082 !! result
3083 <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>
3084 </p>
3085 !! end
3086
3087 !! test
3088 External links: terminating separator
3089 !! input
3090 Terminating separator: http://example.com/thing,
3091 !! result
3092 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3093 </p>
3094 !! end
3095
3096 !! test
3097 External links: intervening separator
3098 !! input
3099 Intervening separator: http://example.com/1,2,3
3100 !! result
3101 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3102 </p>
3103 !! end
3104
3105 !! test
3106 External links: old bug with URL in query
3107 !! input
3108 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3109 !! result
3110 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3111 </p>
3112 !! end
3113
3114 !! test
3115 External links: old URL-in-URL bug, mixed protocols
3116 !! input
3117 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3118 !! result
3119 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3120 </p>
3121 !!end
3122
3123 !! test
3124 External links: URL in text
3125 !! input
3126 URL in text: [http://example.com http://example.com]
3127 !! result
3128 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3129 </p>
3130 !! end
3131
3132 !! test
3133 External links: Clickable images
3134 !! input
3135 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3136 !! result
3137 <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>
3138 </p>
3139 !!end
3140
3141 !! test
3142 External links: raw ampersand
3143 !! input
3144 Old &amp; use: http://x&y
3145 !! result
3146 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3147 </p>
3148 !! end
3149
3150 !! test
3151 External links: encoded ampersand
3152 !! input
3153 Old &amp; use: http://x&amp;y
3154 !! result
3155 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3156 </p>
3157 !! end
3158
3159 !! test
3160 External links: encoded equals (bug 6102)
3161 !! input
3162 http://example.com/?foo&#61;bar
3163 !! result
3164 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3165 </p>
3166 !! end
3167
3168 !! test
3169 External links: [raw ampersand]
3170 !! input
3171 Old &amp; use: [http://x&y]
3172 !! result
3173 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3174 </p>
3175 !! end
3176
3177 !! test
3178 External links: [encoded ampersand]
3179 !! input
3180 Old &amp; use: [http://x&amp;y]
3181 !! result
3182 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3183 </p>
3184 !! end
3185
3186 !! test
3187 External links: [encoded equals] (bug 6102)
3188 !! input
3189 [http://example.com/?foo&#61;bar]
3190 !! result
3191 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3192 </p>
3193 !! end
3194
3195 !! test
3196 External links: [IDN ignored character reference in hostname; strip it right off]
3197 !! input
3198 [http://e&zwnj;xample.com/]
3199 !! result
3200 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3201 </p>
3202 !! end
3203
3204 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3205 # Where an external link could easily circumvent the sanitization of the text of
3206 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3207 # test demands a higher standard. That's a bit strange.
3208 #
3209 # Example:
3210 #
3211 # http://e‌xample.com -> [http://example.com|http://example.com]
3212 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3213 #
3214 # The first example is sanitized, but the second is not. Any security benefits
3215 # from this production are trivial to circumvent. Either remove this test and
3216 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3217 # the test accordingly.
3218 #
3219 # All our love,
3220 # The Parsoid team.
3221 !! test
3222 External links: IDN ignored character reference in hostname; strip it right off
3223 !! input
3224 http://e&zwnj;xample.com/
3225 !! result
3226 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3227 </p>
3228 !! end
3229
3230 !! test
3231 External links: www.jpeg.org (bug 554)
3232 !! input
3233 http://www.jpeg.org
3234 !!result
3235 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3236 </p>
3237 !! end
3238
3239 !! test
3240 External links: URL within URL (original bug 2)
3241 !! input
3242 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3243 !! result
3244 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3245 </p>
3246 !! end
3247
3248 !! test
3249 BUG 361: URL inside bracketed URL
3250 !! input
3251 [http://www.example.com/foo http://www.example.com/bar]
3252 !! result
3253 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3254 </p>
3255 !! end
3256
3257 !! test
3258 BUG 361: URL within URL, not bracketed
3259 !! input
3260 http://www.example.com/foo?=http://www.example.com/bar
3261 !! result
3262 <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>
3263 </p>
3264 !! end
3265
3266 !! test
3267 BUG 289: ">"-token in URL-tail
3268 !! input
3269 http://www.example.com/<hello>
3270 !! result
3271 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3272 </p>
3273 !!end
3274
3275 !! test
3276 BUG 289: literal ">"-token in URL-tail
3277 !! input
3278 http://www.example.com/<b>html</b>
3279 !! result
3280 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3281 </p>
3282 !!end
3283
3284 !! test
3285 BUG 289: ">"-token in bracketed URL
3286 !! input
3287 [http://www.example.com/<hello> stuff]
3288 !! result
3289 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3290 </p>
3291 !!end
3292
3293 !! test
3294 BUG 289: literal ">"-token in bracketed URL
3295 !! input
3296 [http://www.example.com/<b>html</b> stuff]
3297 !! result
3298 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3299 </p>
3300 !!end
3301
3302 !! test
3303 BUG 289: literal double quote at end of URL
3304 !! input
3305 http://www.example.com/"hello"
3306 !! result
3307 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3308 </p>
3309 !!end
3310
3311 !! test
3312 BUG 289: literal double quote in bracketed URL
3313 !! input
3314 [http://www.example.com/"hello" stuff]
3315 !! result
3316 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3317 </p>
3318 !!end
3319
3320 !! test
3321 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3322 !! input
3323 [http://www.example.com test]
3324 !! result
3325 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3326 </p>
3327 !! end
3328
3329 !! test
3330 External links: link text with spaces
3331 !! input
3332 [http://www.example.com a b c]
3333 [http://www.example.com ''a'' ''b'']
3334 !! result
3335 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3336 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3337 </p>
3338 !! end
3339
3340 !! test
3341 External links: wiki links within external link (Bug 3695)
3342 !! input
3343 [http://example.com [[wikilink]] embedded in ext link]
3344 !! result
3345 <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>
3346 </p>
3347 !! end
3348
3349 !! test
3350 BUG 787: Links with one slash after the url protocol are invalid
3351 !! input
3352 http:/example.com
3353
3354 [http:/example.com title]
3355 !! result
3356 <p>http:/example.com
3357 </p><p>[http:/example.com title]
3358 </p>
3359 !! end
3360
3361 !! test
3362 Bracketed external links with template-generated invalid target
3363 !! input
3364 [{{echo|http:/example.com}} title]
3365 !! result
3366 <p>[http:/example.com title]
3367 </p>
3368 !! end
3369
3370 !! test
3371 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3372 !! input
3373 ''[http://example.com text'']
3374 [http://example.com '''text]'''
3375 ''Something [http://example.com in italic'']
3376 ''Something [http://example.com mixed''''', even bold]'''
3377 '''''Now [http://example.com both''''']
3378 !! result
3379 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3380 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3381 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3382 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3383 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3384 </p>
3385 !! end
3386
3387
3388 !! test
3389 Bug 4781: %26 in URL
3390 !! input
3391 http://www.example.com/?title=AT%26T
3392 !! result
3393 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3394 </p>
3395 !! end
3396
3397 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3398 # % is actually legal in HTML5. Any change in output would need testing though.
3399 !! test
3400 Bug 4781, 5267: %25 in URL
3401 !! input
3402 http://www.example.com/?title=100%25_Bran
3403 !! result
3404 <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>
3405 </p>
3406 !! end
3407
3408 !! test
3409 Bug 4781, 5267: %28, %29 in URL
3410 !! input
3411 http://www.example.com/?title=Ben-Hur_%281959_film%29
3412 !! result
3413 <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>
3414 </p>
3415 !! end
3416
3417
3418 !! test
3419 Bug 4781: %26 in autonumber URL
3420 !! input
3421 [http://www.example.com/?title=AT%26T]
3422 !! result
3423 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3424 </p>
3425 !! end
3426
3427 !! test
3428 Bug 4781, 5267: %26 in autonumber URL
3429 !! input
3430 [http://www.example.com/?title=100%25_Bran]
3431 !! result
3432 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3433 </p>
3434 !! end
3435
3436 !! test
3437 Bug 4781, 5267: %28, %29 in autonumber URL
3438 !! input
3439 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3440 !! result
3441 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3442 </p>
3443 !! end
3444
3445
3446 !! test
3447 Bug 4781: %26 in bracketed URL
3448 !! input
3449 [http://www.example.com/?title=AT%26T link]
3450 !! result
3451 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3452 </p>
3453 !! end
3454
3455 !! test
3456 Bug 4781, 5267: %26 in bracketed URL
3457 !! input
3458 [http://www.example.com/?title=100%25_Bran link]
3459 !! result
3460 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3461 </p>
3462 !! end
3463
3464 !! test
3465 Bug 4781, 5267: %28, %29 in bracketed URL
3466 !! input
3467 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3468 !! result
3469 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3470 </p>
3471 !! end
3472
3473 !! test
3474 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3475 !! input
3476 Some [http://example.com/ pretty ''italics'' and stuff]!
3477 !! result
3478 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3479 </p>
3480 !! end
3481
3482 !! test
3483 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3484 !! input
3485 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3486 !! result
3487 <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>
3488 </p>
3489 !! end
3490
3491 !! test
3492 External link containing double-single-quotes with no space separating the url from text in italics
3493 !! input
3494 [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]].]
3495 !! result
3496 <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>
3497 </p>
3498 !! end
3499
3500 !! test
3501 External link with comments in link text
3502 !! input
3503 [http://www.google.com Google <!-- comment -->]
3504 !! result
3505 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3506 </p>
3507 !! end
3508
3509 !! test
3510 URL-encoding in URL functions (single parameter)
3511 !! input
3512 {{localurl:Some page|amp=&}}
3513 !! result
3514 <p>/index.php?title=Some_page&amp;amp=&amp;
3515 </p>
3516 !! end
3517
3518 !! test
3519 URL-encoding in URL functions (multiple parameters)
3520 !! input
3521 {{localurl:Some page|q=?&amp=&}}
3522 !! result
3523 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3524 </p>
3525 !! end
3526
3527 !! test
3528 Brackets in urls
3529 !! input
3530 http://example.com/index.php?foozoid%5B%5D=bar
3531
3532 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3533 !! result
3534 <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>
3535 </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>
3536 </p>
3537 !! end
3538
3539 !! test
3540 IPv6 urls (bug 21261)
3541 !! options
3542 disabled
3543 !! input
3544 http://[2404:130:0:1000::187:2]/index.php
3545 !! result
3546 <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>
3547 </p>
3548 !! end
3549
3550 !! test
3551 Non-extlinks in brackets
3552 !! input
3553 [foo]
3554 [foo bar]
3555 [foo ''bar'']
3556 [fool's] errand
3557 [fool's errand]
3558 [{{echo|foo}}]
3559 [{{echo|foo}} bar]
3560 [{{echo|foo}} ''bar'']
3561 [{{echo|foo}}l's] errand
3562 [{{echo|foo}}l's errand]
3563 [url={{echo|foo}}]
3564 [url=http://example.com]
3565 !! result
3566 <p>[foo]
3567 [foo bar]
3568 [foo <i>bar</i>]
3569 [fool's] errand
3570 [fool's errand]
3571 [foo]
3572 [foo bar]
3573 [foo <i>bar</i>]
3574 [fool's] errand
3575 [fool's errand]
3576 [url=foo]
3577 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3578 </p>
3579 !! end
3580
3581 !! test
3582 Parsoid: Percent encoding in external links
3583 !! options
3584 parsoid
3585 !! input
3586 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3587 !! result
3588 <p><a rel="mw:ExtLink"
3589 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3590 !! end
3591
3592 !! test
3593 Parsoid: use url link syntax for links where the content is equal the link
3594 target
3595 !! options
3596 parsoid
3597 !! input
3598 http://example.com
3599 !! result
3600 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3601 !! end
3602
3603 ###
3604 ### Quotes
3605 ###
3606
3607 !! test
3608 Quotes
3609 !! input
3610 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3611
3612 Normal text. '''''Bold italic text.''''' Normal text.
3613 !!result
3614 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3615 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3616 </p>
3617 !! end
3618
3619
3620 !! test
3621 Unclosed and unmatched quotes (php)
3622 !! options
3623 php
3624 !! input
3625 '''''Bold italic text '''with bold deactivated''' in between.'''''
3626
3627 '''''Bold italic text ''with italic deactivated'' in between.'''''
3628
3629 '''Bold text..
3630
3631 ..spanning two paragraphs (should not work).'''
3632
3633 '''Bold tag left open
3634
3635 ''Italic tag left open
3636
3637 Normal text.
3638
3639 <!-- Unmatching number of opening, closing tags: -->
3640 '''This year''''s election ''should'' beat '''last year''''s.
3641
3642 ''Tom'''s car is bigger than ''Susan'''s.
3643
3644 Plain ''italic'''s plain
3645 !! result
3646 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3647 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3648 </p><p><b>Bold text..</b>
3649 </p><p>..spanning two paragraphs (should not work).
3650 </p><p><b>Bold tag left open</b>
3651 </p><p><i>Italic tag left open</i>
3652 </p><p>Normal text.
3653 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3654 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3655 </p><p>Plain <i>italic'</i>s plain
3656 </p>
3657 !! end
3658 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3659 # parser strips. The wikitext contains just the first half of the bold
3660 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3661 # differently than the PHP parser.)
3662 !! test
3663 Unclosed and unmatched quotes (parsoid)
3664 !! options
3665 parsoid
3666 !! input
3667 '''''Bold italic text '''with bold deactivated''' in between.'''''
3668
3669 '''''Bold italic text ''with italic deactivated'' in between.'''''
3670
3671 '''Bold text..
3672
3673 ..spanning two paragraphs (should not work).'''
3674
3675 '''Bold tag left open
3676
3677 ''Italic tag left open
3678
3679 Normal text.
3680
3681 <!-- Unmatching number of opening, closing tags: -->
3682 '''This year''''s election ''should'' beat '''last year''''s.
3683
3684 ''Tom'''s car is bigger than ''Susan'''s.
3685
3686 Plain ''italic'''s plain
3687 !! result
3688 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3689 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3690 </p><p><b>Bold text..</b>
3691 </p><p>..spanning two paragraphs (should not work).<b></b>
3692 </p><p><b>Bold tag left open</b>
3693 </p><p><i>Italic tag left open</i>
3694 </p><p>Normal text.
3695 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3696 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3697 </p><p>Plain <i>italic'</i>s plain
3698 </p>
3699 !! end
3700
3701 ###
3702 ### Tables
3703 ###
3704 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3705 ###
3706
3707 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3708 # is the bare minimum required by the spec, see:
3709 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3710 !! test
3711 A table with no data. (php)
3712 !! options
3713 php
3714 !! input
3715 {||}
3716 !! result
3717 !! end
3718 # Parsoid team replies: empty table tags are legal in HTML5
3719 !! test
3720 A table with no data. (parsoid)
3721 !! options
3722 parsoid
3723 !! input
3724 {||}
3725 !! result
3726 <table></table>
3727 !! end
3728
3729 # A table with nothing but a caption is invalid XHTML, we might want to render
3730 # this as <p>caption</p>
3731 !! test
3732 A table with nothing but a caption (php)
3733 !! options
3734 php
3735 !! input
3736 {|
3737 |+ caption
3738 |}
3739 !! result
3740 <table>
3741 <caption> caption
3742 </caption><tr><td></td></tr></table>
3743
3744 !! end
3745 # Parsoid team replies: table with only a caption is legal in HTML5
3746 !! test
3747 A table with nothing but a caption (parsoid)
3748 !! options
3749 parsoid
3750 !! input
3751 {|
3752 |+ caption
3753 |}
3754 !! result
3755 <table><caption> caption</caption></table>
3756 !! end
3757
3758 !! test
3759 A table with caption with default-spaced attributes and a table row
3760 !! input
3761 {|
3762 |+ style="color: red;" | caption1
3763 |-
3764 | foo
3765 |}
3766 !! result
3767 <table>
3768 <caption style="color: red;"> caption1
3769 </caption>
3770 <tr>
3771 <td> foo
3772 </td></tr></table>
3773
3774 !! end
3775
3776 !! test
3777 A table with captions with non-default spaced attributes and a table row
3778 !! input
3779 {|
3780 |+style="color: red;"|caption2
3781 |+ style="color: red;"| caption3
3782 |-
3783 | foo
3784 |}
3785 !! result
3786 <table>
3787 <caption style="color: red;">caption2
3788 </caption>
3789 <caption style="color: red;"> caption3
3790 </caption>
3791 <tr>
3792 <td> foo
3793 </td></tr></table>
3794
3795 !! end
3796
3797 !! test
3798 Table td-cell syntax variations
3799 !! input
3800 {|
3801 | foo bar foo | baz
3802 | foo bar foo || baz
3803 | style='color:red;' | baz
3804 | style='color:red;' || baz
3805 |}
3806 !! result
3807 <table>
3808 <tr>
3809 <td> baz
3810 </td>
3811 <td> foo bar foo </td>
3812 <td> baz
3813 </td>
3814 <td style="color:red;"> baz
3815 </td>
3816 <td> style='color:red;' </td>
3817 <td> baz
3818 </td></tr></table>
3819
3820 !! end
3821
3822 !! test
3823 Simple table
3824 !! input
3825 {|
3826 | 1 || 2
3827 |-
3828 | 3 || 4
3829 |}
3830 !! result
3831 <table>
3832 <tr>
3833 <td> 1 </td>
3834 <td> 2
3835 </td></tr>
3836 <tr>
3837 <td> 3 </td>
3838 <td> 4
3839 </td></tr></table>
3840
3841 !! end
3842
3843 !! test
3844 Simple table but with multiple dashes for row wikitext
3845 !! input
3846 {|
3847 | foo
3848 |-----
3849 | bar
3850 |}
3851 !! result
3852 <table>
3853 <tr>
3854 <td> foo
3855 </td></tr>
3856 <tr>
3857 <td> bar
3858 </td></tr></table>
3859
3860 !! end
3861 !! test
3862 Multiplication table
3863 !! input
3864 {| border="1" cellpadding="2"
3865 |+Multiplication table
3866 |-
3867 ! &times; !! 1 !! 2 !! 3
3868 |-
3869 ! 1
3870 | 1 || 2 || 3
3871 |-
3872 ! 2
3873 | 2 || 4 || 6
3874 |-
3875 ! 3
3876 | 3 || 6 || 9
3877 |-
3878 ! 4
3879 | 4 || 8 || 12
3880 |-
3881 ! 5
3882 | 5 || 10 || 15
3883 |}
3884 !! result
3885 <table border="1" cellpadding="2">
3886 <caption>Multiplication table
3887 </caption>
3888 <tr>
3889 <th> &#215; </th>
3890 <th> 1 </th>
3891 <th> 2 </th>
3892 <th> 3
3893 </th></tr>
3894 <tr>
3895 <th> 1
3896 </th>
3897 <td> 1 </td>
3898 <td> 2 </td>
3899 <td> 3
3900 </td></tr>
3901 <tr>
3902 <th> 2
3903 </th>
3904 <td> 2 </td>
3905 <td> 4 </td>
3906 <td> 6
3907 </td></tr>
3908 <tr>
3909 <th> 3
3910 </th>
3911 <td> 3 </td>
3912 <td> 6 </td>
3913 <td> 9
3914 </td></tr>
3915 <tr>
3916 <th> 4
3917 </th>
3918 <td> 4 </td>
3919 <td> 8 </td>
3920 <td> 12
3921 </td></tr>
3922 <tr>
3923 <th> 5
3924 </th>
3925 <td> 5 </td>
3926 <td> 10 </td>
3927 <td> 15
3928 </td></tr></table>
3929
3930 !! end
3931
3932 !! test
3933 Accept "||" in table headings
3934 !! input
3935 {|
3936 !h1 || h2
3937 |}
3938 !! result
3939 <table>
3940 <tr>
3941 <th>h1 </th>
3942 <th> h2
3943 </th></tr></table>
3944
3945 !! end
3946
3947 !! test
3948 Accept "||" in indented table headings
3949 !! input
3950 :{|
3951 !h1 || h2
3952 |}
3953 !! result
3954 <dl><dd><table>
3955 <tr>
3956 <th>h1 </th>
3957 <th> h2
3958 </th></tr></table></dd></dl>
3959
3960 !! end
3961
3962 !! test
3963 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3964 !! input
3965 {|
3966 !| h1
3967 || a
3968 |}
3969 !! result
3970 <table>
3971 <tr>
3972 <th> h1
3973 </th>
3974 <td> a
3975 </td></tr></table>
3976
3977 !! end
3978
3979 !!test
3980 Accept "| !" at start of line in tables (ignore !-attribute)
3981 !!input
3982 {|
3983 |-
3984 | !style="color:red" | bar
3985 |}
3986 !!result
3987 <table>
3988
3989 <tr>
3990 <td> bar
3991 </td></tr></table>
3992
3993 !!end
3994
3995 !!test
3996 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 +/-
3997 !!input
3998 {|
3999 |-
4000 |style='color:red;'|+1
4001 |style='color:blue;'|-1
4002 |-
4003 | 1 || 2 || 3
4004 | 1 ||+2 ||-3
4005 |-
4006 | +1
4007 | -1
4008 |}
4009 !!result
4010 <table>
4011
4012 <tr>
4013 <td style="color:red;">+1
4014 </td>
4015 <td style="color:blue;">-1
4016 </td></tr>
4017 <tr>
4018 <td> 1 </td>
4019 <td> 2 </td>
4020 <td> 3
4021 </td>
4022 <td> 1 </td>
4023 <td>+2 </td>
4024 <td>-3
4025 </td></tr>
4026 <tr>
4027 <td> +1
4028 </td>
4029 <td> -1
4030 </td></tr></table>
4031
4032 !!end
4033
4034 !! test
4035 Table rowspan
4036 !! input
4037 {| border=1
4038 | Cell 1, row 1
4039 |rowspan=2| Cell 2, row 1 (and 2)
4040 | Cell 3, row 1
4041 |-
4042 | Cell 1, row 2
4043 | Cell 3, row 2
4044 |}
4045 !! result
4046 <table border="1">
4047 <tr>
4048 <td> Cell 1, row 1
4049 </td>
4050 <td rowspan="2"> Cell 2, row 1 (and 2)
4051 </td>
4052 <td> Cell 3, row 1
4053 </td></tr>
4054 <tr>
4055 <td> Cell 1, row 2
4056 </td>
4057 <td> Cell 3, row 2
4058 </td></tr></table>
4059
4060 !! end
4061
4062 !! test
4063 Nested table
4064 !! input
4065 {| border=1
4066 | &alpha;
4067 |
4068 {| bgcolor=#ABCDEF border=2
4069 |nested
4070 |-
4071 |table
4072 |}
4073 |the original table again
4074 |}
4075 !! result
4076 <table border="1">
4077 <tr>
4078 <td> &#945;
4079 </td>
4080 <td>
4081 <table bgcolor="#ABCDEF" border="2">
4082 <tr>
4083 <td>nested
4084 </td></tr>
4085 <tr>
4086 <td>table
4087 </td></tr></table>
4088 </td>
4089 <td>the original table again
4090 </td></tr></table>
4091
4092 !! end
4093
4094 !! test
4095 Invalid attributes in table cell (bug 1830)
4096 !! input
4097 {|
4098 |Cell:|broken
4099 |}
4100 !! result
4101 <table>
4102 <tr>
4103 <td>broken
4104 </td></tr></table>
4105
4106 !! end
4107
4108
4109 !! test
4110 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
4111 !! input
4112 {|
4113 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
4114 !! result
4115 <table>
4116 <tr>
4117 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
4118 <td>]" onmouseover="alert(document.cookie)"&gt;test
4119 </td>
4120 </tr>
4121 </table>
4122
4123 !! end
4124
4125
4126 !! test
4127 Indented table markup mixed with indented pre content (proposed in bug 6200)
4128 !! input
4129 <table>
4130 <tr>
4131 <td>
4132 Text that should be rendered preformatted
4133 </td>
4134 </tr>
4135 </table>
4136 !! result
4137 <table>
4138 <tr>
4139 <td>
4140 <pre>Text that should be rendered preformatted
4141 </pre>
4142 </td>
4143 </tr>
4144 </table>
4145
4146 !! end
4147
4148 !! test
4149 Template-generated table cell attributes and cell content
4150 !! input
4151 {|
4152 |{{table_attribs}}
4153 |}
4154 !! result
4155 <table>
4156 <tr>
4157 <td style="color: red"> Foo
4158 </td></tr></table>
4159
4160 !! end
4161
4162 !! test
4163 Template-generated table cell attributes and cell content (2)
4164 !! input
4165 {|
4166 |align=center {{table_attribs}}
4167 |}
4168 !! result
4169 <table>
4170 <tr>
4171 <td align="center" style="color: red"> Foo
4172 </td></tr></table>
4173
4174 !! end
4175
4176 !! test
4177 Template-generated table cell attributes and cell content (3)
4178 !! input
4179 {|
4180 |align=center {{table_cells}}
4181 |}
4182 !! result
4183 <table>
4184 <tr>
4185 <td align="center" style="color: red"> Foo </td>
4186 <td> Bar </td>
4187 <td> Baz
4188 </td></tr></table>
4189
4190 !! end
4191
4192 !! test
4193 Table with row followed by newlines and table heading
4194 !! input
4195 {|
4196 |-
4197
4198 ! foo
4199 |}
4200 !! result
4201 <table>
4202
4203
4204 <tr>
4205 <th> foo
4206 </th></tr></table>
4207
4208 !! end
4209
4210 !! test
4211 Table with empty line following the start tag
4212 !! input
4213 {|
4214
4215 |-
4216 | foo
4217 |}
4218 !! result
4219 <table>
4220
4221
4222 <tr>
4223 <td> foo
4224 </td></tr></table>
4225
4226 !! end
4227
4228 # FIXME: Preserve the attribute properly (with an empty string as value) in
4229 # the PHP parser. Parsoid implements the behavior below.
4230 !! test
4231 Table attributes with empty value
4232 !! options
4233 parsoid
4234 !! input
4235 {|
4236 | style=| hello
4237 |}
4238 !! result
4239 <table>
4240 <tbody>
4241 <tr>
4242 <td style=""> hello
4243 </td></tr></tbody></table>
4244
4245 !! end
4246
4247 !! test
4248 Wikitext table with a lot of comments
4249 !! input
4250 {|
4251 <!-- c0 -->
4252 | foo
4253 <!-- c1 -->
4254 |- <!-- c2 -->
4255 <!-- c3 -->
4256 |<!-- c4 -->
4257 <!-- c5 -->
4258 |}
4259 !! result
4260 <table>
4261 <tr>
4262 <td> foo
4263 </td></tr>
4264 <tr>
4265 <td>
4266 </td></tr></table>
4267
4268 !! end
4269
4270 !! test
4271 Wikitext table with double-line table cell
4272 !! input
4273 {|
4274 |a
4275 b
4276 |}
4277 !! result
4278 <table>
4279 <tr>
4280 <td>a
4281 <p>b
4282 </p>
4283 </td></tr></table>
4284
4285 !! end
4286
4287 !! test
4288 Table cell with a single comment
4289 !! input
4290 {|
4291 | <!-- c1 -->
4292 | a
4293 |}
4294 !! result
4295 <table>
4296 <tr>
4297 <td>
4298 </td>
4299 <td> a
4300 </td></tr></table>
4301
4302 !! end
4303
4304 # The expected HTML structure in this test is debatable. The PHP parser does
4305 # not parse this kind of table at all. The main focus for Parsoid is on
4306 # round-tripping, so this output is ok for now. TODO: revisit!
4307 !! test
4308 Wikitext table with html-syntax row (Parsoid)
4309 !! options
4310 parsoid
4311 !! input
4312 {|
4313 |-
4314 <td>foo</td>
4315 |}
4316 !! result
4317 <table>
4318 <tbody>
4319 <tr>
4320 <td>foo</td></tr></tbody></table>
4321 !! end
4322
4323 !! test
4324 Implicit <td> after a |-
4325 (PHP parser relies on Tidy to add the missing <td> tags)
4326 !! options
4327 parsoid=wt2html,wt2wt
4328 !! input
4329 {|
4330 |-
4331 a
4332 |}
4333 !! result
4334 <table>
4335 <tr><td>a</td></tr>
4336 </table>
4337 !! end
4338
4339 !! test
4340 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4341 (PHP parser relies on Tidy to add the missing <td> tags)
4342 !! options
4343 parsoid=wt2html,wt2wt
4344 !! input
4345 {|
4346 |-
4347 |
4348 a
4349 |-
4350 b
4351 |}
4352 !! result
4353 <table>
4354 <tbody>
4355 <tr><td><pre>a</pre></td></tr>
4356 <tr><td> b</td></tr>
4357 </tbody>
4358 </table>
4359 !! end
4360
4361 !! test
4362 Lists should be recognized in an implicit <td> context
4363 (PHP parser relies on Tidy to add the missing <td> tags)
4364 !! options
4365 parsoid=wt2html,wt2wt
4366 !! input
4367 {|
4368 |-
4369 *a
4370 |}
4371 !! result
4372 <table>
4373 <tr>
4374 <td><ul><li>a</li></ul></td>
4375 </tr>
4376 </table>
4377 !! end
4378
4379 !! test
4380 Parsoid: Round-trip tables directly followed by content (bug 51219)
4381 !! options
4382 parsoid=wt2html,wt2wt
4383 !! input
4384 {|
4385 |foo
4386 |} bar
4387
4388 {|
4389 |baz
4390 |}<b>quux</b>
4391 !! result
4392 <table><tbody>
4393 <tr>
4394 <td>foo</td></tr></tbody></table> bar
4395 <table>
4396 <tbody>
4397 <tr>
4398 <td>baz</td></tr></tbody></table><b>quux</b>
4399 !! end
4400
4401 !! test
4402 Parsoid: Default to a newline after tables in new content (bug 51219)
4403 !! options
4404 parsoid=html2wt
4405 !! input
4406 {|
4407 |-
4408 |foo
4409 |}
4410 <nowiki> </nowiki>bar
4411 {|
4412 |-
4413 |baz
4414 |}
4415 '''quux'''
4416 !! result
4417 <table><tbody>
4418 <tr>
4419 <td>foo</td></tr></tbody></table> bar
4420 <table><tbody>
4421 <tr>
4422 <td>baz</td></tr></tbody></table><b>quux</b>
4423 !! end
4424
4425 ###
4426 ### Internal links
4427 ###
4428 !! test
4429 Plain link, capitalized
4430 !! input
4431 [[Main Page]]
4432 !! result
4433 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4434 </p>
4435 !! end
4436
4437 !! test
4438 Plain link, uncapitalized
4439 !! input
4440 [[main Page]]
4441 !! result
4442 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4443 </p>
4444 !! end
4445
4446 !! test
4447 Piped link
4448 !! input
4449 [[Main Page|The Main Page]]
4450 !! result
4451 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4452 </p>
4453 !! end
4454
4455 !! test
4456 Piped link with comment in link text
4457 !! input
4458 [[Main Page|The Main<!--front--> Page]]
4459 !! result
4460 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4461 </p>
4462 !! end
4463
4464 !! test
4465 Broken link
4466 !! input
4467 [[Zigzagzogzagzig]]
4468 !! result
4469 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4470 </p>
4471 !! end
4472
4473 !! test
4474 Broken link with fragment
4475 !! input
4476 [[Zigzagzogzagzig#zug]]
4477 !! result
4478 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4479 </p>
4480 !! end
4481
4482 !! test
4483 Special page link with fragment
4484 !! input
4485 [[Special:Version#anchor]]
4486 !! result
4487 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4488 </p>
4489 !! end
4490
4491 !! test
4492 Nonexistent special page link with fragment
4493 !! input
4494 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4495 !! result
4496 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4497 </p>
4498 !! end
4499
4500 !! test
4501 Link with prefix
4502 !! input
4503 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4504 !! result
4505 <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>
4506 </p>
4507 !! end
4508
4509 !! test
4510 Link with suffix
4511 !! input
4512 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4513 !! result
4514 <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>!!!
4515 </p>
4516 !! end
4517
4518 !! article
4519 prefixed article
4520 !! text
4521 Some text
4522 !! endarticle
4523
4524 !! test
4525 Bug 43661: Piped links with identical prefixes
4526 !! input
4527 [[prefixed article|prefixed articles with spaces]]
4528
4529 [[prefixed article|prefixed articlesaoeu]]
4530
4531 [[Main Page|Main Page test]]
4532 !! result
4533 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4534 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4535 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4536 </p>
4537 !! end
4538
4539
4540 !! test
4541 Link with HTML entity in suffix / tail
4542 !! input
4543 [[Main Page]]&quot;, [[Main Page]]&#97;
4544 !! result
4545 <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;
4546 </p>
4547 !! end
4548
4549 !! test
4550 Link with 3 brackets
4551 !! input
4552 [[[main page]]]
4553 !! result
4554 <p>[[[main page]]]
4555 </p>
4556 !! end
4557
4558 !! test
4559 Piped link with 3 brackets
4560 !! input
4561 [[[main page|the main page]]]
4562 !! result
4563 <p>[[[main page|the main page]]]
4564 </p>
4565 !! end
4566
4567 !! test
4568 Link with multiple pipes
4569 !! input
4570 [[Main Page|The|Main|Page]]
4571 !! result
4572 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4573 </p>
4574 !! end
4575
4576 !! test
4577 Link to namespaces
4578 !! input
4579 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4580 !! result
4581 <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>
4582 </p>
4583 !! end
4584
4585 !! test
4586 Piped link to namespace
4587 !! input
4588 [[Meta:Disclaimers|The disclaimers]]
4589 !! result
4590 <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>
4591 </p>
4592 !! end
4593
4594 !! test
4595 Link containing }
4596 !! input
4597 [[Usually caused by a typo (oops}]]
4598 !! result
4599 <p>[[Usually caused by a typo (oops}]]
4600 </p>
4601 !! end
4602
4603 !! test
4604 Link containing % (not as a hex sequence)
4605 !! input
4606 [[7% Solution]]
4607 !! result
4608 <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>
4609 </p>
4610 !! end
4611
4612 !! test
4613 Link containing % as a single hex sequence interpreted to char
4614 !! input
4615 [[7%25 Solution]]
4616 !! result
4617 <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>
4618 </p>
4619 !!end
4620
4621 !! test
4622 Link containing % as a double hex sequence interpreted to hex sequence
4623 !! input
4624 [[7%2525 Solution]]
4625 !! result
4626 <p>[[7%2525 Solution]]
4627 </p>
4628 !!end
4629
4630 !! test
4631 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4632 Example for such a section: == < ==
4633 !! input
4634 [[%23%3c]][[%23%3e]]
4635 !! result
4636 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4637 </p>
4638 !! end
4639
4640 !! test
4641 Link containing "<#" and ">#" as a hex sequences
4642 !! input
4643 [[%3c%23]][[%3e%23]]
4644 !! result
4645 <p>[[%3c%23]][[%3e%23]]
4646 </p>
4647 !! end
4648
4649 !! test
4650 Link containing an equals sign
4651 !! input
4652 [[Special:BookSources/isbn=4-00-026157-6]]
4653 !! result
4654 <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>
4655 </p>
4656 !! end
4657
4658 !! article
4659 Foo~bar
4660 !! text
4661 Just a test of an article title containing a tilde.
4662 !! endarticle
4663
4664 # note that links containing signatures, like [[Foo~~~~]], are
4665 # massaged by the pre-save transform (PST) and so the tildes are never
4666 # seen by the parser.
4667 !! test
4668 Link containing a tilde
4669 !! input
4670 [[Foo~bar]]
4671 !! result
4672 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4673 </p>
4674 !! end
4675
4676 !! test
4677 Link containing double-single-quotes '' (bug 4598)
4678 !! input
4679 [[Lista d''e paise d''o munno]]
4680 !! result
4681 <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>
4682 </p>
4683 !! end
4684
4685 !! test
4686 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4687 !! input
4688 Some [[Link|pretty ''italics'' and stuff]]!
4689 !! result
4690 <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>!
4691 </p>
4692 !! end
4693
4694 !! test
4695 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4696 !! input
4697 ''Some [[Link|pretty ''italics'' and stuff]]!
4698 !! result
4699 <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>
4700 </p>
4701 !! end
4702
4703 !! test
4704 Link with double quotes in title part (literal) and alternate part (interpreted)
4705 !! input
4706 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4707
4708 [[''Pentecoste'']]
4709
4710 [[''Pentecoste''|Pentecoste]]
4711
4712 [[''Pentecoste''|''Pentecoste'']]
4713 !! result
4714 <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>
4715 </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>
4716 </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>
4717 </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>
4718 </p>
4719 !! end
4720
4721 !! test
4722 Broken image links with HTML captions (bug 39700)
4723 !! input
4724 [[File:Nonexistent|<script></script>]]
4725 [[File:Nonexistent|100px|<script></script>]]
4726 [[File:Nonexistent|&lt;]]
4727 [[File:Nonexistent|a<i>b</i>c]]
4728 !! result
4729 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4730 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4731 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4732 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4733 </p>
4734 !! end
4735
4736 !! test
4737 Plain link to URL
4738 !! input
4739 [[http://www.example.com]]
4740 !! result
4741 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4742 </p>
4743 !! end
4744
4745 !! test
4746 Plain link to URL with link text
4747 !! input
4748 [[http://www.example.com Link text]]
4749 !! result
4750 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4751 </p>
4752 !! end
4753
4754 !! test
4755 Plain link to protocol-relative URL
4756 !! input
4757 [[//www.example.com]]
4758 !! result
4759 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4760 </p>
4761 !! end
4762
4763 !! test
4764 Plain link to protocol-relative URL with link text
4765 !! input
4766 [[//www.example.com Link text]]
4767 !! result
4768 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4769 </p>
4770 !! end
4771
4772 !! test
4773 Plain link to page with question mark in title
4774 !! input
4775 [[A?b]]
4776
4777 [[A?b|Baz]]
4778 !! result
4779 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4780 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4781 </p>
4782 !! end
4783
4784
4785 # I'm fairly sure the expected result here is wrong.
4786 # We want these to be URL links, not pseudo-pages with URLs for titles....
4787 # However the current output is also pretty screwy.
4788 #
4789 # ----
4790 # I'm changing it to match the current output--it arguably makes more
4791 # sense in the light of the test above. Old expected result was:
4792 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4793 #</p>
4794 # But I think this test is bordering on "garbage in, garbage out" anyway.
4795 # -- wtm
4796 !! test
4797 Piped link to URL
4798 !! input
4799 Piped link to URL: [[http://www.example.com|an example URL]]
4800 !! result
4801 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4802 </p>
4803 !! end
4804
4805 !! test
4806 BUG 2: [[page|http://url/]] should link to page, not http://url/
4807 !! input
4808 [[Main Page|http://url/]]
4809 !! result
4810 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4811 </p>
4812 !! end
4813
4814 !! test
4815 BUG 337: Escaped self-links should be bold
4816 !! options
4817 title=[[Bug462]]
4818 !! input
4819 [[Bu&#103;462]] [[Bug462]]
4820 !! result
4821 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4822 </p>
4823 !! end
4824
4825 !! test
4826 Self-link to section should not be bold
4827 !! options
4828 title=[[Main Page]]
4829 !! input
4830 [[Main Page#section]]
4831 !! result
4832 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4833 </p>
4834 !! end
4835
4836 !! article
4837 00
4838 !! text
4839 This is 00.
4840 !! endarticle
4841
4842 !!test
4843 Self-link to numeric title
4844 !!options
4845 title=[[0]]
4846 !!input
4847 [[0]]
4848 !!result
4849 <p><strong class="selflink">0</strong>
4850 </p>
4851 !!end
4852
4853 !!test
4854 Link to numeric-equivalent title
4855 !!options
4856 title=[[0]]
4857 !!input
4858 [[00]]
4859 !!result
4860 <p><a href="/wiki/00" title="00">00</a>
4861 </p>
4862 !!end
4863
4864 !! test
4865 <nowiki> inside a link
4866 !! input
4867 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4868 !! result
4869 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4870 </p>
4871 !! end
4872
4873 !! test
4874 Non-breaking spaces in title
4875 !! input
4876 [[&nbsp; Main &nbsp; Page &nbsp;]]
4877 !! result
4878 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4879 </p>
4880 !!end
4881
4882 !! test
4883 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4884 !! options
4885 language=ca
4886 !! input
4887 '''[[Main Page]]'''
4888 !! result
4889 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4890 </p>
4891 !! end
4892
4893 !! test
4894 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4895 !! options
4896 language=ca
4897 !! input
4898 ''[[Main Page]]''
4899 !! result
4900 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4901 </p>
4902 !! end
4903
4904 !! test
4905 Internal link with en linktrail: no apostrophes (bug 27473)
4906 !! options
4907 language=en
4908 !! input
4909 [[Something]]'nice
4910 !! result
4911 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4912 </p>
4913 !! end
4914
4915 !! test
4916 Internal link with ca linktrail with apostrophes (bug 27473)
4917 !! options
4918 language=ca
4919 !! input
4920 [[Something]]'nice
4921 !! result
4922 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4923 </p>
4924 !! end
4925
4926 !! test
4927 Internal link with kaa linktrail with apostrophes (bug 27473)
4928 !! options
4929 language=kaa
4930 !! input
4931 [[Something]]'nice
4932 !! result
4933 <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>
4934 </p>
4935 !! end
4936
4937 !! article
4938 Söfnuður
4939 !! text
4940 Test.
4941 !! endarticle
4942
4943 !! test
4944 Internal link with is link prefix
4945 !! options
4946 language=is
4947 !! input
4948 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4949 !! result
4950 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4951 </p>
4952 !! end
4953
4954 !! article
4955 Mótmælendatrú
4956 !! text
4957 Test.
4958 !! endarticle
4959
4960 !! test
4961 Internal link with is link trail and link prefix
4962 !! options
4963 language=is
4964 !! input
4965 [[mótmælendatrú|xxx]]ar
4966 [[mótmælendatrú]]ar
4967 mótmælenda[[söfnuður]]
4968 mótmælenda[[söfnuður|söfnuðir]]
4969 mótmælenda[[söfnuður|söfnuðir]]xxx
4970 !! result
4971 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4972 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4973 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4974 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4975 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4976 </p>
4977 !! end
4978
4979 !! test
4980 Parsoid link trail escaping
4981 !! options
4982 parsoid=html2wt,html2html
4983 !! input
4984 [[apple]]<nowiki/>s
4985 !! result
4986 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4987 !! end
4988
4989 !! test
4990 Parsoid link prefix escaping
4991 !! options
4992 language=is
4993 parsoid=html2wt,html2html
4994 !! input
4995 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4996 !! result
4997 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4998 !! end
4999
5000 !! test
5001 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
5002 !! input
5003 [[Foo| bar]]
5004
5005 [[Foo| ''bar'']]
5006
5007 [http://wp.org foo]
5008
5009 [http://wp.org ''foo'']
5010 !! result
5011 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
5012 </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>
5013 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
5014 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
5015 </p>
5016 !! end
5017
5018 ###
5019 ### Interwiki links (see maintenance/interwiki.sql)
5020 ###
5021
5022 !! test
5023 Inline interwiki link
5024 !! input
5025 [[MeatBall:SoftSecurity]]
5026 !! result
5027 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
5028 </p>
5029 !! end
5030
5031 !! test
5032 Inline interwiki link with empty title (bug 2372)
5033 !! input
5034 [[MeatBall:]]
5035 !! result
5036 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
5037 </p>
5038 !! end
5039
5040 !! test
5041 Interwiki link encoding conversion (bug 1636)
5042 !! input
5043 *[[Wikipedia:ro:Olteni&#0355;a]]
5044 *[[Wikipedia:ro:Olteni&#355;a]]
5045 !! result
5046 <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>
5047 </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>
5048 </li></ul>
5049
5050 !! end
5051
5052 !! test
5053 Interwiki link with fragment (bug 2130)
5054 !! input
5055 [[MeatBall:SoftSecurity#foo]]
5056 !! result
5057 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
5058 </p>
5059 !! end
5060
5061 !! test
5062 Interlanguage link
5063 !! input
5064 Blah blah blah
5065 [[zh:Chinese]]
5066 !!result
5067 <p>Blah blah blah
5068 </p>
5069 !! end
5070
5071 !! test
5072 Double interlanguage link
5073 !! input
5074 Blah blah blah
5075 [[es:Spanish]]
5076 [[zh:Chinese]]
5077 !!result
5078 <p>Blah blah blah
5079 </p>
5080 !! end
5081
5082 !! test
5083 Interlanguage link, with prefix links
5084 !! options
5085 language=ln
5086 !! input
5087 Blah blah blah
5088 [[zh:Chinese]]
5089 !!result
5090 <p>Blah blah blah
5091 </p>
5092 !! end
5093
5094 !! test
5095 Double interlanguage link, with prefix links (bug 8897)
5096 !! options
5097 language=ln
5098 !! input
5099 Blah blah blah
5100 [[es:Spanish]]
5101 [[zh:Chinese]]
5102 !!result
5103 <p>Blah blah blah
5104 </p>
5105 !! end
5106
5107 !! test
5108 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
5109 !! options
5110 language=ln
5111 !! input
5112 [[WW&nbsp;II]]
5113 !!result
5114 <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>
5115 </p>
5116 !! end
5117
5118 !! test
5119 Parsoid: handle constructor well
5120 !! options
5121 parsoid
5122 !! input
5123 [[constructor]]
5124
5125 [[constructor:foo]]
5126 !! result
5127 <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>
5128
5129
5130 <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>
5131 !! end
5132
5133 ##
5134 ## Redirects, Parsoid-only
5135 ##
5136 !! test
5137 Simple redirect to page
5138 !! options
5139 parsoid
5140 !! input
5141 #REDIRECT [[Main Page]]
5142 !! result
5143 <link rel="mw:PageProp/redirect" href="./Main_Page">
5144 !! end
5145
5146 !! test
5147 Optional colon in #REDIRECT
5148 !! options
5149 # the colon is archaic syntax. we support it for wt2html, but we
5150 # don't care that it roundtrips back to the modern syntax.
5151 parsoid=wt2html,html2html
5152 !! input
5153 #REDIRECT:[[Main Page]]
5154 !! result
5155 <link rel="mw:PageProp/redirect" href="./Main_Page">
5156 !! end
5157
5158 !! test
5159 Whitespace in #REDIRECT with optional colon
5160 !! options
5161 # the colon and gratuitous whitespace is archaic syntax. we support
5162 # it for wt2html, but we don't care that it roundtrips back to the
5163 # modern syntax (without extra whitespace)
5164 parsoid=wt2html,html2html
5165 !! input
5166
5167 #REDIRECT
5168 :
5169 [[Main Page]]
5170 !! result
5171 <link rel="mw:PageProp/redirect" href="./Main_Page">
5172 !! end
5173
5174 !! test
5175 Piped link in #REDIRECT
5176 !! options
5177 # content after piped link is ignored. we support this syntax,
5178 # but don't care that the piped link is lost when we roundtrip this.
5179 parsoid=wt2html
5180 !! input
5181 #REDIRECT [[Main Page|bar]]
5182 !! result
5183 <link rel="mw:PageProp/redirect" href="./Main_Page">
5184 !! end
5185
5186 !! test
5187 Redirect to category
5188 !! options
5189 parsoid=wt2html
5190 !! input
5191 #REDIRECT [[Category:Foo]]
5192 !! result
5193 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
5194 !! end
5195
5196 !! test
5197 Redirect to category with URL encoding
5198 !! options
5199 parsoid=wt2html
5200 !! input
5201 #REDIRECT [[Category%3AFoo]]
5202 !! result
5203 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
5204 !! end
5205
5206 !! test
5207 Redirect to category page
5208 !! options
5209 parsoid=wt2html,html2html
5210 !! input
5211 #REDIRECT [[:Category:Foo]]
5212 !! result
5213 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
5214 !! end
5215
5216 !! test
5217 Redirect to image page (1)
5218 !! options
5219 parsoid
5220 !! input
5221 #REDIRECT [[File:Wiki.png]]
5222 !! result
5223 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5224 !! end
5225
5226 !! test
5227 Redirect to image page (2)
5228 !! options
5229 parsoid
5230 !! input
5231 #REDIRECT [[Image:Wiki.png]]
5232 !! result
5233 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5234 !! end
5235
5236 !! test
5237 Redirect to language
5238 !! options
5239 parsoid
5240 !! input
5241 #REDIRECT [[en:File:Wiki.png]]
5242 !! result
5243 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5244 !! end
5245
5246 !! test
5247 Redirect to interwiki
5248 !! options
5249 parsoid
5250 !! input
5251 #REDIRECT [[meatball:File:Wiki.png]]
5252 !! result
5253 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5254 !! end
5255
5256 !! test
5257 Non-English #REDIRECT
5258 !! options
5259 parsoid
5260 language=is
5261 !! input
5262 #TILVÍSUN [[Main Page]]
5263 !! result
5264 <link rel="mw:PageProp/redirect" href="./Main_Page">
5265 !! end
5266
5267 ##
5268 ## XHTML tidiness
5269 ###
5270
5271 !! test
5272 <br> to <br />
5273 !! input
5274 1<br>2<br />3
5275 !! result
5276 <p>1<br />2<br />3
5277 </p>
5278 !! end
5279
5280 !! test
5281 Broken br tag sanitization
5282 !! options
5283 php
5284 !! input
5285 </br>
5286 !! result
5287 <p>&lt;/br&gt;
5288 </p>
5289 !! end
5290
5291 # TODO: Fix html2html mode (bug 51055)!
5292 !! test
5293 Parsoid: Broken br tag recognition
5294 !! options
5295 parsoid=wt2html
5296 !! input
5297 </br>
5298 !! result
5299 <p><br></p>
5300 !! end
5301
5302 !! test
5303 Incorrecly removing closing slashes from correctly formed XHTML
5304 !! input
5305 <br style="clear:both;" />
5306 !! result
5307 <p><br style="clear:both;" />
5308 </p>
5309 !! end
5310
5311 !! test
5312 Failing to transform badly formed HTML into correct XHTML
5313 !! input
5314 <br style="clear: left;">
5315 <br style="clear: right;">
5316 <br style="clear: both;">
5317 !! result
5318 <p><br style="clear: left;" />
5319 <br style="clear: right;" />
5320 <br style="clear: both;" />
5321 </p>
5322 !!end
5323
5324 !! test
5325 Handling html with a div self-closing tag
5326 !! input
5327 <div title />
5328 <div title/>
5329 <div title/ >
5330 <div title=bar />
5331 <div title=bar/>
5332 <div title=bar/ >
5333 !! result
5334 <p>&lt;div title /&gt;
5335 &lt;div title/&gt;
5336 </p>
5337 <div>
5338 <p>&lt;div title=bar /&gt;
5339 &lt;div title=bar/&gt;
5340 </p>
5341 <div title="bar/"></div>
5342 </div>
5343
5344 !! end
5345
5346 !! test
5347 Handling html with a br self-closing tag
5348 !! input
5349 <br title />
5350 <br title/>
5351 <br title/ >
5352 <br title=bar />
5353 <br title=bar/>
5354 <br title=bar/ >
5355 !! result
5356 <p><br title="title" />
5357 <br title="title" />
5358 <br />
5359 <br title="bar" />
5360 <br title="bar" />
5361 <br title="bar/" />
5362 </p>
5363 !! end
5364
5365 !! test
5366 Horizontal ruler (should it add that extra space?)
5367 !! input
5368 <hr>
5369 <hr >
5370 foo <hr
5371 > bar
5372 !! result
5373 <hr />
5374 <hr />
5375 foo <hr /> bar
5376
5377 !! end
5378
5379 !! test
5380 Horizontal ruler -- 4+ dashes render hr
5381 !! input
5382 ----
5383 !! result
5384 <hr />
5385
5386 !! end
5387
5388 !! test
5389 Horizontal ruler -- eats additional dashes on the same line
5390 !! input
5391 ---------
5392 !! result
5393 <hr />
5394
5395 !! end
5396
5397 !! test
5398 Horizontal ruler -- does not collapse dashes on consecutive lines
5399 !! input
5400 ----
5401 ----
5402 !! result
5403 <hr />
5404 <hr />
5405
5406 !! end
5407
5408 !! test
5409 Horizontal ruler -- <4 dashes render as plain text
5410 !! input
5411 ---
5412 !! result
5413 <p>---
5414 </p>
5415 !! end
5416
5417 !! test
5418 Horizontal ruler -- Supports content following dashes on same line
5419 !! input
5420 ---- Foo
5421 !! result
5422 <hr /> Foo
5423
5424 !! end
5425
5426 ###
5427 ### Block-level elements
5428 ###
5429 !! test
5430 Common list
5431 !! input
5432 *Common list
5433 * item 2
5434 *item 3
5435 !! result
5436 <ul><li>Common list
5437 </li><li> item 2
5438 </li><li>item 3
5439 </li></ul>
5440
5441 !! end
5442
5443 !! test
5444 Numbered list
5445 !! input
5446 #Numbered list
5447 #item 2
5448 # item 3
5449 !! result
5450 <ol><li>Numbered list
5451 </li><li>item 2
5452 </li><li> item 3
5453 </li></ol>
5454
5455 !! end
5456
5457 !! test
5458 Mixed list
5459 !! input
5460 *Mixed list
5461 *# with numbers
5462 ** and bullets
5463 *# and numbers
5464 *bullets again
5465 **bullet level 2
5466 ***bullet level 3
5467 ***#Number on level 4
5468 **bullet level 2
5469 **#Number on level 3
5470 **#Number on level 3
5471 *#number level 2
5472 *Level 1
5473 *** Level 3
5474 #** Level 3, but ordered
5475 !! result
5476 <ul><li>Mixed list
5477 <ol><li> with numbers
5478 </li></ol>
5479 <ul><li> and bullets
5480 </li></ul>
5481 <ol><li> and numbers
5482 </li></ol>
5483 </li><li>bullets again
5484 <ul><li>bullet level 2
5485 <ul><li>bullet level 3
5486 <ol><li>Number on level 4
5487 </li></ol>
5488 </li></ul>
5489 </li><li>bullet level 2
5490 <ol><li>Number on level 3
5491 </li><li>Number on level 3
5492 </li></ol>
5493 </li></ul>
5494 <ol><li>number level 2
5495 </li></ol>
5496 </li><li>Level 1
5497 <ul><li><ul><li> Level 3
5498 </li></ul>
5499 </li></ul>
5500 </li></ul>
5501 <ol><li><ul><li><ul><li> Level 3, but ordered
5502 </li></ul>
5503 </li></ul>
5504 </li></ol>
5505
5506 !! end
5507
5508 !! test
5509 Nested lists 1
5510 !! input
5511 *foo
5512 **bar
5513 !! result
5514 <ul><li>foo
5515 <ul><li>bar
5516 </li></ul>
5517 </li></ul>
5518
5519 !! end
5520
5521 !! test
5522 Nested lists 2
5523 !! input
5524 **foo
5525 *bar
5526 !! result
5527 <ul><li><ul><li>foo
5528 </li></ul>
5529 </li><li>bar
5530 </li></ul>
5531
5532 !! end
5533
5534 !! test
5535 Nested lists 3 (first element empty)
5536 !! input
5537 *
5538 **bar
5539 !! result
5540 <ul><li>
5541 <ul><li>bar
5542 </li></ul>
5543 </li></ul>
5544
5545 !! end
5546
5547 !! test
5548 Nested lists 4 (first element empty)
5549 !! input
5550 **
5551 *bar
5552 !! result
5553 <ul><li><ul><li>
5554 </li></ul>
5555 </li><li>bar
5556 </li></ul>
5557
5558 !! end
5559
5560 !! test
5561 Nested lists 5 (both elements empty)
5562 !! input
5563 **
5564 *
5565 !! result
5566 <ul><li><ul><li>
5567 </li></ul>
5568 </li><li>
5569 </li></ul>
5570
5571 !! end
5572
5573 !! test
5574 Nested lists 6 (both elements empty)
5575 !! input
5576 *
5577 **
5578 !! result
5579 <ul><li>
5580 <ul><li>
5581 </li></ul>
5582 </li></ul>
5583
5584 !! end
5585
5586 !! test
5587 Nested lists 7 (skip initial nesting levels)
5588 !! input
5589 *** foo
5590 !! result
5591 <ul><li><ul><li><ul><li> foo
5592 </li></ul>
5593 </li></ul>
5594 </li></ul>
5595
5596 !! end
5597
5598 !! test
5599 Nested lists 8 (multiple nesting transitions)
5600 !! input
5601 * foo
5602 *** bar
5603 ** baz
5604 * boo
5605 !! result
5606 <ul><li> foo
5607 <ul><li><ul><li> bar
5608 </li></ul>
5609 </li><li> baz
5610 </li></ul>
5611 </li><li> boo
5612 </li></ul>
5613
5614 !! end
5615
5616 !! test
5617 1. Lists with start-of-line-transparent tokens before bullets: Comments
5618 !! input
5619 *foo
5620 *<!--cmt-->bar
5621 <!--cmt-->*baz
5622 !! result
5623 <ul><li>foo
5624 </li><li>bar
5625 </li><li>baz
5626 </li></ul>
5627
5628 !! end
5629
5630 !! test
5631 2. Lists with start-of-line-transparent tokens before bullets: Template close
5632 !! input
5633 *foo {{echo|bar
5634 }}*baz
5635 !! result
5636 <ul><li>foo bar
5637 </li><li>baz
5638 </li></ul>
5639
5640 !! end
5641
5642 !! test
5643 List items are not parsed correctly following a <pre> block (bug 785)
5644 !! input
5645 * <pre>foo</pre>
5646 * <pre>bar</pre>
5647 * zar
5648 !! result
5649 <ul><li> <pre>foo</pre>
5650 </li><li> <pre>bar</pre>
5651 </li><li> zar
5652 </li></ul>
5653
5654 !! end
5655
5656 !! test
5657 List items from template
5658 !! input
5659
5660 {{inner list}}
5661 * item 2
5662
5663 * item 0
5664 {{inner list}}
5665 * item 2
5666
5667 * item 0
5668 * notSOL{{inner list}}
5669 * item 2
5670 !! result
5671 <ul><li> item 1
5672 </li><li> item 2
5673 </li></ul>
5674 <ul><li> item 0
5675 </li><li> item 1
5676 </li><li> item 2
5677 </li></ul>
5678 <ul><li> item 0
5679 </li><li> notSOL
5680 </li><li> item 1
5681 </li><li> item 2
5682 </li></ul>
5683
5684 !! end
5685
5686 !! test
5687 List interrupted by empty line or heading
5688 !! input
5689 * foo
5690
5691 ** bar
5692 == A heading ==
5693 * Another list item
5694 !! result
5695 <ul><li> foo
5696 </li></ul>
5697 <ul><li><ul><li> bar
5698 </li></ul>
5699 </li></ul>
5700 <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>
5701 <ul><li> Another list item
5702 </li></ul>
5703
5704 !!end
5705
5706 !!test
5707 Multiple list tags generated by templates
5708 !!input
5709 {{echo|<li>}}a
5710 {{echo|<li>}}b
5711 {{echo|<li>}}c
5712 !!result
5713 <li>a
5714 <li>b
5715 <li>c</li>
5716 </li>
5717 </li>
5718
5719 !!end
5720
5721 !!test
5722 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
5723 !!input
5724 *a
5725 <!--This line will NOT split the list-->
5726 *b
5727 <!--This line will NOT split the list either-->
5728 *c
5729 <!--foo--> <!----> <!--This line NOT split the list either-->
5730 *d
5731 !!result
5732 <ul><li>a
5733 </li><li>b
5734 </li><li>c
5735 </li><li>d
5736 </li></ul>
5737
5738 !!end
5739
5740 !!test
5741 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
5742 !!input
5743 *a
5744 <!--This line will NOT split the list-->
5745 *b
5746 <!--This line will NOT split the list either-->
5747 *c
5748 <!--foo--> <!----> <!--This line NOT split the list
5749 either-->
5750 *d
5751 !!result
5752 <ul><li>a
5753 </li><li>b
5754 </li><li>c
5755 </li><li>d
5756 </li></ul>
5757
5758 !!end
5759
5760 !!test
5761 Test the li-hack
5762 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5763 !!options
5764 parsoid=wt2html,wt2wt
5765 !!input
5766 * foo
5767 * <li>li-hack
5768 * {{echo|<li>templated li-hack}}
5769 * <!--foo--> <li> unsupported li-hack with preceding comments
5770
5771 <ul>
5772 <li><li>not a li-hack
5773 </li>
5774 </ul>
5775 !!result
5776 <ul><li> foo</li>
5777 <li>li-hack</li>
5778 <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>
5779 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5780
5781 <ul>
5782 <li></li><li>not a li-hack
5783 </li>
5784 </ul>
5785 !!end
5786
5787 !! test
5788 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5789 !! options
5790 parsoid
5791 !! input
5792 # foo
5793 ## bar
5794 * foo
5795 ** bar
5796 : foo
5797 :: bar
5798 !! result
5799 <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>
5800 !! end
5801
5802 !! test
5803 Parsoid: Test of whitespace serialization with Templated bullets
5804 !! options
5805 parsoid
5806 !! input
5807 * {{bullet}}
5808 !! result
5809 <ul>
5810 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}'> Bar</li>
5811 </ul>
5812 !! end
5813
5814 # ------------------------------------------------------------------------
5815 # The next set of tests are about Parsoid's ability to handle badly nested
5816 # tags (parse, minimize scope of fixup, and roundtrip back)
5817 # ------------------------------------------------------------------------
5818
5819 !! test
5820 Unbalanced closing block tags break a list
5821 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5822 !! options
5823 parsoid
5824 !! input
5825 <div>
5826 *a</div><div>
5827 *b</div>
5828 !! result
5829 <div>
5830 <ul><li>a
5831 </li></ul></div><div>
5832 <ul><li>b
5833 </li></ul></div>
5834 !! end
5835
5836 !! test
5837 Unbalanced closing non-block tags don't break a list
5838 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5839 !! options
5840 parsoid
5841 !! input
5842 <span>
5843 *a</span><span>
5844 *b</span>
5845 !! result
5846 <p><span></span>
5847 </p>
5848 <ul><li>a<span></span>
5849 </li><li>b
5850 </li></ul>
5851 !! end
5852
5853 !! test
5854 Unclosed formatting tags that straddle lists are closed and reopened
5855 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5856 !! options
5857 parsoid
5858 !! input
5859 # <s> a
5860 # b </s>
5861 !! result
5862 <ol><li> <s> a </s>
5863 </li><li> <s> b </s>
5864 </li></ol>
5865 !! end
5866
5867 !!test
5868 List embedded in a non-block tag
5869 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5870 !! options
5871 parsoid
5872 !!input
5873 <small>
5874 * foo
5875 </small>
5876 !!result
5877 <p><small></small></p>
5878 <small>
5879 <ul>
5880 <li> foo</li>
5881 </ul>
5882 </small>
5883 <p><small></small></p>
5884 !!end
5885
5886 ###
5887 ### Magic Words
5888 ###
5889
5890 # Note that the current date is hard-coded as
5891 # 1970-01-01T00:02:03Z (a Thursday)
5892 # when running parser tests. The timezone is also fixed to GMT, so
5893 # local date will be identical to current date.
5894
5895 !! test
5896 Magic Word: {{CURRENTDAY}}
5897 !! input
5898 {{CURRENTDAY}}
5899 !! result
5900 <p>1
5901 </p>
5902 !! end
5903
5904 !! test
5905 Magic Word: {{CURRENTDAY2}}
5906 !! input
5907 {{CURRENTDAY2}}
5908 !! result
5909 <p>01
5910 </p>
5911 !! end
5912
5913 !! test
5914 Magic Word: {{CURRENTDAYNAME}}
5915 !! input
5916 {{CURRENTDAYNAME}}
5917 !! result
5918 <p>Thursday
5919 </p>
5920 !! end
5921
5922 !! test
5923 Magic Word: {{CURRENTDOW}}
5924 !! input
5925 {{CURRENTDOW}}
5926 !! result
5927 <p>4
5928 </p>
5929 !! end
5930
5931 !! test
5932 Magic Word: {{CURRENTMONTH}}
5933 !! input
5934 {{CURRENTMONTH}}
5935 !! result
5936 <p>01
5937 </p>
5938 !! end
5939
5940 !! test
5941 Magic Word: {{CURRENTMONTH1}}
5942 !! input
5943 {{CURRENTMONTH1}}
5944 !! result
5945 <p>1
5946 </p>
5947 !! end
5948
5949 !! test
5950 Magic Word: {{CURRENTMONTHABBREV}}
5951 !! input
5952 {{CURRENTMONTHABBREV}}
5953 !! result
5954 <p>Jan
5955 </p>
5956 !! end
5957
5958 !! test
5959 Magic Word: {{CURRENTMONTHNAME}}
5960 !! input
5961 {{CURRENTMONTHNAME}}
5962 !! result
5963 <p>January
5964 </p>
5965 !! end
5966
5967 !! test
5968 Magic Word: {{CURRENTMONTHNAMEGEN}}
5969 !! input
5970 {{CURRENTMONTHNAMEGEN}}
5971 !! result
5972 <p>January
5973 </p>
5974 !! end
5975
5976 !! test
5977 Magic Word: {{CURRENTTIME}}
5978 !! input
5979 {{CURRENTTIME}}
5980 !! result
5981 <p>00:02
5982 </p>
5983 !! end
5984
5985 !! test
5986 Magic Word: {{CURRENTHOUR}}
5987 !! input
5988 {{CURRENTHOUR}}
5989 !! result
5990 <p>00
5991 </p>
5992 !! end
5993
5994 !! test
5995 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5996 !! input
5997 {{CURRENTWEEK}}
5998 !! result
5999 <p>1
6000 </p>
6001 !! end
6002
6003 !! test
6004 Magic Word: {{CURRENTYEAR}}
6005 !! input
6006 {{CURRENTYEAR}}
6007 !! result
6008 <p>1970
6009 </p>
6010 !! end
6011
6012 !! test
6013 Magic Word: {{CURRENTTIMESTAMP}}
6014 !! input
6015 {{CURRENTTIMESTAMP}}
6016 !! result
6017 <p>19700101000203
6018 </p>
6019 !! end
6020
6021 !! test
6022 Magic Words LOCAL (UTC)
6023 !! input
6024 * {{LOCALMONTH}}
6025 * {{LOCALMONTH1}}
6026 * {{LOCALMONTHNAME}}
6027 * {{LOCALMONTHNAMEGEN}}
6028 * {{LOCALMONTHABBREV}}
6029 * {{LOCALDAY}}
6030 * {{LOCALDAY2}}
6031 * {{LOCALDAYNAME}}
6032 * {{LOCALYEAR}}
6033 * {{LOCALTIME}}
6034 * {{LOCALHOUR}}
6035 * {{LOCALWEEK}}
6036 * {{LOCALDOW}}
6037 * {{LOCALTIMESTAMP}}
6038 !! result
6039 <ul><li> 01
6040 </li><li> 1
6041 </li><li> January
6042 </li><li> January
6043 </li><li> Jan
6044 </li><li> 1
6045 </li><li> 01
6046 </li><li> Thursday
6047 </li><li> 1970
6048 </li><li> 00:02
6049 </li><li> 00
6050 </li><li> 1
6051 </li><li> 4
6052 </li><li> 19700101000203
6053 </li></ul>
6054
6055 !! end
6056
6057 !! test
6058 Magic Word: {{FULLPAGENAME}}
6059 !! options
6060 title=[[User:Ævar Arnfjörð Bjarmason]]
6061 !! input
6062 {{FULLPAGENAME}}
6063 !! result
6064 <p>User:Ævar Arnfjörð Bjarmason
6065 </p>
6066 !! end
6067
6068 !! test
6069 Magic Word: {{FULLPAGENAMEE}}
6070 !! options
6071 title=[[User:Ævar Arnfjörð Bjarmason]]
6072 !! input
6073 {{FULLPAGENAMEE}}
6074 !! result
6075 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6076 </p>
6077 !! end
6078
6079 !! test
6080 Magic Word: {{TALKSPACE}}
6081 !! options
6082 title=[[User:Ævar Arnfjörð Bjarmason]]
6083 !! input
6084 {{TALKSPACE}}
6085 !! result
6086 <p>User talk
6087 </p>
6088 !! end
6089
6090 !! test
6091 Magic Word: {{TALKSPACE}}, same namespace
6092 !! options
6093 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6094 !! input
6095 {{TALKSPACE}}
6096 !! result
6097 <p>User talk
6098 </p>
6099 !! end
6100
6101 !! test
6102 Magic Word: {{TALKSPACE}}, main namespace
6103 !! options
6104 title=[[Parser Test]]
6105 !! input
6106 {{TALKSPACE}}
6107 !! result
6108 <p>Talk
6109 </p>
6110 !! end
6111
6112 !! test
6113 Magic Word: {{TALKSPACEE}}
6114 !! options
6115 title=[[User:Ævar Arnfjörð Bjarmason]]
6116 !! input
6117 {{TALKSPACEE}}
6118 !! result
6119 <p>User_talk
6120 </p>
6121 !! end
6122
6123 !! test
6124 Magic Word: {{SUBJECTSPACE}}
6125 !! options
6126 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6127 !! input
6128 {{SUBJECTSPACE}}
6129 !! result
6130 <p>User
6131 </p>
6132 !! end
6133
6134 !! test
6135 Magic Word: {{SUBJECTSPACE}}, same namespace
6136 !! options
6137 title=[[User:Ævar Arnfjörð Bjarmason]]
6138 !! input
6139 {{SUBJECTSPACE}}
6140 !! result
6141 <p>User
6142 </p>
6143 !! end
6144
6145 !! test
6146 Magic Word: {{SUBJECTSPACE}}, main namespace
6147 !! options
6148 title=[[Parser Test]]
6149 !! input
6150 {{SUBJECTSPACE}}
6151 !! result
6152
6153 !! end
6154
6155 !! test
6156 Magic Word: {{SUBJECTSPACEE}}
6157 !! options
6158 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6159 !! input
6160 {{SUBJECTSPACEE}}
6161 !! result
6162 <p>User
6163 </p>
6164 !! end
6165
6166 !! test
6167 Magic Word: {{NAMESPACE}}
6168 !! options
6169 title=[[User:Ævar Arnfjörð Bjarmason]]
6170 !! input
6171 {{NAMESPACE}}
6172 !! result
6173 <p>User
6174 </p>
6175 !! end
6176
6177 !! test
6178 Magic Word: {{NAMESPACEE}}
6179 !! options
6180 title=[[User:Ævar Arnfjörð Bjarmason]]
6181 !! input
6182 {{NAMESPACEE}}
6183 !! result
6184 <p>User
6185 </p>
6186 !! end
6187
6188 !! test
6189 Magic Word: {{NAMESPACENUMBER}}
6190 !! options
6191 title=[[User:Ævar Arnfjörð Bjarmason]]
6192 !! input
6193 {{NAMESPACENUMBER}}
6194 !! result
6195 <p>2
6196 </p>
6197 !! end
6198
6199 !! test
6200 Magic Word: {{SUBPAGENAME}}
6201 !! options
6202 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6203 !! input
6204 {{SUBPAGENAME}}
6205 !! result
6206 <p>sub ö
6207 </p>
6208 !! end
6209
6210 !! test
6211 Magic Word: {{SUBPAGENAMEE}}
6212 !! options
6213 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6214 !! input
6215 {{SUBPAGENAMEE}}
6216 !! result
6217 <p>sub_%C3%B6
6218 </p>
6219 !! end
6220
6221 !! test
6222 Magic Word: {{ROOTPAGENAME}}
6223 !! options
6224 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6225 !! input
6226 {{ROOTPAGENAME}}
6227 !! result
6228 <p>Ævar Arnfjörð Bjarmason
6229 </p>
6230 !! end
6231
6232 !! test
6233 Magic Word: {{ROOTPAGENAMEE}}
6234 !! options
6235 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6236 !! input
6237 {{ROOTPAGENAMEE}}
6238 !! result
6239 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6240 </p>
6241 !! end
6242
6243 !! test
6244 Magic Word: {{BASEPAGENAME}}
6245 !! options
6246 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6247 !! input
6248 {{BASEPAGENAME}}
6249 !! result
6250 <p>Ævar Arnfjörð Bjarmason
6251 </p>
6252 !! end
6253
6254 !! test
6255 Magic Word: {{BASEPAGENAMEE}}
6256 !! options
6257 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6258 !! input
6259 {{BASEPAGENAMEE}}
6260 !! result
6261 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6262 </p>
6263 !! end
6264
6265 !! test
6266 Magic Word: {{TALKPAGENAME}}
6267 !! options
6268 title=[[User:Ævar Arnfjörð Bjarmason]]
6269 !! input
6270 {{TALKPAGENAME}}
6271 !! result
6272 <p>User talk:Ævar Arnfjörð Bjarmason
6273 </p>
6274 !! end
6275
6276 !! test
6277 Magic Word: {{TALKPAGENAMEE}}
6278 !! options
6279 title=[[User:Ævar Arnfjörð Bjarmason]]
6280 !! input
6281 {{TALKPAGENAMEE}}
6282 !! result
6283 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6284 </p>
6285 !! end
6286
6287 !! test
6288 Magic Word: {{SUBJECTPAGENAME}}
6289 !! options
6290 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6291 !! input
6292 {{SUBJECTPAGENAME}}
6293 !! result
6294 <p>User:Ævar Arnfjörð Bjarmason
6295 </p>
6296 !! end
6297
6298 !! test
6299 Magic Word: {{SUBJECTPAGENAMEE}}
6300 !! options
6301 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6302 !! input
6303 {{SUBJECTPAGENAMEE}}
6304 !! result
6305 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6306 </p>
6307 !! end
6308
6309 !! test
6310 Magic Word: {{NUMBEROFFILES}}
6311 !! input
6312 {{NUMBEROFFILES}}
6313 !! result
6314 <p>4
6315 </p>
6316 !! end
6317
6318 !! test
6319 Magic Word: {{PAGENAME}}
6320 !! options
6321 title=[[User:Ævar Arnfjörð Bjarmason]]
6322 !! input
6323 {{PAGENAME}}
6324 !! result
6325 <p>Ævar Arnfjörð Bjarmason
6326 </p>
6327 !! end
6328
6329 !! test
6330 Magic Word: {{PAGENAME}} with metacharacters
6331 !! options
6332 title=[['foo & bar = baz']]
6333 !! input
6334 ''{{PAGENAME}}''
6335 !! result
6336 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
6337 </p>
6338 !! end
6339
6340 !! test
6341 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
6342 !! options
6343 title=[[*RFC 1234 http://example.com/]]
6344 !! input
6345 {{PAGENAME}}
6346 !! result
6347 <p>&#42;RFC&#32;1234 http&#58;//example.com/
6348 </p>
6349 !! end
6350
6351 !! test
6352 Magic Word: {{PAGENAMEE}}
6353 !! options
6354 title=[[User:Ævar Arnfjörð Bjarmason]]
6355 !! input
6356 {{PAGENAMEE}}
6357 !! result
6358 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6359 </p>
6360 !! end
6361
6362 !! test
6363 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
6364 !! options
6365 title=[[*RFC 1234 http://example.com/]]
6366 !! input
6367 {{PAGENAMEE}}
6368 !! result
6369 <p>&#42;RFC_1234_http&#58;//example.com/
6370 </p>
6371 !! end
6372
6373 !! test
6374 Magic Word: {{REVISIONID}}
6375 !! input
6376 {{REVISIONID}}
6377 !! result
6378 <p>1337
6379 </p>
6380 !! end
6381
6382 !! test
6383 Magic Word: {{SCRIPTPATH}}
6384 !! input
6385 {{SCRIPTPATH}}
6386 !! result
6387 <p>/
6388 </p>
6389 !! end
6390
6391 !! test
6392 Magic Word: {{STYLEPATH}}
6393 !! input
6394 {{STYLEPATH}}
6395 !! result
6396 <p>/skins
6397 </p>
6398 !! end
6399
6400 !! test
6401 Magic Word: {{SERVER}}
6402 !! input
6403 {{SERVER}}
6404 !! result
6405 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6406 </p>
6407 !! end
6408
6409 !! test
6410 Magic Word: {{SERVERNAME}}
6411 !! input
6412 {{SERVERNAME}}
6413 !! result
6414 <p>example.org
6415 </p>
6416 !! end
6417
6418 !! test
6419 Magic Word: {{SITENAME}}
6420 !! input
6421 {{SITENAME}}
6422 !! result
6423 <p>MediaWiki
6424 </p>
6425 !! end
6426
6427 !! test
6428 Case-sensitive magic words, when cased differently, should just be template transclusions
6429 !! input
6430 {{CurrentMonth}}
6431 {{currentday}}
6432 {{cURreNTweEK}}
6433 {{currentHour}}
6434 !! result
6435 <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>
6436 <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>
6437 <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>
6438 <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>
6439 </p>
6440 !! end
6441
6442 !! test
6443 Case-insensitive magic words should still work with weird casing.
6444 !! input
6445 {{sErVeRNaMe}}
6446 {{LCFirst:AOEU}}
6447 {{ucFIRST:aoeu}}
6448 {{SERver}}
6449 !! result
6450 <p>example.org
6451 aOEU
6452 Aoeu
6453 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6454 </p>
6455 !! end
6456
6457 !! test
6458 Namespace 1 {{ns:1}}
6459 !! input
6460 {{ns:1}}
6461 !! result
6462 <p>Talk
6463 </p>
6464 !! end
6465
6466 !! test
6467 Namespace 1 {{ns:01}}
6468 !! input
6469 {{ns:01}}
6470 !! result
6471 <p>Talk
6472 </p>
6473 !! end
6474
6475 !! test
6476 Namespace 0 {{ns:0}} (bug 4783)
6477 !! input
6478 {{ns:0}}
6479 !! result
6480
6481 !! end
6482
6483 !! test
6484 Namespace 0 {{ns:00}} (bug 4783)
6485 !! input
6486 {{ns:00}}
6487 !! result
6488
6489 !! end
6490
6491 !! test
6492 Namespace -1 {{ns:-1}}
6493 !! input
6494 {{ns:-1}}
6495 !! result
6496 <p>Special
6497 </p>
6498 !! end
6499
6500 !! test
6501 Namespace User {{ns:User}}
6502 !! input
6503 {{ns:User}}
6504 !! result
6505 <p>User
6506 </p>
6507 !! end
6508
6509 !! test
6510 Namespace User talk {{ns:User_talk}}
6511 !! input
6512 {{ns:User_talk}}
6513 !! result
6514 <p>User talk
6515 </p>
6516 !! end
6517
6518 !! test
6519 Namespace User talk {{ns:uSeR tAlK}}
6520 !! input
6521 {{ns:uSeR tAlK}}
6522 !! result
6523 <p>User talk
6524 </p>
6525 !! end
6526
6527 !! test
6528 Namespace File {{ns:File}}
6529 !! input
6530 {{ns:File}}
6531 !! result
6532 <p>File
6533 </p>
6534 !! end
6535
6536 !! test
6537 Namespace File {{ns:Image}}
6538 !! input
6539 {{ns:Image}}
6540 !! result
6541 <p>File
6542 </p>
6543 !! end
6544
6545 !! test
6546 Namespace (lang=de) Benutzer {{ns:User}}
6547 !! options
6548 language=de
6549 !! input
6550 {{ns:User}}
6551 !! result
6552 <p>Benutzer
6553 </p>
6554 !! end
6555
6556 !! test
6557 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
6558 !! options
6559 language=de
6560 !! input
6561 {{ns:3}}
6562 !! result
6563 <p>Benutzer Diskussion
6564 </p>
6565 !! end
6566
6567
6568 !! test
6569 Urlencode
6570 !! input
6571 {{urlencode:hi world?!}}
6572 {{urlencode:hi world?!|WIKI}}
6573 {{urlencode:hi world?!|PATH}}
6574 {{urlencode:hi world?!|QUERY}}
6575 !! result
6576 <p>hi+world%3F%21
6577 hi_world%3F!
6578 hi%20world%3F%21
6579 hi+world%3F%21
6580 </p>
6581 !! end
6582
6583 ###
6584 ### Magic links
6585 ###
6586 !! test
6587 Magic links: internal link to RFC (bug 479)
6588 !! input
6589 [[RFC 123]]
6590 !! result
6591 <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>
6592 </p>
6593 !! end
6594
6595 !! test
6596 Magic links: RFC (bug 479)
6597 !! input
6598 RFC 822
6599 !! result
6600 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
6601 </p>
6602 !! end
6603
6604 !! test
6605 Magic links: ISBN (bug 1937)
6606 !! input
6607 ISBN 0-306-40615-2
6608 !! result
6609 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
6610 </p>
6611 !! end
6612
6613 !! test
6614 Magic links: PMID incorrectly converts space to underscore
6615 !! input
6616 PMID 1234
6617 !! result
6618 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
6619 </p>
6620 !! end
6621
6622 ###
6623 ### Templates
6624 ####
6625
6626 !! test
6627 Nonexistent template
6628 !! input
6629 {{thistemplatedoesnotexist}}
6630 !! result
6631 <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>
6632 </p>
6633 !! end
6634
6635 !! test
6636 Template with invalid target containing tags
6637 !! input
6638 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6639 !! result
6640 <p>{{a<b>b</b>|foo|a=b|a = b}}
6641 </p>
6642 !! end
6643
6644 !! test
6645 Template with invalid target containing unclosed tag
6646 !! input
6647 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6648 !! result
6649 <p>{{a<b>|foo|a=b|a = b}}</b>
6650 </p>
6651 !! end
6652
6653 !! article
6654 Template:test
6655 !! text
6656 This is a test template
6657 !! endarticle
6658
6659 !! test
6660 Simple template
6661 !! input
6662 {{test}}
6663 !! result
6664 <p>This is a test template
6665 </p>
6666 !! end
6667
6668 !! test
6669 Template with explicit namespace
6670 !! input
6671 {{Template:test}}
6672 !! result
6673 <p>This is a test template
6674 </p>
6675 !! end
6676
6677
6678 !! article
6679 Template:paramtest
6680 !! text
6681 This is a test template with parameter {{{param}}}
6682 !! endarticle
6683
6684 !! test
6685 Template parameter
6686 !! input
6687 {{paramtest|param=foo}}
6688 !! result
6689 <p>This is a test template with parameter foo
6690 </p>
6691 !! end
6692
6693 !! article
6694 Template:paramtestnum
6695 !! text
6696 [[{{{1}}}|{{{2}}}]]
6697 !! endarticle
6698
6699 !! test
6700 Template unnamed parameter
6701 !! input
6702 {{paramtestnum|Main Page|the main page}}
6703 !! result
6704 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
6705 </p>
6706 !! end
6707
6708 !! article
6709 Template:templatesimple
6710 !! text
6711 (test)
6712 !! endarticle
6713
6714 !! article
6715 Template:templateredirect
6716 !! text
6717 #redirect [[Template:templatesimple]]
6718 !! endarticle
6719
6720 !! article
6721 Template:templateasargtestnum
6722 !! text
6723 {{{{{1}}}}}
6724 !! endarticle
6725
6726 !! article
6727 Template:templateasargtest
6728 !! text
6729 {{template{{{templ}}}}}
6730 !! endarticle
6731
6732 !! article
6733 Template:templateasargtest2
6734 !! text
6735 {{{{{templ}}}}}
6736 !! endarticle
6737
6738 !! test
6739 Template with template name as unnamed argument
6740 !! input
6741 {{templateasargtestnum|templatesimple}}
6742 !! result
6743 <p>(test)
6744 </p>
6745 !! end
6746
6747 !! test
6748 Template with template name as argument
6749 !! input
6750 {{templateasargtest|templ=simple}}
6751 !! result
6752 <p>(test)
6753 </p>
6754 !! end
6755
6756 !! test
6757 Template with template name as argument (2)
6758 !! input
6759 {{templateasargtest2|templ=templatesimple}}
6760 !! result
6761 <p>(test)
6762 </p>
6763 !! end
6764
6765 !! article
6766 Template:templateasargtestdefault
6767 !! text
6768 {{{{{templ|templatesimple}}}}}
6769 !! endarticle
6770
6771 !! article
6772 Template:templa
6773 !! text
6774 '''templ'''
6775 !! endarticle
6776
6777 !! test
6778 Template with default value
6779 !! input
6780 {{templateasargtestdefault}}
6781 !! result
6782 <p>(test)
6783 </p>
6784 !! end
6785
6786 !! test
6787 Template with default value (value set)
6788 !! input
6789 {{templateasargtestdefault|templ=templa}}
6790 !! result
6791 <p><b>templ</b>
6792 </p>
6793 !! end
6794
6795 !! test
6796 Template redirect
6797 !! input
6798 {{templateredirect}}
6799 !! result
6800 <p>(test)
6801 </p>
6802 !! end
6803
6804 !! test
6805 Template with argument in separate line
6806 !! input
6807 {{ templateasargtest |
6808 templ = simple }}
6809 !! result
6810 <p>(test)
6811 </p>
6812 !! end
6813
6814 !! test
6815 Template with complex template as argument
6816 !! input
6817 {{paramtest|
6818 param ={{ templateasargtest |
6819 templ = simple }}}}
6820 !! result
6821 <p>This is a test template with parameter (test)
6822 </p>
6823 !! end
6824
6825 !! test
6826 Template with thumb image (with link in description)
6827 !! input
6828 {{paramtest|
6829 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6830 !! result
6831 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>
6832
6833 !! end
6834
6835 !! article
6836 Template:complextemplate
6837 !! text
6838 {{{1}}} {{paramtest|
6839 param ={{{param}}}}}
6840 !! endarticle
6841
6842 !! test
6843 Template with complex arguments
6844 !! input
6845 {{complextemplate|
6846 param ={{ templateasargtest |
6847 templ = simple }}|[[Template:complextemplate|link]]}}
6848 !! result
6849 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6850 </p>
6851 !! end
6852
6853 !! test
6854 BUG 553: link with two variables in a piped link
6855 !! input
6856 {|
6857 |[[{{{1}}}|{{{2}}}]]
6858 |}
6859 !! result
6860 <table>
6861 <tr>
6862 <td>[[{{{1}}}|{{{2}}}]]
6863 </td></tr></table>
6864
6865 !! end
6866
6867 !! test
6868 Magic variable as template parameter
6869 !! input
6870 {{paramtest|param={{SITENAME}}}}
6871 !! result
6872 <p>This is a test template with parameter MediaWiki
6873 </p>
6874 !! end
6875
6876 !! article
6877 Template:linktest
6878 !! text
6879 [[{{{param}}}|link]]
6880 !! endarticle
6881
6882 !! test
6883 Template parameter as link source
6884 !! input
6885 {{linktest|param=Main Page}}
6886 !! result
6887 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
6888 </p>
6889 !! end
6890
6891 !!test
6892 Template-generated attribute string (k='v')
6893 !!input
6894 <span {{attr_str|id|v1}}>bar</span>
6895 !!result
6896 <p><span id="v1">bar</span>
6897 </p>
6898 !!end
6899
6900 !!article
6901 Template:paramtest2
6902 !! text
6903 including another template, {{paramtest|param={{{arg}}}}}
6904 !! endarticle
6905
6906 !! test
6907 Template passing argument to another template
6908 !! input
6909 {{paramtest2|arg='hmm'}}
6910 !! result
6911 <p>including another template, This is a test template with parameter 'hmm'
6912 </p>
6913 !! end
6914
6915 !! article
6916 Template:Linktest2
6917 !! text
6918 Main Page
6919 !! endarticle
6920
6921 !! test
6922 Template as link source
6923 !! input
6924 [[{{linktest2}}]]
6925
6926 [[{{linktest2}}|Main Page]]
6927
6928 [[{{linktest2}}]]Page
6929 !! result
6930 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6931 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6932 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
6933 </p>
6934 !! end
6935
6936
6937 !! article
6938 Template:loop1
6939 !! text
6940 {{loop2}}
6941 !! endarticle
6942
6943 !! article
6944 Template:loop2
6945 !! text
6946 {{loop1}}
6947 !! endarticle
6948
6949 !! test
6950 Template infinite loop
6951 !! input
6952 {{loop1}}
6953 !! result
6954 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
6955 </p>
6956 !! end
6957
6958 !! test
6959 Template from main namespace
6960 !! input
6961 {{:Main Page}}
6962 !! result
6963 <p>blah blah
6964 </p>
6965 !! end
6966
6967 !! article
6968 Template:table
6969 !! text
6970 {|
6971 | 1 || 2
6972 |-
6973 | 3 || 4
6974 |}
6975 !! endarticle
6976
6977 !! test
6978 BUG 529: Template with table, not included at beginning of line
6979 !! input
6980 foo {{table}}
6981 !! result
6982 <p>foo
6983 </p>
6984 <table>
6985 <tr>
6986 <td> 1 </td>
6987 <td> 2
6988 </td></tr>
6989 <tr>
6990 <td> 3 </td>
6991 <td> 4
6992 </td></tr></table>
6993
6994 !! end
6995
6996 !! test
6997 BUG 523: Template shouldn't eat newline (or add an extra one before table)
6998 !! input
6999 foo
7000 {{table}}
7001 !! result
7002 <p>foo
7003 </p>
7004 <table>
7005 <tr>
7006 <td> 1 </td>
7007 <td> 2
7008 </td></tr>
7009 <tr>
7010 <td> 3 </td>
7011 <td> 4
7012 </td></tr></table>
7013
7014 !! end
7015
7016 !! test
7017 BUG 41: Template parameters shown as broken links
7018 !! input
7019 {{{parameter}}}
7020 !! result
7021 <p>{{{parameter}}}
7022 </p>
7023 !! end
7024
7025 !! test
7026 Template with targets containing wikilinks
7027 !! input
7028 {{[[foo]]}}
7029
7030 {{[[{{echo|foo}}]]}}
7031
7032 {{{{echo|[[foo}}]]}}
7033 !! result
7034 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7035 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7036 </p><p>{{[[foo}}]]
7037 </p>
7038 !! end
7039
7040 !! article
7041 Template:MSGNW test
7042 !! text
7043 ''None'' of '''this''' should be
7044 * interpreted
7045 but rather passed unmodified
7046 {{test}}
7047 !! endarticle
7048
7049 # hmm, fix this or just deprecate msgnw and document its behavior?
7050 !! test
7051 msgnw keyword
7052 !! options
7053 disabled
7054 !! input
7055 {{msgnw:MSGNW test}}
7056 !! result
7057 <p>''None'' of '''this''' should be
7058 * interpreted
7059 but rather passed unmodified
7060 {{test}}
7061 </p>
7062 !! end
7063
7064 !! test
7065 int keyword
7066 !! input
7067 {{int:youhavenewmessages|lots of money|not!}}
7068 !! result
7069 <p>You have lots of money (not!).
7070 </p>
7071 !! end
7072
7073 !! article
7074 Template:Includes
7075 !! text
7076 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
7077 !! endarticle
7078
7079 !! test
7080 <includeonly> and <noinclude> being included
7081 !! input
7082 {{Includes}}
7083 !! result
7084 <p>Foobar
7085 </p>
7086 !! end
7087
7088 !! article
7089 Template:Includes2
7090 !! text
7091 <onlyinclude>Foo</onlyinclude>bar
7092 !! endarticle
7093
7094 !! test
7095 <onlyinclude> being included
7096 !! input
7097 {{Includes2}}
7098 !! result
7099 <p>Foo
7100 </p>
7101 !! end
7102
7103
7104 !! article
7105 Template:Includes3
7106 !! text
7107 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
7108 !! endarticle
7109
7110 !! test
7111 <onlyinclude> and <includeonly> being included
7112 !! input
7113 {{Includes3}}
7114 !! result
7115 <p>Foo
7116 </p>
7117 !! end
7118
7119 !! test
7120 <includeonly> and <noinclude> on a page
7121 !! input
7122 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
7123 !! result
7124 <p>Foozar
7125 </p>
7126 !! end
7127
7128 !! test
7129 Un-closed <noinclude>
7130 !! input
7131 <noinclude>
7132 !! result
7133 !! end
7134
7135 !! test
7136 <onlyinclude> on a page
7137 !! input
7138 <onlyinclude>Foo</onlyinclude>bar
7139 !! result
7140 <p>Foobar
7141 </p>
7142 !! end
7143
7144 !! test
7145 Un-closed <onlyinclude>
7146 !! input
7147 <onlyinclude>
7148 !! result
7149 !! end
7150
7151 !!test
7152 Self-closed noinclude, includeonly, onlyinclude tags
7153 !!input
7154 <noinclude />
7155 <includeonly />
7156 <onlyinclude />
7157 !!result
7158 <p><br />
7159 </p>
7160 !!end
7161
7162 !!test
7163 Unbalanced includeonly and noinclude tags
7164 !!input
7165 {|
7166 |a</noinclude>
7167 |b</noinclude></noinclude>
7168 |c</noinclude></includeonly>
7169 |d</includeonly></includeonly>
7170 |}
7171 !!result
7172 <table>
7173 <tr>
7174 <td>a
7175 </td>
7176 <td>b
7177 </td>
7178 <td>c&lt;/includeonly&gt;
7179 </td>
7180 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
7181 </td></tr></table>
7182
7183 !!end
7184
7185 !! article
7186 Template:Includeonly section
7187 !! text
7188 <includeonly>
7189 ==Includeonly section==
7190 </includeonly>
7191 ==Section T-1==
7192 !!endarticle
7193
7194 !! test
7195 Bug 6563: Edit link generation for section shown by <includeonly>
7196 !! input
7197 {{includeonly section}}
7198 !! result
7199 <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>
7200 <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>
7201
7202 !! end
7203
7204 # Uses same input as the contents of [[Template:Includeonly section]]
7205 !! test
7206 Bug 6563: Section extraction for section shown by <includeonly>
7207 !! options
7208 section=T-2
7209 !! input
7210 <includeonly>
7211 ==Includeonly section==
7212 </includeonly>
7213 ==Section T-2==
7214 !! result
7215 ==Section T-2==
7216 !! end
7217
7218 !! test
7219 Bug 6563: Edit link generation for section suppressed by <includeonly>
7220 !! input
7221 <includeonly>
7222 ==Includeonly section==
7223 </includeonly>
7224 ==Section 1==
7225 !! result
7226 <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>
7227
7228 !! end
7229
7230 !! test
7231 Bug 6563: Section extraction for section suppressed by <includeonly>
7232 !! options
7233 section=1
7234 !! input
7235 <includeonly>
7236 ==Includeonly section==
7237 </includeonly>
7238 ==Section 1==
7239 !! result
7240 ==Section 1==
7241 !! end
7242
7243 !! test
7244 Un-closed <includeonly>
7245 !! input
7246 <includeonly>
7247 !! result
7248 !! end
7249
7250 # TODO: test with DOM fragment reuse!
7251 !! test
7252 Parsoid: DOM fragment reuse
7253 !! options
7254 parsoid=wt2wt,wt2html
7255 !! input
7256 a{{echo|b<table></table>c}}d
7257
7258 a{{echo|b
7259 <table></table>
7260 c}}d
7261
7262 {{echo|a
7263
7264 <table></table>
7265
7266 b}}
7267 !! result
7268 a<span typeof="mw:Transclusion">b</span>
7269 <table></table><span>c</span>d
7270 <p typeof="mw:Transclusion">ab</p>
7271 <table></table>
7272 <p>cd</p>
7273 <p typeof="mw:Transclusion">a</p>
7274 <table></table>
7275 <p>b</p>
7276 !! end
7277
7278 ###
7279 ### <includeonly> and <noinclude> in attributes
7280 ###
7281 !!test
7282 0. includeonly around the entire attribute
7283 !!input
7284 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
7285 !!result
7286 <p><span id="v2">bar</span>
7287 </p>
7288 !!end
7289
7290 !!test
7291 1. includeonly in html attr key
7292 !!input
7293 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
7294 !!result
7295 <p><span id="foo">bar</span>
7296 </p>
7297 !!end
7298
7299 !!test
7300 2. includeonly in html attr value
7301 !!input
7302 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
7303 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
7304 !!result
7305 <p><span id="v1">bar</span>
7306 <span id="v1">bar</span>
7307 </p>
7308 !!end
7309
7310 !!test
7311 3. includeonly in part of an attr value
7312 !!input
7313 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
7314 !!result
7315 <p><span style="color:red;">bar</span>
7316 </p>
7317 !!end
7318
7319 ###
7320 ### Testing parsing of templates where a template arg
7321 ### has the same name as the template itself.
7322 ###
7323
7324 !! article
7325 Template:quote
7326 !! text
7327 {{{quote|{{{1}}}}}}
7328 !! endarticle
7329
7330 !!test
7331 Templates: Template Name/Arg clash: 1. Use of positional param
7332 !!input
7333 {{quote|foo}}
7334 !!result
7335 <p>foo
7336 </p>
7337 !!end
7338
7339 !!test
7340 Templates: Template Name/Arg clash: 2. Use of named param
7341 !!input
7342 {{quote|quote=foo}}
7343 !!result
7344 <p>foo
7345 </p>
7346 !!end
7347
7348 !!test
7349 Templates: Template Name/Arg clash: 3. Use of named param with empty input
7350 !!input
7351 {{quote|quote}}
7352 !!result
7353 <p>quote
7354 </p>
7355 !!end
7356
7357 ###
7358 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
7359 ###
7360
7361 !!test
7362 Templates: 1. Simple use
7363 !!input
7364 {{echo|Foo}}
7365 !!result
7366 <p>Foo
7367 </p>
7368 !!end
7369
7370 !!test
7371 Templates: 2. Inside a block tag
7372 !!input
7373 <div>{{echo|Foo}}</div>
7374 <blockquote>{{echo|Foo}}</blockquote>
7375 !!result
7376 <div>Foo</div>
7377 <blockquote>Foo</blockquote>
7378
7379 !!end
7380
7381 !!test
7382 Templates: P-wrapping: 1a. Templates on consecutive lines
7383 !!input
7384 {{echo|Foo}}
7385 {{echo|bar}}
7386 !!result
7387 <p>Foo
7388 bar
7389 </p>
7390 !!end
7391
7392 !!test
7393 Templates: P-wrapping: 1b. Templates on consecutive lines
7394 !!input
7395 Foo
7396
7397 {{echo|bar}}
7398 {{echo|baz}}
7399 !!result
7400 <p>Foo
7401 </p><p>bar
7402 baz
7403 </p>
7404 !!end
7405
7406 !!test
7407 Templates: P-wrapping: 1c. Templates on consecutive lines
7408 !!input
7409 {{echo|Foo}}
7410 {{echo|bar}} <div>baz</div>
7411 !!result
7412 <p>Foo
7413 </p>
7414 bar <div>baz</div>
7415
7416 !!end
7417
7418 !!test
7419 Templates: P-wrapping: 1d. Template preceded by comment-only line
7420 !!options
7421 parsoid=wt2html,wt2wt
7422 !!input
7423 <!-- foo -->
7424 {{echo|Bar}}
7425 !!result
7426 <!-- foo -->
7427 <p typeof="mw:Transclusion">Bar
7428 </p>
7429 !!end
7430
7431 !!test
7432 Templates: Inline Text: 1. Multiple tmeplate uses
7433 !!input
7434 {{echo|Foo}}bar{{echo|baz}}
7435 !!result
7436 <p>Foobarbaz
7437 </p>
7438 !!end
7439
7440 !!test
7441 Templates: Inline Text: 2. Back-to-back template uses
7442 !!input
7443 {{echo|Foo}}{{echo|bar}}
7444 !!result
7445 <p>Foobar
7446 </p>
7447 !!end
7448
7449 !!test
7450 Templates: Block Tags: 1. Multiple template uses
7451 !!input
7452 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
7453 !!result
7454 <div>Foo</div><div>bar</div><div>baz</div>
7455
7456 !!end
7457
7458 !!test
7459 Templates: Block Tags: 2. Back-to-back template uses
7460 !!input
7461 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
7462 !!result
7463 <div>Foo</div><div>bar</div>
7464
7465 !!end
7466
7467 !!test
7468 Templates: Links: 1. Simple example
7469 !!input
7470 {{echo|[[Foo|bar]]}}
7471 !!result
7472 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7473 </p>
7474 !!end
7475
7476 !!test
7477 Templates: Links: 2. Generation of link href
7478 !!input
7479 [[{{echo|Foo}}|bar]]
7480 !!result
7481 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7482 </p>
7483 !!end
7484
7485 !!test
7486 Templates: Links: 3. Generation of part of a link href
7487 !!input
7488 [[Fo{{echo|o}}|bar]]
7489
7490 [[Foo{{echo|bar}}]]
7491
7492 [[Foo{{echo|bar}}baz]]
7493
7494 [[Foo{{echo|bar}}|bar]]
7495
7496 [[:Foo{{echo|bar}}]]
7497
7498 [[:Foo{{echo|bar}}|bar]]
7499 !!result
7500 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7501 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7502 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
7503 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7504 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7505 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7506 </p>
7507 !!end
7508
7509 !!test
7510 Templates: Links: 4. Multiple templates generating link href
7511 !!input
7512 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
7513 !!result
7514 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7515 </p>
7516 !!end
7517
7518 !!test
7519 Templates: Links: 5. Generation of link text
7520 !!input
7521 [[Foo|{{echo|bar}}]]
7522 !!result
7523 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7524 </p>
7525 !!end
7526
7527 !!test
7528 Templates: Links: 5. Nested templates (only outermost template should be marked)
7529 !!input
7530 {{echo|[[{{echo|Foo}}|bar]]}}
7531 !!result
7532 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7533 </p>
7534 !!end
7535
7536 !!test
7537 Templates: HTML Tag: 1. Generation of HTML attr. key
7538 !!input
7539 <div {{echo|style}}="color:red;">foo</div>
7540 !!result
7541 <div style="color:red;">foo</div>
7542
7543 !!end
7544
7545 !!test
7546 Templates: HTML Tag: 2. Generation of HTML attr. value
7547 !!input
7548 <div style={{echo|'color:red;'}}>foo</div>
7549 !!result
7550 <div style="color:red;">foo</div>
7551
7552 !!end
7553
7554 !!test
7555 Templates: HTML Tag: 3. Generation of HTML attr key and value
7556 !!input
7557 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
7558 !!result
7559 <div style="color:red;">foo</div>
7560
7561 !!end
7562
7563 !!test
7564 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
7565 !!input
7566 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
7567 !!result
7568 <div title="This is a long title with just one piece templated">foo</div>
7569
7570 !!end
7571
7572 !!test
7573 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
7574 !!input
7575 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
7576 !!result
7577 <div title="This is a long title with just one piece templated">foo</div>
7578
7579 !!end
7580
7581 !!test
7582 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
7583 !!input
7584 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
7585 !!result
7586 <div title="This is a long title with just one piece templated">foo</div>
7587
7588 !!end
7589
7590 !!test
7591 Templates: HTML Tag: 7. Generation of partial attribute key string
7592 !!input
7593 <div st{{echo|yle}}="color:red;">foo</div>
7594 !!result
7595 <div style="color:red;">foo</div>
7596
7597 !!end
7598
7599 !!test
7600 Templates: HTML Tables: 1. Generating start of a HTML table
7601 !!input
7602 {{echo|<table><tr><td>foo</td>}}</tr></table>
7603 !!result
7604 <table><tr><td>foo</td></tr></table>
7605
7606 !!end
7607
7608 !!test
7609 Templates: HTML Tables: 2a. Generating middle of a HTML table
7610 !!input
7611 <table><tr>{{echo|<td>foo</td>}}</tr></table>
7612 !!result
7613 <table><tr><td>foo</td></tr></table>
7614
7615 !!end
7616
7617 !!test
7618 Templates: HTML Tables: 2b. Generating middle of a HTML table
7619 !!input
7620 <table>{{echo|<tr><td>foo</td></tr>}}</table>
7621 !!result
7622 <table><tr><td>foo</td></tr></table>
7623
7624 !!end
7625
7626 !!test
7627 Templates: HTML Tables: 3. Generating end of a HTML table
7628 !!input
7629 <table><tr>{{echo|<td>foo</td></tr></table>}}
7630 !!result
7631 <table><tr><td>foo</td></tr></table>
7632
7633 !!end
7634
7635 !!test
7636 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
7637 !!input
7638 {{echo|<table>}}<tr><td>foo</td></tr></table>
7639 !!result
7640 <table><tr><td>foo</td></tr></table>
7641
7642 !!end
7643
7644 !!test
7645 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
7646 !!input
7647 <table>{{echo|<tr>}}<td>foo</td></tr></table>
7648 !!result
7649 <table><tr><td>foo</td></tr></table>
7650
7651 !!end
7652
7653 !!test
7654 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
7655 !!input
7656 <table><tr>{{echo|<td>}}foo</td></tr></table>
7657 !!result
7658 <table><tr><td>foo</td></tr></table>
7659
7660 !!end
7661
7662 !!test
7663 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
7664 !!input
7665 <table><tr><td>foo{{echo|</td>}}</tr></table>
7666 !!result
7667 <table><tr><td>foo</td></tr></table>
7668
7669 !!end
7670
7671 !!test
7672 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
7673 !!input
7674 <table><tr><td>foo</td>{{echo|</tr>}}</table>
7675 !!result
7676 <table><tr><td>foo</td></tr></table>
7677
7678 !!end
7679
7680 !!test
7681 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
7682 !!input
7683 <table><tr><td>foo</td></tr>{{echo|</table>}}
7684 !!result
7685 <table><tr><td>foo</td></tr></table>
7686
7687 !!end
7688
7689 !!test
7690 Templates: HTML Tables: 5. Proper fostering of categories from inside
7691 !!options
7692 parsoid=wt2html,wt2wt
7693 !!input
7694 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
7695 <!--Two categories (Bug 50330)-->
7696 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
7697 !!result
7698 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
7699 <!--Two categories (Bug 50330)-->
7700 <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>
7701 !!end
7702
7703 !!test
7704 Templates: Wiki Tables: 1a. Fostering of entire template content
7705 !!input
7706 {|
7707 {{echo|a}}
7708 |}
7709 !!result
7710 <table>
7711 a
7712 <tr><td></td></tr></table>
7713
7714 !!end
7715
7716 !!test
7717 Templates: Wiki Tables: 1b. Fostering of entire template content
7718 !!input
7719 {|
7720 {{echo|<div>}}
7721 foo
7722 {{echo|</div>}}
7723 |}
7724 !!result
7725 <table>
7726 <div>
7727 <p>foo
7728 </p>
7729 </div>
7730 <tr><td></td></tr></table>
7731
7732 !!end
7733
7734 !!test
7735 Templates: Wiki Tables: 2. Fostering of partial template content
7736 !!input
7737 {|
7738 {{echo|a
7739 <div>b</div>}}
7740 |}
7741 !!result
7742 <table>
7743 a
7744 <div>b</div>
7745 <tr><td></td></tr></table>
7746
7747 !!end
7748
7749 !!test
7750 Templates: Wiki Tables: 3. td-content via multiple templates
7751 !!input
7752 {|
7753 {{echo|{{pipe}}a}}{{echo|b}}
7754 |}
7755 !!result
7756 <table>
7757 <tr>
7758 <td>ab
7759 </td></tr></table>
7760
7761 !!end
7762
7763 !!test
7764 Templates: Wiki Tables: 4. Templated tags, no content
7765 !!input
7766 {{tbl-start}}
7767 {{tbl-end}}
7768 !!result
7769 <table>
7770 <tr><td></td></tr></table>
7771
7772 !!end
7773
7774 !!test
7775 Templates: Wiki Tables: 5. Templated tags, regular td-tags
7776 !!input
7777 {{tbl-start}}
7778 |foo
7779 {{tbl-end}}
7780 !!result
7781 <table>
7782 <tr>
7783 <td>foo
7784 </td></tr></table>
7785
7786 !!end
7787
7788 !!test
7789 Templates: Wiki Tables: 6. Templated tags, templated td-tags
7790 !!input
7791 {{tbl-start}}
7792 {{!}}foo
7793 {{tbl-end}}
7794 !!result
7795 <table>
7796 <tr>
7797 <td>foo
7798 </td></tr></table>
7799
7800 !!end
7801
7802 !!test
7803 Templates: Lists: Multi-line list-items via templates
7804 !!input
7805 *{{echo|a {{nonexistent|
7806 unused}}}}
7807 *{{echo|b {{nonexistent|
7808 unused}}}}
7809 !!result
7810 <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>
7811 </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>
7812 </li></ul>
7813
7814 !!end
7815
7816 !!test
7817 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
7818 !!input
7819 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
7820 !!result
7821 <p><i>ab</i>c<i>d</i>e
7822 </p>
7823 !!end
7824
7825 !!test
7826 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7827 (PHP parser generates misnested html)
7828 !! options
7829 parsoid=wt2html,wt2wt
7830 !!input
7831 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
7832 !!result
7833 <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>
7834 !!end
7835
7836 !!test
7837 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
7838 (PHP parser generates misnested html)
7839 !! options
7840 parsoid=wt2html,wt2wt
7841 !!input
7842 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
7843 !!result
7844 <div typeof="mw:Transclusion"><i>a</i></div>
7845 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
7846 <div typeof="mw:Transclusion">e</div>
7847 !!end
7848
7849 !!test
7850 Templates: Ugly nesting: 4. Divs opened/closed across templates
7851 !!input
7852 a<div>b{{echo|c</div>d}}e
7853 !!result
7854 a<div>bc</div>de
7855
7856 !!end
7857
7858 !!test
7859 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
7860 (Parsoid-centric)
7861 !! options
7862 parsoid
7863 !!input
7864 {|
7865 |{{echo|foo</table>}}
7866 |bar
7867 |}
7868 !!result
7869 <table typeof="mw:Transclusion">
7870 <tbody>
7871 <tr>
7872 <td>foo</td></tr></tbody></table><span>bar</span>
7873 !!end
7874
7875 !!test
7876 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
7877 (Parsoid-centric)
7878 !! options
7879 parsoid
7880 !!input
7881 <table>
7882 <tr>
7883 <td>
7884 <table>
7885 <tr>
7886 <td>1. {{echo|foo </table>}}</td>
7887 <td> bar </td>
7888 <td>2. {{echo|baz </table>}}</td>
7889 </tr>
7890 <tr>
7891 <td>abc</td>
7892 </tr>
7893 </table>
7894 </td>
7895 </tr>
7896 <tr>
7897 <td>xyz</td>
7898 </tr>
7899 </table>
7900 !!result
7901 <table about="#mwt1" typeof="mw:Transclusion">
7902 <tbody><tr >
7903 <td >
7904 <table >
7905 <tbody><tr >
7906 <td >1. foo </td></tr></tbody></table></td>
7907 <td > bar </td>
7908 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
7909 </span><span about="#mwt1">
7910
7911 abc</span><span about="#mwt1">
7912 </span><span about="#mwt1">
7913 </span><span about="#mwt1">
7914 </span><span about="#mwt1">
7915 </span><span about="#mwt1">
7916
7917 xyz</span><span about="#mwt1">
7918 </span><span about="#mwt1">
7919 </span>
7920 !!end
7921
7922 !! test
7923 Templates: Ugly templates: 3. newline-only template parameter
7924 !! input
7925 foo {{echo|
7926 }}
7927 !! result
7928 <p>foo
7929 </p>
7930 !! end
7931
7932 # This looks like a bug: a single newline triggers p/br for some reason.
7933 !! test
7934 Templates: Ugly templates: 4. newline-only template parameter inconsistency
7935 !! input
7936 {{echo|
7937 }}
7938 !! result
7939 <p><br />
7940 </p>
7941 !! end
7942
7943
7944 !!test
7945 Parser Functions: 1. Simple example
7946 !!input
7947 {{uc:foo}}
7948 !!result
7949 <p>FOO
7950 </p>
7951 !!end
7952
7953 !!test
7954 Parser Functions: 2. Nested use (only outermost should be marked up)
7955 !!input
7956 {{uc:{{lc:FOO}}}}
7957 !!result
7958 <p>FOO
7959 </p>
7960 !!end
7961
7962 ###
7963 ### Pre-save transform tests
7964 ###
7965 !! test
7966 pre-save transform: subst:
7967 !! options
7968 PST
7969 !! input
7970 {{subst:test}}
7971 !! result
7972 This is a test template
7973 !! end
7974
7975 !! test
7976 pre-save transform: normal template
7977 !! options
7978 PST
7979 !! input
7980 {{test}}
7981 !! result
7982 {{test}}
7983 !! end
7984
7985 !! test
7986 pre-save transform: nonexistent template
7987 !! options
7988 PST
7989 !! input
7990 {{thistemplatedoesnotexist}}
7991 !! result
7992 {{thistemplatedoesnotexist}}
7993 !! end
7994
7995
7996 !! test
7997 pre-save transform: subst magic variables
7998 !! options
7999 PST
8000 !! input
8001 {{subst:SITENAME}}
8002 !! result
8003 MediaWiki
8004 !! end
8005
8006 # This is bug 89, which I fixed. -- wtm
8007 !! test
8008 pre-save transform: subst: templates with parameters
8009 !! options
8010 pst
8011 !! input
8012 {{subst:paramtest|param="something else"}}
8013 !! result
8014 This is a test template with parameter "something else"
8015 !! end
8016
8017 !! article
8018 Template:nowikitest
8019 !! text
8020 <nowiki>'''not wiki'''</nowiki>
8021 !! endarticle
8022
8023 !! test
8024 pre-save transform: nowiki in subst (bug 1188)
8025 !! options
8026 pst
8027 !! input
8028 {{subst:nowikitest}}
8029 !! result
8030 <nowiki>'''not wiki'''</nowiki>
8031 !! end
8032
8033
8034 !! article
8035 Template:commenttest
8036 !! text
8037 This template has <!-- a comment --> in it.
8038 !! endarticle
8039
8040 !! test
8041 pre-save transform: comment in subst (bug 1936)
8042 !! options
8043 pst
8044 !! input
8045 {{subst:commenttest}}
8046 !! result
8047 This template has <!-- a comment --> in it.
8048 !! end
8049
8050 !! test
8051 pre-save transform: unclosed tag
8052 !! options
8053 pst noxml
8054 !! input
8055 <nowiki>'''not wiki'''
8056 !! result
8057 <nowiki>'''not wiki'''
8058 !! end
8059
8060 !! test
8061 pre-save transform: mixed tag case
8062 !! options
8063 pst noxml
8064 !! input
8065 <NOwiki>'''not wiki'''</noWIKI>
8066 !! result
8067 <NOwiki>'''not wiki'''</noWIKI>
8068 !! end
8069
8070 !! test
8071 pre-save transform: unclosed comment in <nowiki>
8072 !! options
8073 pst noxml
8074 !! input
8075 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
8076 !! result
8077 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
8078 !!end
8079
8080 # Leading @ in this template definition works around a limitation
8081 # in parsoid's parserTests which otherwise strips the <span> from the
8082 # result (confusing it for a template wrapper)
8083 !! article
8084 Template:dangerous
8085 !!text
8086 @<span onmouseover="alert('crap')">Oh no</span>
8087 !!endarticle
8088
8089 !!test
8090 (confirming safety of fix for subst bug 1936)
8091 !! input
8092 {{Template:dangerous}}
8093 !! result
8094 <p>@<span>Oh no</span>
8095 </p>
8096 !! end
8097
8098 !! test
8099 pre-save transform: comment containing gallery (bug 5024)
8100 !! options
8101 pst
8102 !! input
8103 <!-- <gallery>data</gallery> -->
8104 !!result
8105 <!-- <gallery>data</gallery> -->
8106 !!end
8107
8108 !! test
8109 pre-save transform: comment containing extension
8110 !! options
8111 pst
8112 !! input
8113 <!-- <tag>data</tag> -->
8114 !!result
8115 <!-- <tag>data</tag> -->
8116 !!end
8117
8118 !! test
8119 pre-save transform: comment containing nowiki
8120 !! options
8121 pst
8122 !! input
8123 <!-- <nowiki>data</nowiki> -->
8124 !!result
8125 <!-- <nowiki>data</nowiki> -->
8126 !!end
8127
8128 !! test
8129 pre-save transform: <noinclude> in subst (bug 3298)
8130 !! options
8131 pst
8132 !! input
8133 {{subst:Includes}}
8134 !! result
8135 Foobar
8136 !! end
8137
8138 !! test
8139 pre-save transform: <onlyinclude> in subst (bug 3298)
8140 !! options
8141 pst
8142 !! input
8143 {{subst:Includes2}}
8144 !! result
8145 Foo
8146 !! end
8147
8148 !! article
8149 Template:SubstTest
8150 !!text
8151 {{<includeonly>subst:</includeonly>Includes}}
8152 !! endarticle
8153
8154 !! article
8155 Template:SafeSubstTest
8156 !! text
8157 {{<includeonly>safesubst:</includeonly>Includes}}
8158 !! endarticle
8159
8160 !! test
8161 bug 22297: safesubst: works during PST
8162 !! options
8163 pst
8164 !! input
8165 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
8166 !! result
8167 FoobarFoobar
8168 !! end
8169
8170 !! test
8171 bug 22297: safesubst: works during normal parse
8172 !! input
8173 {{SafeSubstTest}}
8174 !! result
8175 <p>Foobar
8176 </p>
8177 !! end
8178
8179 !! test:
8180 subst: does not work during normal parse
8181 !! input
8182 {{SubstTest}}
8183 !! result
8184 <p>{{subst:Includes}}
8185 </p>
8186 !! end
8187
8188 !! test
8189 pre-save transform: context links ("pipe trick")
8190 !! options
8191 pst
8192 !! input
8193 [[Article (context)|]]
8194 [[Bar:Article|]]
8195 [[:Bar:Article|]]
8196 [[Bar:Article (context)|]]
8197 [[:Bar:Article (context)|]]
8198 [[|Article]]
8199 [[|Article (context)]]
8200 [[Bar:X (Y) Z|]]
8201 [[:Bar:X (Y) Z|]]
8202 !! result
8203 [[Article (context)|Article]]
8204 [[Bar:Article|Article]]
8205 [[:Bar:Article|Article]]
8206 [[Bar:Article (context)|Article]]
8207 [[:Bar:Article (context)|Article]]
8208 [[Article]]
8209 [[Article (context)]]
8210 [[Bar:X (Y) Z|X (Y) Z]]
8211 [[:Bar:X (Y) Z|X (Y) Z]]
8212 !! end
8213
8214 !! test
8215 pre-save transform: context links ("pipe trick") with interwiki prefix
8216 !! options
8217 pst
8218 !! input
8219 [[interwiki:Article|]]
8220 [[:interwiki:Article|]]
8221 [[interwiki:Bar:Article|]]
8222 [[:interwiki:Bar:Article|]]
8223 !! result
8224 [[interwiki:Article|Article]]
8225 [[:interwiki:Article|Article]]
8226 [[interwiki:Bar:Article|Bar:Article]]
8227 [[:interwiki:Bar:Article|Bar:Article]]
8228 !! end
8229
8230 !! test
8231 pre-save transform: context links ("pipe trick") with parens in title
8232 !! options
8233 pst title=[[Somearticle (context)]]
8234 !! input
8235 [[|Article]]
8236 !! result
8237 [[Article (context)|Article]]
8238 !! end
8239
8240 !! test
8241 pre-save transform: context links ("pipe trick") with comma in title
8242 !! options
8243 pst title=[[Someplace, Somewhere]]
8244 !! input
8245 [[|Otherplace]]
8246 [[Otherplace, Elsewhere|]]
8247 [[Otherplace, Elsewhere, Anywhere|]]
8248 !! result
8249 [[Otherplace, Somewhere|Otherplace]]
8250 [[Otherplace, Elsewhere|Otherplace]]
8251 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
8252 !! end
8253
8254 !! test
8255 pre-save transform: context links ("pipe trick") with parens and comma
8256 !! options
8257 pst title=[[Someplace (IGNORED), Somewhere]]
8258 !! input
8259 [[|Otherplace]]
8260 [[Otherplace (place), Elsewhere|]]
8261 !! result
8262 [[Otherplace, Somewhere|Otherplace]]
8263 [[Otherplace (place), Elsewhere|Otherplace]]
8264 !! end
8265
8266 !! test
8267 pre-save transform: context links ("pipe trick") with comma and parens
8268 !! options
8269 pst title=[[Who, me? (context)]]
8270 !! input
8271 [[|Yes, you.]]
8272 [[Me, Myself, and I (1937 song)|]]
8273 !! result
8274 [[Yes, you. (context)|Yes, you.]]
8275 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
8276 !! end
8277
8278 !! test
8279 pre-save transform: context links ("pipe trick") with namespace
8280 !! options
8281 pst title=[[Ns:Somearticle]]
8282 !! input
8283 [[|Article]]
8284 !! result
8285 [[Ns:Article|Article]]
8286 !! end
8287
8288 !! test
8289 pre-save transform: context links ("pipe trick") with namespace and parens
8290 !! options
8291 pst title=[[Ns:Somearticle (context)]]
8292 !! input
8293 [[|Article]]
8294 !! result
8295 [[Ns:Article (context)|Article]]
8296 !! end
8297
8298 !! test
8299 pre-save transform: context links ("pipe trick") with namespace and comma
8300 !! options
8301 pst title=[[Ns:Somearticle, Context, Whatever]]
8302 !! input
8303 [[|Article]]
8304 !! result
8305 [[Ns:Article, Context, Whatever|Article]]
8306 !! end
8307
8308 !! test
8309 pre-save transform: context links ("pipe trick") with namespace, comma and parens
8310 !! options
8311 pst title=[[Ns:Somearticle, Context (context)]]
8312 !! input
8313 [[|Article]]
8314 !! result
8315 [[Ns:Article (context)|Article]]
8316 !! end
8317
8318 !! test
8319 pre-save transform: context links ("pipe trick") with namespace, parens and comma
8320 !! options
8321 pst title=[[Ns:Somearticle (IGNORED), Context]]
8322 !! input
8323 [[|Article]]
8324 !! result
8325 [[Ns:Article, Context|Article]]
8326 !! end
8327
8328 !! test
8329 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
8330 !! options
8331 pst
8332 !! input
8333 [[Article(context)|]]
8334 [[Bar:Article(context)|]]
8335 [[:Bar:Article(context)|]]
8336 [[|Article(context)]]
8337 [[Bar:X(Y)Z|]]
8338 [[:Bar:X(Y)Z|]]
8339 !! result
8340 [[Article(context)|Article]]
8341 [[Bar:Article(context)|Article]]
8342 [[:Bar:Article(context)|Article]]
8343 [[Article(context)]]
8344 [[Bar:X(Y)Z|X(Y)Z]]
8345 [[:Bar:X(Y)Z|X(Y)Z]]
8346 !! end
8347
8348 !! test
8349 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
8350 !! options
8351 pst
8352 !! input
8353 [[Article (context)|]]
8354 [[Bar:Article (context)|]]
8355 [[:Bar:Article (context)|]]
8356 [[|Article (context)]]
8357 [[Bar:X (Y) Z|]]
8358 [[:Bar:X (Y) Z|]]
8359 !! result
8360 [[Article (context)|Article]]
8361 [[Bar:Article (context)|Article]]
8362 [[:Bar:Article (context)|Article]]
8363 [[Article (context)]]
8364 [[Bar:X (Y) Z|X (Y) Z]]
8365 [[:Bar:X (Y) Z|X (Y) Z]]
8366 !! end
8367
8368 !! test
8369 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
8370 !! options
8371 pst
8372 !! input
8373 [[Article(context)|]]
8374 [[Bar:Article(context)|]]
8375 [[:Bar:Article(context)|]]
8376 [[|Article(context)]]
8377 [[Bar:X(Y)Z|]]
8378 [[:Bar:X(Y)Z|]]
8379 !! result
8380 [[Article(context)|Article]]
8381 [[Bar:Article(context)|Article]]
8382 [[:Bar:Article(context)|Article]]
8383 [[Article(context)]]
8384 [[Bar:X(Y)Z|X(Y)Z]]
8385 [[:Bar:X(Y)Z|X(Y)Z]]
8386 !! end
8387
8388 !! test
8389 pre-save transform: context links ("pipe trick") with commas (bug 21660)
8390 !! options
8391 pst
8392 !! input
8393 [[Article (context), context|]]
8394 [[Article (context),context|]]
8395 [[Bar:Article (context), context|]]
8396 [[Bar:Article (context),context|]]
8397 [[:Bar:Article (context), context|]]
8398 [[:Bar:Article (context),context|]]
8399 !! result
8400 [[Article (context), context|Article]]
8401 [[Article (context),context|Article]]
8402 [[Bar:Article (context), context|Article]]
8403 [[Bar:Article (context),context|Article]]
8404 [[:Bar:Article (context), context|Article]]
8405 [[:Bar:Article (context),context|Article]]
8406 !! end
8407
8408 !! test
8409 pre-save transform: trim trailing empty lines
8410 !! options
8411 pst
8412 !! input
8413 Empty lines are trimmed
8414
8415
8416
8417
8418 !! result
8419 Empty lines are trimmed
8420 !! end
8421
8422 !! test
8423 pre-save transform: Signature expansion
8424 !! options
8425 pst
8426 !! input
8427 * ~~~
8428 * <noinclude>~~~</noinclude>
8429 * <includeonly>~~~</includeonly>
8430 * <onlyinclude>~~~</onlyinclude>
8431 !! result
8432 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
8433 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
8434 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
8435 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
8436 !! end
8437
8438
8439 !! test
8440 pre-save transform: Signature expansion in nowiki tags (bug 93)
8441 !! options
8442 pst disabled
8443 !! input
8444 Shall not expand:
8445
8446 <nowiki>~~~~</nowiki>
8447
8448 <includeonly><nowiki>~~~~</nowiki></includeonly>
8449
8450 <noinclude><nowiki>~~~~</nowiki></noinclude>
8451
8452 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8453
8454 {{subst:Foo}} shall be converted to FOO
8455
8456 As well as inside noinclude/onlyinclude
8457 <noinclude>{{subst:Foo}}</noinclude>
8458 <onlyinclude>{{subst:Foo}}</onlyinclude>
8459
8460 But not inside includeonly
8461 <includeonly>{{subst:Foo}}</includeonly>
8462 !! result
8463 Shall not expand:
8464
8465 <nowiki>~~~~</nowiki>
8466
8467 <includeonly><nowiki>~~~~</nowiki></includeonly>
8468
8469 <noinclude><nowiki>~~~~</nowiki></noinclude>
8470
8471 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8472
8473 FOO shall be converted to FOO
8474
8475 As well as inside noinclude/onlyinclude
8476 <noinclude>FOO</noinclude>
8477 <onlyinclude>FOO</onlyinclude>
8478
8479 But not inside includeonly
8480 <includeonly>{{subst:Foo}}</includeonly>
8481 !! end
8482
8483 !! test
8484 Parsoid: Recognize nowiki with trailing space in tags
8485 !! options
8486 parsoid=wt2html
8487 !! input
8488 <nowiki ><div>[[foo]]</nowiki >
8489
8490 a<nowiki / >b
8491
8492 c<nowiki />d
8493
8494 e<nowiki/ >f
8495 !! result
8496 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8497 <p>ab</p>
8498 <p>cd</p>
8499 <p>ef</p>
8500 !! end
8501
8502 !! test
8503 Parsoid: Recognize nowiki with odd capitalization
8504 !! options
8505 parsoid=wt2html
8506 !! input
8507 <noWikI ><div>[[foo]]</Nowiki >
8508 !! result
8509 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8510 !! end
8511
8512
8513 !! test
8514 Parsoid: Escape nowiki with trailing space in tags
8515 !! options
8516 parsoid=html2wt
8517 !! input
8518 &lt;nowiki &gt; foo &lt;/nowiki &gt;
8519
8520 a&lt;nowiki /&gt;b
8521
8522 c&lt;nowiki/ &gt;d
8523 !! result
8524 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
8525 <p>a&lt;nowiki /&gt;b</p>
8526 <p>c&lt;nowiki/ &gt;d</p>
8527 !! end
8528
8529 !! test
8530 Parsoid: Escape weird noWikI capitalizations
8531 !! options
8532 parsoid=html2wt
8533 !! input
8534 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
8535 !! result
8536 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
8537 !! end
8538
8539 ###
8540 ### Message transform tests
8541 ###
8542 !! test
8543 message transform: magic variables
8544 !! options
8545 msg
8546 !! input
8547 {{SITENAME}}
8548 !! result
8549 MediaWiki
8550 !! end
8551
8552 !! test
8553 message transform: should not transform wiki markup
8554 !! options
8555 msg
8556 !! input
8557 ''test''
8558 !! result
8559 ''test''
8560 !! end
8561
8562 !! test
8563 message transform: <noinclude> in transcluded template (bug 4926)
8564 !! options
8565 msg
8566 !! input
8567 {{Includes}}
8568 !! result
8569 Foobar
8570 !! end
8571
8572 !! test
8573 message transform: <onlyinclude> in transcluded template (bug 4926)
8574 !! options
8575 msg
8576 !! input
8577 {{Includes2}}
8578 !! result
8579 Foo
8580 !! end
8581
8582 !! test
8583 {{#special:}} page name, known
8584 !! options
8585 msg
8586 !! input
8587 {{#special:Recentchanges}}
8588 !! result
8589 Special:RecentChanges
8590 !! end
8591
8592 !! test
8593 {{#special:}} page name with subpage, known
8594 !! options
8595 msg
8596 !! input
8597 {{#special:Recentchanges/param}}
8598 !! result
8599 Special:RecentChanges/param
8600 !! end
8601
8602 !! test
8603 {{#special:}} page name, unknown
8604 !! options
8605 msg
8606 !! input
8607 {{#special:foobar nonexistent}}
8608 !! result
8609 Special:Foobar nonexistent
8610 !! end
8611
8612 !! test
8613 {{#speciale:}} page name, known
8614 !! options
8615 msg
8616 !! input
8617 {{#speciale:Recentchanges}}
8618 !! result
8619 Special:RecentChanges
8620 !! end
8621
8622 !! test
8623 {{#speciale:}} page name with subpage, known
8624 !! options
8625 msg
8626 !! input
8627 {{#speciale:Recentchanges/param}}
8628 !! result
8629 Special:RecentChanges/param
8630 !! end
8631
8632 !! test
8633 {{#speciale:}} page name, unknown
8634 !! options
8635 msg
8636 !! input
8637 {{#speciale:foobar nonexistent}}
8638 !! result
8639 Special:Foobar_nonexistent
8640 !! end
8641
8642 ###
8643 ### Images
8644 ###
8645 ### For Parsoid-specific tests, see
8646 #### http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8647
8648 !! test
8649 Simple image (php)
8650 !! options
8651 php
8652 !! input
8653 [[Image:foobar.jpg]]
8654 !! result
8655 <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>
8656 </p>
8657 !! end
8658
8659 !! test
8660 Simple image (parsoid)
8661 !! options
8662 parsoid=wt2html
8663 !! input
8664 [[Image:foobar.jpg]]
8665 !! result
8666 <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>
8667 </p>
8668 !! end
8669
8670 !! test
8671 Simple image (using File: namespace, now canonical) (php)
8672 !! options
8673 php
8674 !! input
8675 [[File:foobar.jpg]]
8676 !! result
8677 <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>
8678 </p>
8679 !! end
8680
8681 !! test
8682 Simple image (using File: namespace, now canonical) (parsoid)
8683 !! options
8684 parsoid
8685 !! input
8686 [[File:Foobar.jpg]]
8687 !! result
8688 <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>
8689 </p>
8690 !! end
8691
8692 !! test
8693 Right-aligned image (php)
8694 !! options
8695 php
8696 !! input
8697 [[Image:foobar.jpg|right]]
8698 !! result
8699 <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>
8700
8701 !! end
8702
8703 !! test
8704 Right-aligned image (parsoid)
8705 !! options
8706 parsoid
8707 !! input
8708 [[File:Foobar.jpg|right]]
8709 !! result
8710 <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>
8711 !! end
8712
8713 !! test
8714 Image with caption (php)
8715 !! options
8716 php
8717 !! input
8718 [[File:Foobar.jpg|right|Caption text]]
8719 !! result
8720 <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>
8721
8722 !! end
8723
8724 !! test
8725 Image with caption (parsoid)
8726 !! options
8727 parsoid
8728 !! input
8729 [[File:Foobar.jpg|right|Caption text]]
8730 !! result
8731 <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>
8732 !! end
8733
8734 !! test
8735 Image with empty attribute (php)
8736 !! options
8737 php
8738 !! input
8739 [[File:Foobar.jpg|right||Caption text]]
8740 !! result
8741 <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>
8742
8743 !! end
8744
8745 !! test
8746 Image with empty attribute (parsoid)
8747 !! options
8748 parsoid=wt2html
8749 !! input
8750 [[File:Foobar.jpg|right||Caption text]]
8751 !! result
8752 <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>
8753 !! end
8754
8755 !! test
8756 Image with attributes from template (php)
8757 !! options
8758 php
8759 !! input
8760 [[File:Foobar.jpg|{{image_attribs}}]]
8761 !! result
8762 <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>
8763
8764 !! end
8765
8766 !! test
8767 Image with attributes from template (parsoid)
8768 !! options
8769 parsoid
8770 !! input
8771 [[File:Foobar.jpg|{{image_attribs}}]]
8772 !! result
8773 <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>
8774 !! end
8775
8776 !! test
8777 Image with link tails (php)
8778 !! options
8779 php
8780 !! input
8781 123[[File:Foobar.jpg]]456
8782 123[[File:Foobar.jpg|right]]456
8783 123[[File:Foobar.jpg|thumb]]456
8784 !! result
8785 <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
8786 </p>
8787 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
8788 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
8789
8790 !! end
8791
8792 !! test
8793 Image with link tails (parsoid)
8794 !! options
8795 parsoid
8796 !! input
8797 123[[File:Foobar.jpg]]456
8798 123[[File:Foobar.jpg|right]]456
8799 123[[File:Foobar.jpg|thumb]]456
8800 !! result
8801 <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>
8802 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
8803 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
8804 !! end
8805
8806 !! test
8807 Image with multiple captions -- only last one is accepted (php)
8808 !! options
8809 php
8810 !! input
8811 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8812 !! result
8813 <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>
8814
8815 !! end
8816
8817 !! test
8818 Image with multiple captions -- only last one is accepted (parsoid)
8819 !! options
8820 parsoid
8821 !! input
8822 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8823 !! result
8824 <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>
8825 !! end
8826
8827 !! test
8828 Image with width attribute at different positions (php)
8829 !! options
8830 php
8831 !! input
8832 [[File:Foobar.jpg|200px|right|Caption]]
8833 [[File:Foobar.jpg|right|200px|Caption]]
8834 [[File:Foobar.jpg|right|Caption|200px]]
8835 !! result
8836 <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>
8837 <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>
8838 <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>
8839
8840 !! end
8841
8842 !! test
8843 Image with width attribute at different positions (parsoid)
8844 !! options
8845 parsoid
8846 !! input
8847 [[File:Foobar.jpg|200px|right|Caption]]
8848 [[File:Foobar.jpg|right|200px|Caption]]
8849 [[File:Foobar.jpg|right|Caption|200px]]
8850 !! result
8851 <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>
8852 <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>
8853 <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>
8854 !! end
8855
8856 !! test
8857 Image with link parameter, wiki target (php)
8858 !! options
8859 php
8860 !! input
8861 [[File:Foobar.jpg|link=Main Page]]
8862 !! result
8863 <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>
8864 </p>
8865 !! end
8866
8867 !! test
8868 Image with link parameter, wiki target (parsoid)
8869 !! options
8870 parsoid
8871 !! input
8872 [[File:Foobar.jpg|link=Main Page]]
8873 !! result
8874 <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>
8875 !! end
8876
8877 !! test
8878 Image with link parameter, URL target (php)
8879 !! options
8880 php
8881 !! input
8882 [[File:Foobar.jpg|link=http://example.com/]]
8883 !! result
8884 <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>
8885 </p>
8886 !! end
8887
8888 # parsoid bug 49293 (part 1)
8889 !! test
8890 Image with link parameter, URL target (parsoid)
8891 !! options
8892 parsoid
8893 !! input
8894 [[File:Foobar.jpg|link=http://example.com/]]
8895 !! result
8896 <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>
8897 !! end
8898
8899 !! test
8900 Image with link parameter, protocol-less URL target (php)
8901 !! options
8902 php
8903 !! input
8904 [[File:Foobar.jpg|link=//example.com/]]
8905 !! result
8906 <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>
8907 </p>
8908 !! end
8909
8910 # parsoid bug 49293 (part 2)
8911 !! test
8912 Image with link parameter, protocol-less URL target (parsoid)
8913 !! options
8914 parsoid
8915 !! input
8916 [[File:Foobar.jpg|link=//example.com/]]
8917 !! result
8918 <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>
8919 !! end
8920
8921 !! test
8922 Image with link parameter, wgExternalLinkTarget
8923 !! input
8924 [[Image:foobar.jpg|link=http://example.com/]]
8925 !! config
8926 wgExternalLinkTarget='foobar'
8927 !! result
8928 <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>
8929 </p>
8930 !! end
8931
8932 !! test
8933 Image with link parameter, wgNoFollowLinks set to false
8934 !! input
8935 [[Image:foobar.jpg|link=http://example.com/]]
8936 !! config
8937 wgNoFollowLinks=false
8938 !! result
8939 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8940 </p>
8941 !! end
8942
8943 !! test
8944 Image with link parameter, wgNoFollowDomainExceptions
8945 !! input
8946 [[Image:foobar.jpg|link=http://example.com/]]
8947 !! config
8948 wgNoFollowDomainExceptions='example.com'
8949 !! result
8950 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8951 </p>
8952 !! end
8953
8954 !! test
8955 Image with link parameter, wgExternalLinkTarget, unnamed parameter
8956 !! input
8957 [[Image:foobar.jpg|link=http://example.com/|Title]]
8958 !! config
8959 wgExternalLinkTarget='foobar'
8960 !! result
8961 <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>
8962 </p>
8963 !! end
8964
8965 !! test
8966 Image with empty link parameter (php)
8967 !! options
8968 php
8969 !! input
8970 [[File:Foobar.jpg|link=]]
8971 !! result
8972 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
8973 </p>
8974 !! end
8975
8976 !! test
8977 Image with empty link parameter (parsoid)
8978 !! options
8979 parsoid
8980 !! input
8981 [[File:Foobar.jpg|link=]]
8982 !! result
8983 <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>
8984 !! end
8985
8986 !! test
8987 Image with link parameter (wiki target) and unnamed parameter (php)
8988 !! options
8989 php
8990 !! input
8991 [[File:Foobar.jpg|link=Main Page|Title]]
8992 !! result
8993 <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>
8994 </p>
8995 !! end
8996
8997 !! test
8998 Image with link parameter (wiki target) and unnamed parameter (parsoid)
8999 !! options
9000 parsoid
9001 !! input
9002 [[File:Foobar.jpg|link=Main Page|Title]]
9003 !! result
9004 <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>
9005 !! end
9006
9007 !! test
9008 Image with link parameter (URL target) and unnamed parameter (php)
9009 !! options
9010 php
9011 !! input
9012 [[File:Foobar.jpg|link=http://example.com/|Title]]
9013 !! result
9014 <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>
9015 </p>
9016 !! end
9017
9018 !! test
9019 Image with link parameter (URL target) and unnamed parameter (parsoid)
9020 !! options
9021 parsoid
9022 !! input
9023 [[File:Foobar.jpg|link=http://example.com/|Title]]
9024 !! result
9025 <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>
9026 !! end
9027
9028 !! test
9029 Thumbnail image with link parameter
9030 !! options
9031 php
9032 !! input
9033 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
9034 !! result
9035 <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>
9036
9037 !! end
9038
9039 !! test
9040 Manually-specified thumbnail image
9041 !! options
9042 php
9043 !! input
9044 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
9045 !! result
9046 <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>
9047
9048 !! end
9049
9050 !! test
9051 Manually-specified thumbnail image with explicit link to wiki page
9052 !! options
9053 php
9054 !! input
9055 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
9056 !! result
9057 <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>
9058
9059 !! end
9060
9061 !! test
9062 Manually-specified thumbnail image with explicit link to url
9063 !! options
9064 php
9065 !! input
9066 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
9067 !! result
9068 <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>
9069
9070 !! end
9071
9072 !! test
9073 Manually-specified thumbnail image with explicit no link
9074 !! options
9075 php
9076 !! input
9077 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
9078 !! result
9079 <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>
9080
9081 !! end
9082
9083 !! test
9084 Manually-specified thumbnail image with explicit link and alt text
9085 !! options
9086 php
9087 !! input
9088 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
9089 !! result
9090 <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>
9091
9092 !! end
9093
9094 !! test
9095 Image with frame and link
9096 !! input
9097 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
9098 !! result
9099 <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>
9100
9101 !! end
9102
9103 !! test
9104 Image with frame and link and explicit alt
9105 !! input
9106 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
9107 !! result
9108 <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>
9109
9110 !! end
9111
9112 !! test
9113 Image with wiki markup in implicit alt
9114 !! input
9115 [[Image:Foobar.jpg|testing '''bold''' in alt]]
9116 !! result
9117 <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>
9118 </p>
9119 !! end
9120
9121 !! test
9122 Image with wiki markup in explicit alt
9123 !! input
9124 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
9125 !! result
9126 <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>
9127 </p>
9128 !! end
9129
9130 !! test
9131 Link to image page- image page normally doesn't exists, hence edit link
9132 Add test with existing image page
9133 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
9134 !! input
9135 [[:Image:test]]
9136 !! result
9137 <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>
9138 </p>
9139 !! end
9140
9141 !! test
9142 bug 18784 Link to non-existent image page with caption should use caption as link text
9143 !! input
9144 [[:Image:test|caption]]
9145 !! result
9146 <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>
9147 </p>
9148 !! end
9149
9150 !! test
9151 Frameless image caption with a free URL
9152 !! input
9153 [[Image:foobar.jpg|http://example.com]]
9154 !! result
9155 <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>
9156 </p>
9157 !! end
9158
9159 !! test
9160 Thumbnail image caption with a free URL
9161 !! input
9162 [[Image:foobar.jpg|thumb|http://example.com]]
9163 !! result
9164 <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>
9165
9166 !! end
9167
9168 !! test
9169 Thumbnail image caption with a free URL and explicit alt
9170 !! input
9171 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
9172 !! result
9173 <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>
9174
9175 !! end
9176
9177 !! test
9178 SVG thumbnails with no language set
9179 !! options
9180 !! input
9181 [[File:Foobar.svg|thumb|width=200]]
9182 !! result
9183 <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>
9184
9185 !! end
9186
9187 !! test
9188 SVG thumbnails with language de
9189 !! options
9190 !! input
9191 [[File:Foobar.svg|thumb|width=200|lang=de]]
9192 !! result
9193 <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>
9194
9195 !! end
9196
9197 !! test
9198 SVG thumbnails with invalid language code
9199 !! options
9200 !! input
9201 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
9202 !! result
9203 <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>
9204
9205 !! end
9206
9207 !! test
9208 BUG 1887: A ISBN with a thumbnail
9209 !! input
9210 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
9211 !! result
9212 <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>
9213
9214 !! end
9215
9216 !! test
9217 BUG 1887: A RFC with a thumbnail
9218 !! input
9219 [[Image:foobar.jpg|thumb|This is RFC 12354]]
9220 !! result
9221 <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>
9222
9223 !! end
9224
9225 !! test
9226 BUG 1887: A mailto link with a thumbnail
9227 !! input
9228 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
9229 !! result
9230 <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>
9231
9232 !! end
9233
9234 # Pending resolution to bug 368
9235 !! test
9236 BUG 648: Frameless image caption with a link
9237 !! input
9238 [[Image:foobar.jpg|text with a [[link]] in it]]
9239 !! result
9240 <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>
9241 </p>
9242 !! end
9243
9244 !! test
9245 BUG 648: Frameless image caption with a link (suffix)
9246 !! input
9247 [[Image:foobar.jpg|text with a [[link]]foo in it]]
9248 !! result
9249 <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>
9250 </p>
9251 !! end
9252
9253 !! test
9254 BUG 648: Frameless image caption with an interwiki link
9255 !! input
9256 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
9257 !! result
9258 <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>
9259 </p>
9260 !! end
9261
9262 !! test
9263 BUG 648: Frameless image caption with a piped interwiki link
9264 !! input
9265 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
9266 !! result
9267 <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>
9268 </p>
9269 !! end
9270
9271 !! test
9272 Escape HTML special chars in image alt text
9273 !! input
9274 [[Image:foobar.jpg|& < > "]]
9275 !! result
9276 <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>
9277 </p>
9278 !! end
9279
9280 !! test
9281 BUG 499: Alt text should have &#1234;, not &amp;1234;
9282 !! input
9283 [[Image:foobar.jpg|&#9792;]]
9284 !! result
9285 <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>
9286 </p>
9287 !! end
9288
9289 !! test
9290 Broken image caption with link
9291 !! input
9292 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
9293 !! result
9294 <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.
9295 </p>
9296 !! end
9297
9298 !! test
9299 Image caption containing another image
9300 !! input
9301 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
9302 !! result
9303 <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>
9304
9305 !! end
9306
9307 !! test
9308 Image caption containing a newline
9309 !! input
9310 [[Image:Foobar.jpg|This
9311 *is some text]]
9312 !! result
9313 <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>
9314 </p>
9315 !!end
9316
9317 !!test
9318 Parsoid: Image caption containing leading space
9319 (The leading space should not trigger nowiki escaping in wt2wt mode)
9320 !! input
9321 [[Image:Foobar.jpg|thumb| bar]]
9322 !! result
9323 <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>
9324
9325 !!end
9326
9327 !! test
9328 Bug 3090: External links other than http: in image captions
9329 !! input
9330 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
9331 !! result
9332 <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>
9333
9334 !! end
9335
9336 !! test
9337 Custom class
9338 !! input
9339 [[Image:foobar.jpg|a|class=b]]
9340 !! result
9341 <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>
9342 </p>
9343 !! end
9344
9345 !! test
9346 Localized image handling (1).
9347 !! options
9348 language=es
9349 !! input
9350 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
9351 !! result
9352 <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>
9353
9354 !! end
9355
9356 !! test
9357 Localized image handling (2).
9358 !! options
9359 language=es
9360 !! input
9361 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
9362 !! result
9363 <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>
9364
9365 !! end
9366
9367 !! test
9368 "border", "frameless" and "class" attributes on an image.
9369 !! input
9370 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
9371 !! result
9372 <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>
9373 </p>
9374 !! end
9375
9376 !! article
9377 File:Barfoo.jpg
9378 !! text
9379 #REDIRECT [[File:Barfoo.jpg]]
9380 !! endarticle
9381
9382 !! test
9383 Redirected image
9384 !! input
9385 [[Image:Barfoo.jpg]]
9386 !! result
9387 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
9388 </p>
9389 !! end
9390
9391 !! test
9392 Missing image with uploads disabled
9393 !! options
9394 wgEnableUploads=0
9395 !! input
9396 [[Image:Foobaz.jpg]]
9397 !! result
9398 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
9399 </p>
9400 !! end
9401
9402 # Parsoid-specific testing for images
9403 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9404 # Currently imperfect due to a flaw in the Parsoid testrunner
9405 # Work in progress
9406 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
9407 # image tests.
9408
9409 !! test
9410 Parsoid-specific image handling - simple image with size and middle alignment
9411 !! options
9412 parsoid
9413 !! input
9414 [[Image:Foobar.jpg|50px|middle]]
9415 !! result
9416 <p>
9417 <span class="mw-valign-middle" typeof="mw:Image">
9418 <a href="File:Foobar.jpg">
9419 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
9420 </a>
9421 </span>
9422 </p>
9423 !! end
9424
9425 !! test
9426 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
9427 !! options
9428 parsoid
9429 !! input
9430 [[Image:Foobar.jpg|500x10px|baseline|caption]]
9431 !! result
9432 <p>
9433 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9434 <a href="File:Foobar.jpg">
9435 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
9436 </a>
9437 </span>
9438 </p>
9439 !! end
9440
9441 !! test
9442 Parsoid-specific image handling - simple image with border and size spec
9443 !! options
9444 parsoid
9445 !! input
9446 [[Image:Foobar.jpg|50px|border|caption]]
9447 !! result
9448 <p>
9449 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9450 <a href="File:Foobar.jpg">
9451 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
9452 </a>
9453 </span>
9454 </p>
9455 !! end
9456
9457 !! test
9458 Parsoid-specific image handling - thumbnail with halign, valign, and caption
9459 !! options
9460 parsoid
9461 !! input
9462 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
9463 !! result
9464 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
9465 <a href="File:Foobar.jpg">
9466 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
9467 </a>
9468 <figcaption>caption content</figcaption>
9469 </figure>
9470 !! end
9471
9472 !! test
9473 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
9474 !! options
9475 parsoid
9476 !! input
9477 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
9478 !! result
9479 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
9480 <a href="File:Foobar.jpg">
9481 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
9482 </a>
9483 <figcaption>caption</figcaption>
9484 </figure>
9485 !! end
9486
9487 !! test
9488 Parsoid-specific image handling - framed image with specific size and caption
9489 !! options
9490 parsoid
9491 !! input
9492 [[Image:Foobar.jpg|500x50px|frame|caption]]
9493 !! result
9494 <figure typeof="mw:Image/Frame">
9495 <a href="File:Foobar.jpg">
9496 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9497 </a>
9498 <figcaption>caption</figcaption>
9499 </figure>
9500 !! end
9501
9502 !! test
9503 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
9504 !! options
9505 parsoid
9506 !! input
9507 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
9508 !! result
9509 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
9510 <a href="File:Foobar.jpg">
9511 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9512 </a>
9513 <figcaption>caption</figcaption>
9514 </figure>
9515 !! end
9516
9517 !! test
9518 Parsoid-specific image handling - frameless image with specific size, border, and caption
9519 !! options
9520 parsoid
9521 !! input
9522 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
9523 !! result
9524 <p>
9525 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9526 <a href="File:Foobar.jpg">
9527 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9528 </a>
9529 </p>
9530 !! end
9531
9532 #!! test
9533 #Parsoid-specific image handling - simple image with a formatted caption
9534 #!! options
9535 #parsoid
9536 #!! input
9537 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
9538 #!! result
9539 #<p>
9540 #<span typeof="mw:Image">
9541 #<a class="mw-default-size" href="Image:Foobar.jpg">
9542 #<img alt="Foobar.jpg" class="mw-default-size" src="http://example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
9543 #</a>
9544 #<span>abc</span>
9545 #</span>
9546 #</p>
9547
9548
9549 ###
9550 ### Subpages
9551 ###
9552 !! article
9553 Subpage test/subpage
9554 !! text
9555 foo
9556 !! endarticle
9557
9558 !! test
9559 Subpage link
9560 !! options
9561 subpage title=[[Subpage test]]
9562 !! input
9563 [[/subpage]]
9564 !! result
9565 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
9566 </p>
9567 !! end
9568
9569 !! test
9570 Subpage noslash link
9571 !! options
9572 subpage title=[[Subpage test]]
9573 !!input
9574 [[/subpage/]]
9575 !! result
9576 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
9577 </p>
9578 !! end
9579
9580 # TODO: make this PHP-parser compatible!
9581 !! test
9582 Relative subpage noslash link
9583 !! options
9584 parsoid=wt2wt,wt2html,html2html
9585 subpage title=[[Subpage test/1/2/3/4]]
9586 !!input
9587 [[../../subpage/]]
9588
9589 [[../../subpage]]
9590 !! result
9591 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
9592 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
9593 !! end
9594
9595 # TODO: make this PHP-parser compatible!
9596 !! test
9597 Parsoid: dot-slash prefixed wikilinks
9598 !! options
9599 parsoid=wt2wt,wt2html,html2html
9600 !!input
9601 [[./foo]]
9602
9603 [[././bar]]
9604
9605 [[././baz/]]
9606 !! result
9607 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
9608 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
9609 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
9610 !! end
9611
9612 !! test
9613 Disabled subpages
9614 !! input
9615 [[/subpage]]
9616 !! result
9617 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
9618 </p>
9619 !! end
9620
9621 !! test
9622 BUG 561: {{/Subpage}}
9623 !! options
9624 subpage title=[[Page]]
9625 !! input
9626 {{/Subpage}}
9627 !! result
9628 <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>
9629 </p>
9630 !! end
9631
9632 ###
9633 ### Categories
9634 ###
9635 !! article
9636 Category:MediaWiki User's Guide
9637 !! text
9638 blah
9639 !! endarticle
9640
9641 !! test
9642 Link to category
9643 !! input
9644 [[:Category:MediaWiki User's Guide]]
9645 !! result
9646 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
9647 </p>
9648 !! end
9649
9650 !! test
9651 Simple category
9652 !! options
9653 cat
9654 !! input
9655 [[Category:MediaWiki User's Guide]]
9656 !! result
9657 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9658 !! end
9659
9660 !! test
9661 PAGESINCATEGORY invalid title fatal (r33546 fix)
9662 !! input
9663 {{PAGESINCATEGORY:<bogus>}}
9664 !! result
9665 <p>0
9666 </p>
9667 !! end
9668
9669 !! test
9670 Category with different sort key
9671 !! options
9672 cat
9673 !! input
9674 [[Category:MediaWiki User's Guide|Foo]]
9675 !! result
9676 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9677 !! end
9678
9679 !! test
9680 Category with identical sort key
9681 !! options
9682 cat
9683 !! input
9684 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9685 !! result
9686 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9687 !! end
9688
9689 !! test
9690 Category with empty sort key
9691 !! options
9692 cat
9693 pst
9694 !! input
9695 [[Category:MediaWiki User's Guide|]]
9696 !! result
9697 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9698 !! end
9699
9700 !! test
9701 Category with empty sort key and parentheses
9702 !! options
9703 cat
9704 pst
9705 !! input
9706 [[Category:Foo (bar)|]]
9707 !! result
9708 [[Category:Foo (bar)|Foo]]
9709 !! end
9710
9711 !! test
9712 Category with link tail
9713 !! options
9714 cat
9715 pst
9716 !! input
9717 123[[Category:Foo]]456
9718 !! result
9719 123[[Category:Foo]]456
9720 !! end
9721
9722 !! test
9723 Category with template
9724 !! options
9725 cat
9726 pst
9727 !! input
9728 [[Category:{{echo|Foo}}]]
9729 !! result
9730 [[Category:{{echo|Foo}}]]
9731 !! end
9732
9733 !! test
9734 Category with template in sort key
9735 !! options
9736 cat
9737 pst
9738 !! input
9739 [[Category:Foo|{{echo|Bar}}]]
9740 !! result
9741 [[Category:Foo|{{echo|Bar}}]]
9742 !! end
9743
9744 !! test
9745 Category with template in sort key and title
9746 !! options
9747 cat
9748 pst
9749 !! input
9750 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9751 !! result
9752 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9753 !! end
9754
9755 !! test
9756 Category / paragraph interactions
9757 !! input
9758 Foo [[Category:Baz]] Bar
9759
9760 Foo [[Category:Baz]]
9761 Bar
9762
9763 Foo
9764 [[Category:Baz]]
9765 Bar
9766
9767 Foo
9768 [[Category:Baz]] Bar
9769
9770 Foo
9771 [[Category:Baz]]
9772 [[Category:Baz]]
9773 [[Category:Baz]]
9774 Bar
9775
9776 [[Category:Baz]]
9777 [[Category:Baz]]
9778 [[Category:Baz]]
9779
9780 [[Category:Baz]]
9781 {{echo|[[Category:Baz]]}}
9782 [[Category:Baz]]
9783 !! result
9784 <p>Foo Bar
9785 </p><p>Foo
9786 Bar
9787 </p><p>Foo
9788 Bar
9789 </p><p>Foo Bar
9790 </p><p>Foo
9791 Bar
9792 </p>
9793 !! end
9794
9795 !! test
9796 Parsoid: Serialize link to category page with colon escape
9797 !! options
9798 parsoid
9799 !! input
9800
9801 [[:Category:Foo]]
9802 [[:Category:Foo|Bar]]
9803 !! result
9804 <p>
9805 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
9806 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
9807 </p>
9808 !! end
9809
9810 !! test
9811 Parsoid: Link prefix/suffixes aren't applied to category links
9812 !! options
9813 parsoid=wt2html,wt2wt,html2html
9814 language=is
9815 !! input
9816 x[[Category:Foo]]y
9817 !! result
9818 <p>x<link rel="mw:WikiLink/Category" href="Category:Foo">y</p>
9819 !! end
9820
9821 !! test
9822 Parsoid: Serialize link to file page with colon escape
9823 !! options
9824 parsoid
9825 !! input
9826
9827 [[:File:Foo.png]]
9828 [[:File:Foo.png|Bar]]
9829 !! result
9830 <p>
9831 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
9832 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
9833 </p>
9834 !! end
9835
9836 !! test
9837 Parsoid: Serialize a genuine category link without colon escape
9838 !! options
9839 parsoid
9840 !! input
9841 [[Category:Foo]]
9842 [[Category:Foo|Bar]]
9843 !! result
9844 <link rel="mw:WikiLink/Category" href="Category:Foo">
9845 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
9846 !! end
9847
9848 ###
9849 ### Inter-language links
9850 ###
9851 !! test
9852 Inter-language links
9853 !! options
9854 ill
9855 !! input
9856 [[es:Alimento]]
9857 [[fr:Nourriture]]
9858 [[zh:&#39135;&#21697;]]
9859 !! result
9860 es:Alimento fr:Nourriture zh:食品
9861 !! end
9862
9863 !! test
9864 Duplicate interlanguage links (bug 24502)
9865 !! options
9866 ill
9867 !! input
9868 [[es:1]]
9869 [[es:2]]
9870 [[fr:1]]
9871 [[fr:2]]
9872 !! result
9873 es:1 fr:1
9874 !! end
9875
9876 ###
9877 ### Sections
9878 ###
9879 !! test
9880 Basic section headings
9881 !! input
9882 == Headline 1 ==
9883 Some text
9884
9885 ==Headline 2==
9886 More
9887 ===Smaller headline===
9888 Blah blah
9889 !! result
9890 <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>
9891 <p>Some text
9892 </p>
9893 <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>
9894 <p>More
9895 </p>
9896 <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>
9897 <p>Blah blah
9898 </p>
9899 !! end
9900
9901 !! test
9902 Section headings with TOC
9903 !! input
9904 == Headline 1 ==
9905 === Subheadline 1 ===
9906 ===== Skipping a level =====
9907 ====== Skipping a level ======
9908
9909 == Headline 2 ==
9910 Some text
9911 ===Another headline===
9912 !! result
9913 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9914 <ul>
9915 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
9916 <ul>
9917 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
9918 <ul>
9919 <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>
9920 <ul>
9921 <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>
9922 </ul>
9923 </li>
9924 </ul>
9925 </li>
9926 </ul>
9927 </li>
9928 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
9929 <ul>
9930 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
9931 </ul>
9932 </li>
9933 </ul>
9934 </div>
9935 <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>
9936 <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>
9937 <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>
9938 <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>
9939 <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>
9940 <p>Some text
9941 </p>
9942 <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>
9943
9944 !! end
9945
9946 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
9947 !! test
9948 Handling of sections up to level 6 and beyond
9949 !! input
9950 = Level 1 Heading=
9951 == Level 2 Heading==
9952 === Level 3 Heading===
9953 ==== Level 4 Heading====
9954 ===== Level 5 Heading=====
9955 ====== Level 6 Heading======
9956 ======= Level 7 Heading=======
9957 ======== Level 8 Heading========
9958 ========= Level 9 Heading=========
9959 ========== Level 10 Heading==========
9960 !! result
9961 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9962 <ul>
9963 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
9964 <ul>
9965 <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>
9966 <ul>
9967 <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>
9968 <ul>
9969 <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>
9970 <ul>
9971 <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>
9972 <ul>
9973 <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>
9974 <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>
9975 <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>
9976 <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>
9977 <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>
9978 </ul>
9979 </li>
9980 </ul>
9981 </li>
9982 </ul>
9983 </li>
9984 </ul>
9985 </li>
9986 </ul>
9987 </li>
9988 </ul>
9989 </div>
9990 <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>
9991 <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>
9992 <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>
9993 <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>
9994 <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>
9995 <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>
9996 <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>
9997 <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>
9998 <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>
9999 <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>
10000
10001 !! end
10002
10003 !! test
10004 TOC regression (bug 9764)
10005 !! input
10006 == title 1 ==
10007 === title 1.1 ===
10008 ==== title 1.1.1 ====
10009 === title 1.2 ===
10010 == title 2 ==
10011 === title 2.1 ===
10012 !! result
10013 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10014 <ul>
10015 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10016 <ul>
10017 <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>
10018 <ul>
10019 <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>
10020 </ul>
10021 </li>
10022 <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>
10023 </ul>
10024 </li>
10025 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
10026 <ul>
10027 <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>
10028 </ul>
10029 </li>
10030 </ul>
10031 </div>
10032 <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>
10033 <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>
10034 <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>
10035 <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>
10036 <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>
10037 <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>
10038
10039 !! end
10040
10041 !! test
10042 TOC with wgMaxTocLevel=3 (bug 6204)
10043 !! options
10044 wgMaxTocLevel=3
10045 !! input
10046 == title 1 ==
10047 === title 1.1 ===
10048 ==== title 1.1.1 ====
10049 === title 1.2 ===
10050 == title 2 ==
10051 === title 2.1 ===
10052 !! result
10053 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10054 <ul>
10055 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10056 <ul>
10057 <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>
10058 <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>
10059 </ul>
10060 </li>
10061 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
10062 <ul>
10063 <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>
10064 </ul>
10065 </li>
10066 </ul>
10067 </div>
10068 <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>
10069 <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>
10070 <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>
10071 <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>
10072 <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>
10073 <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>
10074
10075 !! end
10076
10077 !! test
10078 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
10079 !! options
10080 wgMaxTocLevel=3
10081 !! input
10082 ==Section 1==
10083 ===Section 1.1===
10084 ====Section 1.1.1====
10085 ====Section 1.1.1.1====
10086 ==Section 2==
10087 !! result
10088 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10089 <ul>
10090 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
10091 <ul>
10092 <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>
10093 </ul>
10094 </li>
10095 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
10096 </ul>
10097 </div>
10098 <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>
10099 <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>
10100 <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>
10101 <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>
10102 <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>
10103
10104 !! end
10105
10106
10107 !! test
10108 Resolving duplicate section names
10109 !! input
10110 == Foo bar ==
10111 == Foo bar ==
10112 !! result
10113 <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>
10114 <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>
10115
10116 !! end
10117
10118 !! test
10119 Resolving duplicate section names with differing case (bug 10721)
10120 !! input
10121 == Foo bar ==
10122 == Foo Bar ==
10123 !! result
10124 <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>
10125 <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>
10126
10127 !! end
10128
10129 !! article
10130 Template:sections
10131 !! text
10132 ===Section 1===
10133 ==Section 2==
10134 !! endarticle
10135
10136 !! test
10137 Template with sections, __NOTOC__
10138 !! input
10139 __NOTOC__
10140 ==Section 0==
10141 {{sections}}
10142 ==Section 4==
10143 !! result
10144 <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>
10145 <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>
10146 <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>
10147 <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>
10148
10149 !! end
10150
10151 !! test
10152 __NOEDITSECTION__ keyword
10153 !! input
10154 __NOEDITSECTION__
10155 ==Section 1==
10156 ==Section 2==
10157 !! result
10158 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
10159 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
10160
10161 !! end
10162
10163 !! test
10164 Link inside a section heading
10165 !! input
10166 ==Section with a [[Main Page|link]] in it==
10167 !! result
10168 <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>
10169
10170 !! end
10171
10172 !! test
10173 TOC regression (bug 12077)
10174 !! input
10175 __TOC__
10176 == title 1 ==
10177 === title 1.1 ===
10178 == title 2 ==
10179 !! result
10180 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10181 <ul>
10182 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10183 <ul>
10184 <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>
10185 </ul>
10186 </li>
10187 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
10188 </ul>
10189 </div>
10190 <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>
10191 <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>
10192 <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>
10193
10194 !! end
10195
10196 !! test
10197 BUG 1219 URL next to image (good)
10198 !! input
10199 http://example.com [[Image:foobar.jpg]]
10200 !! result
10201 <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>
10202 </p>
10203 !!end
10204
10205 !! test
10206 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
10207 !! input
10208 ===
10209 The line above must have a trailing space!
10210 === <!--
10211 --> <!-- -->
10212 But just in case it doesn't...
10213 !! result
10214 <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>
10215 <p>The line above must have a trailing space!
10216 </p>
10217 <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>
10218 <p>But just in case it doesn't...
10219 </p>
10220 !! end
10221
10222 !! test
10223 Header with special characters (bug 25462)
10224 !! input
10225 The tooltips shall not show entities to the user (ie. be double escaped)
10226
10227 == text > text ==
10228 section 1
10229
10230 == text < text ==
10231 section 2
10232
10233 == text & text ==
10234 section 3
10235
10236 == text ' text ==
10237 section 4
10238
10239 == text " text ==
10240 section 5
10241 !! result
10242 <p>The tooltips shall not show entities to the user (ie. be double escaped)
10243 </p>
10244 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10245 <ul>
10246 <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>
10247 <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>
10248 <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>
10249 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
10250 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
10251 </ul>
10252 </div>
10253 <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>
10254 <p>section 1
10255 </p>
10256 <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>
10257 <p>section 2
10258 </p>
10259 <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>
10260 <p>section 3
10261 </p>
10262 <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>
10263 <p>section 4
10264 </p>
10265 <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>
10266 <p>section 5
10267 </p>
10268 !! end
10269
10270 !! test
10271 Headers with excess '=' characters
10272 (Are similar tests necessary beyond the 1st level?)
10273 !! input
10274 =foo==
10275 ==foo=
10276 =''italic'' heading==
10277 ==''italic'' heading=
10278 !! result
10279 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10280 <ul>
10281 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
10282 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
10283 <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>
10284 <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>
10285 </ul>
10286 </div>
10287 <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>
10288 <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>
10289 <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>
10290 <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>
10291
10292 !! end
10293
10294 !! test
10295 HTML headers vs TOC (bug 23393)
10296 (__NOEDITSECTION__ for clearer output, doesn't matter here)
10297 !! input
10298 <h1>Header 1</h1>
10299 == Header 1.1 ==
10300 == Header 1.2 ==
10301
10302 <h1>Header 2
10303 </h1>
10304 == Header 2.1 ==
10305 == Header 2.2 ==
10306 __NOEDITSECTION__
10307 !! result
10308 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10309 <ul>
10310 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
10311 <ul>
10312 <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>
10313 <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>
10314 </ul>
10315 </li>
10316 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
10317 <ul>
10318 <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>
10319 <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>
10320 </ul>
10321 </li>
10322 </ul>
10323 </div>
10324 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
10325 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
10326 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
10327 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
10328 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
10329 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
10330
10331 !! end
10332
10333 !! test
10334 BUG 1219 URL next to image (broken)
10335 !! input
10336 http://example.com[[Image:foobar.jpg]]
10337 !! result
10338 <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>
10339 </p>
10340 !!end
10341
10342 !! test
10343 Bug 1186 news: in the middle of text
10344 !! input
10345 http://en.wikinews.org/wiki/Wikinews:Workplace
10346 !! result
10347 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
10348 </p>
10349 !!end
10350
10351
10352 !! test
10353 Namespaced link must have a title
10354 !! input
10355 [[Project:]]
10356 !! result
10357 <p>[[Project:]]
10358 </p>
10359 !!end
10360
10361 !! test
10362 Namespaced link must have a title (bad fragment version)
10363 !! input
10364 [[Project:#fragment]]
10365 !! result
10366 <p>[[Project:#fragment]]
10367 </p>
10368 !!end
10369
10370
10371 ###
10372 ### HTML tags and HTML attributes
10373 ###
10374
10375 !! test
10376 div with no attributes
10377 !! input
10378 <div>HTML rocks</div>
10379 !! result
10380 <div>HTML rocks</div>
10381
10382 !! end
10383
10384 !! test
10385 div with double-quoted attribute
10386 !! input
10387 <div id="rock">HTML rocks</div>
10388 !! result
10389 <div id="rock">HTML rocks</div>
10390
10391 !! end
10392
10393 !! test
10394 div with single-quoted attribute
10395 !! input
10396 <div id='rock'>HTML rocks</div>
10397 !! result
10398 <div id="rock">HTML rocks</div>
10399
10400 !! end
10401
10402 !! test
10403 div with unquoted attribute
10404 !! input
10405 <div id=rock>HTML rocks</div>
10406 !! result
10407 <div id="rock">HTML rocks</div>
10408
10409 !! end
10410
10411 !! test
10412 div with illegal double attributes
10413 !! input
10414 <div id="a" id="b">HTML rocks</div>
10415 !! result
10416 <div id="b">HTML rocks</div>
10417
10418 !!end
10419
10420 # FIXME: produce empty string instead of "class" in the PHP parser, following
10421 # the HTML5 spec.
10422 !! test
10423 div with empty attribute value, space before equals
10424 !! options
10425 parsoid
10426 !! input
10427 <div class =>HTML rocks</div>
10428 !! result
10429 <div class="">HTML rocks</div>
10430
10431 !! end
10432
10433 # The PHP parser escapes the opening brace to &#123; for some reason, so
10434 # disabled this test for it.
10435 !! test
10436 div with braces in attribute value
10437 !! options
10438 parsoid
10439 !! input
10440 <div title="{}">Foo</div>
10441 !! result
10442 <div title="{}">Foo</div>
10443 !! end
10444
10445 # This it very inconsistent in the PHP parser: it returns
10446 # class="class" if there is a space between the name and the equal sign (see
10447 # 'div with empty attribute value, space before equals'), but strips the
10448 # attribute completely if the space is missing. We hope that not much content
10449 # depends on this, so are implementing the behavior below in Parsoid for
10450 # consistencies' sake. Disabled for the PHP parser.
10451 # FIXME: fix this behavior in the PHP parser?
10452 !! test
10453 div with empty attribute value, no space before equals
10454 !! options
10455 parsoid
10456 !! input
10457 <div class=>HTML rocks</div>
10458 !! result
10459 <div class="">HTML rocks</div>
10460
10461 !! end
10462
10463 !! test
10464 HTML multiple attributes correction
10465 !! input
10466 <p class="error" class="awesome">Awesome!</p>
10467 !! result
10468 <p class="awesome">Awesome!</p>
10469
10470 !!end
10471
10472 !! test
10473 Table multiple attributes correction
10474 !! input
10475 {|
10476 !+ class="error" class="awesome"| status
10477 |}
10478 !! result
10479 <table>
10480 <tr>
10481 <th class="awesome"> status
10482 </th></tr></table>
10483
10484 !!end
10485
10486 !! test
10487 DIV IN UPPERCASE
10488 !! input
10489 <DIV ID="x">HTML ROCKS</DIV>
10490 !! result
10491 <div id="x">HTML ROCKS</div>
10492
10493 !!end
10494
10495 !! test
10496 Non-ASCII pseudo-tags are rendered as text
10497 !! input
10498 <khyô>
10499 !! result
10500 <p>&lt;khyô&gt;
10501 </p>
10502 !! end
10503
10504 !! test
10505 Pseudo-tag with URL 'name' renders as url link
10506 !! input
10507 <http://example.com/>
10508 !! result
10509 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
10510 </p>
10511 !! end
10512
10513 !! test
10514 text with amp in the middle of nowhere
10515 !! input
10516 Remember AT&T?
10517 !!result
10518 <p>Remember AT&amp;T?
10519 </p>
10520 !! end
10521
10522 !! test
10523 text with character entity: eacute
10524 !! input
10525 I always thought &eacute; was a cute letter.
10526 !! result
10527 <p>I always thought &#233; was a cute letter.
10528 </p>
10529 !! end
10530
10531 !! test
10532 text with entity-escaped character entity-like string: eacute
10533 !! input
10534 I always thought &amp;eacute; was a cute letter.
10535 !! result
10536 <p>I always thought &amp;eacute; was a cute letter.
10537 </p>
10538 !! end
10539
10540 !! test
10541 text with undefined character entity: xacute
10542 !! input
10543 I always thought &xacute; was a cute letter.
10544 !! result
10545 <p>I always thought &amp;xacute; was a cute letter.
10546 </p>
10547 !! end
10548
10549
10550 ###
10551 ### Nesting tests (see bug 41545, 50604, 51081)
10552 ###
10553
10554 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
10555 # Note that html2wt is considerably more difficult if we use <b> in
10556 # the test case, instead of <big>
10557 !! test
10558 Ensure that HTML adoption agency algorithm is properly implemented.
10559 !! input
10560 <big>X<big>Y</big>Z</big>
10561 !! result
10562 <p><big>X<big>Y</big>Z</big>
10563 </p>
10564 !! end
10565
10566 # This was bug 41545 in the PHP parser.
10567 !! test
10568 Nesting of <kbd>
10569 !! input
10570 <kbd>X<kbd>Y</kbd>Z</kbd>
10571 !! result
10572 <p><kbd>X<kbd>Y</kbd>Z</kbd>
10573 </p>
10574 !! end
10575
10576 # The following cases were bug 51081 in the PHP parser.
10577 # Note that there are some other nestable tags (b, i, etc) which are
10578 # not covered; see bug 51081 for discussion.
10579 !! test
10580 Nesting of <em>
10581 !! input
10582 <em>X<em>Y</em>Z</em>
10583 !! result
10584 <p><em>X<em>Y</em>Z</em>
10585 </p>
10586 !! end
10587
10588 !! test
10589 Nesting of <strong>
10590 !! input
10591 <strong>X<strong>Y</strong>Z</strong>
10592 !! result
10593 <p><strong>X<strong>Y</strong>Z</strong>
10594 </p>
10595 !! end
10596
10597 !! test
10598 Nesting of <q>
10599 !! input
10600 <q>X<q>Y</q>Z</q>
10601 !! result
10602 <p><q>X<q>Y</q>Z</q>
10603 </p>
10604 !! end
10605
10606 !! test
10607 Nesting of <ruby>
10608 !! input
10609 <ruby>X<ruby>Y</ruby>Z</ruby>
10610 !! result
10611 <p><ruby>X<ruby>Y</ruby>Z</ruby>
10612 </p>
10613 !! end
10614
10615 !! test
10616 Nesting of <bdo>
10617 !! input
10618 <bdo>X<bdo>Y</bdo>Z</bdo>
10619 !! result
10620 <p><bdo>X<bdo>Y</bdo>Z</bdo>
10621 </p>
10622 !! end
10623
10624
10625 ###
10626 ### Media links
10627 ###
10628
10629 !! test
10630 Media link
10631 !! input
10632 [[Media:Foobar.jpg]]
10633 !! result
10634 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
10635 </p>
10636 !! end
10637
10638 !! test
10639 Media link with text
10640 !! input
10641 [[Media:Foobar.jpg|A neat file to look at]]
10642 !! result
10643 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
10644 </p>
10645 !! end
10646
10647 # FIXME: this is still bad HTML tag nesting
10648 !! test
10649 Media link with nasty text
10650 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
10651 !! input
10652 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
10653 !! result
10654 <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>
10655
10656 !! end
10657
10658 !! test
10659 Media link to nonexistent file (bug 1702)
10660 !! input
10661 [[Media:No such.jpg]]
10662 !! result
10663 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
10664 </p>
10665 !! end
10666
10667 !! test
10668 Image link to nonexistent file (bug 1850 - good)
10669 !! input
10670 [[Image:No such.jpg]]
10671 !! result
10672 <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>
10673 </p>
10674 !! end
10675
10676 !! test
10677 :Image link to nonexistent file (bug 1850 - bad)
10678 !! input
10679 [[:Image:No such.jpg]]
10680 !! result
10681 <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>
10682 </p>
10683 !! end
10684
10685
10686
10687 !! test
10688 Character reference normalization in link text (bug 1938)
10689 !! input
10690 [[Main Page|this&that]]
10691 !! result
10692 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
10693 </p>
10694 !!end
10695
10696 !! article
10697 אַ
10698 !! text
10699 Test for unicode normalization
10700
10701 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
10702 !! endarticle
10703
10704 !! test
10705 (bug 19451) Links should refer to the normalized form.
10706 !! input
10707 [[&#xFB2E;]]
10708 [[&#x5d0;&#x5b7;]]
10709 [[&#x5d0;ַ]]
10710 [[א&#x5b7;]]
10711 [[אַ]]
10712 !! result
10713 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
10714 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
10715 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
10716 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
10717 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
10718 </p>
10719 !! end
10720
10721 !! test
10722 Empty attribute crash test (bug 2067)
10723 !! input
10724 <font color="">foo</font>
10725 !! result
10726 <p><font color="">foo</font>
10727 </p>
10728 !! end
10729
10730 !! test
10731 Empty attribute crash test single-quotes (bug 2067)
10732 !! input
10733 <font color=''>foo</font>
10734 !! result
10735 <p><font color="">foo</font>
10736 </p>
10737 !! end
10738
10739 !! test
10740 Attribute test: equals, then nothing
10741 !! input
10742 <font color=>foo</font>
10743 !! result
10744 <p><font>foo</font>
10745 </p>
10746 !! end
10747
10748 !! test
10749 Attribute test: unquoted value
10750 !! input
10751 <font color=x>foo</font>
10752 !! result
10753 <p><font color="x">foo</font>
10754 </p>
10755 !! end
10756
10757 !! test
10758 Attribute test: unquoted but illegal value (hash)
10759 !! input
10760 <font color=#x>foo</font>
10761 !! result
10762 <p><font color="#x">foo</font>
10763 </p>
10764 !! end
10765
10766 !! test
10767 Attribute test: no value
10768 !! input
10769 <font color>foo</font>
10770 !! result
10771 <p><font color="color">foo</font>
10772 </p>
10773 !! end
10774
10775 !! test
10776 Bug 2095: link with three closing brackets
10777 !! input
10778 [[Main Page]]]
10779 !! result
10780 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
10781 </p>
10782 !! end
10783
10784 !! test
10785 Bug 2095: link with pipe and three closing brackets
10786 !! input
10787 [[Main Page|link]]]
10788 !! result
10789 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
10790 </p>
10791 !! end
10792
10793 !! test
10794 Bug 2095: link with pipe and three closing brackets, version 2
10795 !! input
10796 [[Main Page|[http://example.com/]]]
10797 !! result
10798 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
10799 </p>
10800 !! end
10801
10802
10803 ###
10804 ### Safety
10805 ###
10806
10807 !! article
10808 Template:Dangerous attribute
10809 !! text
10810 " onmouseover="alert(document.cookie)
10811 !! endarticle
10812
10813 !! article
10814 Template:Dangerous style attribute
10815 !! text
10816 border-size: expression(alert(document.cookie))
10817 !! endarticle
10818
10819 !! article
10820 Template:Div style
10821 !! text
10822 <div style="float: right; {{{1}}}">Magic div</div>
10823 !! endarticle
10824
10825 !! test
10826 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
10827 !! input
10828 <div title="{{test}}"></div>
10829 !! result
10830 <div title="This is a test template"></div>
10831
10832 !! end
10833
10834 !! test
10835 Bug 2304: HTML attribute safety (dangerous template; 2309)
10836 !! input
10837 <div title="{{dangerous attribute}}"></div>
10838 !! result
10839 <div title=""></div>
10840
10841 !! end
10842
10843 !! test
10844 Bug 2304: HTML attribute safety (dangerous style template; 2309)
10845 !! input
10846 <div style="{{dangerous style attribute}}"></div>
10847 !! result
10848 <div style="/* insecure input */"></div>
10849
10850 !! end
10851
10852 !! test
10853 Bug 2304: HTML attribute safety (safe parameter; 2309)
10854 !! input
10855 {{div style|width: 200px}}
10856 !! result
10857 <div style="float: right; width: 200px">Magic div</div>
10858
10859 !! end
10860
10861 !! test
10862 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
10863 !! input
10864 {{div style|width: expression(alert(document.cookie))}}
10865 !! result
10866 <div style="/* insecure input */">Magic div</div>
10867
10868 !! end
10869
10870 !! test
10871 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
10872 !! input
10873 {{div style|"><script>alert(document.cookie)</script>}}
10874 !! result
10875 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10876
10877 !! end
10878
10879 !! test
10880 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
10881 !! input
10882 {{div style|" ><script>alert(document.cookie)</script>}}
10883 !! result
10884 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10885
10886 !! end
10887
10888 !! test
10889 Bug 2304: HTML attribute safety (link)
10890 !! input
10891 <div title="[[Main Page]]"></div>
10892 !! result
10893 <div title="&#91;&#91;Main Page]]"></div>
10894
10895 !! end
10896
10897 !! test
10898 Bug 2304: HTML attribute safety (italics)
10899 !! input
10900 <div title="''foobar''"></div>
10901 !! result
10902 <div title="&#39;&#39;foobar&#39;&#39;"></div>
10903
10904 !! end
10905
10906 !! test
10907 Bug 2304: HTML attribute safety (bold)
10908 !! input
10909 <div title="'''foobar'''"></div>
10910 !! result
10911 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
10912
10913 !! end
10914
10915
10916 !! test
10917 Bug 2304: HTML attribute safety (ISBN)
10918 !! input
10919 <div title="ISBN 1234567890"></div>
10920 !! result
10921 <div title="&#73;SBN 1234567890"></div>
10922
10923 !! end
10924
10925 !! test
10926 Bug 2304: HTML attribute safety (RFC)
10927 !! input
10928 <div title="RFC 1234"></div>
10929 !! result
10930 <div title="&#82;FC 1234"></div>
10931
10932 !! end
10933
10934 !! test
10935 Bug 2304: HTML attribute safety (PMID)
10936 !! input
10937 <div title="PMID 1234567890"></div>
10938 !! result
10939 <div title="&#80;MID 1234567890"></div>
10940
10941 !! end
10942
10943 !! test
10944 Bug 2304: HTML attribute safety (web link)
10945 !! input
10946 <div title="http://example.com/"></div>
10947 !! result
10948 <div title="http&#58;//example.com/"></div>
10949
10950 !! end
10951
10952 !! test
10953 Bug 2304: HTML attribute safety (named web link)
10954 !! input
10955 <div title="[http://example.com/ link]"></div>
10956 !! result
10957 <div title="&#91;http&#58;//example.com/ link]"></div>
10958
10959 !! end
10960
10961 !! test
10962 Bug 3244: HTML attribute safety (extension; safe)
10963 !! input
10964 <div style="<nowiki>background:blue</nowiki>"></div>
10965 !! result
10966 <div style="background:blue"></div>
10967
10968 !! end
10969
10970 !! test
10971 Bug 3244: HTML attribute safety (extension; unsafe)
10972 !! input
10973 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
10974 !! result
10975 <div style="/* insecure input */"></div>
10976
10977 !! end
10978
10979 # More MSIE fun discovered by Tom Gilder
10980
10981 !! test
10982 MSIE CSS safety test: spurious slash
10983 !! input
10984 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
10985 !! result
10986 <div style="/* insecure input */">evil</div>
10987
10988 !! end
10989
10990 !! test
10991 MSIE CSS safety test: hex code
10992 !! input
10993 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
10994 !! result
10995 <div style="/* insecure input */">evil</div>
10996
10997 !! end
10998
10999 !! test
11000 MSIE CSS safety test: comment in url
11001 !! input
11002 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
11003 !! result
11004 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
11005
11006 !! end
11007
11008 !! test
11009 MSIE CSS safety test: comment in expression
11010 !! input
11011 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
11012 !! result
11013 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
11014
11015 !! end
11016
11017
11018 !! test
11019 Table attribute legitimate extension
11020 !! input
11021 {|
11022 !+ style="<nowiki>color:blue</nowiki>"| status
11023 |}
11024 !! result
11025 <table>
11026 <tr>
11027 <th style="color:blue"> status
11028 </th></tr></table>
11029
11030 !!end
11031
11032 !! test
11033 Table attribute safety
11034 !! input
11035 {|
11036 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
11037 |}
11038 !! result
11039 <table>
11040 <tr>
11041 <th style="/* insecure input */"> status
11042 </th></tr></table>
11043
11044 !! end
11045
11046 !! test
11047 CSS line continuation 1
11048 !! input
11049 <div style="background-image: u\&#10;rl(test.jpg);"></div>
11050 !! result
11051 <div style="/* insecure input */"></div>
11052
11053 !! end
11054
11055 !! test
11056 CSS line continuation 2
11057 !! input
11058 <div style="background-image: u\&#13;rl(test.jpg); "></div>
11059 !! result
11060 <div style="/* insecure input */"></div>
11061
11062 !! end
11063
11064 !! article
11065 Template:Identity
11066 !! text
11067 {{{1}}}
11068 !! endarticle
11069
11070 !! test
11071 Expansion of multi-line templates in attribute values (bug 6255)
11072 !! input
11073 <div style="background: {{identity|#00FF00}}">-</div>
11074 !! result
11075 <div style="background: #00FF00">-</div>
11076
11077 !! end
11078
11079
11080 !! test
11081 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
11082 !! input
11083 <div style="background:
11084 #00FF00">-</div>
11085 !! result
11086 <div style="background: #00FF00">-</div>
11087
11088 !! end
11089
11090 !! test
11091 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
11092 !! input
11093 <div style="background: &#10;#00FF00">-</div>
11094 !! result
11095 <div style="background: &#10;#00FF00">-</div>
11096
11097 !! end
11098
11099 ###
11100 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
11101 ###
11102 !! test
11103 Parser hook: empty input
11104 !! input
11105 <tag></tag>
11106 !! result
11107 <pre>
11108 ''
11109 array (
11110 )
11111 </pre>
11112
11113 !! end
11114
11115 !! test
11116 Parser hook: empty input using terminated empty elements
11117 !! input
11118 <tag/>
11119 !! result
11120 <pre>
11121 NULL
11122 array (
11123 )
11124 </pre>
11125
11126 !! end
11127
11128 !! test
11129 Parser hook: empty input using terminated empty elements (space before)
11130 !! input
11131 <tag />
11132 !! result
11133 <pre>
11134 NULL
11135 array (
11136 )
11137 </pre>
11138
11139 !! end
11140
11141 !! test
11142 Parser hook: basic input
11143 !! input
11144 <tag>input</tag>
11145 !! result
11146 <pre>
11147 'input'
11148 array (
11149 )
11150 </pre>
11151
11152 !! end
11153
11154
11155 !! test
11156 Parser hook: case insensitive
11157 !! input
11158 <TAG>input</TAG>
11159 !! result
11160 <pre>
11161 'input'
11162 array (
11163 )
11164 </pre>
11165
11166 !! end
11167
11168
11169 !! test
11170 Parser hook: case insensitive, redux
11171 !! input
11172 <TaG>input</TAg>
11173 !! result
11174 <pre>
11175 'input'
11176 array (
11177 )
11178 </pre>
11179
11180 !! end
11181
11182 !! test
11183 Parser hook: nested tags
11184 !! options
11185 noxml
11186 !! input
11187 <tag><tag></tag></tag>
11188 !! result
11189 <pre>
11190 '<tag>'
11191 array (
11192 )
11193 </pre>&lt;/tag&gt;
11194
11195 !! end
11196
11197 !! test
11198 Parser hook: basic arguments
11199 !! input
11200 <tag width=200 height = "100" depth = '50' square></tag>
11201 !! result
11202 <pre>
11203 ''
11204 array (
11205 'width' => '200',
11206 'height' => '100',
11207 'depth' => '50',
11208 'square' => 'square',
11209 )
11210 </pre>
11211
11212 !! end
11213
11214 !! test
11215 Parser hook: argument containing a forward slash (bug 5344)
11216 !! input
11217 <tag filename='/tmp/bla'></tag>
11218 !! result
11219 <pre>
11220 ''
11221 array (
11222 'filename' => '/tmp/bla',
11223 )
11224 </pre>
11225
11226 !! end
11227
11228 !! test
11229 Parser hook: empty input using terminated empty elements (bug 2374)
11230 !! input
11231 <tag foo=bar/>text
11232 !! result
11233 <pre>
11234 NULL
11235 array (
11236 'foo' => 'bar',
11237 )
11238 </pre>text
11239
11240 !! end
11241
11242 # </tag> should be output literally since there is no matching tag that begins it
11243 !! test
11244 Parser hook: basic arguments using terminated empty elements (bug 2374)
11245 !! input
11246 <tag width=200 height = "100" depth = '50' square/>
11247 other stuff
11248 </tag>
11249 !! result
11250 <pre>
11251 NULL
11252 array (
11253 'width' => '200',
11254 'height' => '100',
11255 'depth' => '50',
11256 'square' => 'square',
11257 )
11258 </pre>
11259 <p>other stuff
11260 &lt;/tag&gt;
11261 </p>
11262 !! end
11263
11264 ###
11265 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
11266 ###
11267
11268 !! test
11269 Parser hook: static parser hook not inside a comment
11270 !! input
11271 <statictag>hello, world</statictag>
11272 <statictag action=flush/>
11273 !! result
11274 <p>hello, world
11275 </p>
11276 !! end
11277
11278
11279 !! test
11280 Parser hook: static parser hook inside a comment
11281 !! input
11282 <!-- <statictag>hello, world</statictag> -->
11283 <statictag action=flush/>
11284 !! result
11285 <p><br />
11286 </p>
11287 !! end
11288
11289 # Nested template calls; this case was broken by Parser.php rev 1.506,
11290 # since reverted.
11291
11292 !! article
11293 Template:One-parameter
11294 !! text
11295 (My parameter is: {{{1}}})
11296 !! endarticle
11297
11298 !! article
11299 Template:Map-one-parameter
11300 !! text
11301 {{{{{1}}}|{{{2}}}}}
11302 !! endarticle
11303
11304 !! test
11305 Nested template calls
11306 !! input
11307 {{Map-one-parameter|One-parameter|param}}
11308 !! result
11309 <p>(My parameter is: param)
11310 </p>
11311 !! end
11312
11313
11314 ###
11315 ### Sanitizer
11316 ###
11317 !! test
11318 Sanitizer: Closing of open tags
11319 !! input
11320 <s></s><table></table>
11321 !! result
11322 <s></s><table></table>
11323
11324 !! end
11325
11326 !! test
11327 Sanitizer: Closing of open but not closed tags
11328 !! input
11329 <s>foo
11330 !! result
11331 <p><s>foo</s>
11332 </p>
11333 !! end
11334
11335 !! test
11336 Sanitizer: Closing of closed but not open tags
11337 !! input
11338 </s>
11339 !! result
11340 <p>&lt;/s&gt;
11341 </p>
11342 !! end
11343
11344 !! test
11345 Sanitizer: Closing of closed but not open table tags
11346 !! input
11347 Table not started</td></tr></table>
11348 !! result
11349 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
11350 </p>
11351 !! end
11352
11353 !! test
11354 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
11355 !! input
11356 <span id="æ: v">byte</span>[[#æ: v|backlink]]
11357 !! result
11358 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
11359 </p>
11360 !! end
11361
11362 !! test
11363 Sanitizer: Validating the contents of the id attribute (bug 4515)
11364 !! options
11365 disabled
11366 !! input
11367 <br id=9 />
11368 !! result
11369 Something, but definitely not <br id="9" />...
11370 !! end
11371
11372 !! test
11373 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
11374 !! options
11375 disabled
11376 !! input
11377 <br id="foo" /><br id="foo" />
11378 !! result
11379 Something need to be done. foo-2 ?
11380 !! end
11381
11382 !! test
11383 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
11384 !! input
11385 <div itemscope>
11386 <meta itemprop="hello" content="world">
11387 <meta http-equiv="refresh" content="5">
11388 <meta itemprop="hello" http-equiv="refresh" content="5">
11389 <link itemprop="hello" href="{{SERVER}}">
11390 <link rel="stylesheet" href="{{SERVER}}">
11391 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
11392 </div>
11393 !! result
11394 <div itemscope="itemscope">
11395 <p> <meta itemprop="hello" content="world" />
11396 &lt;meta http-equiv="refresh" content="5"&gt;
11397 <meta itemprop="hello" content="5" />
11398 </p>
11399 <link itemprop="hello" href="http&#58;//example.org" />
11400 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
11401 <link itemprop="hello" href="http&#58;//example.org" />
11402 </div>
11403
11404 !! end
11405
11406 !! test
11407 Language converter: output gets cut off unexpectedly (bug 5757)
11408 !! options
11409 language=zh
11410 !! input
11411 this bit is safe: }-
11412
11413 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
11414
11415 then we get cut off here: }-
11416
11417 all additional text is vanished
11418 !! result
11419 <p>this bit is safe: }-
11420 </p><p>but if we add a conversion instance: xxx
11421 </p><p>then we get cut off here: }-
11422 </p><p>all additional text is vanished
11423 </p>
11424 !! end
11425
11426 !! test
11427 Self closed html pairs (bug 5487)
11428 !! options
11429 !! input
11430 <center><font id="bug" />Centered text</center>
11431 <div><font id="bug2" />In div text</div>
11432 !! result
11433 <center>&lt;font id="bug" /&gt;Centered text</center>
11434 <div>&lt;font id="bug2" /&gt;In div text</div>
11435
11436 !! end
11437
11438 #
11439 #
11440 #
11441
11442 !! test
11443 Punctuation: nbsp before exclamation
11444 !! input
11445 C'est grave !
11446 !! result
11447 <p>C'est grave&#160;!
11448 </p>
11449 !! end
11450
11451 !! test
11452 Punctuation: CSS !important (bug 11874)
11453 !! input
11454 <div style="width:50% !important">important</div>
11455 !! result
11456 <div style="width:50% !important">important</div>
11457
11458 !!end
11459
11460 !! test
11461 Punctuation: CSS ! important (bug 11874; with space after)
11462 !! input
11463 <div style="width:50% ! important">important</div>
11464 !! result
11465 <div style="width:50% ! important">important</div>
11466
11467 !!end
11468
11469
11470 !! test
11471 HTML bullet list, closed tags (bug 5497)
11472 !! input
11473 <ul>
11474 <li>One</li>
11475 <li>Two</li>
11476 </ul>
11477 !! result
11478 <ul>
11479 <li>One</li>
11480 <li>Two</li>
11481 </ul>
11482
11483 !! end
11484
11485 !! test
11486 HTML bullet list, unclosed tags (bug 5497)
11487 !! options
11488 disabled
11489 !! input
11490 <ul>
11491 <li>One
11492 <li>Two
11493 </ul>
11494 !! result
11495 <ul>
11496 <li>One
11497 </li><li>Two
11498 </li></ul>
11499
11500 !! end
11501
11502 !! test
11503 HTML ordered list, closed tags (bug 5497)
11504 !! input
11505 <ol>
11506 <li>One</li>
11507 <li>Two</li>
11508 </ol>
11509 !! result
11510 <ol>
11511 <li>One</li>
11512 <li>Two</li>
11513 </ol>
11514
11515 !! end
11516
11517 !! test
11518 HTML ordered list, unclosed tags (bug 5497)
11519 !! options
11520 disabled
11521 !! input
11522 <ol>
11523 <li>One
11524 <li>Two
11525 </ol>
11526 !! result
11527 <ol>
11528 <li>One
11529 </li><li>Two
11530 </li></ol>
11531
11532 !! end
11533
11534 !! test
11535 HTML nested bullet list, closed tags (bug 5497)
11536 !! input
11537 <ul>
11538 <li>One</li>
11539 <li>Two:
11540 <ul>
11541 <li>Sub-one</li>
11542 <li>Sub-two</li>
11543 </ul>
11544 </li>
11545 </ul>
11546 !! result
11547 <ul>
11548 <li>One</li>
11549 <li>Two:
11550 <ul>
11551 <li>Sub-one</li>
11552 <li>Sub-two</li>
11553 </ul>
11554 </li>
11555 </ul>
11556
11557 !! end
11558
11559 !! test
11560 HTML nested bullet list, open tags (bug 5497)
11561 !! options
11562 disabled
11563 !! input
11564 <ul>
11565 <li>One
11566 <li>Two:
11567 <ul>
11568 <li>Sub-one
11569 <li>Sub-two
11570 </ul>
11571 </ul>
11572 !! result
11573 <ul>
11574 <li>One
11575 </li><li>Two:
11576 <ul>
11577 <li>Sub-one
11578 </li><li>Sub-two
11579 </li></ul>
11580 </li></ul>
11581
11582 !! end
11583
11584 !! test
11585 HTML nested ordered list, closed tags (bug 5497)
11586 !! input
11587 <ol>
11588 <li>One</li>
11589 <li>Two:
11590 <ol>
11591 <li>Sub-one</li>
11592 <li>Sub-two</li>
11593 </ol>
11594 </li>
11595 </ol>
11596 !! result
11597 <ol>
11598 <li>One</li>
11599 <li>Two:
11600 <ol>
11601 <li>Sub-one</li>
11602 <li>Sub-two</li>
11603 </ol>
11604 </li>
11605 </ol>
11606
11607 !! end
11608
11609 !! test
11610 HTML nested ordered list, open tags (bug 5497)
11611 !! options
11612 disabled
11613 !! input
11614 <ol>
11615 <li>One
11616 <li>Two:
11617 <ol>
11618 <li>Sub-one
11619 <li>Sub-two
11620 </ol>
11621 </ol>
11622 !! result
11623 <ol>
11624 <li>One
11625 </li><li>Two:
11626 <ol>
11627 <li>Sub-one
11628 </li><li>Sub-two
11629 </li></ol>
11630 </li></ol>
11631
11632 !! end
11633
11634 !! test
11635 HTML ordered list item with parameters oddity
11636 !! input
11637 <ol><li id="fragment">One</li></ol>
11638 !! result
11639 <ol><li id="fragment">One</li></ol>
11640
11641 !! end
11642
11643 !!test
11644 bug 5918: autonumbering
11645 !! input
11646 [http://first/] [http://second] [ftp://ftp]
11647
11648 ftp://inlineftp
11649
11650 [mailto:enclosed@mail.tld With target]
11651
11652 [mailto:enclosed@mail.tld]
11653
11654 mailto:inline@mail.tld
11655 !! result
11656 <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>
11657 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
11658 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
11659 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
11660 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
11661 </p>
11662 !! end
11663
11664
11665 #
11666 # Security and HTML correctness
11667 # From Nick Jenkins' fuzz testing
11668 #
11669
11670 !! test
11671 Fuzz testing: Parser13
11672 !! input
11673 {|
11674 | http://a|
11675 !! result
11676 <table>
11677 <tr>
11678 <td>
11679 </td>
11680 </tr>
11681 </table>
11682
11683 !! end
11684
11685 !! test
11686 Fuzz testing: Parser14
11687 !! input
11688 == onmouseover= ==
11689 http://__TOC__
11690 !! result
11691 <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>
11692 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11693 <ul>
11694 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
11695 </ul>
11696 </div>
11697
11698 !! end
11699
11700 !! test
11701 Fuzz testing: Parser14-table
11702 !! input
11703 ==a==
11704 {| STYLE=__TOC__
11705 !! result
11706 <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>
11707 <table style="&#95;_TOC&#95;_">
11708 <tr><td></td></tr>
11709 </table>
11710
11711 !! end
11712
11713 # Known to produce bogus xml (extra </td>)
11714 !! test
11715 Fuzz testing: Parser16
11716 !! options
11717 noxml
11718 !! input
11719 {|
11720 !https://||||||
11721 !! result
11722 <table>
11723 <tr>
11724 <th>https://</th>
11725 <th></th>
11726 <th></th>
11727 <th>
11728 </td>
11729 </tr>
11730 </table>
11731
11732 !! end
11733
11734 !! test
11735 Fuzz testing: Parser21
11736 !! input
11737 {|
11738 ! irc://{{ftp://a" onmouseover="alert('hello world');"
11739 |
11740 !! result
11741 <table>
11742 <tr>
11743 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
11744 </th>
11745 <td>
11746 </td>
11747 </tr>
11748 </table>
11749
11750 !! end
11751
11752 !! test
11753 Fuzz testing: Parser22
11754 !! input
11755 http://===r:::https://b
11756
11757 {|
11758 !!result
11759 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
11760 </p>
11761 <table>
11762 <tr><td></td></tr>
11763 </table>
11764
11765 !! end
11766
11767 # Known to produce bad XML for now
11768 !! test
11769 Fuzz testing: Parser24
11770 !! options
11771 noxml
11772 !! input
11773 {|
11774 {{{|
11775 <u CLASS=
11776 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
11777 <br style="onmouseover='alert(document.cookie);' " />
11778
11779 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11780 |
11781 !! result
11782 <table>
11783 {{{|
11784 <u class="&#124;">}}}} &gt;
11785 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
11786
11787 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11788 <tr>
11789 <td></u>
11790 </td>
11791 </tr>
11792 </table>
11793
11794 !! end
11795
11796 # Note: the current result listed for this is not what the original one was,
11797 # but the original bug was JavaScript injection, which is fixed in any case.
11798 # It's not clear that the original result listed was any more correct than the
11799 # current one. Original result:
11800 # <p>{{{|
11801 # </p>
11802 # <li class="&#124;&#124;">
11803 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11804 !!test
11805 Fuzz testing: Parser25 (bug 6055)
11806 !! input
11807 {{{
11808 |
11809 <LI CLASS=||
11810 >
11811 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
11812 !! result
11813 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11814 </p>
11815 !! end
11816
11817 !!test
11818 Fuzz testing: URL adjacent extension (with space, clean)
11819 !! options
11820 !! input
11821 http://example.com <nowiki>junk</nowiki>
11822 !! result
11823 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
11824 </p>
11825 !!end
11826
11827 !!test
11828 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
11829 !! options
11830 !! input
11831 http://example.com<nowiki>junk</nowiki>
11832 !! result
11833 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
11834 </p>
11835 !!end
11836
11837 !!test
11838 Fuzz testing: URL adjacent extension (no space, dirty; pre)
11839 !! options
11840 !! input
11841 http://example.com<pre>junk</pre>
11842 !! result
11843 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
11844
11845 !!end
11846
11847 !!test
11848 Fuzz testing: image with bogus manual thumbnail
11849 !!input
11850 [[Image:foobar.jpg|thumbnail= ]]
11851 !!result
11852 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
11853
11854 !!end
11855
11856 !! test
11857 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
11858 !! input
11859 <pre dir="&#10;"></pre>
11860 !! result
11861 <pre dir="&#10;"></pre>
11862
11863 !! end
11864
11865 !! test
11866 Parsing optional HTML elements (Bug 6171)
11867 !! options
11868 !! input
11869 <table>
11870 <tr>
11871 <td> Some tabular data</td>
11872 <td> More tabular data ...
11873 <td> And yet som tabular data</td>
11874 </tr>
11875 </table>
11876 !! result
11877 <table>
11878 <tr>
11879 <td> Some tabular data</td>
11880 <td> More tabular data ...
11881 </td><td> And yet som tabular data</td>
11882 </tr>
11883 </table>
11884
11885 !! end
11886
11887 !! test
11888 Correct handling of <td>, <tr> (Bug 6171)
11889 !! options
11890 !! input
11891 <table>
11892 <tr>
11893 <td> Some tabular data</td>
11894 <td> More tabular data ...</td>
11895 <td> And yet som tabular data</td>
11896 </tr>
11897 </table>
11898 !! result
11899 <table>
11900 <tr>
11901 <td> Some tabular data</td>
11902 <td> More tabular data ...</td>
11903 <td> And yet som tabular data</td>
11904 </tr>
11905 </table>
11906
11907 !! end
11908
11909
11910 !! test
11911 Parsing crashing regression (fr:JavaScript)
11912 !! input
11913 </body></x>
11914 !! result
11915 <p>&lt;/body&gt;&lt;/x&gt;
11916 </p>
11917 !! end
11918
11919 !! test
11920 Inline wiki vs wiki block nesting
11921 !! input
11922 '''Bold paragraph
11923
11924 New wiki paragraph
11925 !! result
11926 <p><b>Bold paragraph</b>
11927 </p><p>New wiki paragraph
11928 </p>
11929 !! end
11930
11931 !! test
11932 Inline HTML vs wiki block nesting
11933 !! options
11934 disabled
11935 !! input
11936 <b>Bold paragraph
11937
11938 New wiki paragraph
11939 !! result
11940 <p><b>Bold paragraph</b>
11941 </p><p>New wiki paragraph
11942 </p>
11943 !! end
11944
11945 # Original result was this:
11946 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
11947 # </p>
11948 # While that might be marginally more intuitive, maybe, the six-apostrophe
11949 # construct is clearly pathological and the result stated here (which is what
11950 # the parser actually does) is about as reasonable as anything.
11951 !!test
11952 Mixing markup for italics and bold
11953 !! options
11954 !! input
11955 '''bold''''''bold''bolditalics'''''
11956 !! result
11957 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
11958 </p>
11959 !! end
11960
11961
11962 !! article
11963 Xyzzyx
11964 !! text
11965 Article for special page transclusion test
11966 !! endarticle
11967
11968 !! test
11969 Special page transclusion
11970 !! options
11971 !! input
11972 {{Special:Prefixindex/Xyzzyx}}
11973 !! result
11974 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11975
11976 !! end
11977
11978 !! test
11979 Special page transclusion twice (bug 5021)
11980 !! options
11981 !! input
11982 {{Special:Prefixindex/Xyzzyx}}
11983 {{Special:Prefixindex/Xyzzyx}}
11984 !! result
11985 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11986 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11987
11988 !! end
11989
11990 !! test
11991 Transclusion of default MediaWiki message
11992 !! input
11993 {{MediaWiki:Mainpage}}
11994 !!result
11995 <p>Main Page
11996 </p>
11997 !! end
11998
11999 !! test
12000 Transclusion of nonexistent MediaWiki message
12001 !! input
12002 {{MediaWiki:Mainpagexxx}}
12003 !!result
12004 <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>
12005 </p>
12006 !! end
12007
12008 !! test
12009 Transclusion of MediaWiki message with underscore
12010 !! input
12011 {{MediaWiki:history_short}}
12012 !! result
12013 <p>History
12014 </p>
12015 !! end
12016
12017 !! test
12018 Transclusion of MediaWiki message with space
12019 !! input
12020 {{MediaWiki:history short}}
12021 !! result
12022 <p>History
12023 </p>
12024 !! end
12025
12026 !! test
12027 Invalid header with following text
12028 !! input
12029 = x = y
12030 !! result
12031 <p>= x = y
12032 </p>
12033 !! end
12034
12035
12036 !! test
12037 Section extraction test (section 0)
12038 !! options
12039 section=0
12040 !! input
12041 start
12042 ==a==
12043 ===aa===
12044 ====aaa====
12045 ==b==
12046 ===ba===
12047 ===bb===
12048 ====bba====
12049 ===bc===
12050 ==c==
12051 ===ca===
12052 !! result
12053 start
12054 !! end
12055
12056 !! test
12057 Section extraction test (section 1)
12058 !! options
12059 section=1
12060 !! input
12061 start
12062 ==a==
12063 ===aa===
12064 ====aaa====
12065 ==b==
12066 ===ba===
12067 ===bb===
12068 ====bba====
12069 ===bc===
12070 ==c==
12071 ===ca===
12072 !! result
12073 ==a==
12074 ===aa===
12075 ====aaa====
12076 !! end
12077
12078 !! test
12079 Section extraction test (section 2)
12080 !! options
12081 section=2
12082 !! input
12083 start
12084 ==a==
12085 ===aa===
12086 ====aaa====
12087 ==b==
12088 ===ba===
12089 ===bb===
12090 ====bba====
12091 ===bc===
12092 ==c==
12093 ===ca===
12094 !! result
12095 ===aa===
12096 ====aaa====
12097 !! end
12098
12099 !! test
12100 Section extraction test (section 3)
12101 !! options
12102 section=3
12103 !! input
12104 start
12105 ==a==
12106 ===aa===
12107 ====aaa====
12108 ==b==
12109 ===ba===
12110 ===bb===
12111 ====bba====
12112 ===bc===
12113 ==c==
12114 ===ca===
12115 !! result
12116 ====aaa====
12117 !! end
12118
12119 !! test
12120 Section extraction test (section 4)
12121 !! options
12122 section=4
12123 !! input
12124 start
12125 ==a==
12126 ===aa===
12127 ====aaa====
12128 ==b==
12129 ===ba===
12130 ===bb===
12131 ====bba====
12132 ===bc===
12133 ==c==
12134 ===ca===
12135 !! result
12136 ==b==
12137 ===ba===
12138 ===bb===
12139 ====bba====
12140 ===bc===
12141 !! end
12142
12143 !! test
12144 Section extraction test (section 5)
12145 !! options
12146 section=5
12147 !! input
12148 start
12149 ==a==
12150 ===aa===
12151 ====aaa====
12152 ==b==
12153 ===ba===
12154 ===bb===
12155 ====bba====
12156 ===bc===
12157 ==c==
12158 ===ca===
12159 !! result
12160 ===ba===
12161 !! end
12162
12163 !! test
12164 Section extraction test (section 6)
12165 !! options
12166 section=6
12167 !! input
12168 start
12169 ==a==
12170 ===aa===
12171 ====aaa====
12172 ==b==
12173 ===ba===
12174 ===bb===
12175 ====bba====
12176 ===bc===
12177 ==c==
12178 ===ca===
12179 !! result
12180 ===bb===
12181 ====bba====
12182 !! end
12183
12184 !! test
12185 Section extraction test (section 7)
12186 !! options
12187 section=7
12188 !! input
12189 start
12190 ==a==
12191 ===aa===
12192 ====aaa====
12193 ==b==
12194 ===ba===
12195 ===bb===
12196 ====bba====
12197 ===bc===
12198 ==c==
12199 ===ca===
12200 !! result
12201 ====bba====
12202 !! end
12203
12204 !! test
12205 Section extraction test (section 8)
12206 !! options
12207 section=8
12208 !! input
12209 start
12210 ==a==
12211 ===aa===
12212 ====aaa====
12213 ==b==
12214 ===ba===
12215 ===bb===
12216 ====bba====
12217 ===bc===
12218 ==c==
12219 ===ca===
12220 !! result
12221 ===bc===
12222 !! end
12223
12224 !! test
12225 Section extraction test (section 9)
12226 !! options
12227 section=9
12228 !! input
12229 start
12230 ==a==
12231 ===aa===
12232 ====aaa====
12233 ==b==
12234 ===ba===
12235 ===bb===
12236 ====bba====
12237 ===bc===
12238 ==c==
12239 ===ca===
12240 !! result
12241 ==c==
12242 ===ca===
12243 !! end
12244
12245 !! test
12246 Section extraction test (section 10)
12247 !! options
12248 section=10
12249 !! input
12250 start
12251 ==a==
12252 ===aa===
12253 ====aaa====
12254 ==b==
12255 ===ba===
12256 ===bb===
12257 ====bba====
12258 ===bc===
12259 ==c==
12260 ===ca===
12261 !! result
12262 ===ca===
12263 !! end
12264
12265 !! test
12266 Section extraction test (nonexistent section 11)
12267 !! options
12268 section=11
12269 !! input
12270 start
12271 ==a==
12272 ===aa===
12273 ====aaa====
12274 ==b==
12275 ===ba===
12276 ===bb===
12277 ====bba====
12278 ===bc===
12279 ==c==
12280 ===ca===
12281 !! result
12282 !! end
12283
12284 !! test
12285 Section extraction test with bogus heading (section 1)
12286 !! options
12287 section=1
12288 !! input
12289 ==a==
12290 ==bogus== not a legal section
12291 ==b==
12292 !! result
12293 ==a==
12294 ==bogus== not a legal section
12295 !! end
12296
12297 !! test
12298 Section extraction test with bogus heading (section 2)
12299 !! options
12300 section=2
12301 !! input
12302 ==a==
12303 ==bogus== not a legal section
12304 ==b==
12305 !! result
12306 ==b==
12307 !! end
12308
12309 !! test
12310 Section extraction test with comment after heading (section 1)
12311 !! options
12312 section=1
12313 !! input
12314 ==a==
12315 ==b== <!-- -->
12316 ==c==
12317 !! result
12318 ==a==
12319 !! end
12320
12321 !! test
12322 Section extraction test with comment after heading (section 2)
12323 !! options
12324 section=2
12325 !! input
12326 ==a==
12327 ==b== <!-- -->
12328 ==c==
12329 !! result
12330 ==b== <!-- -->
12331 !! end
12332
12333 !! test
12334 Section extraction test with bogus <nowiki> heading (section 1)
12335 !! options
12336 section=1
12337 !! input
12338 ==a==
12339 ==bogus== <nowiki>not a legal section</nowiki>
12340 ==b==
12341 !! result
12342 ==a==
12343 ==bogus== <nowiki>not a legal section</nowiki>
12344 !! end
12345
12346 !! test
12347 Section extraction test with bogus <nowiki> heading (section 2)
12348 !! options
12349 section=2
12350 !! input
12351 ==a==
12352 ==bogus== <nowiki>not a legal section</nowiki>
12353 ==b==
12354 !! result
12355 ==b==
12356 !! end
12357
12358
12359 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
12360 # instead of respecting commented sections
12361 !! test
12362 Section extraction prefixed by comment (section 1)
12363 !! options
12364 section=1
12365 !! input
12366 <!-- -->==sec1==
12367 ==sec2==
12368 !!result
12369 ==sec2==
12370 !!end
12371
12372 !! test
12373 Section extraction prefixed by comment (section 2)
12374 !! options
12375 section=2
12376 !! input
12377 <!-- -->==sec1==
12378 ==sec2==
12379 !!result
12380
12381 !!end
12382
12383
12384 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
12385 # instead of respecting HTML-style headings
12386 !! test
12387 Section extraction, mixed wiki and html (section 1)
12388 !! options
12389 section=1
12390 !! input
12391 <h2>unmarked</h2>
12392 unmarked
12393 ==1==
12394 one
12395 ==2==
12396 two
12397 !! result
12398 ==1==
12399 one
12400 !! end
12401
12402 !! test
12403 Section extraction, mixed wiki and html (section 2)
12404 !! options
12405 section=2
12406 !! input
12407 <h2>unmarked</h2>
12408 unmarked
12409 ==1==
12410 one
12411 ==2==
12412 two
12413 !! result
12414 ==2==
12415 two
12416 !! end
12417
12418
12419 # Formerly testing for bug 3342
12420 !! test
12421 Section extraction, heading surrounded by <noinclude>
12422 !! options
12423 section=1
12424 !! input
12425 <noinclude>==unmarked==</noinclude>
12426 ==marked==
12427 !! result
12428 ==marked==
12429 !!end
12430
12431 # Test behavior of bug 19910
12432 !! test
12433 Sectiion with all-equals
12434 !! options
12435 section=2
12436 !! input
12437 ===
12438 The line above must have a trailing space
12439 === <!--
12440 --> <!-- -->
12441 But just in case it doesn't...
12442 !! result
12443 === <!--
12444 --> <!-- -->
12445 But just in case it doesn't...
12446 !! end
12447
12448 !! test
12449 Section replacement test (section 0)
12450 !! options
12451 replace=0,"xxx"
12452 !! input
12453 start
12454 ==a==
12455 ===aa===
12456 ====aaa====
12457 ==b==
12458 ===ba===
12459 ===bb===
12460 ====bba====
12461 ===bc===
12462 ==c==
12463 ===ca===
12464 !! result
12465 xxx
12466
12467 ==a==
12468 ===aa===
12469 ====aaa====
12470 ==b==
12471 ===ba===
12472 ===bb===
12473 ====bba====
12474 ===bc===
12475 ==c==
12476 ===ca===
12477 !! end
12478
12479 !! test
12480 Section replacement test (section 1)
12481 !! options
12482 replace=1,"xxx"
12483 !! input
12484 start
12485 ==a==
12486 ===aa===
12487 ====aaa====
12488 ==b==
12489 ===ba===
12490 ===bb===
12491 ====bba====
12492 ===bc===
12493 ==c==
12494 ===ca===
12495 !! result
12496 start
12497 xxx
12498
12499 ==b==
12500 ===ba===
12501 ===bb===
12502 ====bba====
12503 ===bc===
12504 ==c==
12505 ===ca===
12506 !! end
12507
12508 !! test
12509 Section replacement test (section 2)
12510 !! options
12511 replace=2,"xxx"
12512 !! input
12513 start
12514 ==a==
12515 ===aa===
12516 ====aaa====
12517 ==b==
12518 ===ba===
12519 ===bb===
12520 ====bba====
12521 ===bc===
12522 ==c==
12523 ===ca===
12524 !! result
12525 start
12526 ==a==
12527 xxx
12528
12529 ==b==
12530 ===ba===
12531 ===bb===
12532 ====bba====
12533 ===bc===
12534 ==c==
12535 ===ca===
12536 !! end
12537
12538 !! test
12539 Section replacement test (section 3)
12540 !! options
12541 replace=3,"xxx"
12542 !! input
12543 start
12544 ==a==
12545 ===aa===
12546 ====aaa====
12547 ==b==
12548 ===ba===
12549 ===bb===
12550 ====bba====
12551 ===bc===
12552 ==c==
12553 ===ca===
12554 !! result
12555 start
12556 ==a==
12557 ===aa===
12558 xxx
12559
12560 ==b==
12561 ===ba===
12562 ===bb===
12563 ====bba====
12564 ===bc===
12565 ==c==
12566 ===ca===
12567 !! end
12568
12569 !! test
12570 Section replacement test (section 4)
12571 !! options
12572 replace=4,"xxx"
12573 !! input
12574 start
12575 ==a==
12576 ===aa===
12577 ====aaa====
12578 ==b==
12579 ===ba===
12580 ===bb===
12581 ====bba====
12582 ===bc===
12583 ==c==
12584 ===ca===
12585 !! result
12586 start
12587 ==a==
12588 ===aa===
12589 ====aaa====
12590 xxx
12591
12592 ==c==
12593 ===ca===
12594 !! end
12595
12596 !! test
12597 Section replacement test (section 5)
12598 !! options
12599 replace=5,"xxx"
12600 !! input
12601 start
12602 ==a==
12603 ===aa===
12604 ====aaa====
12605 ==b==
12606 ===ba===
12607 ===bb===
12608 ====bba====
12609 ===bc===
12610 ==c==
12611 ===ca===
12612 !! result
12613 start
12614 ==a==
12615 ===aa===
12616 ====aaa====
12617 ==b==
12618 xxx
12619
12620 ===bb===
12621 ====bba====
12622 ===bc===
12623 ==c==
12624 ===ca===
12625 !! end
12626
12627 !! test
12628 Section replacement test (section 6)
12629 !! options
12630 replace=6,"xxx"
12631 !! input
12632 start
12633 ==a==
12634 ===aa===
12635 ====aaa====
12636 ==b==
12637 ===ba===
12638 ===bb===
12639 ====bba====
12640 ===bc===
12641 ==c==
12642 ===ca===
12643 !! result
12644 start
12645 ==a==
12646 ===aa===
12647 ====aaa====
12648 ==b==
12649 ===ba===
12650 xxx
12651
12652 ===bc===
12653 ==c==
12654 ===ca===
12655 !! end
12656
12657 !! test
12658 Section replacement test (section 7)
12659 !! options
12660 replace=7,"xxx"
12661 !! input
12662 start
12663 ==a==
12664 ===aa===
12665 ====aaa====
12666 ==b==
12667 ===ba===
12668 ===bb===
12669 ====bba====
12670 ===bc===
12671 ==c==
12672 ===ca===
12673 !! result
12674 start
12675 ==a==
12676 ===aa===
12677 ====aaa====
12678 ==b==
12679 ===ba===
12680 ===bb===
12681 xxx
12682
12683 ===bc===
12684 ==c==
12685 ===ca===
12686 !! end
12687
12688 !! test
12689 Section replacement test (section 8)
12690 !! options
12691 replace=8,"xxx"
12692 !! input
12693 start
12694 ==a==
12695 ===aa===
12696 ====aaa====
12697 ==b==
12698 ===ba===
12699 ===bb===
12700 ====bba====
12701 ===bc===
12702 ==c==
12703 ===ca===
12704 !! result
12705 start
12706 ==a==
12707 ===aa===
12708 ====aaa====
12709 ==b==
12710 ===ba===
12711 ===bb===
12712 ====bba====
12713 xxx
12714
12715 ==c==
12716 ===ca===
12717 !!end
12718
12719 !! test
12720 Section replacement test (section 9)
12721 !! options
12722 replace=9,"xxx"
12723 !! input
12724 start
12725 ==a==
12726 ===aa===
12727 ====aaa====
12728 ==b==
12729 ===ba===
12730 ===bb===
12731 ====bba====
12732 ===bc===
12733 ==c==
12734 ===ca===
12735 !! result
12736 start
12737 ==a==
12738 ===aa===
12739 ====aaa====
12740 ==b==
12741 ===ba===
12742 ===bb===
12743 ====bba====
12744 ===bc===
12745 xxx
12746 !! end
12747
12748 !! test
12749 Section replacement test (section 10)
12750 !! options
12751 replace=10,"xxx"
12752 !! input
12753 start
12754 ==a==
12755 ===aa===
12756 ====aaa====
12757 ==b==
12758 ===ba===
12759 ===bb===
12760 ====bba====
12761 ===bc===
12762 ==c==
12763 ===ca===
12764 !! result
12765 start
12766 ==a==
12767 ===aa===
12768 ====aaa====
12769 ==b==
12770 ===ba===
12771 ===bb===
12772 ====bba====
12773 ===bc===
12774 ==c==
12775 xxx
12776 !! end
12777
12778 !! test
12779 Section replacement test with initial whitespace (bug 13728)
12780 !! options
12781 replace=2,"xxx"
12782 !! input
12783 Preformatted initial line
12784 ==a==
12785 ===a===
12786 !! result
12787 Preformatted initial line
12788 ==a==
12789 xxx
12790 !! end
12791
12792
12793 !! test
12794 Section extraction, heading followed by pre with 20 spaces (bug 6398)
12795 !! options
12796 section=1
12797 !! input
12798 ==a==
12799 a
12800 !! result
12801 ==a==
12802 a
12803 !! end
12804
12805 !! test
12806 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
12807 !! options
12808 section=1
12809 !! input
12810 ==a==
12811 a
12812 !! result
12813 ==a==
12814 a
12815 !! end
12816
12817
12818 !! test
12819 Section extraction, <pre> around bogus header (bug 10309)
12820 !! options
12821 noxml section=2
12822 !! input
12823 == Section One ==
12824 <pre>
12825 =======
12826 </pre>
12827
12828 == Section Two ==
12829 stuff
12830 !! result
12831 == Section Two ==
12832 stuff
12833 !! end
12834
12835 !! test
12836 Section replacement, <pre> around bogus header (bug 10309)
12837 !! options
12838 noxml replace=2,"xxx"
12839 !! input
12840 == Section One ==
12841 <pre>
12842 =======
12843 </pre>
12844
12845 == Section Two ==
12846 stuff
12847 !! result
12848 == Section One ==
12849 <pre>
12850 =======
12851 </pre>
12852
12853 xxx
12854 !! end
12855
12856
12857
12858 !! test
12859 Handling of &#x0A; in URLs
12860 !! input
12861 **irc://&#x0A;a
12862 !! result
12863 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
12864 </li></ul>
12865 </li></ul>
12866
12867 !!end
12868
12869 !! test
12870 5 quotes, code coverage +1 line (php)
12871 !! options
12872 php
12873 !! input
12874 '''''
12875 !! result
12876 !! end
12877 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
12878 !! test
12879 5 quotes, code coverage +1 line (parsoid)
12880 !! options
12881 parsoid
12882 !! input
12883 '''''
12884 !! result
12885 <p><i><b></b></i></p>
12886 !! end
12887
12888 !! test
12889 Special:Search page linking.
12890 !! input
12891 {{Special:search}}
12892 !! result
12893 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
12894 </p>
12895 !! end
12896
12897 !! test
12898 Say the magic word
12899 !! options
12900 title=[[Parser test]]
12901 !! input
12902 * {{PAGENAME}}
12903 * {{PAGENAMEE}}
12904 * {{FULLPAGENAME}}
12905 * {{FULLPAGENAMEE}}
12906 * {{BASEPAGENAME}}
12907 * {{BASEPAGENAMEE}}
12908 * {{SUBPAGENAME}}
12909 * {{SUBPAGENAMEE}}
12910 * {{ROOTPAGENAME}}
12911 * {{ROOTPAGENAMEE}}
12912 * {{TALKPAGENAME}}
12913 * {{TALKPAGENAMEE}}
12914 * {{SUBJECTPAGENAME}}
12915 * {{SUBJECTPAGENAMEE}}
12916 * {{NAMESPACEE}}
12917 * {{NAMESPACE}}
12918 * {{NAMESPACENUMBER}}
12919 * {{TALKSPACE}}
12920 * {{TALKSPACEE}}
12921 * {{SUBJECTSPACE}}
12922 * {{SUBJECTSPACEE}}
12923 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
12924 !! result
12925 <ul><li> Parser test
12926 </li><li> Parser_test
12927 </li><li> Parser test
12928 </li><li> Parser_test
12929 </li><li> Parser test
12930 </li><li> Parser_test
12931 </li><li> Parser test
12932 </li><li> Parser_test
12933 </li><li> Parser test
12934 </li><li> Parser_test
12935 </li><li> Talk:Parser test
12936 </li><li> Talk:Parser_test
12937 </li><li> Parser test
12938 </li><li> Parser_test
12939 </li><li>
12940 </li><li>
12941 </li><li> 0
12942 </li><li> Talk
12943 </li><li> Talk
12944 </li><li>
12945 </li><li>
12946 </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>
12947 </li></ul>
12948
12949 !! end
12950 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
12951
12952 !! test
12953 Gallery
12954 !! input
12955 <gallery>
12956 image1.png |
12957 image2.gif|||||
12958
12959 image3|
12960 image4 |300px| centre
12961 image5.svg| http://///////
12962 [[x|xx]]]]
12963 * image6
12964 </gallery>
12965 !! result
12966 <ul class="gallery mw-gallery-traditional">
12967 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12968 <div class="thumb" style="height: 150px;">Image1.png</div>
12969 <div class="gallerytext">
12970 </div>
12971 </div></li>
12972 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12973 <div class="thumb" style="height: 150px;">Image2.gif</div>
12974 <div class="gallerytext">
12975 <p>||||
12976 </p>
12977 </div>
12978 </div></li>
12979 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12980 <div class="thumb" style="height: 150px;">Image3</div>
12981 <div class="gallerytext">
12982 </div>
12983 </div></li>
12984 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12985 <div class="thumb" style="height: 150px;">Image4</div>
12986 <div class="gallerytext">
12987 <p>300px| centre
12988 </p>
12989 </div>
12990 </div></li>
12991 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12992 <div class="thumb" style="height: 150px;">Image5.svg</div>
12993 <div class="gallerytext">
12994 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
12995 </p>
12996 </div>
12997 </div></li>
12998 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12999 <div class="thumb" style="height: 150px;">* image6</div>
13000 <div class="gallerytext">
13001 </div>
13002 </div></li>
13003 </ul>
13004
13005 !! end
13006
13007 !! test
13008 Gallery (with options)
13009 !! input
13010 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
13011 File:Nonexistant.jpg|caption
13012 File:Nonexistant.jpg
13013 image:foobar.jpg|some '''caption''' [[Main Page]]
13014 image:foobar.jpg
13015 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
13016 </gallery>
13017 !! result
13018 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
13019 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
13020 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13021 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
13022 <div class="gallerytext">
13023 <p>caption
13024 </p>
13025 </div>
13026 </div></li>
13027 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13028 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
13029 <div class="gallerytext">
13030 </div>
13031 </div></li>
13032 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13033 <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>
13034 <div class="gallerytext">
13035 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13036 </p>
13037 </div>
13038 </div></li>
13039 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13040 <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>
13041 <div class="gallerytext">
13042 </div>
13043 </div></li>
13044 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13045 <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>
13046 <div class="gallerytext">
13047 <p>Blabla|blabla.
13048 </p>
13049 </div>
13050 </div></li>
13051 </ul>
13052
13053 !! end
13054
13055 !! test
13056 Gallery with wikitext inside caption
13057 !! input
13058 <gallery>
13059 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
13060 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
13061 </gallery>
13062 !! result
13063 <ul class="gallery mw-gallery-traditional">
13064 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13065 <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>
13066 <div class="gallerytext">
13067 <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>
13068 </p>
13069 </div>
13070 </div></li>
13071 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13072 <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>
13073 <div class="gallerytext">
13074 <p>This is a test template
13075 </p>
13076 </div>
13077 </div></li>
13078 </ul>
13079
13080 !! end
13081
13082 !! test
13083 gallery (with showfilename option)
13084 !! input
13085 <gallery showfilename>
13086 File:Nonexistant.jpg|caption
13087 File:Nonexistant.jpg
13088 image:foobar.jpg|some '''caption''' [[Main Page]]
13089 File:Foobar.jpg
13090 </gallery>
13091 !! result
13092 <ul class="gallery mw-gallery-traditional">
13093 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13094 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13095 <div class="gallerytext">
13096 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
13097 caption
13098 </p>
13099 </div>
13100 </div></li>
13101 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13102 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13103 <div class="gallerytext">
13104 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
13105 </p>
13106 </div>
13107 </div></li>
13108 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13109 <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>
13110 <div class="gallerytext">
13111 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
13112 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13113 </p>
13114 </div>
13115 </div></li>
13116 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13117 <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>
13118 <div class="gallerytext">
13119 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
13120 </p>
13121 </div>
13122 </div></li>
13123 </ul>
13124
13125 !! end
13126
13127 !! test
13128 Gallery (with namespace-less filenames)
13129 !! input
13130 <gallery>
13131 File:Nonexistant.jpg
13132 Nonexistant.jpg
13133 image:foobar.jpg
13134 foobar.jpg
13135 </gallery>
13136 !! result
13137 <ul class="gallery mw-gallery-traditional">
13138 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13139 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13140 <div class="gallerytext">
13141 </div>
13142 </div></li>
13143 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13144 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13145 <div class="gallerytext">
13146 </div>
13147 </div></li>
13148 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13149 <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>
13150 <div class="gallerytext">
13151 </div>
13152 </div></li>
13153 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13154 <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>
13155 <div class="gallerytext">
13156 </div>
13157 </div></li>
13158 </ul>
13159
13160 !! end
13161
13162 !! test
13163 HTML Hex character encoding (spells the word "JavaScript")
13164 !! input
13165 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
13166 !! result
13167 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
13168 </p>
13169 !! end
13170
13171 !! test
13172 HTML Hex character encoding bogus encoding (bug 26437 regression check)
13173 !! input
13174 &#xsee;&#XSEE;
13175 !! result
13176 <p>&amp;#xsee;&amp;#XSEE;
13177 </p>
13178 !! end
13179
13180 !! test
13181 HTML Hex character encoding mixed case
13182 !! input
13183 &#xEE;&#Xee;
13184 !! result
13185 <p>&#xee;&#xee;
13186 </p>
13187 !! end
13188
13189 !! test
13190 __FORCETOC__ override
13191 !! input
13192 __NEWSECTIONLINK__
13193 __FORCETOC__
13194 !! result
13195 <p><br />
13196 </p>
13197 !! end
13198
13199 !! test
13200 ISBN code coverage
13201 !! input
13202 ISBN 978-0-1234-56&#x20;789
13203 !! result
13204 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
13205 </p>
13206 !! end
13207
13208 !! test
13209 ISBN followed by 5 spaces
13210 !! input
13211 ISBN
13212 !! result
13213 <p>ISBN
13214 </p>
13215 !! end
13216
13217 !! test
13218 Double ISBN
13219 !! input
13220 ISBN ISBN 1234567890
13221 !! result
13222 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13223 </p>
13224 !! end
13225
13226 !! test
13227 Bug 22905: <abbr> followed by ISBN followed by </a>
13228 !! input
13229 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
13230 !! result
13231 <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>
13232 </p>
13233 !! end
13234
13235 !! test
13236 Double RFC
13237 !! input
13238 RFC RFC 1234
13239 !! result
13240 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
13241 </p>
13242 !! end
13243
13244 !! test
13245 Double RFC with a wiki link
13246 !! input
13247 RFC [[RFC 1234]]
13248 !! result
13249 <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>
13250 </p>
13251 !! end
13252
13253 !! test
13254 RFC code coverage
13255 !! input
13256 RFC 983&#x20;987
13257 !! result
13258 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
13259 </p>
13260 !! end
13261
13262 !! test
13263 Centre-aligned image
13264 !! input
13265 [[Image:foobar.jpg|centre]]
13266 !! result
13267 <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>
13268
13269 !!end
13270
13271 !! test
13272 None-aligned image
13273 !! input
13274 [[Image:foobar.jpg|none]]
13275 !! result
13276 <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>
13277
13278 !!end
13279
13280 !! test
13281 Width + Height sized image (using px) (height is ignored)
13282 !! input
13283 [[Image:foobar.jpg|640x480px]]
13284 !! result
13285 <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>
13286 </p>
13287 !!end
13288
13289 !! test
13290 Width-sized image (using px, no following whitespace)
13291 !! input
13292 [[Image:foobar.jpg|640px]]
13293 !! result
13294 <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>
13295 </p>
13296 !!end
13297
13298 !! test
13299 Width-sized image (using px, with following whitespace - test regression from r39467)
13300 !! input
13301 [[Image:foobar.jpg|640px ]]
13302 !! result
13303 <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>
13304 </p>
13305 !!end
13306
13307 !! test
13308 Width-sized image (using px, with preceding whitespace - test regression from r39467)
13309 !! input
13310 [[Image:foobar.jpg| 640px]]
13311 !! result
13312 <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>
13313 </p>
13314 !!end
13315
13316 !! test
13317 Another italics / bold test
13318 !! input
13319 ''' ''x'
13320 !! result
13321 <pre>'<i> </i>x'
13322 </pre>
13323 !!end
13324
13325 # Note the results may be incorrect, as parserTest output included this:
13326 # XML error: Mismatched tag at byte 6120:
13327 # ...<dd> </dt></dl> </dd...
13328 !! test
13329 dt/dd/dl test
13330 !! options
13331 disabled
13332 !! input
13333 :;;;::
13334 !! result
13335 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
13336 </dd></dl>
13337 </dd></dl>
13338 </dt></dl>
13339 </dt></dl>
13340 </dt></dl>
13341 </dd></dl>
13342
13343 !!end
13344
13345
13346 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
13347 !! test
13348 Images with the "|" character in the comment
13349 !! input
13350 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
13351 !! result
13352 <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>
13353
13354 !!end
13355
13356 !! test
13357 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
13358 !! input
13359 <html><script>alert(1);</script></html>
13360 !! result
13361 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
13362 </p>
13363 !! end
13364
13365 !! test
13366 HTML with raw HTML ($wgRawHtml==true)
13367 !! options
13368 wgRawHtml=1
13369 !! input
13370 <html><script>alert(1);</script></html>
13371 !! result
13372 <p><script>alert(1);</script>
13373 </p>
13374 !! end
13375
13376 !! test
13377 Parents of subpages, one level up
13378 !! options
13379 subpage title=[[Subpage test/L1/L2/L3]]
13380 !! input
13381 [[../|L2]]
13382 !! result
13383 <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>
13384 </p>
13385 !! end
13386
13387
13388 !! test
13389 Parents of subpages, one level up, not named
13390 !! options
13391 subpage title=[[Subpage test/L1/L2/L3]]
13392 !! input
13393 [[../]]
13394 !! result
13395 <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>
13396 </p>
13397 !! end
13398
13399
13400
13401 !! test
13402 Parents of subpages, two levels up
13403 !! options
13404 subpage title=[[Subpage test/L1/L2/L3]]
13405 !! input
13406 [[../../|L1]]2
13407
13408 [[../../|L1]]l
13409 !! result
13410 <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
13411 </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>
13412 </p>
13413 !! end
13414
13415 !! test
13416 Parents of subpages, two levels up, without trailing slash or name.
13417 !! options
13418 subpage title=[[Subpage test/L1/L2/L3]]
13419 !! input
13420 [[../..]]
13421 !! result
13422 <p>[[../..]]
13423 </p>
13424 !! end
13425
13426 !! test
13427 Parents of subpages, two levels up, with lots of extra trailing slashes.
13428 !! options
13429 subpage title=[[Subpage test/L1/L2/L3]]
13430 !! input
13431 [[../../////]]
13432 !! result
13433 <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>
13434 </p>
13435 !! end
13436
13437 !! article
13438 Subpage test/L1/L2/L3Sibling
13439 !! text
13440 Sibling article
13441 !! endarticle
13442
13443 !! test
13444 Transclusion of a sibling page (one level up)
13445 !! options
13446 subpage title=[[Subpage test/L1/L2/L3]]
13447 !! input
13448 {{../L3Sibling}}
13449 !! result
13450 <p>Sibling article
13451 </p>
13452 !! end
13453
13454 !! test
13455 Transclusion of a child page
13456 !! options
13457 subpage title=[[Subpage test/L1/L2]]
13458 !! input
13459 {{/L3Sibling}}
13460 !! result
13461 <p>Sibling article
13462 </p>
13463 !! end
13464
13465 !! test
13466 Non-transclusion because of too many up levels
13467 !! options
13468 subpage title=[[Subpage test/L1/L2/L3]]
13469 !! input
13470 {{../../../../More than parent}}
13471 !! result
13472 <p>{{../../../../More than parent}}
13473 </p>
13474 !! end
13475
13476 !! test
13477 Definition list code coverage
13478 !! input
13479 ; title : def
13480 ; title : def
13481 ;title: def
13482 !! result
13483 <dl><dt> title &#160;</dt><dd> def
13484 </dd><dt> title&#160;</dt><dd> def
13485 </dd><dt>title</dt><dd> def
13486 </dd></dl>
13487
13488 !! end
13489
13490 !! test
13491 Don't fall for the self-closing div
13492 !! input
13493 <div>hello world</div/>
13494 !! result
13495 <div>hello world</div>
13496
13497 !! end
13498
13499 !! test
13500 MSGNW magic word
13501 !! input
13502 {{MSGNW:msg}}
13503 !! result
13504 <p>&#91;&#91;:Template:Msg&#93;&#93;
13505 </p>
13506 !! end
13507
13508 !! test
13509 RAW magic word
13510 !! input
13511 {{RAW:QUERTY}}
13512 !! result
13513 <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>
13514 </p>
13515 !! end
13516
13517 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
13518 !! test
13519 Always escape literal '>' in output, not just after '<'
13520 !! input
13521 ><>
13522 !! result
13523 <p>&gt;&lt;&gt;
13524 </p>
13525 !! end
13526
13527 !! test
13528 Template caching
13529 !! input
13530 {{Test}}
13531 {{Test}}
13532 !! result
13533 <p>This is a test template
13534 This is a test template
13535 </p>
13536 !! end
13537
13538
13539 !! article
13540 MediaWiki:Fake
13541 !! text
13542 ==header==
13543 !! endarticle
13544
13545 !! test
13546 Inclusion of !userCanEdit() content
13547 !! input
13548 {{MediaWiki:Fake}}
13549 !! result
13550 <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>
13551
13552 !! end
13553
13554
13555 !! test
13556 Out-of-order TOC heading levels
13557 !! input
13558 ==2==
13559 ======6======
13560 ===3===
13561 =1=
13562 =====5=====
13563 ==2==
13564 !! result
13565 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13566 <ul>
13567 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
13568 <ul>
13569 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
13570 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
13571 </ul>
13572 </li>
13573 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
13574 <ul>
13575 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
13576 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
13577 </ul>
13578 </li>
13579 </ul>
13580 </div>
13581 <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>
13582 <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>
13583 <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>
13584 <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>
13585 <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>
13586 <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>
13587
13588 !! end
13589
13590
13591 !! test
13592 ISBN with a dummy number
13593 !! input
13594 ISBN ---
13595 !! result
13596 <p>ISBN ---
13597 </p>
13598 !! end
13599
13600
13601 !! test
13602 ISBN with space-delimited number
13603 !! input
13604 ISBN 92 9017 032 8
13605 !! result
13606 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
13607 </p>
13608 !! end
13609
13610
13611 !! test
13612 ISBN with multiple spaces, no number
13613 !! input
13614 ISBN foo
13615 !! result
13616 <p>ISBN foo
13617 </p>
13618 !! end
13619
13620
13621 !! test
13622 ISBN length
13623 !! input
13624 ISBN 123456789
13625
13626 ISBN 1234567890
13627
13628 ISBN 12345678901
13629 !! result
13630 <p>ISBN 123456789
13631 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13632 </p><p>ISBN 12345678901
13633 </p>
13634 !! end
13635
13636
13637 !! test
13638 ISBN with trailing year (bug 8110)
13639 !! input
13640 ISBN 1-234-56789-0 - 2006
13641
13642 ISBN 1 234 56789 0 - 2006
13643 !! result
13644 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
13645 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
13646 </p>
13647 !! end
13648
13649
13650 !! test
13651 anchorencode
13652 !! input
13653 {{anchorencode:foo bar©#%n}}
13654 !! result
13655 <p>foo_bar.C2.A9.23.25n
13656 </p>
13657 !! end
13658
13659 !! test
13660 anchorencode trims spaces
13661 !! input
13662 {{anchorencode: __pretty__please__}}
13663 !! result
13664 <p>pretty_please
13665 </p>
13666 !! end
13667
13668 !! test
13669 anchorencode deals with links
13670 !! input
13671 {{anchorencode: [[hello|world]] [[hi]]}}
13672 !! result
13673 <p>world_hi
13674 </p>
13675 !! end
13676
13677 !! test
13678 anchorencode deals with templates
13679 !! input
13680 {{anchorencode: {{Foo}} }}
13681 !! result
13682 <p>FOO
13683 </p>
13684 !! end
13685
13686 !! test
13687 anchorencode encodes like the TOC generator: (bug 18431)
13688 !! input
13689 === _ +:.3A%3A&&amp;]] ===
13690 {{anchorencode: _ +:.3A%3A&&amp;]] }}
13691 __NOEDITSECTION__
13692 !! result
13693 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
13694 <p>.2B:.3A.253A.26.26.5D.5D
13695 </p>
13696 !! end
13697
13698 !! test
13699 Bug 6200: blockquotes and paragraph formatting
13700 !! input
13701 <blockquote>
13702 foo
13703 </blockquote>
13704
13705 bar
13706
13707 baz
13708 !! result
13709 <blockquote>
13710 <p>foo
13711 </p>
13712 </blockquote>
13713 <p>bar
13714 </p>
13715 <pre>baz
13716 </pre>
13717 !! end
13718
13719 !! test
13720 Bug 8293: Use of center tag ruins paragraph formatting
13721 !! input
13722 <center>
13723 foo
13724 </center>
13725
13726 bar
13727
13728 baz
13729 !! result
13730 <center>
13731 <p>foo
13732 </p>
13733 </center>
13734 <p>bar
13735 </p>
13736 <pre>baz
13737 </pre>
13738 !! end
13739
13740 !!test
13741 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
13742 !!options
13743 php
13744 !!input
13745 <span><s>x</span></s>
13746 !!result
13747 <p><span><s>x&lt;/span&gt;</s></span>
13748 </p>
13749 !!end
13750
13751 !!test
13752 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
13753 !!options
13754 parsoid
13755 !!input
13756 <span><s>x</span></s>
13757 !!result
13758 <p><span><s>x</s></span><s></s>
13759 </p>
13760 !!end
13761
13762 ###
13763 ### Language variants related tests
13764 ###
13765 !! test
13766 Self-link in language variants
13767 !! options
13768 title=[[Dunav]] language=sr
13769 !! input
13770 Both [[Dunav]] and [[Дунав]] are names for this river.
13771 !! result
13772 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
13773 </p>
13774 !!end
13775
13776 !! article
13777 Дуна
13778 !! text
13779 content
13780 !! endarticle
13781
13782 !! test
13783 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
13784 !! options
13785 title=[[Duna]] language=sr
13786 !! input
13787 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
13788 !! result
13789 <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.
13790 </p>
13791 !! end
13792
13793 !! test
13794 Link to pages in language variants
13795 !! options
13796 language=sr
13797 !! input
13798 Main Page can be written as [[Маин Паге]]
13799 !! result
13800 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
13801 </p>
13802 !!end
13803
13804
13805 !! test
13806 Multiple links to pages in language variants
13807 !! options
13808 language=sr
13809 !! input
13810 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
13811 !! result
13812 <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>.
13813 </p>
13814 !!end
13815
13816
13817 !! test
13818 Simple template in language variants
13819 !! options
13820 language=sr
13821 !! input
13822 {{тест}}
13823 !! result
13824 <p>This is a test template
13825 </p>
13826 !! end
13827
13828
13829 !! test
13830 Template with explicit namespace in language variants
13831 !! options
13832 language=sr
13833 !! input
13834 {{Template:тест}}
13835 !! result
13836 <p>This is a test template
13837 </p>
13838 !! end
13839
13840
13841 !! test
13842 Basic test for template parameter in language variants
13843 !! options
13844 language=sr
13845 !! input
13846 {{парамтест|param=foo}}
13847 !! result
13848 <p>This is a test template with parameter foo
13849 </p>
13850 !! end
13851
13852
13853 !! test
13854 Simple category in language variants
13855 !! options
13856 language=sr cat
13857 !! input
13858 [[Category:МедиаWики Усер'с Гуиде]]
13859 !! result
13860 <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>
13861 !! end
13862
13863
13864 !! article
13865 Category:分类
13866 !! text
13867 blah
13868 !! endarticle
13869
13870 !! article
13871 Category:分類
13872 !! text
13873 blah
13874 !! endarticle
13875
13876 !! test
13877 Don't convert blue categorylinks to another variant (bug 33210)
13878 !! options
13879 language=zh cat
13880 !! input
13881 [[A]][[Category:分类]]
13882 !! result
13883 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
13884 !! end
13885
13886
13887 !! test
13888 Stripping -{}- tags (language variants)
13889 !! options
13890 language=sr
13891 !! input
13892 Latin proverb: -{Ne nuntium necare}-
13893 !! result
13894 <p>Latin proverb: Ne nuntium necare
13895 </p>
13896 !! end
13897
13898
13899 !! test
13900 Prevent conversion with -{}- tags (language variants)
13901 !! options
13902 language=sr variant=sr-ec
13903 !! input
13904 Latinski: -{Ne nuntium necare}-
13905 !! result
13906 <p>Латински: Ne nuntium necare
13907 </p>
13908 !! end
13909
13910
13911 !! test
13912 Prevent conversion of text with -{}- tags (language variants)
13913 !! options
13914 language=sr variant=sr-ec
13915 !! input
13916 Latinski: -{Ne nuntium necare}-
13917 !! result
13918 <p>Латински: Ne nuntium necare
13919 </p>
13920 !! end
13921
13922
13923 !! test
13924 Prevent conversion of links with -{}- tags (language variants)
13925 !! options
13926 language=sr variant=sr-ec
13927 !! input
13928 -{[[Main Page]]}-
13929 !! result
13930 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13931 </p>
13932 !! end
13933
13934
13935 !! test
13936 -{}- tags within headlines (within html for parserConvert())
13937 !! options
13938 language=sr variant=sr-ec
13939 !! input
13940 == -{Naslov}- ==
13941 !! result
13942 <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>
13943
13944 !! end
13945
13946
13947 !! test
13948 Explicit definition of language variant alternatives
13949 !! options
13950 language=zh variant=zh-tw
13951 !! input
13952 -{zh:China;zh-tw:Taiwan}-, not China
13953 !! result
13954 <p>Taiwan, not China
13955 </p>
13956 !! end
13957
13958
13959 !! test
13960 Conversion around HTML tags
13961 !! options
13962 language=sr variant=sr-ec
13963 !! input
13964 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
13965 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
13966 !! result
13967 <p>
13968 <span title="ЛаCтин">ски</span>
13969 </p>
13970 !! end
13971
13972
13973 !! test
13974 Explicit session-wise language variant mapping (A flag and - flag)
13975 !! options
13976 language=zh variant=zh-tw
13977 !! input
13978 Taiwan is not China.
13979 But -{A|zh:China;zh-tw:Taiwan}- is China,
13980 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
13981 and -{China}- is China.
13982 !! result
13983 <p>Taiwan is not China.
13984 But Taiwan is Taiwan,
13985 (This should be stripped!)
13986 and China is China.
13987 </p>
13988 !! end
13989
13990 !! test
13991 Explicit session-wise language variant mapping (H flag for hide)
13992 !! options
13993 language=zh variant=zh-tw
13994 !! input
13995 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
13996 Taiwan is China.
13997 !! result
13998 <p>(This should be stripped!)
13999 Taiwan is Taiwan.
14000 </p>
14001 !! end
14002
14003 !! test
14004 Adding explicit conversion rule for title (T flag)
14005 !! options
14006 language=zh variant=zh-tw showtitle
14007 !! input
14008 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
14009 !! result
14010 Taiwan
14011 <p>Should be stripped!
14012 </p>
14013 !! end
14014
14015 !! test
14016 Testing that changing the language variant here in the tests actually works
14017 !! options
14018 language=zh variant=zh showtitle
14019 !! input
14020 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
14021 !! result
14022 China
14023 <p>Should be stripped!
14024 </p>
14025 !! end
14026
14027 !! test
14028 Recursive conversion of alt and title attrs shouldn't clear converter state
14029 !! options
14030 language=zh variant=zh-cn showtitle
14031 !! input
14032 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
14033 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
14034 !! result
14035 China
14036 <p>
14037 Should be stripped<span title="Exclamation">!</span>
14038 </p>
14039 !! end
14040
14041 !! test
14042 Bug 24072: more test on conversion rule for title
14043 !! options
14044 language=zh variant=zh-tw showtitle
14045 !! input
14046 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
14047 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
14048 !! result
14049 Taiwan
14050 <p>This should be stripped!
14051 This won't take interferes with the title rule.
14052 </p>
14053 !! end
14054
14055 !! test
14056 Partly disable title conversion if variant == main language code
14057 !! options
14058 language=zh variant=zh title=[[ZH]] showtitle
14059 !! input
14060 -{T|zh-cn:CN;zh-tw:TW}-
14061 !! result
14062 ZH
14063 <p>
14064 </p>
14065 !! end
14066
14067 !! test
14068 Partly disable title conversion if variant == main language code, more
14069 !! options
14070 language=zh variant=zh title=[[ZH]] showtitle
14071 !! input
14072 -{T|TW}-
14073 !! result
14074 ZH
14075 <p>
14076 </p>
14077 !! end
14078
14079 !! test
14080 Raw output of variant escape tags (R flag)
14081 !! options
14082 language=zh variant=zh-tw
14083 !! input
14084 Raw: -{R|zh:China;zh-tw:Taiwan}-
14085 !! result
14086 <p>Raw: zh:China;zh-tw:Taiwan
14087 </p>
14088 !! end
14089
14090 !! test
14091 Nested using of manual convert syntax
14092 !! options
14093 language=zh variant=zh-hk
14094 !! input
14095 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
14096 !! result
14097 <p>Nested: Hello Hong Kong!
14098 </p>
14099 !! end
14100
14101 !! test
14102 Proper conversion of text in external links
14103 !! options
14104 language=sr variant=sr-ec
14105 !! input
14106 http://www.google.com
14107 gopher://www.google.com
14108 [http://www.google.com http://www.google.com]
14109 [gopher://www.google.com gopher://www.google.com]
14110 [https://www.google.com irc://www.google.com]
14111 [ftp://www.google.com www.google.com/ftp://dir]
14112 [//www.google.com www.google.com]
14113 !! result
14114 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
14115 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
14116 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
14117 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
14118 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
14119 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
14120 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
14121 </p>
14122 !! end
14123
14124 !! test
14125 Do not convert roman numbers to language variants
14126 !! options
14127 language=sr variant=sr-ec
14128 !! input
14129 Fridrih IV je car.
14130 !! result
14131 <p>Фридрих IV је цар.
14132 </p>
14133 !! end
14134
14135 !! test
14136 Unclosed language converter markup "-{"
14137 !! options
14138 language=sr
14139 !! input
14140 -{T|hello
14141 !! result
14142 <p>-{T|hello
14143 </p>
14144 !! end
14145
14146 !! test
14147 Don't convert raw rule "-{R|=&gt;}-" to "=>"
14148 !! options
14149 language=sr
14150 !! input
14151 -{R|=&gt;}-
14152 !! result
14153 <p>=&gt;
14154 </p>
14155 !!end
14156
14157 !! test
14158 Bug 529: Uncovered bullet
14159 !! input
14160 * Foo {{bullet}}
14161 !! result
14162 <ul><li> Foo
14163 </li><li> Bar
14164 </li></ul>
14165
14166 !! end
14167
14168 # Plain MediaWiki does not remove empty lists, but tidy actually does.
14169 # Templates in Wikipedia rely on this behavior, as tidy has always been
14170 # enabled there. These tests are normally run *without* tidy, so specify the
14171 # full output here.
14172 # To test realistic parsing behavior, apply a tidy-like transformation to both
14173 # the expected output and your parser's output.
14174 !! test
14175 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
14176 !! input
14177 ******* Foo {{bullet}}
14178 !! result
14179 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
14180 </li></ul>
14181 </li></ul>
14182 </li></ul>
14183 </li></ul>
14184 </li></ul>
14185 </li></ul>
14186 </li><li> Bar
14187 </li></ul>
14188
14189 !! end
14190
14191 !! test
14192 Bug 529: Uncovered table already at line-start
14193 !! input
14194 x
14195
14196 {{table}}
14197 y
14198 !! result
14199 <p>x
14200 </p>
14201 <table>
14202 <tr>
14203 <td> 1 </td>
14204 <td> 2
14205 </td></tr>
14206 <tr>
14207 <td> 3 </td>
14208 <td> 4
14209 </td></tr></table>
14210 <p>y
14211 </p>
14212 !! end
14213
14214 !! test
14215 Bug 529: Uncovered bullet in parser function result
14216 !! input
14217 * Foo {{lc:{{bullet}} }}
14218 !! result
14219 <ul><li> Foo
14220 </li><li> bar
14221 </li></ul>
14222
14223 !! end
14224
14225 !! test
14226 Bug 5678: Double-parsed template argument
14227 !! input
14228 {{lc:{{{1}}}|hello}}
14229 !! result
14230 <p>{{{1}}}
14231 </p>
14232 !! end
14233
14234 !! test
14235 Bug 5678: Double-parsed template invocation
14236 !! input
14237 {{lc:{{paramtest {{!}} param = hello }} }}
14238 !! result
14239 <p>{{paramtest | param = hello }}
14240 </p>
14241 !! end
14242
14243 !! test
14244 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
14245 !! options
14246 language=cs
14247 title=[[Main Page]]
14248 !! input
14249 {{PRVNÍVELKÉ:ěščř}}
14250 {{prvnívelké:ěščř}}
14251 {{PRVNÍMALÉ:ěščř}}
14252 {{prvnímalé:ěščř}}
14253 {{MALÁ:ěščř}}
14254 {{malá:ěščř}}
14255 {{VELKÁ:ěščř}}
14256 {{velká:ěščř}}
14257 !! result
14258 <p>Ěščř
14259 Ěščř
14260 ěščř
14261 ěščř
14262 ěščř
14263 ěščř
14264 ĚŠČŘ
14265 ĚŠČŘ
14266 </p>
14267 !! end
14268
14269 !! test
14270 Morwen/13: Unclosed link followed by heading
14271 !! input
14272 [[link
14273 ==heading==
14274 !! result
14275 <p>[[link
14276 </p>
14277 <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>
14278
14279 !! end
14280
14281 !! test
14282 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
14283 !! input
14284 {{foo|
14285 =heading=
14286 !! result
14287 <p>{{foo|
14288 </p>
14289 <h1><span class="mw-headline" id="heading">heading</span></h1>
14290
14291 !! end
14292
14293 !! test
14294 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
14295 !! input
14296 {{foo|
14297 ==heading==
14298 !! result
14299 <p>{{foo|
14300 </p>
14301 <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>
14302
14303 !! end
14304
14305 !! test
14306 Tildes in comments
14307 !! options
14308 pst
14309 !! input
14310 <!-- ~~~~ -->
14311 !! result
14312 <!-- ~~~~ -->
14313 !! end
14314
14315 !! test
14316 Paragraphs inside divs (no extra line breaks)
14317 !! input
14318 <div>Line one
14319
14320 Line two</div>
14321 !! result
14322 <div>Line one
14323 Line two</div>
14324
14325 !! end
14326
14327 !! test
14328 Paragraphs inside divs (extra line break on open)
14329 !! input
14330 <div>
14331 Line one
14332
14333 Line two</div>
14334 !! result
14335 <div>
14336 <p>Line one
14337 </p>
14338 Line two</div>
14339
14340 !! end
14341
14342 !! test
14343 Paragraphs inside divs (extra line break on close)
14344 !! input
14345 <div>Line one
14346
14347 Line two
14348 </div>
14349 !! result
14350 <div>Line one
14351 <p>Line two
14352 </p>
14353 </div>
14354
14355 !! end
14356
14357 !! test
14358 Paragraphs inside divs (extra line break on open and close)
14359 !! input
14360 <div>
14361 Line one
14362
14363 Line two
14364 </div>
14365 !! result
14366 <div>
14367 <p>Line one
14368 </p><p>Line two
14369 </p>
14370 </div>
14371
14372 !! end
14373
14374 !! test
14375 Nesting tags, paragraphs on lines which begin with <div>
14376 !! options
14377 disabled
14378 !! input
14379 <div></div><strong>A
14380 B</strong>
14381 !! result
14382 <div></div>
14383 <p><strong>A
14384 B</strong>
14385 </p>
14386 !! end
14387
14388 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
14389 !! test
14390 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
14391 !! input
14392 <blockquote>Line one
14393
14394 Line two</blockquote>
14395 !! result
14396 <blockquote>Line one
14397 Line two</blockquote>
14398
14399 !! end
14400
14401 !! test
14402 Bug 6200: paragraphs inside blockquotes (extra line break on open)
14403 !! input
14404 <blockquote>
14405 Line one
14406
14407 Line two</blockquote>
14408 !! result
14409 <blockquote>
14410 <p>Line one
14411 </p>
14412 Line two</blockquote>
14413
14414 !! end
14415
14416 !! test
14417 Bug 6200: paragraphs inside blockquotes (extra line break on close)
14418 !! input
14419 <blockquote>Line one
14420
14421 Line two
14422 </blockquote>
14423 !! result
14424 <blockquote>Line one
14425 <p>Line two
14426 </p>
14427 </blockquote>
14428
14429 !! end
14430
14431 !! test
14432 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
14433 !! input
14434 <blockquote>
14435 Line one
14436
14437 Line two
14438 </blockquote>
14439 !! result
14440 <blockquote>
14441 <p>Line one
14442 </p><p>Line two
14443 </p>
14444 </blockquote>
14445
14446 !! end
14447
14448 !! test
14449 Paragraphs inside blockquotes/divs (no extra line breaks)
14450 !! input
14451 <blockquote><div>Line one
14452
14453 Line two</div></blockquote>
14454 !! result
14455 <blockquote><div>Line one
14456 Line two</div></blockquote>
14457
14458 !! end
14459
14460 !! test
14461 Paragraphs inside blockquotes/divs (extra line break on open)
14462 !! input
14463 <blockquote><div>
14464 Line one
14465
14466 Line two</div></blockquote>
14467 !! result
14468 <blockquote><div>
14469 <p>Line one
14470 </p>
14471 Line two</div></blockquote>
14472
14473 !! end
14474
14475 !! test
14476 Paragraphs inside blockquotes/divs (extra line break on close)
14477 !! input
14478 <blockquote><div>Line one
14479
14480 Line two
14481 </div></blockquote>
14482 !! result
14483 <blockquote><div>Line one
14484 <p>Line two
14485 </p>
14486 </div></blockquote>
14487
14488 !! end
14489
14490 !! test
14491 Paragraphs inside blockquotes/divs (extra line break on open and close)
14492 !! input
14493 <blockquote><div>
14494 Line one
14495
14496 Line two
14497 </div></blockquote>
14498 !! result
14499 <blockquote><div>
14500 <p>Line one
14501 </p><p>Line two
14502 </p>
14503 </div></blockquote>
14504
14505 !! end
14506
14507 !! test
14508 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
14509 !! options
14510 wgLinkHolderBatchSize=0
14511 !! input
14512 [[meatball:1]]
14513 [[meatball:2]]
14514 [[meatball:3]]
14515 !! result
14516 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
14517 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
14518 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
14519 </p>
14520 !! end
14521
14522 !! test
14523 Free external link invading image caption
14524 !! input
14525 [[Image:Foobar.jpg|thumb|http://x|hello]]
14526 !! result
14527 <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>
14528
14529 !! end
14530
14531 !! test
14532 Bug 15196: localised external link numbers
14533 !! options
14534 language=fa
14535 !! input
14536 [http://en.wikipedia.org/]
14537 !! result
14538 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
14539 </p>
14540 !! end
14541
14542 !! test
14543 Multibyte character in padleft
14544 !! input
14545 {{padleft:-Hello|7|Æ}}
14546 !! result
14547 <p>Æ-Hello
14548 </p>
14549 !! end
14550
14551 !! test
14552 Multibyte character in padright
14553 !! input
14554 {{padright:Hello-|7|Æ}}
14555 !! result
14556 <p>Hello-Æ
14557 </p>
14558 !! end
14559
14560 !!test
14561 formatdate parser function
14562 !!input
14563 {{#formatdate:2009-03-24}}
14564 !! result
14565 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
14566 </p>
14567 !! end
14568
14569 !!test
14570 formatdate parser function, with default format
14571 !!input
14572 {{#formatdate:2009-03-24|mdy}}
14573 !! result
14574 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
14575 </p>
14576 !! end
14577
14578 !! test
14579 Spacing of numbers in formatted dates
14580 !! input
14581 {{#formatdate:January 15}}
14582 !! result
14583 <p><span class="mw-formatted-date" title="01-15">January 15</span>
14584 </p>
14585 !! end
14586
14587 !! test
14588 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
14589 !! options
14590 language=nl title=[[MediaWiki:Common.css]]
14591 !! input
14592 {{#formatdate:2009-03-24|dmy}}
14593 !! result
14594 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
14595 </p>
14596 !! end
14597
14598 #
14599 #
14600 #
14601
14602 #
14603 # Edit comments
14604 #
14605
14606 !! test
14607 Edit comment with link
14608 !! options
14609 comment
14610 !! input
14611 I like the [[Main Page]] a lot
14612 !! result
14613 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
14614 !!end
14615
14616 !! test
14617 Edit comment with link and link text
14618 !! options
14619 comment
14620 !! input
14621 I like the [[Main Page|best pages]] a lot
14622 !! result
14623 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14624 !!end
14625
14626 !! test
14627 Edit comment with link and link text with suffix
14628 !! options
14629 comment
14630 !! input
14631 I like the [[Main Page|best page]]s a lot
14632 !! result
14633 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14634 !!end
14635
14636 !! test
14637 Edit comment with section link (non-local, eg in history list)
14638 !! options
14639 comment title=[[Main Page]]
14640 !! input
14641 /* External links */ removed bogus entries
14642 !! result
14643 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14644 !!end
14645
14646 !! test
14647 Edit comment with section link and text before it (non-local, eg in history list)
14648 !! options
14649 comment title=[[Main Page]]
14650 !! input
14651 pre-comment text /* External links */ removed bogus entries
14652 !! result
14653 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>
14654 !!end
14655
14656 !! test
14657 Edit comment with section link (local, eg in diff view)
14658 !! options
14659 comment local title=[[Main Page]]
14660 !! input
14661 /* External links */ removed bogus entries
14662 !! result
14663 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14664 !!end
14665
14666 !! test
14667 Edit comment with subpage link (bug 14080)
14668 !! options
14669 comment
14670 subpage
14671 title=[[Subpage test]]
14672 !! input
14673 Poked at a [[/subpage]] here...
14674 !! result
14675 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
14676 !!end
14677
14678 !! test
14679 Edit comment with subpage link and link text (bug 14080)
14680 !! options
14681 comment
14682 subpage
14683 title=[[Subpage test]]
14684 !! input
14685 Poked at a [[/subpage|neat little page]] here...
14686 !! result
14687 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
14688 !!end
14689
14690 !! test
14691 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
14692 !! options
14693 comment
14694 title=[[Subpage test]]
14695 !! input
14696 Poked at a [[/subpage]] here...
14697 !! result
14698 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...
14699 !!end
14700
14701 !! test
14702 Edit comment with bare anchor link (local, as on diff)
14703 !! options
14704 comment
14705 local
14706 title=[[Main Page]]
14707 !!input
14708 [[#section]]
14709 !! result
14710 <a href="#section">#section</a>
14711 !! end
14712
14713 !! test
14714 Edit comment with bare anchor link (non-local, as on history)
14715 !! options
14716 comment
14717 title=[[Main Page]]
14718 !!input
14719 [[#section]]
14720 !! result
14721 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
14722 !! end
14723
14724 !! test
14725 Anchor starting with underscore
14726 !!input
14727 [[#_ref|One]]
14728 !! result
14729 <p><a href="#_ref">One</a>
14730 </p>
14731 !! end
14732
14733 !! test
14734 Id starting with underscore
14735 !!input
14736 <div id="_ref"></div>
14737 !! result
14738 <div id="_ref"></div>
14739
14740 !! end
14741
14742 !! test
14743 Space normalisation on autocomment (bug 22784)
14744 !! options
14745 comment
14746 title=[[Main Page]]
14747 !!input
14748 /* __hello__world__ */
14749 !! result
14750 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
14751 !! end
14752
14753 !! test
14754 percent-encoding and + signs in comments (Bug 26410)
14755 !! options
14756 comment
14757 !!input
14758 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
14759 !! result
14760 <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>
14761 !! end
14762
14763 !! test
14764 Bad images - basic functionality
14765 !! options
14766 disabled
14767 !! input
14768 [[File:Bad.jpg]]
14769 !! result
14770 !! end
14771
14772 !! test
14773 Bad images - bug 16039: text after bad image disappears
14774 !! options
14775 disabled
14776 !! input
14777 Foo bar
14778 [[File:Bad.jpg]]
14779 Bar foo
14780 !! result
14781 <p>Foo bar
14782 </p><p>Bar foo
14783 </p>
14784 !! end
14785
14786 !! test
14787 Verify that displaytitle works (bug #22501) no displaytitle
14788 !! options
14789 showtitle
14790 !! config
14791 wgAllowDisplayTitle=true
14792 wgRestrictDisplayTitle=false
14793 !! input
14794 this is not the the title
14795 !! result
14796 Parser test
14797 <p>this is not the the title
14798 </p>
14799 !! end
14800
14801 !! test
14802 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
14803 !! options
14804 showtitle
14805 title=[[Screen]]
14806 !! config
14807 wgAllowDisplayTitle=true
14808 wgRestrictDisplayTitle=false
14809 !! input
14810 this is not the the title
14811 {{DISPLAYTITLE:whatever}}
14812 !! result
14813 whatever
14814 <p>this is not the the title
14815 </p>
14816 !! end
14817
14818 !! test
14819 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
14820 !! options
14821 showtitle
14822 title=[[Screen]]
14823 !! config
14824 wgAllowDisplayTitle=true
14825 wgRestrictDisplayTitle=true
14826 !! input
14827 this is not the the title
14828 {{DISPLAYTITLE:whatever}}
14829 !! result
14830 Screen
14831 <p>this is not the the title
14832 </p>
14833 !! end
14834
14835 !! test
14836 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
14837 !! options
14838 showtitle
14839 title=[[Screen]]
14840 !! config
14841 wgAllowDisplayTitle=true
14842 wgRestrictDisplayTitle=true
14843 !! input
14844 this is not the the title
14845 {{DISPLAYTITLE:screen}}
14846 !! result
14847 screen
14848 <p>this is not the the title
14849 </p>
14850 !! end
14851
14852 !! test
14853 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
14854 !! options
14855 showtitle
14856 title=[[Screen]]
14857 !! config
14858 wgAllowDisplayTitle=false
14859 !! input
14860 this is not the the title
14861 {{DISPLAYTITLE:screen}}
14862 !! result
14863 Screen
14864 <p>this is not the the title
14865 <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>
14866 </p>
14867 !! end
14868
14869 !! test
14870 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
14871 !! options
14872 showtitle
14873 title=[[Screen]]
14874 !! config
14875 wgAllowDisplayTitle=false
14876 !! input
14877 this is not the the title
14878 !! result
14879 Screen
14880 <p>this is not the the title
14881 </p>
14882 !! end
14883
14884 !! test
14885 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
14886 !! options
14887 showtitle
14888 title=[[Screen]]
14889 !! config
14890 wgAllowDisplayTitle=true
14891 wgRestrictDisplayTitle=true
14892 !! input
14893 this is not the the title
14894 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
14895 !! result
14896 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
14897 <p>this is not the the title
14898 </p>
14899 !! end
14900
14901 !! test
14902 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
14903 !! options
14904 showtitle
14905 title=[[Screen]]
14906 !! config
14907 wgAllowDisplayTitle=true
14908 wgRestrictDisplayTitle=true
14909 !! input
14910 this is not the the title
14911 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
14912 !! result
14913 <span style="color: red;">s</span>creen
14914 <p>this is not the the title
14915 </p>
14916 !! end
14917
14918 !! test
14919 preload: check <noinclude> and <includeonly>
14920 !! options
14921 preload
14922 !! input
14923 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
14924 !! result
14925 Hello kind world.
14926 !! end
14927
14928 !! test
14929 preload: check <onlyinclude>
14930 !! options
14931 preload
14932 !! input
14933 Goodbye <onlyinclude>Hello world</onlyinclude>
14934 !! result
14935 Hello world
14936 !! end
14937
14938 !! test
14939 preload: can pass tags through if we want to
14940 !! options
14941 preload
14942 !! input
14943 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
14944 !! result
14945 <includeonly>Hello world</includeonly>
14946 !! end
14947
14948 !! test
14949 preload: check that it doesn't try to do tricks
14950 !! options
14951 preload
14952 !! input
14953 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14954 !! result
14955 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14956 !! end
14957
14958 !! test
14959 Play a bit with r67090 and bug 3158
14960 !! options
14961 disabled
14962 !! input
14963 <div style="width:50% !important">&nbsp;</div>
14964 <div style="width:50%&nbsp;!important">&nbsp;</div>
14965 <div style="width:50%&#160;!important">&nbsp;</div>
14966 <div style="border : solid;">&nbsp;</div>
14967 !! result
14968 <div style="width:50% !important">&nbsp;</div>
14969 <div style="width:50% !important">&nbsp;</div>
14970 <div style="width:50% !important">&nbsp;</div>
14971 <div style="border&#160;: solid;">&nbsp;</div>
14972
14973 !! end
14974
14975 !! test
14976 HTML5 data attributes
14977 !! input
14978 <span data-foo="bar">Baz</span>
14979 <p data-abc-def_hij="">Quuz</p>
14980 !! result
14981 <p><span data-foo="bar">Baz</span>
14982 </p>
14983 <p data-abc-def_hij="">Quuz</p>
14984
14985 !! end
14986
14987 !! test
14988 percent-encoding and + signs in internal links (Bug 26410)
14989 !! input
14990 [[User:+%]] [[Page+title%]]
14991 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
14992 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
14993 [[%33%45]] [[%33%45+]]
14994 !! result
14995 <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>
14996 <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>
14997 <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>
14998 <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>
14999 </p>
15000 !! end
15001
15002 !! test
15003 Special characters in embedded file links (bug 27679)
15004 !! input
15005 [[File:Contains & ampersand.jpg]]
15006 [[File:Does not exist.jpg|Title with & ampersand]]
15007 !! result
15008 <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>
15009 <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>
15010 </p>
15011 !! end
15012
15013
15014 !! test
15015 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
15016 !! input
15017 Text&apos;s been normalized?
15018 !! result
15019 <p>Text&#39;s been normalized?
15020 </p>
15021 !! end
15022
15023 !! test
15024 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
15025 !! input
15026 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
15027 !! result
15028 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
15029 </p>
15030 !! end
15031
15032 !! test
15033 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
15034 !! input
15035 [http://www.example.org/ ideograms]
15036 !! result
15037 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
15038 </p>
15039 !! end
15040
15041 !! test
15042 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
15043 !! input
15044 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
15045 !! result
15046 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
15047 </p>
15048 !! end
15049
15050 !! article
15051 Mediawiki:loop1
15052 !! text
15053 {{Identical|A}}
15054 !! endarticle
15055
15056 !! article
15057 Mediawiki:loop2
15058 !! text
15059 {{Identical|B}}
15060 !! endarticle
15061
15062 !! article
15063 Template:Identical
15064 !! text
15065 {{int:loop1}}
15066 {{int:loop2}}
15067 !! endarticle
15068
15069 !! test
15070 Bug 31098 Template which includes system messages which includes the template
15071 !! input
15072 {{Identical}}
15073 !! result
15074 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
15075 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
15076 </p>
15077 !! end
15078
15079 !! test
15080 Bug31490 Turkish: ucfirst 'blah'
15081 !! options
15082 language=tr
15083 !! input
15084 {{ucfirst:blah}}
15085 !! result
15086 <p>Blah
15087 </p>
15088 !! end
15089
15090 !! test
15091 Bug31490 Turkish: ucfirst 'ix'
15092 !! options
15093 language=tr
15094 !! input
15095 {{ucfirst:ix}}
15096 !! result
15097 <p>İx
15098 </p>
15099 !! end
15100
15101 !! test
15102 Bug31490 Turkish: lcfirst 'BLAH'
15103 !! options
15104 language=tr
15105 !! input
15106 {{lcfirst:BLAH}}
15107 !! result
15108 <p>bLAH
15109 </p>
15110 !! end
15111
15112 !! test
15113 Bug31490 Turkish: ucfırst (with a dotless i)
15114 !! options
15115 language=tr
15116 !! input
15117 {{ucfırst:blah}}
15118 !! result
15119 <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>
15120 </p>
15121 !! end
15122
15123 !! test
15124 Bug31490 ucfırst (with a dotless i) with English language
15125 !! options
15126 language=en
15127 !! input
15128 {{ucfırst:blah}}
15129 !! result
15130 <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>
15131 </p>
15132 !! end
15133
15134 !! test
15135 Bug 26375: TOC with italics
15136 !! options
15137 title=[[Main Page]]
15138 !! input
15139 __TOC__
15140 == ''Lost'' episodes ==
15141 !! result
15142 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15143 <ul>
15144 <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>
15145 </ul>
15146 </div>
15147 <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>
15148
15149 !! end
15150
15151 !! test
15152 Bug 26375: TOC with bold
15153 !! options
15154 title=[[Main Page]]
15155 !! input
15156 __TOC__
15157 == '''should be bold''' then normal text ==
15158 !! result
15159 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15160 <ul>
15161 <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>
15162 </ul>
15163 </div>
15164 <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>
15165
15166 !! end
15167
15168 !! test
15169 Bug 33845: Headings become cursive in TOC when they contain an image
15170 !! options
15171 title=[[Main Page]]
15172 !! input
15173 __TOC__
15174 == Image [[Image:foobar.jpg]] ==
15175 !! result
15176 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15177 <ul>
15178 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
15179 </ul>
15180 </div>
15181 <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>
15182
15183 !! end
15184
15185 !! test
15186 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
15187 !! options
15188 title=[[Main Page]]
15189 !! input
15190 __TOC__
15191 == <blockquote>Quote</blockquote> ==
15192 !! result
15193 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15194 <ul>
15195 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
15196 </ul>
15197 </div>
15198 <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>
15199
15200 !! end
15201
15202 !! test
15203 Unclosed tags in TOC
15204 !! options
15205 title=[[Main Page]]
15206 !! input
15207 __TOC__
15208 == Proof: 2 < 3 ==
15209 <small>Hanc marginis exiguitas non caperet.</small>
15210 QED
15211 !! result
15212 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15213 <ul>
15214 <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>
15215 </ul>
15216 </div>
15217 <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>
15218 <p><small>Hanc marginis exiguitas non caperet.</small>
15219 QED
15220 </p>
15221 !! end
15222
15223 !! test
15224 Multiple tags in TOC
15225 !! input
15226 __TOC__
15227 == <i>Foo</i> <b>Bar</b> ==
15228
15229 == <i>Foo</i> <blockquote>Bar</blockquote> ==
15230 !! result
15231 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15232 <ul>
15233 <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>
15234 <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>
15235 </ul>
15236 </div>
15237 <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>
15238 <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>
15239
15240 !! end
15241
15242 !! test
15243 Tags with parameters in TOC
15244 !! input
15245 __TOC__
15246 == <sup class="in-h2">Hello</sup> ==
15247
15248 == <sup class="a > b">Evilbye</sup> ==
15249 !! result
15250 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15251 <ul>
15252 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
15253 <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>
15254 </ul>
15255 </div>
15256 <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>
15257 <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>
15258
15259 !! end
15260
15261 !! test
15262 span tags with directionality in TOC
15263 !! input
15264 __TOC__
15265 == <span dir="ltr">C++</span> ==
15266
15267 == <span dir="rtl">זבנג!</span> ==
15268
15269 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
15270
15271 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
15272
15273 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
15274 !! result
15275 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15276 <ul>
15277 <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>
15278 <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>
15279 <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>
15280 <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>
15281 <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>
15282 </ul>
15283 </div>
15284 <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>
15285 <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>
15286 <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>
15287 <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>
15288 <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>
15289
15290 !! end
15291
15292 !! article
15293 MediaWiki:Bug32057
15294 !! text
15295 == {{int:headline_sample}} ==
15296 !! endarticle
15297
15298 !! test
15299 Bug 32057: Title needed when expanding <h> nodes.
15300 !! options
15301 title=[[Main Page]]
15302 !! input
15303 {{int:Bug32057}}
15304 !! result
15305 <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>
15306
15307 !! end
15308
15309 !! test
15310 Strip marker in urlencode
15311 !! input
15312 {{urlencode:x<nowiki/>y}}
15313 {{urlencode:x<nowiki/>y|wiki}}
15314 {{urlencode:x<nowiki/>y|path}}
15315 !! result
15316 <p>xy
15317 xy
15318 xy
15319 </p>
15320 !! end
15321
15322 !! test
15323 Strip marker in lc
15324 !! input
15325 {{lc:x<nowiki/>y}}
15326 !! result
15327 <p>xy
15328 </p>
15329 !! end
15330
15331 !! test
15332 Strip marker in uc
15333 !! input
15334 {{uc:x<nowiki/>y}}
15335 !! result
15336 <p>XY
15337 </p>
15338 !! end
15339
15340 !! test
15341 Strip marker in formatNum
15342 !! input
15343 {{formatnum:1<nowiki/>2}}
15344 {{formatnum:1<nowiki/>2|R}}
15345 !! result
15346 <p>12
15347 12
15348 </p>
15349 !! end
15350
15351 !! test
15352 Check noCommafy in formatNum
15353 !! options
15354 language=be-tarask
15355 !! input
15356 {{formatnum:123456.78}}
15357 {{formatnum:123456.78|NOSEP}}
15358 !! result
15359 <p>123 456,78
15360 123456.78
15361 </p>
15362 !! end
15363
15364 !! test
15365 Strip marker in grammar
15366 !! options
15367 language=fi
15368 !! input
15369 {{grammar:elative|foo<nowiki/>bar}}
15370 !! result
15371 <p>foobarista
15372 </p>
15373 !! end
15374
15375 !! test
15376 Strip marker in padleft
15377 !! input
15378 {{padleft:|2|x<nowiki/>y}}
15379 !! result
15380 <p>xy
15381 </p>
15382 !! end
15383
15384 !! test
15385 Strip marker in padright
15386 !! input
15387 {{padright:|2|x<nowiki/>y}}
15388 !! result
15389 <p>xy
15390 </p>
15391 !! end
15392
15393 !! test
15394 Strip marker in anchorencode
15395 !! input
15396 {{anchorencode:x<nowiki/>y}}
15397 !! result
15398 <p>xy
15399 </p>
15400 !! end
15401
15402 !! test
15403 nowiki inside link inside heading (bug 18295)
15404 !! input
15405 ==[[foo|x<nowiki>y</nowiki>z]]==
15406 !! result
15407 <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>
15408
15409 !! end
15410
15411 !! test
15412 new support for bdi element (bug 31817)
15413 !! input
15414 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
15415 !! result
15416 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
15417
15418 !!end
15419
15420 !! test
15421 Ignore pipe between table row attributes
15422 !! input
15423 {|
15424 | quux
15425 |- id=foo | style='color: red'
15426 | bar
15427 |}
15428 !! result
15429 <table>
15430 <tr>
15431 <td> quux
15432 </td></tr>
15433 <tr id="foo" style="color: red">
15434 <td> bar
15435 </td></tr></table>
15436
15437 !! end
15438
15439 !!test
15440 Gallery override link with WikiLink (bug 34852)
15441 !! input
15442 <gallery>
15443 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
15444 </gallery>
15445 !! result
15446 <ul class="gallery mw-gallery-traditional">
15447 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15448 <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>
15449 <div class="gallerytext">
15450 <p>caption
15451 </p>
15452 </div>
15453 </div></li>
15454 </ul>
15455
15456 !! end
15457
15458 !!test
15459 Gallery override link with absolute external link (bug 34852)
15460 !! input
15461 <gallery>
15462 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
15463 </gallery>
15464 !! result
15465 <ul class="gallery mw-gallery-traditional">
15466 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15467 <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>
15468 <div class="gallerytext">
15469 <p>caption
15470 </p>
15471 </div>
15472 </div></li>
15473 </ul>
15474
15475 !! end
15476
15477 !!test
15478 Gallery override link with malicious javascript (bug 34852)
15479 !! input
15480 <gallery>
15481 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
15482 </gallery>
15483 !! result
15484 <ul class="gallery mw-gallery-traditional">
15485 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15486 <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>
15487 <div class="gallerytext">
15488 <p>caption
15489 </p>
15490 </div>
15491 </div></li>
15492 </ul>
15493
15494 !! end
15495
15496 !!test
15497 Gallery with invalid title as link (bug 43964)
15498 !! input
15499 <gallery>
15500 File:foobar.jpg|link=<
15501 </gallery>
15502 !! result
15503 <ul class="gallery mw-gallery-traditional">
15504 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15505 <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>
15506 <div class="gallerytext">
15507 </div>
15508 </div></li>
15509 </ul>
15510
15511 !! end
15512
15513 !!test
15514 Language parser function
15515 !! input
15516 {{#language:ar}}
15517 !! result
15518 <p>العربية
15519 </p>
15520 !! end
15521
15522 !!test
15523 Padleft and padright as substr
15524 !! input
15525 {{padleft:|3|abcde}}
15526 {{padright:|3|abcde}}
15527 !! result
15528 <p>abc
15529 abc
15530 </p>
15531 !! end
15532
15533 !!test
15534 Special parser function
15535 !! input
15536 {{#special:RandomPage}}
15537 {{#special:BaDtItLe}}
15538 {{#special:Foobar}}
15539 !! result
15540 <p>Special:Random
15541 Special:Badtitle
15542 Special:Foobar
15543 </p>
15544 !! end
15545
15546 !!test
15547 Bug 34939 - Case insensitive link parsing ([HttP://])
15548 !! input
15549 [HttP://MediaWiki.Org/]
15550 !! result
15551 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
15552 </p>
15553 !! end
15554
15555 !!test
15556 Bug 34939 - Case insensitive link parsing ([HttP:// title])
15557 !! input
15558 [HttP://MediaWiki.Org/ MediaWiki]
15559 !! result
15560 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
15561 </p>
15562 !! end
15563
15564 !!test
15565 Bug 34939 - Case insensitive link parsing (HttP://)
15566 !! input
15567 HttP://MediaWiki.Org/
15568 !! result
15569 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
15570 </p>
15571 !! end
15572
15573
15574 ###
15575 ### Parsoids-specific tests
15576 ### Parsoid-PHP parser incompatibilities
15577 ###
15578 !!test
15579 1. SOL-sensitive wikitext tokens as template-args
15580 !!options
15581 parsoid=wt2html,wt2wt
15582 !!input
15583 {{echo|*a}}
15584 {{echo|#a}}
15585 {{echo|:a}}
15586 !!result
15587 <span about="#mwt1" typeof="mw:Transclusion">
15588 </span><ul about="#mwt1"><li>a</li></ul>
15589 <span about="#mwt2" typeof="mw:Transclusion">
15590 </span><ol about="#mwt2"><li>a</li></ol>
15591 <span about="#mwt3" typeof="mw:Transclusion">
15592 </span><dl about="#mwt3"><dd>a</dd></dl>
15593 !!end
15594
15595 #### ----------------------------------------------------------------
15596 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
15597 #### tags. Parsoid's output for these tags differs from that of the
15598 #### PHP parser.
15599 #### ----------------------------------------------------------------
15600
15601 !!test
15602 Ref: 1. ref-location should be replaced with an index span
15603 !!options
15604 parsoid
15605 !!input
15606 A <ref>foo</ref>
15607 B <ref name="x">foo</ref>
15608 C <ref name="y" />
15609 !!result
15610 <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>
15611 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>
15612 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>
15613 !!end
15614
15615 !!test
15616 Ref: 2. ref-tags with identical names should all get the same index
15617 !!options
15618 parsoid
15619 !!input
15620 A <ref name="x">foo</ref>
15621 B <ref name="x" />
15622 !!result
15623 <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>
15624 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>
15625 !!end
15626
15627 !!test
15628 Ref: 3. spaces in ref-names should be ignored
15629 !!options
15630 parsoid
15631 !!input
15632 A <ref name="x">foo</ref>
15633 B <ref name=" x " />
15634 C <ref name= x />
15635 !!result
15636 <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>
15637 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>
15638 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>
15639 !!end
15640
15641 !!test
15642 Ref: 4. 'constructor' should be accepted as a valid ref-name
15643 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
15644 !!options
15645 parsoid
15646 !!input
15647 A <ref name="constructor">foo</ref>
15648 !!result
15649 <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>
15650 !!end
15651
15652 !!test
15653 Ref: 5. body should accept generic wikitext
15654 !!options
15655 parsoid
15656 !!input
15657 A <ref>
15658 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
15659 </ref>
15660
15661 <references />
15662 !!result
15663 <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>
15664
15665 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15666 <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>
15667 </li></ol>
15668 !!end
15669
15670 !!test
15671 Ref: 6. indent-pres should not be output in ref-body
15672 !!options
15673 parsoid
15674 !!input
15675 A <ref>
15676 foo
15677 bar
15678 baz
15679 </ref>
15680
15681 <references />
15682 !!result
15683 <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>
15684
15685 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15686 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15687 bar
15688 baz
15689 </li></ol>
15690 !!end
15691
15692 !!test
15693 Ref: 6. No p-wrapping in ref-body
15694 !!options
15695 parsoid
15696 !!input
15697 A <ref>
15698 foo
15699
15700 bar
15701
15702
15703 baz
15704
15705
15706
15707 booz
15708 </ref>
15709
15710 <references />
15711 !!result
15712 <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>
15713
15714 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15715 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15716
15717 bar
15718
15719
15720 baz
15721
15722
15723
15724 booz
15725 </li></ol>
15726 !!end
15727
15728 !!test
15729 Ref: 8. transclusion wikitext has lower precedence
15730 !!options
15731 parsoid
15732 !!input
15733 A <ref> foo {{echo|</ref> B C}}
15734
15735 <references />
15736 !!result
15737 <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>
15738
15739 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15740 <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>
15741 !!end
15742
15743 !!test
15744 Ref: 9. unclosed comments should not leak out of ref-body
15745 !!options
15746 parsoid
15747 !!input
15748 A <ref> foo <!--</ref> B C
15749
15750 <references />
15751 !!result
15752 <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>
15753
15754 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15755 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
15756 !!end
15757
15758 !!test
15759 Ref: 10. Unclosed HTML tags should not leak out of ref-body
15760 !!options
15761 parsoid
15762 !!input
15763 A <ref> <b> foo </ref> B C
15764
15765 <references />
15766 !!result
15767 <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>
15768
15769 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15770 <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>
15771 !!end
15772
15773 !!test
15774 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
15775 !!options
15776 parsoid
15777 !!input
15778 A <ref>foo</ref> B
15779 C <ref>bar</ref> D
15780 !!result
15781 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B
15782 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>
15783 !!end
15784
15785 !!test
15786 Ref: 12. ref-tags act as trailing newline migration barrier
15787 !!options
15788 parsoid
15789 !!input
15790 <!--the newline at the end of this line moves out of the p-tag-->a
15791
15792 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
15793 <ref />
15794
15795 c
15796 !!result
15797 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
15798
15799
15800 <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>
15801 <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>
15802
15803
15804 <p>c</p>
15805 !!end
15806
15807 !!test
15808 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
15809 !!options
15810 parsoid
15811 !!input
15812 <ref>foo</ref> A
15813 <ref>bar
15814 </ref> B
15815 !!result
15816 <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
15817 <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>
15818 !!end
15819
15820 !!test
15821 Ref: 14. A nested ref-tag should be emitted as plain text
15822 !!options
15823 parsoid
15824 !!input
15825 <ref>foo <ref>bar</ref> baz</ref>
15826
15827 <references />
15828 !!result
15829 <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>
15830
15831 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
15832 <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>
15833 !!end
15834
15835 !!test
15836 Ref: 15. ref-tags with identical names should get identical indexes
15837 !!options
15838 parsoid
15839 !!input
15840 A1 <ref name="a">foo</ref> A2 <ref name="a" />
15841 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
15842
15843 <references />
15844 !!result
15845 <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>
15846 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>
15847
15848 <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>
15849 !!end
15850
15851 !!test
15852 References: 1. references tag without any refs should be handled properly
15853 !!options
15854 parsoid
15855 !!input
15856 <references />
15857 !!result
15858 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
15859 !!end
15860
15861 !!test
15862 References: 2. references tag with group only outputs references from that group
15863 !!options
15864 parsoid
15865 !!input
15866 A <ref group="a">foo</ref>
15867 B <ref group="b">bar</ref>
15868
15869 <references group='a' />
15870 !!result
15871 <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>
15872 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>
15873
15874 <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>
15875 !!end
15876
15877 !!test
15878 References: 3. ref list should be cleared after processing references
15879 !!options
15880 parsoid
15881 !!input
15882 A <ref>foo</ref>
15883
15884 <references />
15885
15886 B <ref>bar</ref>
15887
15888 <references />
15889 !!result
15890 <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>
15891
15892 <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>
15893
15894 <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>
15895
15896 <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>
15897 !!end
15898
15899 !!test
15900 References: 4. only referenced group should be cleared after processing references
15901 !!options
15902 parsoid
15903 !!input
15904 A <ref group="a">afoo</ref>
15905 B <ref>bfoo</ref>
15906
15907 <references group="a"/>
15908
15909 C <ref>cfoo</ref>
15910
15911 <references />
15912 !!result
15913 <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>
15914 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>
15915
15916 <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>
15917
15918 <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>
15919
15920 <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>
15921 !!end
15922
15923 !!test
15924 References: 5. ref tags in references should be processed while ignoring all other content
15925 !!options
15926 parsoid
15927 !!input
15928 A <ref name="a" />
15929 B <ref name="b">bar</ref>
15930
15931 <references>
15932 <ref name="a">foo</ref>
15933 This should just get lost.
15934 </references>
15935 !!result
15936 <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>
15937 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>
15938
15939 <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>
15940 !!end
15941
15942 !!test
15943 References: 6. <references /> from a transclusion
15944 !!options
15945 parsoid
15946 !!input
15947 {{echo|<references />}}
15948 !!result
15949 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}'></ol>
15950 !!end
15951
15952 !! test
15953 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
15954 !! options
15955 parsoid
15956 !! input
15957 A <ref>foo bar for a</ref>
15958 B <ref name="b" />
15959
15960 <references />
15961
15962 <references>
15963 <ref name="b">foo</ref>
15964 </references>
15965 !! result
15966 <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>
15967 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>
15968
15969 <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>
15970
15971 <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>
15972
15973 !! end
15974
15975 #### ----------------------------------------------------------------
15976 #### The following section of tests are primarily to test
15977 #### wikitext escaping capabilities of Parsoid. Given that
15978 #### escaping can be done any number of ways, the wikitext (input)
15979 #### is always adjusted to reflect how Parsoid adds nowiki
15980 #### escape tags.
15981 ####
15982 #### We are marking several tests as parsoid-only since the
15983 #### HTML in the result section is different from what the
15984 #### PHP parser generates for it.
15985 #### ----------------------------------------------------------------
15986
15987
15988 #### --------------- Headings ---------------
15989 #### 0. Unnested
15990 #### 1. Nested inside html <h1>=foo=</h1>
15991 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
15992 #### 3. Nested inside html with wikitext split by html tags
15993 #### 4. No escape needed
15994 #### 5. Empty headings <h1></h1>
15995 #### 6. Heading chars in SOL context
15996 #### ----------------------------------------
15997 !! test
15998 Headings: 0. Unnested
15999 !! options
16000 parsoid
16001 !! input
16002 <nowiki>=foo=</nowiki>
16003
16004 <nowiki> =foo= </nowiki>
16005 <!--cmt-->
16006 <nowiki>=foo=</nowiki>
16007
16008 =foo''a''<nowiki>=</nowiki>
16009 !! result
16010 <p><span typeof="mw:Nowiki">=foo=</span></p>
16011
16012 <p><span typeof="mw:Nowiki"> =foo= </span>
16013 <!--cmt-->
16014 <span typeof="mw:Nowiki">=foo=</span></p>
16015
16016 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
16017 !!end
16018
16019 !! test
16020 Headings: 1. Nested inside html
16021 !! options
16022 parsoid
16023 !! input
16024 =<nowiki>=foo=</nowiki>=
16025
16026 ==<nowiki>=foo=</nowiki>==
16027
16028 ===<nowiki>=foo=</nowiki>===
16029
16030 ====<nowiki>=foo=</nowiki>====
16031
16032 =====<nowiki>=foo=</nowiki>=====
16033
16034 ======<nowiki>=foo=</nowiki>======
16035 !! result
16036 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
16037 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
16038 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
16039 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
16040 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
16041 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
16042 !!end
16043
16044 !! test
16045 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
16046 !! options
16047 parsoid
16048 !! input
16049 =foo=
16050 <nowiki>*</nowiki>bar
16051
16052 =foo=
16053 =bar
16054
16055 =foo=
16056 <nowiki>=bar=</nowiki>
16057 !! result
16058 <h1>foo</h1>*bar
16059 <h1>foo</h1>=bar
16060 <h1>foo</h1>=bar=
16061 !!end
16062
16063 !! test
16064 Headings: 3. Nested inside html with wikitext split by html tags
16065 !! options
16066 parsoid
16067 !! input
16068 =='''bold'''<nowiki>foo=</nowiki>=
16069 !! result
16070 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
16071 !!end
16072
16073 !! test
16074 Headings: 4a. No escaping needed (testing just h1 and h2)
16075 !! options
16076 parsoid
16077 !! input
16078 ==foo=
16079
16080 =foo==
16081
16082 = =foo= =
16083
16084 ==foo= bar=
16085
16086 ===foo==
16087
16088 ==foo===
16089
16090 =''=''foo==
16091
16092 =<nowiki>=</nowiki>=
16093 !! result
16094 <h1>=foo</h1>
16095 <h1>foo=</h1>
16096 <h1> =foo= </h1>
16097 <h1>=foo= bar</h1>
16098 <h2>=foo</h2>
16099 <h2>foo=</h2>
16100 <h1><i>=</i>foo=</h1>
16101 <h1><span typeof="mw:Nowiki">=</span></h1>
16102 !!end
16103
16104 !! test
16105 Headings: 4b. No escaping needed (inside p-tags)
16106 !! options
16107 parsoid
16108 !! input
16109 ===
16110 =foo= x
16111 =foo= <s></s>
16112 !! result
16113 <p>===
16114 =foo= x
16115 =foo= <s></s>
16116 </p>
16117 !!end
16118
16119 !! test
16120 Headings: 5. Empty headings
16121 !! options
16122 parsoid
16123 !! input
16124 =<nowiki/>=
16125
16126 ==<nowiki/>==
16127
16128 ===<nowiki/>===
16129
16130 ====<nowiki/>====
16131
16132 =====<nowiki/>=====
16133
16134 ======<nowiki/>======
16135 !! result
16136 <h1></h1>
16137 <h2></h2>
16138 <h3></h3>
16139 <h4></h4>
16140 <h5></h5>
16141 <h6></h6>
16142 !!end
16143
16144 !! test
16145 Headings: 6a. Heading chars in SOL context (with trailing spaces)
16146 !! options
16147 parsoid
16148 !! input
16149 <nowiki>=a=</nowiki>
16150
16151 <nowiki>=a=</nowiki>
16152
16153 <nowiki>=a=</nowiki>
16154
16155 <nowiki>=a=</nowiki>
16156 !! result
16157 <p>=a=</p>
16158 <p>=a= </p>
16159 <p>=a= </p>
16160 <p>=a= </p>
16161 !!end
16162
16163 !! test
16164 Headings: 6b. Heading chars in SOL context (with trailing newlines)
16165 !! options
16166 parsoid
16167 !! input
16168 <nowiki>=a=
16169 b</nowiki>
16170
16171 <nowiki>=a=
16172 b</nowiki>
16173
16174 <nowiki>=a=
16175 b</nowiki>
16176
16177 <nowiki>=a=
16178 b</nowiki>
16179 !! result
16180 <p>=a=
16181 b</p>
16182 <p>=a=
16183 b</p>
16184 <p>=a=
16185 b</p>
16186 <p>=a=
16187 b</p>
16188 </p>
16189 !!end
16190
16191 !! test
16192 Headings: 6c. Heading chars in SOL context (leading newline break)
16193 !! options
16194 parsoid
16195 !! input
16196 a
16197 <nowiki>=b=</nowiki>
16198 !! result
16199 <p>a
16200 =b=</p>
16201 !!end
16202
16203 !! test
16204 Headings: 6d. Heading chars in SOL context (with interspersed comments)
16205 !! options
16206 parsoid
16207 !! input
16208 <!--c0--><nowiki>=a=</nowiki>
16209 <!--c1-->
16210 <nowiki>=a=</nowiki> <!--c2--> <!--c3-->
16211 !! result
16212 <p><!--c0-->=a=</p>
16213 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
16214 !!end
16215
16216 !! test
16217 Headings: 6d. Heading chars in SOL context (No escaping needed)
16218 !! options
16219 parsoid=html2wt
16220 !! input
16221 =a=<div>b</div>
16222 !! result
16223 =a=<div>b</div>
16224 !!end
16225
16226 #### --------------- Lists ---------------
16227 #### 0. Outside nests (*foo, etc.)
16228 #### 1. Nested inside html <ul><li>*foo</li></ul>
16229 #### 2. Inside definition lists
16230 #### 3. Only bullets at start should be escaped
16231 #### 4. No escapes needed
16232 #### 5. No unnecessary escapes
16233 #### 6. Escape bullets in SOL position
16234 #### 7. Escape bullets in a multi-line context
16235 #### ----------------------------------------
16236
16237 !! test
16238 Lists: 0. Outside nests
16239 !! input
16240 <nowiki>*</nowiki>foo
16241
16242 <nowiki>#</nowiki>foo
16243 !! result
16244 <p>*foo
16245 </p><p>#foo
16246 </p>
16247 !!end
16248
16249 !! test
16250 Lists: 1. Nested inside html
16251 !! input
16252 *<nowiki>*foo</nowiki>
16253
16254 *<nowiki>#foo</nowiki>
16255
16256 *<nowiki>:foo</nowiki>
16257
16258 *<nowiki>;foo</nowiki>
16259
16260 #<nowiki>*foo</nowiki>
16261
16262 #<nowiki>#foo</nowiki>
16263
16264 #<nowiki>:foo</nowiki>
16265
16266 #<nowiki>;foo</nowiki>
16267 !! result
16268 <ul><li>*foo
16269 </li></ul>
16270 <ul><li>#foo
16271 </li></ul>
16272 <ul><li>:foo
16273 </li></ul>
16274 <ul><li>;foo
16275 </li></ul>
16276 <ol><li>*foo
16277 </li></ol>
16278 <ol><li>#foo
16279 </li></ol>
16280 <ol><li>:foo
16281 </li></ol>
16282 <ol><li>;foo
16283 </li></ol>
16284
16285 !!end
16286
16287 !! test
16288 Lists: 2. Inside definition lists
16289 !! input
16290 ;<nowiki>;foo</nowiki>
16291
16292 ;<nowiki>:foo</nowiki>
16293
16294 ;<nowiki>:foo</nowiki>
16295 :bar
16296
16297 :<nowiki>:foo</nowiki>
16298 !! result
16299 <dl><dt>;foo
16300 </dt></dl>
16301 <dl><dt>:foo
16302 </dt></dl>
16303 <dl><dt>:foo
16304 </dt><dd>bar
16305 </dd></dl>
16306 <dl><dd>:foo
16307 </dd></dl>
16308
16309 !!end
16310
16311 !! test
16312 Lists: 3. Only bullets at start of text should be escaped
16313 !! input
16314 *<nowiki>*foo*bar</nowiki>
16315
16316 *<nowiki>*foo</nowiki>''it''*bar
16317 !! result
16318 <ul><li>*foo*bar
16319 </li></ul>
16320 <ul><li>*foo<i>it</i>*bar
16321 </li></ul>
16322
16323 !!end
16324
16325 !! test
16326 Lists: 4. No escapes needed
16327 !! options
16328 parsoid
16329 !! input
16330 *foo*bar
16331
16332 *''foo''*bar
16333
16334 *[[Foo]]: bar
16335 !! result
16336 <ul><li>foo*bar
16337 </li></ul>
16338 <ul><li><i>foo</i>*bar
16339 </li></ul>
16340 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
16341 </li></ul>
16342 !!end
16343
16344 !! test
16345 Lists: 5. No unnecessary escapes
16346 !! input
16347 * bar <span><nowiki>[[foo]]</nowiki></span>
16348
16349 *=bar <span><nowiki>[[foo]]</nowiki></span>
16350
16351 *[[bar <span><nowiki>[[foo]]</nowiki></span>
16352
16353 *]]bar <span><nowiki>[[foo]]</nowiki></span>
16354
16355 *=bar <span>foo]]</span>=
16356
16357 * <s></s>: a
16358 !! result
16359 <ul><li> bar <span>[[foo]]</span>
16360 </li></ul>
16361 <ul><li>=bar <span>[[foo]]</span>
16362 </li></ul>
16363 <ul><li>[[bar <span>[[foo]]</span>
16364 </li></ul>
16365 <ul><li>]]bar <span>[[foo]]</span>
16366 </li></ul>
16367 <ul><li>=bar <span>foo]]</span>=
16368 </li></ul>
16369 <ul><li> <s></s>: a
16370 </li></ul>
16371
16372 !!end
16373
16374 !! test
16375 Lists: 6. Escape bullets in SOL position
16376 !! options
16377 parsoid
16378 !! input
16379 <!--cmt--><nowiki>*foo</nowiki>
16380 !! result
16381 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
16382 !!end
16383
16384 !! test
16385 Lists: 7. Escape bullets in a multi-line context
16386 !! input
16387 a
16388 <nowiki>*</nowiki>b
16389 !! result
16390 <p>a
16391 *b
16392 </p>
16393 !!end
16394
16395 #### --------------- HRs ---------------
16396 #### 1. Single line
16397 #### -----------------------------------
16398
16399 !! test
16400 HRs: 1. Single line
16401 !! options
16402 parsoid
16403 !! input
16404 ----<nowiki>----</nowiki>
16405 ----=foo=
16406 ----*foo
16407 !! result
16408 <hr><span typeof="mw:Nowiki">----</span>
16409 <hr>=foo=
16410 <hr>*foo
16411 !! end
16412
16413 #### --------------- Tables ---------------
16414 #### 1a. Simple example
16415 #### 1b. No escaping needed (!foo)
16416 #### 1c. No escaping needed (|foo)
16417 #### 1d. No escaping needed (|}foo)
16418 ####
16419 #### 2a. Nested in td (<td>foo|bar</td>)
16420 #### 2b. Nested in td (<td>foo||bar</td>)
16421 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
16422 ####
16423 #### 3a. Nested in th (<th>foo!bar</th>)
16424 #### 3b. Nested in th (<th>foo!!bar</th>)
16425 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
16426 ####
16427 #### 4a. Escape -
16428 #### 4b. Escape +
16429 #### 4c. No escaping needed
16430 #### --------------------------------------
16431
16432 !! test
16433 Tables: 1a. Simple example
16434 !! input
16435 <nowiki>{|
16436 |}</nowiki>
16437 !! result
16438 <p>{|
16439 |}
16440 </p>
16441 !! end
16442
16443 !! test
16444 Tables: 1b. No escaping needed
16445 !! input
16446 !foo
16447 !! result
16448 <p>!foo
16449 </p>
16450 !! end
16451
16452 !! test
16453 Tables: 1c. No escaping needed
16454 !! input
16455 |foo
16456 !! result
16457 <p>|foo
16458 </p>
16459 !! end
16460
16461 !! test
16462 Tables: 1d. No escaping needed
16463 !! input
16464 |}foo
16465 !! result
16466 <p>|}foo
16467 </p>
16468 !! end
16469
16470 !! test
16471 Tables: 2a. Nested in td
16472 !! options
16473 parsoid
16474 !! input
16475 {|
16476 |<nowiki>foo|bar</nowiki>
16477 |}
16478 !! result
16479 <table><tbody><tr>
16480 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
16481 !! end
16482
16483 !! test
16484 Tables: 2b. Nested in td
16485 !! options
16486 parsoid
16487 !! input
16488 {|
16489 |<nowiki>foo||bar</nowiki>
16490 |''it''<nowiki>foo||bar</nowiki>
16491 |}
16492 !! result
16493 <table><tbody><tr>
16494 <td><span typeof="mw:Nowiki">foo||bar</span></td>
16495 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
16496 !! end
16497
16498 !! test
16499 Tables: 2c. Nested in td -- no escaping needed
16500 !! options
16501 parsoid
16502 !! input
16503 {|
16504 |foo!!bar
16505 |}
16506 !! result
16507 <table><tbody><tr><td>foo!!bar
16508 </td></tr></tbody></table>
16509
16510 !! end
16511
16512 !! test
16513 Tables: 3a. Nested in th
16514 !! options
16515 parsoid
16516 !! input
16517 {|
16518 !foo!bar
16519 |}
16520 !! result
16521 <table><tbody><tr><th>foo!bar
16522 </th></tr></tbody></table>
16523
16524 !! end
16525
16526 !! test
16527 Tables: 3b. Nested in th
16528 !! options
16529 parsoid
16530 !! input
16531 {|
16532 !<nowiki>foo!!bar</nowiki>
16533 |}
16534 !! result
16535 <table>
16536 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
16537 </tbody></table>
16538 !! end
16539
16540 !! test
16541 Tables: 3c. Nested in th -- no escaping needed
16542 !! options
16543 parsoid
16544 !! input
16545 {|
16546 !<nowiki>foo||bar</nowiki>
16547 |}
16548 !! result
16549 <table><tbody><tr>
16550 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
16551 !! end
16552
16553 !! test
16554 Tables: 4a. Escape -
16555 !! options
16556 parsoid
16557 !! input
16558 {|
16559 |-
16560 !-bar
16561 |-
16562 |<nowiki>-bar</nowiki>
16563 |}
16564 !! result
16565 <table><tbody>
16566 <tr><th>-bar</th></tr>
16567 <tr>
16568 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
16569 !! end
16570
16571 !! test
16572 Tables: 4b. Escape +
16573 !! options
16574 parsoid
16575 !! input
16576 {|
16577 |-
16578 !+bar
16579 |-
16580 |<nowiki>+bar</nowiki>
16581 |}
16582 !! result
16583 <table><tbody>
16584 <tr><th>+bar</th></tr>
16585 <tr>
16586 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
16587 !! end
16588
16589 !! test
16590 Tables: 4c. No escaping needed
16591 !! options
16592 parsoid
16593 !! input
16594 {|
16595 |-
16596 |foo-bar
16597 |foo+bar
16598 |-
16599 |''foo''-bar
16600 |''foo''+bar
16601 |-
16602 |foo
16603 bar|baz
16604 +bar
16605 -bar
16606 |}
16607 !! result
16608 <table><tbody>
16609 <tr><td>foo-bar</td><td>foo+bar</td></tr>
16610 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
16611 <tr><td>foo
16612 <p>bar|baz
16613 +bar
16614 -bar</p></td></tr>
16615 </tbody></table>
16616 !! end
16617
16618 ### SSS FIXME: Disabled right now because accurate html2wt
16619 ### on this snippet requires data-parsoid flags that we've
16620 ### stripped out of these tests. We should scheme how we
16621 ### we want to handle these kind of tests that require
16622 ### data-parsoid flags for accurate html2wt serialization
16623
16624 !! test
16625 Tables: 4d. No escaping needed
16626 !! options
16627 disabled
16628 !! input
16629 {|
16630 ||+1
16631 ||-2
16632 |}
16633 !! result
16634 <table>
16635 <tr>
16636 <td>+1
16637 </td>
16638 <td>-2
16639 </td></tr></table>
16640
16641 !! end
16642
16643 #### --------------- Links ----------------
16644 #### 1. Quote marks in link text
16645 #### 2. Wikilinks: Escapes needed
16646 #### 3. Wikilinks: No escapes needed
16647 #### 4. Extlinks: Escapes needed
16648 #### 5. Extlinks: No escapes needed
16649 #### --------------------------------------
16650 !! test
16651 Links 1. Quote marks in link text
16652 !! options
16653 parsoid
16654 !! input
16655 [[Foo|Foo<nowiki>''boo''</nowiki>]]
16656 !! result
16657 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
16658 !! end
16659
16660 !! test
16661 Links 2. WikiLinks: Escapes needed
16662 !! options
16663 parsoid
16664 !! input
16665 [[Foo|<nowiki>[Foobar]</nowiki>]]
16666 [[Foo|<nowiki>Foobar]</nowiki>]]
16667 [[Foo|x [Foobar] x]]
16668 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
16669 [[Foo|<nowiki>[[Bar]]</nowiki>]]
16670 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
16671 [[Foo|<nowiki>|Bar</nowiki>]]
16672 [[Foo|<nowiki>]]bar</nowiki>]]
16673 [[Foo|<nowiki>[[bar</nowiki>]]
16674 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
16675 !! result
16676 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
16677 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
16678 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
16679 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
16680 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
16681 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
16682 <a href="Foo" rel="mw:WikiLink">|Bar</a>
16683 <a href="Foo" rel="mw:WikiLink">]]bar</a>
16684 <a href="Foo" rel="mw:WikiLink">[[bar</a>
16685 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
16686 !! end
16687
16688 !! test
16689 Links 3. WikiLinks: No escapes needed
16690 !! options
16691 parsoid
16692 !! input
16693 [[Foo|[Foobar]]
16694 [[Foo|foo|bar]]
16695 !! result
16696 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
16697 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
16698 !! end
16699
16700 !! test
16701 Links 4. ExtLinks: Escapes needed
16702 !! options
16703 parsoid
16704 !! input
16705 [http://google.com <nowiki>[google]</nowiki>]
16706 [http://google.com <nowiki>google]</nowiki>]
16707 !! result
16708 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
16709 <a href="http://google.com" rel="mw:ExtLink">google]</a>
16710 !! end
16711
16712 !! test
16713 Links 5. ExtLinks: No escapes needed
16714 !! options
16715 parsoid
16716 !! input
16717 [http://google.com [google]
16718 !! result
16719 <a href="http://google.com" rel="mw:ExtLink">[google</a>
16720 !! end
16721
16722 #### --------------- Quotes ---------------
16723 #### 1. Quotes inside <b> and <i>
16724 #### 2. Link fragments separated by <i> and <b> tags
16725 #### 3. Link fragments inside <i> and <b>
16726 #### 4. No escaping needed
16727 #### --------------------------------------
16728 !! test
16729 1. Quotes inside <b> and <i>
16730 !! options
16731 parsoid=html2wt,wt2wt
16732 !! input
16733 ''<nowiki>'foo'</nowiki>''
16734 ''<nowiki>''foo''</nowiki>''
16735 ''<nowiki>'''foo'''</nowiki>''
16736 ''foo''<nowiki/>'s
16737 '''<nowiki>'foo'</nowiki>'''
16738 '''<nowiki>''foo''</nowiki>'''
16739 '''<nowiki>'''foo'''</nowiki>'''
16740 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
16741 '''foo'''<nowiki/>'s
16742 '''foo''
16743 ''foo''<nowiki/>'
16744 '<nowiki/>''foo''<nowiki/>'
16745 ''''foo'''
16746 '''foo'''<nowiki/>'
16747 '<nowiki/>'''foo'''<nowiki/>'
16748 !! result
16749 <p><i>'foo'</i>
16750 <i>''foo''</i>
16751 <i>'''foo'''</i>
16752 <i>foo</i>'s
16753 <b>'foo'</b>
16754 <b>''foo''</b>
16755 <b>'''foo'''</b>
16756 <b>foo'<i>bar'</i>baz</b>
16757 <b>foo</b>'s
16758 '<i>foo</i>
16759 <i>foo</i>'
16760 '<i>foo</i>'
16761 '<b>foo</b>
16762 <b>foo</b>'
16763 '<b>foo</b>'</p>
16764 !! end
16765
16766 !! test
16767 2. Link fragments separated by <i> and <b> tags
16768 !! input
16769 [[''foo''<nowiki>hello]]</nowiki>
16770
16771 [['''foo'''<nowiki>hello]]</nowiki>
16772 !! result
16773 <p>[[<i>foo</i>hello]]
16774 </p><p>[[<b>foo</b>hello]]
16775 </p>
16776 !! end
16777
16778 !! test
16779 3. Link fragments inside <i> and <b>
16780 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
16781 this is one of the shortcomings of this format)
16782 !! input
16783 ''[[foo''<nowiki>]]</nowiki>
16784
16785 '''[[foo'''<nowiki>]]</nowiki>
16786 !! result
16787 <p><i>[[foo</i>]]
16788 </p><p><b>[[foo</b>]]
16789 </p>
16790 !! end
16791
16792 !! test
16793 4. No escaping needed
16794 !! input
16795 '<span>''bar''</span>'
16796 '<span>'''bar'''</span>'
16797 !! result
16798 <p>'<span><i>bar</i></span>'
16799 '<span><b>bar</b></span>'
16800 </p>
16801 !! end
16802
16803 #### ----------- Paragraphs ---------------
16804 #### 1. No unnecessary escapes
16805 #### --------------------------------------
16806
16807 !! test
16808 1. No unnecessary escapes
16809 !! input
16810 bar <span><nowiki>[[foo]]</nowiki></span>
16811
16812 =bar <span><nowiki>[[foo]]</nowiki></span>
16813
16814 [[bar <span><nowiki>[[foo]]</nowiki></span>
16815
16816 ]]bar <span><nowiki>[[foo]]</nowiki></span>
16817
16818 =bar <span>foo]]</span><nowiki>=</nowiki>
16819 !! result
16820 <p>bar <span>[[foo]]</span>
16821 </p><p>=bar <span>[[foo]]</span>
16822 </p><p>[[bar <span>[[foo]]</span>
16823 </p><p>]]bar <span>[[foo]]</span>
16824 </p><p>=bar <span>foo]]</span>=
16825 </p>
16826 !!end
16827
16828 #### ----------------------- PRE --------------------------
16829 #### 1. Leading whitespace in SOL context should be escaped
16830 #### ------------------------------------------------------
16831 !! test
16832 1. Leading whitespace in SOL context should be escaped
16833 !! options
16834 parsoid
16835 !! input
16836 <nowiki> </nowiki>a
16837
16838 <nowiki> </nowiki> a
16839
16840 <nowiki> </nowiki>a(tab)
16841
16842 <nowiki> </nowiki> a
16843 <!--cmt-->
16844 <nowiki> </nowiki> a
16845
16846 a
16847 <nowiki> </nowiki>b
16848
16849 a
16850 <nowiki> </nowiki>b
16851
16852 a
16853 <nowiki> </nowiki> b
16854 !! result
16855 <p> a</p>
16856 <p> a</p>
16857 <p> a(tab)</p>
16858 <p> a</p>
16859 <p><!--cmt--> a</p>
16860 <p>a
16861 b</p>
16862 <p>a
16863 b</p>
16864 <p>a
16865 b</p>
16866 !! end
16867
16868 #### --------------- HTML tags ---------------
16869 #### 1. a tags
16870 #### 2. other tags
16871 #### 3. multi-line html tag
16872 #### -----------------------------------------
16873 !! test
16874 1. a tags
16875 !! options
16876 parsoid
16877 !! input
16878 <a href="http://google.com">google</a>
16879 !! result
16880 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
16881 !! end
16882
16883 !! test
16884 2. other tags
16885 !! input
16886 <nowiki><div>foo</div>
16887 <div style="color:red">foo</div></nowiki>
16888 !! result
16889 <p>&lt;div&gt;foo&lt;/div&gt;
16890 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
16891 </p>
16892 !! end
16893
16894 !! test
16895 3. multi-line html tag
16896 !! input
16897 <nowiki><div
16898 >foo</div
16899 ></nowiki>
16900 !! result
16901 <p>&lt;div
16902 &gt;foo&lt;/div
16903 &gt;
16904 </p>
16905 !! end
16906
16907 !! test
16908 4. extension tags
16909 !! input
16910 <nowiki><ref>foo</ref></nowiki>
16911 !! result
16912 <p>&lt;ref&gt;foo&lt;/ref&gt;
16913 </p>
16914 !! end
16915
16916 #### --------------- Others ---------------
16917 !! test
16918 Escaping nowikis
16919 !! input
16920 &lt;nowiki&gt;foo&lt;/nowiki&gt;
16921 !! result
16922 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
16923 </p>
16924 !! end
16925
16926 ## The quote-char in the input is necessary for triggering the bug
16927 !! test
16928 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
16929 !! options
16930 parsoid=wt2wt,html2wt
16931 !! input
16932 foo's bar :
16933 !! result
16934 <p>foo's bar :</p>
16935 !! end
16936
16937 !! test
16938
16939 Tag-like HTML structures are passed through as text
16940 !! input
16941 <x y>
16942
16943 <x.y>
16944
16945 <x-y>
16946
16947 1>2
16948
16949 x<y
16950
16951 a>b
16952
16953 1<d e>f
16954 !! result
16955 <p>&lt;x y&gt;
16956 </p><p>&lt;x.y&gt;
16957 </p><p>&lt;x-y&gt;
16958 </p><p>1&gt;2
16959 </p><p>x&lt;y
16960 </p><p>a&gt;b
16961 </p><p>1&lt;d e&gt;f
16962 </p>
16963 !! end
16964
16965
16966 # This was a bug in the PHP parser (see bug 17663 and its dups,
16967 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
16968 !! test
16969 Tag names followed by punctuation should not be recognized as tags
16970 !! input
16971 <s.ome> text
16972 !! result
16973 <p>&lt;s.ome&gt; text
16974 </p>
16975 !! end
16976
16977 !! test
16978 HTML tag with necessary entities in attributes
16979 !! input
16980 <span title="&amp;amp;">foo</span>
16981 !! result
16982 <p><span title="&amp;amp;">foo</span>
16983 </p>
16984 !! end
16985
16986 !! test
16987 HTML tag with 'unnecessary' entity encoding in attributes
16988 !! input
16989 <span title="&amp;">foo</span>
16990 !! result
16991 <p><span title="&amp;">foo</span>
16992 </p>
16993 !! end
16994
16995 !! test
16996 HTML tag with broken attribute value quoting
16997 !! input
16998 <span title="Hello world>Foo</span>
16999 !! result
17000 <p><span>Foo</span>
17001 </p>
17002 !! end
17003
17004 !! test
17005 Parsoid-only: HTML tag with broken attribute value quoting
17006 !! options
17007 parsoid
17008 !! input
17009 <span title="Hello world>Foo</span>
17010 !! result
17011 <p><span title="Hello world">Foo</span>
17012 </p>
17013 !! end
17014
17015 !! test
17016 Table with broken attribute value quoting
17017 !! input
17018 {|
17019 | title="Hello world|Foo
17020 |}
17021 !! result
17022 <table>
17023 <tr>
17024 <td>Foo
17025 </td></tr></table>
17026
17027 !! end
17028
17029 !! test
17030 Table with broken attribute value quoting on consecutive lines
17031 !! input
17032 {|
17033 | title="Hello world|Foo
17034 | style="color:red|Bar
17035 |}
17036 !! result
17037 <table>
17038 <tr>
17039 <td>Foo
17040 </td>
17041 <td>Bar
17042 </td></tr></table>
17043
17044 !! end
17045
17046 !! test
17047 Parsoid-only: Table with broken attribute value quoting on consecutive lines
17048 !! options
17049 parsoid
17050 !! input
17051 {|
17052 | title="Hello world|Foo
17053 | style="color:red|Bar
17054 |}
17055 !! result
17056 <table><tbody>
17057 <tr>
17058 <td title="Hello world">Foo
17059 </td><td style="color: red">Bar
17060 </td></tr></tbody></table>
17061
17062 !! end
17063
17064 !! test
17065 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
17066 !! options
17067 parsoid
17068 !! input
17069 {{}}
17070 !! result
17071 {{}}
17072 !! end
17073
17074 !! test
17075 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
17076 !! options
17077 parsoid
17078 !! input
17079 }}{{
17080 !! result
17081 }}{{
17082 !! end
17083
17084 !!test
17085 Accept empty td cell attribute
17086 !!input
17087 {|
17088 | align="center" | foo || |
17089 |}
17090 !!result
17091 <table>
17092 <tr>
17093 <td align="center"> foo </td>
17094 <td>
17095 </td></tr></table>
17096
17097 !!end
17098
17099 !!test
17100 Non-empty attributes in th-cells
17101 !!input
17102 {|
17103 ! Foo !! style="color: red" | Bar
17104 |}
17105 !!result
17106 <table>
17107 <tr>
17108 <th> Foo </th>
17109 <th style="color: red"> Bar
17110 </th></tr></table>
17111
17112 !!end
17113
17114 !!test
17115 Accept empty attributes in th-cells
17116 !!input
17117 {|
17118 !| foo !!| bar
17119 |}
17120 !!result
17121 <table>
17122 <tr>
17123 <th> foo </th>
17124 <th> bar
17125 </th></tr></table>
17126
17127 !!end
17128
17129 !!test
17130 Empty table rows go away
17131 !!input
17132 {|
17133 | Hello
17134 | there
17135 |- class="foo"
17136 |-
17137 |}
17138 !! result
17139 <table>
17140 <tr>
17141 <td> Hello
17142 </td>
17143 <td> there
17144 </td></tr>
17145
17146 </table>
17147
17148 !! end
17149
17150 ###
17151 ### Parsoid-centric tests for testing RTing of inter-element separators
17152 ### Edge cases not tested by existing parser tests and specific to
17153 ### Parsoid-specific serialization strategies.
17154 ###
17155
17156 !!test
17157 RT-ed inter-element separators should be valid separators
17158 !!input
17159 {|
17160 |- [[foo]]
17161 |}
17162 !!result
17163 <table>
17164
17165 </table>
17166
17167 !!end
17168
17169 !!test
17170 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
17171 (Parsoid-only since PHP parser relies on Tidy for correct output)
17172 !!options
17173 parsoid
17174 !!input
17175 {|
17176 |<small>foo
17177 bar
17178 |}
17179
17180 {|
17181 |<small>foo<small>
17182 |}
17183 !!result
17184 !!end
17185
17186 !!test
17187 Empty TD followed by TD with tpl-generated attribute
17188 !!input
17189 {|
17190 |-
17191 |
17192 |{{echo|style='color:red'}}|foo
17193 |}
17194 !!result
17195 <table>
17196
17197 <tr>
17198 <td>
17199 </td>
17200 <td>foo
17201 </td></tr></table>
17202
17203 !!end
17204
17205 !!test
17206 Indented table with an empty td
17207 !!input
17208 {|
17209 |-
17210 |
17211 |foo
17212 |}
17213 !!result
17214 <table>
17215
17216 <tr>
17217 <td>
17218 </td>
17219 <td>foo
17220 </td></tr></table>
17221
17222 !!end
17223
17224 !!test
17225 Empty TR followed by a template-generated TR
17226 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
17227 !!options
17228 parsoid=wt2html,wt2wt
17229 !!input
17230 {|
17231 |-
17232 {{echo|<tr><td>foo</td></tr>}}
17233 |}
17234 !!result
17235 <table>
17236 <tbody>
17237 <tr></tr>
17238 <tr typeof="mw:Transclusion">
17239 <td>foo</td></tr></tbody></table>
17240 !!end
17241
17242 ## PHP and parsoid output differ for this, and since this is primarily
17243 ## for testing Parsoid's serializer, marking this Parsoid only
17244 !!test
17245 Empty TR followed by mixed-ws-comment line should RT correctly
17246 !!options
17247 parsoid
17248 !!input
17249 {|
17250 |-
17251 <!--c-->
17252 |-
17253 <!--c--> <!--d-->
17254 |}
17255 !!result
17256 <table>
17257 <tbody>
17258 <tr>
17259 <td> <!--c--></td></tr>
17260 <tr>
17261 <td><!--c--> <!--d--></td></tr>
17262 </tbody></table>
17263
17264 !!end
17265
17266 !!test
17267 Multi-line image caption generated by templates with/without trailing newlines
17268 !!options
17269 parsoid
17270 !!input
17271 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
17272 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
17273 !!result
17274 <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>
17275 <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>
17276
17277 !!end
17278
17279 ## PHP emits broken html for this, and since this is primarily
17280 ## a Parsoid serializer test, marking this Parsoid only
17281 !!test
17282 Improperly nested inline or quotes tags with whitespace in between
17283 !!options
17284 parsoid
17285 !!input
17286 <span> <s>x</span> </s>
17287 ''' ''x''' ''
17288 !!result
17289 <p><span> <s>x</s></span><s> </s>
17290 <b> <i>x</i></b><i> </i>
17291 </p>
17292 !!end
17293
17294 !!test
17295 Encapsulate protected attributes from wt
17296 !!options
17297 parsoid
17298 !!input
17299 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
17300 !!result
17301 <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>
17302 </body>
17303 !!end
17304
17305 ## Currently the p-wrapper is fragile in how adds / removes transformations.
17306 ## Having nested or stray pre tags results in the attempt to add duplicates,
17307 ## causing an assertion fail. This test tries to prevent that situation.
17308 !!test
17309 Ensure ParagraphWrapper can deal with stray closing pre tags
17310 !!options
17311 parsoid=wt2html
17312 !!input
17313 plain text</pre>
17314 !!result
17315 plain text
17316 !!end
17317
17318 # -----------------------------------------------------------------
17319 # The following section of tests are primarily to spec requirements
17320 # around serialization of new/edited content.
17321 #
17322 # All these tests are marked Parsoid html2wt and html2html only
17323 # ----------------------------------------------------------------
17324
17325 !! test
17326 Image: Modifying size of an image
17327 !! options
17328 parsoid=html2wt
17329 !! input
17330 [[Image:Wiki.png|230x230px]]
17331 !! result
17332 <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>
17333 !!end
17334
17335 !! test
17336 Image: New block level image should have \n before and after
17337 !! options
17338 parsoid=html2wt
17339 !! input
17340 123
17341 [[File:Wiki.png|right|thumb|150x150px]]
17342 456
17343 !! result
17344 <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>
17345 !!end
17346
17347 # Wacky -- the leading newline in input is required because
17348 # that is what the serializer emits. To be fixed. Not fixing
17349 # the test because this test is required to test serialization of
17350 # new content and preferred whitespace style.
17351 !! test
17352 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
17353 !! options
17354 parsoid=html2wt
17355 !! input
17356
17357 * foo
17358 !! result
17359 <ul>
17360 <li><p>foo</p></li>
17361 </ul>
17362 !! end
17363
17364 # Wacky -- the leading newline in input is required because
17365 # that is what the serializer emits. To be fixed. Not fixing
17366 # the test because this test is required to test serialization of
17367 # new content and preferred whitespace style.
17368 !! test
17369 Lists: Add space after bullets
17370 !! options
17371 parsoid=html2wt
17372 !! input
17373
17374 * foo
17375 * bar
17376 * <span> baz</span>
17377 !! result
17378 <ul>
17379 <li>foo</li>
17380 <li> bar</li>
17381 <li><span> baz</span></li>
17382 </ul>
17383 !! end
17384
17385 !! test
17386 Parsoid: Serialize positional parameters with = in them as named parameter
17387 !! options
17388 parsoid=html2wt
17389 !! input
17390 {{echo|1 = f=oo}}
17391 !! result
17392 <p about="#mwt1" typeof="mw:Transclusion"
17393 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}'
17394 >foo</p>
17395 !! end
17396
17397 # -----------------------------------------------------------------
17398 # End of section for Parsoid-only html2wt tests for serialization
17399 # of new content
17400 # -----------------------------------------------------------------
17401
17402 TODO:
17403 more images
17404 more tables
17405 character entities
17406 and much more
17407 Try for 100% code coverage