Merge "Added a Descriptive Comment to the AutoLoaderTest"
[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 A?b
125 !! text
126 Weirdo titles!
127 !! endarticle
128
129 ###
130 ### Basic tests
131 ###
132 !! test
133 Blank input
134 !! input
135 !! result
136 !! end
137
138
139 !! test
140 Simple paragraph
141 !! input
142 This is a simple paragraph.
143 !! result
144 <p>This is a simple paragraph.
145 </p>
146 !! end
147
148 !! test
149 Paragraphs with extra newline spacing
150 !! input
151 foo
152
153 bar
154
155
156 baz
157
158
159
160 booz
161 !! result
162 <p>foo
163 </p><p>bar
164 </p><p><br />
165 baz
166 </p><p><br />
167 </p><p>booz
168 </p>
169 !! end
170
171 !! test
172 Paragraphs with newline spacing with comment lines in between
173 !! input
174 ----
175 a
176 <!--foo-->
177 b
178 ----
179 a
180 <!--foo--><!--More than 1 comment disables stripping of this line!-->
181 b
182 ----
183 a
184 <!--foo-->
185
186 b
187 ----
188 a
189
190 <!--foo-->
191 b
192 ----
193 a
194 <!--foo-->
195
196
197 b
198 ----
199 a
200
201
202 <!--foo-->
203 b
204 ----
205 !! result
206 <hr />
207 <p>a
208 b
209 </p>
210 <hr />
211 <p>a
212 </p><p>b
213 </p>
214 <hr />
215 <p>a
216 </p><p>b
217 </p>
218 <hr />
219 <p>a
220 </p><p>b
221 </p>
222 <hr />
223 <p>a
224 </p><p><br />
225 b
226 </p>
227 <hr />
228 <p>a
229 </p><p><br />
230 b
231 </p>
232 <hr />
233
234 !! end
235
236 !! test
237 Paragraphs with newline spacing with non-empty white-space lines in between
238 !! input
239 ----
240 a
241
242 b
243 ----
244 a
245
246
247 b
248 ----
249 !! result
250 <hr />
251 <p>a
252 </p><p>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 mixed comment and white-space lines in between
265 !! input
266 ----
267 a
268 <!--foo-->
269 b
270 ----
271 a
272 <!--foo--><!--More than 1 comment disables stripping of this line!-->
273 b
274 ----
275 a
276
277 <!--foo-->
278 <!--bar-->
279 b
280 ----
281 a
282
283 <!--foo-->
284 <!--bar-->
285
286 b
287 ----
288 !! result
289 <hr />
290 <p>a
291 b
292 </p>
293 <hr />
294 <p>a
295 </p><p>b
296 </p>
297 <hr />
298 <p>a
299 </p><p>b
300 </p>
301 <hr />
302 <p>a
303 </p><p><br />
304 b
305 </p>
306 <hr />
307
308 !! end
309
310 !! test
311 Extra newlines: More paragraphs with indented comment
312 !! input
313 a
314
315 <!--boo-->
316
317 b
318 !!result
319 <p>a
320 </p><p><br />
321 b
322 </p>
323 !!end
324
325 !! test
326 Extra newlines followed by heading
327 !! input
328 a
329
330
331
332 =b=
333 [[a]]
334
335
336 =b=
337 !! result
338 <p>a
339 </p><p><br />
340 </p>
341 <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>
342 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
343 </p><p><br />
344 </p>
345 <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>
346
347 !! end
348
349 !! test
350 Extra newlines between heading and content are swallowed
351 !! input
352 =b=
353
354
355
356 [[a]]
357 !! result
358 <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>
359 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
360 </p>
361 !! end
362
363 !! test
364 Parsing an URL
365 !! input
366 http://fr.wikipedia.org/wiki/🍺
367 <!-- EasterEgg we love beer, better be able be able to link to it -->
368 !! result
369 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
370 </p>
371 !! end
372
373 !! test
374 Simple list
375 !! input
376 * Item 1
377 * Item 2
378 !! result
379 <ul><li> Item 1
380 </li><li> Item 2
381 </li></ul>
382
383 !! end
384
385 !! test
386 Italics and bold
387 !! input
388 * plain
389 * plain''italic''plain
390 * plain''italic''plain''italic''plain
391 * plain'''bold'''plain
392 * plain'''bold'''plain'''bold'''plain
393 * plain''italic''plain'''bold'''plain
394 * plain'''bold'''plain''italic''plain
395 * plain''italic'''bold-italic'''italic''plain
396 * plain'''bold''bold-italic''bold'''plain
397 * plain'''''bold-italic'''italic''plain
398 * plain'''''bold-italic''bold'''plain
399 * plain''italic'''bold-italic'''''plain
400 * plain'''bold''bold-italic'''''plain
401 * plain l'''italic''plain
402 * plain l''''bold''' plain
403 !! result
404 <ul><li> plain
405 </li><li> plain<i>italic</i>plain
406 </li><li> plain<i>italic</i>plain<i>italic</i>plain
407 </li><li> plain<b>bold</b>plain
408 </li><li> plain<b>bold</b>plain<b>bold</b>plain
409 </li><li> plain<i>italic</i>plain<b>bold</b>plain
410 </li><li> plain<b>bold</b>plain<i>italic</i>plain
411 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
412 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
413 </li><li> plain<i><b>bold-italic</b>italic</i>plain
414 </li><li> plain<b><i>bold-italic</i>bold</b>plain
415 </li><li> plain<i>italic<b>bold-italic</b></i>plain
416 </li><li> plain<b>bold<i>bold-italic</i></b>plain
417 </li><li> plain l'<i>italic</i>plain
418 </li><li> plain l'<b>bold</b> plain
419 </li></ul>
420
421 !! end
422
423 # this example taken from the simple/Moon article
424 !! test
425 Italics and possessives
426 !! input
427 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
428 !! result
429 <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
430 </p>
431 !! end
432
433 ###
434 ### 2-quote opening sequence tests
435 ###
436 !! test
437 Italics and bold: 2-quote opening sequence: (2,2)
438 !! input
439 ''foo''
440 !! result
441 <p><i>foo</i>
442 </p>
443 !!end
444
445
446 !! test
447 Italics and bold: 2-quote opening sequence: (2,3)
448 !! input
449 ''foo'''
450 !! result
451 <p><i>foo'</i>
452 </p>
453 !!end
454
455
456 !! test
457 Italics and bold: 2-quote opening sequence: (2,4)
458 !! input
459 ''foo''''
460 !! result
461 <p><i>foo''</i>
462 </p>
463 !!end
464
465
466 !! test
467 Italics and bold: 2-quote opening sequence: (2,5) (php)
468 !! options
469 php
470 !! input
471 ''foo'''''
472 !! result
473 <p><i>foo</i>
474 </p>
475 !!end
476 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
477 !! test
478 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
479 !! options
480 parsoid
481 !! input
482 ''foo'''''
483 !! result
484 <p><i>foo</i><b></b>
485 </p>
486 !!end
487
488
489 ###
490 ### 3-quote opening sequence tests
491 ###
492
493 !! test
494 Italics and bold: 3-quote opening sequence: (3,2)
495 !! input
496 '''foo''
497 !! result
498 <p>'<i>foo</i>
499 </p>
500 !!end
501
502
503 !! test
504 Italics and bold: 3-quote opening sequence: (3,3)
505 !! input
506 '''foo'''
507 !! result
508 <p><b>foo</b>
509 </p>
510 !!end
511
512
513 !! test
514 Italics and bold: 3-quote opening sequence: (3,4)
515 !! input
516 '''foo''''
517 !! result
518 <p><b>foo'</b>
519 </p>
520 !!end
521
522
523 !! test
524 Italics and bold: 3-quote opening sequence: (3,5) (php)
525 !! options
526 php
527 !! input
528 '''foo'''''
529 !! result
530 <p><b>foo</b>
531 </p>
532 !!end
533 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
534 !! test
535 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
536 !! options
537 parsoid
538 !! input
539 '''foo'''''
540 !! result
541 <p><b>foo<i></i></b>
542 </p>
543 !!end
544
545
546 ###
547 ### 4-quote opening sequence tests
548 ###
549
550 !! test
551 Italics and bold: 4-quote opening sequence: (4,2)
552 !! input
553 ''''foo''
554 !! result
555 <p>''<i>foo</i>
556 </p>
557 !!end
558
559
560 !! test
561 Italics and bold: 4-quote opening sequence: (4,3)
562 !! input
563 ''''foo'''
564 !! result
565 <p>'<b>foo</b>
566 </p>
567 !!end
568
569
570 !! test
571 Italics and bold: 4-quote opening sequence: (4,4)
572 !! input
573 ''''foo''''
574 !! result
575 <p>'<b>foo'</b>
576 </p>
577 !!end
578
579
580 !! test
581 Italics and bold: 4-quote opening sequence: (4,5) (php)
582 !! options
583 php
584 !! input
585 ''''foo'''''
586 !! result
587 <p>'<b>foo</b>
588 </p>
589 !!end
590 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
591 !! test
592 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
593 !! options
594 parsoid
595 !! input
596 ''''foo'''''
597 !! result
598 <p>'<b>foo<i></i></b>
599 </p>
600 !!end
601
602
603 ###
604 ### 5-quote opening sequence tests
605 ###
606
607 !! test
608 Italics and bold: 5-quote opening sequence: (5,2) (php)
609 !! options
610 php
611 !! input
612 '''''foo''
613 !! result
614 <p><b><i>foo</i></b>
615 </p>
616 !!end
617 # Parsoid reverses the nesting order, compared to the PHP parser
618 !! test
619 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
620 !! options
621 parsoid
622 !! input
623 '''''foo''
624 !! result
625 <p><i><b>foo</b></i>
626 </p>
627 !!end
628
629
630 !! test
631 Italics and bold: 5-quote opening sequence: (5,3)
632 !! input
633 '''''foo'''
634 !! result
635 <p><i><b>foo</b></i>
636 </p>
637 !!end
638
639
640 !! test
641 Italics and bold: 5-quote opening sequence: (5,4)
642 !! input
643 '''''foo''''
644 !! result
645 <p><i><b>foo'</b></i>
646 </p>
647 !!end
648
649
650 !! test
651 Italics and bold: 5-quote opening sequence: (5,5)
652 !! input
653 '''''foo'''''
654 !! result
655 <p><i><b>foo</b></i>
656 </p>
657 !!end
658
659 ###
660 ### multiple quote sequences in a line
661 ###
662 !! test
663 Italics and bold: multiple quote sequences: (2,4,2)
664 !! input
665 ''foo''''bar''
666 !! result
667 <p><i>foo'<b>bar</b></i>
668 </p>
669 !!end
670
671
672 !! test
673 Italics and bold: multiple quote sequences: (2,4,3)
674 !! input
675 ''foo''''bar'''
676 !! result
677 <p><i>foo'<b>bar</b></i>
678 </p>
679 !!end
680
681
682 !! test
683 Italics and bold: multiple quote sequences: (2,4,4)
684 !! input
685 ''foo''''bar''''
686 !! result
687 <p><i>foo'<b>bar'</b></i>
688 </p>
689 !!end
690
691
692 !! test
693 Italics and bold: multiple quote sequences: (3,4,2) (php)
694 !! options
695 php
696 !! input
697 '''foo''''bar''
698 !! result
699 <p><b>foo'</b>bar
700 </p>
701 !!end
702 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
703 !! test
704 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
705 !! options
706 parsoid
707 !! input
708 '''foo''''bar''
709 !! result
710 <p><b>foo'</b>bar<i></i>
711 </p>
712 !!end
713
714
715 !! test
716 Italics and bold: multiple quote sequences: (3,4,3) (php)
717 !! options
718 php
719 !! input
720 '''foo''''bar'''
721 !! result
722 <p><b>foo'</b>bar
723 </p>
724 !!end
725 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
726 !! test
727 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
728 !! options
729 parsoid
730 !! input
731 '''foo''''bar'''
732 !! result
733 <p><b>foo'</b>bar<b></b>
734 </p>
735 !!end
736
737 ###
738 ### other quote tests
739 ###
740 !! test
741 Italics and bold: other quote tests: (2,3,5)
742 !! input
743 ''this is about '''foo's family'''''
744 !! result
745 <p><i>this is about <b>foo's family</b></i>
746 </p>
747 !!end
748
749
750 !! test
751 Italics and bold: other quote tests: (2,(3,3),2)
752 !! input
753 ''this is about '''foo's''' family''
754 !! result
755 <p><i>this is about <b>foo's</b> family</i>
756 </p>
757 !!end
758
759
760 !! test
761 Italics and bold: other quote tests: (3,2,3,2)
762 !! input
763 '''this is about ''foo'''s family''
764 !! result
765 <p><b>this is about <i>foo</i></b><i>s family</i>
766 </p>
767 !!end
768
769
770 # The Parsoid team believes the PHP parser's output on this test is wrong.
771 # It only checks for convert-to-bold-on-single-character-word when the word
772 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
773 # This means that the bold token in position 2 (0-indexed) gets converted by
774 # parsoid, but doesn't get changed by the PHP parser.
775 !! test
776 Italics and bold: other quote tests: (3,2,3,3) (php)
777 !! options
778 php
779 !! input
780 '''this is about ''foo'''s family'''
781 !! result
782 <p>'<i>this is about </i>foo<b>s family</b>
783 </p>
784 !!end
785 # This is the output the Parsoid team believes to be correct.
786 !! test
787 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
788 !! options
789 parsoid
790 !! input
791 '''this is about ''foo'''s family'''
792 !! result
793 <p><b>this is about <i>foo'</i>s family</b>
794 </p>
795 !!end
796
797
798 !! test
799 Italics and bold: other quote tests: (3,(2,2),3)
800 !! input
801 '''this is about ''foo's'' family'''
802 !! result
803 <p><b>this is about <i>foo's</i> family</b>
804 </p>
805 !!end
806
807
808 !! test
809 Italicized possessive
810 !! input
811 The ''[[Main Page]]'''s talk page.
812 !! result
813 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
814 </p>
815 !! end
816
817 !! test
818 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
819 (Requires tidy for PHP parser output to be fixed up)
820 !! options
821 parsoid=wt2html,wt2wt
822 !! input
823 {|
824 !''a!!''b
825 |''a||''b
826 |}
827 !! result
828 <table>
829 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
830 <td><i>a</i></td><td><i>b</i></td></tr>
831 </tbody></table>
832 !! end
833
834 ###
835 ### Non-html5 tags
836 ###
837
838 !! test
839 Non-html5 tags should be accepted
840 !! input
841 <center>''foo''</center>
842 <big>''foo''</big>
843 <font>''foo''</font>
844 <strike>''foo''</strike>
845 <tt>''foo''</tt>
846 !! result
847 <center><i>foo</i></center>
848 <p><big><i>foo</i></big>
849 <font><i>foo</i></font>
850 <strike><i>foo</i></strike>
851 <tt><i>foo</i></tt>
852 </p>
853 !! end
854
855 ###
856 ### <nowiki> test cases
857 ###
858
859 !! test
860 <nowiki> unordered list
861 !! input
862 <nowiki>* This is not an unordered list item.</nowiki>
863 !! result
864 <p>* This is not an unordered list item.
865 </p>
866 !! end
867
868 !! test
869 <nowiki> spacing
870 !! input
871 <nowiki>Lorem ipsum dolor
872
873 sed abit.
874 sed nullum.
875
876 :and a colon
877 </nowiki>
878 !! result
879 <p>Lorem ipsum dolor
880
881 sed abit.
882 sed nullum.
883
884 :and a colon
885
886 </p>
887 !! end
888
889 !! test
890 nowiki 3
891 !! input
892 :There is not nowiki.
893 :There is <nowiki>nowiki</nowiki>.
894
895 #There is not nowiki.
896 #There is <nowiki>nowiki</nowiki>.
897
898 *There is not nowiki.
899 *There is <nowiki>nowiki</nowiki>.
900 !! result
901 <dl><dd>There is not nowiki.
902 </dd><dd>There is nowiki.
903 </dd></dl>
904 <ol><li>There is not nowiki.
905 </li><li>There is nowiki.
906 </li></ol>
907 <ul><li>There is not nowiki.
908 </li><li>There is nowiki.
909 </li></ul>
910
911 !! end
912
913 !! test
914 Entities inside <nowiki>
915 !! input
916 <nowiki>&lt;</nowiki>
917 !! result
918 <p>&lt;
919 </p>
920 !! end
921
922 !! test
923 Entities inside template parameters
924 !! options
925 parsoid
926 !! input
927 {{echo|&ndash;}}
928 !! result
929 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}'>&ndash;</span>
930 </p>
931 !! end
932
933 ###
934 ### Comments
935 ###
936 !! test
937 Comments and Indent-Pre
938 !! input
939 <!-- comment 1 --> asdf
940
941 <!-- comment 1 --> asdf
942 <!-- comment 2 -->
943
944 <!-- comment 1 --> asdf
945 <!-- comment 2 -->xyz
946
947 <!-- comment 1 --> asdf
948 <!-- comment 2 --> xyz
949 !! result
950 <pre>asdf
951 </pre>
952 <pre>asdf
953 </pre>
954 <pre>asdf
955 </pre>
956 <p>xyz
957 </p>
958 <pre>asdf
959 xyz
960 </pre>
961 !! end
962
963 !! test
964 Comment test 2a
965 !! input
966 asdf
967 <!-- comment 1 -->
968 jkl
969 !! result
970 <p>asdf
971 jkl
972 </p>
973 !! end
974
975 !! test
976 Comment test 2b
977 !! input
978 asdf
979 <!-- comment 1 -->
980
981 jkl
982 !! result
983 <p>asdf
984 </p><p>jkl
985 </p>
986 !! end
987
988 !! test
989 Comment test 3
990 !! input
991 asdf
992 <!-- comment 1 -->
993 <!-- comment 2 -->
994 jkl
995 !! result
996 <p>asdf
997 jkl
998 </p>
999 !! end
1000
1001 !! test
1002 Comment test 4
1003 !! input
1004 asdf<!-- comment 1 -->jkl
1005 !! result
1006 <p>asdfjkl
1007 </p>
1008 !! end
1009
1010 !! test
1011 Comment spacing
1012 !! input
1013 a
1014 <!-- foo --> b <!-- bar -->
1015 c
1016 !! result
1017 <p>a
1018 </p>
1019 <pre> b
1020 </pre>
1021 <p>c
1022 </p>
1023 !! end
1024
1025 !! test
1026 Comment whitespace
1027 !! input
1028 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1029 !! result
1030
1031 !! end
1032
1033 !! test
1034 Comment semantics and delimiters
1035 !! input
1036 <!-- --><!----><!-----><!------>
1037 !! result
1038
1039 !! end
1040
1041 !! test
1042 Comment semantics and delimiters, redux
1043 !! input
1044 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1045 -- foo -- funky huh? ... -->
1046 !! result
1047
1048 !! end
1049
1050 !! test
1051 Comment semantics and delimiters: directors cut
1052 !! input
1053 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1054 everything starting with < followed by !-- until the first -- and > we see,
1055 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1056 -->-->
1057 !! result
1058 <p>--&gt;
1059 </p>
1060 !! end
1061
1062 !! test
1063 Comment semantics: nesting
1064 !! input
1065 <!--<!-- no, we're not going to do anything fancy here -->-->
1066 !! result
1067 <p>--&gt;
1068 </p>
1069 !! end
1070
1071 !! test
1072 Comment semantics: unclosed comment at end
1073 !! input
1074 <!--This comment will run out to the end of the document
1075 !! result
1076
1077 !! end
1078
1079 !! test
1080 Comment in template title
1081 !! input
1082 {{f<!---->oo}}
1083 !! result
1084 <p>FOO
1085 </p>
1086 !! end
1087
1088 !! test
1089 Comment on its own line post-expand
1090 !! input
1091 a
1092 {{blank}}<!---->
1093 b
1094 !! result
1095 <p>a
1096 </p><p>b
1097 </p>
1098 !! end
1099
1100 !! test
1101 Comment on its own line post-expand with non-significant whitespace
1102 !! input
1103 a
1104 {{blank}} <!---->
1105 b
1106 !! result
1107 <p>a
1108 </p><p>b
1109 </p>
1110 !! end
1111
1112 ###
1113 ### paragraph wrapping tests
1114 ###
1115 !! test
1116 No block tags
1117 !! input
1118 a
1119
1120 b
1121 !! result
1122 <p>a
1123 </p><p>b
1124 </p>
1125 !! end
1126 !! test
1127 Block tag on one line
1128 !! input
1129 a <div>foo</div>
1130
1131 b
1132 !! result
1133 a <div>foo</div>
1134 <p>b
1135 </p>
1136 !! end
1137
1138 !! test
1139 Block tag on both lines
1140 !! input
1141 a <div>foo</div>
1142
1143 b <div>foo</div>
1144 !! result
1145 a <div>foo</div>
1146 b <div>foo</div>
1147
1148 !! end
1149
1150 !! test
1151 Multiple lines without block tags
1152 !! input
1153 <div>foo</div> a
1154 b
1155 c
1156 d<!--foo--> e
1157 x <div>foo</div> z
1158 !! result
1159 <div>foo</div> a
1160 <p>b
1161 c
1162 d e
1163 </p>
1164 x <div>foo</div> z
1165
1166 !! end
1167
1168 !! test
1169 Empty lines between lines with block tags
1170 !! input
1171 <div></div>
1172
1173
1174 <div></div>a
1175
1176 b
1177 <div>a</div>b
1178
1179 <div>b</div>d
1180
1181
1182 <div>e</div>
1183 !! result
1184 <div></div>
1185 <p><br />
1186 </p>
1187 <div></div>a
1188 <p>b
1189 </p>
1190 <div>a</div>b
1191 <div>b</div>d
1192 <p><br />
1193 </p>
1194 <div>e</div>
1195
1196 !! end
1197
1198 ###
1199 ### Preformatted text
1200 ###
1201 !! test
1202 Preformatted text
1203 !! input
1204 This is some
1205 Preformatted text
1206 With ''italic''
1207 And '''bold'''
1208 And a [[Main Page|link]]
1209 !! result
1210 <pre>This is some
1211 Preformatted text
1212 With <i>italic</i>
1213 And <b>bold</b>
1214 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1215 </pre>
1216 !! end
1217
1218 !! test
1219 Ident preformatting with inline content
1220 !! input
1221 a
1222 ''b''
1223 !! result
1224 <pre>a
1225 <i>b</i>
1226 </pre>
1227 !! end
1228
1229 !! test
1230 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1231 !! input
1232 <pre><nowiki>
1233 <b>
1234 <cite>
1235 <em>
1236 </nowiki></pre>
1237 !! result
1238 <pre>
1239 &lt;b&gt;
1240 &lt;cite&gt;
1241 &lt;em&gt;
1242 </pre>
1243
1244 !! end
1245
1246 !! test
1247 Regression with preformatted in <center>
1248 !! input
1249 <center>
1250 Blah
1251 </center>
1252 !! result
1253 <center>
1254 <pre>Blah
1255 </pre>
1256 </center>
1257
1258 !! end
1259
1260 # Expected output in the following test is not really expected (there should be
1261 # <pre> in the output) -- it's only testing for well-formedness.
1262 !! test
1263 Bug 6200: Preformatted in <blockquote>
1264 !! input
1265 <blockquote>
1266 Blah
1267 </blockquote>
1268 !! result
1269 <blockquote>
1270 Blah
1271 </blockquote>
1272
1273 !! end
1274
1275 !! test
1276 <pre> with attributes (bug 3202)
1277 !! input
1278 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1279 !! result
1280 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1281
1282 !! end
1283
1284 !! test
1285 <pre> with width attribute (bug 3202)
1286 !! input
1287 <pre width="8">Narrow screen goodies</pre>
1288 !! result
1289 <pre width="8">Narrow screen goodies</pre>
1290
1291 !! end
1292
1293 !! test
1294 <pre> with forbidden attribute (bug 3202)
1295 !! input
1296 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1297 !! result
1298 <pre width="8">Narrow screen goodies</pre>
1299
1300 !! end
1301
1302 !! test
1303 Entities inside <pre>
1304 !! input
1305 <pre>&lt;</pre>
1306 !! result
1307 <pre>&lt;</pre>
1308
1309 !! end
1310
1311 !! test
1312 <pre> with forbidden attribute values (bug 3202)
1313 !! input
1314 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1315 !! result
1316 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1317
1318 !! end
1319
1320 !! test
1321 <nowiki> inside <pre> (bug 13238)
1322 !! input
1323 <pre>
1324 <nowiki>
1325 </pre>
1326 <pre>
1327 <nowiki></nowiki>
1328 </pre>
1329 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1330 !! result
1331 <pre>
1332 &lt;nowiki&gt;
1333 </pre>
1334 <pre>
1335
1336 </pre>
1337 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1338
1339 !! end
1340
1341 !! test
1342 <nowiki> and <pre> preference (first one wins)
1343 !! input
1344 <pre>
1345 <nowiki>
1346 </pre>
1347 </nowiki>
1348 </pre>
1349
1350 <nowiki>
1351 <pre>
1352 <nowiki>
1353 </pre>
1354 </nowiki>
1355 </pre>
1356
1357 !! result
1358 <pre>
1359 &lt;nowiki&gt;
1360 </pre>
1361 <p>&lt;/nowiki&gt;
1362 &lt;/pre&gt;
1363 </p><p>
1364 &lt;pre&gt;
1365 &lt;nowiki&gt;
1366 &lt;/pre&gt;
1367
1368 &lt;/pre&gt;
1369 </p>
1370 !! end
1371
1372 !! test
1373 </pre> inside nowiki
1374 !! input
1375 <nowiki></pre></nowiki>
1376 !! result
1377 <p>&lt;/pre&gt;
1378 </p>
1379 !! end
1380
1381 !!test
1382 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1383 !!input
1384 {{echo|}}
1385 !!result
1386
1387 !!end
1388
1389 !!test
1390 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1391 !!input
1392 {{echo|
1393 foo}}
1394 !!result
1395 <p>foo
1396 </p>
1397 !!end
1398
1399 !! test
1400 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1401 !! input
1402 {{echo|a
1403 b}}
1404 !!result
1405 <pre>a
1406 </pre>
1407 <p>b
1408 </p>
1409 !!end
1410
1411 !! test
1412 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1413 !! input
1414 {{echo|a
1415 b
1416 c
1417 d
1418 e
1419 }}
1420 !!result
1421 <pre>a
1422 </pre>
1423 <p>b
1424 c
1425 </p>
1426 <pre>d
1427 </pre>
1428 <p>e
1429 </p>
1430 !!end
1431
1432 !!test
1433 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1434 !!input
1435 {{echo| foo}}
1436
1437 {{echo| foo}}{{echo| bar}}
1438
1439 {{echo| foo}}
1440 {{echo| bar}}
1441
1442 {{echo|<!--cmt--> foo}}
1443
1444 <!--cmt-->{{echo| foo}}
1445
1446 {{echo|{{echo| }}bar}}
1447 !!result
1448 <pre>foo
1449 </pre>
1450 <pre>foo bar
1451 </pre>
1452 <pre>foo
1453 bar
1454 </pre>
1455 <pre>foo
1456 </pre>
1457 <pre>foo
1458 </pre>
1459 <pre>bar
1460 </pre>
1461 !!end
1462
1463 !! test
1464 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1465 !! input
1466 {{echo| }}a
1467
1468 {{echo|
1469 }}a
1470
1471 {{echo|
1472 b}}
1473
1474 {{echo|a
1475 }}b
1476
1477 {{echo|a
1478 }} b
1479 !!result
1480 <pre>a
1481 </pre>
1482 <p><br />
1483 </p>
1484 <pre>a
1485 </pre>
1486 <p><br />
1487 </p>
1488 <pre>b
1489 </pre>
1490 <p>a
1491 </p>
1492 <pre>b
1493 </pre>
1494 <p>a
1495 </p>
1496 <pre>b
1497 </pre>
1498 !!end
1499
1500 !! test
1501 Templates: Single-line variant of parameter whitespace stripping test
1502 !! input
1503 {{echo| a}}
1504
1505 {{echo|1= a}}
1506
1507 {{echo|{{echo| a}}}}
1508
1509 {{echo|1={{echo| a}}}}
1510 !! result
1511 <pre>a
1512 </pre>
1513 <p>a
1514 </p>
1515 <pre>a
1516 </pre>
1517 <p>a
1518 </p>
1519 !! end
1520
1521 !! test
1522 Templates: Strip whitespace from named parameters, but not positional ones
1523 !! input
1524 {{echo|
1525 foo}}
1526
1527 {{echo|
1528 * foo}}
1529
1530 {{echo| 1 =
1531 foo}}
1532
1533 {{echo| 1 =
1534 * foo}}
1535 !! result
1536 <pre>foo
1537 </pre>
1538 <p><br />
1539 </p>
1540 <ul><li> foo
1541 </li></ul>
1542 <p>foo
1543 </p>
1544 <ul><li> foo
1545 </li></ul>
1546
1547 !! end
1548
1549 !! test
1550 Templates: Dont strip whitespace from whitespace/comment-only arguments
1551 !! input
1552 {{echo| }}
1553 {{echo|<!--cmt-->}}
1554 {{echo| <!--cmt--> }}
1555 !! result
1556 <p><br />
1557 </p>
1558 !! end
1559
1560 !! test
1561 Templates: Parsoid parameter escaping test 1
1562 !! options
1563 parsoid
1564 !! input
1565 {{echo|[foo]|{{echo|[bar]}}}}
1566 !! result
1567 <p about="#mwt1" typeof="mw:Transclusion"
1568 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>
1569 !! end
1570
1571 !! test
1572 Parsoid: Pipes in external links in template parameter
1573 !! options
1574 parsoid
1575 !! input
1576 {{echo|[{{echo|http://example.com}} link]}}
1577 !! result
1578 <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>
1579 !! end
1580
1581 !! test
1582 Parsoid: pipe in transclusion parameter
1583 !! options
1584 parsoid
1585 !! input
1586 {{echo|http://foo.com/a&#124;b}}
1587 !! result
1588 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1589 typeof="mw:Transclusion"
1590 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>
1591 !! end
1592
1593 !! test
1594 Parsoid: Pipe in external link target and content in template parameter
1595 !! options
1596 parsoid=html2wt,wt2wt
1597 !! input
1598 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1599 !! result
1600 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1601 typeof="mw:Transclusion"
1602 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},
1603 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}'>a|b</a></p>
1604 !! end
1605
1606 !! test
1607 Templates: Dont escape already nowiki-escaped text in template parameters
1608 !! options
1609 parsoid=html2wt,wt2wt
1610 !! input
1611 {{echo|foo<nowiki>|</nowiki>bar}}
1612 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1613 {{echo|<nowiki></nowiki>}}
1614 !! result
1615 <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>
1616 <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>
1617 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}'></span>
1618 </p>
1619 !! end
1620
1621 ###
1622 ### Parsoid-centric tests for testing RT edge cases for pre
1623 ###
1624
1625 !!test
1626 1a. Indent-Pre and Comments
1627 !!input
1628 a
1629 <!--a-->
1630 c
1631 !!result
1632 <pre>a
1633 </pre>
1634 <p>c
1635 </p>
1636 !!end
1637
1638 !!test
1639 1b. Indent-Pre and Comments
1640 !!input
1641 a
1642 <!--a-->
1643 c
1644 !!result
1645 <pre>a
1646 </pre>
1647 <p>c
1648 </p>
1649 !!end
1650
1651 !!test
1652 1c. Indent-Pre and Comments
1653 !!input
1654 <!--a--> a
1655
1656 <!--a--> a
1657 !!result
1658 <pre> a
1659 </pre>
1660 <pre> a
1661 </pre>
1662 !!end
1663
1664 !!test
1665 2a. Indent-Pre and tables
1666 !!input
1667 {|
1668 |-
1669 !h1!!h2
1670 |foo||bar
1671 |}
1672 !!result
1673 <table>
1674
1675 <tr>
1676 <th>h1</th>
1677 <th>h2
1678 </th>
1679 <td>foo</td>
1680 <td>bar
1681 </td></tr></table>
1682
1683 !!end
1684
1685 !!test
1686 2b. Indent-Pre and tables
1687 !!input
1688 {|
1689 |-
1690 |foo
1691 |}
1692 !!result
1693 <table>
1694
1695 <tr>
1696 <td>foo
1697 </td></tr></table>
1698
1699 !!end
1700
1701 !!test
1702 2c. Indent-Pre and tables (bug 42252)
1703 !!input
1704 {|
1705 |+ foo
1706 ! | bar
1707 |}
1708 !!result
1709 <table>
1710 <caption> foo
1711 </caption>
1712 <tr>
1713 <th> bar
1714 </th></tr></table>
1715
1716 !!end
1717
1718 !!test
1719 3a. Indent-Pre and block tags (single-line html)
1720 !!input
1721 <p> foo </p>
1722 <div> foo </div>
1723 <span> foo </span>
1724 !!result
1725 <p> foo </p>
1726 <div> foo </div>
1727 <pre><span> foo </span>
1728 </pre>
1729 !!end
1730
1731 !!test
1732 3b. Indent-Pre and block tags (pre-content on separate line)
1733 !!input
1734 <p>
1735 foo
1736 </p>
1737
1738 <div>
1739 foo
1740 </div>
1741
1742 <center>
1743 foo
1744 </center>
1745
1746 <blockquote>
1747 foo
1748 </blockquote>
1749
1750 <table><tr><td>
1751 foo
1752 </td></tr></table>
1753
1754 <ul><li>
1755 foo
1756 </li></ul>
1757
1758 !!result
1759 <p>
1760 foo
1761 </p>
1762 <div>
1763 <pre>foo
1764 </pre>
1765 </div>
1766 <center>
1767 <pre>foo
1768 </pre>
1769 </center>
1770 <blockquote>
1771 foo
1772 </blockquote>
1773 <table><tr><td>
1774 <pre>foo
1775 </pre>
1776 </td></tr></table>
1777 <ul><li>
1778 foo
1779 </li></ul>
1780
1781 !!end
1782
1783 !!test
1784 4. Multiple spaces at start-of-line
1785 !!input
1786 <p> foo </p>
1787 foo
1788 {|
1789 |foo
1790 |}
1791 !!result
1792 <p> foo </p>
1793 <pre> foo
1794 </pre>
1795 <table>
1796 <tr>
1797 <td>foo
1798 </td></tr></table>
1799
1800 !!end
1801
1802 !! test
1803 5. White-space in indent-pre
1804 NOTE: the white-space char on 2nd line is significant
1805 !! input
1806 a<br/>
1807
1808 b
1809 !! result
1810 <pre>a<br />
1811
1812 b
1813 </pre>
1814 !! end
1815
1816 ###
1817 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1818 ###
1819
1820 !!test
1821 HTML-pre: 1. embedded newlines
1822 !!input
1823 <pre>foo</pre>
1824
1825 <pre>
1826 foo
1827 </pre>
1828
1829 <pre>
1830
1831 foo
1832 </pre>
1833
1834 <pre>
1835
1836
1837 foo
1838 </pre>
1839 !!result
1840 <pre>foo</pre>
1841 <pre>
1842 foo
1843 </pre>
1844 <pre>
1845
1846 foo
1847 </pre>
1848 <pre>
1849
1850
1851 foo
1852 </pre>
1853
1854 !!end
1855
1856 !!test
1857 HTML-pre: 2: indented text
1858 !!input
1859 <pre>
1860 foo
1861 </pre>
1862 !!result
1863 <pre>
1864 foo
1865 </pre>
1866
1867 !!end
1868
1869 !!test
1870 HTML-pre: 3: other wikitext
1871 !!input
1872 <pre>
1873 * foo
1874 # bar
1875 = no-h =
1876 '' no-italic ''
1877 [[ NoLink ]]
1878 </pre>
1879 !!result
1880 <pre>
1881 * foo
1882 # bar
1883 = no-h =
1884 '' no-italic ''
1885 [[ NoLink ]]
1886 </pre>
1887
1888 !!end
1889
1890 ###
1891 ### Definition lists
1892 ###
1893 !! test
1894 Simple definition
1895 !! input
1896 ; name : Definition
1897 !! result
1898 <dl><dt> name&#160;</dt><dd> Definition
1899 </dd></dl>
1900
1901 !! end
1902
1903 !! test
1904 Definition list for indentation only
1905 !! input
1906 : Indented text
1907 !! result
1908 <dl><dd> Indented text
1909 </dd></dl>
1910
1911 !! end
1912
1913 !! test
1914 Definition list with no space
1915 !! input
1916 ;name:Definition
1917 !! result
1918 <dl><dt>name</dt><dd>Definition
1919 </dd></dl>
1920
1921 !!end
1922
1923 !! test
1924 Definition list with URL link
1925 !! input
1926 ; http://example.com/ : definition
1927 !! result
1928 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1929 </dd></dl>
1930
1931 !! end
1932
1933 !! test
1934 Definition list with bracketed URL link
1935 !! input
1936 ;[http://www.example.com/ Example]:Something about it
1937 !! result
1938 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1939 </dd></dl>
1940
1941 !! end
1942
1943 !! test
1944 Definition list with wikilink containing colon
1945 !! input
1946 ; [[Help:FAQ]]: The least-read page on Wikipedia
1947 !! result
1948 <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
1949 </dd></dl>
1950
1951 !! end
1952
1953 # At Brion's and JeLuF's insistence... :)
1954 !! test
1955 Definition list with news link containing colon
1956 !! input
1957 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1958 !! result
1959 <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!
1960 </dd></dl>
1961
1962 !! end
1963
1964 !! test
1965 Malformed definition list with colon
1966 !! input
1967 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1968 !! result
1969 <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
1970 </dt></dl>
1971
1972 !! end
1973
1974 !! test
1975 Definition lists: colon in external link text
1976 !! input
1977 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1978 !! result
1979 <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
1980 </dd></dl>
1981
1982 !! end
1983
1984 !! test
1985 Definition lists: colon in HTML attribute
1986 !! input
1987 ;<b style="display: inline">bold</b>
1988 !! result
1989 <dl><dt><b style="display: inline">bold</b>
1990 </dt></dl>
1991
1992 !! end
1993
1994 !! test
1995 Definition lists: self-closed tag
1996 !! input
1997 ;one<br/>two : two-line fun
1998 !! result
1999 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
2000 </dd></dl>
2001
2002 !! end
2003
2004 !! test
2005 Bug 11748: Literal closing tags
2006 !! input
2007 <dl>
2008 <dt>test 1</dt>
2009 <dd>test test test test test</dd>
2010 <dt>test 2</dt>
2011 <dd>test test test test test</dd>
2012 </dl>
2013 !! result
2014 <dl>
2015 <dt>test 1</dt>
2016 <dd>test test test test test</dd>
2017 <dt>test 2</dt>
2018 <dd>test test test test test</dd>
2019 </dl>
2020
2021 !! end
2022
2023 !! test
2024 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2025 !! input
2026 <ul><li>
2027 ; term : description
2028 * unordered
2029 </li>
2030 </ul>
2031 !! result
2032 <ul><li>
2033 <dl><dt> term&#160;</dt><dd> description
2034 </dd></dl>
2035 <ul><li> unordered
2036 </li></ul>
2037 </li>
2038 </ul>
2039
2040 !! end
2041
2042 !! test
2043
2044 Definition list with empty definition and following paragraph
2045 !! input
2046 ; term:
2047 Paragraph text
2048 !! result
2049 <dl><dt> term</dt><dd>
2050 </dd></dl>
2051 <p>Paragraph text
2052 </p>
2053 !! end
2054
2055 !! test
2056 Nested definition lists using html syntax
2057 !! input
2058 <dl><dd>
2059 <dl>
2060 <dd>Foo</dd>
2061 </dl>
2062 </dd></dl>
2063 !! result
2064 <dl><dd>
2065 <dl>
2066 <dd>Foo</dd>
2067 </dl>
2068 </dd></dl>
2069
2070 !! end
2071
2072 !! test
2073 Definition Lists: No nesting: Multiple dd's
2074 !! input
2075 ;x
2076 :a
2077 :b
2078 !! result
2079 <dl><dt>x
2080 </dt><dd>a
2081 </dd><dd>b
2082 </dd></dl>
2083
2084 !! end
2085
2086 !! test
2087 Definition Lists: Indentation: Regular
2088 !! input
2089 :i1
2090 ::i2
2091 :::i3
2092 !! result
2093 <dl><dd>i1
2094 <dl><dd>i2
2095 <dl><dd>i3
2096 </dd></dl>
2097 </dd></dl>
2098 </dd></dl>
2099
2100 !! end
2101
2102 !! test
2103 Definition Lists: Indentation: Missing 1st level
2104 !! input
2105 ::i2
2106 :::i3
2107 !! result
2108 <dl><dd><dl><dd>i2
2109 <dl><dd>i3
2110 </dd></dl>
2111 </dd></dl>
2112 </dd></dl>
2113
2114 !! end
2115
2116 !! test
2117 Definition Lists: Indentation: Multi-level indent
2118 !! input
2119 :::i3
2120 !! result
2121 <dl><dd><dl><dd><dl><dd>i3
2122 </dd></dl>
2123 </dd></dl>
2124 </dd></dl>
2125
2126 !! end
2127
2128 !! test
2129 Definition Lists: Hacky use to indent tables
2130 !! input
2131 ::{|
2132 |foo
2133 |bar
2134 |}
2135 this text
2136 should be left alone
2137 !! result
2138 <dl><dd><dl><dd><table>
2139 <tr>
2140 <td>foo
2141 </td>
2142 <td>bar
2143 </td></tr></table></dd></dl></dd></dl>
2144 <p>this text
2145 should be left alone
2146 </p>
2147 !! end
2148 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2149 ## as an empty dt item. It also ignores all but the last ";" when followed
2150 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2151 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2152 ## ";"s.
2153 ##
2154 ## Ex: ";;t2 ::d2" is transformed into:
2155 ##
2156 ## <dl>
2157 ## <dt>t2 </dt>
2158 ## <dd>
2159 ## <dl>
2160 ## <dt></dt>
2161 ## <dd>d2</dd>
2162 ## </dl>
2163 ## </dd>
2164 ## </dl>
2165 ##
2166 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2167 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2168 ##
2169 ## <dl>
2170 ## <dt>
2171 ## <dl>
2172 ## <dt>t2 </dt>
2173 ## <dd>:d2</dd>
2174 ## </dl>
2175 ## </dt>
2176 ## </dl>
2177 ##
2178 ## All Parsoid only definition list tests have this difference.
2179 ##
2180 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2181 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2182
2183 !! test
2184 Table / list interaction: indented table with lists in table contents
2185 !! input
2186 :{|
2187 |-
2188 | a
2189 * b
2190 |-
2191 | c
2192 * d
2193 |}
2194 !! result
2195 <dl><dd><table>
2196
2197 <tr>
2198 <td> a
2199 <ul><li> b
2200 </li></ul>
2201 </td></tr>
2202 <tr>
2203 <td> c
2204 <ul><li> d
2205 </li></ul>
2206 </td></tr></table></dd></dl>
2207
2208 !! end
2209
2210 !!test
2211 Table / list interaction: lists nested in tables nested in indented lists
2212 !!input
2213 :{|
2214 |
2215 :a
2216 :b
2217 |
2218 *c
2219 *d
2220 |}
2221
2222 *e
2223 *f
2224 !!result
2225 <dl><dd><table>
2226 <tr>
2227 <td>
2228 <dl><dd>a
2229 </dd><dd>b
2230 </dd></dl>
2231 </td>
2232 <td>
2233 <ul><li>c
2234 </li><li>d
2235 </li></ul>
2236 </td></tr></table></dd></dl>
2237 <ul><li>e
2238 </li><li>f
2239 </li></ul>
2240
2241 !!end
2242
2243 !! test
2244 Definition Lists: Nesting: Multi-level (Parsoid only)
2245 !! options
2246 parsoid
2247 !! input
2248 ;t1 :d1
2249 ;;t2 ::d2
2250 ;;;t3 :::d3
2251 !! result
2252 <dl>
2253 <dt>t1 </dt>
2254 <dd>d1</dd>
2255 <dt>
2256 <dl>
2257 <dt>t2 </dt>
2258 <dd>:d2</dd>
2259 <dt>
2260 <dl>
2261 <dt>t3 </dt>
2262 <dd>::d3</dd>
2263 </dl>
2264 </dt>
2265 </dl>
2266 </dt>
2267 </dl>
2268
2269
2270 !! end
2271
2272
2273 !! test
2274 Definition Lists: Nesting: Test 2 (Parsoid only)
2275 !! options
2276 parsoid
2277 !! input
2278 ;t1
2279 ::d2
2280 !! result
2281 <dl>
2282 <dt>t1</dt>
2283 <dd>
2284 <dl>
2285 <dd>d2</dd>
2286 </dl>
2287 </dd>
2288 </dl>
2289
2290 !! end
2291
2292
2293 !! test
2294 Definition Lists: Nesting: Test 3 (Parsoid only)
2295 !! options
2296 parsoid
2297 !! input
2298 :;t1
2299 ::::d2
2300 !! result
2301 <dl>
2302 <dd>
2303 <dl>
2304 <dt>t1</dt>
2305 <dd>
2306 <dl>
2307 <dd>
2308 <dl>
2309 <dd>d2</dd>
2310 </dl>
2311 </dd>
2312 </dl>
2313 </dd>
2314 </dl>
2315 </dd>
2316 </dl>
2317
2318 !! end
2319
2320
2321 !! test
2322 Definition Lists: Nesting: Test 4
2323 !! input
2324 ::;t3
2325 :::d3
2326 !! result
2327 <dl><dd><dl><dd><dl><dt>t3
2328 </dt><dd>d3
2329 </dd></dl>
2330 </dd></dl>
2331 </dd></dl>
2332
2333 !! end
2334
2335
2336 ## The Parsoid team believes the following three test exposes a
2337 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2338 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2339 !! test
2340 Definition Lists: Mixed Lists: Test 1 (php)
2341 !! options
2342 php
2343 !! input
2344 :;* foo
2345 ::* bar
2346 :; baz
2347 !! result
2348 <dl><dd><dl><dt><ul><li> foo
2349 </li><li> bar
2350 </li></ul>
2351 </dt></dl>
2352 <dl><dt> baz
2353 </dt></dl>
2354 </dd></dl>
2355
2356 !! end
2357 !! test
2358 Definition Lists: Mixed Lists: Test 1 (parsoid)
2359 !! options
2360 parsoid
2361 !! input
2362 :;* foo
2363 ::* bar
2364 :; baz
2365 !! result
2366 <dl><dd><dl><dt><ul><li> foo
2367 </li></ul></dt><dd><ul><li> bar
2368 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2369 !! end
2370
2371 !! test
2372 Definition Lists: Mixed Lists: Test 2
2373 !! input
2374 *: d1
2375 *: d2
2376 !! result
2377 <ul><li><dl><dd> d1
2378 </dd><dd> d2
2379 </dd></dl>
2380 </li></ul>
2381
2382 !! end
2383
2384
2385 !! test
2386 Definition Lists: Mixed Lists: Test 3
2387 !! input
2388 *::: d1
2389 *::: d2
2390 !! result
2391 <ul><li><dl><dd><dl><dd><dl><dd> d1
2392 </dd><dd> d2
2393 </dd></dl>
2394 </dd></dl>
2395 </dd></dl>
2396 </li></ul>
2397
2398 !! end
2399
2400
2401 !! test
2402 Definition Lists: Mixed Lists: Test 4
2403 !! input
2404 *;d1 :d2
2405 *;d3 :d4
2406 !! result
2407 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2408 </dd><dt>d3&#160;</dt><dd>d4
2409 </dd></dl>
2410 </li></ul>
2411
2412 !! end
2413
2414
2415 !! test
2416 Definition Lists: Mixed Lists: Test 5
2417 !! input
2418 *:d1
2419 *:: d2
2420 !! result
2421 <ul><li><dl><dd>d1
2422 <dl><dd> d2
2423 </dd></dl>
2424 </dd></dl>
2425 </li></ul>
2426
2427 !! end
2428
2429
2430 !! test
2431 Definition Lists: Mixed Lists: Test 6
2432 !! input
2433 #*:d1
2434 #*::: d3
2435 !! result
2436 <ol><li><ul><li><dl><dd>d1
2437 <dl><dd><dl><dd> d3
2438 </dd></dl>
2439 </dd></dl>
2440 </dd></dl>
2441 </li></ul>
2442 </li></ol>
2443
2444 !! end
2445
2446
2447 !! test
2448 Definition Lists: Mixed Lists: Test 7
2449 !! input
2450 :* d1
2451 :* d2
2452 !! result
2453 <dl><dd><ul><li> d1
2454 </li><li> d2
2455 </li></ul>
2456 </dd></dl>
2457
2458 !! end
2459
2460
2461 !! test
2462 Definition Lists: Mixed Lists: Test 8
2463 !! input
2464 :* d1
2465 ::* d2
2466 !! result
2467 <dl><dd><ul><li> d1
2468 </li></ul>
2469 <dl><dd><ul><li> d2
2470 </li></ul>
2471 </dd></dl>
2472 </dd></dl>
2473
2474 !! end
2475
2476
2477 !! test
2478 Definition Lists: Mixed Lists: Test 9
2479 !! input
2480 *;foo :bar
2481 !! result
2482 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2483 </dd></dl>
2484 </li></ul>
2485
2486 !! end
2487
2488
2489 !! test
2490 Definition Lists: Mixed Lists: Test 10
2491 !! input
2492 *#;foo :bar
2493 !! result
2494 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2495 </dd></dl>
2496 </li></ol>
2497 </li></ul>
2498
2499 !! end
2500
2501 # The Parsoid team disagrees with the PHP parser's seemingly-random
2502 # rules regarding dd/dt on the next two tests. Parsoid is more
2503 # consistent, and recognizes the shared nesting and keeps the
2504 # still-open tags around until the nesting is complete.
2505
2506 !! test
2507 Definition Lists: Mixed Lists: Test 11 (php)
2508 !! options
2509 php
2510 !! input
2511 *#*#;*;;foo :bar
2512 *#*#;boo :baz
2513 !! result
2514 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2515 </dt></dl>
2516 </dd></dl>
2517 </li></ul>
2518 </dd></dl>
2519 <dl><dt>boo&#160;</dt><dd>baz
2520 </dd></dl>
2521 </li></ol>
2522 </li></ul>
2523 </li></ol>
2524 </li></ul>
2525
2526 !! end
2527 !! test
2528 Definition Lists: Mixed Lists: Test 11 (parsoid)
2529 !! options
2530 parsoid
2531 !! input
2532 *#*#;*;;foo :bar
2533 *#*#;boo :baz
2534 !! result
2535 <ul>
2536 <li>
2537 <ol>
2538 <li>
2539 <ul>
2540 <li>
2541 <ol>
2542 <li>
2543 <dl>
2544 <dt>
2545 <ul>
2546 <li>
2547 <dl>
2548 <dt>
2549 <dl>
2550 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2551 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2552 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2553 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2554 !! end
2555
2556
2557 !! test
2558 Definition Lists: Weird Ones: Test 1 (php)
2559 !! options
2560 php
2561 !! input
2562 *#;*::;; foo : bar (who uses this?)
2563 !! result
2564 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2565 </dt></dl>
2566 </dd></dl>
2567 </dd></dl>
2568 </dd></dl>
2569 </li></ul>
2570 </dd></dl>
2571 </li></ol>
2572 </li></ul>
2573
2574 !! end
2575 !! test
2576 Definition Lists: Weird Ones: Test 1 (parsoid)
2577 !! options
2578 parsoid
2579 !! input
2580 *#;*::;; foo : bar (who uses this?)
2581 !! result
2582 <ul>
2583 <li>
2584 <ol>
2585 <li>
2586 <dl>
2587 <dt>
2588 <ul>
2589 <li>
2590 <dl>
2591 <dd>
2592 <dl>
2593 <dd>
2594 <dl>
2595 <dt>
2596 <dl>
2597 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2598 <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>
2599 !! end
2600
2601 ###
2602 ### External links
2603 ###
2604 !! test
2605 External links: non-bracketed
2606 !! input
2607 Non-bracketed: http://example.com
2608 !! result
2609 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2610 </p>
2611 !! end
2612
2613 !! test
2614 External links: numbered
2615 !! input
2616 Numbered: [http://example.com]
2617 Numbered: [http://example.net]
2618 Numbered: [http://example.com]
2619 !! result
2620 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2621 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2622 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2623 </p>
2624 !!end
2625
2626 !! test
2627 External links: specified text
2628 !! input
2629 Specified text: [http://example.com link]
2630 !! result
2631 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2632 </p>
2633 !!end
2634
2635 !! test
2636 External links: trail
2637 !! input
2638 Linktrails should not work for external links: [http://example.com link]s
2639 !! result
2640 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2641 </p>
2642 !! end
2643
2644 !! test
2645 External links: dollar sign in URL
2646 !! input
2647 http://example.com/1$2345
2648 !! result
2649 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2650 </p>
2651 !! end
2652
2653 !! test
2654 External links: dollar sign in URL (named)
2655 !! input
2656 [http://example.com/1$2345]
2657 !! result
2658 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2659 </p>
2660 !!end
2661
2662 !! test
2663 External links: open square bracket forbidden in URL (bug 4377)
2664 !! input
2665 http://example.com/1[2345
2666 !! result
2667 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2668 </p>
2669 !! end
2670
2671 !! test
2672 External links: open square bracket forbidden in URL (named) (bug 4377)
2673 !! input
2674 [http://example.com/1[2345]
2675 !! result
2676 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2677 </p>
2678 !!end
2679
2680 !! test
2681 External links: nowiki in URL link text (bug 6230)
2682 !!input
2683 [http://example.com/ <nowiki>''example site''</nowiki>]
2684 !! result
2685 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2686 </p>
2687 !! end
2688
2689 !! test
2690 External links: newline forbidden in text (bug 6230 regression check)
2691 !! input
2692 [http://example.com/ first
2693 second]
2694 !! result
2695 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2696 second]
2697 </p>
2698 !!end
2699
2700 !! test
2701 External links: Pipe char between url and text
2702 !! input
2703 [http://example.com | link]
2704 !! result
2705 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2706 </p>
2707 !!end
2708
2709 !! test
2710 External links: protocol-relative URL in brackets
2711 !! input
2712 [//example.com/ Test]
2713 !! result
2714 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2715 </p>
2716 !! end
2717
2718 !! test
2719 External links: protocol-relative URL in brackets without text
2720 !! input
2721 [//example.com]
2722 !! result
2723 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2724 </p>
2725 !! end
2726
2727 !! test
2728 External links: protocol-relative URL in free text is left alone
2729 !! input
2730 //example.com/Foo
2731 !! result
2732 <p>//example.com/Foo
2733 </p>
2734 !!end
2735
2736 !! test
2737 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2738 !! input
2739 foo//example.com/Foo
2740 !! result
2741 <p>foo//example.com/Foo
2742 </p>
2743 !! end
2744
2745 !! test
2746 External image
2747 !! input
2748 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2749 !! result
2750 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2751 </p>
2752 !! end
2753
2754 !! test
2755 External image from https
2756 !! input
2757 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2758 !! result
2759 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2760 </p>
2761 !! end
2762
2763 !! test
2764 External image (when not allowed)
2765 !! options
2766 wgAllowExternalImages=0
2767 !! input
2768 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2769 !! result
2770 <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>
2771 </p>
2772 !! end
2773
2774 !! test
2775 Link to non-http image, no img tag
2776 !! input
2777 Link to non-http image, no img tag: ftp://example.com/test.jpg
2778 !! result
2779 <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>
2780 </p>
2781 !! end
2782
2783 !! test
2784 External links: terminating separator
2785 !! input
2786 Terminating separator: http://example.com/thing,
2787 !! result
2788 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2789 </p>
2790 !! end
2791
2792 !! test
2793 External links: intervening separator
2794 !! input
2795 Intervening separator: http://example.com/1,2,3
2796 !! result
2797 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2798 </p>
2799 !! end
2800
2801 !! test
2802 External links: old bug with URL in query
2803 !! input
2804 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2805 !! result
2806 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2807 </p>
2808 !! end
2809
2810 !! test
2811 External links: old URL-in-URL bug, mixed protocols
2812 !! input
2813 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2814 !! result
2815 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2816 </p>
2817 !!end
2818
2819 !! test
2820 External links: URL in text
2821 !! input
2822 URL in text: [http://example.com http://example.com]
2823 !! result
2824 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2825 </p>
2826 !! end
2827
2828 !! test
2829 External links: Clickable images
2830 !! input
2831 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2832 !! result
2833 <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>
2834 </p>
2835 !!end
2836
2837 !! test
2838 External links: raw ampersand
2839 !! input
2840 Old &amp; use: http://x&y
2841 !! result
2842 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2843 </p>
2844 !! end
2845
2846 !! test
2847 External links: encoded ampersand
2848 !! input
2849 Old &amp; use: http://x&amp;y
2850 !! result
2851 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2852 </p>
2853 !! end
2854
2855 !! test
2856 External links: encoded equals (bug 6102)
2857 !! input
2858 http://example.com/?foo&#61;bar
2859 !! result
2860 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2861 </p>
2862 !! end
2863
2864 !! test
2865 External links: [raw ampersand]
2866 !! input
2867 Old &amp; use: [http://x&y]
2868 !! result
2869 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2870 </p>
2871 !! end
2872
2873 !! test
2874 External links: [encoded ampersand]
2875 !! input
2876 Old &amp; use: [http://x&amp;y]
2877 !! result
2878 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2879 </p>
2880 !! end
2881
2882 !! test
2883 External links: [encoded equals] (bug 6102)
2884 !! input
2885 [http://example.com/?foo&#61;bar]
2886 !! result
2887 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2888 </p>
2889 !! end
2890
2891 !! test
2892 External links: [IDN ignored character reference in hostname; strip it right off]
2893 !! input
2894 [http://e&zwnj;xample.com/]
2895 !! result
2896 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2897 </p>
2898 !! end
2899
2900 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2901 # Where an external link could easily circumvent the sanitization of the text of
2902 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2903 # test demands a higher standard. That's a bit strange.
2904 #
2905 # Example:
2906 #
2907 # http://e‌xample.com -> [http://example.com|http://example.com]
2908 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2909 #
2910 # The first example is sanitized, but the second is not. Any security benefits
2911 # from this production are trivial to circumvent. Either remove this test and
2912 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2913 # the test accordingly.
2914 #
2915 # All our love,
2916 # The Parsoid team.
2917 !! test
2918 External links: IDN ignored character reference in hostname; strip it right off
2919 !! input
2920 http://e&zwnj;xample.com/
2921 !! result
2922 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2923 </p>
2924 !! end
2925
2926 !! test
2927 External links: www.jpeg.org (bug 554)
2928 !! input
2929 http://www.jpeg.org
2930 !!result
2931 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2932 </p>
2933 !! end
2934
2935 !! test
2936 External links: URL within URL (original bug 2)
2937 !! input
2938 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2939 !! result
2940 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2941 </p>
2942 !! end
2943
2944 !! test
2945 BUG 361: URL inside bracketed URL
2946 !! input
2947 [http://www.example.com/foo http://www.example.com/bar]
2948 !! result
2949 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2950 </p>
2951 !! end
2952
2953 !! test
2954 BUG 361: URL within URL, not bracketed
2955 !! input
2956 http://www.example.com/foo?=http://www.example.com/bar
2957 !! result
2958 <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>
2959 </p>
2960 !! end
2961
2962 !! test
2963 BUG 289: ">"-token in URL-tail
2964 !! input
2965 http://www.example.com/<hello>
2966 !! result
2967 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2968 </p>
2969 !!end
2970
2971 !! test
2972 BUG 289: literal ">"-token in URL-tail
2973 !! input
2974 http://www.example.com/<b>html</b>
2975 !! result
2976 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2977 </p>
2978 !!end
2979
2980 !! test
2981 BUG 289: ">"-token in bracketed URL
2982 !! input
2983 [http://www.example.com/<hello> stuff]
2984 !! result
2985 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2986 </p>
2987 !!end
2988
2989 !! test
2990 BUG 289: literal ">"-token in bracketed URL
2991 !! input
2992 [http://www.example.com/<b>html</b> stuff]
2993 !! result
2994 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2995 </p>
2996 !!end
2997
2998 !! test
2999 BUG 289: literal double quote at end of URL
3000 !! input
3001 http://www.example.com/"hello"
3002 !! result
3003 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3004 </p>
3005 !!end
3006
3007 !! test
3008 BUG 289: literal double quote in bracketed URL
3009 !! input
3010 [http://www.example.com/"hello" stuff]
3011 !! result
3012 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3013 </p>
3014 !!end
3015
3016 !! test
3017 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3018 !! input
3019 [http://www.example.com test]
3020 !! result
3021 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3022 </p>
3023 !! end
3024
3025 !! test
3026 External links: link text with spaces
3027 !! input
3028 [http://www.example.com a b c]
3029 [http://www.example.com ''a'' ''b'']
3030 !! result
3031 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3032 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3033 </p>
3034 !! end
3035
3036 !! test
3037 External links: wiki links within external link (Bug 3695)
3038 !! input
3039 [http://example.com [[wikilink]] embedded in ext link]
3040 !! result
3041 <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>
3042 </p>
3043 !! end
3044
3045 !! test
3046 BUG 787: Links with one slash after the url protocol are invalid
3047 !! input
3048 http:/example.com
3049
3050 [http:/example.com title]
3051 !! result
3052 <p>http:/example.com
3053 </p><p>[http:/example.com title]
3054 </p>
3055 !! end
3056
3057 !! test
3058 Bracketed external links with template-generated invalid target
3059 !! input
3060 [{{echo|http:/example.com}} title]
3061 !! result
3062 <p>[http:/example.com title]
3063 </p>
3064 !! end
3065
3066 !! test
3067 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3068 !! input
3069 ''[http://example.com text'']
3070 [http://example.com '''text]'''
3071 ''Something [http://example.com in italic'']
3072 ''Something [http://example.com mixed''''', even bold]'''
3073 '''''Now [http://example.com both''''']
3074 !! result
3075 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3076 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3077 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3078 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3079 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3080 </p>
3081 !! end
3082
3083
3084 !! test
3085 Bug 4781: %26 in URL
3086 !! input
3087 http://www.example.com/?title=AT%26T
3088 !! result
3089 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3090 </p>
3091 !! end
3092
3093 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3094 # % is actually legal in HTML5. Any change in output would need testing though.
3095 !! test
3096 Bug 4781, 5267: %25 in URL
3097 !! input
3098 http://www.example.com/?title=100%25_Bran
3099 !! result
3100 <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>
3101 </p>
3102 !! end
3103
3104 !! test
3105 Bug 4781, 5267: %28, %29 in URL
3106 !! input
3107 http://www.example.com/?title=Ben-Hur_%281959_film%29
3108 !! result
3109 <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>
3110 </p>
3111 !! end
3112
3113
3114 !! test
3115 Bug 4781: %26 in autonumber URL
3116 !! input
3117 [http://www.example.com/?title=AT%26T]
3118 !! result
3119 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3120 </p>
3121 !! end
3122
3123 !! test
3124 Bug 4781, 5267: %26 in autonumber URL
3125 !! input
3126 [http://www.example.com/?title=100%25_Bran]
3127 !! result
3128 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3129 </p>
3130 !! end
3131
3132 !! test
3133 Bug 4781, 5267: %28, %29 in autonumber URL
3134 !! input
3135 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3136 !! result
3137 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3138 </p>
3139 !! end
3140
3141
3142 !! test
3143 Bug 4781: %26 in bracketed URL
3144 !! input
3145 [http://www.example.com/?title=AT%26T link]
3146 !! result
3147 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3148 </p>
3149 !! end
3150
3151 !! test
3152 Bug 4781, 5267: %26 in bracketed URL
3153 !! input
3154 [http://www.example.com/?title=100%25_Bran link]
3155 !! result
3156 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3157 </p>
3158 !! end
3159
3160 !! test
3161 Bug 4781, 5267: %28, %29 in bracketed URL
3162 !! input
3163 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3164 !! result
3165 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3166 </p>
3167 !! end
3168
3169 !! test
3170 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3171 !! input
3172 Some [http://example.com/ pretty ''italics'' and stuff]!
3173 !! result
3174 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3175 </p>
3176 !! end
3177
3178 !! test
3179 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3180 !! input
3181 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3182 !! result
3183 <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>
3184 </p>
3185 !! end
3186
3187 !! test
3188 External link containing double-single-quotes with no space separating the url from text in italics
3189 !! input
3190 [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]].]
3191 !! result
3192 <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>
3193 </p>
3194 !! end
3195
3196 !! test
3197 External link with comments in link text
3198 !! input
3199 [http://www.google.com Google <!-- comment -->]
3200 !! result
3201 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3202 </p>
3203 !! end
3204
3205 !! test
3206 URL-encoding in URL functions (single parameter)
3207 !! input
3208 {{localurl:Some page|amp=&}}
3209 !! result
3210 <p>/index.php?title=Some_page&amp;amp=&amp;
3211 </p>
3212 !! end
3213
3214 !! test
3215 URL-encoding in URL functions (multiple parameters)
3216 !! input
3217 {{localurl:Some page|q=?&amp=&}}
3218 !! result
3219 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3220 </p>
3221 !! end
3222
3223 !! test
3224 Brackets in urls
3225 !! input
3226 http://example.com/index.php?foozoid%5B%5D=bar
3227
3228 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3229 !! result
3230 <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>
3231 </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>
3232 </p>
3233 !! end
3234
3235 !! test
3236 IPv6 urls (bug 21261)
3237 !! options
3238 disabled
3239 !! input
3240 http://[2404:130:0:1000::187:2]/index.php
3241 !! result
3242 <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>
3243 </p>
3244 !! end
3245
3246 !! test
3247 Non-extlinks in brackets
3248 !! input
3249 [foo]
3250 [foo bar]
3251 [foo ''bar'']
3252 [fool's] errand
3253 [fool's errand]
3254 [{{echo|foo}}]
3255 [{{echo|foo}} bar]
3256 [{{echo|foo}} ''bar'']
3257 [{{echo|foo}}l's] errand
3258 [{{echo|foo}}l's errand]
3259 [url={{echo|foo}}]
3260 [url=http://example.com]
3261 !! result
3262 <p>[foo]
3263 [foo bar]
3264 [foo <i>bar</i>]
3265 [fool's] errand
3266 [fool's errand]
3267 [foo]
3268 [foo bar]
3269 [foo <i>bar</i>]
3270 [fool's] errand
3271 [fool's errand]
3272 [url=foo]
3273 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3274 </p>
3275 !! end
3276
3277 !! test
3278 Parsoid: Percent encoding in external links
3279 !! options
3280 parsoid
3281 !! input
3282 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3283 !! result
3284 <p><a rel="mw:ExtLink"
3285 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3286 !! end
3287
3288 !! test
3289 Parsoid: use url link syntax for links where the content is equal the link
3290 target
3291 !! options
3292 parsoid
3293 !! input
3294 http://example.com
3295 !! result
3296 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3297 !! end
3298
3299 ###
3300 ### Quotes
3301 ###
3302
3303 !! test
3304 Quotes
3305 !! input
3306 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3307
3308 Normal text. '''''Bold italic text.''''' Normal text.
3309 !!result
3310 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3311 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3312 </p>
3313 !! end
3314
3315
3316 !! test
3317 Unclosed and unmatched quotes (php)
3318 !! options
3319 php
3320 !! input
3321 '''''Bold italic text '''with bold deactivated''' in between.'''''
3322
3323 '''''Bold italic text ''with italic deactivated'' in between.'''''
3324
3325 '''Bold text..
3326
3327 ..spanning two paragraphs (should not work).'''
3328
3329 '''Bold tag left open
3330
3331 ''Italic tag left open
3332
3333 Normal text.
3334
3335 <!-- Unmatching number of opening, closing tags: -->
3336 '''This year''''s election ''should'' beat '''last year''''s.
3337
3338 ''Tom'''s car is bigger than ''Susan'''s.
3339
3340 Plain ''italic'''s plain
3341 !! result
3342 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3343 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3344 </p><p><b>Bold text..</b>
3345 </p><p>..spanning two paragraphs (should not work).
3346 </p><p><b>Bold tag left open</b>
3347 </p><p><i>Italic tag left open</i>
3348 </p><p>Normal text.
3349 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3350 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3351 </p><p>Plain <i>italic'</i>s plain
3352 </p>
3353 !! end
3354 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3355 # parser strips. The wikitext contains just the first half of the bold
3356 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3357 # differently than the PHP parser.)
3358 !! test
3359 Unclosed and unmatched quotes (parsoid)
3360 !! options
3361 parsoid
3362 !! input
3363 '''''Bold italic text '''with bold deactivated''' in between.'''''
3364
3365 '''''Bold italic text ''with italic deactivated'' in between.'''''
3366
3367 '''Bold text..
3368
3369 ..spanning two paragraphs (should not work).'''
3370
3371 '''Bold tag left open
3372
3373 ''Italic tag left open
3374
3375 Normal text.
3376
3377 <!-- Unmatching number of opening, closing tags: -->
3378 '''This year''''s election ''should'' beat '''last year''''s.
3379
3380 ''Tom'''s car is bigger than ''Susan'''s.
3381
3382 Plain ''italic'''s plain
3383 !! result
3384 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3385 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3386 </p><p><b>Bold text..</b>
3387 </p><p>..spanning two paragraphs (should not work).<b></b>
3388 </p><p><b>Bold tag left open</b>
3389 </p><p><i>Italic tag left open</i>
3390 </p><p>Normal text.
3391 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3392 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3393 </p><p>Plain <i>italic'</i>s plain
3394 </p>
3395 !! end
3396
3397 ###
3398 ### Tables
3399 ###
3400 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3401 ###
3402
3403 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3404 # is the bare minimum required by the spec, see:
3405 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3406 !! test
3407 A table with no data. (php)
3408 !! options
3409 php
3410 !! input
3411 {||}
3412 !! result
3413 !! end
3414 # Parsoid team replies: empty table tags are legal in HTML5
3415 !! test
3416 A table with no data. (parsoid)
3417 !! options
3418 parsoid
3419 !! input
3420 {||}
3421 !! result
3422 <table></table>
3423 !! end
3424
3425 # A table with nothing but a caption is invalid XHTML, we might want to render
3426 # this as <p>caption</p>
3427 !! test
3428 A table with nothing but a caption (php)
3429 !! options
3430 php
3431 !! input
3432 {|
3433 |+ caption
3434 |}
3435 !! result
3436 <table>
3437 <caption> caption
3438 </caption><tr><td></td></tr></table>
3439
3440 !! end
3441 # Parsoid team replies: table with only a caption is legal in HTML5
3442 !! test
3443 A table with nothing but a caption (parsoid)
3444 !! options
3445 parsoid
3446 !! input
3447 {|
3448 |+ caption
3449 |}
3450 !! result
3451 <table><caption> caption</caption></table>
3452 !! end
3453
3454 !! test
3455 A table with caption with default-spaced attributes and a table row
3456 !! input
3457 {|
3458 |+ style="color: red;" | caption1
3459 |-
3460 | foo
3461 |}
3462 !! result
3463 <table>
3464 <caption style="color: red;"> caption1
3465 </caption>
3466 <tr>
3467 <td> foo
3468 </td></tr></table>
3469
3470 !! end
3471
3472 !! test
3473 A table with captions with non-default spaced attributes and a table row
3474 !! input
3475 {|
3476 |+style="color: red;"|caption2
3477 |+ style="color: red;"| caption3
3478 |-
3479 | foo
3480 |}
3481 !! result
3482 <table>
3483 <caption style="color: red;">caption2
3484 </caption>
3485 <caption style="color: red;"> caption3
3486 </caption>
3487 <tr>
3488 <td> foo
3489 </td></tr></table>
3490
3491 !! end
3492
3493 !! test
3494 Table td-cell syntax variations
3495 !! input
3496 {|
3497 | foo bar foo | baz
3498 | foo bar foo || baz
3499 | style='color:red;' | baz
3500 | style='color:red;' || baz
3501 |}
3502 !! result
3503 <table>
3504 <tr>
3505 <td> baz
3506 </td>
3507 <td> foo bar foo </td>
3508 <td> baz
3509 </td>
3510 <td style="color:red;"> baz
3511 </td>
3512 <td> style='color:red;' </td>
3513 <td> baz
3514 </td></tr></table>
3515
3516 !! end
3517
3518 !! test
3519 Simple table
3520 !! input
3521 {|
3522 | 1 || 2
3523 |-
3524 | 3 || 4
3525 |}
3526 !! result
3527 <table>
3528 <tr>
3529 <td> 1 </td>
3530 <td> 2
3531 </td></tr>
3532 <tr>
3533 <td> 3 </td>
3534 <td> 4
3535 </td></tr></table>
3536
3537 !! end
3538
3539 !! test
3540 Simple table but with multiple dashes for row wikitext
3541 !! input
3542 {|
3543 | foo
3544 |-----
3545 | bar
3546 |}
3547 !! result
3548 <table>
3549 <tr>
3550 <td> foo
3551 </td></tr>
3552 <tr>
3553 <td> bar
3554 </td></tr></table>
3555
3556 !! end
3557 !! test
3558 Multiplication table
3559 !! input
3560 {| border="1" cellpadding="2"
3561 |+Multiplication table
3562 |-
3563 ! &times; !! 1 !! 2 !! 3
3564 |-
3565 ! 1
3566 | 1 || 2 || 3
3567 |-
3568 ! 2
3569 | 2 || 4 || 6
3570 |-
3571 ! 3
3572 | 3 || 6 || 9
3573 |-
3574 ! 4
3575 | 4 || 8 || 12
3576 |-
3577 ! 5
3578 | 5 || 10 || 15
3579 |}
3580 !! result
3581 <table border="1" cellpadding="2">
3582 <caption>Multiplication table
3583 </caption>
3584 <tr>
3585 <th> &#215; </th>
3586 <th> 1 </th>
3587 <th> 2 </th>
3588 <th> 3
3589 </th></tr>
3590 <tr>
3591 <th> 1
3592 </th>
3593 <td> 1 </td>
3594 <td> 2 </td>
3595 <td> 3
3596 </td></tr>
3597 <tr>
3598 <th> 2
3599 </th>
3600 <td> 2 </td>
3601 <td> 4 </td>
3602 <td> 6
3603 </td></tr>
3604 <tr>
3605 <th> 3
3606 </th>
3607 <td> 3 </td>
3608 <td> 6 </td>
3609 <td> 9
3610 </td></tr>
3611 <tr>
3612 <th> 4
3613 </th>
3614 <td> 4 </td>
3615 <td> 8 </td>
3616 <td> 12
3617 </td></tr>
3618 <tr>
3619 <th> 5
3620 </th>
3621 <td> 5 </td>
3622 <td> 10 </td>
3623 <td> 15
3624 </td></tr></table>
3625
3626 !! end
3627
3628 !! test
3629 Accept "||" in table headings
3630 !! input
3631 {|
3632 !h1 || h2
3633 |}
3634 !! result
3635 <table>
3636 <tr>
3637 <th>h1 </th>
3638 <th> h2
3639 </th></tr></table>
3640
3641 !! end
3642
3643 !! test
3644 Accept "||" in indented table headings
3645 !! input
3646 :{|
3647 !h1 || h2
3648 |}
3649 !! result
3650 <dl><dd><table>
3651 <tr>
3652 <th>h1 </th>
3653 <th> h2
3654 </th></tr></table></dd></dl>
3655
3656 !! end
3657
3658 !! test
3659 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3660 !! input
3661 {|
3662 !| h1
3663 || a
3664 |}
3665 !! result
3666 <table>
3667 <tr>
3668 <th> h1
3669 </th>
3670 <td> a
3671 </td></tr></table>
3672
3673 !! end
3674
3675 !!test
3676 Accept "| !" at start of line in tables (ignore !-attribute)
3677 !!input
3678 {|
3679 |-
3680 | !style="color:red" | bar
3681 |}
3682 !!result
3683 <table>
3684
3685 <tr>
3686 <td> bar
3687 </td></tr></table>
3688
3689 !!end
3690
3691 !!test
3692 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 +/-
3693 !!input
3694 {|
3695 |-
3696 |style='color:red;'|+1
3697 |style='color:blue;'|-1
3698 |-
3699 | 1 || 2 || 3
3700 | 1 ||+2 ||-3
3701 |-
3702 | +1
3703 | -1
3704 |}
3705 !!result
3706 <table>
3707
3708 <tr>
3709 <td style="color:red;">+1
3710 </td>
3711 <td style="color:blue;">-1
3712 </td></tr>
3713 <tr>
3714 <td> 1 </td>
3715 <td> 2 </td>
3716 <td> 3
3717 </td>
3718 <td> 1 </td>
3719 <td>+2 </td>
3720 <td>-3
3721 </td></tr>
3722 <tr>
3723 <td> +1
3724 </td>
3725 <td> -1
3726 </td></tr></table>
3727
3728 !!end
3729
3730 !! test
3731 Table rowspan
3732 !! input
3733 {| border=1
3734 | Cell 1, row 1
3735 |rowspan=2| Cell 2, row 1 (and 2)
3736 | Cell 3, row 1
3737 |-
3738 | Cell 1, row 2
3739 | Cell 3, row 2
3740 |}
3741 !! result
3742 <table border="1">
3743 <tr>
3744 <td> Cell 1, row 1
3745 </td>
3746 <td rowspan="2"> Cell 2, row 1 (and 2)
3747 </td>
3748 <td> Cell 3, row 1
3749 </td></tr>
3750 <tr>
3751 <td> Cell 1, row 2
3752 </td>
3753 <td> Cell 3, row 2
3754 </td></tr></table>
3755
3756 !! end
3757
3758 !! test
3759 Nested table
3760 !! input
3761 {| border=1
3762 | &alpha;
3763 |
3764 {| bgcolor=#ABCDEF border=2
3765 |nested
3766 |-
3767 |table
3768 |}
3769 |the original table again
3770 |}
3771 !! result
3772 <table border="1">
3773 <tr>
3774 <td> &#945;
3775 </td>
3776 <td>
3777 <table bgcolor="#ABCDEF" border="2">
3778 <tr>
3779 <td>nested
3780 </td></tr>
3781 <tr>
3782 <td>table
3783 </td></tr></table>
3784 </td>
3785 <td>the original table again
3786 </td></tr></table>
3787
3788 !! end
3789
3790 !! test
3791 Invalid attributes in table cell (bug 1830)
3792 !! input
3793 {|
3794 |Cell:|broken
3795 |}
3796 !! result
3797 <table>
3798 <tr>
3799 <td>broken
3800 </td></tr></table>
3801
3802 !! end
3803
3804
3805 !! test
3806 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3807 !! input
3808 {|
3809 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3810 !! result
3811 <table>
3812 <tr>
3813 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3814 <td>]" onmouseover="alert(document.cookie)"&gt;test
3815 </td>
3816 </tr>
3817 </table>
3818
3819 !! end
3820
3821
3822 !! test
3823 Indented table markup mixed with indented pre content (proposed in bug 6200)
3824 !! input
3825 <table>
3826 <tr>
3827 <td>
3828 Text that should be rendered preformatted
3829 </td>
3830 </tr>
3831 </table>
3832 !! result
3833 <table>
3834 <tr>
3835 <td>
3836 <pre>Text that should be rendered preformatted
3837 </pre>
3838 </td>
3839 </tr>
3840 </table>
3841
3842 !! end
3843
3844 !! test
3845 Template-generated table cell attributes and cell content
3846 !! input
3847 {|
3848 |{{table_attribs}}
3849 |}
3850 !! result
3851 <table>
3852 <tr>
3853 <td style="color: red"> Foo
3854 </td></tr></table>
3855
3856 !! end
3857
3858 !! test
3859 Table with row followed by newlines and table heading
3860 !! input
3861 {|
3862 |-
3863
3864 ! foo
3865 |}
3866 !! result
3867 <table>
3868
3869
3870 <tr>
3871 <th> foo
3872 </th></tr></table>
3873
3874 !! end
3875
3876 !! test
3877 Table with empty line following the start tag
3878 !! input
3879 {|
3880
3881 |-
3882 | foo
3883 |}
3884 !! result
3885 <table>
3886
3887
3888 <tr>
3889 <td> foo
3890 </td></tr></table>
3891
3892 !! end
3893
3894 # FIXME: Preserve the attribute properly (with an empty string as value) in
3895 # the PHP parser. Parsoid implements the behavior below.
3896 !! test
3897 Table attributes with empty value
3898 !! options
3899 parsoid
3900 !! input
3901 {|
3902 | style=| hello
3903 |}
3904 !! result
3905 <table>
3906 <tbody>
3907 <tr>
3908 <td style=""> hello
3909 </td></tr></tbody></table>
3910
3911 !! end
3912
3913 !! test
3914 Wikitext table with a lot of comments
3915 !! input
3916 {|
3917 <!-- c0 -->
3918 | foo
3919 <!-- c1 -->
3920 |- <!-- c2 -->
3921 <!-- c3 -->
3922 |<!-- c4 -->
3923 <!-- c5 -->
3924 |}
3925 !! result
3926 <table>
3927 <tr>
3928 <td> foo
3929 </td></tr>
3930 <tr>
3931 <td>
3932 </td></tr></table>
3933
3934 !! end
3935
3936 !! test
3937 Wikitext table with double-line table cell
3938 !! input
3939 {|
3940 |a
3941 b
3942 |}
3943 !! result
3944 <table>
3945 <tr>
3946 <td>a
3947 <p>b
3948 </p>
3949 </td></tr></table>
3950
3951 !! end
3952
3953 !! test
3954 Table cell with a single comment
3955 !! input
3956 {|
3957 | <!-- c1 -->
3958 | a
3959 |}
3960 !! result
3961 <table>
3962 <tr>
3963 <td>
3964 </td>
3965 <td> a
3966 </td></tr></table>
3967
3968 !! end
3969
3970 # The expected HTML structure in this test is debatable. The PHP parser does
3971 # not parse this kind of table at all. The main focus for Parsoid is on
3972 # round-tripping, so this output is ok for now. TODO: revisit!
3973 !! test
3974 Wikitext table with html-syntax row (Parsoid)
3975 !! options
3976 parsoid
3977 !! input
3978 {|
3979 |-
3980 <td>foo</td>
3981 |}
3982 !! result
3983 <table>
3984 <tbody>
3985 <tr>
3986 <td>foo</td></tr></tbody></table>
3987 !! end
3988
3989 !! test
3990 Implicit <td> after a |-
3991 (PHP parser relies on Tidy to add the missing <td> tags)
3992 !! options
3993 parsoid=wt2html,wt2wt
3994 !! input
3995 {|
3996 |-
3997 a
3998 |}
3999 !! result
4000 <table>
4001 <tr><td>a</td></tr>
4002 </table>
4003 !! end
4004
4005 !! test
4006 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4007 (PHP parser relies on Tidy to add the missing <td> tags)
4008 !! options
4009 parsoid=wt2html,wt2wt
4010 !! input
4011 {|
4012 |-
4013 |
4014 a
4015 |-
4016 b
4017 |}
4018 !! result
4019 <table>
4020 <tbody>
4021 <tr><td><pre>a</pre></td></tr>
4022 <tr><td> b</td></tr>
4023 </tbody>
4024 </table>
4025 !! end
4026
4027 !! test
4028 Lists should be recognized in an implicit <td> context
4029 (PHP parser relies on Tidy to add the missing <td> tags)
4030 !! options
4031 parsoid=wt2html,wt2wt
4032 !! input
4033 {|
4034 |-
4035 *a
4036 |}
4037 !! result
4038 <table>
4039 <tr>
4040 <td><ul><li>a</li></ul></td>
4041 </tr>
4042 </table>
4043 !! end
4044
4045 ###
4046 ### Internal links
4047 ###
4048 !! test
4049 Plain link, capitalized
4050 !! input
4051 [[Main Page]]
4052 !! result
4053 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4054 </p>
4055 !! end
4056
4057 !! test
4058 Plain link, uncapitalized
4059 !! input
4060 [[main Page]]
4061 !! result
4062 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4063 </p>
4064 !! end
4065
4066 !! test
4067 Piped link
4068 !! input
4069 [[Main Page|The Main Page]]
4070 !! result
4071 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4072 </p>
4073 !! end
4074
4075 !! test
4076 Piped link with comment in link text
4077 !! input
4078 [[Main Page|The Main<!--front--> Page]]
4079 !! result
4080 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4081 </p>
4082 !! end
4083
4084 !! test
4085 Broken link
4086 !! input
4087 [[Zigzagzogzagzig]]
4088 !! result
4089 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4090 </p>
4091 !! end
4092
4093 !! test
4094 Broken link with fragment
4095 !! input
4096 [[Zigzagzogzagzig#zug]]
4097 !! result
4098 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4099 </p>
4100 !! end
4101
4102 !! test
4103 Special page link with fragment
4104 !! input
4105 [[Special:Version#anchor]]
4106 !! result
4107 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4108 </p>
4109 !! end
4110
4111 !! test
4112 Nonexistent special page link with fragment
4113 !! input
4114 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4115 !! result
4116 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4117 </p>
4118 !! end
4119
4120 !! test
4121 Link with prefix
4122 !! input
4123 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4124 !! result
4125 <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>
4126 </p>
4127 !! end
4128
4129 !! test
4130 Link with suffix
4131 !! input
4132 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4133 !! result
4134 <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>!!!
4135 </p>
4136 !! end
4137
4138 !! article
4139 prefixed article
4140 !! text
4141 Some text
4142 !! endarticle
4143
4144 !! test
4145 Bug 43661: Piped links with identical prefixes
4146 !! input
4147 [[prefixed article|prefixed articles with spaces]]
4148
4149 [[prefixed article|prefixed articlesaoeu]]
4150
4151 [[Main Page|Main Page test]]
4152 !! result
4153 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4154 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4155 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4156 </p>
4157 !! end
4158
4159
4160 !! test
4161 Link with HTML entity in suffix / tail
4162 !! input
4163 [[Main Page]]&quot;, [[Main Page]]&#97;
4164 !! result
4165 <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;
4166 </p>
4167 !! end
4168
4169 !! test
4170 Link with 3 brackets
4171 !! input
4172 [[[main page]]]
4173 !! result
4174 <p>[[[main page]]]
4175 </p>
4176 !! end
4177
4178 !! test
4179 Piped link with 3 brackets
4180 !! input
4181 [[[main page|the main page]]]
4182 !! result
4183 <p>[[[main page|the main page]]]
4184 </p>
4185 !! end
4186
4187 !! test
4188 Link with multiple pipes
4189 !! input
4190 [[Main Page|The|Main|Page]]
4191 !! result
4192 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4193 </p>
4194 !! end
4195
4196 !! test
4197 Link to namespaces
4198 !! input
4199 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4200 !! result
4201 <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>
4202 </p>
4203 !! end
4204
4205 !! test
4206 Piped link to namespace
4207 !! input
4208 [[Meta:Disclaimers|The disclaimers]]
4209 !! result
4210 <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>
4211 </p>
4212 !! end
4213
4214 !! test
4215 Link containing }
4216 !! input
4217 [[Usually caused by a typo (oops}]]
4218 !! result
4219 <p>[[Usually caused by a typo (oops}]]
4220 </p>
4221 !! end
4222
4223 !! test
4224 Link containing % (not as a hex sequence)
4225 !! input
4226 [[7% Solution]]
4227 !! result
4228 <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>
4229 </p>
4230 !! end
4231
4232 !! test
4233 Link containing % as a single hex sequence interpreted to char
4234 !! input
4235 [[7%25 Solution]]
4236 !! result
4237 <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>
4238 </p>
4239 !!end
4240
4241 !! test
4242 Link containing % as a double hex sequence interpreted to hex sequence
4243 !! input
4244 [[7%2525 Solution]]
4245 !! result
4246 <p>[[7%2525 Solution]]
4247 </p>
4248 !!end
4249
4250 !! test
4251 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4252 Example for such a section: == < ==
4253 !! input
4254 [[%23%3c]][[%23%3e]]
4255 !! result
4256 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4257 </p>
4258 !! end
4259
4260 !! test
4261 Link containing "<#" and ">#" as a hex sequences
4262 !! input
4263 [[%3c%23]][[%3e%23]]
4264 !! result
4265 <p>[[%3c%23]][[%3e%23]]
4266 </p>
4267 !! end
4268
4269 !! test
4270 Link containing an equals sign
4271 !! input
4272 [[Special:BookSources/isbn=4-00-026157-6]]
4273 !! result
4274 <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>
4275 </p>
4276 !! end
4277
4278 !! article
4279 Foo~bar
4280 !! text
4281 Just a test of an article title containing a tilde.
4282 !! endarticle
4283
4284 # note that links containing signatures, like [[Foo~~~~]], are
4285 # massaged by the pre-save transform (PST) and so the tildes are never
4286 # seen by the parser.
4287 !! test
4288 Link containing a tilde
4289 !! input
4290 [[Foo~bar]]
4291 !! result
4292 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4293 </p>
4294 !! end
4295
4296 !! test
4297 Link containing double-single-quotes '' (bug 4598)
4298 !! input
4299 [[Lista d''e paise d''o munno]]
4300 !! result
4301 <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>
4302 </p>
4303 !! end
4304
4305 !! test
4306 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4307 !! input
4308 Some [[Link|pretty ''italics'' and stuff]]!
4309 !! result
4310 <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>!
4311 </p>
4312 !! end
4313
4314 !! test
4315 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4316 !! input
4317 ''Some [[Link|pretty ''italics'' and stuff]]!
4318 !! result
4319 <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>
4320 </p>
4321 !! end
4322
4323 !! test
4324 Link with double quotes in title part (literal) and alternate part (interpreted)
4325 !! input
4326 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4327
4328 [[''Pentecoste'']]
4329
4330 [[''Pentecoste''|Pentecoste]]
4331
4332 [[''Pentecoste''|''Pentecoste'']]
4333 !! result
4334 <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>
4335 </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>
4336 </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>
4337 </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>
4338 </p>
4339 !! end
4340
4341 !! test
4342 Broken image links with HTML captions (bug 39700)
4343 !! input
4344 [[File:Nonexistent|<script></script>]]
4345 [[File:Nonexistent|100px|<script></script>]]
4346 [[File:Nonexistent|&lt;]]
4347 [[File:Nonexistent|a<i>b</i>c]]
4348 !! result
4349 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4350 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4351 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4352 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4353 </p>
4354 !! end
4355
4356 !! test
4357 Plain link to URL
4358 !! input
4359 [[http://www.example.com]]
4360 !! result
4361 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4362 </p>
4363 !! end
4364
4365 !! test
4366 Plain link to URL with link text
4367 !! input
4368 [[http://www.example.com Link text]]
4369 !! result
4370 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4371 </p>
4372 !! end
4373
4374 !! test
4375 Plain link to protocol-relative URL
4376 !! input
4377 [[//www.example.com]]
4378 !! result
4379 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4380 </p>
4381 !! end
4382
4383 !! test
4384 Plain link to protocol-relative URL with link text
4385 !! input
4386 [[//www.example.com Link text]]
4387 !! result
4388 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4389 </p>
4390 !! end
4391
4392 !! test
4393 Plain link to page with question mark in title
4394 !! input
4395 [[A?b]]
4396
4397 [[A?b|Baz]]
4398 !! result
4399 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4400 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4401 </p>
4402 !! end
4403
4404
4405 # I'm fairly sure the expected result here is wrong.
4406 # We want these to be URL links, not pseudo-pages with URLs for titles....
4407 # However the current output is also pretty screwy.
4408 #
4409 # ----
4410 # I'm changing it to match the current output--it arguably makes more
4411 # sense in the light of the test above. Old expected result was:
4412 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4413 #</p>
4414 # But I think this test is bordering on "garbage in, garbage out" anyway.
4415 # -- wtm
4416 !! test
4417 Piped link to URL
4418 !! input
4419 Piped link to URL: [[http://www.example.com|an example URL]]
4420 !! result
4421 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4422 </p>
4423 !! end
4424
4425 !! test
4426 BUG 2: [[page|http://url/]] should link to page, not http://url/
4427 !! input
4428 [[Main Page|http://url/]]
4429 !! result
4430 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4431 </p>
4432 !! end
4433
4434 !! test
4435 BUG 337: Escaped self-links should be bold
4436 !! options
4437 title=[[Bug462]]
4438 !! input
4439 [[Bu&#103;462]] [[Bug462]]
4440 !! result
4441 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4442 </p>
4443 !! end
4444
4445 !! test
4446 Self-link to section should not be bold
4447 !! options
4448 title=[[Main Page]]
4449 !! input
4450 [[Main Page#section]]
4451 !! result
4452 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4453 </p>
4454 !! end
4455
4456 !! article
4457 00
4458 !! text
4459 This is 00.
4460 !! endarticle
4461
4462 !!test
4463 Self-link to numeric title
4464 !!options
4465 title=[[0]]
4466 !!input
4467 [[0]]
4468 !!result
4469 <p><strong class="selflink">0</strong>
4470 </p>
4471 !!end
4472
4473 !!test
4474 Link to numeric-equivalent title
4475 !!options
4476 title=[[0]]
4477 !!input
4478 [[00]]
4479 !!result
4480 <p><a href="/wiki/00" title="00">00</a>
4481 </p>
4482 !!end
4483
4484 !! test
4485 <nowiki> inside a link
4486 !! input
4487 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4488 !! result
4489 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4490 </p>
4491 !! end
4492
4493 !! test
4494 Non-breaking spaces in title
4495 !! input
4496 [[&nbsp; Main &nbsp; Page &nbsp;]]
4497 !! result
4498 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4499 </p>
4500 !!end
4501
4502 !! test
4503 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4504 !! options
4505 language=ca
4506 !! input
4507 '''[[Main Page]]'''
4508 !! result
4509 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4510 </p>
4511 !! end
4512
4513 !! test
4514 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4515 !! options
4516 language=ca
4517 !! input
4518 ''[[Main Page]]''
4519 !! result
4520 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4521 </p>
4522 !! end
4523
4524 !! test
4525 Internal link with en linktrail: no apostrophes (bug 27473)
4526 !! options
4527 language=en
4528 !! input
4529 [[Something]]'nice
4530 !! result
4531 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4532 </p>
4533 !! end
4534
4535 !! test
4536 Internal link with ca linktrail with apostrophes (bug 27473)
4537 !! options
4538 language=ca
4539 !! input
4540 [[Something]]'nice
4541 !! result
4542 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4543 </p>
4544 !! end
4545
4546 !! test
4547 Internal link with kaa linktrail with apostrophes (bug 27473)
4548 !! options
4549 language=kaa
4550 !! input
4551 [[Something]]'nice
4552 !! result
4553 <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>
4554 </p>
4555 !! end
4556
4557 !! article
4558 Söfnuður
4559 !! text
4560 Test.
4561 !! endarticle
4562
4563 !! test
4564 Internal link with is link prefix
4565 !! options
4566 language=is
4567 !! input
4568 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4569 !! result
4570 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4571 </p>
4572 !! end
4573
4574 !! article
4575 Mótmælendatrú
4576 !! text
4577 Test.
4578 !! endarticle
4579
4580 !! test
4581 Internal link with is link trail and link prefix
4582 !! options
4583 language=is
4584 !! input
4585 [[mótmælendatrú|xxx]]ar
4586 [[mótmælendatrú]]ar
4587 mótmælenda[[söfnuður]]
4588 mótmælenda[[söfnuður|söfnuðir]]
4589 mótmælenda[[söfnuður|söfnuðir]]xxx
4590 !! result
4591 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4592 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4593 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4594 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4595 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4596 </p>
4597 !! end
4598
4599 !! test
4600 Parsoid link trail escaping
4601 !! options
4602 parsoid=html2wt,html2html
4603 !! input
4604 [[apple]]<nowiki/>s
4605 !! result
4606 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4607 !! end
4608
4609 !! test
4610 Parsoid link prefix escaping
4611 !! options
4612 language=is
4613 parsoid=html2wt,html2html
4614 !! input
4615 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4616 !! result
4617 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4618 !! end
4619
4620 !! test
4621 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4622 !! input
4623 [[Foo| bar]]
4624
4625 [[Foo| ''bar'']]
4626
4627 [http://wp.org foo]
4628
4629 [http://wp.org ''foo'']
4630 !! result
4631 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4632 </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>
4633 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4634 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4635 </p>
4636 !! end
4637
4638 ###
4639 ### Interwiki links (see maintenance/interwiki.sql)
4640 ###
4641
4642 !! test
4643 Inline interwiki link
4644 !! input
4645 [[MeatBall:SoftSecurity]]
4646 !! result
4647 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4648 </p>
4649 !! end
4650
4651 !! test
4652 Inline interwiki link with empty title (bug 2372)
4653 !! input
4654 [[MeatBall:]]
4655 !! result
4656 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4657 </p>
4658 !! end
4659
4660 !! test
4661 Interwiki link encoding conversion (bug 1636)
4662 !! input
4663 *[[Wikipedia:ro:Olteni&#0355;a]]
4664 *[[Wikipedia:ro:Olteni&#355;a]]
4665 !! result
4666 <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>
4667 </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>
4668 </li></ul>
4669
4670 !! end
4671
4672 !! test
4673 Interwiki link with fragment (bug 2130)
4674 !! input
4675 [[MeatBall:SoftSecurity#foo]]
4676 !! result
4677 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4678 </p>
4679 !! end
4680
4681 !! test
4682 Interlanguage link
4683 !! input
4684 Blah blah blah
4685 [[zh:Chinese]]
4686 !!result
4687 <p>Blah blah blah
4688 </p>
4689 !! end
4690
4691 !! test
4692 Double interlanguage link
4693 !! input
4694 Blah blah blah
4695 [[es:Spanish]]
4696 [[zh:Chinese]]
4697 !!result
4698 <p>Blah blah blah
4699 </p>
4700 !! end
4701
4702 !! test
4703 Interlanguage link, with prefix links
4704 !! options
4705 language=ln
4706 !! input
4707 Blah blah blah
4708 [[zh:Chinese]]
4709 !!result
4710 <p>Blah blah blah
4711 </p>
4712 !! end
4713
4714 !! test
4715 Double interlanguage link, with prefix links (bug 8897)
4716 !! options
4717 language=ln
4718 !! input
4719 Blah blah blah
4720 [[es:Spanish]]
4721 [[zh:Chinese]]
4722 !!result
4723 <p>Blah blah blah
4724 </p>
4725 !! end
4726
4727 !! test
4728 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4729 !! options
4730 language=ln
4731 !! input
4732 [[WW&nbsp;II]]
4733 !!result
4734 <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>
4735 </p>
4736 !! end
4737
4738 !! test
4739 Parsoid: handle constructor well
4740 !! options
4741 parsoid
4742 !! input
4743 [[constructor]]
4744
4745 [[constructor:foo]]
4746 !! result
4747 <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>
4748
4749
4750 <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>
4751 !! end
4752
4753 ##
4754 ## Redirects, Parsoid-only
4755 ##
4756 !! test
4757 Simple redirect to page
4758 !! options
4759 parsoid
4760 !! input
4761 #REDIRECT [[Main Page]]
4762 !! result
4763 <link rel="mw:PageProp/redirect" href="./Main_Page">
4764 !! end
4765
4766 !! test
4767 Redirect to category
4768 !! options
4769 parsoid=wt2html
4770 !! input
4771 #REDIRECT [[Category:Foo]]
4772 !! result
4773 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
4774 !! end
4775
4776 !! test
4777 Redirect to category page
4778 !! options
4779 parsoid=wt2html,html2html
4780 !! input
4781 #REDIRECT [[:Category:Foo]]
4782 !! result
4783 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
4784 !! end
4785
4786 !! test
4787 Redirect to image page
4788 !! options
4789 parsoid
4790 !! input
4791 #REDIRECT [[File:Wiki.png]]
4792 !! result
4793 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
4794 !! end
4795
4796 !! test
4797 Redirect to language
4798 !! options
4799 parsoid
4800 !! input
4801 #REDIRECT [[en:File:Wiki.png]]
4802 !! result
4803 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4804 !! end
4805
4806 !! test
4807 Redirect to interwiki
4808 !! options
4809 parsoid
4810 !! input
4811 #REDIRECT [[meatball:File:Wiki.png]]
4812 !! result
4813 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4814 !! end
4815
4816 ##
4817 ## XHTML tidiness
4818 ###
4819
4820 !! test
4821 <br> to <br />
4822 !! input
4823 1<br>2<br />3
4824 !! result
4825 <p>1<br />2<br />3
4826 </p>
4827 !! end
4828
4829 !! test
4830 Broken br tag sanitization
4831 !! options
4832 php
4833 !! input
4834 </br>
4835 !! result
4836 <p>&lt;/br&gt;
4837 </p>
4838 !! end
4839
4840 # TODO: Fix html2html mode (bug 51055)!
4841 !! test
4842 Parsoid: Broken br tag recognition
4843 !! options
4844 parsoid=wt2html
4845 !! input
4846 </br>
4847 !! result
4848 <p><br></p>
4849 !! end
4850
4851 !! test
4852 Incorrecly removing closing slashes from correctly formed XHTML
4853 !! input
4854 <br style="clear:both;" />
4855 !! result
4856 <p><br style="clear:both;" />
4857 </p>
4858 !! end
4859
4860 !! test
4861 Failing to transform badly formed HTML into correct XHTML
4862 !! input
4863 <br style="clear: left;">
4864 <br style="clear: right;">
4865 <br style="clear: both;">
4866 !! result
4867 <p><br style="clear: left;" />
4868 <br style="clear: right;" />
4869 <br style="clear: both;" />
4870 </p>
4871 !!end
4872
4873 !! test
4874 Handling html with a div self-closing tag
4875 !! input
4876 <div title />
4877 <div title/>
4878 <div title/ >
4879 <div title=bar />
4880 <div title=bar/>
4881 <div title=bar/ >
4882 !! result
4883 <p>&lt;div title /&gt;
4884 &lt;div title/&gt;
4885 </p>
4886 <div>
4887 <p>&lt;div title=bar /&gt;
4888 &lt;div title=bar/&gt;
4889 </p>
4890 <div title="bar/"></div>
4891 </div>
4892
4893 !! end
4894
4895 !! test
4896 Handling html with a br self-closing tag
4897 !! input
4898 <br title />
4899 <br title/>
4900 <br title/ >
4901 <br title=bar />
4902 <br title=bar/>
4903 <br title=bar/ >
4904 !! result
4905 <p><br title="title" />
4906 <br title="title" />
4907 <br />
4908 <br title="bar" />
4909 <br title="bar" />
4910 <br title="bar/" />
4911 </p>
4912 !! end
4913
4914 !! test
4915 Horizontal ruler (should it add that extra space?)
4916 !! input
4917 <hr>
4918 <hr >
4919 foo <hr
4920 > bar
4921 !! result
4922 <hr />
4923 <hr />
4924 foo <hr /> bar
4925
4926 !! end
4927
4928 !! test
4929 Horizontal ruler -- 4+ dashes render hr
4930 !! input
4931 ----
4932 !! result
4933 <hr />
4934
4935 !! end
4936
4937 !! test
4938 Horizontal ruler -- eats additional dashes on the same line
4939 !! input
4940 ---------
4941 !! result
4942 <hr />
4943
4944 !! end
4945
4946 !! test
4947 Horizontal ruler -- does not collapse dashes on consecutive lines
4948 !! input
4949 ----
4950 ----
4951 !! result
4952 <hr />
4953 <hr />
4954
4955 !! end
4956
4957 !! test
4958 Horizontal ruler -- <4 dashes render as plain text
4959 !! input
4960 ---
4961 !! result
4962 <p>---
4963 </p>
4964 !! end
4965
4966 !! test
4967 Horizontal ruler -- Supports content following dashes on same line
4968 !! input
4969 ---- Foo
4970 !! result
4971 <hr /> Foo
4972
4973 !! end
4974
4975 ###
4976 ### Block-level elements
4977 ###
4978 !! test
4979 Common list
4980 !! input
4981 *Common list
4982 * item 2
4983 *item 3
4984 !! result
4985 <ul><li>Common list
4986 </li><li> item 2
4987 </li><li>item 3
4988 </li></ul>
4989
4990 !! end
4991
4992 !! test
4993 Numbered list
4994 !! input
4995 #Numbered list
4996 #item 2
4997 # item 3
4998 !! result
4999 <ol><li>Numbered list
5000 </li><li>item 2
5001 </li><li> item 3
5002 </li></ol>
5003
5004 !! end
5005
5006 !! test
5007 Mixed list
5008 !! input
5009 *Mixed list
5010 *# with numbers
5011 ** and bullets
5012 *# and numbers
5013 *bullets again
5014 **bullet level 2
5015 ***bullet level 3
5016 ***#Number on level 4
5017 **bullet level 2
5018 **#Number on level 3
5019 **#Number on level 3
5020 *#number level 2
5021 *Level 1
5022 *** Level 3
5023 #** Level 3, but ordered
5024 !! result
5025 <ul><li>Mixed list
5026 <ol><li> with numbers
5027 </li></ol>
5028 <ul><li> and bullets
5029 </li></ul>
5030 <ol><li> and numbers
5031 </li></ol>
5032 </li><li>bullets again
5033 <ul><li>bullet level 2
5034 <ul><li>bullet level 3
5035 <ol><li>Number on level 4
5036 </li></ol>
5037 </li></ul>
5038 </li><li>bullet level 2
5039 <ol><li>Number on level 3
5040 </li><li>Number on level 3
5041 </li></ol>
5042 </li></ul>
5043 <ol><li>number level 2
5044 </li></ol>
5045 </li><li>Level 1
5046 <ul><li><ul><li> Level 3
5047 </li></ul>
5048 </li></ul>
5049 </li></ul>
5050 <ol><li><ul><li><ul><li> Level 3, but ordered
5051 </li></ul>
5052 </li></ul>
5053 </li></ol>
5054
5055 !! end
5056
5057 !! test
5058 Nested lists 1
5059 !! input
5060 *foo
5061 **bar
5062 !! result
5063 <ul><li>foo
5064 <ul><li>bar
5065 </li></ul>
5066 </li></ul>
5067
5068 !! end
5069
5070 !! test
5071 Nested lists 2
5072 !! input
5073 **foo
5074 *bar
5075 !! result
5076 <ul><li><ul><li>foo
5077 </li></ul>
5078 </li><li>bar
5079 </li></ul>
5080
5081 !! end
5082
5083 !! test
5084 Nested lists 3 (first element empty)
5085 !! input
5086 *
5087 **bar
5088 !! result
5089 <ul><li>
5090 <ul><li>bar
5091 </li></ul>
5092 </li></ul>
5093
5094 !! end
5095
5096 !! test
5097 Nested lists 4 (first element empty)
5098 !! input
5099 **
5100 *bar
5101 !! result
5102 <ul><li><ul><li>
5103 </li></ul>
5104 </li><li>bar
5105 </li></ul>
5106
5107 !! end
5108
5109 !! test
5110 Nested lists 5 (both elements empty)
5111 !! input
5112 **
5113 *
5114 !! result
5115 <ul><li><ul><li>
5116 </li></ul>
5117 </li><li>
5118 </li></ul>
5119
5120 !! end
5121
5122 !! test
5123 Nested lists 6 (both elements empty)
5124 !! input
5125 *
5126 **
5127 !! result
5128 <ul><li>
5129 <ul><li>
5130 </li></ul>
5131 </li></ul>
5132
5133 !! end
5134
5135 !! test
5136 Nested lists 7 (skip initial nesting levels)
5137 !! input
5138 *** foo
5139 !! result
5140 <ul><li><ul><li><ul><li> foo
5141 </li></ul>
5142 </li></ul>
5143 </li></ul>
5144
5145 !! end
5146
5147 !! test
5148 Nested lists 8 (multiple nesting transitions)
5149 !! input
5150 * foo
5151 *** bar
5152 ** baz
5153 * boo
5154 !! result
5155 <ul><li> foo
5156 <ul><li><ul><li> bar
5157 </li></ul>
5158 </li><li> baz
5159 </li></ul>
5160 </li><li> boo
5161 </li></ul>
5162
5163 !! end
5164
5165 !! test
5166 1. Lists with start-of-line-transparent tokens before bullets: Comments
5167 !! input
5168 *foo
5169 *<!--cmt-->bar
5170 <!--cmt-->*baz
5171 !! result
5172 <ul><li>foo
5173 </li><li>bar
5174 </li><li>baz
5175 </li></ul>
5176
5177 !! end
5178
5179 !! test
5180 2. Lists with start-of-line-transparent tokens before bullets: Template close
5181 !! input
5182 *foo {{echo|bar
5183 }}*baz
5184 !! result
5185 <ul><li>foo bar
5186 </li><li>baz
5187 </li></ul>
5188
5189 !! end
5190
5191 !! test
5192 List items are not parsed correctly following a <pre> block (bug 785)
5193 !! input
5194 * <pre>foo</pre>
5195 * <pre>bar</pre>
5196 * zar
5197 !! result
5198 <ul><li> <pre>foo</pre>
5199 </li><li> <pre>bar</pre>
5200 </li><li> zar
5201 </li></ul>
5202
5203 !! end
5204
5205 !! test
5206 List items from template
5207 !! input
5208
5209 {{inner list}}
5210 * item 2
5211
5212 * item 0
5213 {{inner list}}
5214 * item 2
5215
5216 * item 0
5217 * notSOL{{inner list}}
5218 * item 2
5219 !! result
5220 <ul><li> item 1
5221 </li><li> item 2
5222 </li></ul>
5223 <ul><li> item 0
5224 </li><li> item 1
5225 </li><li> item 2
5226 </li></ul>
5227 <ul><li> item 0
5228 </li><li> notSOL
5229 </li><li> item 1
5230 </li><li> item 2
5231 </li></ul>
5232
5233 !! end
5234
5235 !! test
5236 List interrupted by empty line or heading
5237 !! input
5238 * foo
5239
5240 ** bar
5241 == A heading ==
5242 * Another list item
5243 !! result
5244 <ul><li> foo
5245 </li></ul>
5246 <ul><li><ul><li> bar
5247 </li></ul>
5248 </li></ul>
5249 <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>
5250 <ul><li> Another list item
5251 </li></ul>
5252
5253 !!end
5254
5255 !!test
5256 Multiple list tags generated by templates
5257 !!input
5258 {{echo|<li>}}a
5259 {{echo|<li>}}b
5260 {{echo|<li>}}c
5261 !!result
5262 <li>a
5263 <li>b
5264 <li>c</li>
5265 </li>
5266 </li>
5267
5268 !!end
5269
5270 !!test
5271 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
5272 !!input
5273 *a
5274 <!--This line will NOT split the list-->
5275 *b
5276 <!--This line will NOT split the list either-->
5277 *c
5278 <!--foo--> <!--This line with more than 1 comment will split the list-->
5279 *d
5280 !!result
5281 <ul><li>a
5282 </li><li>b
5283 </li><li>c
5284 </li></ul>
5285 <ul><li>d
5286 </li></ul>
5287
5288 !!end
5289
5290 !!test
5291 Test the li-hack
5292 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5293 !!options
5294 parsoid=wt2html,wt2wt
5295 !!input
5296 * foo
5297 * <li>li-hack
5298 * {{echo|<li>templated li-hack}}
5299 * <!--foo--> <li> unsupported li-hack with preceding comments
5300
5301 <ul>
5302 <li><li>not a li-hack
5303 </li>
5304 </ul>
5305 !!result
5306 <ul><li> foo</li>
5307 <li>li-hack</li>
5308 <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>
5309 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5310
5311 <ul>
5312 <li></li><li>not a li-hack
5313 </li>
5314 </ul>
5315 !!end
5316
5317 !! test
5318 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5319 !! options
5320 parsoid
5321 !! input
5322 # foo
5323 ## bar
5324 * foo
5325 ** bar
5326 : foo
5327 :: bar
5328 !! result
5329 <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>
5330 !! end
5331
5332 # ------------------------------------------------------------------------
5333 # The next set of tests are about Parsoid's ability to handle badly nested
5334 # tags (parse, minimize scope of fixup, and roundtrip back)
5335 # ------------------------------------------------------------------------
5336
5337 !! test
5338 Unbalanced closing block tags break a list
5339 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5340 !! options
5341 parsoid
5342 !! input
5343 <div>
5344 *a</div><div>
5345 *b</div>
5346 !! result
5347 <div>
5348 <ul><li>a
5349 </li></ul></div><div>
5350 <ul><li>b
5351 </li></ul></div>
5352 !! end
5353
5354 !! test
5355 Unbalanced closing non-block tags don't break a list
5356 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5357 !! options
5358 parsoid
5359 !! input
5360 <span>
5361 *a</span><span>
5362 *b</span>
5363 !! result
5364 <p><span></span>
5365 </p>
5366 <ul><li>a<span></span>
5367 </li><li>b
5368 </li></ul>
5369 !! end
5370
5371 !! test
5372 Unclosed formatting tags that straddle lists are closed and reopened
5373 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5374 !! options
5375 parsoid
5376 !! input
5377 # <s> a
5378 # b </s>
5379 !! result
5380 <ol><li> <s> a </s>
5381 </li><li> <s> b </s>
5382 </li></ol>
5383 !! end
5384
5385 !!test
5386 List embedded in a non-block tag
5387 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5388 !! options
5389 parsoid
5390 !!input
5391 <small>
5392 * foo
5393 </small>
5394 !!result
5395 <p><small></small></p>
5396 <small>
5397 <ul>
5398 <li> foo</li>
5399 </ul>
5400 </small>
5401 <p><small></small></p>
5402 !!end
5403
5404 ###
5405 ### Magic Words
5406 ###
5407
5408 !! test
5409 Magic Word: {{CURRENTDAY}}
5410 !! input
5411 {{CURRENTDAY}}
5412 !! result
5413 <p>1
5414 </p>
5415 !! end
5416
5417 !! test
5418 Magic Word: {{CURRENTDAY2}}
5419 !! input
5420 {{CURRENTDAY2}}
5421 !! result
5422 <p>01
5423 </p>
5424 !! end
5425
5426 !! test
5427 Magic Word: {{CURRENTDAYNAME}}
5428 !! input
5429 {{CURRENTDAYNAME}}
5430 !! result
5431 <p>Thursday
5432 </p>
5433 !! end
5434
5435 !! test
5436 Magic Word: {{CURRENTDOW}}
5437 !! input
5438 {{CURRENTDOW}}
5439 !! result
5440 <p>4
5441 </p>
5442 !! end
5443
5444 !! test
5445 Magic Word: {{CURRENTMONTH}}
5446 !! input
5447 {{CURRENTMONTH}}
5448 !! result
5449 <p>01
5450 </p>
5451 !! end
5452
5453 !! test
5454 Magic Word: {{CURRENTMONTHABBREV}}
5455 !! input
5456 {{CURRENTMONTHABBREV}}
5457 !! result
5458 <p>Jan
5459 </p>
5460 !! end
5461
5462 !! test
5463 Magic Word: {{CURRENTMONTHNAME}}
5464 !! input
5465 {{CURRENTMONTHNAME}}
5466 !! result
5467 <p>January
5468 </p>
5469 !! end
5470
5471 !! test
5472 Magic Word: {{CURRENTMONTHNAMEGEN}}
5473 !! input
5474 {{CURRENTMONTHNAMEGEN}}
5475 !! result
5476 <p>January
5477 </p>
5478 !! end
5479
5480 !! test
5481 Magic Word: {{CURRENTTIME}}
5482 !! input
5483 {{CURRENTTIME}}
5484 !! result
5485 <p>00:02
5486 </p>
5487 !! end
5488
5489 !! test
5490 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5491 !! input
5492 {{CURRENTWEEK}}
5493 !! result
5494 <p>1
5495 </p>
5496 !! end
5497
5498 !! test
5499 Magic Word: {{CURRENTYEAR}}
5500 !! input
5501 {{CURRENTYEAR}}
5502 !! result
5503 <p>1970
5504 </p>
5505 !! end
5506
5507 !! test
5508 Magic Word: {{FULLPAGENAME}}
5509 !! options
5510 title=[[User:Ævar Arnfjörð Bjarmason]]
5511 !! input
5512 {{FULLPAGENAME}}
5513 !! result
5514 <p>User:Ævar Arnfjörð Bjarmason
5515 </p>
5516 !! end
5517
5518 !! test
5519 Magic Word: {{FULLPAGENAMEE}}
5520 !! options
5521 title=[[User:Ævar Arnfjörð Bjarmason]]
5522 !! input
5523 {{FULLPAGENAMEE}}
5524 !! result
5525 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5526 </p>
5527 !! end
5528
5529 !! test
5530 Magic Word: {{NAMESPACE}}
5531 !! options
5532 title=[[User:Ævar Arnfjörð Bjarmason]]
5533 !! input
5534 {{NAMESPACE}}
5535 !! result
5536 <p>User
5537 </p>
5538 !! end
5539
5540 !! test
5541 Magic Word: {{NAMESPACEE}}
5542 !! options
5543 title=[[User:Ævar Arnfjörð Bjarmason]]
5544 !! input
5545 {{NAMESPACEE}}
5546 !! result
5547 <p>User
5548 </p>
5549 !! end
5550
5551 !! test
5552 Magic Word: {{NAMESPACENUMBER}}
5553 !! options
5554 title=[[User:Ævar Arnfjörð Bjarmason]]
5555 !! input
5556 {{NAMESPACENUMBER}}
5557 !! result
5558 <p>2
5559 </p>
5560 !! end
5561
5562 !! test
5563 Magic Word: {{NUMBEROFFILES}}
5564 !! input
5565 {{NUMBEROFFILES}}
5566 !! result
5567 <p>4
5568 </p>
5569 !! end
5570
5571 !! test
5572 Magic Word: {{PAGENAME}}
5573 !! options
5574 title=[[User:Ævar Arnfjörð Bjarmason]]
5575 !! input
5576 {{PAGENAME}}
5577 !! result
5578 <p>Ævar Arnfjörð Bjarmason
5579 </p>
5580 !! end
5581
5582 !! test
5583 Magic Word: {{PAGENAME}} with metacharacters
5584 !! options
5585 title=[['foo & bar = baz']]
5586 !! input
5587 ''{{PAGENAME}}''
5588 !! result
5589 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5590 </p>
5591 !! end
5592
5593 !! test
5594 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5595 !! options
5596 title=[[*RFC 1234 http://example.com/]]
5597 !! input
5598 {{PAGENAME}}
5599 !! result
5600 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5601 </p>
5602 !! end
5603
5604 !! test
5605 Magic Word: {{PAGENAMEE}}
5606 !! options
5607 title=[[User:Ævar Arnfjörð Bjarmason]]
5608 !! input
5609 {{PAGENAMEE}}
5610 !! result
5611 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5612 </p>
5613 !! end
5614
5615 !! test
5616 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5617 !! options
5618 title=[[*RFC 1234 http://example.com/]]
5619 !! input
5620 {{PAGENAMEE}}
5621 !! result
5622 <p>&#42;RFC_1234_http&#58;//example.com/
5623 </p>
5624 !! end
5625
5626 !! test
5627 Magic Word: {{REVISIONID}}
5628 !! input
5629 {{REVISIONID}}
5630 !! result
5631 <p>1337
5632 </p>
5633 !! end
5634
5635 !! test
5636 Magic Word: {{SCRIPTPATH}}
5637 !! input
5638 {{SCRIPTPATH}}
5639 !! result
5640 <p>/
5641 </p>
5642 !! end
5643
5644 !! test
5645 Magic Word: {{SERVER}}
5646 !! input
5647 {{SERVER}}
5648 !! result
5649 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5650 </p>
5651 !! end
5652
5653 !! test
5654 Magic Word: {{SERVERNAME}}
5655 !! input
5656 {{SERVERNAME}}
5657 !! result
5658 <p>example.org
5659 </p>
5660 !! end
5661
5662 !! test
5663 Magic Word: {{SITENAME}}
5664 !! input
5665 {{SITENAME}}
5666 !! result
5667 <p>MediaWiki
5668 </p>
5669 !! end
5670
5671 !! test
5672 Case-sensitive magic words, when cased differently, should just be template transclusions
5673 !! input
5674 {{CurrentMonth}}
5675 {{currentday}}
5676 {{cURreNTweEK}}
5677 {{currentHour}}
5678 !! result
5679 <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>
5680 <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>
5681 <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>
5682 <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>
5683 </p>
5684 !! end
5685
5686 !! test
5687 Case-insensitive magic words should still work with weird casing.
5688 !! input
5689 {{sErVeRNaMe}}
5690 {{LCFirst:AOEU}}
5691 {{ucFIRST:aoeu}}
5692 {{SERver}}
5693 !! result
5694 <p>example.org
5695 aOEU
5696 Aoeu
5697 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5698 </p>
5699 !! end
5700
5701 !! test
5702 Namespace 1 {{ns:1}}
5703 !! input
5704 {{ns:1}}
5705 !! result
5706 <p>Talk
5707 </p>
5708 !! end
5709
5710 !! test
5711 Namespace 1 {{ns:01}}
5712 !! input
5713 {{ns:01}}
5714 !! result
5715 <p>Talk
5716 </p>
5717 !! end
5718
5719 !! test
5720 Namespace 0 {{ns:0}} (bug 4783)
5721 !! input
5722 {{ns:0}}
5723 !! result
5724
5725 !! end
5726
5727 !! test
5728 Namespace 0 {{ns:00}} (bug 4783)
5729 !! input
5730 {{ns:00}}
5731 !! result
5732
5733 !! end
5734
5735 !! test
5736 Namespace -1 {{ns:-1}}
5737 !! input
5738 {{ns:-1}}
5739 !! result
5740 <p>Special
5741 </p>
5742 !! end
5743
5744 !! test
5745 Namespace User {{ns:User}}
5746 !! input
5747 {{ns:User}}
5748 !! result
5749 <p>User
5750 </p>
5751 !! end
5752
5753 !! test
5754 Namespace User talk {{ns:User_talk}}
5755 !! input
5756 {{ns:User_talk}}
5757 !! result
5758 <p>User talk
5759 </p>
5760 !! end
5761
5762 !! test
5763 Namespace User talk {{ns:uSeR tAlK}}
5764 !! input
5765 {{ns:uSeR tAlK}}
5766 !! result
5767 <p>User talk
5768 </p>
5769 !! end
5770
5771 !! test
5772 Namespace File {{ns:File}}
5773 !! input
5774 {{ns:File}}
5775 !! result
5776 <p>File
5777 </p>
5778 !! end
5779
5780 !! test
5781 Namespace File {{ns:Image}}
5782 !! input
5783 {{ns:Image}}
5784 !! result
5785 <p>File
5786 </p>
5787 !! end
5788
5789 !! test
5790 Namespace (lang=de) Benutzer {{ns:User}}
5791 !! options
5792 language=de
5793 !! input
5794 {{ns:User}}
5795 !! result
5796 <p>Benutzer
5797 </p>
5798 !! end
5799
5800 !! test
5801 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5802 !! options
5803 language=de
5804 !! input
5805 {{ns:3}}
5806 !! result
5807 <p>Benutzer Diskussion
5808 </p>
5809 !! end
5810
5811
5812 !! test
5813 Urlencode
5814 !! input
5815 {{urlencode:hi world?!}}
5816 {{urlencode:hi world?!|WIKI}}
5817 {{urlencode:hi world?!|PATH}}
5818 {{urlencode:hi world?!|QUERY}}
5819 !! result
5820 <p>hi+world%3F%21
5821 hi_world%3F!
5822 hi%20world%3F%21
5823 hi+world%3F%21
5824 </p>
5825 !! end
5826
5827 ###
5828 ### Magic links
5829 ###
5830 !! test
5831 Magic links: internal link to RFC (bug 479)
5832 !! input
5833 [[RFC 123]]
5834 !! result
5835 <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>
5836 </p>
5837 !! end
5838
5839 !! test
5840 Magic links: RFC (bug 479)
5841 !! input
5842 RFC 822
5843 !! result
5844 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5845 </p>
5846 !! end
5847
5848 !! test
5849 Magic links: ISBN (bug 1937)
5850 !! input
5851 ISBN 0-306-40615-2
5852 !! result
5853 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5854 </p>
5855 !! end
5856
5857 !! test
5858 Magic links: PMID incorrectly converts space to underscore
5859 !! input
5860 PMID 1234
5861 !! result
5862 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5863 </p>
5864 !! end
5865
5866 ###
5867 ### Templates
5868 ####
5869
5870 !! test
5871 Nonexistent template
5872 !! input
5873 {{thistemplatedoesnotexist}}
5874 !! result
5875 <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>
5876 </p>
5877 !! end
5878
5879 !! test
5880 Template with invalid target containing tags
5881 !! input
5882 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5883 !! result
5884 <p>{{a<b>b</b>|foo|a=b|a = b}}
5885 </p>
5886 !! end
5887
5888 !! test
5889 Template with invalid target containing unclosed tag
5890 !! input
5891 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5892 !! result
5893 <p>{{a<b>|foo|a=b|a = b}}</b>
5894 </p>
5895 !! end
5896
5897 !! article
5898 Template:test
5899 !! text
5900 This is a test template
5901 !! endarticle
5902
5903 !! test
5904 Simple template
5905 !! input
5906 {{test}}
5907 !! result
5908 <p>This is a test template
5909 </p>
5910 !! end
5911
5912 !! test
5913 Template with explicit namespace
5914 !! input
5915 {{Template:test}}
5916 !! result
5917 <p>This is a test template
5918 </p>
5919 !! end
5920
5921
5922 !! article
5923 Template:paramtest
5924 !! text
5925 This is a test template with parameter {{{param}}}
5926 !! endarticle
5927
5928 !! test
5929 Template parameter
5930 !! input
5931 {{paramtest|param=foo}}
5932 !! result
5933 <p>This is a test template with parameter foo
5934 </p>
5935 !! end
5936
5937 !! article
5938 Template:paramtestnum
5939 !! text
5940 [[{{{1}}}|{{{2}}}]]
5941 !! endarticle
5942
5943 !! test
5944 Template unnamed parameter
5945 !! input
5946 {{paramtestnum|Main Page|the main page}}
5947 !! result
5948 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5949 </p>
5950 !! end
5951
5952 !! article
5953 Template:templatesimple
5954 !! text
5955 (test)
5956 !! endarticle
5957
5958 !! article
5959 Template:templateredirect
5960 !! text
5961 #redirect [[Template:templatesimple]]
5962 !! endarticle
5963
5964 !! article
5965 Template:templateasargtestnum
5966 !! text
5967 {{{{{1}}}}}
5968 !! endarticle
5969
5970 !! article
5971 Template:templateasargtest
5972 !! text
5973 {{template{{{templ}}}}}
5974 !! endarticle
5975
5976 !! article
5977 Template:templateasargtest2
5978 !! text
5979 {{{{{templ}}}}}
5980 !! endarticle
5981
5982 !! test
5983 Template with template name as unnamed argument
5984 !! input
5985 {{templateasargtestnum|templatesimple}}
5986 !! result
5987 <p>(test)
5988 </p>
5989 !! end
5990
5991 !! test
5992 Template with template name as argument
5993 !! input
5994 {{templateasargtest|templ=simple}}
5995 !! result
5996 <p>(test)
5997 </p>
5998 !! end
5999
6000 !! test
6001 Template with template name as argument (2)
6002 !! input
6003 {{templateasargtest2|templ=templatesimple}}
6004 !! result
6005 <p>(test)
6006 </p>
6007 !! end
6008
6009 !! article
6010 Template:templateasargtestdefault
6011 !! text
6012 {{{{{templ|templatesimple}}}}}
6013 !! endarticle
6014
6015 !! article
6016 Template:templa
6017 !! text
6018 '''templ'''
6019 !! endarticle
6020
6021 !! test
6022 Template with default value
6023 !! input
6024 {{templateasargtestdefault}}
6025 !! result
6026 <p>(test)
6027 </p>
6028 !! end
6029
6030 !! test
6031 Template with default value (value set)
6032 !! input
6033 {{templateasargtestdefault|templ=templa}}
6034 !! result
6035 <p><b>templ</b>
6036 </p>
6037 !! end
6038
6039 !! test
6040 Template redirect
6041 !! input
6042 {{templateredirect}}
6043 !! result
6044 <p>(test)
6045 </p>
6046 !! end
6047
6048 !! test
6049 Template with argument in separate line
6050 !! input
6051 {{ templateasargtest |
6052 templ = simple }}
6053 !! result
6054 <p>(test)
6055 </p>
6056 !! end
6057
6058 !! test
6059 Template with complex template as argument
6060 !! input
6061 {{paramtest|
6062 param ={{ templateasargtest |
6063 templ = simple }}}}
6064 !! result
6065 <p>This is a test template with parameter (test)
6066 </p>
6067 !! end
6068
6069 !! test
6070 Template with thumb image (with link in description)
6071 !! input
6072 {{paramtest|
6073 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6074 !! result
6075 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>
6076
6077 !! end
6078
6079 !! article
6080 Template:complextemplate
6081 !! text
6082 {{{1}}} {{paramtest|
6083 param ={{{param}}}}}
6084 !! endarticle
6085
6086 !! test
6087 Template with complex arguments
6088 !! input
6089 {{complextemplate|
6090 param ={{ templateasargtest |
6091 templ = simple }}|[[Template:complextemplate|link]]}}
6092 !! result
6093 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6094 </p>
6095 !! end
6096
6097 !! test
6098 BUG 553: link with two variables in a piped link
6099 !! input
6100 {|
6101 |[[{{{1}}}|{{{2}}}]]
6102 |}
6103 !! result
6104 <table>
6105 <tr>
6106 <td>[[{{{1}}}|{{{2}}}]]
6107 </td></tr></table>
6108
6109 !! end
6110
6111 !! test
6112 Magic variable as template parameter
6113 !! input
6114 {{paramtest|param={{SITENAME}}}}
6115 !! result
6116 <p>This is a test template with parameter MediaWiki
6117 </p>
6118 !! end
6119
6120 !! article
6121 Template:linktest
6122 !! text
6123 [[{{{param}}}|link]]
6124 !! endarticle
6125
6126 !! test
6127 Template parameter as link source
6128 !! input
6129 {{linktest|param=Main Page}}
6130 !! result
6131 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
6132 </p>
6133 !! end
6134
6135 !!test
6136 Template-generated attribute string (k='v')
6137 !!input
6138 <span {{attr_str|id|v1}}>bar</span>
6139 !!result
6140 <p><span id="v1">bar</span>
6141 </p>
6142 !!end
6143
6144 !!article
6145 Template:paramtest2
6146 !! text
6147 including another template, {{paramtest|param={{{arg}}}}}
6148 !! endarticle
6149
6150 !! test
6151 Template passing argument to another template
6152 !! input
6153 {{paramtest2|arg='hmm'}}
6154 !! result
6155 <p>including another template, This is a test template with parameter 'hmm'
6156 </p>
6157 !! end
6158
6159 !! article
6160 Template:Linktest2
6161 !! text
6162 Main Page
6163 !! endarticle
6164
6165 !! test
6166 Template as link source
6167 !! input
6168 [[{{linktest2}}]]
6169
6170 [[{{linktest2}}|Main Page]]
6171
6172 [[{{linktest2}}]]Page
6173 !! result
6174 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6175 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6176 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
6177 </p>
6178 !! end
6179
6180
6181 !! article
6182 Template:loop1
6183 !! text
6184 {{loop2}}
6185 !! endarticle
6186
6187 !! article
6188 Template:loop2
6189 !! text
6190 {{loop1}}
6191 !! endarticle
6192
6193 !! test
6194 Template infinite loop
6195 !! input
6196 {{loop1}}
6197 !! result
6198 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
6199 </p>
6200 !! end
6201
6202 !! test
6203 Template from main namespace
6204 !! input
6205 {{:Main Page}}
6206 !! result
6207 <p>blah blah
6208 </p>
6209 !! end
6210
6211 !! article
6212 Template:table
6213 !! text
6214 {|
6215 | 1 || 2
6216 |-
6217 | 3 || 4
6218 |}
6219 !! endarticle
6220
6221 !! test
6222 BUG 529: Template with table, not included at beginning of line
6223 !! input
6224 foo {{table}}
6225 !! result
6226 <p>foo
6227 </p>
6228 <table>
6229 <tr>
6230 <td> 1 </td>
6231 <td> 2
6232 </td></tr>
6233 <tr>
6234 <td> 3 </td>
6235 <td> 4
6236 </td></tr></table>
6237
6238 !! end
6239
6240 !! test
6241 BUG 523: Template shouldn't eat newline (or add an extra one before table)
6242 !! input
6243 foo
6244 {{table}}
6245 !! result
6246 <p>foo
6247 </p>
6248 <table>
6249 <tr>
6250 <td> 1 </td>
6251 <td> 2
6252 </td></tr>
6253 <tr>
6254 <td> 3 </td>
6255 <td> 4
6256 </td></tr></table>
6257
6258 !! end
6259
6260 !! test
6261 BUG 41: Template parameters shown as broken links
6262 !! input
6263 {{{parameter}}}
6264 !! result
6265 <p>{{{parameter}}}
6266 </p>
6267 !! end
6268
6269 !! test
6270 Template with targets containing wikilinks
6271 !! input
6272 {{[[foo]]}}
6273
6274 {{[[{{echo|foo}}]]}}
6275
6276 {{{{echo|[[foo}}]]}}
6277 !! result
6278 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6279 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6280 </p><p>{{[[foo}}]]
6281 </p>
6282 !! end
6283
6284 !! article
6285 Template:MSGNW test
6286 !! text
6287 ''None'' of '''this''' should be
6288 * interpreted
6289 but rather passed unmodified
6290 {{test}}
6291 !! endarticle
6292
6293 # hmm, fix this or just deprecate msgnw and document its behavior?
6294 !! test
6295 msgnw keyword
6296 !! options
6297 disabled
6298 !! input
6299 {{msgnw:MSGNW test}}
6300 !! result
6301 <p>''None'' of '''this''' should be
6302 * interpreted
6303 but rather passed unmodified
6304 {{test}}
6305 </p>
6306 !! end
6307
6308 !! test
6309 int keyword
6310 !! input
6311 {{int:youhavenewmessages|lots of money|not!}}
6312 !! result
6313 <p>You have lots of money (not!).
6314 </p>
6315 !! end
6316
6317 !! article
6318 Template:Includes
6319 !! text
6320 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6321 !! endarticle
6322
6323 !! test
6324 <includeonly> and <noinclude> being included
6325 !! input
6326 {{Includes}}
6327 !! result
6328 <p>Foobar
6329 </p>
6330 !! end
6331
6332 !! article
6333 Template:Includes2
6334 !! text
6335 <onlyinclude>Foo</onlyinclude>bar
6336 !! endarticle
6337
6338 !! test
6339 <onlyinclude> being included
6340 !! input
6341 {{Includes2}}
6342 !! result
6343 <p>Foo
6344 </p>
6345 !! end
6346
6347
6348 !! article
6349 Template:Includes3
6350 !! text
6351 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6352 !! endarticle
6353
6354 !! test
6355 <onlyinclude> and <includeonly> being included
6356 !! input
6357 {{Includes3}}
6358 !! result
6359 <p>Foo
6360 </p>
6361 !! end
6362
6363 !! test
6364 <includeonly> and <noinclude> on a page
6365 !! input
6366 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6367 !! result
6368 <p>Foozar
6369 </p>
6370 !! end
6371
6372 !! test
6373 Un-closed <noinclude>
6374 !! input
6375 <noinclude>
6376 !! result
6377 !! end
6378
6379 !! test
6380 <onlyinclude> on a page
6381 !! input
6382 <onlyinclude>Foo</onlyinclude>bar
6383 !! result
6384 <p>Foobar
6385 </p>
6386 !! end
6387
6388 !! test
6389 Un-closed <onlyinclude>
6390 !! input
6391 <onlyinclude>
6392 !! result
6393 !! end
6394
6395 !!test
6396 Self-closed noinclude, includeonly, onlyinclude tags
6397 !!input
6398 <noinclude />
6399 <includeonly />
6400 <onlyinclude />
6401 !!result
6402 <p><br />
6403 </p>
6404 !!end
6405
6406 !!test
6407 Unbalanced includeonly and noinclude tags
6408 !!input
6409 {|
6410 |a</noinclude>
6411 |b</noinclude></noinclude>
6412 |c</noinclude></includeonly>
6413 |d</includeonly></includeonly>
6414 |}
6415 !!result
6416 <table>
6417 <tr>
6418 <td>a
6419 </td>
6420 <td>b
6421 </td>
6422 <td>c&lt;/includeonly&gt;
6423 </td>
6424 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6425 </td></tr></table>
6426
6427 !!end
6428
6429 !! article
6430 Template:Includeonly section
6431 !! text
6432 <includeonly>
6433 ==Includeonly section==
6434 </includeonly>
6435 ==Section T-1==
6436 !!endarticle
6437
6438 !! test
6439 Bug 6563: Edit link generation for section shown by <includeonly>
6440 !! input
6441 {{includeonly section}}
6442 !! result
6443 <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>
6444 <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>
6445
6446 !! end
6447
6448 # Uses same input as the contents of [[Template:Includeonly section]]
6449 !! test
6450 Bug 6563: Section extraction for section shown by <includeonly>
6451 !! options
6452 section=T-2
6453 !! input
6454 <includeonly>
6455 ==Includeonly section==
6456 </includeonly>
6457 ==Section T-2==
6458 !! result
6459 ==Section T-2==
6460 !! end
6461
6462 !! test
6463 Bug 6563: Edit link generation for section suppressed by <includeonly>
6464 !! input
6465 <includeonly>
6466 ==Includeonly section==
6467 </includeonly>
6468 ==Section 1==
6469 !! result
6470 <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>
6471
6472 !! end
6473
6474 !! test
6475 Bug 6563: Section extraction for section suppressed by <includeonly>
6476 !! options
6477 section=1
6478 !! input
6479 <includeonly>
6480 ==Includeonly section==
6481 </includeonly>
6482 ==Section 1==
6483 !! result
6484 ==Section 1==
6485 !! end
6486
6487 !! test
6488 Un-closed <includeonly>
6489 !! input
6490 <includeonly>
6491 !! result
6492 !! end
6493
6494 ###
6495 ### <includeonly> and <noinclude> in attributes
6496 ###
6497 !!test
6498 0. includeonly around the entire attribute
6499 !!input
6500 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6501 !!result
6502 <p><span id="v2">bar</span>
6503 </p>
6504 !!end
6505
6506 !!test
6507 1. includeonly in html attr key
6508 !!input
6509 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6510 !!result
6511 <p><span id="foo">bar</span>
6512 </p>
6513 !!end
6514
6515 !!test
6516 2. includeonly in html attr value
6517 !!input
6518 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6519 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6520 !!result
6521 <p><span id="v1">bar</span>
6522 <span id="v1">bar</span>
6523 </p>
6524 !!end
6525
6526 !!test
6527 3. includeonly in part of an attr value
6528 !!input
6529 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6530 !!result
6531 <p><span style="color:red;">bar</span>
6532 </p>
6533 !!end
6534
6535 ###
6536 ### Testing parsing of templates where a template arg
6537 ### has the same name as the template itself.
6538 ###
6539
6540 !! article
6541 Template:quote
6542 !! text
6543 {{{quote|{{{1}}}}}}
6544 !! endarticle
6545
6546 !!test
6547 Templates: Template Name/Arg clash: 1. Use of positional param
6548 !!input
6549 {{quote|foo}}
6550 !!result
6551 <p>foo
6552 </p>
6553 !!end
6554
6555 !!test
6556 Templates: Template Name/Arg clash: 2. Use of named param
6557 !!input
6558 {{quote|quote=foo}}
6559 !!result
6560 <p>foo
6561 </p>
6562 !!end
6563
6564 !!test
6565 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6566 !!input
6567 {{quote|quote}}
6568 !!result
6569 <p>quote
6570 </p>
6571 !!end
6572
6573 ###
6574 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6575 ###
6576
6577 !!test
6578 Templates: 1. Simple use
6579 !!input
6580 {{echo|Foo}}
6581 !!result
6582 <p>Foo
6583 </p>
6584 !!end
6585
6586 !!test
6587 Templates: 2. Inside a block tag
6588 !!input
6589 <div>{{echo|Foo}}</div>
6590 !!result
6591 <div>Foo</div>
6592
6593 !!end
6594
6595 !!test
6596 Templates: P-wrapping: 1a. Templates on consecutive lines
6597 !!input
6598 {{echo|Foo}}
6599 {{echo|bar}}
6600 !!result
6601 <p>Foo
6602 bar
6603 </p>
6604 !!end
6605
6606 !!test
6607 Templates: P-wrapping: 1b. Templates on consecutive lines
6608 !!input
6609 Foo
6610
6611 {{echo|bar}}
6612 {{echo|baz}}
6613 !!result
6614 <p>Foo
6615 </p><p>bar
6616 baz
6617 </p>
6618 !!end
6619
6620 !!test
6621 Templates: P-wrapping: 1c. Templates on consecutive lines
6622 !!input
6623 {{echo|Foo}}
6624 {{echo|bar}} <div>baz</div>
6625 !!result
6626 <p>Foo
6627 </p>
6628 bar <div>baz</div>
6629
6630 !!end
6631
6632 !!test
6633 Templates: P-wrapping: 1d. Template preceded by comment-only line
6634 !!options
6635 parsoid=wt2html,wt2wt
6636 !!input
6637 <!-- foo -->
6638 {{echo|Bar}}
6639 !!result
6640 <!-- foo -->
6641 <p typeof="mw:Transclusion">Bar
6642 </p>
6643 !!end
6644
6645 !!test
6646 Templates: Inline Text: 1. Multiple tmeplate uses
6647 !!input
6648 {{echo|Foo}}bar{{echo|baz}}
6649 !!result
6650 <p>Foobarbaz
6651 </p>
6652 !!end
6653
6654 !!test
6655 Templates: Inline Text: 2. Back-to-back template uses
6656 !!input
6657 {{echo|Foo}}{{echo|bar}}
6658 !!result
6659 <p>Foobar
6660 </p>
6661 !!end
6662
6663 !!test
6664 Templates: Block Tags: 1. Multiple template uses
6665 !!input
6666 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6667 !!result
6668 <div>Foo</div><div>bar</div><div>baz</div>
6669
6670 !!end
6671
6672 !!test
6673 Templates: Block Tags: 2. Back-to-back template uses
6674 !!input
6675 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6676 !!result
6677 <div>Foo</div><div>bar</div>
6678
6679 !!end
6680
6681 !!test
6682 Templates: Links: 1. Simple example
6683 !!input
6684 {{echo|[[Foo|bar]]}}
6685 !!result
6686 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6687 </p>
6688 !!end
6689
6690 !!test
6691 Templates: Links: 2. Generation of link href
6692 !!input
6693 [[{{echo|Foo}}|bar]]
6694 !!result
6695 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6696 </p>
6697 !!end
6698
6699 !!test
6700 Templates: Links: 3. Generation of part of a link href
6701 !!input
6702 [[Fo{{echo|o}}|bar]]
6703
6704 [[Foo{{echo|bar}}]]
6705
6706 [[Foo{{echo|bar}}baz]]
6707
6708 [[Foo{{echo|bar}}|bar]]
6709
6710 [[:Foo{{echo|bar}}]]
6711
6712 [[:Foo{{echo|bar}}|bar]]
6713 !!result
6714 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6715 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6716 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6717 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6718 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6719 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6720 </p>
6721 !!end
6722
6723 !!test
6724 Templates: Links: 4. Multiple templates generating link href
6725 !!input
6726 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6727 !!result
6728 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6729 </p>
6730 !!end
6731
6732 !!test
6733 Templates: Links: 5. Generation of link text
6734 !!input
6735 [[Foo|{{echo|bar}}]]
6736 !!result
6737 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6738 </p>
6739 !!end
6740
6741 !!test
6742 Templates: Links: 5. Nested templates (only outermost template should be marked)
6743 !!input
6744 {{echo|[[{{echo|Foo}}|bar]]}}
6745 !!result
6746 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6747 </p>
6748 !!end
6749
6750 !!test
6751 Templates: HTML Tag: 1. Generation of HTML attr. key
6752 !!input
6753 <div {{echo|style}}="color:red;">foo</div>
6754 !!result
6755 <div style="color:red;">foo</div>
6756
6757 !!end
6758
6759 !!test
6760 Templates: HTML Tag: 2. Generation of HTML attr. value
6761 !!input
6762 <div style={{echo|'color:red;'}}>foo</div>
6763 !!result
6764 <div style="color:red;">foo</div>
6765
6766 !!end
6767
6768 !!test
6769 Templates: HTML Tag: 3. Generation of HTML attr key and value
6770 !!input
6771 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6772 !!result
6773 <div style="color:red;">foo</div>
6774
6775 !!end
6776
6777 !!test
6778 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6779 !!input
6780 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6781 !!result
6782 <div title="This is a long title with just one piece templated">foo</div>
6783
6784 !!end
6785
6786 !!test
6787 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6788 !!input
6789 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6790 !!result
6791 <div title="This is a long title with just one piece templated">foo</div>
6792
6793 !!end
6794
6795 !!test
6796 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6797 !!input
6798 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6799 !!result
6800 <div title="This is a long title with just one piece templated">foo</div>
6801
6802 !!end
6803
6804 !!test
6805 Templates: HTML Tag: 7. Generation of partial attribute key string
6806 !!input
6807 <div st{{echo|yle}}="color:red;">foo</div>
6808 !!result
6809 <div style="color:red;">foo</div>
6810
6811 !!end
6812
6813 !!test
6814 Templates: HTML Tables: 1. Generating start of a HTML table
6815 !!input
6816 {{echo|<table><tr><td>foo</td>}}</tr></table>
6817 !!result
6818 <table><tr><td>foo</td></tr></table>
6819
6820 !!end
6821
6822 !!test
6823 Templates: HTML Tables: 2a. Generating middle of a HTML table
6824 !!input
6825 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6826 !!result
6827 <table><tr><td>foo</td></tr></table>
6828
6829 !!end
6830
6831 !!test
6832 Templates: HTML Tables: 2b. Generating middle of a HTML table
6833 !!input
6834 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6835 !!result
6836 <table><tr><td>foo</td></tr></table>
6837
6838 !!end
6839
6840 !!test
6841 Templates: HTML Tables: 3. Generating end of a HTML table
6842 !!input
6843 <table><tr>{{echo|<td>foo</td></tr></table>}}
6844 !!result
6845 <table><tr><td>foo</td></tr></table>
6846
6847 !!end
6848
6849 !!test
6850 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6851 !!input
6852 {{echo|<table>}}<tr><td>foo</td></tr></table>
6853 !!result
6854 <table><tr><td>foo</td></tr></table>
6855
6856 !!end
6857
6858 !!test
6859 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6860 !!input
6861 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6862 !!result
6863 <table><tr><td>foo</td></tr></table>
6864
6865 !!end
6866
6867 !!test
6868 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6869 !!input
6870 <table><tr>{{echo|<td>}}foo</td></tr></table>
6871 !!result
6872 <table><tr><td>foo</td></tr></table>
6873
6874 !!end
6875
6876 !!test
6877 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6878 !!input
6879 <table><tr><td>foo{{echo|</td>}}</tr></table>
6880 !!result
6881 <table><tr><td>foo</td></tr></table>
6882
6883 !!end
6884
6885 !!test
6886 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6887 !!input
6888 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6889 !!result
6890 <table><tr><td>foo</td></tr></table>
6891
6892 !!end
6893
6894 !!test
6895 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6896 !!input
6897 <table><tr><td>foo</td></tr>{{echo|</table>}}
6898 !!result
6899 <table><tr><td>foo</td></tr></table>
6900
6901 !!end
6902
6903 !!test
6904 Templates: HTML Tables: 5. Proper fostering of categories from inside
6905 !!options
6906 parsoid=wt2html,wt2wt
6907 !!input
6908 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
6909 <!--Two categories (Bug 50330)-->
6910 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
6911 !!result
6912 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
6913 <!--Two categories (Bug 50330)-->
6914 <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>
6915 !!end
6916
6917 !!test
6918 Templates: Wiki Tables: 1a. Fostering of entire template content
6919 !!input
6920 {|
6921 {{echo|a}}
6922 |}
6923 !!result
6924 <table>
6925 a
6926 <tr><td></td></tr></table>
6927
6928 !!end
6929
6930 !!test
6931 Templates: Wiki Tables: 1b. Fostering of entire template content
6932 !!input
6933 {|
6934 {{echo|<div>}}
6935 foo
6936 {{echo|</div>}}
6937 |}
6938 !!result
6939 <table>
6940 <div>
6941 <p>foo
6942 </p>
6943 </div>
6944 <tr><td></td></tr></table>
6945
6946 !!end
6947
6948 !!test
6949 Templates: Wiki Tables: 2. Fostering of partial template content
6950 !!input
6951 {|
6952 {{echo|a
6953 <div>b</div>}}
6954 |}
6955 !!result
6956 <table>
6957 a
6958 <div>b</div>
6959 <tr><td></td></tr></table>
6960
6961 !!end
6962
6963 !!test
6964 Templates: Wiki Tables: 3. td-content via multiple templates
6965 !!input
6966 {|
6967 {{echo|{{pipe}}a}}{{echo|b}}
6968 |}
6969 !!result
6970 <table>
6971 <tr>
6972 <td>ab
6973 </td></tr></table>
6974
6975 !!end
6976
6977 !!test
6978 Templates: Wiki Tables: 4. Templated tags, no content
6979 !!input
6980 {{tbl-start}}
6981 {{tbl-end}}
6982 !!result
6983 <table>
6984 <tr><td></td></tr></table>
6985
6986 !!end
6987
6988 !!test
6989 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6990 !!input
6991 {{tbl-start}}
6992 |foo
6993 {{tbl-end}}
6994 !!result
6995 <table>
6996 <tr>
6997 <td>foo
6998 </td></tr></table>
6999
7000 !!end
7001
7002 !!test
7003 Templates: Wiki Tables: 6. Templated tags, templated td-tags
7004 !!input
7005 {{tbl-start}}
7006 {{!}}foo
7007 {{tbl-end}}
7008 !!result
7009 <table>
7010 <tr>
7011 <td>foo
7012 </td></tr></table>
7013
7014 !!end
7015
7016 !!test
7017 Templates: Lists: Multi-line list-items via templates
7018 !!input
7019 *{{echo|a {{nonexistent|
7020 unused}}}}
7021 *{{echo|b {{nonexistent|
7022 unused}}}}
7023 !!result
7024 <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>
7025 </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>
7026 </li></ul>
7027
7028 !!end
7029
7030 !!test
7031 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
7032 !!input
7033 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
7034 !!result
7035 <p><i>ab</i>c<i>d</i>e
7036 </p>
7037 !!end
7038
7039 !!test
7040 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7041 (PHP parser generates misnested html)
7042 !! options
7043 parsoid=wt2html,wt2wt
7044 !!input
7045 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
7046 !!result
7047 <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>
7048 !!end
7049
7050 !!test
7051 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
7052 (PHP parser generates misnested html)
7053 !! options
7054 parsoid=wt2html,wt2wt
7055 !!input
7056 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
7057 !!result
7058 <div typeof="mw:Transclusion"><i>a</i></div>
7059 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
7060 <div typeof="mw:Transclusion">e</div>
7061 !!end
7062
7063 !!test
7064 Templates: Ugly nesting: 4. Divs opened/closed across templates
7065 !!input
7066 a<div>b{{echo|c</div>d}}e
7067 !!result
7068 a<div>bc</div>de
7069
7070 !!end
7071
7072 !!test
7073 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
7074 (Parsoid-centric)
7075 !! options
7076 parsoid
7077 !!input
7078 {|
7079 |{{echo|foo</table>}}
7080 |bar
7081 |}
7082 !!result
7083 <table typeof="mw:Transclusion">
7084 <tbody>
7085 <tr>
7086 <td>foo</td></tr></tbody></table><span>bar</span>
7087 !!end
7088
7089 !!test
7090 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
7091 (Parsoid-centric)
7092 !! options
7093 parsoid
7094 !!input
7095 <table>
7096 <tr>
7097 <td>
7098 <table>
7099 <tr>
7100 <td>1. {{echo|foo </table>}}</td>
7101 <td> bar </td>
7102 <td>2. {{echo|baz </table>}}</td>
7103 </tr>
7104 <tr>
7105 <td>abc</td>
7106 </tr>
7107 </table>
7108 </td>
7109 </tr>
7110 <tr>
7111 <td>xyz</td>
7112 </tr>
7113 </table>
7114 !!result
7115 <table about="#mwt1" typeof="mw:Transclusion">
7116 <tbody><tr >
7117 <td >
7118 <table >
7119 <tbody><tr >
7120 <td >1. foo </td></tr></tbody></table></td>
7121 <td > bar </td>
7122 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
7123 </span><span about="#mwt1">
7124
7125 abc</span><span about="#mwt1">
7126 </span><span about="#mwt1">
7127 </span><span about="#mwt1">
7128 </span><span about="#mwt1">
7129 </span><span about="#mwt1">
7130
7131 xyz</span><span about="#mwt1">
7132 </span><span about="#mwt1">
7133 </span>
7134 !!end
7135
7136 !! test
7137 Templates: Ugly templates: 3. newline-only template parameter
7138 !! input
7139 foo {{echo|
7140 }}
7141 !! result
7142 <p>foo
7143 </p>
7144 !! end
7145
7146 # This looks like a bug: a single newline triggers p/br for some reason.
7147 !! test
7148 Templates: Ugly templates: 4. newline-only template parameter inconsistency
7149 !! input
7150 {{echo|
7151 }}
7152 !! result
7153 <p><br />
7154 </p>
7155 !! end
7156
7157
7158 !!test
7159 Parser Functions: 1. Simple example
7160 !!input
7161 {{uc:foo}}
7162 !!result
7163 <p>FOO
7164 </p>
7165 !!end
7166
7167 !!test
7168 Parser Functions: 2. Nested use (only outermost should be marked up)
7169 !!input
7170 {{uc:{{lc:FOO}}}}
7171 !!result
7172 <p>FOO
7173 </p>
7174 !!end
7175
7176 ###
7177 ### Pre-save transform tests
7178 ###
7179 !! test
7180 pre-save transform: subst:
7181 !! options
7182 PST
7183 !! input
7184 {{subst:test}}
7185 !! result
7186 This is a test template
7187 !! end
7188
7189 !! test
7190 pre-save transform: normal template
7191 !! options
7192 PST
7193 !! input
7194 {{test}}
7195 !! result
7196 {{test}}
7197 !! end
7198
7199 !! test
7200 pre-save transform: nonexistent template
7201 !! options
7202 PST
7203 !! input
7204 {{thistemplatedoesnotexist}}
7205 !! result
7206 {{thistemplatedoesnotexist}}
7207 !! end
7208
7209
7210 !! test
7211 pre-save transform: subst magic variables
7212 !! options
7213 PST
7214 !! input
7215 {{subst:SITENAME}}
7216 !! result
7217 MediaWiki
7218 !! end
7219
7220 # This is bug 89, which I fixed. -- wtm
7221 !! test
7222 pre-save transform: subst: templates with parameters
7223 !! options
7224 pst
7225 !! input
7226 {{subst:paramtest|param="something else"}}
7227 !! result
7228 This is a test template with parameter "something else"
7229 !! end
7230
7231 !! article
7232 Template:nowikitest
7233 !! text
7234 <nowiki>'''not wiki'''</nowiki>
7235 !! endarticle
7236
7237 !! test
7238 pre-save transform: nowiki in subst (bug 1188)
7239 !! options
7240 pst
7241 !! input
7242 {{subst:nowikitest}}
7243 !! result
7244 <nowiki>'''not wiki'''</nowiki>
7245 !! end
7246
7247
7248 !! article
7249 Template:commenttest
7250 !! text
7251 This template has <!-- a comment --> in it.
7252 !! endarticle
7253
7254 !! test
7255 pre-save transform: comment in subst (bug 1936)
7256 !! options
7257 pst
7258 !! input
7259 {{subst:commenttest}}
7260 !! result
7261 This template has <!-- a comment --> in it.
7262 !! end
7263
7264 !! test
7265 pre-save transform: unclosed tag
7266 !! options
7267 pst noxml
7268 !! input
7269 <nowiki>'''not wiki'''
7270 !! result
7271 <nowiki>'''not wiki'''
7272 !! end
7273
7274 !! test
7275 pre-save transform: mixed tag case
7276 !! options
7277 pst noxml
7278 !! input
7279 <NOwiki>'''not wiki'''</noWIKI>
7280 !! result
7281 <NOwiki>'''not wiki'''</noWIKI>
7282 !! end
7283
7284 !! test
7285 pre-save transform: unclosed comment in <nowiki>
7286 !! options
7287 pst noxml
7288 !! input
7289 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7290 !! result
7291 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7292 !!end
7293
7294 # Leading @ in this template definition works around a limitation
7295 # in parsoid's parserTests which otherwise strips the <span> from the
7296 # result (confusing it for a template wrapper)
7297 !! article
7298 Template:dangerous
7299 !!text
7300 @<span onmouseover="alert('crap')">Oh no</span>
7301 !!endarticle
7302
7303 !!test
7304 (confirming safety of fix for subst bug 1936)
7305 !! input
7306 {{Template:dangerous}}
7307 !! result
7308 <p>@<span>Oh no</span>
7309 </p>
7310 !! end
7311
7312 !! test
7313 pre-save transform: comment containing gallery (bug 5024)
7314 !! options
7315 pst
7316 !! input
7317 <!-- <gallery>data</gallery> -->
7318 !!result
7319 <!-- <gallery>data</gallery> -->
7320 !!end
7321
7322 !! test
7323 pre-save transform: comment containing extension
7324 !! options
7325 pst
7326 !! input
7327 <!-- <tag>data</tag> -->
7328 !!result
7329 <!-- <tag>data</tag> -->
7330 !!end
7331
7332 !! test
7333 pre-save transform: comment containing nowiki
7334 !! options
7335 pst
7336 !! input
7337 <!-- <nowiki>data</nowiki> -->
7338 !!result
7339 <!-- <nowiki>data</nowiki> -->
7340 !!end
7341
7342 !! test
7343 pre-save transform: <noinclude> in subst (bug 3298)
7344 !! options
7345 pst
7346 !! input
7347 {{subst:Includes}}
7348 !! result
7349 Foobar
7350 !! end
7351
7352 !! test
7353 pre-save transform: <onlyinclude> in subst (bug 3298)
7354 !! options
7355 pst
7356 !! input
7357 {{subst:Includes2}}
7358 !! result
7359 Foo
7360 !! end
7361
7362 !! article
7363 Template:SubstTest
7364 !!text
7365 {{<includeonly>subst:</includeonly>Includes}}
7366 !! endarticle
7367
7368 !! article
7369 Template:SafeSubstTest
7370 !! text
7371 {{<includeonly>safesubst:</includeonly>Includes}}
7372 !! endarticle
7373
7374 !! test
7375 bug 22297: safesubst: works during PST
7376 !! options
7377 pst
7378 !! input
7379 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
7380 !! result
7381 FoobarFoobar
7382 !! end
7383
7384 !! test
7385 bug 22297: safesubst: works during normal parse
7386 !! input
7387 {{SafeSubstTest}}
7388 !! result
7389 <p>Foobar
7390 </p>
7391 !! end
7392
7393 !! test:
7394 subst: does not work during normal parse
7395 !! input
7396 {{SubstTest}}
7397 !! result
7398 <p>{{subst:Includes}}
7399 </p>
7400 !! end
7401
7402 !! test
7403 pre-save transform: context links ("pipe trick")
7404 !! options
7405 pst
7406 !! input
7407 [[Article (context)|]]
7408 [[Bar:Article|]]
7409 [[:Bar:Article|]]
7410 [[Bar:Article (context)|]]
7411 [[:Bar:Article (context)|]]
7412 [[|Article]]
7413 [[|Article (context)]]
7414 [[Bar:X (Y) Z|]]
7415 [[:Bar:X (Y) Z|]]
7416 !! result
7417 [[Article (context)|Article]]
7418 [[Bar:Article|Article]]
7419 [[:Bar:Article|Article]]
7420 [[Bar:Article (context)|Article]]
7421 [[:Bar:Article (context)|Article]]
7422 [[Article]]
7423 [[Article (context)]]
7424 [[Bar:X (Y) Z|X (Y) Z]]
7425 [[:Bar:X (Y) Z|X (Y) Z]]
7426 !! end
7427
7428 !! test
7429 pre-save transform: context links ("pipe trick") with interwiki prefix
7430 !! options
7431 pst
7432 !! input
7433 [[interwiki:Article|]]
7434 [[:interwiki:Article|]]
7435 [[interwiki:Bar:Article|]]
7436 [[:interwiki:Bar:Article|]]
7437 !! result
7438 [[interwiki:Article|Article]]
7439 [[:interwiki:Article|Article]]
7440 [[interwiki:Bar:Article|Bar:Article]]
7441 [[:interwiki:Bar:Article|Bar:Article]]
7442 !! end
7443
7444 !! test
7445 pre-save transform: context links ("pipe trick") with parens in title
7446 !! options
7447 pst title=[[Somearticle (context)]]
7448 !! input
7449 [[|Article]]
7450 !! result
7451 [[Article (context)|Article]]
7452 !! end
7453
7454 !! test
7455 pre-save transform: context links ("pipe trick") with comma in title
7456 !! options
7457 pst title=[[Someplace, Somewhere]]
7458 !! input
7459 [[|Otherplace]]
7460 [[Otherplace, Elsewhere|]]
7461 [[Otherplace, Elsewhere, Anywhere|]]
7462 !! result
7463 [[Otherplace, Somewhere|Otherplace]]
7464 [[Otherplace, Elsewhere|Otherplace]]
7465 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
7466 !! end
7467
7468 !! test
7469 pre-save transform: context links ("pipe trick") with parens and comma
7470 !! options
7471 pst title=[[Someplace (IGNORED), Somewhere]]
7472 !! input
7473 [[|Otherplace]]
7474 [[Otherplace (place), Elsewhere|]]
7475 !! result
7476 [[Otherplace, Somewhere|Otherplace]]
7477 [[Otherplace (place), Elsewhere|Otherplace]]
7478 !! end
7479
7480 !! test
7481 pre-save transform: context links ("pipe trick") with comma and parens
7482 !! options
7483 pst title=[[Who, me? (context)]]
7484 !! input
7485 [[|Yes, you.]]
7486 [[Me, Myself, and I (1937 song)|]]
7487 !! result
7488 [[Yes, you. (context)|Yes, you.]]
7489 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7490 !! end
7491
7492 !! test
7493 pre-save transform: context links ("pipe trick") with namespace
7494 !! options
7495 pst title=[[Ns:Somearticle]]
7496 !! input
7497 [[|Article]]
7498 !! result
7499 [[Ns:Article|Article]]
7500 !! end
7501
7502 !! test
7503 pre-save transform: context links ("pipe trick") with namespace and parens
7504 !! options
7505 pst title=[[Ns:Somearticle (context)]]
7506 !! input
7507 [[|Article]]
7508 !! result
7509 [[Ns:Article (context)|Article]]
7510 !! end
7511
7512 !! test
7513 pre-save transform: context links ("pipe trick") with namespace and comma
7514 !! options
7515 pst title=[[Ns:Somearticle, Context, Whatever]]
7516 !! input
7517 [[|Article]]
7518 !! result
7519 [[Ns:Article, Context, Whatever|Article]]
7520 !! end
7521
7522 !! test
7523 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7524 !! options
7525 pst title=[[Ns:Somearticle, Context (context)]]
7526 !! input
7527 [[|Article]]
7528 !! result
7529 [[Ns:Article (context)|Article]]
7530 !! end
7531
7532 !! test
7533 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7534 !! options
7535 pst title=[[Ns:Somearticle (IGNORED), Context]]
7536 !! input
7537 [[|Article]]
7538 !! result
7539 [[Ns:Article, Context|Article]]
7540 !! end
7541
7542 !! test
7543 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7544 !! options
7545 pst
7546 !! input
7547 [[Article(context)|]]
7548 [[Bar:Article(context)|]]
7549 [[:Bar:Article(context)|]]
7550 [[|Article(context)]]
7551 [[Bar:X(Y)Z|]]
7552 [[:Bar:X(Y)Z|]]
7553 !! result
7554 [[Article(context)|Article]]
7555 [[Bar:Article(context)|Article]]
7556 [[:Bar:Article(context)|Article]]
7557 [[Article(context)]]
7558 [[Bar:X(Y)Z|X(Y)Z]]
7559 [[:Bar:X(Y)Z|X(Y)Z]]
7560 !! end
7561
7562 !! test
7563 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7564 !! options
7565 pst
7566 !! input
7567 [[Article (context)|]]
7568 [[Bar:Article (context)|]]
7569 [[:Bar:Article (context)|]]
7570 [[|Article (context)]]
7571 [[Bar:X (Y) Z|]]
7572 [[:Bar:X (Y) Z|]]
7573 !! result
7574 [[Article (context)|Article]]
7575 [[Bar:Article (context)|Article]]
7576 [[:Bar:Article (context)|Article]]
7577 [[Article (context)]]
7578 [[Bar:X (Y) Z|X (Y) Z]]
7579 [[:Bar:X (Y) Z|X (Y) Z]]
7580 !! end
7581
7582 !! test
7583 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7584 !! options
7585 pst
7586 !! input
7587 [[Article(context)|]]
7588 [[Bar:Article(context)|]]
7589 [[:Bar:Article(context)|]]
7590 [[|Article(context)]]
7591 [[Bar:X(Y)Z|]]
7592 [[:Bar:X(Y)Z|]]
7593 !! result
7594 [[Article(context)|Article]]
7595 [[Bar:Article(context)|Article]]
7596 [[:Bar:Article(context)|Article]]
7597 [[Article(context)]]
7598 [[Bar:X(Y)Z|X(Y)Z]]
7599 [[:Bar:X(Y)Z|X(Y)Z]]
7600 !! end
7601
7602 !! test
7603 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7604 !! options
7605 pst
7606 !! input
7607 [[Article (context), context|]]
7608 [[Article (context),context|]]
7609 [[Bar:Article (context), context|]]
7610 [[Bar:Article (context),context|]]
7611 [[:Bar:Article (context), context|]]
7612 [[:Bar:Article (context),context|]]
7613 !! result
7614 [[Article (context), context|Article]]
7615 [[Article (context),context|Article]]
7616 [[Bar:Article (context), context|Article]]
7617 [[Bar:Article (context),context|Article]]
7618 [[:Bar:Article (context), context|Article]]
7619 [[:Bar:Article (context),context|Article]]
7620 !! end
7621
7622 !! test
7623 pre-save transform: trim trailing empty lines
7624 !! options
7625 pst
7626 !! input
7627 Empty lines are trimmed
7628
7629
7630
7631
7632 !! result
7633 Empty lines are trimmed
7634 !! end
7635
7636 !! test
7637 pre-save transform: Signature expansion
7638 !! options
7639 pst
7640 !! input
7641 * ~~~
7642 * <noinclude>~~~</noinclude>
7643 * <includeonly>~~~</includeonly>
7644 * <onlyinclude>~~~</onlyinclude>
7645 !! result
7646 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7647 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7648 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7649 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7650 !! end
7651
7652
7653 !! test
7654 pre-save transform: Signature expansion in nowiki tags (bug 93)
7655 !! options
7656 pst disabled
7657 !! input
7658 Shall not expand:
7659
7660 <nowiki>~~~~</nowiki>
7661
7662 <includeonly><nowiki>~~~~</nowiki></includeonly>
7663
7664 <noinclude><nowiki>~~~~</nowiki></noinclude>
7665
7666 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7667
7668 {{subst:Foo}} shall be converted to FOO
7669
7670 As well as inside noinclude/onlyinclude
7671 <noinclude>{{subst:Foo}}</noinclude>
7672 <onlyinclude>{{subst:Foo}}</onlyinclude>
7673
7674 But not inside includeonly
7675 <includeonly>{{subst:Foo}}</includeonly>
7676 !! result
7677 Shall not expand:
7678
7679 <nowiki>~~~~</nowiki>
7680
7681 <includeonly><nowiki>~~~~</nowiki></includeonly>
7682
7683 <noinclude><nowiki>~~~~</nowiki></noinclude>
7684
7685 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7686
7687 FOO shall be converted to FOO
7688
7689 As well as inside noinclude/onlyinclude
7690 <noinclude>FOO</noinclude>
7691 <onlyinclude>FOO</onlyinclude>
7692
7693 But not inside includeonly
7694 <includeonly>{{subst:Foo}}</includeonly>
7695 !! end
7696
7697 ###
7698 ### Message transform tests
7699 ###
7700 !! test
7701 message transform: magic variables
7702 !! options
7703 msg
7704 !! input
7705 {{SITENAME}}
7706 !! result
7707 MediaWiki
7708 !! end
7709
7710 !! test
7711 message transform: should not transform wiki markup
7712 !! options
7713 msg
7714 !! input
7715 ''test''
7716 !! result
7717 ''test''
7718 !! end
7719
7720 !! test
7721 message transform: <noinclude> in transcluded template (bug 4926)
7722 !! options
7723 msg
7724 !! input
7725 {{Includes}}
7726 !! result
7727 Foobar
7728 !! end
7729
7730 !! test
7731 message transform: <onlyinclude> in transcluded template (bug 4926)
7732 !! options
7733 msg
7734 !! input
7735 {{Includes2}}
7736 !! result
7737 Foo
7738 !! end
7739
7740 !! test
7741 {{#special:}} page name, known
7742 !! options
7743 msg
7744 !! input
7745 {{#special:Recentchanges}}
7746 !! result
7747 Special:RecentChanges
7748 !! end
7749
7750 !! test
7751 {{#special:}} page name with subpage, known
7752 !! options
7753 msg
7754 !! input
7755 {{#special:Recentchanges/param}}
7756 !! result
7757 Special:RecentChanges/param
7758 !! end
7759
7760 !! test
7761 {{#special:}} page name, unknown
7762 !! options
7763 msg
7764 !! input
7765 {{#special:foobar nonexistent}}
7766 !! result
7767 Special:Foobar nonexistent
7768 !! end
7769
7770 !! test
7771 {{#speciale:}} page name, known
7772 !! options
7773 msg
7774 !! input
7775 {{#speciale:Recentchanges}}
7776 !! result
7777 Special:RecentChanges
7778 !! end
7779
7780 !! test
7781 {{#speciale:}} page name with subpage, known
7782 !! options
7783 msg
7784 !! input
7785 {{#speciale:Recentchanges/param}}
7786 !! result
7787 Special:RecentChanges/param
7788 !! end
7789
7790 !! test
7791 {{#speciale:}} page name, unknown
7792 !! options
7793 msg
7794 !! input
7795 {{#speciale:foobar nonexistent}}
7796 !! result
7797 Special:Foobar_nonexistent
7798 !! end
7799
7800 ###
7801 ### Images
7802 ###
7803 !! test
7804 Simple image
7805 !! input
7806 [[Image:foobar.jpg]]
7807 !! result
7808 <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>
7809 </p>
7810 !! end
7811
7812 !! test
7813 Right-aligned image
7814 !! input
7815 [[Image:foobar.jpg|right]]
7816 !! result
7817 <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>
7818
7819 !! end
7820
7821 !! test
7822 Simple image (using File: namespace, now canonical)
7823 !! input
7824 [[File:foobar.jpg]]
7825 !! result
7826 <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>
7827 </p>
7828 !! end
7829
7830 !! test
7831 Image with caption
7832 !! input
7833 [[Image:foobar.jpg|right|Caption text]]
7834 !! result
7835 <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>
7836
7837 !! end
7838
7839 !! test
7840 Image with empty attribute
7841 !! input
7842 [[Image:foobar.jpg|right||Caption text]]
7843 !! result
7844 <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>
7845
7846 !! end
7847
7848 !! test
7849 Image with link tails
7850 !! input
7851 123[[Image:foobar.jpg]]456
7852 123[[Image:foobar.jpg|right]]456
7853 123[[Image:foobar.jpg|thumb]]456
7854 !! result
7855 <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
7856 </p>
7857 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
7858 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
7859
7860 !! end
7861
7862 !! test
7863 Image with multiple captions -- only last one is accepted
7864 !! input
7865 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7866 !! result
7867 <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>
7868
7869 !! end
7870
7871 !! test
7872 Image with width attribute at different positions
7873 !! input
7874 [[Image:foobar.jpg|200px|right|Caption]]
7875 [[Image:foobar.jpg|right|200px|Caption]]
7876 [[Image:foobar.jpg|right|Caption|200px]]
7877 !! result
7878 <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>
7879 <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>
7880 <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>
7881
7882 !! end
7883
7884 !! test
7885 Image with link parameter, wiki target
7886 !! input
7887 [[Image:foobar.jpg|link=Target page]]
7888 !! result
7889 <p><a href="/wiki/Target_page" title="Target page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7890 </p>
7891 !! end
7892
7893 !! test
7894 Image with link parameter, URL target
7895 !! input
7896 [[Image:foobar.jpg|link=http://example.com/]]
7897 !! result
7898 <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>
7899 </p>
7900 !! end
7901
7902 !! test
7903 Image with link parameter, wgExternalLinkTarget
7904 !! input
7905 [[Image:foobar.jpg|link=http://example.com/]]
7906 !! config
7907 wgExternalLinkTarget='foobar'
7908 !! result
7909 <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>
7910 </p>
7911 !! end
7912
7913 !! test
7914 Image with link parameter, wgNoFollowLinks set to false
7915 !! input
7916 [[Image:foobar.jpg|link=http://example.com/]]
7917 !! config
7918 wgNoFollowLinks=false
7919 !! result
7920 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7921 </p>
7922 !! end
7923
7924 !! test
7925 Image with link parameter, wgNoFollowDomainExceptions
7926 !! input
7927 [[Image:foobar.jpg|link=http://example.com/]]
7928 !! config
7929 wgNoFollowDomainExceptions='example.com'
7930 !! result
7931 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7932 </p>
7933 !! end
7934
7935 !! test
7936 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7937 !! input
7938 [[Image:foobar.jpg|link=http://example.com/|Title]]
7939 !! config
7940 wgExternalLinkTarget='foobar'
7941 !! result
7942 <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>
7943 </p>
7944 !! end
7945
7946 !! test
7947 Image with empty link parameter
7948 !! input
7949 [[Image:foobar.jpg|link=]]
7950 !! result
7951 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7952 </p>
7953 !! end
7954
7955 !! test
7956 Image with link parameter (wiki target) and unnamed parameter
7957 !! input
7958 [[Image:foobar.jpg|link=Target page|Title]]
7959 !! result
7960 <p><a href="/wiki/Target_page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7961 </p>
7962 !! end
7963
7964 !! test
7965 Image with link parameter (URL target) and unnamed parameter
7966 !! input
7967 [[Image:foobar.jpg|link=http://example.com/|Title]]
7968 !! result
7969 <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>
7970 </p>
7971 !! end
7972
7973 !! test
7974 Thumbnail image with link parameter
7975 !! options
7976 php
7977 !! input
7978 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
7979 !! result
7980 <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>
7981
7982 !! end
7983
7984 !! test
7985 Manually-specified thumbnail image
7986 !! options
7987 php
7988 !! input
7989 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
7990 !! result
7991 <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>
7992
7993 !! end
7994
7995 !! test
7996 Manually-specified thumbnail image with explicit link to wiki page
7997 !! options
7998 php
7999 !! input
8000 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
8001 !! result
8002 <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>
8003
8004 !! end
8005
8006 !! test
8007 Manually-specified thumbnail image with explicit link to url
8008 !! options
8009 php
8010 !! input
8011 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
8012 !! result
8013 <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>
8014
8015 !! end
8016
8017 !! test
8018 Manually-specified thumbnail image with explicit no link
8019 !! options
8020 php
8021 !! input
8022 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
8023 !! result
8024 <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>
8025
8026 !! end
8027
8028 !! test
8029 Manually-specified thumbnail image with explicit link and alt text
8030 !! options
8031 php
8032 !! input
8033 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
8034 !! result
8035 <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>
8036
8037 !! end
8038
8039 !! test
8040 Image with frame and link
8041 !! input
8042 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
8043 !! result
8044 <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>
8045
8046 !! end
8047
8048 !! test
8049 Image with frame and link and explicit alt
8050 !! input
8051 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
8052 !! result
8053 <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>
8054
8055 !! end
8056
8057 !! test
8058 Image with wiki markup in implicit alt
8059 !! input
8060 [[Image:Foobar.jpg|testing '''bold''' in alt]]
8061 !! result
8062 <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>
8063 </p>
8064 !! end
8065
8066 !! test
8067 Image with wiki markup in explicit alt
8068 !! input
8069 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
8070 !! result
8071 <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>
8072 </p>
8073 !! end
8074
8075 !! test
8076 Link to image page- image page normally doesn't exists, hence edit link
8077 Add test with existing image page
8078 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
8079 !! input
8080 [[:Image:test]]
8081 !! result
8082 <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>
8083 </p>
8084 !! end
8085
8086 !! test
8087 bug 18784 Link to non-existent image page with caption should use caption as link text
8088 !! input
8089 [[:Image:test|caption]]
8090 !! result
8091 <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>
8092 </p>
8093 !! end
8094
8095 !! test
8096 Frameless image caption with a free URL
8097 !! input
8098 [[Image:foobar.jpg|http://example.com]]
8099 !! result
8100 <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>
8101 </p>
8102 !! end
8103
8104 !! test
8105 Thumbnail image caption with a free URL
8106 !! input
8107 [[Image:foobar.jpg|thumb|http://example.com]]
8108 !! result
8109 <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>
8110
8111 !! end
8112
8113 !! test
8114 Thumbnail image caption with a free URL and explicit alt
8115 !! input
8116 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
8117 !! result
8118 <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>
8119
8120 !! end
8121
8122 !! test
8123 SVG thumbnails with no language set
8124 !! options
8125 !! input
8126 [[File:Foobar.svg|thumb|width=200]]
8127 !! result
8128 <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>
8129
8130 !! end
8131
8132 !! test
8133 SVG thumbnails with language de
8134 !! options
8135 !! input
8136 [[File:Foobar.svg|thumb|width=200|lang=de]]
8137 !! result
8138 <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>
8139
8140 !! end
8141
8142 !! test
8143 SVG thumbnails with invalid language code
8144 !! options
8145 !! input
8146 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
8147 !! result
8148 <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>
8149
8150 !! end
8151
8152 !! test
8153 BUG 1887: A ISBN with a thumbnail
8154 !! input
8155 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
8156 !! result
8157 <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>
8158
8159 !! end
8160
8161 !! test
8162 BUG 1887: A RFC with a thumbnail
8163 !! input
8164 [[Image:foobar.jpg|thumb|This is RFC 12354]]
8165 !! result
8166 <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>
8167
8168 !! end
8169
8170 !! test
8171 BUG 1887: A mailto link with a thumbnail
8172 !! input
8173 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
8174 !! result
8175 <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>
8176
8177 !! end
8178
8179 # Pending resolution to bug 368
8180 !! test
8181 BUG 648: Frameless image caption with a link
8182 !! input
8183 [[Image:foobar.jpg|text with a [[link]] in it]]
8184 !! result
8185 <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>
8186 </p>
8187 !! end
8188
8189 !! test
8190 BUG 648: Frameless image caption with a link (suffix)
8191 !! input
8192 [[Image:foobar.jpg|text with a [[link]]foo in it]]
8193 !! result
8194 <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>
8195 </p>
8196 !! end
8197
8198 !! test
8199 BUG 648: Frameless image caption with an interwiki link
8200 !! input
8201 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
8202 !! result
8203 <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>
8204 </p>
8205 !! end
8206
8207 !! test
8208 BUG 648: Frameless image caption with a piped interwiki link
8209 !! input
8210 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
8211 !! result
8212 <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>
8213 </p>
8214 !! end
8215
8216 !! test
8217 Escape HTML special chars in image alt text
8218 !! input
8219 [[Image:foobar.jpg|& < > "]]
8220 !! result
8221 <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>
8222 </p>
8223 !! end
8224
8225 !! test
8226 BUG 499: Alt text should have &#1234;, not &amp;1234;
8227 !! input
8228 [[Image:foobar.jpg|&#9792;]]
8229 !! result
8230 <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>
8231 </p>
8232 !! end
8233
8234 !! test
8235 Broken image caption with link
8236 !! input
8237 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
8238 !! result
8239 <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.
8240 </p>
8241 !! end
8242
8243 !! test
8244 Image caption containing another image
8245 !! input
8246 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
8247 !! result
8248 <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>
8249
8250 !! end
8251
8252 !! test
8253 Image caption containing a newline
8254 !! input
8255 [[Image:Foobar.jpg|This
8256 *is some text]]
8257 !! result
8258 <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>
8259 </p>
8260 !!end
8261
8262 !!test
8263 Parsoid: Image caption containing leading space
8264 (The leading space should not trigger nowiki escaping in wt2wt mode)
8265 !! input
8266 [[Image:Foobar.jpg|thumb| bar]]
8267 !! result
8268 <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>
8269
8270 !!end
8271
8272 !! test
8273 Bug 3090: External links other than http: in image captions
8274 !! input
8275 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
8276 !! result
8277 <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>
8278
8279 !! end
8280
8281 !! test
8282 Custom class
8283 !! input
8284 [[Image:foobar.jpg|a|class=b]]
8285 !! result
8286 <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>
8287 </p>
8288 !! end
8289
8290 !! test
8291 Localized image handling (1).
8292 !! options
8293 language=es
8294 !! input
8295 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
8296 !! result
8297 <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>
8298
8299 !! end
8300
8301 !! test
8302 Localized image handling (2).
8303 !! options
8304 language=es
8305 !! input
8306 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
8307 !! result
8308 <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>
8309
8310 !! end
8311
8312 !! test
8313 "border", "frameless" and "class" attributes on an image.
8314 !! input
8315 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
8316 !! result
8317 <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>
8318 </p>
8319 !! end
8320
8321 !! article
8322 File:Barfoo.jpg
8323 !! text
8324 #REDIRECT [[File:Barfoo.jpg]]
8325 !! endarticle
8326
8327 !! test
8328 Redirected image
8329 !! input
8330 [[Image:Barfoo.jpg]]
8331 !! result
8332 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
8333 </p>
8334 !! end
8335
8336 !! test
8337 Missing image with uploads disabled
8338 !! options
8339 wgEnableUploads=0
8340 !! input
8341 [[Image:Foobaz.jpg]]
8342 !! result
8343 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
8344 </p>
8345 !! end
8346
8347 # Parsoid-specific testing for images
8348 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8349 # Currently imperfect due to a flaw in the Parsoid testrunner
8350 # Work in progress
8351
8352 !! test
8353 Parsoid-specific image handling - simple image
8354 !! options
8355 parsoid
8356 !! input
8357 [[Image:Foobar.jpg]]
8358 !! result
8359 <p>
8360 <span class="mw-default-size" typeof="mw:Image">
8361 <a href="File:Foobar.jpg">
8362 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8363 </a>
8364 </span>
8365 </p>
8366 !! end
8367
8368 !! test
8369 Parsoid-specific image handling - simple image without link
8370 !! options
8371 parsoid
8372 !! input
8373 [[Image:Foobar.jpg|link=]]
8374 !! result
8375 <p>
8376 <span class="mw-default-size" typeof="mw:Image">
8377 <span>
8378 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8379 </span>
8380 </span>
8381 </p>
8382 !! end
8383
8384 !! test
8385 Parsoid-specific image handling - simple image with specific link
8386 !! options
8387 parsoid
8388 !! input
8389 [[Image:Foobar.jpg|link=Main Page]]
8390 !! result
8391 <p>
8392 <span class="mw-default-size" typeof="mw:Image">
8393 <a href="Main_Page">
8394 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8395 </a>
8396 </span>
8397 </p>
8398 !! end
8399
8400 !! test
8401 Parsoid-specific image handling - simple image with size and middle alignment
8402 !! options
8403 parsoid
8404 !! input
8405 [[Image:Foobar.jpg|50px|middle]]
8406 !! result
8407 <p>
8408 <span class="mw-valign-middle" typeof="mw:Image">
8409 <a href="File:Foobar.jpg">
8410 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8411 </a>
8412 </span>
8413 </p>
8414 !! end
8415
8416 !! test
8417 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
8418 !! options
8419 parsoid
8420 !! input
8421 [[Image:Foobar.jpg|500x10px|baseline|caption]]
8422 !! result
8423 <p>
8424 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8425 <a href="File:Foobar.jpg">
8426 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
8427 </a>
8428 </span>
8429 </p>
8430 !! end
8431
8432 !! test
8433 Parsoid-specific image handling - simple image with border and size spec
8434 !! options
8435 parsoid
8436 !! input
8437 [[Image:Foobar.jpg|50px|border|caption]]
8438 !! result
8439 <p>
8440 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8441 <a href="File:Foobar.jpg">
8442 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8443 </a>
8444 </span>
8445 </p>
8446 !! end
8447
8448 !! test
8449 Parsoid-specific image handling - thumbnail with halign, valign, and caption
8450 !! options
8451 parsoid
8452 !! input
8453 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
8454 !! result
8455 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
8456 <a href="File:Foobar.jpg">
8457 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
8458 </a>
8459 <figcaption>caption content</figcaption>
8460 </figure>
8461 !! end
8462
8463 !! test
8464 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
8465 !! options
8466 parsoid
8467 !! input
8468 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
8469 !! result
8470 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
8471 <a href="File:Foobar.jpg">
8472 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
8473 </a>
8474 <figcaption>caption</figcaption>
8475 </figure>
8476 !! end
8477
8478 !! test
8479 Parsoid-specific image handling - framed image with specific size and caption
8480 !! options
8481 parsoid
8482 !! input
8483 [[Image:Foobar.jpg|500x50px|frame|caption]]
8484 !! result
8485 <figure typeof="mw:Image/Frame">
8486 <a href="File:Foobar.jpg">
8487 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8488 </a>
8489 <figcaption>caption</figcaption>
8490 </figure>
8491 !! end
8492
8493 !! test
8494 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
8495 !! options
8496 parsoid
8497 !! input
8498 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
8499 !! result
8500 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
8501 <a href="File:Foobar.jpg">
8502 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8503 </a>
8504 <figcaption>caption</figcaption>
8505 </figure>
8506 !! end
8507
8508 !! test
8509 Parsoid-specific image handling - frameless image with specific size, border, and caption
8510 !! options
8511 parsoid
8512 !! input
8513 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
8514 !! result
8515 <p>
8516 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8517 <a href="File:Foobar.jpg">
8518 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8519 </a>
8520 </p>
8521 !! end
8522
8523 #!! test
8524 #Parsoid-specific image handling - simple image with a formatted caption
8525 #!! options
8526 #parsoid
8527 #!! input
8528 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
8529 #!! result
8530 #<p>
8531 #<span typeof="mw:Image">
8532 #<a class="mw-default-size" href="Image:Foobar.jpg">
8533 #<img alt="Foobar.jpg" class="mw-default-size" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8534 #</a>
8535 #<span>abc</span>
8536 #</span>
8537 #</p>
8538
8539
8540 ###
8541 ### Subpages
8542 ###
8543 !! article
8544 Subpage test/subpage
8545 !! text
8546 foo
8547 !! endarticle
8548
8549 !! test
8550 Subpage link
8551 !! options
8552 subpage title=[[Subpage test]]
8553 !! input
8554 [[/subpage]]
8555 !! result
8556 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
8557 </p>
8558 !! end
8559
8560 !! test
8561 Subpage noslash link
8562 !! options
8563 subpage title=[[Subpage test]]
8564 !!input
8565 [[/subpage/]]
8566 !! result
8567 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
8568 </p>
8569 !! end
8570
8571 # TODO: make this PHP-parser compatible!
8572 !! test
8573 Relative subpage noslash link
8574 !! options
8575 parsoid=wt2wt,wt2html,html2html
8576 subpage title=[[Subpage test/1/2/3/4]]
8577 !!input
8578 [[../../subpage/]]
8579
8580 [[../../subpage]]
8581 !! result
8582 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
8583 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
8584 !! end
8585
8586 # TODO: make this PHP-parser compatible!
8587 !! test
8588 Parsoid: dot-slash prefixed wikilinks
8589 !! options
8590 parsoid=wt2wt,wt2html,html2html
8591 !!input
8592 [[./foo]]
8593
8594 [[././bar]]
8595
8596 [[././baz/]]
8597 !! result
8598 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
8599 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
8600 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
8601 !! end
8602
8603 !! test
8604 Disabled subpages
8605 !! input
8606 [[/subpage]]
8607 !! result
8608 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
8609 </p>
8610 !! end
8611
8612 !! test
8613 BUG 561: {{/Subpage}}
8614 !! options
8615 subpage title=[[Page]]
8616 !! input
8617 {{/Subpage}}
8618 !! result
8619 <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>
8620 </p>
8621 !! end
8622
8623 ###
8624 ### Categories
8625 ###
8626 !! article
8627 Category:MediaWiki User's Guide
8628 !! text
8629 blah
8630 !! endarticle
8631
8632 !! test
8633 Link to category
8634 !! input
8635 [[:Category:MediaWiki User's Guide]]
8636 !! result
8637 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
8638 </p>
8639 !! end
8640
8641 !! test
8642 Simple category
8643 !! options
8644 cat
8645 !! input
8646 [[Category:MediaWiki User's Guide]]
8647 !! result
8648 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8649 !! end
8650
8651 !! test
8652 PAGESINCATEGORY invalid title fatal (r33546 fix)
8653 !! input
8654 {{PAGESINCATEGORY:<bogus>}}
8655 !! result
8656 <p>0
8657 </p>
8658 !! end
8659
8660 !! test
8661 Category with different sort key
8662 !! options
8663 cat
8664 !! input
8665 [[Category:MediaWiki User's Guide|Foo]]
8666 !! result
8667 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8668 !! end
8669
8670 !! test
8671 Category with identical sort key
8672 !! options
8673 cat
8674 !! input
8675 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8676 !! result
8677 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8678 !! end
8679
8680 !! test
8681 Category with empty sort key
8682 !! options
8683 cat
8684 pst
8685 !! input
8686 [[Category:MediaWiki User's Guide|]]
8687 !! result
8688 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8689 !! end
8690
8691 !! test
8692 Category with empty sort key and parentheses
8693 !! options
8694 cat
8695 pst
8696 !! input
8697 [[Category:Foo (bar)|]]
8698 !! result
8699 [[Category:Foo (bar)|Foo]]
8700 !! end
8701
8702 !! test
8703 Category with link tail
8704 !! options
8705 cat
8706 pst
8707 !! input
8708 123[[Category:Foo]]456
8709 !! result
8710 123[[Category:Foo]]456
8711 !! end
8712
8713 !! test
8714 Category with template
8715 !! options
8716 cat
8717 pst
8718 !! input
8719 [[Category:{{echo|Foo}}]]
8720 !! result
8721 [[Category:{{echo|Foo}}]]
8722 !! end
8723
8724 !! test
8725 Category with template in sort key
8726 !! options
8727 cat
8728 pst
8729 !! input
8730 [[Category:Foo|{{echo|Bar}}]]
8731 !! result
8732 [[Category:Foo|{{echo|Bar}}]]
8733 !! end
8734
8735 !! test
8736 Category with template in sort key and title
8737 !! options
8738 cat
8739 pst
8740 !! input
8741 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8742 !! result
8743 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8744 !! end
8745
8746 !! test
8747 Category / paragraph interactions
8748 !! input
8749 Foo [[Category:Baz]] Bar
8750
8751 Foo [[Category:Baz]]
8752 Bar
8753
8754 Foo
8755 [[Category:Baz]]
8756 Bar
8757
8758 Foo
8759 [[Category:Baz]] Bar
8760
8761 Foo
8762 [[Category:Baz]]
8763 [[Category:Baz]]
8764 [[Category:Baz]]
8765 Bar
8766
8767 [[Category:Baz]]
8768 [[Category:Baz]]
8769 [[Category:Baz]]
8770
8771 [[Category:Baz]]
8772 {{echo|[[Category:Baz]]}}
8773 [[Category:Baz]]
8774 !! result
8775 <p>Foo Bar
8776 </p><p>Foo
8777 Bar
8778 </p><p>Foo
8779 Bar
8780 </p><p>Foo Bar
8781 </p><p>Foo
8782 Bar
8783 </p>
8784 !! end
8785
8786 !! test
8787 Parsoid: Serialize link to category page with colon escape
8788 !! options
8789 parsoid
8790 !! input
8791
8792 [[:Category:Foo]]
8793 [[:Category:Foo|Bar]]
8794 !! result
8795 <p>
8796 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
8797 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
8798 </p>
8799 !! end
8800
8801 !! test
8802 Parsoid: Link prefix/suffixes aren't applied to category links
8803 !! options
8804 parsoid=wt2html,wt2wt,html2html
8805 language=is
8806 !! input
8807 x[[Category:Foo]]y
8808 !! result
8809 <p>x<link rel="mw:WikiLink/Category" href="Category:Foo">y</p>
8810 !! end
8811
8812 !! test
8813 Parsoid: Serialize link to file page with colon escape
8814 !! options
8815 parsoid
8816 !! input
8817
8818 [[:File:Foo.png]]
8819 [[:File:Foo.png|Bar]]
8820 !! result
8821 <p>
8822 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
8823 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
8824 </p>
8825 !! end
8826
8827 !! test
8828 Parsoid: Serialize a genuine category link without colon escape
8829 !! options
8830 parsoid
8831 !! input
8832 [[Category:Foo]]
8833 [[Category:Foo|Bar]]
8834 !! result
8835 <link rel="mw:WikiLink/Category" href="Category:Foo">
8836 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
8837 !! end
8838
8839 ###
8840 ### Inter-language links
8841 ###
8842 !! test
8843 Inter-language links
8844 !! options
8845 ill
8846 !! input
8847 [[es:Alimento]]
8848 [[fr:Nourriture]]
8849 [[zh:&#39135;&#21697;]]
8850 !! result
8851 es:Alimento fr:Nourriture zh:食品
8852 !! end
8853
8854 !! test
8855 Duplicate interlanguage links (bug 24502)
8856 !! options
8857 ill
8858 !! input
8859 [[es:1]]
8860 [[es:2]]
8861 [[fr:1]]
8862 [[fr:2]]
8863 !! result
8864 es:1 fr:1
8865 !! end
8866
8867 ###
8868 ### Sections
8869 ###
8870 !! test
8871 Basic section headings
8872 !! input
8873 == Headline 1 ==
8874 Some text
8875
8876 ==Headline 2==
8877 More
8878 ===Smaller headline===
8879 Blah blah
8880 !! result
8881 <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>
8882 <p>Some text
8883 </p>
8884 <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>
8885 <p>More
8886 </p>
8887 <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>
8888 <p>Blah blah
8889 </p>
8890 !! end
8891
8892 !! test
8893 Section headings with TOC
8894 !! input
8895 == Headline 1 ==
8896 === Subheadline 1 ===
8897 ===== Skipping a level =====
8898 ====== Skipping a level ======
8899
8900 == Headline 2 ==
8901 Some text
8902 ===Another headline===
8903 !! result
8904 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8905 <ul>
8906 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
8907 <ul>
8908 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
8909 <ul>
8910 <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>
8911 <ul>
8912 <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>
8913 </ul>
8914 </li>
8915 </ul>
8916 </li>
8917 </ul>
8918 </li>
8919 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
8920 <ul>
8921 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
8922 </ul>
8923 </li>
8924 </ul>
8925 </div>
8926 <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>
8927 <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>
8928 <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>
8929 <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>
8930 <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>
8931 <p>Some text
8932 </p>
8933 <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>
8934
8935 !! end
8936
8937 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
8938 !! test
8939 Handling of sections up to level 6 and beyond
8940 !! input
8941 = Level 1 Heading=
8942 == Level 2 Heading==
8943 === Level 3 Heading===
8944 ==== Level 4 Heading====
8945 ===== Level 5 Heading=====
8946 ====== Level 6 Heading======
8947 ======= Level 7 Heading=======
8948 ======== Level 8 Heading========
8949 ========= Level 9 Heading=========
8950 ========== Level 10 Heading==========
8951 !! result
8952 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8953 <ul>
8954 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
8955 <ul>
8956 <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>
8957 <ul>
8958 <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>
8959 <ul>
8960 <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>
8961 <ul>
8962 <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>
8963 <ul>
8964 <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>
8965 <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>
8966 <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>
8967 <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>
8968 <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>
8969 </ul>
8970 </li>
8971 </ul>
8972 </li>
8973 </ul>
8974 </li>
8975 </ul>
8976 </li>
8977 </ul>
8978 </li>
8979 </ul>
8980 </div>
8981 <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>
8982 <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>
8983 <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>
8984 <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>
8985 <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>
8986 <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>
8987 <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>
8988 <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>
8989 <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>
8990 <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>
8991
8992 !! end
8993
8994 !! test
8995 TOC regression (bug 9764)
8996 !! input
8997 == title 1 ==
8998 === title 1.1 ===
8999 ==== title 1.1.1 ====
9000 === title 1.2 ===
9001 == title 2 ==
9002 === title 2.1 ===
9003 !! result
9004 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9005 <ul>
9006 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9007 <ul>
9008 <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>
9009 <ul>
9010 <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>
9011 </ul>
9012 </li>
9013 <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>
9014 </ul>
9015 </li>
9016 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9017 <ul>
9018 <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>
9019 </ul>
9020 </li>
9021 </ul>
9022 </div>
9023 <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>
9024 <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>
9025 <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>
9026 <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>
9027 <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>
9028 <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>
9029
9030 !! end
9031
9032 !! test
9033 TOC with wgMaxTocLevel=3 (bug 6204)
9034 !! options
9035 wgMaxTocLevel=3
9036 !! input
9037 == title 1 ==
9038 === title 1.1 ===
9039 ==== title 1.1.1 ====
9040 === title 1.2 ===
9041 == title 2 ==
9042 === title 2.1 ===
9043 !! result
9044 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9045 <ul>
9046 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9047 <ul>
9048 <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>
9049 <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>
9050 </ul>
9051 </li>
9052 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9053 <ul>
9054 <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>
9055 </ul>
9056 </li>
9057 </ul>
9058 </div>
9059 <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>
9060 <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>
9061 <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>
9062 <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>
9063 <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>
9064 <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>
9065
9066 !! end
9067
9068 !! test
9069 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
9070 !! options
9071 wgMaxTocLevel=3
9072 !! input
9073 ==Section 1==
9074 ===Section 1.1===
9075 ====Section 1.1.1====
9076 ====Section 1.1.1.1====
9077 ==Section 2==
9078 !! result
9079 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9080 <ul>
9081 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
9082 <ul>
9083 <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>
9084 </ul>
9085 </li>
9086 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
9087 </ul>
9088 </div>
9089 <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>
9090 <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>
9091 <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>
9092 <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>
9093 <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>
9094
9095 !! end
9096
9097
9098 !! test
9099 Resolving duplicate section names
9100 !! input
9101 == Foo bar ==
9102 == Foo bar ==
9103 !! result
9104 <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>
9105 <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>
9106
9107 !! end
9108
9109 !! test
9110 Resolving duplicate section names with differing case (bug 10721)
9111 !! input
9112 == Foo bar ==
9113 == Foo Bar ==
9114 !! result
9115 <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>
9116 <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>
9117
9118 !! end
9119
9120 !! article
9121 Template:sections
9122 !! text
9123 ===Section 1===
9124 ==Section 2==
9125 !! endarticle
9126
9127 !! test
9128 Template with sections, __NOTOC__
9129 !! input
9130 __NOTOC__
9131 ==Section 0==
9132 {{sections}}
9133 ==Section 4==
9134 !! result
9135 <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>
9136 <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>
9137 <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>
9138 <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>
9139
9140 !! end
9141
9142 !! test
9143 __NOEDITSECTION__ keyword
9144 !! input
9145 __NOEDITSECTION__
9146 ==Section 1==
9147 ==Section 2==
9148 !! result
9149 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
9150 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
9151
9152 !! end
9153
9154 !! test
9155 Link inside a section heading
9156 !! input
9157 ==Section with a [[Main Page|link]] in it==
9158 !! result
9159 <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>
9160
9161 !! end
9162
9163 !! test
9164 TOC regression (bug 12077)
9165 !! input
9166 __TOC__
9167 == title 1 ==
9168 === title 1.1 ===
9169 == title 2 ==
9170 !! result
9171 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9172 <ul>
9173 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9174 <ul>
9175 <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>
9176 </ul>
9177 </li>
9178 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
9179 </ul>
9180 </div>
9181 <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>
9182 <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>
9183 <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>
9184
9185 !! end
9186
9187 !! test
9188 BUG 1219 URL next to image (good)
9189 !! input
9190 http://example.com [[Image:foobar.jpg]]
9191 !! result
9192 <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>
9193 </p>
9194 !!end
9195
9196 !! test
9197 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
9198 !! input
9199 ===
9200 The line above must have a trailing space!
9201 === <!--
9202 --> <!-- -->
9203 But just in case it doesn't...
9204 !! result
9205 <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>
9206 <p>The line above must have a trailing space!
9207 </p>
9208 <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>
9209 <p>But just in case it doesn't...
9210 </p>
9211 !! end
9212
9213 !! test
9214 Header with special characters (bug 25462)
9215 !! input
9216 The tooltips shall not show entities to the user (ie. be double escaped)
9217
9218 == text > text ==
9219 section 1
9220
9221 == text < text ==
9222 section 2
9223
9224 == text & text ==
9225 section 3
9226
9227 == text ' text ==
9228 section 4
9229
9230 == text " text ==
9231 section 5
9232 !! result
9233 <p>The tooltips shall not show entities to the user (ie. be double escaped)
9234 </p>
9235 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9236 <ul>
9237 <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>
9238 <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>
9239 <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>
9240 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
9241 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
9242 </ul>
9243 </div>
9244 <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>
9245 <p>section 1
9246 </p>
9247 <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>
9248 <p>section 2
9249 </p>
9250 <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>
9251 <p>section 3
9252 </p>
9253 <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>
9254 <p>section 4
9255 </p>
9256 <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>
9257 <p>section 5
9258 </p>
9259 !! end
9260
9261 !! test
9262 Headers with excess '=' characters
9263 (Are similar tests necessary beyond the 1st level?)
9264 !! input
9265 =foo==
9266 ==foo=
9267 =''italic'' heading==
9268 ==''italic'' heading=
9269 !! result
9270 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9271 <ul>
9272 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
9273 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
9274 <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>
9275 <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>
9276 </ul>
9277 </div>
9278 <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>
9279 <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>
9280 <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>
9281 <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>
9282
9283 !! end
9284
9285 !! test
9286 HTML headers vs TOC (bug 23393)
9287 (__NOEDITSECTION__ for clearer output, doesn't matter here)
9288 !! input
9289 <h1>Header 1</h1>
9290 == Header 1.1 ==
9291 == Header 1.2 ==
9292
9293 <h1>Header 2
9294 </h1>
9295 == Header 2.1 ==
9296 == Header 2.2 ==
9297 __NOEDITSECTION__
9298 !! result
9299 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9300 <ul>
9301 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
9302 <ul>
9303 <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>
9304 <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>
9305 </ul>
9306 </li>
9307 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
9308 <ul>
9309 <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>
9310 <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>
9311 </ul>
9312 </li>
9313 </ul>
9314 </div>
9315 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
9316 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
9317 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
9318 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
9319 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
9320 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
9321
9322 !! end
9323
9324 !! test
9325 BUG 1219 URL next to image (broken)
9326 !! input
9327 http://example.com[[Image:foobar.jpg]]
9328 !! result
9329 <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>
9330 </p>
9331 !!end
9332
9333 !! test
9334 Bug 1186 news: in the middle of text
9335 !! input
9336 http://en.wikinews.org/wiki/Wikinews:Workplace
9337 !! result
9338 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
9339 </p>
9340 !!end
9341
9342
9343 !! test
9344 Namespaced link must have a title
9345 !! input
9346 [[Project:]]
9347 !! result
9348 <p>[[Project:]]
9349 </p>
9350 !!end
9351
9352 !! test
9353 Namespaced link must have a title (bad fragment version)
9354 !! input
9355 [[Project:#fragment]]
9356 !! result
9357 <p>[[Project:#fragment]]
9358 </p>
9359 !!end
9360
9361
9362 ###
9363 ### HTML tags and HTML attributes
9364 ###
9365
9366 !! test
9367 div with no attributes
9368 !! input
9369 <div>HTML rocks</div>
9370 !! result
9371 <div>HTML rocks</div>
9372
9373 !! end
9374
9375 !! test
9376 div with double-quoted attribute
9377 !! input
9378 <div id="rock">HTML rocks</div>
9379 !! result
9380 <div id="rock">HTML rocks</div>
9381
9382 !! end
9383
9384 !! test
9385 div with single-quoted attribute
9386 !! input
9387 <div id='rock'>HTML rocks</div>
9388 !! result
9389 <div id="rock">HTML rocks</div>
9390
9391 !! end
9392
9393 !! test
9394 div with unquoted attribute
9395 !! input
9396 <div id=rock>HTML rocks</div>
9397 !! result
9398 <div id="rock">HTML rocks</div>
9399
9400 !! end
9401
9402 !! test
9403 div with illegal double attributes
9404 !! input
9405 <div id="a" id="b">HTML rocks</div>
9406 !! result
9407 <div id="b">HTML rocks</div>
9408
9409 !!end
9410
9411 # FIXME: produce empty string instead of "class" in the PHP parser, following
9412 # the HTML5 spec.
9413 !! test
9414 div with empty attribute value, space before equals
9415 !! options
9416 parsoid
9417 !! input
9418 <div class =>HTML rocks</div>
9419 !! result
9420 <div class="">HTML rocks</div>
9421
9422 !! end
9423
9424 # The PHP parser escapes the opening brace to &#123; for some reason, so
9425 # disabled this test for it.
9426 !! test
9427 div with braces in attribute value
9428 !! options
9429 parsoid
9430 !! input
9431 <div title="{}">Foo</div>
9432 !! result
9433 <div title="{}">Foo</div>
9434 !! end
9435
9436 # This it very inconsistent in the PHP parser: it returns
9437 # class="class" if there is a space between the name and the equal sign (see
9438 # 'div with empty attribute value, space before equals'), but strips the
9439 # attribute completely if the space is missing. We hope that not much content
9440 # depends on this, so are implementing the behavior below in Parsoid for
9441 # consistencies' sake. Disabled for the PHP parser.
9442 # FIXME: fix this behavior in the PHP parser?
9443 !! test
9444 div with empty attribute value, no space before equals
9445 !! options
9446 parsoid
9447 !! input
9448 <div class=>HTML rocks</div>
9449 !! result
9450 <div class="">HTML rocks</div>
9451
9452 !! end
9453
9454 !! test
9455 HTML multiple attributes correction
9456 !! input
9457 <p class="error" class="awesome">Awesome!</p>
9458 !! result
9459 <p class="awesome">Awesome!</p>
9460
9461 !!end
9462
9463 !! test
9464 Table multiple attributes correction
9465 !! input
9466 {|
9467 !+ class="error" class="awesome"| status
9468 |}
9469 !! result
9470 <table>
9471 <tr>
9472 <th class="awesome"> status
9473 </th></tr></table>
9474
9475 !!end
9476
9477 !! test
9478 DIV IN UPPERCASE
9479 !! input
9480 <DIV ID="x">HTML ROCKS</DIV>
9481 !! result
9482 <div id="x">HTML ROCKS</div>
9483
9484 !!end
9485
9486 !! test
9487 Non-ASCII pseudo-tags are rendered as text
9488 !! input
9489 <khyô>
9490 !! result
9491 <p>&lt;khyô&gt;
9492 </p>
9493 !! end
9494
9495 !! test
9496 Pseudo-tag with URL 'name' renders as url link
9497 !! input
9498 <http://example.com/>
9499 !! result
9500 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
9501 </p>
9502 !! end
9503
9504 !! test
9505 text with amp in the middle of nowhere
9506 !! input
9507 Remember AT&T?
9508 !!result
9509 <p>Remember AT&amp;T?
9510 </p>
9511 !! end
9512
9513 !! test
9514 text with character entity: eacute
9515 !! input
9516 I always thought &eacute; was a cute letter.
9517 !! result
9518 <p>I always thought &#233; was a cute letter.
9519 </p>
9520 !! end
9521
9522 !! test
9523 text with entity-escaped character entity-like string: eacute
9524 !! input
9525 I always thought &amp;eacute; was a cute letter.
9526 !! result
9527 <p>I always thought &amp;eacute; was a cute letter.
9528 </p>
9529 !! end
9530
9531 !! test
9532 text with undefined character entity: xacute
9533 !! input
9534 I always thought &xacute; was a cute letter.
9535 !! result
9536 <p>I always thought &amp;xacute; was a cute letter.
9537 </p>
9538 !! end
9539
9540
9541 ###
9542 ### Nesting tests (see bug 41545, 50604, 51081)
9543 ###
9544
9545 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
9546 # Note that html2wt is considerably more difficult if we use <b> in
9547 # the test case, instead of <big>
9548 !! test
9549 Ensure that HTML adoption agency algorithm is properly implemented.
9550 !! input
9551 <big>X<big>Y</big>Z</big>
9552 !! result
9553 <p><big>X<big>Y</big>Z</big>
9554 </p>
9555 !! end
9556
9557 # This was bug 41545 in the PHP parser.
9558 !! test
9559 Nesting of <kbd>
9560 !! input
9561 <kbd>X<kbd>Y</kbd>Z</kbd>
9562 !! result
9563 <p><kbd>X<kbd>Y</kbd>Z</kbd>
9564 </p>
9565 !! end
9566
9567 # The following cases were bug 51081 in the PHP parser.
9568 # Note that there are some other nestable tags (b, i, etc) which are
9569 # not covered; see bug 51081 for discussion.
9570 !! test
9571 Nesting of <em>
9572 !! input
9573 <em>X<em>Y</em>Z</em>
9574 !! result
9575 <p><em>X<em>Y</em>Z</em>
9576 </p>
9577 !! end
9578
9579 !! test
9580 Nesting of <strong>
9581 !! input
9582 <strong>X<strong>Y</strong>Z</strong>
9583 !! result
9584 <p><strong>X<strong>Y</strong>Z</strong>
9585 </p>
9586 !! end
9587
9588 !! test
9589 Nesting of <q>
9590 !! input
9591 <q>X<q>Y</q>Z</q>
9592 !! result
9593 <p><q>X<q>Y</q>Z</q>
9594 </p>
9595 !! end
9596
9597 !! test
9598 Nesting of <ruby>
9599 !! input
9600 <ruby>X<ruby>Y</ruby>Z</ruby>
9601 !! result
9602 <p><ruby>X<ruby>Y</ruby>Z</ruby>
9603 </p>
9604 !! end
9605
9606 !! test
9607 Nesting of <bdo>
9608 !! input
9609 <bdo>X<bdo>Y</bdo>Z</bdo>
9610 !! result
9611 <p><bdo>X<bdo>Y</bdo>Z</bdo>
9612 </p>
9613 !! end
9614
9615
9616 ###
9617 ### Media links
9618 ###
9619
9620 !! test
9621 Media link
9622 !! input
9623 [[Media:Foobar.jpg]]
9624 !! result
9625 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
9626 </p>
9627 !! end
9628
9629 !! test
9630 Media link with text
9631 !! input
9632 [[Media:Foobar.jpg|A neat file to look at]]
9633 !! result
9634 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
9635 </p>
9636 !! end
9637
9638 # FIXME: this is still bad HTML tag nesting
9639 !! test
9640 Media link with nasty text
9641 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
9642 !! input
9643 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
9644 !! result
9645 <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>
9646
9647 !! end
9648
9649 !! test
9650 Media link to nonexistent file (bug 1702)
9651 !! input
9652 [[Media:No such.jpg]]
9653 !! result
9654 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
9655 </p>
9656 !! end
9657
9658 !! test
9659 Image link to nonexistent file (bug 1850 - good)
9660 !! input
9661 [[Image:No such.jpg]]
9662 !! result
9663 <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>
9664 </p>
9665 !! end
9666
9667 !! test
9668 :Image link to nonexistent file (bug 1850 - bad)
9669 !! input
9670 [[:Image:No such.jpg]]
9671 !! result
9672 <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>
9673 </p>
9674 !! end
9675
9676
9677
9678 !! test
9679 Character reference normalization in link text (bug 1938)
9680 !! input
9681 [[Main Page|this&that]]
9682 !! result
9683 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
9684 </p>
9685 !!end
9686
9687 !! article
9688 אַ
9689 !! text
9690 Test for unicode normalization
9691
9692 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
9693 !! endarticle
9694
9695 !! test
9696 (bug 19451) Links should refer to the normalized form.
9697 !! input
9698 [[&#xFB2E;]]
9699 [[&#x5d0;&#x5b7;]]
9700 [[&#x5d0;ַ]]
9701 [[א&#x5b7;]]
9702 [[אַ]]
9703 !! result
9704 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
9705 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
9706 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
9707 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
9708 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
9709 </p>
9710 !! end
9711
9712 !! test
9713 Empty attribute crash test (bug 2067)
9714 !! input
9715 <font color="">foo</font>
9716 !! result
9717 <p><font color="">foo</font>
9718 </p>
9719 !! end
9720
9721 !! test
9722 Empty attribute crash test single-quotes (bug 2067)
9723 !! input
9724 <font color=''>foo</font>
9725 !! result
9726 <p><font color="">foo</font>
9727 </p>
9728 !! end
9729
9730 !! test
9731 Attribute test: equals, then nothing
9732 !! input
9733 <font color=>foo</font>
9734 !! result
9735 <p><font>foo</font>
9736 </p>
9737 !! end
9738
9739 !! test
9740 Attribute test: unquoted value
9741 !! input
9742 <font color=x>foo</font>
9743 !! result
9744 <p><font color="x">foo</font>
9745 </p>
9746 !! end
9747
9748 !! test
9749 Attribute test: unquoted but illegal value (hash)
9750 !! input
9751 <font color=#x>foo</font>
9752 !! result
9753 <p><font color="#x">foo</font>
9754 </p>
9755 !! end
9756
9757 !! test
9758 Attribute test: no value
9759 !! input
9760 <font color>foo</font>
9761 !! result
9762 <p><font color="color">foo</font>
9763 </p>
9764 !! end
9765
9766 !! test
9767 Bug 2095: link with three closing brackets
9768 !! input
9769 [[Main Page]]]
9770 !! result
9771 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
9772 </p>
9773 !! end
9774
9775 !! test
9776 Bug 2095: link with pipe and three closing brackets
9777 !! input
9778 [[Main Page|link]]]
9779 !! result
9780 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
9781 </p>
9782 !! end
9783
9784 !! test
9785 Bug 2095: link with pipe and three closing brackets, version 2
9786 !! input
9787 [[Main Page|[http://example.com/]]]
9788 !! result
9789 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
9790 </p>
9791 !! end
9792
9793
9794 ###
9795 ### Safety
9796 ###
9797
9798 !! article
9799 Template:Dangerous attribute
9800 !! text
9801 " onmouseover="alert(document.cookie)
9802 !! endarticle
9803
9804 !! article
9805 Template:Dangerous style attribute
9806 !! text
9807 border-size: expression(alert(document.cookie))
9808 !! endarticle
9809
9810 !! article
9811 Template:Div style
9812 !! text
9813 <div style="float: right; {{{1}}}">Magic div</div>
9814 !! endarticle
9815
9816 !! test
9817 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
9818 !! input
9819 <div title="{{test}}"></div>
9820 !! result
9821 <div title="This is a test template"></div>
9822
9823 !! end
9824
9825 !! test
9826 Bug 2304: HTML attribute safety (dangerous template; 2309)
9827 !! input
9828 <div title="{{dangerous attribute}}"></div>
9829 !! result
9830 <div title=""></div>
9831
9832 !! end
9833
9834 !! test
9835 Bug 2304: HTML attribute safety (dangerous style template; 2309)
9836 !! input
9837 <div style="{{dangerous style attribute}}"></div>
9838 !! result
9839 <div style="/* insecure input */"></div>
9840
9841 !! end
9842
9843 !! test
9844 Bug 2304: HTML attribute safety (safe parameter; 2309)
9845 !! input
9846 {{div style|width: 200px}}
9847 !! result
9848 <div style="float: right; width: 200px">Magic div</div>
9849
9850 !! end
9851
9852 !! test
9853 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
9854 !! input
9855 {{div style|width: expression(alert(document.cookie))}}
9856 !! result
9857 <div style="/* insecure input */">Magic div</div>
9858
9859 !! end
9860
9861 !! test
9862 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
9863 !! input
9864 {{div style|"><script>alert(document.cookie)</script>}}
9865 !! result
9866 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9867
9868 !! end
9869
9870 !! test
9871 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
9872 !! input
9873 {{div style|" ><script>alert(document.cookie)</script>}}
9874 !! result
9875 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9876
9877 !! end
9878
9879 !! test
9880 Bug 2304: HTML attribute safety (link)
9881 !! input
9882 <div title="[[Main Page]]"></div>
9883 !! result
9884 <div title="&#91;&#91;Main Page]]"></div>
9885
9886 !! end
9887
9888 !! test
9889 Bug 2304: HTML attribute safety (italics)
9890 !! input
9891 <div title="''foobar''"></div>
9892 !! result
9893 <div title="&#39;&#39;foobar&#39;&#39;"></div>
9894
9895 !! end
9896
9897 !! test
9898 Bug 2304: HTML attribute safety (bold)
9899 !! input
9900 <div title="'''foobar'''"></div>
9901 !! result
9902 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
9903
9904 !! end
9905
9906
9907 !! test
9908 Bug 2304: HTML attribute safety (ISBN)
9909 !! input
9910 <div title="ISBN 1234567890"></div>
9911 !! result
9912 <div title="&#73;SBN 1234567890"></div>
9913
9914 !! end
9915
9916 !! test
9917 Bug 2304: HTML attribute safety (RFC)
9918 !! input
9919 <div title="RFC 1234"></div>
9920 !! result
9921 <div title="&#82;FC 1234"></div>
9922
9923 !! end
9924
9925 !! test
9926 Bug 2304: HTML attribute safety (PMID)
9927 !! input
9928 <div title="PMID 1234567890"></div>
9929 !! result
9930 <div title="&#80;MID 1234567890"></div>
9931
9932 !! end
9933
9934 !! test
9935 Bug 2304: HTML attribute safety (web link)
9936 !! input
9937 <div title="http://example.com/"></div>
9938 !! result
9939 <div title="http&#58;//example.com/"></div>
9940
9941 !! end
9942
9943 !! test
9944 Bug 2304: HTML attribute safety (named web link)
9945 !! input
9946 <div title="[http://example.com/ link]"></div>
9947 !! result
9948 <div title="&#91;http&#58;//example.com/ link]"></div>
9949
9950 !! end
9951
9952 !! test
9953 Bug 3244: HTML attribute safety (extension; safe)
9954 !! input
9955 <div style="<nowiki>background:blue</nowiki>"></div>
9956 !! result
9957 <div style="background:blue"></div>
9958
9959 !! end
9960
9961 !! test
9962 Bug 3244: HTML attribute safety (extension; unsafe)
9963 !! input
9964 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
9965 !! result
9966 <div style="/* insecure input */"></div>
9967
9968 !! end
9969
9970 # More MSIE fun discovered by Tom Gilder
9971
9972 !! test
9973 MSIE CSS safety test: spurious slash
9974 !! input
9975 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
9976 !! result
9977 <div style="/* insecure input */">evil</div>
9978
9979 !! end
9980
9981 !! test
9982 MSIE CSS safety test: hex code
9983 !! input
9984 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
9985 !! result
9986 <div style="/* insecure input */">evil</div>
9987
9988 !! end
9989
9990 !! test
9991 MSIE CSS safety test: comment in url
9992 !! input
9993 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
9994 !! result
9995 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
9996
9997 !! end
9998
9999 !! test
10000 MSIE CSS safety test: comment in expression
10001 !! input
10002 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
10003 !! result
10004 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
10005
10006 !! end
10007
10008
10009 !! test
10010 Table attribute legitimate extension
10011 !! input
10012 {|
10013 !+ style="<nowiki>color:blue</nowiki>"| status
10014 |}
10015 !! result
10016 <table>
10017 <tr>
10018 <th style="color:blue"> status
10019 </th></tr></table>
10020
10021 !!end
10022
10023 !! test
10024 Table attribute safety
10025 !! input
10026 {|
10027 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
10028 |}
10029 !! result
10030 <table>
10031 <tr>
10032 <th style="/* insecure input */"> status
10033 </th></tr></table>
10034
10035 !! end
10036
10037 !! test
10038 CSS line continuation 1
10039 !! input
10040 <div style="background-image: u\&#10;rl(test.jpg);"></div>
10041 !! result
10042 <div style="/* insecure input */"></div>
10043
10044 !! end
10045
10046 !! test
10047 CSS line continuation 2
10048 !! input
10049 <div style="background-image: u\&#13;rl(test.jpg); "></div>
10050 !! result
10051 <div style="/* insecure input */"></div>
10052
10053 !! end
10054
10055 !! article
10056 Template:Identity
10057 !! text
10058 {{{1}}}
10059 !! endarticle
10060
10061 !! test
10062 Expansion of multi-line templates in attribute values (bug 6255)
10063 !! input
10064 <div style="background: {{identity|#00FF00}}">-</div>
10065 !! result
10066 <div style="background: #00FF00">-</div>
10067
10068 !! end
10069
10070
10071 !! test
10072 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
10073 !! input
10074 <div style="background:
10075 #00FF00">-</div>
10076 !! result
10077 <div style="background: #00FF00">-</div>
10078
10079 !! end
10080
10081 !! test
10082 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
10083 !! input
10084 <div style="background: &#10;#00FF00">-</div>
10085 !! result
10086 <div style="background: &#10;#00FF00">-</div>
10087
10088 !! end
10089
10090 ###
10091 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
10092 ###
10093 !! test
10094 Parser hook: empty input
10095 !! input
10096 <tag></tag>
10097 !! result
10098 <pre>
10099 ''
10100 array (
10101 )
10102 </pre>
10103
10104 !! end
10105
10106 !! test
10107 Parser hook: empty input using terminated empty elements
10108 !! input
10109 <tag/>
10110 !! result
10111 <pre>
10112 NULL
10113 array (
10114 )
10115 </pre>
10116
10117 !! end
10118
10119 !! test
10120 Parser hook: empty input using terminated empty elements (space before)
10121 !! input
10122 <tag />
10123 !! result
10124 <pre>
10125 NULL
10126 array (
10127 )
10128 </pre>
10129
10130 !! end
10131
10132 !! test
10133 Parser hook: basic input
10134 !! input
10135 <tag>input</tag>
10136 !! result
10137 <pre>
10138 'input'
10139 array (
10140 )
10141 </pre>
10142
10143 !! end
10144
10145
10146 !! test
10147 Parser hook: case insensitive
10148 !! input
10149 <TAG>input</TAG>
10150 !! result
10151 <pre>
10152 'input'
10153 array (
10154 )
10155 </pre>
10156
10157 !! end
10158
10159
10160 !! test
10161 Parser hook: case insensitive, redux
10162 !! input
10163 <TaG>input</TAg>
10164 !! result
10165 <pre>
10166 'input'
10167 array (
10168 )
10169 </pre>
10170
10171 !! end
10172
10173 !! test
10174 Parser hook: nested tags
10175 !! options
10176 noxml
10177 !! input
10178 <tag><tag></tag></tag>
10179 !! result
10180 <pre>
10181 '<tag>'
10182 array (
10183 )
10184 </pre>&lt;/tag&gt;
10185
10186 !! end
10187
10188 !! test
10189 Parser hook: basic arguments
10190 !! input
10191 <tag width=200 height = "100" depth = '50' square></tag>
10192 !! result
10193 <pre>
10194 ''
10195 array (
10196 'width' => '200',
10197 'height' => '100',
10198 'depth' => '50',
10199 'square' => 'square',
10200 )
10201 </pre>
10202
10203 !! end
10204
10205 !! test
10206 Parser hook: argument containing a forward slash (bug 5344)
10207 !! input
10208 <tag filename='/tmp/bla'></tag>
10209 !! result
10210 <pre>
10211 ''
10212 array (
10213 'filename' => '/tmp/bla',
10214 )
10215 </pre>
10216
10217 !! end
10218
10219 !! test
10220 Parser hook: empty input using terminated empty elements (bug 2374)
10221 !! input
10222 <tag foo=bar/>text
10223 !! result
10224 <pre>
10225 NULL
10226 array (
10227 'foo' => 'bar',
10228 )
10229 </pre>text
10230
10231 !! end
10232
10233 # </tag> should be output literally since there is no matching tag that begins it
10234 !! test
10235 Parser hook: basic arguments using terminated empty elements (bug 2374)
10236 !! input
10237 <tag width=200 height = "100" depth = '50' square/>
10238 other stuff
10239 </tag>
10240 !! result
10241 <pre>
10242 NULL
10243 array (
10244 'width' => '200',
10245 'height' => '100',
10246 'depth' => '50',
10247 'square' => 'square',
10248 )
10249 </pre>
10250 <p>other stuff
10251 &lt;/tag&gt;
10252 </p>
10253 !! end
10254
10255 ###
10256 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
10257 ###
10258
10259 !! test
10260 Parser hook: static parser hook not inside a comment
10261 !! input
10262 <statictag>hello, world</statictag>
10263 <statictag action=flush/>
10264 !! result
10265 <p>hello, world
10266 </p>
10267 !! end
10268
10269
10270 !! test
10271 Parser hook: static parser hook inside a comment
10272 !! input
10273 <!-- <statictag>hello, world</statictag> -->
10274 <statictag action=flush/>
10275 !! result
10276 <p><br />
10277 </p>
10278 !! end
10279
10280 # Nested template calls; this case was broken by Parser.php rev 1.506,
10281 # since reverted.
10282
10283 !! article
10284 Template:One-parameter
10285 !! text
10286 (My parameter is: {{{1}}})
10287 !! endarticle
10288
10289 !! article
10290 Template:Map-one-parameter
10291 !! text
10292 {{{{{1}}}|{{{2}}}}}
10293 !! endarticle
10294
10295 !! test
10296 Nested template calls
10297 !! input
10298 {{Map-one-parameter|One-parameter|param}}
10299 !! result
10300 <p>(My parameter is: param)
10301 </p>
10302 !! end
10303
10304
10305 ###
10306 ### Sanitizer
10307 ###
10308 !! test
10309 Sanitizer: Closing of open tags
10310 !! input
10311 <s></s><table></table>
10312 !! result
10313 <s></s><table></table>
10314
10315 !! end
10316
10317 !! test
10318 Sanitizer: Closing of open but not closed tags
10319 !! input
10320 <s>foo
10321 !! result
10322 <p><s>foo</s>
10323 </p>
10324 !! end
10325
10326 !! test
10327 Sanitizer: Closing of closed but not open tags
10328 !! input
10329 </s>
10330 !! result
10331 <p>&lt;/s&gt;
10332 </p>
10333 !! end
10334
10335 !! test
10336 Sanitizer: Closing of closed but not open table tags
10337 !! input
10338 Table not started</td></tr></table>
10339 !! result
10340 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
10341 </p>
10342 !! end
10343
10344 !! test
10345 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
10346 !! input
10347 <span id="æ: v">byte</span>[[#æ: v|backlink]]
10348 !! result
10349 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
10350 </p>
10351 !! end
10352
10353 !! test
10354 Sanitizer: Validating the contents of the id attribute (bug 4515)
10355 !! options
10356 disabled
10357 !! input
10358 <br id=9 />
10359 !! result
10360 Something, but definitely not <br id="9" />...
10361 !! end
10362
10363 !! test
10364 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
10365 !! options
10366 disabled
10367 !! input
10368 <br id="foo" /><br id="foo" />
10369 !! result
10370 Something need to be done. foo-2 ?
10371 !! end
10372
10373 !! test
10374 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
10375 !! input
10376 <div itemscope>
10377 <meta itemprop="hello" content="world">
10378 <meta http-equiv="refresh" content="5">
10379 <meta itemprop="hello" http-equiv="refresh" content="5">
10380 <link itemprop="hello" href="{{SERVER}}">
10381 <link rel="stylesheet" href="{{SERVER}}">
10382 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
10383 </div>
10384 !! result
10385 <div itemscope="itemscope">
10386 <p> <meta itemprop="hello" content="world" />
10387 &lt;meta http-equiv="refresh" content="5"&gt;
10388 <meta itemprop="hello" content="5" />
10389 </p>
10390 <link itemprop="hello" href="http&#58;//example.org" />
10391 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
10392 <link itemprop="hello" href="http&#58;//example.org" />
10393 </div>
10394
10395 !! end
10396
10397 !! test
10398 Language converter: output gets cut off unexpectedly (bug 5757)
10399 !! options
10400 language=zh
10401 !! input
10402 this bit is safe: }-
10403
10404 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
10405
10406 then we get cut off here: }-
10407
10408 all additional text is vanished
10409 !! result
10410 <p>this bit is safe: }-
10411 </p><p>but if we add a conversion instance: xxx
10412 </p><p>then we get cut off here: }-
10413 </p><p>all additional text is vanished
10414 </p>
10415 !! end
10416
10417 !! test
10418 Self closed html pairs (bug 5487)
10419 !! options
10420 !! input
10421 <center><font id="bug" />Centered text</center>
10422 <div><font id="bug2" />In div text</div>
10423 !! result
10424 <center>&lt;font id="bug" /&gt;Centered text</center>
10425 <div>&lt;font id="bug2" /&gt;In div text</div>
10426
10427 !! end
10428
10429 #
10430 #
10431 #
10432
10433 !! test
10434 Punctuation: nbsp before exclamation
10435 !! input
10436 C'est grave !
10437 !! result
10438 <p>C'est grave&#160;!
10439 </p>
10440 !! end
10441
10442 !! test
10443 Punctuation: CSS !important (bug 11874)
10444 !! input
10445 <div style="width:50% !important">important</div>
10446 !! result
10447 <div style="width:50% !important">important</div>
10448
10449 !!end
10450
10451 !! test
10452 Punctuation: CSS ! important (bug 11874; with space after)
10453 !! input
10454 <div style="width:50% ! important">important</div>
10455 !! result
10456 <div style="width:50% ! important">important</div>
10457
10458 !!end
10459
10460
10461 !! test
10462 HTML bullet list, closed tags (bug 5497)
10463 !! input
10464 <ul>
10465 <li>One</li>
10466 <li>Two</li>
10467 </ul>
10468 !! result
10469 <ul>
10470 <li>One</li>
10471 <li>Two</li>
10472 </ul>
10473
10474 !! end
10475
10476 !! test
10477 HTML bullet list, unclosed tags (bug 5497)
10478 !! options
10479 disabled
10480 !! input
10481 <ul>
10482 <li>One
10483 <li>Two
10484 </ul>
10485 !! result
10486 <ul>
10487 <li>One
10488 </li><li>Two
10489 </li></ul>
10490
10491 !! end
10492
10493 !! test
10494 HTML ordered list, closed tags (bug 5497)
10495 !! input
10496 <ol>
10497 <li>One</li>
10498 <li>Two</li>
10499 </ol>
10500 !! result
10501 <ol>
10502 <li>One</li>
10503 <li>Two</li>
10504 </ol>
10505
10506 !! end
10507
10508 !! test
10509 HTML ordered list, unclosed tags (bug 5497)
10510 !! options
10511 disabled
10512 !! input
10513 <ol>
10514 <li>One
10515 <li>Two
10516 </ol>
10517 !! result
10518 <ol>
10519 <li>One
10520 </li><li>Two
10521 </li></ol>
10522
10523 !! end
10524
10525 !! test
10526 HTML nested bullet list, closed tags (bug 5497)
10527 !! input
10528 <ul>
10529 <li>One</li>
10530 <li>Two:
10531 <ul>
10532 <li>Sub-one</li>
10533 <li>Sub-two</li>
10534 </ul>
10535 </li>
10536 </ul>
10537 !! result
10538 <ul>
10539 <li>One</li>
10540 <li>Two:
10541 <ul>
10542 <li>Sub-one</li>
10543 <li>Sub-two</li>
10544 </ul>
10545 </li>
10546 </ul>
10547
10548 !! end
10549
10550 !! test
10551 HTML nested bullet list, open tags (bug 5497)
10552 !! options
10553 disabled
10554 !! input
10555 <ul>
10556 <li>One
10557 <li>Two:
10558 <ul>
10559 <li>Sub-one
10560 <li>Sub-two
10561 </ul>
10562 </ul>
10563 !! result
10564 <ul>
10565 <li>One
10566 </li><li>Two:
10567 <ul>
10568 <li>Sub-one
10569 </li><li>Sub-two
10570 </li></ul>
10571 </li></ul>
10572
10573 !! end
10574
10575 !! test
10576 HTML nested ordered list, closed tags (bug 5497)
10577 !! input
10578 <ol>
10579 <li>One</li>
10580 <li>Two:
10581 <ol>
10582 <li>Sub-one</li>
10583 <li>Sub-two</li>
10584 </ol>
10585 </li>
10586 </ol>
10587 !! result
10588 <ol>
10589 <li>One</li>
10590 <li>Two:
10591 <ol>
10592 <li>Sub-one</li>
10593 <li>Sub-two</li>
10594 </ol>
10595 </li>
10596 </ol>
10597
10598 !! end
10599
10600 !! test
10601 HTML nested ordered list, open tags (bug 5497)
10602 !! options
10603 disabled
10604 !! input
10605 <ol>
10606 <li>One
10607 <li>Two:
10608 <ol>
10609 <li>Sub-one
10610 <li>Sub-two
10611 </ol>
10612 </ol>
10613 !! result
10614 <ol>
10615 <li>One
10616 </li><li>Two:
10617 <ol>
10618 <li>Sub-one
10619 </li><li>Sub-two
10620 </li></ol>
10621 </li></ol>
10622
10623 !! end
10624
10625 !! test
10626 HTML ordered list item with parameters oddity
10627 !! input
10628 <ol><li id="fragment">One</li></ol>
10629 !! result
10630 <ol><li id="fragment">One</li></ol>
10631
10632 !! end
10633
10634 !!test
10635 bug 5918: autonumbering
10636 !! input
10637 [http://first/] [http://second] [ftp://ftp]
10638
10639 ftp://inlineftp
10640
10641 [mailto:enclosed@mail.tld With target]
10642
10643 [mailto:enclosed@mail.tld]
10644
10645 mailto:inline@mail.tld
10646 !! result
10647 <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>
10648 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
10649 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
10650 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
10651 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
10652 </p>
10653 !! end
10654
10655
10656 #
10657 # Security and HTML correctness
10658 # From Nick Jenkins' fuzz testing
10659 #
10660
10661 !! test
10662 Fuzz testing: Parser13
10663 !! input
10664 {|
10665 | http://a|
10666 !! result
10667 <table>
10668 <tr>
10669 <td>
10670 </td>
10671 </tr>
10672 </table>
10673
10674 !! end
10675
10676 !! test
10677 Fuzz testing: Parser14
10678 !! input
10679 == onmouseover= ==
10680 http://__TOC__
10681 !! result
10682 <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>
10683 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10684 <ul>
10685 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
10686 </ul>
10687 </div>
10688
10689 !! end
10690
10691 !! test
10692 Fuzz testing: Parser14-table
10693 !! input
10694 ==a==
10695 {| STYLE=__TOC__
10696 !! result
10697 <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>
10698 <table style="&#95;_TOC&#95;_">
10699 <tr><td></td></tr>
10700 </table>
10701
10702 !! end
10703
10704 # Known to produce bogus xml (extra </td>)
10705 !! test
10706 Fuzz testing: Parser16
10707 !! options
10708 noxml
10709 !! input
10710 {|
10711 !https://||||||
10712 !! result
10713 <table>
10714 <tr>
10715 <th>https://</th>
10716 <th></th>
10717 <th></th>
10718 <th>
10719 </td>
10720 </tr>
10721 </table>
10722
10723 !! end
10724
10725 !! test
10726 Fuzz testing: Parser21
10727 !! input
10728 {|
10729 ! irc://{{ftp://a" onmouseover="alert('hello world');"
10730 |
10731 !! result
10732 <table>
10733 <tr>
10734 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
10735 </th>
10736 <td>
10737 </td>
10738 </tr>
10739 </table>
10740
10741 !! end
10742
10743 !! test
10744 Fuzz testing: Parser22
10745 !! input
10746 http://===r:::https://b
10747
10748 {|
10749 !!result
10750 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
10751 </p>
10752 <table>
10753 <tr><td></td></tr>
10754 </table>
10755
10756 !! end
10757
10758 # Known to produce bad XML for now
10759 !! test
10760 Fuzz testing: Parser24
10761 !! options
10762 noxml
10763 !! input
10764 {|
10765 {{{|
10766 <u CLASS=
10767 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
10768 <br style="onmouseover='alert(document.cookie);' " />
10769
10770 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10771 |
10772 !! result
10773 <table>
10774 {{{|
10775 <u class="&#124;">}}}} &gt;
10776 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
10777
10778 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10779 <tr>
10780 <td></u>
10781 </td>
10782 </tr>
10783 </table>
10784
10785 !! end
10786
10787 # Note: the current result listed for this is not what the original one was,
10788 # but the original bug was JavaScript injection, which is fixed in any case.
10789 # It's not clear that the original result listed was any more correct than the
10790 # current one. Original result:
10791 # <p>{{{|
10792 # </p>
10793 # <li class="&#124;&#124;">
10794 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10795 !!test
10796 Fuzz testing: Parser25 (bug 6055)
10797 !! input
10798 {{{
10799 |
10800 <LI CLASS=||
10801 >
10802 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
10803 !! result
10804 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10805 </p>
10806 !! end
10807
10808 !!test
10809 Fuzz testing: URL adjacent extension (with space, clean)
10810 !! options
10811 !! input
10812 http://example.com <nowiki>junk</nowiki>
10813 !! result
10814 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
10815 </p>
10816 !!end
10817
10818 !!test
10819 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
10820 !! options
10821 !! input
10822 http://example.com<nowiki>junk</nowiki>
10823 !! result
10824 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
10825 </p>
10826 !!end
10827
10828 !!test
10829 Fuzz testing: URL adjacent extension (no space, dirty; pre)
10830 !! options
10831 !! input
10832 http://example.com<pre>junk</pre>
10833 !! result
10834 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
10835
10836 !!end
10837
10838 !!test
10839 Fuzz testing: image with bogus manual thumbnail
10840 !!input
10841 [[Image:foobar.jpg|thumbnail= ]]
10842 !!result
10843 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
10844
10845 !!end
10846
10847 !! test
10848 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
10849 !! input
10850 <pre dir="&#10;"></pre>
10851 !! result
10852 <pre dir="&#10;"></pre>
10853
10854 !! end
10855
10856 !! test
10857 Parsing optional HTML elements (Bug 6171)
10858 !! options
10859 !! input
10860 <table>
10861 <tr>
10862 <td> Some tabular data</td>
10863 <td> More tabular data ...
10864 <td> And yet som tabular data</td>
10865 </tr>
10866 </table>
10867 !! result
10868 <table>
10869 <tr>
10870 <td> Some tabular data</td>
10871 <td> More tabular data ...
10872 </td><td> And yet som tabular data</td>
10873 </tr>
10874 </table>
10875
10876 !! end
10877
10878 !! test
10879 Correct handling of <td>, <tr> (Bug 6171)
10880 !! options
10881 !! input
10882 <table>
10883 <tr>
10884 <td> Some tabular data</td>
10885 <td> More tabular data ...</td>
10886 <td> And yet som tabular data</td>
10887 </tr>
10888 </table>
10889 !! result
10890 <table>
10891 <tr>
10892 <td> Some tabular data</td>
10893 <td> More tabular data ...</td>
10894 <td> And yet som tabular data</td>
10895 </tr>
10896 </table>
10897
10898 !! end
10899
10900
10901 !! test
10902 Parsing crashing regression (fr:JavaScript)
10903 !! input
10904 </body></x>
10905 !! result
10906 <p>&lt;/body&gt;&lt;/x&gt;
10907 </p>
10908 !! end
10909
10910 !! test
10911 Inline wiki vs wiki block nesting
10912 !! input
10913 '''Bold paragraph
10914
10915 New wiki paragraph
10916 !! result
10917 <p><b>Bold paragraph</b>
10918 </p><p>New wiki paragraph
10919 </p>
10920 !! end
10921
10922 !! test
10923 Inline HTML vs wiki block nesting
10924 !! options
10925 disabled
10926 !! input
10927 <b>Bold paragraph
10928
10929 New wiki paragraph
10930 !! result
10931 <p><b>Bold paragraph</b>
10932 </p><p>New wiki paragraph
10933 </p>
10934 !! end
10935
10936 # Original result was this:
10937 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10938 # </p>
10939 # While that might be marginally more intuitive, maybe, the six-apostrophe
10940 # construct is clearly pathological and the result stated here (which is what
10941 # the parser actually does) is about as reasonable as anything.
10942 !!test
10943 Mixing markup for italics and bold
10944 !! options
10945 !! input
10946 '''bold''''''bold''bolditalics'''''
10947 !! result
10948 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
10949 </p>
10950 !! end
10951
10952
10953 !! article
10954 Xyzzyx
10955 !! text
10956 Article for special page transclusion test
10957 !! endarticle
10958
10959 !! test
10960 Special page transclusion
10961 !! options
10962 !! input
10963 {{Special:Prefixindex/Xyzzyx}}
10964 !! result
10965 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10966
10967 !! end
10968
10969 !! test
10970 Special page transclusion twice (bug 5021)
10971 !! options
10972 !! input
10973 {{Special:Prefixindex/Xyzzyx}}
10974 {{Special:Prefixindex/Xyzzyx}}
10975 !! result
10976 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10977 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10978
10979 !! end
10980
10981 !! test
10982 Transclusion of default MediaWiki message
10983 !! input
10984 {{MediaWiki:Mainpage}}
10985 !!result
10986 <p>Main Page
10987 </p>
10988 !! end
10989
10990 !! test
10991 Transclusion of nonexistent MediaWiki message
10992 !! input
10993 {{MediaWiki:Mainpagexxx}}
10994 !!result
10995 <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>
10996 </p>
10997 !! end
10998
10999 !! test
11000 Transclusion of MediaWiki message with underscore
11001 !! input
11002 {{MediaWiki:history_short}}
11003 !! result
11004 <p>History
11005 </p>
11006 !! end
11007
11008 !! test
11009 Transclusion of MediaWiki message with space
11010 !! input
11011 {{MediaWiki:history short}}
11012 !! result
11013 <p>History
11014 </p>
11015 !! end
11016
11017 !! test
11018 Invalid header with following text
11019 !! input
11020 = x = y
11021 !! result
11022 <p>= x = y
11023 </p>
11024 !! end
11025
11026
11027 !! test
11028 Section extraction test (section 0)
11029 !! options
11030 section=0
11031 !! input
11032 start
11033 ==a==
11034 ===aa===
11035 ====aaa====
11036 ==b==
11037 ===ba===
11038 ===bb===
11039 ====bba====
11040 ===bc===
11041 ==c==
11042 ===ca===
11043 !! result
11044 start
11045 !! end
11046
11047 !! test
11048 Section extraction test (section 1)
11049 !! options
11050 section=1
11051 !! input
11052 start
11053 ==a==
11054 ===aa===
11055 ====aaa====
11056 ==b==
11057 ===ba===
11058 ===bb===
11059 ====bba====
11060 ===bc===
11061 ==c==
11062 ===ca===
11063 !! result
11064 ==a==
11065 ===aa===
11066 ====aaa====
11067 !! end
11068
11069 !! test
11070 Section extraction test (section 2)
11071 !! options
11072 section=2
11073 !! input
11074 start
11075 ==a==
11076 ===aa===
11077 ====aaa====
11078 ==b==
11079 ===ba===
11080 ===bb===
11081 ====bba====
11082 ===bc===
11083 ==c==
11084 ===ca===
11085 !! result
11086 ===aa===
11087 ====aaa====
11088 !! end
11089
11090 !! test
11091 Section extraction test (section 3)
11092 !! options
11093 section=3
11094 !! input
11095 start
11096 ==a==
11097 ===aa===
11098 ====aaa====
11099 ==b==
11100 ===ba===
11101 ===bb===
11102 ====bba====
11103 ===bc===
11104 ==c==
11105 ===ca===
11106 !! result
11107 ====aaa====
11108 !! end
11109
11110 !! test
11111 Section extraction test (section 4)
11112 !! options
11113 section=4
11114 !! input
11115 start
11116 ==a==
11117 ===aa===
11118 ====aaa====
11119 ==b==
11120 ===ba===
11121 ===bb===
11122 ====bba====
11123 ===bc===
11124 ==c==
11125 ===ca===
11126 !! result
11127 ==b==
11128 ===ba===
11129 ===bb===
11130 ====bba====
11131 ===bc===
11132 !! end
11133
11134 !! test
11135 Section extraction test (section 5)
11136 !! options
11137 section=5
11138 !! input
11139 start
11140 ==a==
11141 ===aa===
11142 ====aaa====
11143 ==b==
11144 ===ba===
11145 ===bb===
11146 ====bba====
11147 ===bc===
11148 ==c==
11149 ===ca===
11150 !! result
11151 ===ba===
11152 !! end
11153
11154 !! test
11155 Section extraction test (section 6)
11156 !! options
11157 section=6
11158 !! input
11159 start
11160 ==a==
11161 ===aa===
11162 ====aaa====
11163 ==b==
11164 ===ba===
11165 ===bb===
11166 ====bba====
11167 ===bc===
11168 ==c==
11169 ===ca===
11170 !! result
11171 ===bb===
11172 ====bba====
11173 !! end
11174
11175 !! test
11176 Section extraction test (section 7)
11177 !! options
11178 section=7
11179 !! input
11180 start
11181 ==a==
11182 ===aa===
11183 ====aaa====
11184 ==b==
11185 ===ba===
11186 ===bb===
11187 ====bba====
11188 ===bc===
11189 ==c==
11190 ===ca===
11191 !! result
11192 ====bba====
11193 !! end
11194
11195 !! test
11196 Section extraction test (section 8)
11197 !! options
11198 section=8
11199 !! input
11200 start
11201 ==a==
11202 ===aa===
11203 ====aaa====
11204 ==b==
11205 ===ba===
11206 ===bb===
11207 ====bba====
11208 ===bc===
11209 ==c==
11210 ===ca===
11211 !! result
11212 ===bc===
11213 !! end
11214
11215 !! test
11216 Section extraction test (section 9)
11217 !! options
11218 section=9
11219 !! input
11220 start
11221 ==a==
11222 ===aa===
11223 ====aaa====
11224 ==b==
11225 ===ba===
11226 ===bb===
11227 ====bba====
11228 ===bc===
11229 ==c==
11230 ===ca===
11231 !! result
11232 ==c==
11233 ===ca===
11234 !! end
11235
11236 !! test
11237 Section extraction test (section 10)
11238 !! options
11239 section=10
11240 !! input
11241 start
11242 ==a==
11243 ===aa===
11244 ====aaa====
11245 ==b==
11246 ===ba===
11247 ===bb===
11248 ====bba====
11249 ===bc===
11250 ==c==
11251 ===ca===
11252 !! result
11253 ===ca===
11254 !! end
11255
11256 !! test
11257 Section extraction test (nonexistent section 11)
11258 !! options
11259 section=11
11260 !! input
11261 start
11262 ==a==
11263 ===aa===
11264 ====aaa====
11265 ==b==
11266 ===ba===
11267 ===bb===
11268 ====bba====
11269 ===bc===
11270 ==c==
11271 ===ca===
11272 !! result
11273 !! end
11274
11275 !! test
11276 Section extraction test with bogus heading (section 1)
11277 !! options
11278 section=1
11279 !! input
11280 ==a==
11281 ==bogus== not a legal section
11282 ==b==
11283 !! result
11284 ==a==
11285 ==bogus== not a legal section
11286 !! end
11287
11288 !! test
11289 Section extraction test with bogus heading (section 2)
11290 !! options
11291 section=2
11292 !! input
11293 ==a==
11294 ==bogus== not a legal section
11295 ==b==
11296 !! result
11297 ==b==
11298 !! end
11299
11300 !! test
11301 Section extraction test with comment after heading (section 1)
11302 !! options
11303 section=1
11304 !! input
11305 ==a==
11306 ==b== <!-- -->
11307 ==c==
11308 !! result
11309 ==a==
11310 !! end
11311
11312 !! test
11313 Section extraction test with comment after heading (section 2)
11314 !! options
11315 section=2
11316 !! input
11317 ==a==
11318 ==b== <!-- -->
11319 ==c==
11320 !! result
11321 ==b== <!-- -->
11322 !! end
11323
11324 !! test
11325 Section extraction test with bogus <nowiki> heading (section 1)
11326 !! options
11327 section=1
11328 !! input
11329 ==a==
11330 ==bogus== <nowiki>not a legal section</nowiki>
11331 ==b==
11332 !! result
11333 ==a==
11334 ==bogus== <nowiki>not a legal section</nowiki>
11335 !! end
11336
11337 !! test
11338 Section extraction test with bogus <nowiki> heading (section 2)
11339 !! options
11340 section=2
11341 !! input
11342 ==a==
11343 ==bogus== <nowiki>not a legal section</nowiki>
11344 ==b==
11345 !! result
11346 ==b==
11347 !! end
11348
11349
11350 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
11351 # instead of respecting commented sections
11352 !! test
11353 Section extraction prefixed by comment (section 1)
11354 !! options
11355 section=1
11356 !! input
11357 <!-- -->==sec1==
11358 ==sec2==
11359 !!result
11360 ==sec2==
11361 !!end
11362
11363 !! test
11364 Section extraction prefixed by comment (section 2)
11365 !! options
11366 section=2
11367 !! input
11368 <!-- -->==sec1==
11369 ==sec2==
11370 !!result
11371
11372 !!end
11373
11374
11375 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
11376 # instead of respecting HTML-style headings
11377 !! test
11378 Section extraction, mixed wiki and html (section 1)
11379 !! options
11380 section=1
11381 !! input
11382 <h2>unmarked</h2>
11383 unmarked
11384 ==1==
11385 one
11386 ==2==
11387 two
11388 !! result
11389 ==1==
11390 one
11391 !! end
11392
11393 !! test
11394 Section extraction, mixed wiki and html (section 2)
11395 !! options
11396 section=2
11397 !! input
11398 <h2>unmarked</h2>
11399 unmarked
11400 ==1==
11401 one
11402 ==2==
11403 two
11404 !! result
11405 ==2==
11406 two
11407 !! end
11408
11409
11410 # Formerly testing for bug 3342
11411 !! test
11412 Section extraction, heading surrounded by <noinclude>
11413 !! options
11414 section=1
11415 !! input
11416 <noinclude>==unmarked==</noinclude>
11417 ==marked==
11418 !! result
11419 ==marked==
11420 !!end
11421
11422 # Test behavior of bug 19910
11423 !! test
11424 Sectiion with all-equals
11425 !! options
11426 section=2
11427 !! input
11428 ===
11429 The line above must have a trailing space
11430 === <!--
11431 --> <!-- -->
11432 But just in case it doesn't...
11433 !! result
11434 === <!--
11435 --> <!-- -->
11436 But just in case it doesn't...
11437 !! end
11438
11439 !! test
11440 Section replacement test (section 0)
11441 !! options
11442 replace=0,"xxx"
11443 !! input
11444 start
11445 ==a==
11446 ===aa===
11447 ====aaa====
11448 ==b==
11449 ===ba===
11450 ===bb===
11451 ====bba====
11452 ===bc===
11453 ==c==
11454 ===ca===
11455 !! result
11456 xxx
11457
11458 ==a==
11459 ===aa===
11460 ====aaa====
11461 ==b==
11462 ===ba===
11463 ===bb===
11464 ====bba====
11465 ===bc===
11466 ==c==
11467 ===ca===
11468 !! end
11469
11470 !! test
11471 Section replacement test (section 1)
11472 !! options
11473 replace=1,"xxx"
11474 !! input
11475 start
11476 ==a==
11477 ===aa===
11478 ====aaa====
11479 ==b==
11480 ===ba===
11481 ===bb===
11482 ====bba====
11483 ===bc===
11484 ==c==
11485 ===ca===
11486 !! result
11487 start
11488 xxx
11489
11490 ==b==
11491 ===ba===
11492 ===bb===
11493 ====bba====
11494 ===bc===
11495 ==c==
11496 ===ca===
11497 !! end
11498
11499 !! test
11500 Section replacement test (section 2)
11501 !! options
11502 replace=2,"xxx"
11503 !! input
11504 start
11505 ==a==
11506 ===aa===
11507 ====aaa====
11508 ==b==
11509 ===ba===
11510 ===bb===
11511 ====bba====
11512 ===bc===
11513 ==c==
11514 ===ca===
11515 !! result
11516 start
11517 ==a==
11518 xxx
11519
11520 ==b==
11521 ===ba===
11522 ===bb===
11523 ====bba====
11524 ===bc===
11525 ==c==
11526 ===ca===
11527 !! end
11528
11529 !! test
11530 Section replacement test (section 3)
11531 !! options
11532 replace=3,"xxx"
11533 !! input
11534 start
11535 ==a==
11536 ===aa===
11537 ====aaa====
11538 ==b==
11539 ===ba===
11540 ===bb===
11541 ====bba====
11542 ===bc===
11543 ==c==
11544 ===ca===
11545 !! result
11546 start
11547 ==a==
11548 ===aa===
11549 xxx
11550
11551 ==b==
11552 ===ba===
11553 ===bb===
11554 ====bba====
11555 ===bc===
11556 ==c==
11557 ===ca===
11558 !! end
11559
11560 !! test
11561 Section replacement test (section 4)
11562 !! options
11563 replace=4,"xxx"
11564 !! input
11565 start
11566 ==a==
11567 ===aa===
11568 ====aaa====
11569 ==b==
11570 ===ba===
11571 ===bb===
11572 ====bba====
11573 ===bc===
11574 ==c==
11575 ===ca===
11576 !! result
11577 start
11578 ==a==
11579 ===aa===
11580 ====aaa====
11581 xxx
11582
11583 ==c==
11584 ===ca===
11585 !! end
11586
11587 !! test
11588 Section replacement test (section 5)
11589 !! options
11590 replace=5,"xxx"
11591 !! input
11592 start
11593 ==a==
11594 ===aa===
11595 ====aaa====
11596 ==b==
11597 ===ba===
11598 ===bb===
11599 ====bba====
11600 ===bc===
11601 ==c==
11602 ===ca===
11603 !! result
11604 start
11605 ==a==
11606 ===aa===
11607 ====aaa====
11608 ==b==
11609 xxx
11610
11611 ===bb===
11612 ====bba====
11613 ===bc===
11614 ==c==
11615 ===ca===
11616 !! end
11617
11618 !! test
11619 Section replacement test (section 6)
11620 !! options
11621 replace=6,"xxx"
11622 !! input
11623 start
11624 ==a==
11625 ===aa===
11626 ====aaa====
11627 ==b==
11628 ===ba===
11629 ===bb===
11630 ====bba====
11631 ===bc===
11632 ==c==
11633 ===ca===
11634 !! result
11635 start
11636 ==a==
11637 ===aa===
11638 ====aaa====
11639 ==b==
11640 ===ba===
11641 xxx
11642
11643 ===bc===
11644 ==c==
11645 ===ca===
11646 !! end
11647
11648 !! test
11649 Section replacement test (section 7)
11650 !! options
11651 replace=7,"xxx"
11652 !! input
11653 start
11654 ==a==
11655 ===aa===
11656 ====aaa====
11657 ==b==
11658 ===ba===
11659 ===bb===
11660 ====bba====
11661 ===bc===
11662 ==c==
11663 ===ca===
11664 !! result
11665 start
11666 ==a==
11667 ===aa===
11668 ====aaa====
11669 ==b==
11670 ===ba===
11671 ===bb===
11672 xxx
11673
11674 ===bc===
11675 ==c==
11676 ===ca===
11677 !! end
11678
11679 !! test
11680 Section replacement test (section 8)
11681 !! options
11682 replace=8,"xxx"
11683 !! input
11684 start
11685 ==a==
11686 ===aa===
11687 ====aaa====
11688 ==b==
11689 ===ba===
11690 ===bb===
11691 ====bba====
11692 ===bc===
11693 ==c==
11694 ===ca===
11695 !! result
11696 start
11697 ==a==
11698 ===aa===
11699 ====aaa====
11700 ==b==
11701 ===ba===
11702 ===bb===
11703 ====bba====
11704 xxx
11705
11706 ==c==
11707 ===ca===
11708 !!end
11709
11710 !! test
11711 Section replacement test (section 9)
11712 !! options
11713 replace=9,"xxx"
11714 !! input
11715 start
11716 ==a==
11717 ===aa===
11718 ====aaa====
11719 ==b==
11720 ===ba===
11721 ===bb===
11722 ====bba====
11723 ===bc===
11724 ==c==
11725 ===ca===
11726 !! result
11727 start
11728 ==a==
11729 ===aa===
11730 ====aaa====
11731 ==b==
11732 ===ba===
11733 ===bb===
11734 ====bba====
11735 ===bc===
11736 xxx
11737 !! end
11738
11739 !! test
11740 Section replacement test (section 10)
11741 !! options
11742 replace=10,"xxx"
11743 !! input
11744 start
11745 ==a==
11746 ===aa===
11747 ====aaa====
11748 ==b==
11749 ===ba===
11750 ===bb===
11751 ====bba====
11752 ===bc===
11753 ==c==
11754 ===ca===
11755 !! result
11756 start
11757 ==a==
11758 ===aa===
11759 ====aaa====
11760 ==b==
11761 ===ba===
11762 ===bb===
11763 ====bba====
11764 ===bc===
11765 ==c==
11766 xxx
11767 !! end
11768
11769 !! test
11770 Section replacement test with initial whitespace (bug 13728)
11771 !! options
11772 replace=2,"xxx"
11773 !! input
11774 Preformatted initial line
11775 ==a==
11776 ===a===
11777 !! result
11778 Preformatted initial line
11779 ==a==
11780 xxx
11781 !! end
11782
11783
11784 !! test
11785 Section extraction, heading followed by pre with 20 spaces (bug 6398)
11786 !! options
11787 section=1
11788 !! input
11789 ==a==
11790 a
11791 !! result
11792 ==a==
11793 a
11794 !! end
11795
11796 !! test
11797 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
11798 !! options
11799 section=1
11800 !! input
11801 ==a==
11802 a
11803 !! result
11804 ==a==
11805 a
11806 !! end
11807
11808
11809 !! test
11810 Section extraction, <pre> around bogus header (bug 10309)
11811 !! options
11812 noxml section=2
11813 !! input
11814 == Section One ==
11815 <pre>
11816 =======
11817 </pre>
11818
11819 == Section Two ==
11820 stuff
11821 !! result
11822 == Section Two ==
11823 stuff
11824 !! end
11825
11826 !! test
11827 Section replacement, <pre> around bogus header (bug 10309)
11828 !! options
11829 noxml replace=2,"xxx"
11830 !! input
11831 == Section One ==
11832 <pre>
11833 =======
11834 </pre>
11835
11836 == Section Two ==
11837 stuff
11838 !! result
11839 == Section One ==
11840 <pre>
11841 =======
11842 </pre>
11843
11844 xxx
11845 !! end
11846
11847
11848
11849 !! test
11850 Handling of &#x0A; in URLs
11851 !! input
11852 **irc://&#x0A;a
11853 !! result
11854 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
11855 </li></ul>
11856 </li></ul>
11857
11858 !!end
11859
11860 !! test
11861 5 quotes, code coverage +1 line (php)
11862 !! options
11863 php
11864 !! input
11865 '''''
11866 !! result
11867 !! end
11868 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
11869 !! test
11870 5 quotes, code coverage +1 line (parsoid)
11871 !! options
11872 parsoid
11873 !! input
11874 '''''
11875 !! result
11876 <p><i><b></b></i></p>
11877 !! end
11878
11879 !! test
11880 Special:Search page linking.
11881 !! input
11882 {{Special:search}}
11883 !! result
11884 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
11885 </p>
11886 !! end
11887
11888 !! test
11889 Say the magic word
11890 !! input
11891 * {{PAGENAME}}
11892 * {{BASEPAGENAME}}
11893 * {{SUBPAGENAME}}
11894 * {{SUBPAGENAMEE}}
11895 * {{ROOTPAGENAME}}
11896 * {{ROOTPAGENAMEE}}
11897 * {{BASEPAGENAME}}
11898 * {{BASEPAGENAMEE}}
11899 * {{TALKPAGENAME}}
11900 * {{TALKPAGENAMEE}}
11901 * {{SUBJECTPAGENAME}}
11902 * {{SUBJECTPAGENAMEE}}
11903 * {{NAMESPACEE}}
11904 * {{NAMESPACE}}
11905 * {{TALKSPACE}}
11906 * {{TALKSPACEE}}
11907 * {{SUBJECTSPACE}}
11908 * {{SUBJECTSPACEE}}
11909 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
11910 !! result
11911 <ul><li> Parser test
11912 </li><li> Parser test
11913 </li><li> Parser test
11914 </li><li> Parser_test
11915 </li><li> Parser test
11916 </li><li> Parser_test
11917 </li><li> Parser test
11918 </li><li> Parser_test
11919 </li><li> Talk:Parser test
11920 </li><li> Talk:Parser_test
11921 </li><li> Parser test
11922 </li><li> Parser_test
11923 </li><li>
11924 </li><li>
11925 </li><li> Talk
11926 </li><li> Talk
11927 </li><li>
11928 </li><li>
11929 </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>
11930 </li></ul>
11931
11932 !! end
11933 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
11934
11935 !! test
11936 Gallery
11937 !! input
11938 <gallery>
11939 image1.png |
11940 image2.gif|||||
11941
11942 image3|
11943 image4 |300px| centre
11944 image5.svg| http://///////
11945 [[x|xx]]]]
11946 * image6
11947 </gallery>
11948 !! result
11949 <ul class="gallery">
11950 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11951 <div style="height: 150px;">Image1.png</div>
11952 <div class="gallerytext">
11953 </div>
11954 </div></li>
11955 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11956 <div style="height: 150px;">Image2.gif</div>
11957 <div class="gallerytext">
11958 <p>||||
11959 </p>
11960 </div>
11961 </div></li>
11962 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11963 <div style="height: 150px;">Image3</div>
11964 <div class="gallerytext">
11965 </div>
11966 </div></li>
11967 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11968 <div style="height: 150px;">Image4</div>
11969 <div class="gallerytext">
11970 <p>300px| centre
11971 </p>
11972 </div>
11973 </div></li>
11974 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11975 <div style="height: 150px;">Image5.svg</div>
11976 <div class="gallerytext">
11977 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
11978 </p>
11979 </div>
11980 </div></li>
11981 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11982 <div style="height: 150px;">* image6</div>
11983 <div class="gallerytext">
11984 </div>
11985 </div></li>
11986 </ul>
11987
11988 !! end
11989
11990 !! test
11991 Gallery (with options)
11992 !! input
11993 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
11994 File:Nonexistant.jpg|caption
11995 File:Nonexistant.jpg
11996 image:foobar.jpg|some '''caption''' [[Main Page]]
11997 image:foobar.jpg
11998 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
11999 </gallery>
12000 !! result
12001 <ul class="gallery" style="max-width: 226px;_width: 226px;">
12002 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
12003 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12004 <div style="height: 70px;">Nonexistant.jpg</div>
12005 <div class="gallerytext">
12006 <p>caption
12007 </p>
12008 </div>
12009 </div></li>
12010 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12011 <div style="height: 70px;">Nonexistant.jpg</div>
12012 <div class="gallerytext">
12013 </div>
12014 </div></li>
12015 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12016 <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>
12017 <div class="gallerytext">
12018 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12019 </p>
12020 </div>
12021 </div></li>
12022 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12023 <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>
12024 <div class="gallerytext">
12025 </div>
12026 </div></li>
12027 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12028 <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>
12029 <div class="gallerytext">
12030 <p>Blabla|blabla.
12031 </p>
12032 </div>
12033 </div></li>
12034 </ul>
12035
12036 !! end
12037
12038 !! test
12039 Gallery with wikitext inside caption
12040 !! input
12041 <gallery>
12042 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
12043 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
12044 </gallery>
12045 !! result
12046 <ul class="gallery">
12047 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12048 <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>
12049 <div class="gallerytext">
12050 <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>
12051 </p>
12052 </div>
12053 </div></li>
12054 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12055 <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>
12056 <div class="gallerytext">
12057 <p>This is a test template
12058 </p>
12059 </div>
12060 </div></li>
12061 </ul>
12062
12063 !! end
12064
12065 !! test
12066 gallery (with showfilename option)
12067 !! input
12068 <gallery showfilename>
12069 File:Nonexistant.jpg|caption
12070 File:Nonexistant.jpg
12071 image:foobar.jpg|some '''caption''' [[Main Page]]
12072 File:Foobar.jpg
12073 </gallery>
12074 !! result
12075 <ul class="gallery">
12076 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12077 <div style="height: 150px;">Nonexistant.jpg</div>
12078 <div class="gallerytext">
12079 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12080 caption
12081 </p>
12082 </div>
12083 </div></li>
12084 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12085 <div style="height: 150px;">Nonexistant.jpg</div>
12086 <div class="gallerytext">
12087 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12088 </p>
12089 </div>
12090 </div></li>
12091 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12092 <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>
12093 <div class="gallerytext">
12094 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12095 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12096 </p>
12097 </div>
12098 </div></li>
12099 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12100 <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>
12101 <div class="gallerytext">
12102 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12103 </p>
12104 </div>
12105 </div></li>
12106 </ul>
12107
12108 !! end
12109
12110 !! test
12111 Gallery (with namespace-less filenames)
12112 !! input
12113 <gallery>
12114 File:Nonexistant.jpg
12115 Nonexistant.jpg
12116 image:foobar.jpg
12117 foobar.jpg
12118 </gallery>
12119 !! result
12120 <ul class="gallery">
12121 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12122 <div style="height: 150px;">Nonexistant.jpg</div>
12123 <div class="gallerytext">
12124 </div>
12125 </div></li>
12126 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12127 <div style="height: 150px;">Nonexistant.jpg</div>
12128 <div class="gallerytext">
12129 </div>
12130 </div></li>
12131 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12132 <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>
12133 <div class="gallerytext">
12134 </div>
12135 </div></li>
12136 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12137 <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>
12138 <div class="gallerytext">
12139 </div>
12140 </div></li>
12141 </ul>
12142
12143 !! end
12144
12145 !! test
12146 HTML Hex character encoding (spells the word "JavaScript")
12147 !! input
12148 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
12149 !! result
12150 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
12151 </p>
12152 !! end
12153
12154 !! test
12155 HTML Hex character encoding bogus encoding (bug 26437 regression check)
12156 !! input
12157 &#xsee;&#XSEE;
12158 !! result
12159 <p>&amp;#xsee;&amp;#XSEE;
12160 </p>
12161 !! end
12162
12163 !! test
12164 HTML Hex character encoding mixed case
12165 !! input
12166 &#xEE;&#Xee;
12167 !! result
12168 <p>&#xee;&#xee;
12169 </p>
12170 !! end
12171
12172 !! test
12173 __FORCETOC__ override
12174 !! input
12175 __NEWSECTIONLINK__
12176 __FORCETOC__
12177 !! result
12178 <p><br />
12179 </p>
12180 !! end
12181
12182 !! test
12183 ISBN code coverage
12184 !! input
12185 ISBN 978-0-1234-56&#x20;789
12186 !! result
12187 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
12188 </p>
12189 !! end
12190
12191 !! test
12192 ISBN followed by 5 spaces
12193 !! input
12194 ISBN
12195 !! result
12196 <p>ISBN
12197 </p>
12198 !! end
12199
12200 !! test
12201 Double ISBN
12202 !! input
12203 ISBN ISBN 1234567890
12204 !! result
12205 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12206 </p>
12207 !! end
12208
12209 !! test
12210 Bug 22905: <abbr> followed by ISBN followed by </a>
12211 !! input
12212 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
12213 !! result
12214 <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>
12215 </p>
12216 !! end
12217
12218 !! test
12219 Double RFC
12220 !! input
12221 RFC RFC 1234
12222 !! result
12223 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
12224 </p>
12225 !! end
12226
12227 !! test
12228 Double RFC with a wiki link
12229 !! input
12230 RFC [[RFC 1234]]
12231 !! result
12232 <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>
12233 </p>
12234 !! end
12235
12236 !! test
12237 RFC code coverage
12238 !! input
12239 RFC 983&#x20;987
12240 !! result
12241 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
12242 </p>
12243 !! end
12244
12245 !! test
12246 Centre-aligned image
12247 !! input
12248 [[Image:foobar.jpg|centre]]
12249 !! result
12250 <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>
12251
12252 !!end
12253
12254 !! test
12255 None-aligned image
12256 !! input
12257 [[Image:foobar.jpg|none]]
12258 !! result
12259 <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>
12260
12261 !!end
12262
12263 !! test
12264 Width + Height sized image (using px) (height is ignored)
12265 !! input
12266 [[Image:foobar.jpg|640x480px]]
12267 !! result
12268 <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>
12269 </p>
12270 !!end
12271
12272 !! test
12273 Width-sized image (using px, no following whitespace)
12274 !! input
12275 [[Image:foobar.jpg|640px]]
12276 !! result
12277 <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>
12278 </p>
12279 !!end
12280
12281 !! test
12282 Width-sized image (using px, with following whitespace - test regression from r39467)
12283 !! input
12284 [[Image:foobar.jpg|640px ]]
12285 !! result
12286 <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>
12287 </p>
12288 !!end
12289
12290 !! test
12291 Width-sized image (using px, with preceding whitespace - test regression from r39467)
12292 !! input
12293 [[Image:foobar.jpg| 640px]]
12294 !! result
12295 <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>
12296 </p>
12297 !!end
12298
12299 !! test
12300 Another italics / bold test
12301 !! input
12302 ''' ''x'
12303 !! result
12304 <pre>'<i> </i>x'
12305 </pre>
12306 !!end
12307
12308 # Note the results may be incorrect, as parserTest output included this:
12309 # XML error: Mismatched tag at byte 6120:
12310 # ...<dd> </dt></dl> </dd...
12311 !! test
12312 dt/dd/dl test
12313 !! options
12314 disabled
12315 !! input
12316 :;;;::
12317 !! result
12318 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
12319 </dd></dl>
12320 </dd></dl>
12321 </dt></dl>
12322 </dt></dl>
12323 </dt></dl>
12324 </dd></dl>
12325
12326 !!end
12327
12328
12329 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
12330 !! test
12331 Images with the "|" character in the comment
12332 !! input
12333 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
12334 !! result
12335 <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>
12336
12337 !!end
12338
12339 !! test
12340 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
12341 !! input
12342 <html><script>alert(1);</script></html>
12343 !! result
12344 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
12345 </p>
12346 !! end
12347
12348 !! test
12349 HTML with raw HTML ($wgRawHtml==true)
12350 !! options
12351 wgRawHtml=1
12352 !! input
12353 <html><script>alert(1);</script></html>
12354 !! result
12355 <p><script>alert(1);</script>
12356 </p>
12357 !! end
12358
12359 !! test
12360 Parents of subpages, one level up
12361 !! options
12362 subpage title=[[Subpage test/L1/L2/L3]]
12363 !! input
12364 [[../|L2]]
12365 !! result
12366 <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>
12367 </p>
12368 !! end
12369
12370
12371 !! test
12372 Parents of subpages, one level up, not named
12373 !! options
12374 subpage title=[[Subpage test/L1/L2/L3]]
12375 !! input
12376 [[../]]
12377 !! result
12378 <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>
12379 </p>
12380 !! end
12381
12382
12383
12384 !! test
12385 Parents of subpages, two levels up
12386 !! options
12387 subpage title=[[Subpage test/L1/L2/L3]]
12388 !! input
12389 [[../../|L1]]2
12390
12391 [[../../|L1]]l
12392 !! result
12393 <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
12394 </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>
12395 </p>
12396 !! end
12397
12398 !! test
12399 Parents of subpages, two levels up, without trailing slash or name.
12400 !! options
12401 subpage title=[[Subpage test/L1/L2/L3]]
12402 !! input
12403 [[../..]]
12404 !! result
12405 <p>[[../..]]
12406 </p>
12407 !! end
12408
12409 !! test
12410 Parents of subpages, two levels up, with lots of extra trailing slashes.
12411 !! options
12412 subpage title=[[Subpage test/L1/L2/L3]]
12413 !! input
12414 [[../../////]]
12415 !! result
12416 <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>
12417 </p>
12418 !! end
12419
12420 !! article
12421 Subpage test/L1/L2/L3Sibling
12422 !! text
12423 Sibling article
12424 !! endarticle
12425
12426 !! test
12427 Transclusion of a sibling page (one level up)
12428 !! options
12429 subpage title=[[Subpage test/L1/L2/L3]]
12430 !! input
12431 {{../L3Sibling}}
12432 !! result
12433 <p>Sibling article
12434 </p>
12435 !! end
12436
12437 !! test
12438 Transclusion of a child page
12439 !! options
12440 subpage title=[[Subpage test/L1/L2]]
12441 !! input
12442 {{/L3Sibling}}
12443 !! result
12444 <p>Sibling article
12445 </p>
12446 !! end
12447
12448 !! test
12449 Non-transclusion because of too many up levels
12450 !! options
12451 subpage title=[[Subpage test/L1/L2/L3]]
12452 !! input
12453 {{../../../../More than parent}}
12454 !! result
12455 <p>{{../../../../More than parent}}
12456 </p>
12457 !! end
12458
12459 !! test
12460 Definition list code coverage
12461 !! input
12462 ; title : def
12463 ; title : def
12464 ;title: def
12465 !! result
12466 <dl><dt> title &#160;</dt><dd> def
12467 </dd><dt> title&#160;</dt><dd> def
12468 </dd><dt>title</dt><dd> def
12469 </dd></dl>
12470
12471 !! end
12472
12473 !! test
12474 Don't fall for the self-closing div
12475 !! input
12476 <div>hello world</div/>
12477 !! result
12478 <div>hello world</div>
12479
12480 !! end
12481
12482 !! test
12483 MSGNW magic word
12484 !! input
12485 {{MSGNW:msg}}
12486 !! result
12487 <p>&#91;&#91;:Template:Msg&#93;&#93;
12488 </p>
12489 !! end
12490
12491 !! test
12492 RAW magic word
12493 !! input
12494 {{RAW:QUERTY}}
12495 !! result
12496 <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>
12497 </p>
12498 !! end
12499
12500 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
12501 !! test
12502 Always escape literal '>' in output, not just after '<'
12503 !! input
12504 ><>
12505 !! result
12506 <p>&gt;&lt;&gt;
12507 </p>
12508 !! end
12509
12510 !! test
12511 Template caching
12512 !! input
12513 {{Test}}
12514 {{Test}}
12515 !! result
12516 <p>This is a test template
12517 This is a test template
12518 </p>
12519 !! end
12520
12521
12522 !! article
12523 MediaWiki:Fake
12524 !! text
12525 ==header==
12526 !! endarticle
12527
12528 !! test
12529 Inclusion of !userCanEdit() content
12530 !! input
12531 {{MediaWiki:Fake}}
12532 !! result
12533 <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>
12534
12535 !! end
12536
12537
12538 !! test
12539 Out-of-order TOC heading levels
12540 !! input
12541 ==2==
12542 ======6======
12543 ===3===
12544 =1=
12545 =====5=====
12546 ==2==
12547 !! result
12548 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12549 <ul>
12550 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
12551 <ul>
12552 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
12553 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
12554 </ul>
12555 </li>
12556 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
12557 <ul>
12558 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
12559 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
12560 </ul>
12561 </li>
12562 </ul>
12563 </div>
12564 <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>
12565 <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>
12566 <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>
12567 <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>
12568 <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>
12569 <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>
12570
12571 !! end
12572
12573
12574 !! test
12575 ISBN with a dummy number
12576 !! input
12577 ISBN ---
12578 !! result
12579 <p>ISBN ---
12580 </p>
12581 !! end
12582
12583
12584 !! test
12585 ISBN with space-delimited number
12586 !! input
12587 ISBN 92 9017 032 8
12588 !! result
12589 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
12590 </p>
12591 !! end
12592
12593
12594 !! test
12595 ISBN with multiple spaces, no number
12596 !! input
12597 ISBN foo
12598 !! result
12599 <p>ISBN foo
12600 </p>
12601 !! end
12602
12603
12604 !! test
12605 ISBN length
12606 !! input
12607 ISBN 123456789
12608
12609 ISBN 1234567890
12610
12611 ISBN 12345678901
12612 !! result
12613 <p>ISBN 123456789
12614 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12615 </p><p>ISBN 12345678901
12616 </p>
12617 !! end
12618
12619
12620 !! test
12621 ISBN with trailing year (bug 8110)
12622 !! input
12623 ISBN 1-234-56789-0 - 2006
12624
12625 ISBN 1 234 56789 0 - 2006
12626 !! result
12627 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
12628 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
12629 </p>
12630 !! end
12631
12632
12633 !! test
12634 anchorencode
12635 !! input
12636 {{anchorencode:foo bar©#%n}}
12637 !! result
12638 <p>foo_bar.C2.A9.23.25n
12639 </p>
12640 !! end
12641
12642 !! test
12643 anchorencode trims spaces
12644 !! input
12645 {{anchorencode: __pretty__please__}}
12646 !! result
12647 <p>pretty_please
12648 </p>
12649 !! end
12650
12651 !! test
12652 anchorencode deals with links
12653 !! input
12654 {{anchorencode: [[hello|world]] [[hi]]}}
12655 !! result
12656 <p>world_hi
12657 </p>
12658 !! end
12659
12660 !! test
12661 anchorencode deals with templates
12662 !! input
12663 {{anchorencode: {{Foo}} }}
12664 !! result
12665 <p>FOO
12666 </p>
12667 !! end
12668
12669 !! test
12670 anchorencode encodes like the TOC generator: (bug 18431)
12671 !! input
12672 === _ +:.3A%3A&&amp;]] ===
12673 {{anchorencode: _ +:.3A%3A&&amp;]] }}
12674 __NOEDITSECTION__
12675 !! result
12676 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
12677 <p>.2B:.3A.253A.26.26.5D.5D
12678 </p>
12679 !! end
12680
12681 # Expected output in the following test is not necessarily expected (there
12682 # should probably be <p> tags inside the <blockquote> in the output) -- it's
12683 # only testing for well-formedness.
12684 !! test
12685 Bug 6200: blockquotes and paragraph formatting
12686 !! input
12687 <blockquote>
12688 foo
12689 </blockquote>
12690
12691 bar
12692
12693 baz
12694 !! result
12695 <blockquote>
12696 foo
12697 </blockquote>
12698 <p>bar
12699 </p>
12700 <pre>baz
12701 </pre>
12702 !! end
12703
12704 !! test
12705 Bug 8293: Use of center tag ruins paragraph formatting
12706 !! input
12707 <center>
12708 foo
12709 </center>
12710
12711 bar
12712
12713 baz
12714 !! result
12715 <center>
12716 <p>foo
12717 </p>
12718 </center>
12719 <p>bar
12720 </p>
12721 <pre>baz
12722 </pre>
12723 !! end
12724
12725 !!test
12726 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
12727 !!options
12728 php
12729 !!input
12730 <span><s>x</span></s>
12731 !!result
12732 <p><span><s>x&lt;/span&gt;</s></span>
12733 </p>
12734 !!end
12735
12736 !!test
12737 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
12738 !!options
12739 parsoid
12740 !!input
12741 <span><s>x</span></s>
12742 !!result
12743 <p><span><s>x</s></span><s></s>
12744 </p>
12745 !!end
12746
12747 ###
12748 ### Language variants related tests
12749 ###
12750 !! test
12751 Self-link in language variants
12752 !! options
12753 title=[[Dunav]] language=sr
12754 !! input
12755 Both [[Dunav]] and [[Дунав]] are names for this river.
12756 !! result
12757 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
12758 </p>
12759 !!end
12760
12761 !! article
12762 Дуна
12763 !! text
12764 content
12765 !! endarticle
12766
12767 !! test
12768 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
12769 !! options
12770 title=[[Duna]] language=sr
12771 !! input
12772 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
12773 !! result
12774 <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.
12775 </p>
12776 !! end
12777
12778 !! test
12779 Link to pages in language variants
12780 !! options
12781 language=sr
12782 !! input
12783 Main Page can be written as [[Маин Паге]]
12784 !! result
12785 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
12786 </p>
12787 !!end
12788
12789
12790 !! test
12791 Multiple links to pages in language variants
12792 !! options
12793 language=sr
12794 !! input
12795 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
12796 !! result
12797 <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>.
12798 </p>
12799 !!end
12800
12801
12802 !! test
12803 Simple template in language variants
12804 !! options
12805 language=sr
12806 !! input
12807 {{тест}}
12808 !! result
12809 <p>This is a test template
12810 </p>
12811 !! end
12812
12813
12814 !! test
12815 Template with explicit namespace in language variants
12816 !! options
12817 language=sr
12818 !! input
12819 {{Template:тест}}
12820 !! result
12821 <p>This is a test template
12822 </p>
12823 !! end
12824
12825
12826 !! test
12827 Basic test for template parameter in language variants
12828 !! options
12829 language=sr
12830 !! input
12831 {{парамтест|param=foo}}
12832 !! result
12833 <p>This is a test template with parameter foo
12834 </p>
12835 !! end
12836
12837
12838 !! test
12839 Simple category in language variants
12840 !! options
12841 language=sr cat
12842 !! input
12843 [[Category:МедиаWики Усер'с Гуиде]]
12844 !! result
12845 <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>
12846 !! end
12847
12848
12849 !! article
12850 Category:分类
12851 !! text
12852 blah
12853 !! endarticle
12854
12855 !! article
12856 Category:分類
12857 !! text
12858 blah
12859 !! endarticle
12860
12861 !! test
12862 Don't convert blue categorylinks to another variant (bug 33210)
12863 !! options
12864 language=zh cat
12865 !! input
12866 [[A]][[Category:分类]]
12867 !! result
12868 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
12869 !! end
12870
12871
12872 !! test
12873 Stripping -{}- tags (language variants)
12874 !! options
12875 language=sr
12876 !! input
12877 Latin proverb: -{Ne nuntium necare}-
12878 !! result
12879 <p>Latin proverb: Ne nuntium necare
12880 </p>
12881 !! end
12882
12883
12884 !! test
12885 Prevent conversion with -{}- tags (language variants)
12886 !! options
12887 language=sr variant=sr-ec
12888 !! input
12889 Latinski: -{Ne nuntium necare}-
12890 !! result
12891 <p>Латински: Ne nuntium necare
12892 </p>
12893 !! end
12894
12895
12896 !! test
12897 Prevent conversion of text with -{}- tags (language variants)
12898 !! options
12899 language=sr variant=sr-ec
12900 !! input
12901 Latinski: -{Ne nuntium necare}-
12902 !! result
12903 <p>Латински: Ne nuntium necare
12904 </p>
12905 !! end
12906
12907
12908 !! test
12909 Prevent conversion of links with -{}- tags (language variants)
12910 !! options
12911 language=sr variant=sr-ec
12912 !! input
12913 -{[[Main Page]]}-
12914 !! result
12915 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12916 </p>
12917 !! end
12918
12919
12920 !! test
12921 -{}- tags within headlines (within html for parserConvert())
12922 !! options
12923 language=sr variant=sr-ec
12924 !! input
12925 == -{Naslov}- ==
12926 !! result
12927 <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>
12928
12929 !! end
12930
12931
12932 !! test
12933 Explicit definition of language variant alternatives
12934 !! options
12935 language=zh variant=zh-tw
12936 !! input
12937 -{zh:China;zh-tw:Taiwan}-, not China
12938 !! result
12939 <p>Taiwan, not China
12940 </p>
12941 !! end
12942
12943
12944 !! test
12945 Conversion around HTML tags
12946 !! options
12947 language=sr variant=sr-ec
12948 !! input
12949 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
12950 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
12951 !! result
12952 <p>
12953 <span title="ЛаCтин">ски</span>
12954 </p>
12955 !! end
12956
12957
12958 !! test
12959 Explicit session-wise language variant mapping (A flag and - flag)
12960 !! options
12961 language=zh variant=zh-tw
12962 !! input
12963 Taiwan is not China.
12964 But -{A|zh:China;zh-tw:Taiwan}- is China,
12965 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
12966 and -{China}- is China.
12967 !! result
12968 <p>Taiwan is not China.
12969 But Taiwan is Taiwan,
12970 (This should be stripped!)
12971 and China is China.
12972 </p>
12973 !! end
12974
12975 !! test
12976 Explicit session-wise language variant mapping (H flag for hide)
12977 !! options
12978 language=zh variant=zh-tw
12979 !! input
12980 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
12981 Taiwan is China.
12982 !! result
12983 <p>(This should be stripped!)
12984 Taiwan is Taiwan.
12985 </p>
12986 !! end
12987
12988 !! test
12989 Adding explicit conversion rule for title (T flag)
12990 !! options
12991 language=zh variant=zh-tw showtitle
12992 !! input
12993 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12994 !! result
12995 Taiwan
12996 <p>Should be stripped!
12997 </p>
12998 !! end
12999
13000 !! test
13001 Testing that changing the language variant here in the tests actually works
13002 !! options
13003 language=zh variant=zh showtitle
13004 !! input
13005 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13006 !! result
13007 China
13008 <p>Should be stripped!
13009 </p>
13010 !! end
13011
13012 !! test
13013 Recursive conversion of alt and title attrs shouldn't clear converter state
13014 !! options
13015 language=zh variant=zh-cn showtitle
13016 !! input
13017 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
13018 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
13019 !! result
13020 China
13021 <p>
13022 Should be stripped<span title="Exclamation">!</span>
13023 </p>
13024 !! end
13025
13026 !! test
13027 Bug 24072: more test on conversion rule for title
13028 !! options
13029 language=zh variant=zh-tw showtitle
13030 !! input
13031 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13032 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
13033 !! result
13034 Taiwan
13035 <p>This should be stripped!
13036 This won't take interferes with the title rule.
13037 </p>
13038 !! end
13039
13040 !! test
13041 Partly disable title conversion if variant == main language code
13042 !! options
13043 language=zh variant=zh title=[[ZH]] showtitle
13044 !! input
13045 -{T|zh-cn:CN;zh-tw:TW}-
13046 !! result
13047 ZH
13048 <p>
13049 </p>
13050 !! end
13051
13052 !! test
13053 Partly disable title conversion if variant == main language code, more
13054 !! options
13055 language=zh variant=zh title=[[ZH]] showtitle
13056 !! input
13057 -{T|TW}-
13058 !! result
13059 ZH
13060 <p>
13061 </p>
13062 !! end
13063
13064 !! test
13065 Raw output of variant escape tags (R flag)
13066 !! options
13067 language=zh variant=zh-tw
13068 !! input
13069 Raw: -{R|zh:China;zh-tw:Taiwan}-
13070 !! result
13071 <p>Raw: zh:China;zh-tw:Taiwan
13072 </p>
13073 !! end
13074
13075 !! test
13076 Nested using of manual convert syntax
13077 !! options
13078 language=zh variant=zh-hk
13079 !! input
13080 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
13081 !! result
13082 <p>Nested: Hello Hong Kong!
13083 </p>
13084 !! end
13085
13086 !! test
13087 Proper conversion of text in external links
13088 !! options
13089 language=sr variant=sr-ec
13090 !! input
13091 http://www.google.com
13092 gopher://www.google.com
13093 [http://www.google.com http://www.google.com]
13094 [gopher://www.google.com gopher://www.google.com]
13095 [https://www.google.com irc://www.google.com]
13096 [ftp://www.google.com www.google.com/ftp://dir]
13097 [//www.google.com www.google.com]
13098 !! result
13099 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13100 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13101 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13102 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13103 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
13104 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
13105 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
13106 </p>
13107 !! end
13108
13109 !! test
13110 Do not convert roman numbers to language variants
13111 !! options
13112 language=sr variant=sr-ec
13113 !! input
13114 Fridrih IV je car.
13115 !! result
13116 <p>Фридрих IV је цар.
13117 </p>
13118 !! end
13119
13120 !! test
13121 Unclosed language converter markup "-{"
13122 !! options
13123 language=sr
13124 !! input
13125 -{T|hello
13126 !! result
13127 <p>-{T|hello
13128 </p>
13129 !! end
13130
13131 !! test
13132 Don't convert raw rule "-{R|=&gt;}-" to "=>"
13133 !! options
13134 language=sr
13135 !! input
13136 -{R|=&gt;}-
13137 !! result
13138 <p>=&gt;
13139 </p>
13140 !!end
13141
13142 !!article
13143 Template:Bullet
13144 !!text
13145 * Bar
13146 !!endarticle
13147
13148 !! test
13149 Bug 529: Uncovered bullet
13150 !! input
13151 * Foo {{bullet}}
13152 !! result
13153 <ul><li> Foo
13154 </li><li> Bar
13155 </li></ul>
13156
13157 !! end
13158
13159 # Plain MediaWiki does not remove empty lists, but tidy actually does.
13160 # Templates in Wikipedia rely on this behavior, as tidy has always been
13161 # enabled there. These tests are normally run *without* tidy, so specify the
13162 # full output here.
13163 # To test realistic parsing behavior, apply a tidy-like transformation to both
13164 # the expected output and your parser's output.
13165 !! test
13166 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
13167 !! input
13168 ******* Foo {{bullet}}
13169 !! result
13170 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
13171 </li></ul>
13172 </li></ul>
13173 </li></ul>
13174 </li></ul>
13175 </li></ul>
13176 </li></ul>
13177 </li><li> Bar
13178 </li></ul>
13179
13180 !! end
13181
13182 !! test
13183 Bug 529: Uncovered table already at line-start
13184 !! input
13185 x
13186
13187 {{table}}
13188 y
13189 !! result
13190 <p>x
13191 </p>
13192 <table>
13193 <tr>
13194 <td> 1 </td>
13195 <td> 2
13196 </td></tr>
13197 <tr>
13198 <td> 3 </td>
13199 <td> 4
13200 </td></tr></table>
13201 <p>y
13202 </p>
13203 !! end
13204
13205 !! test
13206 Bug 529: Uncovered bullet in parser function result
13207 !! input
13208 * Foo {{lc:{{bullet}} }}
13209 !! result
13210 <ul><li> Foo
13211 </li><li> bar
13212 </li></ul>
13213
13214 !! end
13215
13216 !! test
13217 Bug 5678: Double-parsed template argument
13218 !! input
13219 {{lc:{{{1}}}|hello}}
13220 !! result
13221 <p>{{{1}}}
13222 </p>
13223 !! end
13224
13225 !! test
13226 Bug 5678: Double-parsed template invocation
13227 !! input
13228 {{lc:{{paramtest {{!}} param = hello }} }}
13229 !! result
13230 <p>{{paramtest | param = hello }}
13231 </p>
13232 !! end
13233
13234 !! test
13235 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
13236 !! options
13237 language=cs
13238 title=[[Main Page]]
13239 !! input
13240 {{PRVNÍVELKÉ:ěščř}}
13241 {{prvnívelké:ěščř}}
13242 {{PRVNÍMALÉ:ěščř}}
13243 {{prvnímalé:ěščř}}
13244 {{MALÁ:ěščř}}
13245 {{malá:ěščř}}
13246 {{VELKÁ:ěščř}}
13247 {{velká:ěščř}}
13248 !! result
13249 <p>Ěščř
13250 Ěščř
13251 ěščř
13252 ěščř
13253 ěščř
13254 ěščř
13255 ĚŠČŘ
13256 ĚŠČŘ
13257 </p>
13258 !! end
13259
13260 !! test
13261 Morwen/13: Unclosed link followed by heading
13262 !! input
13263 [[link
13264 ==heading==
13265 !! result
13266 <p>[[link
13267 </p>
13268 <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>
13269
13270 !! end
13271
13272 !! test
13273 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
13274 !! input
13275 {{foo|
13276 =heading=
13277 !! result
13278 <p>{{foo|
13279 </p>
13280 <h1><span class="mw-headline" id="heading">heading</span></h1>
13281
13282 !! end
13283
13284 !! test
13285 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
13286 !! input
13287 {{foo|
13288 ==heading==
13289 !! result
13290 <p>{{foo|
13291 </p>
13292 <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>
13293
13294 !! end
13295
13296 !! test
13297 Tildes in comments
13298 !! options
13299 pst
13300 !! input
13301 <!-- ~~~~ -->
13302 !! result
13303 <!-- ~~~~ -->
13304 !! end
13305
13306 !! test
13307 Paragraphs inside divs (no extra line breaks)
13308 !! input
13309 <div>Line one
13310
13311 Line two</div>
13312 !! result
13313 <div>Line one
13314 Line two</div>
13315
13316 !! end
13317
13318 !! test
13319 Paragraphs inside divs (extra line break on open)
13320 !! input
13321 <div>
13322 Line one
13323
13324 Line two</div>
13325 !! result
13326 <div>
13327 <p>Line one
13328 </p>
13329 Line two</div>
13330
13331 !! end
13332
13333 !! test
13334 Paragraphs inside divs (extra line break on close)
13335 !! input
13336 <div>Line one
13337
13338 Line two
13339 </div>
13340 !! result
13341 <div>Line one
13342 <p>Line two
13343 </p>
13344 </div>
13345
13346 !! end
13347
13348 !! test
13349 Paragraphs inside divs (extra line break on open and close)
13350 !! input
13351 <div>
13352 Line one
13353
13354 Line two
13355 </div>
13356 !! result
13357 <div>
13358 <p>Line one
13359 </p><p>Line two
13360 </p>
13361 </div>
13362
13363 !! end
13364
13365 !! test
13366 Nesting tags, paragraphs on lines which begin with <div>
13367 !! options
13368 disabled
13369 !! input
13370 <div></div><strong>A
13371 B</strong>
13372 !! result
13373 <div></div>
13374 <p><strong>A
13375 B</strong>
13376 </p>
13377 !! end
13378
13379 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
13380 !! test
13381 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
13382 !! options
13383 disabled
13384 !! input
13385 <blockquote>Line one
13386
13387 Line two</blockquote>
13388 !! result
13389 <blockquote>Line one
13390 Line two</blockquote>
13391
13392 !! end
13393
13394 !! test
13395 Bug 6200: paragraphs inside blockquotes (extra line break on open)
13396 !! options
13397 disabled
13398 !! input
13399 <blockquote>
13400 Line one
13401
13402 Line two</blockquote>
13403 !! result
13404 <blockquote>
13405 <p>Line one
13406 </p>
13407 Line two</blockquote>
13408
13409 !! end
13410
13411 !! test
13412 Bug 6200: paragraphs inside blockquotes (extra line break on close)
13413 !! options
13414 disabled
13415 !! input
13416 <blockquote>Line one
13417
13418 Line two
13419 </blockquote>
13420 !! result
13421 <blockquote>Line one
13422 <p>Line two
13423 </p>
13424 </blockquote>
13425
13426 !! end
13427
13428 !! test
13429 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
13430 !! options
13431 disabled
13432 !! input
13433 <blockquote>
13434 Line one
13435
13436 Line two
13437 </blockquote>
13438 !! result
13439 <blockquote>
13440 <p>Line one
13441 </p><p>Line two
13442 </p>
13443 </blockquote>
13444
13445 !! end
13446
13447 !! test
13448 Paragraphs inside blockquotes/divs (no extra line breaks)
13449 !! input
13450 <blockquote><div>Line one
13451
13452 Line two</div></blockquote>
13453 !! result
13454 <blockquote><div>Line one
13455 Line two</div></blockquote>
13456
13457 !! end
13458
13459 !! test
13460 Paragraphs inside blockquotes/divs (extra line break on open)
13461 !! input
13462 <blockquote><div>
13463 Line one
13464
13465 Line two</div></blockquote>
13466 !! result
13467 <blockquote><div>
13468 <p>Line one
13469 </p>
13470 Line two</div></blockquote>
13471
13472 !! end
13473
13474 !! test
13475 Paragraphs inside blockquotes/divs (extra line break on close)
13476 !! input
13477 <blockquote><div>Line one
13478
13479 Line two
13480 </div></blockquote>
13481 !! result
13482 <blockquote><div>Line one
13483 <p>Line two
13484 </p>
13485 </div></blockquote>
13486
13487 !! end
13488
13489 !! test
13490 Paragraphs inside blockquotes/divs (extra line break on open and close)
13491 !! input
13492 <blockquote><div>
13493 Line one
13494
13495 Line two
13496 </div></blockquote>
13497 !! result
13498 <blockquote><div>
13499 <p>Line one
13500 </p><p>Line two
13501 </p>
13502 </div></blockquote>
13503
13504 !! end
13505
13506 !! test
13507 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
13508 !! options
13509 wgLinkHolderBatchSize=0
13510 !! input
13511 [[meatball:1]]
13512 [[meatball:2]]
13513 [[meatball:3]]
13514 !! result
13515 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
13516 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
13517 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
13518 </p>
13519 !! end
13520
13521 !! test
13522 Free external link invading image caption
13523 !! input
13524 [[Image:Foobar.jpg|thumb|http://x|hello]]
13525 !! result
13526 <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>
13527
13528 !! end
13529
13530 !! test
13531 Bug 15196: localised external link numbers
13532 !! options
13533 language=fa
13534 !! input
13535 [http://en.wikipedia.org/]
13536 !! result
13537 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
13538 </p>
13539 !! end
13540
13541 !! test
13542 Multibyte character in padleft
13543 !! input
13544 {{padleft:-Hello|7|Æ}}
13545 !! result
13546 <p>Æ-Hello
13547 </p>
13548 !! end
13549
13550 !! test
13551 Multibyte character in padright
13552 !! input
13553 {{padright:Hello-|7|Æ}}
13554 !! result
13555 <p>Hello-Æ
13556 </p>
13557 !! end
13558
13559 !!test
13560 formatdate parser function
13561 !!input
13562 {{#formatdate:2009-03-24}}
13563 !! result
13564 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
13565 </p>
13566 !! end
13567
13568 !!test
13569 formatdate parser function, with default format
13570 !!input
13571 {{#formatdate:2009-03-24|mdy}}
13572 !! result
13573 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
13574 </p>
13575 !! end
13576
13577 !! test
13578 Spacing of numbers in formatted dates
13579 !! input
13580 {{#formatdate:January 15}}
13581 !! result
13582 <p><span class="mw-formatted-date" title="01-15">January 15</span>
13583 </p>
13584 !! end
13585
13586 !! test
13587 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
13588 !! options
13589 language=nl title=[[MediaWiki:Common.css]]
13590 !! input
13591 {{#formatdate:2009-03-24|dmy}}
13592 !! result
13593 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
13594 </p>
13595 !! end
13596
13597 #
13598 #
13599 #
13600
13601 #
13602 # Edit comments
13603 #
13604
13605 !! test
13606 Edit comment with link
13607 !! options
13608 comment
13609 !! input
13610 I like the [[Main Page]] a lot
13611 !! result
13612 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
13613 !!end
13614
13615 !! test
13616 Edit comment with link and link text
13617 !! options
13618 comment
13619 !! input
13620 I like the [[Main Page|best pages]] a lot
13621 !! result
13622 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13623 !!end
13624
13625 !! test
13626 Edit comment with link and link text with suffix
13627 !! options
13628 comment
13629 !! input
13630 I like the [[Main Page|best page]]s a lot
13631 !! result
13632 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13633 !!end
13634
13635 !! test
13636 Edit comment with section link (non-local, eg in history list)
13637 !! options
13638 comment title=[[Main Page]]
13639 !! input
13640 /* External links */ removed bogus entries
13641 !! result
13642 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13643 !!end
13644
13645 !! test
13646 Edit comment with section link and text before it (non-local, eg in history list)
13647 !! options
13648 comment title=[[Main Page]]
13649 !! input
13650 pre-comment text /* External links */ removed bogus entries
13651 !! result
13652 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>
13653 !!end
13654
13655 !! test
13656 Edit comment with section link (local, eg in diff view)
13657 !! options
13658 comment local title=[[Main Page]]
13659 !! input
13660 /* External links */ removed bogus entries
13661 !! result
13662 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13663 !!end
13664
13665 !! test
13666 Edit comment with subpage link (bug 14080)
13667 !! options
13668 comment
13669 subpage
13670 title=[[Subpage test]]
13671 !! input
13672 Poked at a [[/subpage]] here...
13673 !! result
13674 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
13675 !!end
13676
13677 !! test
13678 Edit comment with subpage link and link text (bug 14080)
13679 !! options
13680 comment
13681 subpage
13682 title=[[Subpage test]]
13683 !! input
13684 Poked at a [[/subpage|neat little page]] here...
13685 !! result
13686 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
13687 !!end
13688
13689 !! test
13690 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
13691 !! options
13692 comment
13693 title=[[Subpage test]]
13694 !! input
13695 Poked at a [[/subpage]] here...
13696 !! result
13697 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...
13698 !!end
13699
13700 !! test
13701 Edit comment with bare anchor link (local, as on diff)
13702 !! options
13703 comment
13704 local
13705 title=[[Main Page]]
13706 !!input
13707 [[#section]]
13708 !! result
13709 <a href="#section">#section</a>
13710 !! end
13711
13712 !! test
13713 Edit comment with bare anchor link (non-local, as on history)
13714 !! options
13715 comment
13716 title=[[Main Page]]
13717 !!input
13718 [[#section]]
13719 !! result
13720 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
13721 !! end
13722
13723 !! test
13724 Anchor starting with underscore
13725 !!input
13726 [[#_ref|One]]
13727 !! result
13728 <p><a href="#_ref">One</a>
13729 </p>
13730 !! end
13731
13732 !! test
13733 Id starting with underscore
13734 !!input
13735 <div id="_ref"></div>
13736 !! result
13737 <div id="_ref"></div>
13738
13739 !! end
13740
13741 !! test
13742 Space normalisation on autocomment (bug 22784)
13743 !! options
13744 comment
13745 title=[[Main Page]]
13746 !!input
13747 /* __hello__world__ */
13748 !! result
13749 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
13750 !! end
13751
13752 !! test
13753 percent-encoding and + signs in comments (Bug 26410)
13754 !! options
13755 comment
13756 !!input
13757 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
13758 !! result
13759 <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>
13760 !! end
13761
13762 !! test
13763 Bad images - basic functionality
13764 !! options
13765 disabled
13766 !! input
13767 [[File:Bad.jpg]]
13768 !! result
13769 !! end
13770
13771 !! test
13772 Bad images - bug 16039: text after bad image disappears
13773 !! options
13774 disabled
13775 !! input
13776 Foo bar
13777 [[File:Bad.jpg]]
13778 Bar foo
13779 !! result
13780 <p>Foo bar
13781 </p><p>Bar foo
13782 </p>
13783 !! end
13784
13785 !! test
13786 Verify that displaytitle works (bug #22501) no displaytitle
13787 !! options
13788 showtitle
13789 !! config
13790 wgAllowDisplayTitle=true
13791 wgRestrictDisplayTitle=false
13792 !! input
13793 this is not the the title
13794 !! result
13795 Parser test
13796 <p>this is not the the title
13797 </p>
13798 !! end
13799
13800 !! test
13801 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
13802 !! options
13803 showtitle
13804 title=[[Screen]]
13805 !! config
13806 wgAllowDisplayTitle=true
13807 wgRestrictDisplayTitle=false
13808 !! input
13809 this is not the the title
13810 {{DISPLAYTITLE:whatever}}
13811 !! result
13812 whatever
13813 <p>this is not the the title
13814 </p>
13815 !! end
13816
13817 !! test
13818 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
13819 !! options
13820 showtitle
13821 title=[[Screen]]
13822 !! config
13823 wgAllowDisplayTitle=true
13824 wgRestrictDisplayTitle=true
13825 !! input
13826 this is not the the title
13827 {{DISPLAYTITLE:whatever}}
13828 !! result
13829 Screen
13830 <p>this is not the the title
13831 </p>
13832 !! end
13833
13834 !! test
13835 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
13836 !! options
13837 showtitle
13838 title=[[Screen]]
13839 !! config
13840 wgAllowDisplayTitle=true
13841 wgRestrictDisplayTitle=true
13842 !! input
13843 this is not the the title
13844 {{DISPLAYTITLE:screen}}
13845 !! result
13846 screen
13847 <p>this is not the the title
13848 </p>
13849 !! end
13850
13851 !! test
13852 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
13853 !! options
13854 showtitle
13855 title=[[Screen]]
13856 !! config
13857 wgAllowDisplayTitle=false
13858 !! input
13859 this is not the the title
13860 {{DISPLAYTITLE:screen}}
13861 !! result
13862 Screen
13863 <p>this is not the the title
13864 <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>
13865 </p>
13866 !! end
13867
13868 !! test
13869 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
13870 !! options
13871 showtitle
13872 title=[[Screen]]
13873 !! config
13874 wgAllowDisplayTitle=false
13875 !! input
13876 this is not the the title
13877 !! result
13878 Screen
13879 <p>this is not the the title
13880 </p>
13881 !! end
13882
13883 !! test
13884 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
13885 !! options
13886 showtitle
13887 title=[[Screen]]
13888 !! config
13889 wgAllowDisplayTitle=true
13890 wgRestrictDisplayTitle=true
13891 !! input
13892 this is not the the title
13893 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
13894 !! result
13895 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
13896 <p>this is not the the title
13897 </p>
13898 !! end
13899
13900 !! test
13901 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
13902 !! options
13903 showtitle
13904 title=[[Screen]]
13905 !! config
13906 wgAllowDisplayTitle=true
13907 wgRestrictDisplayTitle=true
13908 !! input
13909 this is not the the title
13910 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
13911 !! result
13912 <span style="color: red;">s</span>creen
13913 <p>this is not the the title
13914 </p>
13915 !! end
13916
13917 !! test
13918 preload: check <noinclude> and <includeonly>
13919 !! options
13920 preload
13921 !! input
13922 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
13923 !! result
13924 Hello kind world.
13925 !! end
13926
13927 !! test
13928 preload: check <onlyinclude>
13929 !! options
13930 preload
13931 !! input
13932 Goodbye <onlyinclude>Hello world</onlyinclude>
13933 !! result
13934 Hello world
13935 !! end
13936
13937 !! test
13938 preload: can pass tags through if we want to
13939 !! options
13940 preload
13941 !! input
13942 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
13943 !! result
13944 <includeonly>Hello world</includeonly>
13945 !! end
13946
13947 !! test
13948 preload: check that it doesn't try to do tricks
13949 !! options
13950 preload
13951 !! input
13952 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13953 !! result
13954 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13955 !! end
13956
13957 !! test
13958 Play a bit with r67090 and bug 3158
13959 !! options
13960 disabled
13961 !! input
13962 <div style="width:50% !important">&nbsp;</div>
13963 <div style="width:50%&nbsp;!important">&nbsp;</div>
13964 <div style="width:50%&#160;!important">&nbsp;</div>
13965 <div style="border : solid;">&nbsp;</div>
13966 !! result
13967 <div style="width:50% !important">&nbsp;</div>
13968 <div style="width:50% !important">&nbsp;</div>
13969 <div style="width:50% !important">&nbsp;</div>
13970 <div style="border&#160;: solid;">&nbsp;</div>
13971
13972 !! end
13973
13974 !! test
13975 HTML5 data attributes
13976 !! input
13977 <span data-foo="bar">Baz</span>
13978 <p data-abc-def_hij="">Quuz</p>
13979 !! result
13980 <p><span data-foo="bar">Baz</span>
13981 </p>
13982 <p data-abc-def_hij="">Quuz</p>
13983
13984 !! end
13985
13986 !! test
13987 percent-encoding and + signs in internal links (Bug 26410)
13988 !! input
13989 [[User:+%]] [[Page+title%]]
13990 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
13991 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
13992 [[%33%45]] [[%33%45+]]
13993 !! result
13994 <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>
13995 <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>
13996 <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>
13997 <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>
13998 </p>
13999 !! end
14000
14001 !! test
14002 Special characters in embedded file links (bug 27679)
14003 !! input
14004 [[File:Contains & ampersand.jpg]]
14005 [[File:Does not exist.jpg|Title with & ampersand]]
14006 !! result
14007 <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>
14008 <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>
14009 </p>
14010 !! end
14011
14012
14013 !! test
14014 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
14015 !! input
14016 Text&apos;s been normalized?
14017 !! result
14018 <p>Text&#39;s been normalized?
14019 </p>
14020 !! end
14021
14022 !! test
14023 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
14024 !! input
14025 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
14026 !! result
14027 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
14028 </p>
14029 !! end
14030
14031 !! test
14032 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
14033 !! input
14034 [http://www.example.org/ ideograms]
14035 !! result
14036 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
14037 </p>
14038 !! end
14039
14040 !! test
14041 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
14042 !! input
14043 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
14044 !! result
14045 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
14046 </p>
14047 !! end
14048
14049 !! article
14050 Mediawiki:loop1
14051 !! text
14052 {{Identical|A}}
14053 !! endarticle
14054
14055 !! article
14056 Mediawiki:loop2
14057 !! text
14058 {{Identical|B}}
14059 !! endarticle
14060
14061 !! article
14062 Template:Identical
14063 !! text
14064 {{int:loop1}}
14065 {{int:loop2}}
14066 !! endarticle
14067
14068 !! test
14069 Bug 31098 Template which includes system messages which includes the template
14070 !! input
14071 {{Identical}}
14072 !! result
14073 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14074 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14075 </p>
14076 !! end
14077
14078 !! test
14079 Bug31490 Turkish: ucfirst 'blah'
14080 !! options
14081 language=tr
14082 !! input
14083 {{ucfirst:blah}}
14084 !! result
14085 <p>Blah
14086 </p>
14087 !! end
14088
14089 !! test
14090 Bug31490 Turkish: ucfirst 'ix'
14091 !! options
14092 language=tr
14093 !! input
14094 {{ucfirst:ix}}
14095 !! result
14096 <p>İx
14097 </p>
14098 !! end
14099
14100 !! test
14101 Bug31490 Turkish: lcfirst 'BLAH'
14102 !! options
14103 language=tr
14104 !! input
14105 {{lcfirst:BLAH}}
14106 !! result
14107 <p>bLAH
14108 </p>
14109 !! end
14110
14111 !! test
14112 Bug31490 Turkish: ucfırst (with a dotless i)
14113 !! options
14114 language=tr
14115 !! input
14116 {{ucfırst:blah}}
14117 !! result
14118 <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>
14119 </p>
14120 !! end
14121
14122 !! test
14123 Bug31490 ucfırst (with a dotless i) with English language
14124 !! options
14125 language=en
14126 !! input
14127 {{ucfırst:blah}}
14128 !! result
14129 <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>
14130 </p>
14131 !! end
14132
14133 !! test
14134 Bug 26375: TOC with italics
14135 !! options
14136 title=[[Main Page]]
14137 !! input
14138 __TOC__
14139 == ''Lost'' episodes ==
14140 !! result
14141 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14142 <ul>
14143 <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>
14144 </ul>
14145 </div>
14146 <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>
14147
14148 !! end
14149
14150 !! test
14151 Bug 26375: TOC with bold
14152 !! options
14153 title=[[Main Page]]
14154 !! input
14155 __TOC__
14156 == '''should be bold''' then normal text ==
14157 !! result
14158 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14159 <ul>
14160 <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>
14161 </ul>
14162 </div>
14163 <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>
14164
14165 !! end
14166
14167 !! test
14168 Bug 33845: Headings become cursive in TOC when they contain an image
14169 !! options
14170 title=[[Main Page]]
14171 !! input
14172 __TOC__
14173 == Image [[Image:foobar.jpg]] ==
14174 !! result
14175 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14176 <ul>
14177 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
14178 </ul>
14179 </div>
14180 <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>
14181
14182 !! end
14183
14184 !! test
14185 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
14186 !! options
14187 title=[[Main Page]]
14188 !! input
14189 __TOC__
14190 == <blockquote>Quote</blockquote> ==
14191 !! result
14192 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14193 <ul>
14194 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
14195 </ul>
14196 </div>
14197 <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>
14198
14199 !! end
14200
14201 !! test
14202 Unclosed tags in TOC
14203 !! options
14204 title=[[Main Page]]
14205 !! input
14206 __TOC__
14207 == Proof: 2 < 3 ==
14208 <small>Hanc marginis exiguitas non caperet.</small>
14209 QED
14210 !! result
14211 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14212 <ul>
14213 <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>
14214 </ul>
14215 </div>
14216 <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>
14217 <p><small>Hanc marginis exiguitas non caperet.</small>
14218 QED
14219 </p>
14220 !! end
14221
14222 !! test
14223 Multiple tags in TOC
14224 !! input
14225 __TOC__
14226 == <i>Foo</i> <b>Bar</b> ==
14227
14228 == <i>Foo</i> <blockquote>Bar</blockquote> ==
14229 !! result
14230 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14231 <ul>
14232 <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>
14233 <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>
14234 </ul>
14235 </div>
14236 <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>
14237 <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>
14238
14239 !! end
14240
14241 !! test
14242 Tags with parameters in TOC
14243 !! input
14244 __TOC__
14245 == <sup class="in-h2">Hello</sup> ==
14246
14247 == <sup class="a > b">Evilbye</sup> ==
14248 !! result
14249 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14250 <ul>
14251 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
14252 <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>
14253 </ul>
14254 </div>
14255 <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>
14256 <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>
14257
14258 !! end
14259
14260 !! test
14261 span tags with directionality in TOC
14262 !! input
14263 __TOC__
14264 == <span dir="ltr">C++</span> ==
14265
14266 == <span dir="rtl">זבנג!</span> ==
14267
14268 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
14269
14270 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
14271
14272 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
14273 !! result
14274 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14275 <ul>
14276 <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>
14277 <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>
14278 <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>
14279 <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>
14280 <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>
14281 </ul>
14282 </div>
14283 <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>
14284 <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>
14285 <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>
14286 <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>
14287 <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>
14288
14289 !! end
14290
14291 !! article
14292 MediaWiki:Bug32057
14293 !! text
14294 == {{int:headline_sample}} ==
14295 !! endarticle
14296
14297 !! test
14298 Bug 32057: Title needed when expanding <h> nodes.
14299 !! options
14300 title=[[Main Page]]
14301 !! input
14302 {{int:Bug32057}}
14303 !! result
14304 <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>
14305
14306 !! end
14307
14308 !! test
14309 Strip marker in urlencode
14310 !! input
14311 {{urlencode:x<nowiki/>y}}
14312 {{urlencode:x<nowiki/>y|wiki}}
14313 {{urlencode:x<nowiki/>y|path}}
14314 !! result
14315 <p>xy
14316 xy
14317 xy
14318 </p>
14319 !! end
14320
14321 !! test
14322 Strip marker in lc
14323 !! input
14324 {{lc:x<nowiki/>y}}
14325 !! result
14326 <p>xy
14327 </p>
14328 !! end
14329
14330 !! test
14331 Strip marker in uc
14332 !! input
14333 {{uc:x<nowiki/>y}}
14334 !! result
14335 <p>XY
14336 </p>
14337 !! end
14338
14339 !! test
14340 Strip marker in formatNum
14341 !! input
14342 {{formatnum:1<nowiki/>2}}
14343 {{formatnum:1<nowiki/>2|R}}
14344 !! result
14345 <p>12
14346 12
14347 </p>
14348 !! end
14349
14350 !! test
14351 Check noCommafy in formatNum
14352 !! options
14353 language=be-tarask
14354 !! input
14355 {{formatnum:123456.78}}
14356 {{formatnum:123456.78|NOSEP}}
14357 !! result
14358 <p>123 456,78
14359 123456.78
14360 </p>
14361 !! end
14362
14363 !! test
14364 Strip marker in grammar
14365 !! options
14366 language=fi
14367 !! input
14368 {{grammar:elative|foo<nowiki/>bar}}
14369 !! result
14370 <p>foobarista
14371 </p>
14372 !! end
14373
14374 !! test
14375 Strip marker in padleft
14376 !! input
14377 {{padleft:|2|x<nowiki/>y}}
14378 !! result
14379 <p>xy
14380 </p>
14381 !! end
14382
14383 !! test
14384 Strip marker in padright
14385 !! input
14386 {{padright:|2|x<nowiki/>y}}
14387 !! result
14388 <p>xy
14389 </p>
14390 !! end
14391
14392 !! test
14393 Strip marker in anchorencode
14394 !! input
14395 {{anchorencode:x<nowiki/>y}}
14396 !! result
14397 <p>xy
14398 </p>
14399 !! end
14400
14401 !! test
14402 nowiki inside link inside heading (bug 18295)
14403 !! input
14404 ==[[foo|x<nowiki>y</nowiki>z]]==
14405 !! result
14406 <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>
14407
14408 !! end
14409
14410 !! test
14411 new support for bdi element (bug 31817)
14412 !! input
14413 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14414 !! result
14415 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14416
14417 !!end
14418
14419 !! test
14420 Ignore pipe between table row attributes
14421 !! input
14422 {|
14423 | quux
14424 |- id=foo | style='color: red'
14425 | bar
14426 |}
14427 !! result
14428 <table>
14429 <tr>
14430 <td> quux
14431 </td></tr>
14432 <tr id="foo" style="color: red">
14433 <td> bar
14434 </td></tr></table>
14435
14436 !! end
14437
14438 !!test
14439 Gallery override link with WikiLink (bug 34852)
14440 !! input
14441 <gallery>
14442 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
14443 </gallery>
14444 !! result
14445 <ul class="gallery">
14446 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14447 <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>
14448 <div class="gallerytext">
14449 <p>caption
14450 </p>
14451 </div>
14452 </div></li>
14453 </ul>
14454
14455 !! end
14456
14457 !!test
14458 Gallery override link with absolute external link (bug 34852)
14459 !! input
14460 <gallery>
14461 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
14462 </gallery>
14463 !! result
14464 <ul class="gallery">
14465 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14466 <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>
14467 <div class="gallerytext">
14468 <p>caption
14469 </p>
14470 </div>
14471 </div></li>
14472 </ul>
14473
14474 !! end
14475
14476 !!test
14477 Gallery override link with malicious javascript (bug 34852)
14478 !! input
14479 <gallery>
14480 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
14481 </gallery>
14482 !! result
14483 <ul class="gallery">
14484 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14485 <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>
14486 <div class="gallerytext">
14487 <p>caption
14488 </p>
14489 </div>
14490 </div></li>
14491 </ul>
14492
14493 !! end
14494
14495 !!test
14496 Gallery with invalid title as link (bug 43964)
14497 !! input
14498 <gallery>
14499 File:foobar.jpg|link=<
14500 </gallery>
14501 !! result
14502 <ul class="gallery">
14503 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14504 <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>
14505 <div class="gallerytext">
14506 </div>
14507 </div></li>
14508 </ul>
14509
14510 !! end
14511
14512 !!test
14513 Language parser function
14514 !! input
14515 {{#language:ar}}
14516 !! result
14517 <p>العربية
14518 </p>
14519 !! end
14520
14521 !!test
14522 Padleft and padright as substr
14523 !! input
14524 {{padleft:|3|abcde}}
14525 {{padright:|3|abcde}}
14526 !! result
14527 <p>abc
14528 abc
14529 </p>
14530 !! end
14531
14532 !!test
14533 Special parser function
14534 !! input
14535 {{#special:RandomPage}}
14536 {{#special:BaDtItLe}}
14537 {{#special:Foobar}}
14538 !! result
14539 <p>Special:Random
14540 Special:Badtitle
14541 Special:Foobar
14542 </p>
14543 !! end
14544
14545 !!test
14546 Bug 34939 - Case insensitive link parsing ([HttP://])
14547 !! input
14548 [HttP://MediaWiki.Org/]
14549 !! result
14550 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
14551 </p>
14552 !! end
14553
14554 !!test
14555 Bug 34939 - Case insensitive link parsing ([HttP:// title])
14556 !! input
14557 [HttP://MediaWiki.Org/ MediaWiki]
14558 !! result
14559 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
14560 </p>
14561 !! end
14562
14563 !!test
14564 Bug 34939 - Case insensitive link parsing (HttP://)
14565 !! input
14566 HttP://MediaWiki.Org/
14567 !! result
14568 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
14569 </p>
14570 !! end
14571
14572
14573 ###
14574 ### Parsoids-specific tests
14575 ### Parsoid-PHP parser incompatibilities
14576 ###
14577 !!test
14578 1. SOL-sensitive wikitext tokens as template-args
14579 !!options
14580 parsoid=wt2html,wt2wt
14581 !!input
14582 {{echo|*a}}
14583 {{echo|#a}}
14584 {{echo|:a}}
14585 !!result
14586 <span about="#mwt1" typeof="mw:Transclusion">
14587 </span><ul about="#mwt1"><li>a</li></ul>
14588 <span about="#mwt2" typeof="mw:Transclusion">
14589 </span><ol about="#mwt2"><li>a</li></ol>
14590 <span about="#mwt3" typeof="mw:Transclusion">
14591 </span><dl about="#mwt3"><dd>a</dd></dl>
14592 !!end
14593
14594 #### ----------------------------------------------------------------
14595 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
14596 #### tags. Parsoid's output for these tags differs from that of the
14597 #### PHP parser.
14598 #### ----------------------------------------------------------------
14599
14600 !!test
14601 Ref: 1. ref-location should be replaced with an index span
14602 !!options
14603 parsoid
14604 !!input
14605 A <ref>foo</ref>
14606 B <ref name="x">foo</ref>
14607 C <ref name="y" />
14608 !!result
14609 <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>
14610 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>
14611 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>
14612 !!end
14613
14614 !!test
14615 Ref: 2. ref-tags with identical names should all get the same index
14616 !!options
14617 parsoid
14618 !!input
14619 A <ref name="x">foo</ref>
14620 B <ref name="x" />
14621 !!result
14622 <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>
14623 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>
14624 !!end
14625
14626 !!test
14627 Ref: 3. spaces in ref-names should be ignored
14628 !!options
14629 parsoid
14630 !!input
14631 A <ref name="x">foo</ref>
14632 B <ref name=" x " />
14633 C <ref name= x />
14634 !!result
14635 <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>
14636 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>
14637 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>
14638 !!end
14639
14640 !!test
14641 Ref: 4. 'constructor' should be accepted as a valid ref-name
14642 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
14643 !!options
14644 parsoid
14645 !!input
14646 A <ref name="constructor">foo</ref>
14647 !!result
14648 <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>
14649 !!end
14650
14651 !!test
14652 Ref: 5. body should accept generic wikitext
14653 !!options
14654 parsoid
14655 !!input
14656 A <ref>
14657 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
14658 </ref>
14659
14660 <references />
14661 !!result
14662 <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>
14663
14664 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14665 <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>
14666 </li></ol>
14667 !!end
14668
14669 !!test
14670 Ref: 6. indent-pres should not be output in ref-body
14671 !!options
14672 parsoid
14673 !!input
14674 A <ref>
14675 foo
14676 bar
14677 baz
14678 </ref>
14679
14680 <references />
14681 !!result
14682 <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>
14683
14684 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14685 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14686 bar
14687 baz
14688 </li></ol>
14689 !!end
14690
14691 !!test
14692 Ref: 6. No p-wrapping in ref-body
14693 !!options
14694 parsoid
14695 !!input
14696 A <ref>
14697 foo
14698
14699 bar
14700
14701
14702 baz
14703
14704
14705
14706 booz
14707 </ref>
14708
14709 <references />
14710 !!result
14711 <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>
14712
14713 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14714 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14715
14716 bar
14717
14718
14719 baz
14720
14721
14722
14723 booz
14724 </li></ol>
14725 !!end
14726
14727 !!test
14728 Ref: 8. transclusion wikitext has lower precedence
14729 !!options
14730 parsoid
14731 !!input
14732 A <ref> foo {{echo|</ref> B C}}
14733
14734 <references />
14735 !!result
14736 <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>
14737
14738 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14739 <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>
14740 !!end
14741
14742 !!test
14743 Ref: 9. unclosed comments should not leak out of ref-body
14744 !!options
14745 parsoid
14746 !!input
14747 A <ref> foo <!--</ref> B C
14748
14749 <references />
14750 !!result
14751 <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>
14752
14753 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14754 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
14755 !!end
14756
14757 !!test
14758 Ref: 10. Unclosed HTML tags should not leak out of ref-body
14759 !!options
14760 parsoid
14761 !!input
14762 A <ref> <b> foo </ref> B C
14763
14764 <references />
14765 !!result
14766 <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>
14767
14768 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14769 <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>
14770 !!end
14771
14772 !!test
14773 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
14774 !!options
14775 parsoid
14776 !!input
14777 A <ref>foo</ref> B
14778 C <ref>bar</ref> D
14779 !!result
14780 <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
14781 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>
14782 !!end
14783
14784 !!test
14785 Ref: 12. ref-tags act as trailing newline migration barrier
14786 !!options
14787 parsoid
14788 !!input
14789 <!--the newline at the end of this line moves out of the p-tag-->a
14790
14791 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
14792 <ref />
14793
14794 c
14795 !!result
14796 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
14797
14798
14799 <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>
14800 <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>
14801
14802
14803 <p>c</p>
14804 !!end
14805
14806 !!test
14807 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
14808 !!options
14809 parsoid
14810 !!input
14811 <ref>foo</ref> A
14812 <ref>bar
14813 </ref> B
14814 !!result
14815 <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
14816 <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>
14817 !!end
14818
14819 !!test
14820 Ref: 14. A nested ref-tag should be emitted as plain text
14821 !!options
14822 parsoid
14823 !!input
14824 <ref>foo <ref>bar</ref> baz</ref>
14825
14826 <references />
14827 !!result
14828 <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>
14829
14830 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
14831 <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>
14832 !!end
14833
14834 !!test
14835 Ref: 15. ref-tags with identical names should get identical indexes
14836 !!options
14837 parsoid
14838 !!input
14839 A1 <ref name="a">foo</ref> A2 <ref name="a" />
14840 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
14841
14842 <references />
14843 !!result
14844 <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>
14845 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>
14846
14847 <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>
14848 !!end
14849
14850 !!test
14851 References: 1. references tag without any refs should be handled properly
14852 !!options
14853 parsoid
14854 !!input
14855 <references />
14856 !!result
14857 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
14858 !!end
14859
14860 !!test
14861 References: 2. references tag with group only outputs references from that group
14862 !!options
14863 parsoid
14864 !!input
14865 A <ref group="a">foo</ref>
14866 B <ref group="b">bar</ref>
14867
14868 <references group='a' />
14869 !!result
14870 <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>
14871 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>
14872
14873 <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>
14874 !!end
14875
14876 !!test
14877 References: 3. ref list should be cleared after processing references
14878 !!options
14879 parsoid
14880 !!input
14881 A <ref>foo</ref>
14882
14883 <references />
14884
14885 B <ref>bar</ref>
14886
14887 <references />
14888 !!result
14889 <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>
14890
14891 <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>
14892
14893 <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>
14894
14895 <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>
14896 !!end
14897
14898 !!test
14899 References: 4. only referenced group should be cleared after processing references
14900 !!options
14901 parsoid
14902 !!input
14903 A <ref group="a">afoo</ref>
14904 B <ref>bfoo</ref>
14905
14906 <references group="a"/>
14907
14908 C <ref>cfoo</ref>
14909
14910 <references />
14911 !!result
14912 <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>
14913 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>
14914
14915 <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>
14916
14917 <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>
14918
14919 <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>
14920 !!end
14921
14922 !!test
14923 References: 5. ref tags in references should be processed while ignoring all other content
14924 !!options
14925 parsoid
14926 !!input
14927 A <ref name="a" />
14928 B <ref name="b">bar</ref>
14929
14930 <references>
14931 <ref name="a">foo</ref>
14932 This should just get lost.
14933 </references>
14934 !!result
14935 <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>
14936 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>
14937
14938 <ol about="#mwt7" class="references" data-mw='{"name":"references","body":{"extsrc":"<ref name=\"a\">foo</ref>\nThis should just get lost."},"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">↑</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>
14939 !!end
14940
14941 !!test
14942 References: 6. <references /> from a transclusion
14943 !!options
14944 parsoid
14945 !!input
14946 {{echo|<references />}}
14947 !!result
14948 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}'></ol>
14949 !!end
14950
14951 #### ----------------------------------------------------------------
14952 #### The following section of tests are primarily to test
14953 #### wikitext escaping capabilities of Parsoid. Given that
14954 #### escaping can be done any number of ways, the wikitext (input)
14955 #### is always adjusted to reflect how Parsoid adds nowiki
14956 #### escape tags.
14957 ####
14958 #### We are marking several tests as parsoid-only since the
14959 #### HTML in the result section is different from what the
14960 #### PHP parser generates for it.
14961 #### ----------------------------------------------------------------
14962
14963
14964 #### --------------- Headings ---------------
14965 #### 0. Unnested
14966 #### 1. Nested inside html <h1>=foo=</h1>
14967 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
14968 #### 3. Nested inside html with wikitext split by html tags
14969 #### 4. No escape needed
14970 #### 5. Empty headings <h1></h1>
14971 #### 6. Heading chars in SOL context
14972 #### ----------------------------------------
14973 !! test
14974 Headings: 0. Unnested
14975 !! options
14976 parsoid
14977 !! input
14978 <nowiki>=foo=</nowiki>
14979
14980 <nowiki> =foo= </nowiki>
14981 <!--cmt-->
14982 <nowiki>=foo=</nowiki>
14983
14984 =foo''a''<nowiki>=</nowiki>
14985 !! result
14986 <p><span typeof="mw:Nowiki">=foo=</span></p>
14987
14988 <p><span typeof="mw:Nowiki"> =foo= </span>
14989 <!--cmt-->
14990 <span typeof="mw:Nowiki">=foo=</span></p>
14991
14992 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
14993 !!end
14994
14995 !! test
14996 Headings: 1. Nested inside html
14997 !! options
14998 parsoid
14999 !! input
15000 =<nowiki>=foo=</nowiki>=
15001
15002 ==<nowiki>=foo=</nowiki>==
15003
15004 ===<nowiki>=foo=</nowiki>===
15005
15006 ====<nowiki>=foo=</nowiki>====
15007
15008 =====<nowiki>=foo=</nowiki>=====
15009
15010 ======<nowiki>=foo=</nowiki>======
15011 !! result
15012 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
15013 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
15014 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
15015 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
15016 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
15017 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
15018 !!end
15019
15020 !! test
15021 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
15022 !! options
15023 parsoid
15024 !! input
15025 =foo=
15026 <nowiki>*</nowiki>bar
15027
15028 =foo=
15029 =bar
15030
15031 =foo=
15032 <nowiki>=bar=</nowiki>
15033 !! result
15034 <h1>foo</h1>*bar
15035 <h1>foo</h1>=bar
15036 <h1>foo</h1>=bar=
15037 !!end
15038
15039 !! test
15040 Headings: 3. Nested inside html with wikitext split by html tags
15041 !! options
15042 parsoid
15043 !! input
15044 =='''bold'''<nowiki>foo=</nowiki>=
15045 !! result
15046 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
15047 !!end
15048
15049 !! test
15050 Headings: 4a. No escaping needed (testing just h1 and h2)
15051 !! options
15052 parsoid
15053 !! input
15054 ==foo=
15055
15056 =foo==
15057
15058 = =foo= =
15059
15060 ==foo= bar=
15061
15062 ===foo==
15063
15064 ==foo===
15065
15066 =''=''foo==
15067
15068 =<nowiki>=</nowiki>=
15069 !! result
15070 <h1>=foo</h1>
15071 <h1>foo=</h1>
15072 <h1> =foo= </h1>
15073 <h1>=foo= bar</h1>
15074 <h2>=foo</h2>
15075 <h2>foo=</h2>
15076 <h1><i>=</i>foo=</h1>
15077 <h1><span typeof="mw:Nowiki">=</span></h1>
15078 !!end
15079
15080 !! test
15081 Headings: 4b. No escaping needed (inside p-tags)
15082 !! options
15083 parsoid
15084 !! input
15085 ===
15086 =foo= x
15087 =foo= <s></s>
15088 !! result
15089 <p>===
15090 =foo= x
15091 =foo= <s></s>
15092 </p>
15093 !!end
15094
15095 !! test
15096 Headings: 5. Empty headings
15097 !! options
15098 parsoid
15099 !! input
15100 =<nowiki/>=
15101
15102 ==<nowiki/>==
15103
15104 ===<nowiki/>===
15105
15106 ====<nowiki/>====
15107
15108 =====<nowiki/>=====
15109
15110 ======<nowiki/>======
15111 !! result
15112 <h1></h1>
15113 <h2></h2>
15114 <h3></h3>
15115 <h4></h4>
15116 <h5></h5>
15117 <h6></h6>
15118 !!end
15119
15120 !! test
15121 Headings: 6a. Heading chars in SOL context (with trailing spaces)
15122 !! options
15123 parsoid
15124 !! input
15125 <nowiki>=a=</nowiki>
15126
15127 <nowiki>=a=</nowiki>
15128
15129 <nowiki>=a=</nowiki>
15130
15131 <nowiki>=a=</nowiki>
15132 !! result
15133 <p>=a=</p>
15134 <p>=a= </p>
15135 <p>=a= </p>
15136 <p>=a= </p>
15137 !!end
15138
15139 !! test
15140 Headings: 6b. Heading chars in SOL context (with trailing newlines)
15141 !! options
15142 parsoid
15143 !! input
15144 <nowiki>=a=
15145 b</nowiki>
15146
15147 <nowiki>=a=
15148 b</nowiki>
15149
15150 <nowiki>=a=
15151 b</nowiki>
15152
15153 <nowiki>=a=
15154 b</nowiki>
15155 !! result
15156 <p>=a=
15157 b</p>
15158 <p>=a=
15159 b</p>
15160 <p>=a=
15161 b</p>
15162 <p>=a=
15163 b</p>
15164 </p>
15165 !!end
15166
15167 !! test
15168 Headings: 6c. Heading chars in SOL context (leading newline break)
15169 !! options
15170 parsoid
15171 !! input
15172 a
15173 <nowiki>=b=</nowiki>
15174 !! result
15175 <p>a
15176 =b=</p>
15177 !!end
15178
15179 !! test
15180 Headings: 6d. Heading chars in SOL context (with interspersed comments)
15181 !! options
15182 parsoid
15183 !! input
15184 <!--c0--><nowiki>=a=</nowiki>
15185 <!--c1-->
15186 <nowiki>=a=</nowiki> <!--c2--> <!--c3-->
15187 !! result
15188 <p><!--c0-->=a=</p>
15189 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
15190 !!end
15191
15192 !! test
15193 Headings: 6d. Heading chars in SOL context (No escaping needed)
15194 !! options
15195 parsoid=html2wt
15196 !! input
15197 =a=<div>b</div>
15198 !! result
15199 =a=<div>b</div>
15200 !!end
15201
15202 #### --------------- Lists ---------------
15203 #### 0. Outside nests (*foo, etc.)
15204 #### 1. Nested inside html <ul><li>*foo</li></ul>
15205 #### 2. Inside definition lists
15206 #### 3. Only bullets at start should be escaped
15207 #### 4. No escapes needed
15208 #### 5. No unnecessary escapes
15209 #### 6. Escape bullets in SOL position
15210 #### 7. Escape bullets in a multi-line context
15211 #### ----------------------------------------
15212
15213 !! test
15214 Lists: 0. Outside nests
15215 !! input
15216 <nowiki>*</nowiki>foo
15217
15218 <nowiki>#</nowiki>foo
15219 !! result
15220 <p>*foo
15221 </p><p>#foo
15222 </p>
15223 !!end
15224
15225 !! test
15226 Lists: 1. Nested inside html
15227 !! input
15228 *<nowiki>*foo</nowiki>
15229
15230 *<nowiki>#foo</nowiki>
15231
15232 *<nowiki>:foo</nowiki>
15233
15234 *<nowiki>;foo</nowiki>
15235
15236 #<nowiki>*foo</nowiki>
15237
15238 #<nowiki>#foo</nowiki>
15239
15240 #<nowiki>:foo</nowiki>
15241
15242 #<nowiki>;foo</nowiki>
15243 !! result
15244 <ul><li>*foo
15245 </li></ul>
15246 <ul><li>#foo
15247 </li></ul>
15248 <ul><li>:foo
15249 </li></ul>
15250 <ul><li>;foo
15251 </li></ul>
15252 <ol><li>*foo
15253 </li></ol>
15254 <ol><li>#foo
15255 </li></ol>
15256 <ol><li>:foo
15257 </li></ol>
15258 <ol><li>;foo
15259 </li></ol>
15260
15261 !!end
15262
15263 !! test
15264 Lists: 2. Inside definition lists
15265 !! input
15266 ;<nowiki>;foo</nowiki>
15267
15268 ;<nowiki>:foo</nowiki>
15269
15270 ;<nowiki>:foo</nowiki>
15271 :bar
15272
15273 :<nowiki>:foo</nowiki>
15274 !! result
15275 <dl><dt>;foo
15276 </dt></dl>
15277 <dl><dt>:foo
15278 </dt></dl>
15279 <dl><dt>:foo
15280 </dt><dd>bar
15281 </dd></dl>
15282 <dl><dd>:foo
15283 </dd></dl>
15284
15285 !!end
15286
15287 !! test
15288 Lists: 3. Only bullets at start of text should be escaped
15289 !! input
15290 *<nowiki>*foo*bar</nowiki>
15291
15292 *<nowiki>*foo</nowiki>''it''*bar
15293 !! result
15294 <ul><li>*foo*bar
15295 </li></ul>
15296 <ul><li>*foo<i>it</i>*bar
15297 </li></ul>
15298
15299 !!end
15300
15301 !! test
15302 Lists: 4. No escapes needed
15303 !! options
15304 parsoid
15305 !! input
15306 *foo*bar
15307
15308 *''foo''*bar
15309
15310 *[[Foo]]: bar
15311 !! result
15312 <ul><li>foo*bar
15313 </li></ul>
15314 <ul><li><i>foo</i>*bar
15315 </li></ul>
15316 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
15317 </li></ul>
15318 !!end
15319
15320 !! test
15321 Lists: 5. No unnecessary escapes
15322 !! input
15323 * bar <span><nowiki>[[foo]]</nowiki></span>
15324
15325 *=bar <span><nowiki>[[foo]]</nowiki></span>
15326
15327 *[[bar <span><nowiki>[[foo]]</nowiki></span>
15328
15329 *]]bar <span><nowiki>[[foo]]</nowiki></span>
15330
15331 *=bar <span>foo]]</span>=
15332
15333 * <s></s>: a
15334 !! result
15335 <ul><li> bar <span>[[foo]]</span>
15336 </li></ul>
15337 <ul><li>=bar <span>[[foo]]</span>
15338 </li></ul>
15339 <ul><li>[[bar <span>[[foo]]</span>
15340 </li></ul>
15341 <ul><li>]]bar <span>[[foo]]</span>
15342 </li></ul>
15343 <ul><li>=bar <span>foo]]</span>=
15344 </li></ul>
15345 <ul><li> <s></s>: a
15346 </li></ul>
15347
15348 !!end
15349
15350 !! test
15351 Lists: 6. Escape bullets in SOL position
15352 !! options
15353 parsoid
15354 !! input
15355 <!--cmt--><nowiki>*foo</nowiki>
15356 !! result
15357 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
15358 !!end
15359
15360 !! test
15361 Lists: 7. Escape bullets in a multi-line context
15362 !! input
15363 a
15364 <nowiki>*</nowiki>b
15365 !! result
15366 <p>a
15367 *b
15368 </p>
15369 !!end
15370
15371 #### --------------- HRs ---------------
15372 #### 1. Single line
15373 #### -----------------------------------
15374
15375 !! test
15376 HRs: 1. Single line
15377 !! options
15378 parsoid
15379 !! input
15380 ----<nowiki>----</nowiki>
15381 ----=foo=
15382 ----*foo
15383 !! result
15384 <hr><span typeof="mw:Nowiki">----</span>
15385 <hr>=foo=
15386 <hr>*foo
15387 !! end
15388
15389 #### --------------- Tables ---------------
15390 #### 1a. Simple example
15391 #### 1b. No escaping needed (!foo)
15392 #### 1c. No escaping needed (|foo)
15393 #### 1d. No escaping needed (|}foo)
15394 ####
15395 #### 2a. Nested in td (<td>foo|bar</td>)
15396 #### 2b. Nested in td (<td>foo||bar</td>)
15397 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
15398 ####
15399 #### 3a. Nested in th (<th>foo!bar</th>)
15400 #### 3b. Nested in th (<th>foo!!bar</th>)
15401 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
15402 ####
15403 #### 4a. Escape -
15404 #### 4b. Escape +
15405 #### 4c. No escaping needed
15406 #### --------------------------------------
15407
15408 !! test
15409 Tables: 1a. Simple example
15410 !! input
15411 <nowiki>{|
15412 |}</nowiki>
15413 !! result
15414 <p>{|
15415 |}
15416 </p>
15417 !! end
15418
15419 !! test
15420 Tables: 1b. No escaping needed
15421 !! input
15422 !foo
15423 !! result
15424 <p>!foo
15425 </p>
15426 !! end
15427
15428 !! test
15429 Tables: 1c. No escaping needed
15430 !! input
15431 |foo
15432 !! result
15433 <p>|foo
15434 </p>
15435 !! end
15436
15437 !! test
15438 Tables: 1d. No escaping needed
15439 !! input
15440 |}foo
15441 !! result
15442 <p>|}foo
15443 </p>
15444 !! end
15445
15446 !! test
15447 Tables: 2a. Nested in td
15448 !! options
15449 parsoid
15450 !! input
15451 {|
15452 |<nowiki>foo|bar</nowiki>
15453 |}
15454 !! result
15455 <table><tbody><tr>
15456 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
15457 !! end
15458
15459 !! test
15460 Tables: 2b. Nested in td
15461 !! options
15462 parsoid
15463 !! input
15464 {|
15465 |<nowiki>foo||bar</nowiki>
15466 |''it''<nowiki>foo||bar</nowiki>
15467 |}
15468 !! result
15469 <table><tbody><tr>
15470 <td><span typeof="mw:Nowiki">foo||bar</span></td>
15471 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
15472 !! end
15473
15474 !! test
15475 Tables: 2c. Nested in td -- no escaping needed
15476 !! options
15477 parsoid
15478 !! input
15479 {|
15480 |foo!!bar
15481 |}
15482 !! result
15483 <table><tbody><tr><td>foo!!bar
15484 </td></tr></tbody></table>
15485
15486 !! end
15487
15488 !! test
15489 Tables: 3a. Nested in th
15490 !! options
15491 parsoid
15492 !! input
15493 {|
15494 !foo!bar
15495 |}
15496 !! result
15497 <table><tbody><tr><th>foo!bar
15498 </th></tr></tbody></table>
15499
15500 !! end
15501
15502 !! test
15503 Tables: 3b. Nested in th
15504 !! options
15505 parsoid
15506 !! input
15507 {|
15508 !<nowiki>foo!!bar</nowiki>
15509 |}
15510 !! result
15511 <table>
15512 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
15513 </tbody></table>
15514 !! end
15515
15516 !! test
15517 Tables: 3c. Nested in th -- no escaping needed
15518 !! options
15519 parsoid
15520 !! input
15521 {|
15522 !<nowiki>foo||bar</nowiki>
15523 |}
15524 !! result
15525 <table><tbody><tr>
15526 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
15527 !! end
15528
15529 !! test
15530 Tables: 4a. Escape -
15531 !! options
15532 parsoid
15533 !! input
15534 {|
15535 |-
15536 !-bar
15537 |-
15538 |<nowiki>-bar</nowiki>
15539 |}
15540 !! result
15541 <table><tbody>
15542 <tr><th>-bar</th></tr>
15543 <tr>
15544 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
15545 !! end
15546
15547 !! test
15548 Tables: 4b. Escape +
15549 !! options
15550 parsoid
15551 !! input
15552 {|
15553 |-
15554 !+bar
15555 |-
15556 |<nowiki>+bar</nowiki>
15557 |}
15558 !! result
15559 <table><tbody>
15560 <tr><th>+bar</th></tr>
15561 <tr>
15562 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
15563 !! end
15564
15565 !! test
15566 Tables: 4c. No escaping needed
15567 !! options
15568 parsoid
15569 !! input
15570 {|
15571 |-
15572 |foo-bar
15573 |foo+bar
15574 |-
15575 |''foo''-bar
15576 |''foo''+bar
15577 |}
15578 !! result
15579 <table><tbody>
15580 <tr><td>foo-bar</td><td>foo+bar</td></tr>
15581 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
15582 </tbody></table>
15583 !! end
15584
15585 ### SSS FIXME: Disabled right now because accurate html2wt
15586 ### on this snippet requires data-parsoid flags that we've
15587 ### stripped out of these tests. We should scheme how we
15588 ### we want to handle these kind of tests that require
15589 ### data-parsoid flags for accurate html2wt serialization
15590
15591 !! test
15592 Tables: 4d. No escaping needed
15593 !! options
15594 disabled
15595 !! input
15596 {|
15597 ||+1
15598 ||-2
15599 |}
15600 !! result
15601 <table>
15602 <tr>
15603 <td>+1
15604 </td>
15605 <td>-2
15606 </td></tr></table>
15607
15608 !! end
15609
15610 #### --------------- Links ----------------
15611 #### 1. Quote marks in link text
15612 #### 2. Wikilinks: Escapes needed
15613 #### 3. Wikilinks: No escapes needed
15614 #### 4. Extlinks: Escapes needed
15615 #### 5. Extlinks: No escapes needed
15616 #### --------------------------------------
15617 !! test
15618 Links 1. Quote marks in link text
15619 !! options
15620 parsoid
15621 !! input
15622 [[Foo|Foo<nowiki>''boo''</nowiki>]]
15623 !! result
15624 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
15625 !! end
15626
15627 !! test
15628 Links 2. WikiLinks: Escapes needed
15629 !! options
15630 parsoid
15631 !! input
15632 [[Foo|<nowiki>[Foobar]</nowiki>]]
15633 [[Foo|<nowiki>Foobar]</nowiki>]]
15634 [[Foo|x [Foobar] x]]
15635 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
15636 [[Foo|<nowiki>[[Bar]]</nowiki>]]
15637 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
15638 [[Foo|<nowiki>|Bar</nowiki>]]
15639 [[Foo|<nowiki>]]bar</nowiki>]]
15640 [[Foo|<nowiki>[[bar</nowiki>]]
15641 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
15642 !! result
15643 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
15644 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
15645 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
15646 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
15647 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
15648 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
15649 <a href="Foo" rel="mw:WikiLink">|Bar</a>
15650 <a href="Foo" rel="mw:WikiLink">]]bar</a>
15651 <a href="Foo" rel="mw:WikiLink">[[bar</a>
15652 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
15653 !! end
15654
15655 !! test
15656 Links 3. WikiLinks: No escapes needed
15657 !! options
15658 parsoid
15659 !! input
15660 [[Foo|[Foobar]]
15661 [[Foo|foo|bar]]
15662 !! result
15663 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
15664 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
15665 !! end
15666
15667 !! test
15668 Links 4. ExtLinks: Escapes needed
15669 !! options
15670 parsoid
15671 !! input
15672 [http://google.com <nowiki>[google]</nowiki>]
15673 [http://google.com <nowiki>google]</nowiki>]
15674 !! result
15675 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
15676 <a href="http://google.com" rel="mw:ExtLink">google]</a>
15677 !! end
15678
15679 !! test
15680 Links 5. ExtLinks: No escapes needed
15681 !! options
15682 parsoid
15683 !! input
15684 [http://google.com [google]
15685 !! result
15686 <a href="http://google.com" rel="mw:ExtLink">[google</a>
15687 !! end
15688
15689 #### --------------- Quotes ---------------
15690 #### 1. Quotes inside <b> and <i>
15691 #### 2. Link fragments separated by <i> and <b> tags
15692 #### 3. Link fragments inside <i> and <b>
15693 #### --------------------------------------
15694 !! test
15695 1. Quotes inside <b> and <i>
15696 !! input
15697 ''<nowiki>'foo'</nowiki>''
15698 ''<nowiki>''foo''</nowiki>''
15699 ''<nowiki>'''foo'''</nowiki>''
15700 ''foo''<nowiki>'s</nowiki>
15701 '''<nowiki>'foo'</nowiki>'''
15702 '''<nowiki>''foo''</nowiki>'''
15703 '''<nowiki>'''foo'''</nowiki>'''
15704 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
15705 '''foo'''<nowiki>'s</nowiki>
15706 !! result
15707 <p><i>'foo'</i>
15708 <i>''foo''</i>
15709 <i>'''foo'''</i>
15710 <i>foo</i>'s
15711 <b>'foo'</b>
15712 <b>''foo''</b>
15713 <b>'''foo'''</b>
15714 <b>foo'<i>bar'</i>baz</b>
15715 <b>foo</b>'s
15716 </p>
15717 !! end
15718
15719 !! test
15720 2. Link fragments separated by <i> and <b> tags
15721 !! input
15722 [[''foo''<nowiki>hello]]</nowiki>
15723
15724 [['''foo'''<nowiki>hello]]</nowiki>
15725 !! result
15726 <p>[[<i>foo</i>hello]]
15727 </p><p>[[<b>foo</b>hello]]
15728 </p>
15729 !! end
15730
15731 !! test
15732 2. Link fragments inside <i> and <b>
15733 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
15734 this is one of the shortcomings of this format)
15735 !! input
15736 ''[[foo''<nowiki>]]</nowiki>
15737
15738 '''[[foo'''<nowiki>]]</nowiki>
15739 !! result
15740 <p><i>[[foo</i>]]
15741 </p><p><b>[[foo</b>]]
15742 </p>
15743 !! end
15744
15745 #### ----------- Paragraphs ---------------
15746 #### 1. No unnecessary escapes
15747 #### --------------------------------------
15748
15749 !! test
15750 1. No unnecessary escapes
15751 !! input
15752 bar <span><nowiki>[[foo]]</nowiki></span>
15753
15754 =bar <span><nowiki>[[foo]]</nowiki></span>
15755
15756 [[bar <span><nowiki>[[foo]]</nowiki></span>
15757
15758 ]]bar <span><nowiki>[[foo]]</nowiki></span>
15759
15760 =bar <span>foo]]</span><nowiki>=</nowiki>
15761 !! result
15762 <p>bar <span>[[foo]]</span>
15763 </p><p>=bar <span>[[foo]]</span>
15764 </p><p>[[bar <span>[[foo]]</span>
15765 </p><p>]]bar <span>[[foo]]</span>
15766 </p><p>=bar <span>foo]]</span>=
15767 </p>
15768 !!end
15769
15770 #### ----------------------- PRE --------------------------
15771 #### 1. Leading whitespace in SOL context should be escaped
15772 #### ------------------------------------------------------
15773 !! test
15774 1. Leading whitespace in SOL context should be escaped
15775 !! options
15776 parsoid
15777 !! input
15778 <nowiki> </nowiki>a
15779
15780 <nowiki> </nowiki> a
15781
15782 <nowiki> </nowiki>a(tab)
15783
15784 <nowiki> </nowiki> a
15785 <!--cmt-->
15786 <nowiki> </nowiki> a
15787
15788 a
15789 <nowiki> </nowiki>b
15790
15791 a
15792 <nowiki> </nowiki>b
15793
15794 a
15795 <nowiki> </nowiki> b
15796 !! result
15797 <p> a</p>
15798 <p> a</p>
15799 <p> a(tab)</p>
15800 <p> a</p>
15801 <p><!--cmt--> a</p>
15802 <p>a
15803 b</p>
15804 <p>a
15805 b</p>
15806 <p>a
15807 b</p>
15808 !! end
15809
15810 #### --------------- HTML tags ---------------
15811 #### 1. a tags
15812 #### 2. other tags
15813 #### 3. multi-line html tag
15814 #### -----------------------------------------
15815 !! test
15816 1. a tags
15817 !! options
15818 parsoid
15819 !! input
15820 <a href="http://google.com">google</a>
15821 !! result
15822 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
15823 !! end
15824
15825 !! test
15826 2. other tags
15827 !! input
15828 <nowiki><div>foo</div>
15829 <div style="color:red">foo</div></nowiki>
15830 !! result
15831 <p>&lt;div&gt;foo&lt;/div&gt;
15832 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
15833 </p>
15834 !! end
15835
15836 !! test
15837 3. multi-line html tag
15838 !! input
15839 <nowiki><div
15840 >foo</div
15841 ></nowiki>
15842 !! result
15843 <p>&lt;div
15844 &gt;foo&lt;/div
15845 &gt;
15846 </p>
15847 !! end
15848
15849 !! test
15850 4. extension tags
15851 !! input
15852 <nowiki><ref>foo</ref></nowiki>
15853 !! result
15854 <p>&lt;ref&gt;foo&lt;/ref&gt;
15855 </p>
15856 !! end
15857
15858 #### --------------- Others ---------------
15859 !! test
15860 Escaping nowikis
15861 !! input
15862 &lt;nowiki&gt;foo&lt;/nowiki&gt;
15863 !! result
15864 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
15865 </p>
15866 !! end
15867 !! test
15868
15869 Tag-like HTML structures are passed through as text
15870 !! input
15871 <x y>
15872
15873 <x.y>
15874
15875 <x-y>
15876
15877 1>2
15878
15879 x<y
15880
15881 a>b
15882
15883 1<d e>f
15884 !! result
15885 <p>&lt;x y&gt;
15886 </p><p>&lt;x.y&gt;
15887 </p><p>&lt;x-y&gt;
15888 </p><p>1&gt;2
15889 </p><p>x&lt;y
15890 </p><p>a&gt;b
15891 </p><p>1&lt;d e&gt;f
15892 </p>
15893 !! end
15894
15895
15896 # This fails in the PHP parser (see bug 40670,
15897 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
15898 !! test
15899 Tag names followed by punctuation should not be recognized as tags
15900 !! options
15901 parsoid
15902 !! input
15903 <s.ome> text
15904 !! result
15905 <p>&lt;s.ome&gt; text
15906 </p>
15907 !! end
15908
15909 !! test
15910 HTML tag with necessary entities in attributes
15911 !! input
15912 <span title="&amp;amp;">foo</span>
15913 !! result
15914 <p><span title="&amp;amp;">foo</span>
15915 </p>
15916 !! end
15917
15918 !! test
15919 HTML tag with 'unnecessary' entity encoding in attributes
15920 !! input
15921 <span title="&amp;">foo</span>
15922 !! result
15923 <p><span title="&amp;">foo</span>
15924 </p>
15925 !! end
15926
15927 !! test
15928 HTML tag with broken attribute value quoting
15929 !! input
15930 <span title="Hello world>Foo</span>
15931 !! result
15932 <p><span>Foo</span>
15933 </p>
15934 !! end
15935
15936 !! test
15937 Parsoid-only: HTML tag with broken attribute value quoting
15938 !! options
15939 parsoid
15940 !! input
15941 <span title="Hello world>Foo</span>
15942 !! result
15943 <p><span title="Hello world">Foo</span>
15944 </p>
15945 !! end
15946
15947 !! test
15948 Table with broken attribute value quoting
15949 !! input
15950 {|
15951 | title="Hello world|Foo
15952 |}
15953 !! result
15954 <table>
15955 <tr>
15956 <td>Foo
15957 </td></tr></table>
15958
15959 !! end
15960
15961 !! test
15962 Table with broken attribute value quoting on consecutive lines
15963 !! input
15964 {|
15965 | title="Hello world|Foo
15966 | style="color:red|Bar
15967 |}
15968 !! result
15969 <table>
15970 <tr>
15971 <td>Foo
15972 </td>
15973 <td>Bar
15974 </td></tr></table>
15975
15976 !! end
15977
15978 !! test
15979 Parsoid-only: Table with broken attribute value quoting on consecutive lines
15980 !! options
15981 parsoid
15982 !! input
15983 {|
15984 | title="Hello world|Foo
15985 | style="color:red|Bar
15986 |}
15987 !! result
15988 <table><tbody>
15989 <tr>
15990 <td title="Hello world">Foo
15991 </td><td style="color: red">Bar
15992 </td></tr></tbody></table>
15993
15994 !! end
15995
15996 !! test
15997 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
15998 !! options
15999 parsoid
16000 !! input
16001 {{}}
16002 !! result
16003 {{}}
16004 !! end
16005
16006 !! test
16007 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16008 !! options
16009 parsoid
16010 !! input
16011 }}{{
16012 !! result
16013 }}{{
16014 !! end
16015
16016 !!test
16017 Accept empty td cell attribute
16018 !!input
16019 {|
16020 | align="center" | foo || |
16021 |}
16022 !!result
16023 <table>
16024 <tr>
16025 <td align="center"> foo </td>
16026 <td>
16027 </td></tr></table>
16028
16029 !!end
16030
16031 !!test
16032 Non-empty attributes in th-cells
16033 !!input
16034 {|
16035 ! Foo !! style="color: red" | Bar
16036 |}
16037 !!result
16038 <table>
16039 <tr>
16040 <th> Foo </th>
16041 <th style="color: red"> Bar
16042 </th></tr></table>
16043
16044 !!end
16045
16046 !!test
16047 Accept empty attributes in th-cells
16048 !!input
16049 {|
16050 !| foo !!| bar
16051 |}
16052 !!result
16053 <table>
16054 <tr>
16055 <th> foo </th>
16056 <th> bar
16057 </th></tr></table>
16058
16059 !!end
16060
16061 !!test
16062 Empty table rows go away
16063 !!input
16064 {|
16065 | Hello
16066 | there
16067 |- class="foo"
16068 |-
16069 |}
16070 !! result
16071 <table>
16072 <tr>
16073 <td> Hello
16074 </td>
16075 <td> there
16076 </td></tr>
16077
16078 </table>
16079
16080 !! end
16081
16082 ###
16083 ### Parsoid-centric tests for testing RTing of inter-element separators
16084 ### Edge cases not tested by existing parser tests and specific to
16085 ### Parsoid-specific serialization strategies.
16086 ###
16087
16088 !!test
16089 RT-ed inter-element separators should be valid separators
16090 !!input
16091 {|
16092 |- [[foo]]
16093 |}
16094 !!result
16095 <table>
16096
16097 </table>
16098
16099 !!end
16100
16101 !!test
16102 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
16103 (Parsoid-only since PHP parser relies on Tidy for correct output)
16104 !!options
16105 parsoid
16106 !!input
16107 {|
16108 |<small>foo
16109 bar
16110 |}
16111
16112 {|
16113 |<small>foo<small>
16114 |}
16115 !!result
16116 !!end
16117
16118 !!test
16119 Empty TD followed by TD with tpl-generated attribute
16120 !!input
16121 {|
16122 |-
16123 |
16124 |{{echo|style='color:red'}}|foo
16125 |}
16126 !!result
16127 <table>
16128
16129 <tr>
16130 <td>
16131 </td>
16132 <td>foo
16133 </td></tr></table>
16134
16135 !!end
16136
16137 !!test
16138 Indented table with an empty td
16139 !!input
16140 {|
16141 |-
16142 |
16143 |foo
16144 |}
16145 !!result
16146 <table>
16147
16148 <tr>
16149 <td>
16150 </td>
16151 <td>foo
16152 </td></tr></table>
16153
16154 !!end
16155
16156 !!test
16157 Empty TR followed by a template-generated TR
16158 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
16159 !!options
16160 parsoid=wt2html,wt2wt
16161 !!input
16162 {|
16163 |-
16164 {{echo|<tr><td>foo</td></tr>}}
16165 |}
16166 !!result
16167 <table>
16168 <tbody>
16169 <tr></tr>
16170 <tr typeof="mw:Transclusion">
16171 <td>foo</td></tr></tbody></table>
16172 !!end
16173
16174 ## PHP and parsoid output differ for this, and since this is primarily
16175 ## for testing Parsoid's serializer, marking this Parsoid only
16176 !!test
16177 Empty TR followed by mixed-ws-comment line should RT correctly
16178 !!options
16179 parsoid
16180 !!input
16181 {|
16182 |-
16183 <!--c-->
16184 |-
16185 <!--c--> <!--d-->
16186 |}
16187 !!result
16188 <table>
16189 <tbody>
16190 <tr>
16191 <td> <!--c--></td></tr>
16192 <tr>
16193 <td><!--c--> <!--d--></td></tr>
16194 </tbody></table>
16195
16196 !!end
16197
16198 !!test
16199 Multi-line image caption generated by templates with/without trailing newlines
16200 !!options
16201 parsoid
16202 !!input
16203 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
16204 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
16205 !!result
16206 <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>
16207 <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>
16208
16209 !!end
16210
16211 ## PHP emits broken html for this, and since this is primarily
16212 ## a Parsoid serializer test, marking this Parsoid only
16213 !!test
16214 Improperly nested inline or quotes tags with whitespace in between
16215 !!options
16216 parsoid
16217 !!input
16218 <span> <s>x</span> </s>
16219 ''' ''x''' ''
16220 !!result
16221 <p><span> <s>x</s></span><s> </s>
16222 <b> <i>x</i></b><i> </i>
16223 </p>
16224 !!end
16225
16226 # -----------------------------------------------------------------
16227 # The following section of tests are primarily to spec requirements
16228 # around serialization of new/edited content.
16229 #
16230 # All these tests are marked Parsoid html2wt and html2html only
16231 # ----------------------------------------------------------------
16232
16233 !! test
16234 Image: Modifying size of an image
16235 !! options
16236 parsoid=html2wt
16237 !! input
16238 [[Image:Wiki.png|230x230px]]
16239 !! result
16240 <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>
16241 !!end
16242
16243 !! test
16244 Image: New block level image should have \n before and after
16245 !! options
16246 parsoid=html2wt
16247 !! input
16248 123
16249 [[File:Wiki.png|right|thumb|150x150px]]
16250 456
16251 !! result
16252 <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>
16253 !!end
16254
16255 !! test
16256 Lists: Add space after bullets
16257 !! options
16258 parsoid=html2wt
16259 !! input
16260
16261 * foo
16262 * bar
16263 * <span> baz</span>
16264 !! result
16265 <ul>
16266 <li>foo</li>
16267 <li> bar</li>
16268 <li><span> baz</span></li>
16269 </ul>
16270 !! end
16271
16272 !! test
16273 Parsoid: Serialize positional parameters with = in them as named parameter
16274 !! options
16275 parsoid=html2wt
16276 !! input
16277 {{echo|1 = f=oo}}
16278 !! result
16279 <p about="#mwt1" typeof="mw:Transclusion"
16280 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}'
16281 >foo</p>
16282 !! end
16283
16284 # -----------------------------------------------------------------
16285 # End of section for Parsoid-only html2wt tests for serialization
16286 # of new content
16287 # -----------------------------------------------------------------
16288
16289 TODO:
16290 more images
16291 more tables
16292 character entities
16293 and much more
16294 Try for 100% code coverage