Merge "(bug 37158) display personal menu on top of page tabs on Vector"
[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 # showtitle make the first line the title
25 # comment run through Linker::formatComment() instead of main parser
26 # local format section links in edit comment text as local links
27 #
28 # For testing purposes, temporary articles can created:
29 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
30 # where '/' denotes a newline.
31
32 # This is the standard article assumed to exist.
33 !! article
34 Main Page
35 !! text
36 blah blah
37 !! endarticle
38
39 !!article
40 Template:Foo
41 !!text
42 FOO
43 !!endarticle
44
45 !! article
46 Template:Blank
47 !! text
48 !! endarticle
49
50 !! article
51 Template:pipe
52 !! text
53 |
54 !! endarticle
55
56 !!article
57 MediaWiki:bad image list
58 !!text
59 * [[File:Bad.jpg]] except [[Nasty page]]
60 !!endarticle
61
62 !! article
63 Template:inner list
64 !! text
65 * item 1
66 !! endarticle
67
68 !! article
69 Template:!
70 !! text
71 |
72 !! endarticle
73
74 !! article
75 Template:echo
76 !! text
77 {{{1}}}
78 !! endarticle
79
80 !! article
81 Template:echo_with_span
82 !! text
83 <span>{{{1}}}</span>
84 !! endarticle
85
86 !! article
87 Template:echo_with_div
88 !! text
89 <div>{{{1}}}</div>
90 !! endarticle
91
92 !! article
93 Template:attr_str
94 !! text
95 {{{1}}}="{{{2}}}"
96 !! endarticle
97
98 !! article
99 Template:table_attribs
100 !! text
101 <noinclude>
102 |</noinclude>style="color: red"| Foo
103 !! endarticle
104
105 ###
106 ### Basic tests
107 ###
108 !! test
109 Blank input
110 !! input
111 !! result
112 !! end
113
114
115 !! test
116 Simple paragraph
117 !! input
118 This is a simple paragraph.
119 !! result
120 <p>This is a simple paragraph.
121 </p>
122 !! end
123
124 !! test
125 Paragraphs with extra newline spacing
126 !! input
127 foo
128
129 bar
130
131
132 baz
133
134
135
136 booz
137 !! result
138 <p>foo
139 </p><p>bar
140 </p><p><br />
141 baz
142 </p><p><br />
143 </p><p>booz
144 </p>
145 !! end
146
147 !! test
148 Simple list
149 !! input
150 * Item 1
151 * Item 2
152 !! result
153 <ul><li> Item 1
154 </li><li> Item 2
155 </li></ul>
156
157 !! end
158
159 !! test
160 Italics and bold
161 !! input
162 * plain
163 * plain''italic''plain
164 * plain''italic''plain''italic''plain
165 * plain'''bold'''plain
166 * plain'''bold'''plain'''bold'''plain
167 * plain''italic''plain'''bold'''plain
168 * plain'''bold'''plain''italic''plain
169 * plain''italic'''bold-italic'''italic''plain
170 * plain'''bold''bold-italic''bold'''plain
171 * plain'''''bold-italic'''italic''plain
172 * plain'''''bold-italic''bold'''plain
173 * plain''italic'''bold-italic'''''plain
174 * plain'''bold''bold-italic'''''plain
175 * plain l'''italic''plain
176 * plain l''''bold''' plain
177 !! result
178 <ul><li> plain
179 </li><li> plain<i>italic</i>plain
180 </li><li> plain<i>italic</i>plain<i>italic</i>plain
181 </li><li> plain<b>bold</b>plain
182 </li><li> plain<b>bold</b>plain<b>bold</b>plain
183 </li><li> plain<i>italic</i>plain<b>bold</b>plain
184 </li><li> plain<b>bold</b>plain<i>italic</i>plain
185 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
186 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
187 </li><li> plain<i><b>bold-italic</b>italic</i>plain
188 </li><li> plain<b><i>bold-italic</i>bold</b>plain
189 </li><li> plain<i>italic<b>bold-italic</b></i>plain
190 </li><li> plain<b>bold<i>bold-italic</i></b>plain
191 </li><li> plain l'<i>italic</i>plain
192 </li><li> plain l'<b>bold</b> plain
193 </li></ul>
194
195 !! end
196
197 ###
198 ### 2-quote opening sequence tests
199 ###
200 !! test
201 Italics and bold: 2-quote opening sequence: (2,2)
202 !! input
203 ''foo''
204 !! result
205 <p><i>foo</i>
206 </p>
207 !!end
208
209
210 !! test
211 Italics and bold: 2-quote opening sequence: (2,3)
212 !! input
213 ''foo'''
214 !! result
215 <p><i>foo'</i>
216 </p>
217 !!end
218
219
220 !! test
221 Italics and bold: 2-quote opening sequence: (2,4)
222 !! input
223 ''foo''''
224 !! result
225 <p><i>foo''</i>
226 </p>
227 !!end
228
229
230 !! test
231 Italics and bold: 2-quote opening sequence: (2,5)
232 !! input
233 ''foo'''''
234 !! result
235 <p><i>foo</i>
236 </p>
237 !!end
238
239
240 ###
241 ### 3-quote opening sequence tests
242 ###
243
244 !! test
245 Italics and bold: 3-quote opening sequence: (3,2)
246 !! input
247 '''foo''
248 !! result
249 <p>'<i>foo</i>
250 </p>
251 !!end
252
253
254 !! test
255 Italics and bold: 3-quote opening sequence: (3,3)
256 !! input
257 '''foo'''
258 !! result
259 <p><b>foo</b>
260 </p>
261 !!end
262
263
264 !! test
265 Italics and bold: 3-quote opening sequence: (3,4)
266 !! input
267 '''foo''''
268 !! result
269 <p><b>foo'</b>
270 </p>
271 !!end
272
273
274 !! test
275 Italics and bold: 3-quote opening sequence: (3,5)
276 !! input
277 '''foo'''''
278 !! result
279 <p><b>foo</b>
280 </p>
281 !!end
282
283
284 ###
285 ### 4-quote opening sequence tests
286 ###
287
288 !! test
289 Italics and bold: 4-quote opening sequence: (4,2)
290 !! input
291 ''''foo''
292 !! result
293 <p>''<i>foo</i>
294 </p>
295 !!end
296
297
298 !! test
299 Italics and bold: 4-quote opening sequence: (4,3)
300 !! input
301 ''''foo'''
302 !! result
303 <p>'<b>foo</b>
304 </p>
305 !!end
306
307
308 !! test
309 Italics and bold: 4-quote opening sequence: (4,4)
310 !! input
311 ''''foo''''
312 !! result
313 <p>'<b>foo'</b>
314 </p>
315 !!end
316
317
318 !! test
319 Italics and bold: 4-quote opening sequence: (4,5)
320 !! input
321 ''''foo'''''
322 !! result
323 <p>'<b>foo</b>
324 </p>
325 !!end
326
327
328 ###
329 ### 5-quote opening sequence tests
330 ###
331
332 !! test
333 Italics and bold: 5-quote opening sequence: (5,2)
334 !! input
335 '''''foo''
336 !! result
337 <p><b><i>foo</i></b>
338 </p>
339 !!end
340
341
342 !! test
343 Italics and bold: 5-quote opening sequence: (5,3)
344 !! input
345 '''''foo'''
346 !! result
347 <p><i><b>foo</b></i>
348 </p>
349 !!end
350
351
352 !! test
353 Italics and bold: 5-quote opening sequence: (5,4)
354 !! input
355 '''''foo''''
356 !! result
357 <p><i><b>foo'</b></i>
358 </p>
359 !!end
360
361
362 !! test
363 Italics and bold: 5-quote opening sequence: (5,5)
364 !! input
365 '''''foo'''''
366 !! result
367 <p><i><b>foo</b></i>
368 </p>
369 !!end
370
371 ###
372 ### multiple quote sequences in a line
373 ###
374 !! test
375 Italics and bold: multiple quote sequences: (2,4,2)
376 !! input
377 ''foo''''bar''
378 !! result
379 <p><i>foo'<b>bar</b></i>
380 </p>
381 !!end
382
383
384 !! test
385 Italics and bold: multiple quote sequences: (2,4,3)
386 !! input
387 ''foo''''bar'''
388 !! result
389 <p><i>foo'<b>bar</b></i>
390 </p>
391 !!end
392
393
394 !! test
395 Italics and bold: multiple quote sequences: (2,4,4)
396 !! input
397 ''foo''''bar''''
398 !! result
399 <p><i>foo'<b>bar'</b></i>
400 </p>
401 !!end
402
403
404 !! test
405 Italics and bold: multiple quote sequences: (3,4,2)
406 !! input
407 '''foo''''bar''
408 !! result
409 <p><b>foo'</b>bar
410 </p>
411 !!end
412
413
414 !! test
415 Italics and bold: multiple quote sequences: (3,4,3)
416 !! input
417 '''foo''''bar'''
418 !! result
419 <p><b>foo'</b>bar
420 </p>
421 !!end
422
423 ###
424 ### other quote tests
425 ###
426 !! test
427 Italics and bold: other quote tests: (2,3,5)
428 !! input
429 ''this is about '''foo's family'''''
430 !! result
431 <p><i>this is about <b>foo's family</b></i>
432 </p>
433 !!end
434
435
436 !! test
437 Italics and bold: other quote tests: (2,(3,3),2)
438 !! input
439 ''this is about '''foo's''' family''
440 !! result
441 <p><i>this is about <b>foo's</b> family</i>
442 </p>
443 !!end
444
445
446 !! test
447 Italics and bold: other quote tests: (3,2,3,2)
448 !! input
449 '''this is about ''foo'''s family''
450 !! result
451 <p><b>this is about <i>foo</i></b><i>s family</i>
452 </p>
453 !!end
454
455
456 !! test
457 Italics and bold: other quote tests: (3,2,3,3)
458 !! input
459 '''this is about ''foo'''s family'''
460 !! result
461 <p>'<i>this is about </i>foo<b>s family</b>
462 </p>
463 !!end
464
465
466
467 !! test
468 Italics and bold: other quote tests: (3,(2,2),3)
469 !! input
470 '''this is about ''foo's'' family'''
471 !! result
472 <p><b>this is about <i>foo's</i> family</b>
473 </p>
474 !!end
475
476 ###
477 ### <nowiki> test cases
478 ###
479
480 !! test
481 <nowiki> unordered list
482 !! input
483 <nowiki>* This is not an unordered list item.</nowiki>
484 !! result
485 <p>* This is not an unordered list item.
486 </p>
487 !! end
488
489 !! test
490 <nowiki> spacing
491 !! input
492 <nowiki>Lorem ipsum dolor
493
494 sed abit.
495 sed nullum.
496
497 :and a colon
498 </nowiki>
499 !! result
500 <p>Lorem ipsum dolor
501
502 sed abit.
503 sed nullum.
504
505 :and a colon
506
507 </p>
508 !! end
509
510 !! test
511 nowiki 3
512 !! input
513 :There is not nowiki.
514 :There is <nowiki>nowiki</nowiki>.
515
516 #There is not nowiki.
517 #There is <nowiki>nowiki</nowiki>.
518
519 *There is not nowiki.
520 *There is <nowiki>nowiki</nowiki>.
521 !! result
522 <dl><dd>There is not nowiki.
523 </dd><dd>There is nowiki.
524 </dd></dl>
525 <ol><li>There is not nowiki.
526 </li><li>There is nowiki.
527 </li></ol>
528 <ul><li>There is not nowiki.
529 </li><li>There is nowiki.
530 </li></ul>
531
532 !! end
533
534
535 ###
536 ### Comments
537 ###
538 !! test
539 Comments and Pre
540 !! input
541 <!-- comment 1 --> asdf
542
543 <!-- comment 1 --> asdf
544 <!-- comment 2 -->
545
546 <!-- comment 1 --> asdf
547 <!-- comment 2 -->xyz
548
549 <!-- comment 1 --> asdf
550 <!-- comment 2 --> xyz
551 !! result
552 <pre>asdf
553 </pre>
554 <pre>asdf
555 </pre>
556 <pre>asdf
557 </pre>
558 <p>xyz
559 </p>
560 <pre>asdf
561 xyz
562 </pre>
563 !! end
564
565 !! test
566 Comment test 2a
567 !! input
568 asdf
569 <!-- comment 1 -->
570 jkl
571 !! result
572 <p>asdf
573 jkl
574 </p>
575 !! end
576
577 !! test
578 Comment test 2b
579 !! input
580 asdf
581 <!-- comment 1 -->
582
583 jkl
584 !! result
585 <p>asdf
586 </p><p>jkl
587 </p>
588 !! end
589
590 !! test
591 Comment test 3
592 !! input
593 asdf
594 <!-- comment 1 -->
595 <!-- comment 2 -->
596 jkl
597 !! result
598 <p>asdf
599 jkl
600 </p>
601 !! end
602
603 !! test
604 Comment test 4
605 !! input
606 asdf<!-- comment 1 -->jkl
607 !! result
608 <p>asdfjkl
609 </p>
610 !! end
611
612 !! test
613 Comment spacing
614 !! input
615 a
616 <!-- foo --> b <!-- bar -->
617 c
618 !! result
619 <p>a
620 </p>
621 <pre> b
622 </pre>
623 <p>c
624 </p>
625 !! end
626
627 !! test
628 Comment whitespace
629 !! input
630 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
631 !! result
632
633 !! end
634
635 !! test
636 Comment semantics and delimiters
637 !! input
638 <!-- --><!----><!-----><!------>
639 !! result
640
641 !! end
642
643 !! test
644 Comment semantics and delimiters, redux
645 !! input
646 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
647 -- foo -- funky huh? ... -->
648 !! result
649
650 !! end
651
652 !! test
653 Comment semantics and delimiters: directors cut
654 !! input
655 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
656 everything starting with < followed by !-- until the first -- and > we see,
657 that wouldn't be valid XML however, since in XML -- has to terminate a comment
658 -->-->
659 !! result
660 <p>--&gt;
661 </p>
662 !! end
663
664 !! test
665 Comment semantics: nesting
666 !! input
667 <!--<!-- no, we're not going to do anything fancy here -->-->
668 !! result
669 <p>--&gt;
670 </p>
671 !! end
672
673 !! test
674 Comment semantics: unclosed comment at end
675 !! input
676 <!--This comment will run out to the end of the document
677 !! result
678
679 !! end
680
681 !! test
682 Comment in template title
683 !! input
684 {{f<!---->oo}}
685 !! result
686 <p>FOO
687 </p>
688 !! end
689
690 !! test
691 Comment on its own line post-expand
692 !! input
693 a
694 {{blank}}<!---->
695 b
696 !! result
697 <p>a
698 </p><p>b
699 </p>
700 !! end
701
702 !! test
703 Comment on its own line post-expand with non-significant whitespace
704 !! input
705 a
706 {{blank}} <!---->
707 b
708 !! result
709 <p>a
710 </p><p>b
711 </p>
712 !! end
713
714 ###
715 ### paragraph wraping tests
716 ###
717 !! test
718 No block tags
719 !! input
720 a
721
722 b
723 !! result
724 <p>a
725 </p><p>b
726 </p>
727 !! end
728 !! test
729 Block tag on one line
730 !! input
731 a <div>foo</div>
732
733 b
734 !! result
735 a <div>foo</div>
736 <p>b
737 </p>
738 !! end
739
740 !! test
741 Block tag on both lines
742 !! input
743 a <div>foo</div>
744
745 b <div>foo</div>
746 !! result
747 a <div>foo</div>
748 b <div>foo</div>
749
750 !! end
751
752 !! test
753 Multiple lines without block tags
754 !! input
755 <div>foo</div> a
756 b
757 c
758 d<!--foo--> e
759 x <div>foo</div> z
760 !! result
761 <div>foo</div> a
762 <p>b
763 c
764 d e
765 </p>
766 x <div>foo</div> z
767
768 !! end
769
770 ###
771 ### Preformatted text
772 ###
773 !! test
774 Preformatted text
775 !! input
776 This is some
777 Preformatted text
778 With ''italic''
779 And '''bold'''
780 And a [[Main Page|link]]
781 !! result
782 <pre>This is some
783 Preformatted text
784 With <i>italic</i>
785 And <b>bold</b>
786 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
787 </pre>
788 !! end
789
790 !! test
791 Ident preformatting with inline content
792 !! input
793 a
794 ''b''
795 !! result
796 <pre>a
797 <i>b</i>
798 </pre>
799 !! end
800
801 !! test
802 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
803 !! input
804 <pre><nowiki>
805 <b>
806 <cite>
807 <em>
808 </nowiki></pre>
809 !! result
810 <pre>
811 &lt;b&gt;
812 &lt;cite&gt;
813 &lt;em&gt;
814 </pre>
815
816 !! end
817
818 !! test
819 Regression with preformatted in <center>
820 !! input
821 <center>
822 Blah
823 </center>
824 !! result
825 <center>
826 <pre>Blah
827 </pre>
828 </center>
829
830 !! end
831
832 # Expected output in the following test is not really expected (there should be
833 # <pre> in the output) -- it's only testing for well-formedness.
834 !! test
835 Bug 6200: Preformatted in <blockquote>
836 !! input
837 <blockquote>
838 Blah
839 </blockquote>
840 !! result
841 <blockquote>
842 Blah
843 </blockquote>
844
845 !! end
846
847 !! test
848 <pre> with attributes (bug 3202)
849 !! input
850 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
851 !! result
852 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
853
854 !! end
855
856 !! test
857 <pre> with width attribute (bug 3202)
858 !! input
859 <pre width="8">Narrow screen goodies</pre>
860 !! result
861 <pre width="8">Narrow screen goodies</pre>
862
863 !! end
864
865 !! test
866 <pre> with forbidden attribute (bug 3202)
867 !! input
868 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
869 !! result
870 <pre width="8">Narrow screen goodies</pre>
871
872 !! end
873
874 !! test
875 <pre> with forbidden attribute values (bug 3202)
876 !! input
877 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
878 !! result
879 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
880
881 !! end
882
883 !! test
884 <nowiki> inside <pre> (bug 13238)
885 !! input
886 <pre>
887 <nowiki>
888 </pre>
889 <pre>
890 <nowiki></nowiki>
891 </pre>
892 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
893 !! result
894 <pre>
895 &lt;nowiki&gt;
896 </pre>
897 <pre>
898
899 </pre>
900 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
901
902 !! end
903
904 !! test
905 <nowiki> and <pre> preference (first one wins)
906 !! input
907 <pre>
908 <nowiki>
909 </pre>
910 </nowiki>
911 </pre>
912
913 <nowiki>
914 <pre>
915 <nowiki>
916 </pre>
917 </nowiki>
918 </pre>
919
920 !! result
921 <pre>
922 &lt;nowiki&gt;
923 </pre>
924 <p>&lt;/nowiki&gt;
925 &lt;/pre&gt;
926 </p><p>
927 &lt;pre&gt;
928 &lt;nowiki&gt;
929 &lt;/pre&gt;
930
931 &lt;/pre&gt;
932 </p>
933 !! end
934
935 !! test
936 </pre> inside nowiki
937 !! input
938 <nowiki></pre></nowiki>
939 !! result
940 <p>&lt;/pre&gt;
941 </p>
942 !! end
943
944 !!test
945 Templates: Pre: 1a. Templates that break a line should suppress <pre>
946 !!input
947 {{echo|}}
948 !!result
949
950 !!end
951
952 !!test
953 Templates: Pre: 1b. Templates that break a line should suppress <pre>
954 !!input
955 {{echo|
956 foo}}
957 !!result
958 <p>foo
959 </p>
960 !!end
961
962 !! test
963 Templates: Pre: 1c: Wrapping should be based on expanded content
964 !! input
965 {{echo|a
966 b}}
967 !!result
968 <pre>a
969 </pre>
970 <p>b
971 </p>
972 !!end
973
974 !! test
975 Templates: Pre: 1d: Wrapping should be based on expanded content
976 !! input
977 {{echo|a
978 b
979 c
980 d
981 e
982 }}
983 !!result
984 <pre>a
985 </pre>
986 <p>b
987 c
988 </p>
989 <pre>d
990 </pre>
991 <p>e
992 </p>
993 !!end
994
995 !!test
996 Templates: Pre: 1e. Wrapping should be based on expanded content
997 !!input
998 {{echo| foo}}
999
1000 {{echo| foo}}{{echo| bar}}
1001
1002 {{echo| foo}}
1003 {{echo| bar}}
1004
1005 {{echo|<!--cmt--> foo}}
1006
1007 <!--cmt-->{{echo| foo}}
1008
1009 {{echo|{{echo| }}bar}}
1010 !!result
1011 <pre>foo
1012 </pre>
1013 <pre>foo bar
1014 </pre>
1015 <pre>foo
1016 bar
1017 </pre>
1018 <pre>foo
1019 </pre>
1020 <pre>foo
1021 </pre>
1022 <pre>bar
1023 </pre>
1024 !!end
1025
1026 !! test
1027 Templates: Pre: 1f: Wrapping should be based on expanded content
1028 !! input
1029 {{echo| }}a
1030
1031 {{echo|
1032 }}a
1033
1034 {{echo|
1035 b}}
1036
1037 {{echo|a
1038 }}b
1039
1040 {{echo|a
1041 }} b
1042 !!result
1043 <pre>a
1044 </pre>
1045 <p><br />
1046 </p>
1047 <pre>a
1048 </pre>
1049 <p><br />
1050 </p>
1051 <pre>b
1052 </pre>
1053 <p>a
1054 </p>
1055 <pre>b
1056 </pre>
1057 <p>a
1058 </p>
1059 <pre>b
1060 </pre>
1061 !!end
1062
1063 !! test
1064 Templates: Single-line variant of parameter whitespace stripping test
1065 !! input
1066 {{echo| a}}
1067
1068 {{echo|1= a}}
1069
1070 {{echo|{{echo| a}}}}
1071
1072 {{echo|1={{echo| a}}}}
1073 !! result
1074 <pre>a
1075 </pre>
1076 <p>a
1077 </p>
1078 <pre>a
1079 </pre>
1080 <p>a
1081 </p>
1082 !! end
1083
1084 !! test
1085 Templates: Strip whitespace from named parameters, but not positional ones
1086 !! input
1087 {{echo|
1088 foo}}
1089
1090 {{echo|
1091 * foo}}
1092
1093 {{echo| 1 =
1094 foo}}
1095
1096 {{echo| 1 =
1097 * foo}}
1098 !! result
1099 <pre>foo
1100 </pre>
1101 <p><br />
1102 </p>
1103 <ul><li> foo
1104 </li></ul>
1105 <p>foo
1106 </p>
1107 <ul><li> foo
1108 </li></ul>
1109
1110 !! end
1111
1112 ###
1113 ### Parsoid-centric tests for testing RT edge cases for pre
1114 ###
1115
1116 !!test
1117 1a. Pre and Comments
1118 !!input
1119 a
1120 <!--a-->
1121 c
1122 !!result
1123 <pre>a
1124 </pre>
1125 <p>c
1126 </p>
1127 !!end
1128
1129 !!test
1130 1b. Pre and Comments
1131 !!input
1132 a
1133 <!--a-->
1134 c
1135 !!result
1136 <pre>a
1137 </pre>
1138 <p>c
1139 </p>
1140 !!end
1141
1142 !!test
1143 1c. Pre and Comments
1144 !!input
1145 <!--a--> a
1146
1147 <!--a--> a
1148 !!result
1149 <pre> a
1150 </pre>
1151 <pre> a
1152 </pre>
1153 !!end
1154
1155 !!test
1156 2a. Pre and tables
1157 !!input
1158 {|
1159 |-
1160 !h1!!h2
1161 |foo||bar
1162 |}
1163 !!result
1164 <table>
1165
1166 <tr>
1167 <th>h1</th>
1168 <th>h2
1169 </th>
1170 <td>foo</td>
1171 <td>bar
1172 </td></tr></table>
1173
1174 !!end
1175
1176 !!test
1177 2b. Pre and tables
1178 !!input
1179 {|
1180 |-
1181 |foo
1182 |}
1183 !!result
1184 <table>
1185
1186 <tr>
1187 <td>foo
1188 </td></tr></table>
1189
1190 !!end
1191
1192 !!test
1193 3a. Pre and block tags (single-line html)
1194 !!input
1195 <p> foo </p>
1196 <div> foo </div>
1197 <span> foo </span>
1198 !!result
1199 <p> foo </p>
1200 <div> foo </div>
1201 <pre><span> foo </span>
1202 </pre>
1203 !!end
1204
1205 !!test
1206 3b. Pre and block tags (pre-content on separate line)
1207 !!input
1208 <p>
1209 foo
1210 </p>
1211
1212 <div>
1213 foo
1214 </div>
1215
1216 <center>
1217 foo
1218 </center>
1219
1220 <blockquote>
1221 foo
1222 </blockquote>
1223
1224 <table><tr><td>
1225 foo
1226 </td></tr></table>
1227
1228 <ul><li>
1229 foo
1230 </li></ul>
1231
1232 !!result
1233 <p>
1234 foo
1235 </p>
1236 <div>
1237 <pre>foo
1238 </pre>
1239 </div>
1240 <center>
1241 <pre>foo
1242 </pre>
1243 </center>
1244 <blockquote>
1245 foo
1246 </blockquote>
1247 <table><tr><td>
1248 <pre>foo
1249 </pre>
1250 </td></tr></table>
1251 <ul><li>
1252 foo
1253 </li></ul>
1254
1255 !!end
1256
1257 !!test
1258 4. Multiple spaces at start-of-line
1259 !!input
1260 <p> foo </p>
1261 foo
1262 {|
1263 |foo
1264 |}
1265 !!result
1266 <p> foo </p>
1267 <pre> foo
1268 </pre>
1269 <table>
1270 <tr>
1271 <td>foo
1272 </td></tr></table>
1273
1274 !!end
1275
1276 ###
1277 ### Definition lists
1278 ###
1279 !! test
1280 Simple definition
1281 !! input
1282 ; name : Definition
1283 !! result
1284 <dl><dt> name&#160;</dt><dd> Definition
1285 </dd></dl>
1286
1287 !! end
1288
1289 !! test
1290 Definition list for indentation only
1291 !! input
1292 : Indented text
1293 !! result
1294 <dl><dd> Indented text
1295 </dd></dl>
1296
1297 !! end
1298
1299 !! test
1300 Definition list with no space
1301 !! input
1302 ;name:Definition
1303 !! result
1304 <dl><dt>name</dt><dd>Definition
1305 </dd></dl>
1306
1307 !!end
1308
1309 !! test
1310 Definition list with URL link
1311 !! input
1312 ; http://example.com/ : definition
1313 !! result
1314 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1315 </dd></dl>
1316
1317 !! end
1318
1319 !! test
1320 Definition list with bracketed URL link
1321 !! input
1322 ;[http://www.example.com/ Example]:Something about it
1323 !! result
1324 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1325 </dd></dl>
1326
1327 !! end
1328
1329 !! test
1330 Definition list with wikilink containing colon
1331 !! input
1332 ; [[Help:FAQ]]: The least-read page on Wikipedia
1333 !! result
1334 <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
1335 </dd></dl>
1336
1337 !! end
1338
1339 # At Brion's and JeLuF's insistence... :)
1340 !! test
1341 Definition list with news link containing colon
1342 !! input
1343 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1344 !! result
1345 <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!
1346 </dd></dl>
1347
1348 !! end
1349
1350 !! test
1351 Malformed definition list with colon
1352 !! input
1353 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1354 !! result
1355 <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
1356 </dt></dl>
1357
1358 !! end
1359
1360 !! test
1361 Definition lists: colon in external link text
1362 !! input
1363 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1364 !! result
1365 <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
1366 </dd></dl>
1367
1368 !! end
1369
1370 !! test
1371 Definition lists: colon in HTML attribute
1372 !! input
1373 ;<b style="display: inline">bold</b>
1374 !! result
1375 <dl><dt><b style="display: inline">bold</b>
1376 </dt></dl>
1377
1378 !! end
1379
1380 !! test
1381 Definition lists: self-closed tag
1382 !! input
1383 ;one<br/>two : two-line fun
1384 !! result
1385 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1386 </dd></dl>
1387
1388 !! end
1389
1390 !! test
1391 Bug 11748: Literal closing tags
1392 !! input
1393 <dl>
1394 <dt>test 1</dt>
1395 <dd>test test test test test</dd>
1396 <dt>test 2</dt>
1397 <dd>test test test test test</dd>
1398 </dl>
1399 !! result
1400 <dl>
1401 <dt>test 1</dt>
1402 <dd>test test test test test</dd>
1403 <dt>test 2</dt>
1404 <dd>test test test test test</dd>
1405 </dl>
1406
1407 !! end
1408
1409 !! test
1410 Definition and unordered list using wiki syntax nested in unordered list using html tags.
1411 !! input
1412 <ul><li>
1413 ; term : description
1414 * unordered
1415 </li>
1416 </ul>
1417 !! result
1418 <ul><li>
1419 <dl><dt> term&#160;</dt><dd> description
1420 </dd></dl>
1421 <ul><li> unordered
1422 </li></ul>
1423 </li>
1424 </ul>
1425
1426 !! end
1427
1428 !! test
1429
1430 Definition list with empty definition and following paragraph
1431 !! input
1432 ; term:
1433 Paragraph text
1434 !! result
1435 <dl><dt> term</dt><dd>
1436 </dd></dl>
1437 <p>Paragraph text
1438 </p>
1439 !! end
1440
1441 !! test
1442 Nested definition lists using html syntax
1443 !! input
1444 <dl><dd>
1445 <dl>
1446 <dd>Foo</dd>
1447 </dl>
1448 </dd></dl>
1449 !! result
1450 <dl><dd>
1451 <dl>
1452 <dd>Foo</dd>
1453 </dl>
1454 </dd></dl>
1455
1456 !! end
1457
1458 !! test
1459 Definition Lists: No nesting: Multiple dd's
1460 !! input
1461 ;x
1462 :a
1463 :b
1464 !! result
1465 <dl><dt>x
1466 </dt><dd>a
1467 </dd><dd>b
1468 </dd></dl>
1469
1470 !! end
1471
1472 !! test
1473 Definition Lists: Indentation: Regular
1474 !! input
1475 :i1
1476 ::i2
1477 :::i3
1478 !! result
1479 <dl><dd>i1
1480 <dl><dd>i2
1481 <dl><dd>i3
1482 </dd></dl>
1483 </dd></dl>
1484 </dd></dl>
1485
1486 !! end
1487
1488 !! test
1489 Definition Lists: Indentation: Missing 1st level
1490 !! input
1491 ::i2
1492 :::i3
1493 !! result
1494 <dl><dd><dl><dd>i2
1495 <dl><dd>i3
1496 </dd></dl>
1497 </dd></dl>
1498 </dd></dl>
1499
1500 !! end
1501
1502 !! test
1503 Definition Lists: Indentation: Multi-level indent
1504 !! input
1505 :::i3
1506 !! result
1507 <dl><dd><dl><dd><dl><dd>i3
1508 </dd></dl>
1509 </dd></dl>
1510 </dd></dl>
1511
1512 !! end
1513
1514 !! test
1515 Definition Lists: Hacky use to indent tables
1516 !! input
1517 ::{|
1518 |foo
1519 |bar
1520 |}
1521 this text
1522 should be left alone
1523 !! result
1524 <dl><dd><dl><dd><table>
1525 <tr>
1526 <td>foo
1527 </td>
1528 <td>bar
1529 </td></tr></table></dd></dl></dd></dl>
1530 <p>this text
1531 should be left alone
1532 </p>
1533 !! end
1534 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
1535 ## as an empty dt item. It also ignores all but the last ";" when followed
1536 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
1537 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
1538 ## ";"s.
1539 ##
1540 ## Ex: ";;t2 ::d2" is transformed into:
1541 ##
1542 ## <dl>
1543 ## <dt>t2 </dt>
1544 ## <dd>
1545 ## <dl>
1546 ## <dt></dt>
1547 ## <dd>d2</dd>
1548 ## </dl>
1549 ## </dd>
1550 ## </dl>
1551 ##
1552 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
1553 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
1554 ##
1555 ## <dl>
1556 ## <dt>
1557 ## <dl>
1558 ## <dt>t2 </dt>
1559 ## <dd>:d2</dd>
1560 ## </dl>
1561 ## </dt>
1562 ## </dl>
1563 ##
1564 ## All Parsoid only definition list tests have this difference.
1565 ##
1566 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
1567 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
1568
1569 !! test
1570 Definition Lists: Nesting: Multi-level (Parsoid only)
1571 !! options
1572 disabled
1573 !! input
1574 ;t1 :d1
1575 ;;t2 ::d2
1576 ;;;t3 :::d3
1577 !! result
1578 <dl>
1579 <dt>t1 </dt>
1580 <dd>d1</dd>
1581 <dt>
1582 <dl>
1583 <dt>t2 </dt>
1584 <dd>:d2</dd>
1585 <dt>
1586 <dl>
1587 <dt>t3 </dt>
1588 <dd>::d3</dd>
1589 </dl>
1590 </dt>
1591 </dl>
1592 </dt>
1593 </dl>
1594
1595
1596 !! end
1597
1598
1599 !! test
1600 Definition Lists: Nesting: Test 2 (Parsoid only)
1601 !! options
1602 disabled
1603 !! input
1604 ;t1
1605 ::d2
1606 !! result
1607 <dl>
1608 <dt>t1</dt>
1609 <dd>
1610 <dl>
1611 <dd>d2</dd>
1612 </dl>
1613 </dd>
1614 </dl>
1615
1616 !! end
1617
1618
1619 !! test
1620 Definition Lists: Nesting: Test 3 (Parsoid only)
1621 !! options
1622 disabled
1623 !! input
1624 :;t1
1625 ::::d2
1626 !! result
1627 <dl>
1628 <dd>
1629 <dl>
1630 <dt>t1</dt>
1631 <dd>
1632 <dl>
1633 <dd>
1634 <dl>
1635 <dd>d2</dd>
1636 </dl>
1637 </dd>
1638 </dl>
1639 </dd>
1640 </dl>
1641 </dd>
1642 </dl>
1643
1644 !! end
1645
1646
1647 !! test
1648 Definition Lists: Nesting: Test 4
1649 !! input
1650 ::;t3
1651 :::d3
1652 !! result
1653 <dl><dd><dl><dd><dl><dt>t3
1654 </dt><dd>d3
1655 </dd></dl>
1656 </dd></dl>
1657 </dd></dl>
1658
1659 !! end
1660
1661
1662 !! test
1663 Definition Lists: Mixed Lists: Test 1
1664 !! input
1665 :;* foo
1666 ::* bar
1667 :; baz
1668 !! result
1669 <dl><dd><dl><dt><ul><li> foo
1670 </li><li> bar
1671 </li></ul>
1672 </dt></dl>
1673 <dl><dt> baz
1674 </dt></dl>
1675 </dd></dl>
1676
1677 !! end
1678
1679
1680 !! test
1681 Definition Lists: Mixed Lists: Test 2
1682 !! input
1683 *: d1
1684 *: d2
1685 !! result
1686 <ul><li><dl><dd> d1
1687 </dd><dd> d2
1688 </dd></dl>
1689 </li></ul>
1690
1691 !! end
1692
1693
1694 !! test
1695 Definition Lists: Mixed Lists: Test 3
1696 !! input
1697 *::: d1
1698 *::: d2
1699 !! result
1700 <ul><li><dl><dd><dl><dd><dl><dd> d1
1701 </dd><dd> d2
1702 </dd></dl>
1703 </dd></dl>
1704 </dd></dl>
1705 </li></ul>
1706
1707 !! end
1708
1709
1710 !! test
1711 Definition Lists: Mixed Lists: Test 4
1712 !! input
1713 *;d1 :d2
1714 *;d3 :d4
1715 !! result
1716 <ul><li><dl><dt>d1&#160;</dt><dd>d2
1717 </dd><dt>d3&#160;</dt><dd>d4
1718 </dd></dl>
1719 </li></ul>
1720
1721 !! end
1722
1723
1724 !! test
1725 Definition Lists: Mixed Lists: Test 5
1726 !! input
1727 *:d1
1728 *:: d2
1729 !! result
1730 <ul><li><dl><dd>d1
1731 <dl><dd> d2
1732 </dd></dl>
1733 </dd></dl>
1734 </li></ul>
1735
1736 !! end
1737
1738
1739 !! test
1740 Definition Lists: Mixed Lists: Test 6
1741 !! input
1742 #*:d1
1743 #*::: d3
1744 !! result
1745 <ol><li><ul><li><dl><dd>d1
1746 <dl><dd><dl><dd> d3
1747 </dd></dl>
1748 </dd></dl>
1749 </dd></dl>
1750 </li></ul>
1751 </li></ol>
1752
1753 !! end
1754
1755
1756 !! test
1757 Definition Lists: Mixed Lists: Test 7
1758 !! input
1759 :* d1
1760 :* d2
1761 !! result
1762 <dl><dd><ul><li> d1
1763 </li><li> d2
1764 </li></ul>
1765 </dd></dl>
1766
1767 !! end
1768
1769
1770 !! test
1771 Definition Lists: Mixed Lists: Test 8
1772 !! input
1773 :* d1
1774 ::* d2
1775 !! result
1776 <dl><dd><ul><li> d1
1777 </li></ul>
1778 <dl><dd><ul><li> d2
1779 </li></ul>
1780 </dd></dl>
1781 </dd></dl>
1782
1783 !! end
1784
1785
1786 !! test
1787 Definition Lists: Mixed Lists: Test 9
1788 !! input
1789 *;foo :bar
1790 !! result
1791 <ul><li><dl><dt>foo&#160;</dt><dd>bar
1792 </dd></dl>
1793 </li></ul>
1794
1795 !! end
1796
1797
1798 !! test
1799 Definition Lists: Mixed Lists: Test 10
1800 !! input
1801 *#;foo :bar
1802 !! result
1803 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
1804 </dd></dl>
1805 </li></ol>
1806 </li></ul>
1807
1808 !! end
1809
1810
1811 !! test
1812 Definition Lists: Mixed Lists: Test 11
1813 !! input
1814 *#*#;*;;foo :bar
1815 *#*#;boo :baz
1816 !! result
1817 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
1818 </dt></dl>
1819 </dd></dl>
1820 </li></ul>
1821 </dd></dl>
1822 <dl><dt>boo&#160;</dt><dd>baz
1823 </dd></dl>
1824 </li></ol>
1825 </li></ul>
1826 </li></ol>
1827 </li></ul>
1828
1829 !! end
1830
1831
1832 !! test
1833 Definition Lists: Weird Ones: Test 1
1834 !! input
1835 *#;*::;; foo : bar (who uses this?)
1836 !! result
1837 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
1838 </dt></dl>
1839 </dd></dl>
1840 </dd></dl>
1841 </dd></dl>
1842 </li></ul>
1843 </dd></dl>
1844 </li></ol>
1845 </li></ul>
1846
1847 !! end
1848
1849 ###
1850 ### External links
1851 ###
1852 !! test
1853 External links: non-bracketed
1854 !! input
1855 Non-bracketed: http://example.com
1856 !! result
1857 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
1858 </p>
1859 !! end
1860
1861 !! test
1862 External links: numbered
1863 !! input
1864 Numbered: [http://example.com]
1865 Numbered: [http://example.net]
1866 Numbered: [http://example.com]
1867 !! result
1868 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
1869 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
1870 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
1871 </p>
1872 !!end
1873
1874 !! test
1875 External links: specified text
1876 !! input
1877 Specified text: [http://example.com link]
1878 !! result
1879 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
1880 </p>
1881 !!end
1882
1883 !! test
1884 External links: trail
1885 !! input
1886 Linktrails should not work for external links: [http://example.com link]s
1887 !! result
1888 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
1889 </p>
1890 !! end
1891
1892 !! test
1893 External links: dollar sign in URL
1894 !! input
1895 http://example.com/1$2345
1896 !! result
1897 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
1898 </p>
1899 !! end
1900
1901 !! test
1902 External links: dollar sign in URL (named)
1903 !! input
1904 [http://example.com/1$2345]
1905 !! result
1906 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
1907 </p>
1908 !!end
1909
1910 !! test
1911 External links: open square bracket forbidden in URL (bug 4377)
1912 !! input
1913 http://example.com/1[2345
1914 !! result
1915 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
1916 </p>
1917 !! end
1918
1919 !! test
1920 External links: open square bracket forbidden in URL (named) (bug 4377)
1921 !! input
1922 [http://example.com/1[2345]
1923 !! result
1924 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
1925 </p>
1926 !!end
1927
1928 !! test
1929 External links: nowiki in URL link text (bug 6230)
1930 !!input
1931 [http://example.com/ <nowiki>''example site''</nowiki>]
1932 !! result
1933 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
1934 </p>
1935 !! end
1936
1937 !! test
1938 External links: newline forbidden in text (bug 6230 regression check)
1939 !! input
1940 [http://example.com/ first
1941 second]
1942 !! result
1943 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
1944 second]
1945 </p>
1946 !!end
1947
1948 !! test
1949 External links: Pipe char between url and text
1950 !! input
1951 [http://example.com | link]
1952 !! result
1953 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
1954 </p>
1955 !!end
1956
1957 !! test
1958 External links: protocol-relative URL in brackets
1959 !! input
1960 [//example.com/ Test]
1961 !! result
1962 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
1963 </p>
1964 !! end
1965
1966 !! test
1967 External links: protocol-relative URL in brackets without text
1968 !! input
1969 [//example.com]
1970 !! result
1971 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
1972 </p>
1973 !! end
1974
1975 !! test
1976 External links: protocol-relative URL in free text is left alone
1977 !! input
1978 //example.com/Foo
1979 !! result
1980 <p>//example.com/Foo
1981 </p>
1982 !!end
1983
1984 !! test
1985 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
1986 !! input
1987 foo//example.com/Foo
1988 !! result
1989 <p>foo//example.com/Foo
1990 </p>
1991 !! end
1992
1993 !! test
1994 External image
1995 !! input
1996 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
1997 !! result
1998 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
1999 </p>
2000 !! end
2001
2002 !! test
2003 External image from https
2004 !! input
2005 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2006 !! result
2007 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2008 </p>
2009 !! end
2010
2011 !! test
2012 Link to non-http image, no img tag
2013 !! input
2014 Link to non-http image, no img tag: ftp://example.com/test.jpg
2015 !! result
2016 <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>
2017 </p>
2018 !! end
2019
2020 !! test
2021 External links: terminating separator
2022 !! input
2023 Terminating separator: http://example.com/thing,
2024 !! result
2025 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2026 </p>
2027 !! end
2028
2029 !! test
2030 External links: intervening separator
2031 !! input
2032 Intervening separator: http://example.com/1,2,3
2033 !! result
2034 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2035 </p>
2036 !! end
2037
2038 !! test
2039 External links: old bug with URL in query
2040 !! input
2041 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2042 !! result
2043 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2044 </p>
2045 !! end
2046
2047 !! test
2048 External links: old URL-in-URL bug, mixed protocols
2049 !! input
2050 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2051 !! result
2052 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2053 </p>
2054 !!end
2055
2056 !! test
2057 External links: URL in text
2058 !! input
2059 URL in text: [http://example.com http://example.com]
2060 !! result
2061 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2062 </p>
2063 !! end
2064
2065 !! test
2066 External links: Clickable images
2067 !! input
2068 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2069 !! result
2070 <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>
2071 </p>
2072 !!end
2073
2074 !! test
2075 External links: raw ampersand
2076 !! input
2077 Old &amp; use: http://x&y
2078 !! result
2079 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2080 </p>
2081 !! end
2082
2083 !! test
2084 External links: encoded ampersand
2085 !! input
2086 Old &amp; use: http://x&amp;y
2087 !! result
2088 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2089 </p>
2090 !! end
2091
2092 !! test
2093 External links: encoded equals (bug 6102)
2094 !! input
2095 http://example.com/?foo&#61;bar
2096 !! result
2097 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2098 </p>
2099 !! end
2100
2101 !! test
2102 External links: [raw ampersand]
2103 !! input
2104 Old &amp; use: [http://x&y]
2105 !! result
2106 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2107 </p>
2108 !! end
2109
2110 !! test
2111 External links: [encoded ampersand]
2112 !! input
2113 Old &amp; use: [http://x&amp;y]
2114 !! result
2115 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2116 </p>
2117 !! end
2118
2119 !! test
2120 External links: [encoded equals] (bug 6102)
2121 !! input
2122 [http://example.com/?foo&#61;bar]
2123 !! result
2124 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2125 </p>
2126 !! end
2127
2128 !! test
2129 External links: [IDN ignored character reference in hostname; strip it right off]
2130 !! input
2131 [http://e&zwnj;xample.com/]
2132 !! result
2133 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2134 </p>
2135 !! end
2136
2137 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2138 # Where an external link could easily circumvent the sanitization of the text of
2139 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2140 # test demands a higher standard. That's a bit strange.
2141 #
2142 # Example:
2143 #
2144 # http://e‌xample.com -> [http://example.com|http://example.com]
2145 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2146 #
2147 # The first example is sanitized, but the second is not. Any security benefits
2148 # from this production are trivial to circumvent. Either remove this test and
2149 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2150 # the test accordingly.
2151 #
2152 # All our love,
2153 # The Parsoid team.
2154 !! test
2155 External links: IDN ignored character reference in hostname; strip it right off
2156 !! input
2157 http://e&zwnj;xample.com/
2158 !! result
2159 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2160 </p>
2161 !! end
2162
2163 !! test
2164 External links: www.jpeg.org (bug 554)
2165 !! input
2166 http://www.jpeg.org
2167 !!result
2168 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2169 </p>
2170 !! end
2171
2172 !! test
2173 External links: URL within URL (original bug 2)
2174 !! input
2175 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2176 !! result
2177 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2178 </p>
2179 !! end
2180
2181 !! test
2182 BUG 361: URL inside bracketed URL
2183 !! input
2184 [http://www.example.com/foo http://www.example.com/bar]
2185 !! result
2186 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2187 </p>
2188 !! end
2189
2190 !! test
2191 BUG 361: URL within URL, not bracketed
2192 !! input
2193 http://www.example.com/foo?=http://www.example.com/bar
2194 !! result
2195 <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>
2196 </p>
2197 !! end
2198
2199 !! test
2200 BUG 289: ">"-token in URL-tail
2201 !! input
2202 http://www.example.com/<hello>
2203 !! result
2204 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2205 </p>
2206 !!end
2207
2208 !! test
2209 BUG 289: literal ">"-token in URL-tail
2210 !! input
2211 http://www.example.com/<b>html</b>
2212 !! result
2213 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2214 </p>
2215 !!end
2216
2217 !! test
2218 BUG 289: ">"-token in bracketed URL
2219 !! input
2220 [http://www.example.com/<hello> stuff]
2221 !! result
2222 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2223 </p>
2224 !!end
2225
2226 !! test
2227 BUG 289: literal ">"-token in bracketed URL
2228 !! input
2229 [http://www.example.com/<b>html</b> stuff]
2230 !! result
2231 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2232 </p>
2233 !!end
2234
2235 !! test
2236 BUG 289: literal double quote at end of URL
2237 !! input
2238 http://www.example.com/"hello"
2239 !! result
2240 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2241 </p>
2242 !!end
2243
2244 !! test
2245 BUG 289: literal double quote in bracketed URL
2246 !! input
2247 [http://www.example.com/"hello" stuff]
2248 !! result
2249 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2250 </p>
2251 !!end
2252
2253 !! test
2254 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2255 !! input
2256 [http://www.example.com test]
2257 !! result
2258 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
2259 </p>
2260 !! end
2261
2262 !! test
2263 External links: wiki links within external link (Bug 3695)
2264 !! input
2265 [http://example.com [[wikilink]] embedded in ext link]
2266 !! result
2267 <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>
2268 </p>
2269 !! end
2270
2271 !! test
2272 BUG 787: Links with one slash after the url protocol are invalid
2273 !! input
2274 http:/example.com
2275
2276 [http:/example.com title]
2277 !! result
2278 <p>http:/example.com
2279 </p><p>[http:/example.com title]
2280 </p>
2281 !! end
2282
2283 !! test
2284 Bracketed external links with template-generated invalid target
2285 !! input
2286 [{{echo|http:/example.com}} title]
2287 !! result
2288 <p>[http:/example.com title]
2289 </p>
2290 !! end
2291
2292 !! test
2293 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2294 !! input
2295 ''[http://example.com text'']
2296 [http://example.com '''text]'''
2297 ''Something [http://example.com in italic'']
2298 ''Something [http://example.com mixed''''', even bold]'''
2299 '''''Now [http://example.com both''''']
2300 !! result
2301 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2302 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2303 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2304 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2305 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2306 </p>
2307 !! end
2308
2309
2310 !! test
2311 Bug 4781: %26 in URL
2312 !! input
2313 http://www.example.com/?title=AT%26T
2314 !! result
2315 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2316 </p>
2317 !! end
2318
2319 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2320 # % is actually legal in HTML5. Any change in output would need testing though.
2321 !! test
2322 Bug 4781, 5267: %25 in URL
2323 !! input
2324 http://www.example.com/?title=100%25_Bran
2325 !! result
2326 <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>
2327 </p>
2328 !! end
2329
2330 !! test
2331 Bug 4781, 5267: %28, %29 in URL
2332 !! input
2333 http://www.example.com/?title=Ben-Hur_%281959_film%29
2334 !! result
2335 <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>
2336 </p>
2337 !! end
2338
2339
2340 !! test
2341 Bug 4781: %26 in autonumber URL
2342 !! input
2343 [http://www.example.com/?title=AT%26T]
2344 !! result
2345 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
2346 </p>
2347 !! end
2348
2349 !! test
2350 Bug 4781, 5267: %26 in autonumber URL
2351 !! input
2352 [http://www.example.com/?title=100%25_Bran]
2353 !! result
2354 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
2355 </p>
2356 !! end
2357
2358 !! test
2359 Bug 4781, 5267: %28, %29 in autonumber URL
2360 !! input
2361 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
2362 !! result
2363 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
2364 </p>
2365 !! end
2366
2367
2368 !! test
2369 Bug 4781: %26 in bracketed URL
2370 !! input
2371 [http://www.example.com/?title=AT%26T link]
2372 !! result
2373 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
2374 </p>
2375 !! end
2376
2377 !! test
2378 Bug 4781, 5267: %26 in bracketed URL
2379 !! input
2380 [http://www.example.com/?title=100%25_Bran link]
2381 !! result
2382 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
2383 </p>
2384 !! end
2385
2386 !! test
2387 Bug 4781, 5267: %28, %29 in bracketed URL
2388 !! input
2389 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
2390 !! result
2391 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
2392 </p>
2393 !! end
2394
2395 !! test
2396 External link containing double-single-quotes in text '' (bug 4598 sanity check)
2397 !! input
2398 Some [http://example.com/ pretty ''italics'' and stuff]!
2399 !! result
2400 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
2401 </p>
2402 !! end
2403
2404 !! test
2405 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
2406 !! input
2407 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
2408 !! result
2409 <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>
2410 </p>
2411 !! end
2412
2413 !! test
2414 External link containing double-single-quotes with no space separating the url from text in italics
2415 !! input
2416 [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]].]
2417 !! result
2418 <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>
2419 </p>
2420 !! end
2421
2422 !! test
2423 URL-encoding in URL functions (single parameter)
2424 !! input
2425 {{localurl:Some page|amp=&}}
2426 !! result
2427 <p>/index.php?title=Some_page&amp;amp=&amp;
2428 </p>
2429 !! end
2430
2431 !! test
2432 URL-encoding in URL functions (multiple parameters)
2433 !! input
2434 {{localurl:Some page|q=?&amp=&}}
2435 !! result
2436 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
2437 </p>
2438 !! end
2439
2440 !! test
2441 Brackets in urls
2442 !! input
2443 http://example.com/index.php?foozoid%5B%5D=bar
2444
2445 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
2446 !! result
2447 <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>
2448 </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>
2449 </p>
2450 !! end
2451
2452 !! test
2453 IPv6 urls (bug 21261)
2454 !! options
2455 disabled
2456 !! input
2457 http://[2404:130:0:1000::187:2]/index.php
2458 !! result
2459 <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>
2460 </p>
2461 !! end
2462
2463 ###
2464 ### Quotes
2465 ###
2466
2467 !! test
2468 Quotes
2469 !! input
2470 Normal text. '''Bold text.''' Normal text. ''Italic text.''
2471
2472 Normal text. '''''Bold italic text.''''' Normal text.
2473 !!result
2474 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
2475 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
2476 </p>
2477 !! end
2478
2479
2480 !! test
2481 Unclosed and unmatched quotes
2482 !! input
2483 '''''Bold italic text '''with bold deactivated''' in between.'''''
2484
2485 '''''Bold italic text ''with italic deactivated'' in between.'''''
2486
2487 '''Bold text..
2488
2489 ..spanning two paragraphs (should not work).'''
2490
2491 '''Bold tag left open
2492
2493 ''Italic tag left open
2494
2495 Normal text.
2496
2497 <!-- Unmatching number of opening, closing tags: -->
2498 '''This year''''s election ''should'' beat '''last year''''s.
2499
2500 ''Tom'''s car is bigger than ''Susan'''s.
2501
2502 Plain ''italic'''s plain
2503 !! result
2504 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
2505 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
2506 </p><p><b>Bold text..</b>
2507 </p><p>..spanning two paragraphs (should not work).
2508 </p><p><b>Bold tag left open</b>
2509 </p><p><i>Italic tag left open</i>
2510 </p><p>Normal text.
2511 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
2512 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
2513 </p><p>Plain <i>italic'</i>s plain
2514 </p>
2515 !! end
2516
2517 ###
2518 ### Tables
2519 ###
2520 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
2521 ###
2522
2523 # This should not produce <table></table> as <table><tr><td></td></tr></table>
2524 # is the bare minimun required by the spec, see:
2525 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
2526 !! test
2527 A table with no data.
2528 !! input
2529 {||}
2530 !! result
2531 !! end
2532
2533 # A table with nothing but a caption is invalid XHTML, we might want to render
2534 # this as <p>caption</p>
2535 !! test
2536 A table with nothing but a caption
2537 !! input
2538 {|
2539 |+ caption
2540 |}
2541 !! result
2542 <table>
2543 <caption> caption
2544 </caption><tr><td></td></tr></table>
2545
2546 !! end
2547
2548 !! test
2549 Simple table
2550 !! input
2551 {|
2552 | 1 || 2
2553 |-
2554 | 3 || 4
2555 |}
2556 !! result
2557 <table>
2558 <tr>
2559 <td> 1 </td>
2560 <td> 2
2561 </td></tr>
2562 <tr>
2563 <td> 3 </td>
2564 <td> 4
2565 </td></tr></table>
2566
2567 !! end
2568
2569 !! test
2570 Simple table but with multiple dashes for row wikitext
2571 !! input
2572 {|
2573 | foo
2574 |-----
2575 | bar
2576 |}
2577 !! result
2578 <table>
2579 <tr>
2580 <td> foo
2581 </td></tr>
2582 <tr>
2583 <td> bar
2584 </td></tr></table>
2585
2586 !! end
2587 !! test
2588 Multiplication table
2589 !! input
2590 {| border="1" cellpadding="2"
2591 |+Multiplication table
2592 |-
2593 ! &times; !! 1 !! 2 !! 3
2594 |-
2595 ! 1
2596 | 1 || 2 || 3
2597 |-
2598 ! 2
2599 | 2 || 4 || 6
2600 |-
2601 ! 3
2602 | 3 || 6 || 9
2603 |-
2604 ! 4
2605 | 4 || 8 || 12
2606 |-
2607 ! 5
2608 | 5 || 10 || 15
2609 |}
2610 !! result
2611 <table border="1" cellpadding="2">
2612 <caption>Multiplication table
2613 </caption>
2614 <tr>
2615 <th> &#215; </th>
2616 <th> 1 </th>
2617 <th> 2 </th>
2618 <th> 3
2619 </th></tr>
2620 <tr>
2621 <th> 1
2622 </th>
2623 <td> 1 </td>
2624 <td> 2 </td>
2625 <td> 3
2626 </td></tr>
2627 <tr>
2628 <th> 2
2629 </th>
2630 <td> 2 </td>
2631 <td> 4 </td>
2632 <td> 6
2633 </td></tr>
2634 <tr>
2635 <th> 3
2636 </th>
2637 <td> 3 </td>
2638 <td> 6 </td>
2639 <td> 9
2640 </td></tr>
2641 <tr>
2642 <th> 4
2643 </th>
2644 <td> 4 </td>
2645 <td> 8 </td>
2646 <td> 12
2647 </td></tr>
2648 <tr>
2649 <th> 5
2650 </th>
2651 <td> 5 </td>
2652 <td> 10 </td>
2653 <td> 15
2654 </td></tr></table>
2655
2656 !! end
2657
2658 !!test
2659 Allow +/- in 2nd and later cells in a row
2660 !!input
2661 {|
2662 | 1 || 2 || 3
2663 |-
2664 | 1 || +2 || -3
2665 |}
2666 !!result
2667 <table>
2668 <tr>
2669 <td> 1 </td>
2670 <td> 2 </td>
2671 <td> 3
2672 </td></tr>
2673 <tr>
2674 <td> 1 </td>
2675 <td> +2 </td>
2676 <td> -3
2677 </td></tr></table>
2678
2679 !!end
2680
2681 !! test
2682 Table rowspan
2683 !! input
2684 {| border=1
2685 | Cell 1, row 1
2686 |rowspan=2| Cell 2, row 1 (and 2)
2687 | Cell 3, row 1
2688 |-
2689 | Cell 1, row 2
2690 | Cell 3, row 2
2691 |}
2692 !! result
2693 <table border="1">
2694 <tr>
2695 <td> Cell 1, row 1
2696 </td>
2697 <td rowspan="2"> Cell 2, row 1 (and 2)
2698 </td>
2699 <td> Cell 3, row 1
2700 </td></tr>
2701 <tr>
2702 <td> Cell 1, row 2
2703 </td>
2704 <td> Cell 3, row 2
2705 </td></tr></table>
2706
2707 !! end
2708
2709 !! test
2710 Nested table
2711 !! input
2712 {| border=1
2713 | &alpha;
2714 |
2715 {| bgcolor=#ABCDEF border=2
2716 |nested
2717 |-
2718 |table
2719 |}
2720 |the original table again
2721 |}
2722 !! result
2723 <table border="1">
2724 <tr>
2725 <td> &#945;
2726 </td>
2727 <td>
2728 <table bgcolor="#ABCDEF" border="2">
2729 <tr>
2730 <td>nested
2731 </td></tr>
2732 <tr>
2733 <td>table
2734 </td></tr></table>
2735 </td>
2736 <td>the original table again
2737 </td></tr></table>
2738
2739 !! end
2740
2741 !! test
2742 Invalid attributes in table cell (bug 1830)
2743 !! input
2744 {|
2745 |Cell:|broken
2746 |}
2747 !! result
2748 <table>
2749 <tr>
2750 <td>broken
2751 </td></tr></table>
2752
2753 !! end
2754
2755
2756 !! test
2757 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
2758 !! input
2759 {|
2760 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
2761 !! result
2762 <table>
2763 <tr>
2764 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
2765 <td>]" onmouseover="alert(document.cookie)"&gt;test
2766 </td>
2767 </tr>
2768 </table>
2769
2770 !! end
2771
2772
2773 !! test
2774 Indented table markup mixed with indented pre content (proposed in bug 6200)
2775 !! input
2776 <table>
2777 <tr>
2778 <td>
2779 Text that should be rendered preformatted
2780 </td>
2781 </tr>
2782 </table>
2783 !! result
2784 <table>
2785 <tr>
2786 <td>
2787 <pre>Text that should be rendered preformatted
2788 </pre>
2789 </td>
2790 </tr>
2791 </table>
2792
2793 !! end
2794
2795 !! test
2796 Template-generated table cell attributes and cell content
2797 !! input
2798 {|
2799 |{{table_attribs}}
2800 |}
2801 !! result
2802 <table>
2803 <tr>
2804 <td style="color: red"> Foo
2805 </td></tr></table>
2806
2807 !! end
2808
2809 !! test
2810 Table with row followed by newlines and table heading
2811 !! input
2812 {|
2813 |-
2814
2815 ! foo
2816 |}
2817 !! result
2818 <table>
2819
2820
2821 <tr>
2822 <th> foo
2823 </th></tr></table>
2824
2825 !! end
2826
2827 # FIXME: Preserve the attribute properly (with an empty string as value) in
2828 # the PHP parser. Parsoid implements the behavior below.
2829 !! test
2830 Table attributes with empty value
2831 !! options
2832 disabled
2833 !! input
2834 {|
2835 | style=| hello
2836 |}
2837 !! result
2838 <table>
2839 <tr>
2840 <td style=""> hello
2841 </td></tr></table>
2842
2843 !! end
2844
2845 ###
2846 ### Internal links
2847 ###
2848 !! test
2849 Plain link, capitalized
2850 !! input
2851 [[Main Page]]
2852 !! result
2853 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
2854 </p>
2855 !! end
2856
2857 !! test
2858 Plain link, uncapitalized
2859 !! input
2860 [[main Page]]
2861 !! result
2862 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
2863 </p>
2864 !! end
2865
2866 !! test
2867 Piped link
2868 !! input
2869 [[Main Page|The Main Page]]
2870 !! result
2871 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
2872 </p>
2873 !! end
2874
2875 !! test
2876 Broken link
2877 !! input
2878 [[Zigzagzogzagzig]]
2879 !! result
2880 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
2881 </p>
2882 !! end
2883
2884 !! test
2885 Broken link with fragment
2886 !! input
2887 [[Zigzagzogzagzig#zug]]
2888 !! result
2889 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
2890 </p>
2891 !! end
2892
2893 !! test
2894 Special page link with fragment
2895 !! input
2896 [[Special:Version#anchor]]
2897 !! result
2898 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
2899 </p>
2900 !! end
2901
2902 !! test
2903 Nonexistent special page link with fragment
2904 !! input
2905 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
2906 !! result
2907 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
2908 </p>
2909 !! end
2910
2911 !! test
2912 Link with prefix
2913 !! input
2914 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
2915 !! result
2916 <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>
2917 </p>
2918 !! end
2919
2920 !! test
2921 Link with suffix
2922 !! input
2923 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
2924 !! result
2925 <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>!!!
2926 </p>
2927 !! end
2928
2929 !! test
2930 Link with 3 brackets
2931 !! input
2932 [[[main page]]]
2933 !! result
2934 <p>[[[main page]]]
2935 </p>
2936 !! end
2937
2938 !! test
2939 Piped link with 3 brackets
2940 !! input
2941 [[[main page|the main page]]]
2942 !! result
2943 <p>[[[main page|the main page]]]
2944 </p>
2945 !! end
2946
2947 !! test
2948 Link with multiple pipes
2949 !! input
2950 [[Main Page|The|Main|Page]]
2951 !! result
2952 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
2953 </p>
2954 !! end
2955
2956 !! test
2957 Link to namespaces
2958 !! input
2959 [[Talk:Parser testing]], [[Meta:Disclaimers]]
2960 !! result
2961 <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>
2962 </p>
2963 !! end
2964
2965 !! test
2966 Piped link to namespace
2967 !! input
2968 [[Meta:Disclaimers|The disclaimers]]
2969 !! result
2970 <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>
2971 </p>
2972 !! end
2973
2974 !! test
2975 Link containing }
2976 !! input
2977 [[Usually caused by a typo (oops}]]
2978 !! result
2979 <p>[[Usually caused by a typo (oops}]]
2980 </p>
2981 !! end
2982
2983 !! test
2984 Link containing % (not as a hex sequence)
2985 !! input
2986 [[7% Solution]]
2987 !! result
2988 <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>
2989 </p>
2990 !! end
2991
2992 !! test
2993 Link containing % as a single hex sequence interpreted to char
2994 !! input
2995 [[7%25 Solution]]
2996 !! result
2997 <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>
2998 </p>
2999 !!end
3000
3001 !! test
3002 Link containing % as a double hex sequence interpreted to hex sequence
3003 !! input
3004 [[7%2525 Solution]]
3005 !! result
3006 <p>[[7%2525 Solution]]
3007 </p>
3008 !!end
3009
3010 !! test
3011 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
3012 Example for such a section: == < ==
3013 !! input
3014 [[%23%3c]][[%23%3e]]
3015 !! result
3016 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
3017 </p>
3018 !! end
3019
3020 !! test
3021 Link containing "<#" and ">#" as a hex sequences
3022 !! input
3023 [[%3c%23]][[%3e%23]]
3024 !! result
3025 <p>[[%3c%23]][[%3e%23]]
3026 </p>
3027 !! end
3028
3029 !! test
3030 Link containing double-single-quotes '' (bug 4598)
3031 !! input
3032 [[Lista d''e paise d''o munno]]
3033 !! result
3034 <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>
3035 </p>
3036 !! end
3037
3038 !! test
3039 Link containing double-single-quotes '' in text (bug 4598 sanity check)
3040 !! input
3041 Some [[Link|pretty ''italics'' and stuff]]!
3042 !! result
3043 <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>!
3044 </p>
3045 !! end
3046
3047 !! test
3048 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
3049 !! input
3050 ''Some [[Link|pretty ''italics'' and stuff]]!
3051 !! result
3052 <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>
3053 </p>
3054 !! end
3055
3056 !! test
3057 Link with double quotes in title part (literal) and alternate part (interpreted)
3058 !! input
3059 [[File:Denys Savchenko ''Pentecoste''.jpg]]
3060
3061 [[''Pentecoste'']]
3062
3063 [[''Pentecoste''|Pentecoste]]
3064
3065 [[''Pentecoste''|''Pentecoste'']]
3066 !! result
3067 <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>
3068 </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>
3069 </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>
3070 </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>
3071 </p>
3072 !! end
3073
3074 !! test
3075 Broken image links with HTML captions (bug 39700)
3076 !! input
3077 [[File:Nonexistent|<script></script>]]
3078 [[File:Nonexistent|100px|<script></script>]]
3079 [[File:Nonexistent|&lt;]]
3080 [[File:Nonexistent|a<i>b</i>c]]
3081 !! result
3082 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3083 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3084 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
3085 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
3086 </p>
3087 !! end
3088
3089 !! test
3090 Plain link to URL
3091 !! input
3092 [[http://www.example.com]]
3093 !! result
3094 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
3095 </p>
3096 !! end
3097
3098 !! test
3099 Plain link to URL with link text
3100 !! input
3101 [[http://www.example.com Link text]]
3102 !! result
3103 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
3104 </p>
3105 !! end
3106
3107 !! test
3108 Plain link to protocol-relative URL
3109 !! input
3110 [[//www.example.com]]
3111 !! result
3112 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
3113 </p>
3114 !! end
3115
3116 !! test
3117 Plain link to protocol-relative URL with link text
3118 !! input
3119 [[//www.example.com Link text]]
3120 !! result
3121 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
3122 </p>
3123 !! end
3124
3125
3126 # I'm fairly sure the expected result here is wrong.
3127 # We want these to be URL links, not pseudo-pages with URLs for titles....
3128 # However the current output is also pretty screwy.
3129 #
3130 # ----
3131 # I'm changing it to match the current output--it arguably makes more
3132 # sense in the light of the test above. Old expected result was:
3133 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
3134 #</p>
3135 # But I think this test is bordering on "garbage in, garbage out" anyway.
3136 # -- wtm
3137 !! test
3138 Piped link to URL
3139 !! input
3140 Piped link to URL: [[http://www.example.com|an example URL]]
3141 !! result
3142 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
3143 </p>
3144 !! end
3145
3146 !! test
3147 BUG 2: [[page|http://url/]] should link to page, not http://url/
3148 !! input
3149 [[Main Page|http://url/]]
3150 !! result
3151 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
3152 </p>
3153 !! end
3154
3155 !! test
3156 BUG 337: Escaped self-links should be bold
3157 !! options
3158 title=[[Bug462]]
3159 !! input
3160 [[Bu&#103;462]] [[Bug462]]
3161 !! result
3162 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
3163 </p>
3164 !! end
3165
3166 !! test
3167 Self-link to section should not be bold
3168 !! options
3169 title=[[Main Page]]
3170 !! input
3171 [[Main Page#section]]
3172 !! result
3173 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
3174 </p>
3175 !! end
3176
3177 !! article
3178 00
3179 !! text
3180 This is 00.
3181 !! endarticle
3182
3183 !!test
3184 Self-link to numeric title
3185 !!options
3186 title=[[0]]
3187 !!input
3188 [[0]]
3189 !!result
3190 <p><strong class="selflink">0</strong>
3191 </p>
3192 !!end
3193
3194 !!test
3195 Link to numeric-equivalent title
3196 !!options
3197 title=[[0]]
3198 !!input
3199 [[00]]
3200 !!result
3201 <p><a href="/wiki/00" title="00">00</a>
3202 </p>
3203 !!end
3204
3205 !! test
3206 <nowiki> inside a link
3207 !! input
3208 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
3209 !! result
3210 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
3211 </p>
3212 !! end
3213
3214 !! test
3215 Non-breaking spaces in title
3216 !! input
3217 [[&nbsp; Main &nbsp; Page &nbsp;]]
3218 !! result
3219 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
3220 </p>
3221 !!end
3222
3223 !! test
3224 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
3225 !! options
3226 language=ca
3227 !! input
3228 '''[[Main Page]]'''
3229 !! result
3230 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
3231 </p>
3232 !! end
3233
3234 !! test
3235 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
3236 !! options
3237 language=ca
3238 !! input
3239 ''[[Main Page]]''
3240 !! result
3241 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
3242 </p>
3243 !! end
3244
3245 !! test
3246 Internal link with en linktrail: no apostrophes (bug 27473)
3247 !! options
3248 language=en
3249 !! input
3250 [[Something]]'nice
3251 !! result
3252 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
3253 </p>
3254 !! end
3255
3256 !! test
3257 Internal link with ca linktrail with apostrophes (bug 27473)
3258 !! options
3259 language=ca
3260 !! input
3261 [[Something]]'nice
3262 !! result
3263 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
3264 </p>
3265 !! end
3266
3267 !! test
3268 Internal link with kaa linktrail with apostrophes (bug 27473)
3269 !! options
3270 language=kaa
3271 !! input
3272 [[Something]]'nice
3273 !! result
3274 <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>
3275 </p>
3276 !! end
3277
3278 ###
3279 ### Interwiki links (see maintenance/interwiki.sql)
3280 ###
3281
3282 !! test
3283 Inline interwiki link
3284 !! input
3285 [[MeatBall:SoftSecurity]]
3286 !! result
3287 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
3288 </p>
3289 !! end
3290
3291 !! test
3292 Inline interwiki link with empty title (bug 2372)
3293 !! input
3294 [[MeatBall:]]
3295 !! result
3296 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
3297 </p>
3298 !! end
3299
3300 !! test
3301 Interwiki link encoding conversion (bug 1636)
3302 !! input
3303 *[[Wikipedia:ro:Olteni&#0355;a]]
3304 *[[Wikipedia:ro:Olteni&#355;a]]
3305 !! result
3306 <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>
3307 </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>
3308 </li></ul>
3309
3310 !! end
3311
3312 !! test
3313 Interwiki link with fragment (bug 2130)
3314 !! input
3315 [[MeatBall:SoftSecurity#foo]]
3316 !! result
3317 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
3318 </p>
3319 !! end
3320
3321 !! test
3322 Interlanguage link
3323 !! input
3324 Blah blah blah
3325 [[zh:Chinese]]
3326 !!result
3327 <p>Blah blah blah
3328 </p>
3329 !! end
3330
3331 !! test
3332 Double interlanguage link
3333 !! input
3334 Blah blah blah
3335 [[es:Spanish]]
3336 [[zh:Chinese]]
3337 !!result
3338 <p>Blah blah blah
3339 </p>
3340 !! end
3341
3342 !! test
3343 Interlanguage link, with prefix links
3344 !! options
3345 language=ln
3346 !! input
3347 Blah blah blah
3348 [[zh:Chinese]]
3349 !!result
3350 <p>Blah blah blah
3351 </p>
3352 !! end
3353
3354 !! test
3355 Double interlanguage link, with prefix links (bug 8897)
3356 !! options
3357 language=ln
3358 !! input
3359 Blah blah blah
3360 [[es:Spanish]]
3361 [[zh:Chinese]]
3362 !!result
3363 <p>Blah blah blah
3364 </p>
3365 !! end
3366
3367 !! test
3368 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
3369 !! options
3370 language=ln
3371 !! input
3372 [[WW&nbsp;II]]
3373 !!result
3374 <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>
3375 </p>
3376 !! end
3377
3378 ##
3379 ## XHTML tidiness
3380 ###
3381
3382 !! test
3383 <br> to <br />
3384 !! input
3385 1<br>2<br />3
3386 !! result
3387 <p>1<br />2<br />3
3388 </p>
3389 !! end
3390
3391 !! test
3392 Broken br tag sanitization
3393 !! input
3394 </br>
3395 !! result
3396 <p>&lt;/br&gt;
3397 </p>
3398 !! end
3399
3400 !! test
3401 Incorrecly removing closing slashes from correctly formed XHTML
3402 !! input
3403 <br style="clear:both;" />
3404 !! result
3405 <p><br style="clear:both;" />
3406 </p>
3407 !! end
3408
3409 !! test
3410 Failing to transform badly formed HTML into correct XHTML
3411 !! input
3412 <br style="clear: left;">
3413 <br style="clear: right;">
3414 <br style="clear: both;">
3415 !! result
3416 <p><br style="clear: left;" />
3417 <br style="clear: right;" />
3418 <br style="clear: both;" />
3419 </p>
3420 !!end
3421
3422 !! test
3423 Handling html with a div self-closing tag
3424 !! input
3425 <div title />
3426 <div title/>
3427 <div title/ >
3428 <div title=bar />
3429 <div title=bar/>
3430 <div title=bar/ >
3431 !! result
3432 <p>&lt;div title /&gt;
3433 &lt;div title/&gt;
3434 </p>
3435 <div>
3436 <p>&lt;div title=bar /&gt;
3437 &lt;div title=bar/&gt;
3438 </p>
3439 <div title="bar/"></div>
3440 </div>
3441
3442 !! end
3443
3444 !! test
3445 Handling html with a br self-closing tag
3446 !! input
3447 <br title />
3448 <br title/>
3449 <br title/ >
3450 <br title=bar />
3451 <br title=bar/>
3452 <br title=bar/ >
3453 !! result
3454 <p><br title="title" />
3455 <br title="title" />
3456 <br />
3457 <br title="bar" />
3458 <br title="bar" />
3459 <br title="bar/" />
3460 </p>
3461 !! end
3462
3463 !! test
3464 Horizontal ruler (should it add that extra space?)
3465 !! input
3466 <hr>
3467 <hr >
3468 foo <hr
3469 > bar
3470 !! result
3471 <hr />
3472 <hr />
3473 foo <hr /> bar
3474
3475 !! end
3476
3477 !! test
3478 Horizontal ruler -- 4+ dashes render hr
3479 !! input
3480 ----
3481 !! result
3482 <hr />
3483
3484 !! end
3485
3486 !! test
3487 Horizontal ruler -- eats additional dashes on the same line
3488 !! input
3489 ---------
3490 !! result
3491 <hr />
3492
3493 !! end
3494
3495 !! test
3496 Horizontal ruler -- does not collaps dashes on consecutive lines
3497 !! input
3498 ----
3499 ----
3500 !! result
3501 <hr />
3502 <hr />
3503
3504 !! end
3505
3506 !! test
3507 Horizontal ruler -- <4 dashes render as plain text
3508 !! input
3509 ---
3510 !! result
3511 <p>---
3512 </p>
3513 !! end
3514
3515 ###
3516 ### Block-level elements
3517 ###
3518 !! test
3519 Common list
3520 !! input
3521 *Common list
3522 * item 2
3523 *item 3
3524 !! result
3525 <ul><li>Common list
3526 </li><li> item 2
3527 </li><li>item 3
3528 </li></ul>
3529
3530 !! end
3531
3532 !! test
3533 Numbered list
3534 !! input
3535 #Numbered list
3536 #item 2
3537 # item 3
3538 !! result
3539 <ol><li>Numbered list
3540 </li><li>item 2
3541 </li><li> item 3
3542 </li></ol>
3543
3544 !! end
3545
3546 !! test
3547 Mixed list
3548 !! input
3549 *Mixed list
3550 *# with numbers
3551 ** and bullets
3552 *# and numbers
3553 *bullets again
3554 **bullet level 2
3555 ***bullet level 3
3556 ***#Number on level 4
3557 **bullet level 2
3558 **#Number on level 3
3559 **#Number on level 3
3560 *#number level 2
3561 *Level 1
3562 *** Level 3
3563 #** Level 3, but ordered
3564 !! result
3565 <ul><li>Mixed list
3566 <ol><li> with numbers
3567 </li></ol>
3568 <ul><li> and bullets
3569 </li></ul>
3570 <ol><li> and numbers
3571 </li></ol>
3572 </li><li>bullets again
3573 <ul><li>bullet level 2
3574 <ul><li>bullet level 3
3575 <ol><li>Number on level 4
3576 </li></ol>
3577 </li></ul>
3578 </li><li>bullet level 2
3579 <ol><li>Number on level 3
3580 </li><li>Number on level 3
3581 </li></ol>
3582 </li></ul>
3583 <ol><li>number level 2
3584 </li></ol>
3585 </li><li>Level 1
3586 <ul><li><ul><li> Level 3
3587 </li></ul>
3588 </li></ul>
3589 </li></ul>
3590 <ol><li><ul><li><ul><li> Level 3, but ordered
3591 </li></ul>
3592 </li></ul>
3593 </li></ol>
3594
3595 !! end
3596
3597 !! test
3598 Nested lists 1
3599 !! input
3600 *foo
3601 **bar
3602 !! result
3603 <ul><li>foo
3604 <ul><li>bar
3605 </li></ul>
3606 </li></ul>
3607
3608 !! end
3609
3610 !! test
3611 Nested lists 2
3612 !! input
3613 **foo
3614 *bar
3615 !! result
3616 <ul><li><ul><li>foo
3617 </li></ul>
3618 </li><li>bar
3619 </li></ul>
3620
3621 !! end
3622
3623 !! test
3624 Nested lists 3 (first element empty)
3625 !! input
3626 *
3627 **bar
3628 !! result
3629 <ul><li>
3630 <ul><li>bar
3631 </li></ul>
3632 </li></ul>
3633
3634 !! end
3635
3636 !! test
3637 Nested lists 4 (first element empty)
3638 !! input
3639 **
3640 *bar
3641 !! result
3642 <ul><li><ul><li>
3643 </li></ul>
3644 </li><li>bar
3645 </li></ul>
3646
3647 !! end
3648
3649 !! test
3650 Nested lists 5 (both elements empty)
3651 !! input
3652 **
3653 *
3654 !! result
3655 <ul><li><ul><li>
3656 </li></ul>
3657 </li><li>
3658 </li></ul>
3659
3660 !! end
3661
3662 !! test
3663 Nested lists 6 (both elements empty)
3664 !! input
3665 *
3666 **
3667 !! result
3668 <ul><li>
3669 <ul><li>
3670 </li></ul>
3671 </li></ul>
3672
3673 !! end
3674
3675 !! test
3676 Nested lists 7 (skip initial nesting levels)
3677 !! input
3678 *** foo
3679 !! result
3680 <ul><li><ul><li><ul><li> foo
3681 </li></ul>
3682 </li></ul>
3683 </li></ul>
3684
3685 !! end
3686
3687 !! test
3688 Nested lists 8 (multiple nesting transitions)
3689 !! input
3690 * foo
3691 *** bar
3692 ** baz
3693 * boo
3694 !! result
3695 <ul><li> foo
3696 <ul><li><ul><li> bar
3697 </li></ul>
3698 </li><li> baz
3699 </li></ul>
3700 </li><li> boo
3701 </li></ul>
3702
3703 !! end
3704
3705 !! test
3706 1. Lists with start-of-line-transparent tokens before bullets: Comments
3707 !! input
3708 *foo
3709 *<!--cmt-->bar
3710 <!--cmt-->*baz
3711 !! result
3712 <ul><li>foo
3713 </li><li>bar
3714 </li><li>baz
3715 </li></ul>
3716
3717 !! end
3718
3719 !! test
3720 2. Lists with start-of-line-transparent tokens before bullets: Template close
3721 !! input
3722 *foo {{echo|bar
3723 }}*baz
3724 !! result
3725 <ul><li>foo bar
3726 </li><li>baz
3727 </li></ul>
3728
3729 !! end
3730
3731 !! test
3732 List items are not parsed correctly following a <pre> block (bug 785)
3733 !! input
3734 * <pre>foo</pre>
3735 * <pre>bar</pre>
3736 * zar
3737 !! result
3738 <ul><li> <pre>foo</pre>
3739 </li><li> <pre>bar</pre>
3740 </li><li> zar
3741 </li></ul>
3742
3743 !! end
3744
3745 !! test
3746 List items from template
3747 !! input
3748
3749 {{inner list}}
3750 * item 2
3751
3752 * item 0
3753 {{inner list}}
3754 * item 2
3755
3756 * item 0
3757 * notSOL{{inner list}}
3758 * item 2
3759 !! result
3760 <ul><li> item 1
3761 </li><li> item 2
3762 </li></ul>
3763 <ul><li> item 0
3764 </li><li> item 1
3765 </li><li> item 2
3766 </li></ul>
3767 <ul><li> item 0
3768 </li><li> notSOL
3769 </li><li> item 1
3770 </li><li> item 2
3771 </li></ul>
3772
3773 !! end
3774
3775 !! test
3776 List interrupted by empty line or heading
3777 !! input
3778 * foo
3779
3780 ** bar
3781 == A heading ==
3782 * Another list item
3783 !! result
3784 <ul><li> foo
3785 </li></ul>
3786 <ul><li><ul><li> bar
3787 </li></ul>
3788 </li></ul>
3789 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a>]</span> <span class="mw-headline" id="A_heading"> A heading </span></h2>
3790 <ul><li> Another list item
3791 </li></ul>
3792
3793 !!end
3794
3795
3796 ###
3797 ### Magic Words
3798 ###
3799
3800 !! test
3801 Magic Word: {{CURRENTDAY}}
3802 !! input
3803 {{CURRENTDAY}}
3804 !! result
3805 <p>1
3806 </p>
3807 !! end
3808
3809 !! test
3810 Magic Word: {{CURRENTDAY2}}
3811 !! input
3812 {{CURRENTDAY2}}
3813 !! result
3814 <p>01
3815 </p>
3816 !! end
3817
3818 !! test
3819 Magic Word: {{CURRENTDAYNAME}}
3820 !! input
3821 {{CURRENTDAYNAME}}
3822 !! result
3823 <p>Thursday
3824 </p>
3825 !! end
3826
3827 !! test
3828 Magic Word: {{CURRENTDOW}}
3829 !! input
3830 {{CURRENTDOW}}
3831 !! result
3832 <p>4
3833 </p>
3834 !! end
3835
3836 !! test
3837 Magic Word: {{CURRENTMONTH}}
3838 !! input
3839 {{CURRENTMONTH}}
3840 !! result
3841 <p>01
3842 </p>
3843 !! end
3844
3845 !! test
3846 Magic Word: {{CURRENTMONTHABBREV}}
3847 !! input
3848 {{CURRENTMONTHABBREV}}
3849 !! result
3850 <p>Jan
3851 </p>
3852 !! end
3853
3854 !! test
3855 Magic Word: {{CURRENTMONTHNAME}}
3856 !! input
3857 {{CURRENTMONTHNAME}}
3858 !! result
3859 <p>January
3860 </p>
3861 !! end
3862
3863 !! test
3864 Magic Word: {{CURRENTMONTHNAMEGEN}}
3865 !! input
3866 {{CURRENTMONTHNAMEGEN}}
3867 !! result
3868 <p>January
3869 </p>
3870 !! end
3871
3872 !! test
3873 Magic Word: {{CURRENTTIME}}
3874 !! input
3875 {{CURRENTTIME}}
3876 !! result
3877 <p>00:02
3878 </p>
3879 !! end
3880
3881 !! test
3882 Magic Word: {{CURRENTWEEK}} (@bug 4594)
3883 !! input
3884 {{CURRENTWEEK}}
3885 !! result
3886 <p>1
3887 </p>
3888 !! end
3889
3890 !! test
3891 Magic Word: {{CURRENTYEAR}}
3892 !! input
3893 {{CURRENTYEAR}}
3894 !! result
3895 <p>1970
3896 </p>
3897 !! end
3898
3899 !! test
3900 Magic Word: {{FULLPAGENAME}}
3901 !! options
3902 title=[[User:Ævar Arnfjörð Bjarmason]]
3903 !! input
3904 {{FULLPAGENAME}}
3905 !! result
3906 <p>User:Ævar Arnfjörð Bjarmason
3907 </p>
3908 !! end
3909
3910 !! test
3911 Magic Word: {{FULLPAGENAMEE}}
3912 !! options
3913 title=[[User:Ævar Arnfjörð Bjarmason]]
3914 !! input
3915 {{FULLPAGENAMEE}}
3916 !! result
3917 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
3918 </p>
3919 !! end
3920
3921 !! test
3922 Magic Word: {{NAMESPACE}}
3923 !! options
3924 title=[[User:Ævar Arnfjörð Bjarmason]]
3925 !! input
3926 {{NAMESPACE}}
3927 !! result
3928 <p>User
3929 </p>
3930 !! end
3931
3932 !! test
3933 Magic Word: {{NAMESPACEE}}
3934 !! options
3935 title=[[User:Ævar Arnfjörð Bjarmason]]
3936 !! input
3937 {{NAMESPACEE}}
3938 !! result
3939 <p>User
3940 </p>
3941 !! end
3942
3943 !! test
3944 Magic Word: {{NAMESPACENUMBER}}
3945 !! options
3946 title=[[User:Ævar Arnfjörð Bjarmason]]
3947 !! input
3948 {{NAMESPACENUMBER}}
3949 !! result
3950 <p>2
3951 </p>
3952 !! end
3953
3954 !! test
3955 Magic Word: {{NUMBEROFFILES}}
3956 !! input
3957 {{NUMBEROFFILES}}
3958 !! result
3959 <p>2
3960 </p>
3961 !! end
3962
3963 !! test
3964 Magic Word: {{PAGENAME}}
3965 !! options
3966 title=[[User:Ævar Arnfjörð Bjarmason]]
3967 !! input
3968 {{PAGENAME}}
3969 !! result
3970 <p>Ævar Arnfjörð Bjarmason
3971 </p>
3972 !! end
3973
3974 !! test
3975 Magic Word: {{PAGENAME}} with metacharacters
3976 !! options
3977 title=[['foo & bar = baz']]
3978 !! input
3979 ''{{PAGENAME}}''
3980 !! result
3981 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
3982 </p>
3983 !! end
3984
3985 !! test
3986 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
3987 !! options
3988 title=[[*RFC 1234 http://example.com/]]
3989 !! input
3990 {{PAGENAME}}
3991 !! result
3992 <p>&#42;RFC&#32;1234 http&#58;//example.com/
3993 </p>
3994 !! end
3995
3996 !! test
3997 Magic Word: {{PAGENAMEE}}
3998 !! options
3999 title=[[User:Ævar Arnfjörð Bjarmason]]
4000 !! input
4001 {{PAGENAMEE}}
4002 !! result
4003 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
4004 </p>
4005 !! end
4006
4007 !! test
4008 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
4009 !! options
4010 title=[[*RFC 1234 http://example.com/]]
4011 !! input
4012 {{PAGENAMEE}}
4013 !! result
4014 <p>&#42;RFC_1234_http&#58;//example.com/
4015 </p>
4016 !! end
4017
4018 !! test
4019 Magic Word: {{REVISIONID}}
4020 !! input
4021 {{REVISIONID}}
4022 !! result
4023 <p>1337
4024 </p>
4025 !! end
4026
4027 !! test
4028 Magic Word: {{SCRIPTPATH}}
4029 !! input
4030 {{SCRIPTPATH}}
4031 !! result
4032 <p>/
4033 </p>
4034 !! end
4035
4036 !! test
4037 Magic Word: {{SERVER}}
4038 !! input
4039 {{SERVER}}
4040 !! result
4041 <p><a rel="nofollow" class="external free" href="http://Britney-Spears">http://Britney-Spears</a>
4042 </p>
4043 !! end
4044
4045 !! test
4046 Magic Word: {{SERVERNAME}}
4047 !! input
4048 {{SERVERNAME}}
4049 !! result
4050 <p>Britney-Spears
4051 </p>
4052 !! end
4053
4054 !! test
4055 Magic Word: {{SITENAME}}
4056 !! input
4057 {{SITENAME}}
4058 !! result
4059 <p>MediaWiki
4060 </p>
4061 !! end
4062
4063 !! test
4064 Namespace 1 {{ns:1}}
4065 !! input
4066 {{ns:1}}
4067 !! result
4068 <p>Talk
4069 </p>
4070 !! end
4071
4072 !! test
4073 Namespace 1 {{ns:01}}
4074 !! input
4075 {{ns:01}}
4076 !! result
4077 <p>Talk
4078 </p>
4079 !! end
4080
4081 !! test
4082 Namespace 0 {{ns:0}} (bug 4783)
4083 !! input
4084 {{ns:0}}
4085 !! result
4086
4087 !! end
4088
4089 !! test
4090 Namespace 0 {{ns:00}} (bug 4783)
4091 !! input
4092 {{ns:00}}
4093 !! result
4094
4095 !! end
4096
4097 !! test
4098 Namespace -1 {{ns:-1}}
4099 !! input
4100 {{ns:-1}}
4101 !! result
4102 <p>Special
4103 </p>
4104 !! end
4105
4106 !! test
4107 Namespace User {{ns:User}}
4108 !! input
4109 {{ns:User}}
4110 !! result
4111 <p>User
4112 </p>
4113 !! end
4114
4115 !! test
4116 Namespace User talk {{ns:User_talk}}
4117 !! input
4118 {{ns:User_talk}}
4119 !! result
4120 <p>User talk
4121 </p>
4122 !! end
4123
4124 !! test
4125 Namespace User talk {{ns:uSeR tAlK}}
4126 !! input
4127 {{ns:uSeR tAlK}}
4128 !! result
4129 <p>User talk
4130 </p>
4131 !! end
4132
4133 !! test
4134 Namespace File {{ns:File}}
4135 !! input
4136 {{ns:File}}
4137 !! result
4138 <p>File
4139 </p>
4140 !! end
4141
4142 !! test
4143 Namespace File {{ns:Image}}
4144 !! input
4145 {{ns:Image}}
4146 !! result
4147 <p>File
4148 </p>
4149 !! end
4150
4151 !! test
4152 Namespace (lang=de) Benutzer {{ns:User}}
4153 !! options
4154 language=de
4155 !! input
4156 {{ns:User}}
4157 !! result
4158 <p>Benutzer
4159 </p>
4160 !! end
4161
4162 !! test
4163 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
4164 !! options
4165 language=de
4166 !! input
4167 {{ns:3}}
4168 !! result
4169 <p>Benutzer Diskussion
4170 </p>
4171 !! end
4172
4173
4174 !! test
4175 Urlencode
4176 !! input
4177 {{urlencode:hi world?!}}
4178 {{urlencode:hi world?!|WIKI}}
4179 {{urlencode:hi world?!|PATH}}
4180 {{urlencode:hi world?!|QUERY}}
4181 !! result
4182 <p>hi+world%3F%21
4183 hi_world%3F!
4184 hi%20world%3F%21
4185 hi+world%3F%21
4186 </p>
4187 !! end
4188
4189 ###
4190 ### Magic links
4191 ###
4192 !! test
4193 Magic links: internal link to RFC (bug 479)
4194 !! input
4195 [[RFC 123]]
4196 !! result
4197 <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>
4198 </p>
4199 !! end
4200
4201 !! test
4202 Magic links: RFC (bug 479)
4203 !! input
4204 RFC 822
4205 !! result
4206 <p><a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc822">RFC 822</a>
4207 </p>
4208 !! end
4209
4210 !! test
4211 Magic links: ISBN (bug 1937)
4212 !! input
4213 ISBN 0-306-40615-2
4214 !! result
4215 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
4216 </p>
4217 !! end
4218
4219 !! test
4220 Magic links: PMID incorrectly converts space to underscore
4221 !! input
4222 PMID 1234
4223 !! result
4224 <p><a class="external mw-magiclink-pmid" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
4225 </p>
4226 !! end
4227
4228 ###
4229 ### Templates
4230 ####
4231
4232 !! test
4233 Nonexistent template
4234 !! input
4235 {{thistemplatedoesnotexist}}
4236 !! result
4237 <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>
4238 </p>
4239 !! end
4240
4241 !! article
4242 Template:test
4243 !! text
4244 This is a test template
4245 !! endarticle
4246
4247 !! test
4248 Simple template
4249 !! input
4250 {{test}}
4251 !! result
4252 <p>This is a test template
4253 </p>
4254 !! end
4255
4256 !! test
4257 Template with explicit namespace
4258 !! input
4259 {{Template:test}}
4260 !! result
4261 <p>This is a test template
4262 </p>
4263 !! end
4264
4265
4266 !! article
4267 Template:paramtest
4268 !! text
4269 This is a test template with parameter {{{param}}}
4270 !! endarticle
4271
4272 !! test
4273 Template parameter
4274 !! input
4275 {{paramtest|param=foo}}
4276 !! result
4277 <p>This is a test template with parameter foo
4278 </p>
4279 !! end
4280
4281 !! article
4282 Template:paramtestnum
4283 !! text
4284 [[{{{1}}}|{{{2}}}]]
4285 !! endarticle
4286
4287 !! test
4288 Template unnamed parameter
4289 !! input
4290 {{paramtestnum|Main Page|the main page}}
4291 !! result
4292 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
4293 </p>
4294 !! end
4295
4296 !! article
4297 Template:templatesimple
4298 !! text
4299 (test)
4300 !! endarticle
4301
4302 !! article
4303 Template:templateredirect
4304 !! text
4305 #redirect [[Template:templatesimple]]
4306 !! endarticle
4307
4308 !! article
4309 Template:templateasargtestnum
4310 !! text
4311 {{{{{1}}}}}
4312 !! endarticle
4313
4314 !! article
4315 Template:templateasargtest
4316 !! text
4317 {{template{{{templ}}}}}
4318 !! endarticle
4319
4320 !! article
4321 Template:templateasargtest2
4322 !! text
4323 {{{{{templ}}}}}
4324 !! endarticle
4325
4326 !! test
4327 Template with template name as unnamed argument
4328 !! input
4329 {{templateasargtestnum|templatesimple}}
4330 !! result
4331 <p>(test)
4332 </p>
4333 !! end
4334
4335 !! test
4336 Template with template name as argument
4337 !! input
4338 {{templateasargtest|templ=simple}}
4339 !! result
4340 <p>(test)
4341 </p>
4342 !! end
4343
4344 !! test
4345 Template with template name as argument (2)
4346 !! input
4347 {{templateasargtest2|templ=templatesimple}}
4348 !! result
4349 <p>(test)
4350 </p>
4351 !! end
4352
4353 !! article
4354 Template:templateasargtestdefault
4355 !! text
4356 {{{{{templ|templatesimple}}}}}
4357 !! endarticle
4358
4359 !! article
4360 Template:templa
4361 !! text
4362 '''templ'''
4363 !! endarticle
4364
4365 !! test
4366 Template with default value
4367 !! input
4368 {{templateasargtestdefault}}
4369 !! result
4370 <p>(test)
4371 </p>
4372 !! end
4373
4374 !! test
4375 Template with default value (value set)
4376 !! input
4377 {{templateasargtestdefault|templ=templa}}
4378 !! result
4379 <p><b>templ</b>
4380 </p>
4381 !! end
4382
4383 !! test
4384 Template redirect
4385 !! input
4386 {{templateredirect}}
4387 !! result
4388 <p>(test)
4389 </p>
4390 !! end
4391
4392 !! test
4393 Template with argument in separate line
4394 !! input
4395 {{ templateasargtest |
4396 templ = simple }}
4397 !! result
4398 <p>(test)
4399 </p>
4400 !! end
4401
4402 !! test
4403 Template with complex template as argument
4404 !! input
4405 {{paramtest|
4406 param ={{ templateasargtest |
4407 templ = simple }}}}
4408 !! result
4409 <p>This is a test template with parameter (test)
4410 </p>
4411 !! end
4412
4413 !! test
4414 Template with thumb image (with link in description)
4415 !! input
4416 {{paramtest|
4417 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
4418 !! result
4419 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>
4420
4421 !! end
4422
4423 !! article
4424 Template:complextemplate
4425 !! text
4426 {{{1}}} {{paramtest|
4427 param ={{{param}}}}}
4428 !! endarticle
4429
4430 !! test
4431 Template with complex arguments
4432 !! input
4433 {{complextemplate|
4434 param ={{ templateasargtest |
4435 templ = simple }}|[[Template:complextemplate|link]]}}
4436 !! result
4437 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
4438 </p>
4439 !! end
4440
4441 !! test
4442 BUG 553: link with two variables in a piped link
4443 !! input
4444 {|
4445 |[[{{{1}}}|{{{2}}}]]
4446 |}
4447 !! result
4448 <table>
4449 <tr>
4450 <td>[[{{{1}}}|{{{2}}}]]
4451 </td></tr></table>
4452
4453 !! end
4454
4455 !! test
4456 Magic variable as template parameter
4457 !! input
4458 {{paramtest|param={{SITENAME}}}}
4459 !! result
4460 <p>This is a test template with parameter MediaWiki
4461 </p>
4462 !! end
4463
4464 !! article
4465 Template:linktest
4466 !! text
4467 [[{{{param}}}|link]]
4468 !! endarticle
4469
4470 !! test
4471 Template parameter as link source
4472 !! input
4473 {{linktest|param=Main Page}}
4474 !! result
4475 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
4476 </p>
4477 !! end
4478
4479 !!test
4480 Template-generated attribute string (k='v')
4481 !!input
4482 <span {{attr_str|id|v1}}>bar</span>
4483 !!result
4484 <p><span id="v1">bar</span>
4485 </p>
4486 !!end
4487
4488 !!article
4489 Template:paramtest2
4490 !! text
4491 including another template, {{paramtest|param={{{arg}}}}}
4492 !! endarticle
4493
4494 !! test
4495 Template passing argument to another template
4496 !! input
4497 {{paramtest2|arg='hmm'}}
4498 !! result
4499 <p>including another template, This is a test template with parameter 'hmm'
4500 </p>
4501 !! end
4502
4503 !! article
4504 Template:Linktest2
4505 !! text
4506 Main Page
4507 !! endarticle
4508
4509 !! test
4510 Template as link source
4511 !! input
4512 [[{{linktest2}}]]
4513 !! result
4514 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4515 </p>
4516 !! end
4517
4518
4519 !! article
4520 Template:loop1
4521 !! text
4522 {{loop2}}
4523 !! endarticle
4524
4525 !! article
4526 Template:loop2
4527 !! text
4528 {{loop1}}
4529 !! endarticle
4530
4531 !! test
4532 Template infinite loop
4533 !! input
4534 {{loop1}}
4535 !! result
4536 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
4537 </p>
4538 !! end
4539
4540 !! test
4541 Template from main namespace
4542 !! input
4543 {{:Main Page}}
4544 !! result
4545 <p>blah blah
4546 </p>
4547 !! end
4548
4549 !! article
4550 Template:table
4551 !! text
4552 {|
4553 | 1 || 2
4554 |-
4555 | 3 || 4
4556 |}
4557 !! endarticle
4558
4559 !! test
4560 BUG 529: Template with table, not included at beginning of line
4561 !! input
4562 foo {{table}}
4563 !! result
4564 <p>foo
4565 </p>
4566 <table>
4567 <tr>
4568 <td> 1 </td>
4569 <td> 2
4570 </td></tr>
4571 <tr>
4572 <td> 3 </td>
4573 <td> 4
4574 </td></tr></table>
4575
4576 !! end
4577
4578 !! test
4579 BUG 523: Template shouldn't eat newline (or add an extra one before table)
4580 !! input
4581 foo
4582 {{table}}
4583 !! result
4584 <p>foo
4585 </p>
4586 <table>
4587 <tr>
4588 <td> 1 </td>
4589 <td> 2
4590 </td></tr>
4591 <tr>
4592 <td> 3 </td>
4593 <td> 4
4594 </td></tr></table>
4595
4596 !! end
4597
4598 !! test
4599 BUG 41: Template parameters shown as broken links
4600 !! input
4601 {{{parameter}}}
4602 !! result
4603 <p>{{{parameter}}}
4604 </p>
4605 !! end
4606
4607 !! test
4608 Template with targets containing wikilinks
4609 !! input
4610 {{[[foo]]}}
4611
4612 {{[[{{echo|foo}}]]}}
4613
4614 {{{{echo|[[foo}}]]}}
4615 !! result
4616 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
4617 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
4618 </p><p>{{[[foo}}]]
4619 </p>
4620 !! end
4621
4622 !! article
4623 Template:MSGNW test
4624 !! text
4625 ''None'' of '''this''' should be
4626 * interpreted
4627 but rather passed unmodified
4628 {{test}}
4629 !! endarticle
4630
4631 # hmm, fix this or just deprecate msgnw and document its behavior?
4632 !! test
4633 msgnw keyword
4634 !! options
4635 disabled
4636 !! input
4637 {{msgnw:MSGNW test}}
4638 !! result
4639 <p>''None'' of '''this''' should be
4640 * interpreted
4641 but rather passed unmodified
4642 {{test}}
4643 </p>
4644 !! end
4645
4646 !! test
4647 int keyword
4648 !! input
4649 {{int:youhavenewmessages|lots of money|not!}}
4650 !! result
4651 <p>You have lots of money (not!).
4652 </p>
4653 !! end
4654
4655 !! article
4656 Template:Includes
4657 !! text
4658 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
4659 !! endarticle
4660
4661 !! test
4662 <includeonly> and <noinclude> being included
4663 !! input
4664 {{Includes}}
4665 !! result
4666 <p>Foobar
4667 </p>
4668 !! end
4669
4670 !! article
4671 Template:Includes2
4672 !! text
4673 <onlyinclude>Foo</onlyinclude>bar
4674 !! endarticle
4675
4676 !! test
4677 <onlyinclude> being included
4678 !! input
4679 {{Includes2}}
4680 !! result
4681 <p>Foo
4682 </p>
4683 !! end
4684
4685
4686 !! article
4687 Template:Includes3
4688 !! text
4689 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
4690 !! endarticle
4691
4692 !! test
4693 <onlyinclude> and <includeonly> being included
4694 !! input
4695 {{Includes3}}
4696 !! result
4697 <p>Foo
4698 </p>
4699 !! end
4700
4701 !! test
4702 <includeonly> and <noinclude> on a page
4703 !! input
4704 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
4705 !! result
4706 <p>Foozar
4707 </p>
4708 !! end
4709
4710 !! test
4711 <onlyinclude> on a page
4712 !! input
4713 <onlyinclude>Foo</onlyinclude>bar
4714 !! result
4715 <p>Foobar
4716 </p>
4717 !! end
4718
4719 !! article
4720 Template:Includeonly section
4721 !! text
4722 <includeonly>
4723 ==Includeonly section==
4724 </includeonly>
4725 ==Section T-1==
4726 !!endarticle
4727
4728 !! test
4729 Bug 6563: Edit link generation for section shown by <includeonly>
4730 !! input
4731 {{includeonly section}}
4732 !! result
4733 <h2><span class="editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline" id="Includeonly_section">Includeonly section</span></h2>
4734 <h2><span class="editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline" id="Section_T-1">Section T-1</span></h2>
4735
4736 !! end
4737
4738 # Uses same input as the contents of [[Template:Includeonly section]]
4739 !! test
4740 Bug 6563: Section extraction for section shown by <includeonly>
4741 !! options
4742 section=T-2
4743 !! input
4744 <includeonly>
4745 ==Includeonly section==
4746 </includeonly>
4747 ==Section T-2==
4748 !! result
4749 ==Section T-2==
4750 !! end
4751
4752 !! test
4753 Bug 6563: Edit link generation for section suppressed by <includeonly>
4754 !! input
4755 <includeonly>
4756 ==Includeonly section==
4757 </includeonly>
4758 ==Section 1==
4759 !! result
4760 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h2>
4761
4762 !! end
4763
4764 !! test
4765 Bug 6563: Section extraction for section suppressed by <includeonly>
4766 !! options
4767 section=1
4768 !! input
4769 <includeonly>
4770 ==Includeonly section==
4771 </includeonly>
4772 ==Section 1==
4773 !! result
4774 ==Section 1==
4775 !! end
4776
4777 ###
4778 ### <includeonly> and <noinclude> in attributes
4779 ###
4780 !!test
4781 0. includeonly around the entire attribute
4782 !!input
4783 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
4784 !!result
4785 <p><span id="v2">bar</span>
4786 </p>
4787 !!end
4788
4789 !!test
4790 1. includeonly in html attr key
4791 !!input
4792 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
4793 !!result
4794 <p><span id="foo">bar</span>
4795 </p>
4796 !!end
4797
4798 !!test
4799 2. includeonly in html attr value
4800 !!input
4801 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
4802 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
4803 !!result
4804 <p><span id="v1">bar</span>
4805 <span id="v1">bar</span>
4806 </p>
4807 !!end
4808
4809 !!test
4810 3. includeonly in part of an attr value
4811 !!input
4812 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
4813 !!result
4814 <p><span style="color:red;">bar</span>
4815 </p>
4816 !!end
4817
4818 ###
4819 ### Testing parsing of templates where a template arg
4820 ### has the same name as the template itself.
4821 ###
4822
4823 !! article
4824 Template:quote
4825 !! text
4826 {{{quote|{{{1}}}}}}
4827 !! endarticle
4828
4829 !!test
4830 Templates: Template Name/Arg clash: 1. Use of positional param
4831 !!input
4832 {{quote|foo}}
4833 !!result
4834 <p>foo
4835 </p>
4836 !!end
4837
4838 !!test
4839 Templates: Template Name/Arg clash: 2. Use of named param
4840 !!input
4841 {{quote|quote=foo}}
4842 !!result
4843 <p>foo
4844 </p>
4845 !!end
4846
4847 !!test
4848 Templates: Template Name/Arg clash: 3. Use of named param with empty input
4849 !!input
4850 {{quote|quote}}
4851 !!result
4852 <p>quote
4853 </p>
4854 !!end
4855
4856 ###
4857 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
4858 ###
4859
4860 !!test
4861 Templates: 1. Simple use
4862 !!input
4863 {{echo|Foo}}
4864 !!result
4865 <p>Foo
4866 </p>
4867 !!end
4868
4869 !!test
4870 Templates: 2. Inside a block tag
4871 !!input
4872 <div>{{echo|Foo}}</div>
4873 !!result
4874 <div>Foo</div>
4875
4876 !!end
4877
4878 !!test
4879 Templates: P-wrapping: 1a. Templates on consecutive lines
4880 !!input
4881 {{echo|Foo}}
4882 {{echo|bar}}
4883 !!result
4884 <p>Foo
4885 bar
4886 </p>
4887 !!end
4888
4889 !!test
4890 Templates: P-wrapping: 1b. Templates on consecutive lines
4891 !!input
4892 Foo
4893
4894 {{echo|bar}}
4895 {{echo|baz}}
4896 !!result
4897 <p>Foo
4898 </p><p>bar
4899 baz
4900 </p>
4901 !!end
4902
4903 !!test
4904 Templates: P-wrapping: 1c. Templates on consecutive lines
4905 !!input
4906 {{echo|Foo}}
4907 {{echo|bar}} <div>baz</div>
4908 !!result
4909 <p>Foo
4910 </p>
4911 bar <div>baz</div>
4912
4913 !!end
4914
4915 !!test
4916 Templates: Inline Text: 1. Multiple tmeplate uses
4917 !!input
4918 {{echo|Foo}}bar{{echo|baz}}
4919 !!result
4920 <p>Foobarbaz
4921 </p>
4922 !!end
4923
4924 !!test
4925 Templates: Inline Text: 2. Back-to-back template uses
4926 !!input
4927 {{echo|Foo}}{{echo|bar}}
4928 !!result
4929 <p>Foobar
4930 </p>
4931 !!end
4932
4933 !!test
4934 Templates: Block Tags: 1. Multiple template uses
4935 !!input
4936 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
4937 !!result
4938 <div>Foo</div><div>bar</div><div>baz</div>
4939
4940 !!end
4941
4942 !!test
4943 Templates: Block Tags: 2. Back-to-back template uses
4944 !!input
4945 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
4946 !!result
4947 <div>Foo</div><div>bar</div>
4948
4949 !!end
4950
4951 !!test
4952 Templates: Links: 1. Simple example
4953 !!input
4954 {{echo|[[Foo|bar]]}}
4955 !!result
4956 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
4957 </p>
4958 !!end
4959
4960 !!test
4961 Templates: Links: 2. Generation of link href
4962 !!input
4963 [[{{echo|Foo}}|bar]]
4964 !!result
4965 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
4966 </p>
4967 !!end
4968
4969 !!test
4970 Templates: Links: 3. Generation of part of a link href
4971 !!input
4972 [[Fo{{echo|o}}|bar]]
4973 !!result
4974 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
4975 </p>
4976 !!end
4977
4978 !!test
4979 Templates: Links: 4. Multiple templates generating link href
4980 !!input
4981 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
4982 !!result
4983 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
4984 </p>
4985 !!end
4986
4987 !!test
4988 Templates: Links: 5. Generation of link text
4989 !!input
4990 [[Foo|{{echo|bar}}]]
4991 !!result
4992 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
4993 </p>
4994 !!end
4995
4996 !!test
4997 Templates: Links: 5. Nested templates (only outermost template should be marked)
4998 !!input
4999 {{echo|[[{{echo|Foo}}|bar]]}}
5000 !!result
5001 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5002 </p>
5003 !!end
5004
5005 !!test
5006 Templates: HTML Tag: 1. Generation of HTML attr. key
5007 !!input
5008 <div {{echo|style}}="color:red;">foo</div>
5009 !!result
5010 <div style="color:red;">foo</div>
5011
5012 !!end
5013
5014 !!test
5015 Templates: HTML Tag: 2. Generation of HTML attr. value
5016 !!input
5017 <div style={{echo|'color:red;'}}>foo</div>
5018 !!result
5019 <div style="color:red;">foo</div>
5020
5021 !!end
5022
5023 !!test
5024 Templates: HTML Tag: 3. Generation of HTML attr key and value
5025 !!input
5026 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
5027 !!result
5028 <div style="color:red;">foo</div>
5029
5030 !!end
5031
5032 !!test
5033 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
5034 !!input
5035 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
5036 !!result
5037 <div title="This is a long title with just one piece templated">foo</div>
5038
5039 !!end
5040
5041 !!test
5042 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
5043 !!input
5044 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
5045 !!result
5046 <div title="This is a long title with just one piece templated">foo</div>
5047
5048 !!end
5049
5050 !!test
5051 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
5052 !!input
5053 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
5054 !!result
5055 <div title="This is a long title with just one piece templated">foo</div>
5056
5057 !!end
5058
5059 !!test
5060 Templates: HTML Tables: 1. Generating start of a HTML table
5061 !!input
5062 {{echo|<table><tr><td>foo</td>}}</tr></table>
5063 !!result
5064 <table><tr><td>foo</td></tr></table>
5065
5066 !!end
5067
5068 !!test
5069 Templates: HTML Tables: 2a. Generating middle of a HTML table
5070 !!input
5071 <table><tr>{{echo|<td>foo</td>}}</tr></table>
5072 !!result
5073 <table><tr><td>foo</td></tr></table>
5074
5075 !!end
5076
5077 !!test
5078 Templates: HTML Tables: 2b. Generating middle of a HTML table
5079 !!input
5080 <table>{{echo|<tr><td>foo</td></tr>}}</table>
5081 !!result
5082 <table><tr><td>foo</td></tr></table>
5083
5084 !!end
5085
5086 !!test
5087 Templates: HTML Tables: 3. Generating end of a HTML table
5088 !!input
5089 <table><tr>{{echo|<td>foo</td></tr></table>}}
5090 !!result
5091 <table><tr><td>foo</td></tr></table>
5092
5093 !!end
5094
5095 !!test
5096 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
5097 !!input
5098 {{echo|<table>}}<tr><td>foo</td></tr></table>
5099 !!result
5100 <table><tr><td>foo</td></tr></table>
5101
5102 !!end
5103
5104 !!test
5105 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
5106 !!input
5107 <table>{{echo|<tr>}}<td>foo</td></tr></table>
5108 !!result
5109 <table><tr><td>foo</td></tr></table>
5110
5111 !!end
5112
5113 !!test
5114 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
5115 !!input
5116 <table><tr>{{echo|<td>}}foo</td></tr></table>
5117 !!result
5118 <table><tr><td>foo</td></tr></table>
5119
5120 !!end
5121
5122 !!test
5123 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
5124 !!input
5125 <table><tr><td>foo{{echo|</td>}}</tr></table>
5126 !!result
5127 <table><tr><td>foo</td></tr></table>
5128
5129 !!end
5130
5131 !!test
5132 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
5133 !!input
5134 <table><tr><td>foo</td>{{echo|</tr>}}</table>
5135 !!result
5136 <table><tr><td>foo</td></tr></table>
5137
5138 !!end
5139
5140 !!test
5141 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
5142 !!input
5143 <table><tr><td>foo</td></tr>{{echo|</table>}}
5144 !!result
5145 <table><tr><td>foo</td></tr></table>
5146
5147 !!end
5148
5149 !!test
5150 Templates: Wiki Tables: 1. Fostering of entire template content
5151 !!input
5152 {|
5153 {{echo|a}}
5154 |}
5155 !!result
5156 <table>
5157 a
5158 <tr><td></td></tr></table>
5159
5160 !!end
5161
5162 !!test
5163 Templates: Wiki Tables: 2. Fostering of partial template content
5164 !!input
5165 {|
5166 {{echo|a
5167 <div>b</div>}}
5168 |}
5169 !!result
5170 <table>
5171 a
5172 <div>b</div>
5173 <tr><td></td></tr></table>
5174
5175 !!end
5176
5177 !!test
5178 Templates: Wiki Tables: 3. td-content via multiple templates
5179 !!input
5180 {|
5181 {{echo|{{pipe}}a}}{{echo|b}}
5182 |}
5183 !!result
5184 <table>
5185 <tr>
5186 <td>ab
5187 </td></tr></table>
5188
5189 !!end
5190
5191 !!test
5192 Templates: Lists: Multi-line list-items via templates
5193 !!input
5194 *{{echo|a {{nonexistent|
5195 unused}}}}
5196 *{{echo|b {{nonexistent|
5197 unused}}}}
5198 !!result
5199 <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>
5200 </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>
5201 </li></ul>
5202
5203 !!end
5204
5205 !!test
5206 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
5207 !!input
5208 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
5209 !!result
5210 <p><i>ab</i>c<i>d</i>e
5211 </p>
5212 !!end
5213
5214 !!test
5215 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
5216 (PHP parser generates misnested html)
5217 !! options
5218 disabled
5219 !!input
5220 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
5221 !!result
5222 <p><span><i>a</i></span><i><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
5223 !!end
5224
5225 !!test
5226 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
5227 (PHP parser generates misnested html)
5228 !! options
5229 disabled
5230 !!input
5231 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
5232 !!result
5233 <div><i>a</i></div>
5234 <div><i>b</i>c<i>d</i></div>
5235 <div>e</div>
5236 !!end
5237
5238 !!test
5239 Templates: Ugly nesting: 4. Divs opened/closed across templates
5240 !!input
5241 a<div>b{{echo|c</div>d}}e
5242 !!result
5243 a<div>bc</div>de
5244
5245 !!end
5246
5247 !!test
5248 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
5249 (Parsoid-centric)
5250 !! options
5251 disabled
5252 !!input
5253 {|
5254 |{{echo|foo</table>}}
5255 |bar
5256 |}
5257 !!result
5258 <table data-parsoid="{&quot;src&quot;:&quot;{|\n|{{echo|foo&lt;/table&gt;}}\n|bar\n|}&quot;}" about="#mwt1" typeof="mw:Object/Template ">
5259 <tbody><tr><td>foo</td></tr></tbody></table><span about="#mwt1">
5260 bar</span><span about="#mwt1">
5261 </span>
5262 !!end
5263
5264 !!test
5265 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
5266 (Parsoid-centric)
5267 !! options
5268 disabled
5269 !!input
5270 <table>
5271 <tr>
5272 <td>
5273 <table>
5274 <tr>
5275 <td>1. {{echo|foo </table>}}</td>
5276 <td> bar </td>
5277 <td>2. {{echo|baz </table>}}</td>
5278 </tr>
5279 <tr>
5280 <td>abc</td>
5281 </tr>
5282 </table>
5283 </td>
5284 </tr>
5285 <tr>
5286 <td>xyz</td>
5287 </tr>
5288 </table>
5289 !!result
5290 <table data-parsoid="{&quot;src&quot;:&quot;&lt;table&gt;\n &lt;tr&gt;\n &lt;td&gt;\n &lt;table&gt;\n &lt;tr&gt;\n &lt;td&gt;1. {{echo|foo &lt;/table&gt;}}&lt;/td&gt;\n &lt;td&gt; bar &lt;/td&gt;\n &lt;td&gt;2. {{echo|baz &lt;/table&gt;}}&lt;/td&gt;\n &lt;/tr&gt;\n &lt;tr&gt;\n &lt;td&gt;abc&lt;/td&gt;\n &lt;/tr&gt;\n &lt;/table&gt;\n &lt;/td&gt;\n &lt;/tr&gt;\n &lt;tr&gt;\n &lt;td&gt;xyz&lt;/td&gt;\n &lt;/tr&gt;\n&lt;/table&gt;&quot;}" about="#mwt1" typeof="mw:Object/Template">
5291 <tbody><tr data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">
5292 <td data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">
5293 <table data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">
5294 <tbody><tr data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">
5295 <td data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">1. foo </td></tr></tbody></table></td>
5296 <td data-parsoid="{&quot;stx&quot;:&quot;html&quot;}"> bar </td>
5297 <td data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">2. baz </td></tr></tbody></table><span about="#mwt1">
5298 </span><span about="#mwt1">
5299
5300 abc</span><span about="#mwt1">
5301 </span><span about="#mwt1">
5302 </span><span about="#mwt1">
5303 </span><span about="#mwt1">
5304 </span><span about="#mwt1">
5305
5306 xyz</span><span about="#mwt1">
5307 </span><span about="#mwt1">
5308 </span>
5309 !!end
5310
5311 !!test
5312 Parser Functions: 1. Simple example
5313 !!input
5314 {{uc:foo}}
5315 !!result
5316 <p>FOO
5317 </p>
5318 !!end
5319
5320 !!test
5321 Parser Functions: 2. Nested use (only outermost should be marked up)
5322 !!input
5323 {{uc:{{lc:FOO}}}}
5324 !!result
5325 <p>FOO
5326 </p>
5327 !!end
5328
5329 ###
5330 ### Pre-save transform tests
5331 ###
5332 !! test
5333 pre-save transform: subst:
5334 !! options
5335 PST
5336 !! input
5337 {{subst:test}}
5338 !! result
5339 This is a test template
5340 !! end
5341
5342 !! test
5343 pre-save transform: normal template
5344 !! options
5345 PST
5346 !! input
5347 {{test}}
5348 !! result
5349 {{test}}
5350 !! end
5351
5352 !! test
5353 pre-save transform: nonexistent template
5354 !! options
5355 PST
5356 !! input
5357 {{thistemplatedoesnotexist}}
5358 !! result
5359 {{thistemplatedoesnotexist}}
5360 !! end
5361
5362
5363 !! test
5364 pre-save transform: subst magic variables
5365 !! options
5366 PST
5367 !! input
5368 {{subst:SITENAME}}
5369 !! result
5370 MediaWiki
5371 !! end
5372
5373 # This is bug 89, which I fixed. -- wtm
5374 !! test
5375 pre-save transform: subst: templates with parameters
5376 !! options
5377 pst
5378 !! input
5379 {{subst:paramtest|param="something else"}}
5380 !! result
5381 This is a test template with parameter "something else"
5382 !! end
5383
5384 !! article
5385 Template:nowikitest
5386 !! text
5387 <nowiki>'''not wiki'''</nowiki>
5388 !! endarticle
5389
5390 !! test
5391 pre-save transform: nowiki in subst (bug 1188)
5392 !! options
5393 pst
5394 !! input
5395 {{subst:nowikitest}}
5396 !! result
5397 <nowiki>'''not wiki'''</nowiki>
5398 !! end
5399
5400
5401 !! article
5402 Template:commenttest
5403 !! text
5404 This template has <!-- a comment --> in it.
5405 !! endarticle
5406
5407 !! test
5408 pre-save transform: comment in subst (bug 1936)
5409 !! options
5410 pst
5411 !! input
5412 {{subst:commenttest}}
5413 !! result
5414 This template has <!-- a comment --> in it.
5415 !! end
5416
5417 !! test
5418 pre-save transform: unclosed tag
5419 !! options
5420 pst noxml
5421 !! input
5422 <nowiki>'''not wiki'''
5423 !! result
5424 <nowiki>'''not wiki'''
5425 !! end
5426
5427 !! test
5428 pre-save transform: mixed tag case
5429 !! options
5430 pst noxml
5431 !! input
5432 <NOwiki>'''not wiki'''</noWIKI>
5433 !! result
5434 <NOwiki>'''not wiki'''</noWIKI>
5435 !! end
5436
5437 !! test
5438 pre-save transform: unclosed comment in <nowiki>
5439 !! options
5440 pst noxml
5441 !! input
5442 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
5443 !! result
5444 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
5445 !!end
5446
5447 !! article
5448 Template:dangerous
5449 !!text
5450 <span onmouseover="alert('crap')">Oh no</span>
5451 !!endarticle
5452
5453 !!test
5454 (confirming safety of fix for subst bug 1936)
5455 !! input
5456 {{Template:dangerous}}
5457 !! result
5458 <p><span>Oh no</span>
5459 </p>
5460 !! end
5461
5462 !! test
5463 pre-save transform: comment containing gallery (bug 5024)
5464 !! options
5465 pst
5466 !! input
5467 <!-- <gallery>data</gallery> -->
5468 !!result
5469 <!-- <gallery>data</gallery> -->
5470 !!end
5471
5472 !! test
5473 pre-save transform: comment containing extension
5474 !! options
5475 pst
5476 !! input
5477 <!-- <tag>data</tag> -->
5478 !!result
5479 <!-- <tag>data</tag> -->
5480 !!end
5481
5482 !! test
5483 pre-save transform: comment containing nowiki
5484 !! options
5485 pst
5486 !! input
5487 <!-- <nowiki>data</nowiki> -->
5488 !!result
5489 <!-- <nowiki>data</nowiki> -->
5490 !!end
5491
5492 !! test
5493 pre-save transform: <noinclude> in subst (bug 3298)
5494 !! options
5495 pst
5496 !! input
5497 {{subst:Includes}}
5498 !! result
5499 Foobar
5500 !! end
5501
5502 !! test
5503 pre-save transform: <onlyinclude> in subst (bug 3298)
5504 !! options
5505 pst
5506 !! input
5507 {{subst:Includes2}}
5508 !! result
5509 Foo
5510 !! end
5511
5512 !! article
5513 Template:SubstTest
5514 !!text
5515 {{<includeonly>subst:</includeonly>Includes}}
5516 !! endarticle
5517
5518 !! article
5519 Template:SafeSubstTest
5520 !! text
5521 {{<includeonly>safesubst:</includeonly>Includes}}
5522 !! endarticle
5523
5524 !! test
5525 bug 22297: safesubst: works during PST
5526 !! options
5527 pst
5528 !! input
5529 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
5530 !! result
5531 FoobarFoobar
5532 !! end
5533
5534 !! test
5535 bug 22297: safesubst: works during normal parse
5536 !! input
5537 {{SafeSubstTest}}
5538 !! result
5539 <p>Foobar
5540 </p>
5541 !! end
5542
5543 !! test:
5544 subst: does not work during normal parse
5545 !! input
5546 {{SubstTest}}
5547 !! result
5548 <p>{{subst:Includes}}
5549 </p>
5550 !! end
5551
5552 !! test
5553 pre-save transform: context links ("pipe trick")
5554 !! options
5555 pst
5556 !! input
5557 [[Article (context)|]]
5558 [[Bar:Article|]]
5559 [[:Bar:Article|]]
5560 [[Bar:Article (context)|]]
5561 [[:Bar:Article (context)|]]
5562 [[|Article]]
5563 [[|Article (context)]]
5564 [[Bar:X (Y) Z|]]
5565 [[:Bar:X (Y) Z|]]
5566 !! result
5567 [[Article (context)|Article]]
5568 [[Bar:Article|Article]]
5569 [[:Bar:Article|Article]]
5570 [[Bar:Article (context)|Article]]
5571 [[:Bar:Article (context)|Article]]
5572 [[Article]]
5573 [[Article (context)]]
5574 [[Bar:X (Y) Z|X (Y) Z]]
5575 [[:Bar:X (Y) Z|X (Y) Z]]
5576 !! end
5577
5578 !! test
5579 pre-save transform: context links ("pipe trick") with interwiki prefix
5580 !! options
5581 pst
5582 !! input
5583 [[interwiki:Article|]]
5584 [[:interwiki:Article|]]
5585 [[interwiki:Bar:Article|]]
5586 [[:interwiki:Bar:Article|]]
5587 !! result
5588 [[interwiki:Article|Article]]
5589 [[:interwiki:Article|Article]]
5590 [[interwiki:Bar:Article|Bar:Article]]
5591 [[:interwiki:Bar:Article|Bar:Article]]
5592 !! end
5593
5594 !! test
5595 pre-save transform: context links ("pipe trick") with parens in title
5596 !! options
5597 pst title=[[Somearticle (context)]]
5598 !! input
5599 [[|Article]]
5600 !! result
5601 [[Article (context)|Article]]
5602 !! end
5603
5604 !! test
5605 pre-save transform: context links ("pipe trick") with comma in title
5606 !! options
5607 pst title=[[Someplace, Somewhere]]
5608 !! input
5609 [[|Otherplace]]
5610 [[Otherplace, Elsewhere|]]
5611 [[Otherplace, Elsewhere, Anywhere|]]
5612 !! result
5613 [[Otherplace, Somewhere|Otherplace]]
5614 [[Otherplace, Elsewhere|Otherplace]]
5615 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
5616 !! end
5617
5618 !! test
5619 pre-save transform: context links ("pipe trick") with parens and comma
5620 !! options
5621 pst title=[[Someplace (IGNORED), Somewhere]]
5622 !! input
5623 [[|Otherplace]]
5624 [[Otherplace (place), Elsewhere|]]
5625 !! result
5626 [[Otherplace, Somewhere|Otherplace]]
5627 [[Otherplace (place), Elsewhere|Otherplace]]
5628 !! end
5629
5630 !! test
5631 pre-save transform: context links ("pipe trick") with comma and parens
5632 !! options
5633 pst title=[[Who, me? (context)]]
5634 !! input
5635 [[|Yes, you.]]
5636 [[Me, Myself, and I (1937 song)|]]
5637 !! result
5638 [[Yes, you. (context)|Yes, you.]]
5639 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
5640 !! end
5641
5642 !! test
5643 pre-save transform: context links ("pipe trick") with namespace
5644 !! options
5645 pst title=[[Ns:Somearticle]]
5646 !! input
5647 [[|Article]]
5648 !! result
5649 [[Ns:Article|Article]]
5650 !! end
5651
5652 !! test
5653 pre-save transform: context links ("pipe trick") with namespace and parens
5654 !! options
5655 pst title=[[Ns:Somearticle (context)]]
5656 !! input
5657 [[|Article]]
5658 !! result
5659 [[Ns:Article (context)|Article]]
5660 !! end
5661
5662 !! test
5663 pre-save transform: context links ("pipe trick") with namespace and comma
5664 !! options
5665 pst title=[[Ns:Somearticle, Context, Whatever]]
5666 !! input
5667 [[|Article]]
5668 !! result
5669 [[Ns:Article, Context, Whatever|Article]]
5670 !! end
5671
5672 !! test
5673 pre-save transform: context links ("pipe trick") with namespace, comma and parens
5674 !! options
5675 pst title=[[Ns:Somearticle, Context (context)]]
5676 !! input
5677 [[|Article]]
5678 !! result
5679 [[Ns:Article (context)|Article]]
5680 !! end
5681
5682 !! test
5683 pre-save transform: context links ("pipe trick") with namespace, parens and comma
5684 !! options
5685 pst title=[[Ns:Somearticle (IGNORED), Context]]
5686 !! input
5687 [[|Article]]
5688 !! result
5689 [[Ns:Article, Context|Article]]
5690 !! end
5691
5692 !! test
5693 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
5694 !! options
5695 pst
5696 !! input
5697 [[Article(context)|]]
5698 [[Bar:Article(context)|]]
5699 [[:Bar:Article(context)|]]
5700 [[|Article(context)]]
5701 [[Bar:X(Y)Z|]]
5702 [[:Bar:X(Y)Z|]]
5703 !! result
5704 [[Article(context)|Article]]
5705 [[Bar:Article(context)|Article]]
5706 [[:Bar:Article(context)|Article]]
5707 [[Article(context)]]
5708 [[Bar:X(Y)Z|X(Y)Z]]
5709 [[:Bar:X(Y)Z|X(Y)Z]]
5710 !! end
5711
5712 !! test
5713 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
5714 !! options
5715 pst
5716 !! input
5717 [[Article (context)|]]
5718 [[Bar:Article (context)|]]
5719 [[:Bar:Article (context)|]]
5720 [[|Article (context)]]
5721 [[Bar:X (Y) Z|]]
5722 [[:Bar:X (Y) Z|]]
5723 !! result
5724 [[Article (context)|Article]]
5725 [[Bar:Article (context)|Article]]
5726 [[:Bar:Article (context)|Article]]
5727 [[Article (context)]]
5728 [[Bar:X (Y) Z|X (Y) Z]]
5729 [[:Bar:X (Y) Z|X (Y) Z]]
5730 !! end
5731
5732 !! test
5733 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
5734 !! options
5735 pst
5736 !! input
5737 [[Article(context)|]]
5738 [[Bar:Article(context)|]]
5739 [[:Bar:Article(context)|]]
5740 [[|Article(context)]]
5741 [[Bar:X(Y)Z|]]
5742 [[:Bar:X(Y)Z|]]
5743 !! result
5744 [[Article(context)|Article]]
5745 [[Bar:Article(context)|Article]]
5746 [[:Bar:Article(context)|Article]]
5747 [[Article(context)]]
5748 [[Bar:X(Y)Z|X(Y)Z]]
5749 [[:Bar:X(Y)Z|X(Y)Z]]
5750 !! end
5751
5752 !! test
5753 pre-save transform: context links ("pipe trick") with commas (bug 21660)
5754 !! options
5755 pst
5756 !! input
5757 [[Article (context), context|]]
5758 [[Article (context),context|]]
5759 [[Bar:Article (context), context|]]
5760 [[Bar:Article (context),context|]]
5761 [[:Bar:Article (context), context|]]
5762 [[:Bar:Article (context),context|]]
5763 !! result
5764 [[Article (context), context|Article]]
5765 [[Article (context),context|Article]]
5766 [[Bar:Article (context), context|Article]]
5767 [[Bar:Article (context),context|Article]]
5768 [[:Bar:Article (context), context|Article]]
5769 [[:Bar:Article (context),context|Article]]
5770 !! end
5771
5772 !! test
5773 pre-save transform: trim trailing empty lines
5774 !! options
5775 pst
5776 !! input
5777 Empty lines are trimmed
5778
5779
5780
5781
5782 !! result
5783 Empty lines are trimmed
5784 !! end
5785
5786 !! test
5787 pre-save transform: Signature expansion
5788 !! options
5789 pst
5790 !! input
5791 * ~~~
5792 * <noinclude>~~~</noinclude>
5793 * <includeonly>~~~</includeonly>
5794 * <onlyinclude>~~~</onlyinclude>
5795 !! result
5796 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
5797 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
5798 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
5799 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
5800 !! end
5801
5802
5803 !! test
5804 pre-save transform: Signature expansion in nowiki tags (bug 93)
5805 !! options
5806 pst disabled
5807 !! input
5808 Shall not expand:
5809
5810 <nowiki>~~~~</nowiki>
5811
5812 <includeonly><nowiki>~~~~</nowiki></includeonly>
5813
5814 <noinclude><nowiki>~~~~</nowiki></noinclude>
5815
5816 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
5817
5818 {{subst:Foo}} shall be converted to FOO
5819
5820 As well as inside noinclude/onlyinclude
5821 <noinclude>{{subst:Foo}}</noinclude>
5822 <onlyinclude>{{subst:Foo}}</onlyinclude>
5823
5824 But not inside includeonly
5825 <includeonly>{{subst:Foo}}</includeonly>
5826 !! result
5827 Shall not expand:
5828
5829 <nowiki>~~~~</nowiki>
5830
5831 <includeonly><nowiki>~~~~</nowiki></includeonly>
5832
5833 <noinclude><nowiki>~~~~</nowiki></noinclude>
5834
5835 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
5836
5837 FOO shall be converted to FOO
5838
5839 As well as inside noinclude/onlyinclude
5840 <noinclude>FOO</noinclude>
5841 <onlyinclude>FOO</onlyinclude>
5842
5843 But not inside includeonly
5844 <includeonly>{{subst:Foo}}</includeonly>
5845 !! end
5846
5847 ###
5848 ### Message transform tests
5849 ###
5850 !! test
5851 message transform: magic variables
5852 !! options
5853 msg
5854 !! input
5855 {{SITENAME}}
5856 !! result
5857 MediaWiki
5858 !! end
5859
5860 !! test
5861 message transform: should not transform wiki markup
5862 !! options
5863 msg
5864 !! input
5865 ''test''
5866 !! result
5867 ''test''
5868 !! end
5869
5870 !! test
5871 message transform: <noinclude> in transcluded template (bug 4926)
5872 !! options
5873 msg
5874 !! input
5875 {{Includes}}
5876 !! result
5877 Foobar
5878 !! end
5879
5880 !! test
5881 message transform: <onlyinclude> in transcluded template (bug 4926)
5882 !! options
5883 msg
5884 !! input
5885 {{Includes2}}
5886 !! result
5887 Foo
5888 !! end
5889
5890 !! test
5891 {{#special:}} page name, known
5892 !! options
5893 msg
5894 !! input
5895 {{#special:Recentchanges}}
5896 !! result
5897 Special:RecentChanges
5898 !! end
5899
5900 !! test
5901 {{#special:}} page name with subpage, known
5902 !! options
5903 msg
5904 !! input
5905 {{#special:Recentchanges/param}}
5906 !! result
5907 Special:RecentChanges/param
5908 !! end
5909
5910 !! test
5911 {{#special:}} page name, unknown
5912 !! options
5913 msg
5914 !! input
5915 {{#special:foobarnonexistent}}
5916 !! result
5917 No such special page
5918 !! end
5919
5920 !! test
5921 {{#speciale:}} page name, known
5922 !! options
5923 msg
5924 !! input
5925 {{#speciale:Recentchanges}}
5926 !! result
5927 Special:RecentChanges
5928 !! end
5929
5930 !! test
5931 {{#speciale:}} page name with subpage, known
5932 !! options
5933 msg
5934 !! input
5935 {{#speciale:Recentchanges/param}}
5936 !! result
5937 Special:RecentChanges/param
5938 !! end
5939
5940 !! test
5941 {{#speciale:}} page name, unknown
5942 !! options
5943 msg
5944 !! input
5945 {{#speciale:foobarnonexistent}}
5946 !! result
5947 No_such_special_page
5948 !! end
5949
5950 ###
5951 ### Images
5952 ###
5953 !! test
5954 Simple image
5955 !! input
5956 [[Image:foobar.jpg]]
5957 !! result
5958 <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>
5959 </p>
5960 !! end
5961
5962 !! test
5963 Right-aligned image
5964 !! input
5965 [[Image:foobar.jpg|right]]
5966 !! result
5967 <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>
5968
5969 !! end
5970
5971 !! test
5972 Simple image (using File: namespace, now canonical)
5973 !! input
5974 [[File:foobar.jpg]]
5975 !! result
5976 <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>
5977 </p>
5978 !! end
5979
5980 !! test
5981 Image with caption
5982 !! input
5983 [[Image:foobar.jpg|right|Caption text]]
5984 !! result
5985 <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>
5986
5987 !! end
5988
5989 !! test
5990 Image with empty attribute
5991 !! input
5992 [[Image:foobar.jpg|right||Caption text]]
5993 !! result
5994 <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>
5995
5996 !! end
5997
5998 !! test
5999 Image with link tails
6000 !! input
6001 123[[Image:foobar.jpg]]456
6002 123[[Image:foobar.jpg|right]]456
6003 123[[Image:foobar.jpg|thumb]]456
6004 !! result
6005 <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
6006 </p>
6007 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
6008 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
6009
6010 !! end
6011
6012 !! test
6013 Image with multiple captions -- only last one is accepted
6014 !! input
6015 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
6016 !! result
6017 <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>
6018
6019 !! end
6020
6021 !! test
6022 Image with link parameter, wiki target
6023 !! input
6024 [[Image:foobar.jpg|link=Target page]]
6025 !! result
6026 <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>
6027 </p>
6028 !! end
6029
6030 !! test
6031 Image with link parameter, URL target
6032 !! input
6033 [[Image:foobar.jpg|link=http://example.com/]]
6034 !! result
6035 <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>
6036 </p>
6037 !! end
6038
6039 !! test
6040 Image with link parameter, wgExternalLinkTarget
6041 !! input
6042 [[Image:foobar.jpg|link=http://example.com/]]
6043 !! config
6044 wgExternalLinkTarget='foobar'
6045 !! result
6046 <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>
6047 </p>
6048 !! end
6049
6050 !! test
6051 Image with link parameter, wgNoFollowLinks set to false
6052 !! input
6053 [[Image:foobar.jpg|link=http://example.com/]]
6054 !! config
6055 wgNoFollowLinks=false
6056 !! result
6057 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6058 </p>
6059 !! end
6060
6061 !! test
6062 Image with link parameter, wgNoFollowDomainExceptions
6063 !! input
6064 [[Image:foobar.jpg|link=http://example.com/]]
6065 !! config
6066 wgNoFollowDomainExceptions='example.com'
6067 !! result
6068 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6069 </p>
6070 !! end
6071
6072 !! test
6073 Image with link parameter, wgExternalLinkTarget, unnamed parameter
6074 !! input
6075 [[Image:foobar.jpg|link=http://example.com/|Title]]
6076 !! config
6077 wgExternalLinkTarget='foobar'
6078 !! result
6079 <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>
6080 </p>
6081 !! end
6082
6083 !! test
6084 Image with empty link parameter
6085 !! input
6086 [[Image:foobar.jpg|link=]]
6087 !! result
6088 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
6089 </p>
6090 !! end
6091
6092 !! test
6093 Image with link parameter (wiki target) and unnamed parameter
6094 !! input
6095 [[Image:foobar.jpg|link=Target page|Title]]
6096 !! result
6097 <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>
6098 </p>
6099 !! end
6100
6101 !! test
6102 Image with link parameter (URL target) and unnamed parameter
6103 !! input
6104 [[Image:foobar.jpg|link=http://example.com/|Title]]
6105 !! result
6106 <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>
6107 </p>
6108 !! end
6109
6110 !! test
6111 Thumbnail image with link parameter
6112 !! input
6113 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
6114 !! result
6115 <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>
6116
6117 !! end
6118
6119 !! test
6120 Image with frame and link
6121 !! input
6122 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
6123 !! result
6124 <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>
6125
6126 !! end
6127
6128 !! test
6129 Image with frame and link and explicit alt
6130 !! input
6131 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
6132 !! result
6133 <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>
6134
6135 !! end
6136
6137 !! test
6138 Image with wiki markup in implicit alt
6139 !! input
6140 [[Image:Foobar.jpg|testing '''bold''' in alt]]
6141 !! result
6142 <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>
6143 </p>
6144 !! end
6145
6146 !! test
6147 Image with wiki markup in explicit alt
6148 !! input
6149 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
6150 !! result
6151 <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>
6152 </p>
6153 !! end
6154
6155 !! test
6156 Link to image page- image page normally doesn't exists, hence edit link
6157 Add test with existing image page
6158 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
6159 !! input
6160 [[:Image:test]]
6161 !! result
6162 <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>
6163 </p>
6164 !! end
6165
6166 !! test
6167 bug 18784 Link to non-existent image page with caption should use caption as link text
6168 !! input
6169 [[:Image:test|caption]]
6170 !! result
6171 <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>
6172 </p>
6173 !! end
6174
6175 !! test
6176 Frameless image caption with a free URL
6177 !! input
6178 [[Image:foobar.jpg|http://example.com]]
6179 !! result
6180 <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>
6181 </p>
6182 !! end
6183
6184 !! test
6185 Thumbnail image caption with a free URL
6186 !! input
6187 [[Image:foobar.jpg|thumb|http://example.com]]
6188 !! result
6189 <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>
6190
6191 !! end
6192
6193 !! test
6194 Thumbnail image caption with a free URL and explicit alt
6195 !! input
6196 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
6197 !! result
6198 <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>
6199
6200 !! end
6201
6202 !! test
6203 BUG 1887: A ISBN with a thumbnail
6204 !! input
6205 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
6206 !! result
6207 <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>
6208
6209 !! end
6210
6211 !! test
6212 BUG 1887: A RFC with a thumbnail
6213 !! input
6214 [[Image:foobar.jpg|thumb|This is RFC 12354]]
6215 !! result
6216 <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" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
6217
6218 !! end
6219
6220 !! test
6221 BUG 1887: A mailto link with a thumbnail
6222 !! input
6223 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
6224 !! result
6225 <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>
6226
6227 !! end
6228
6229 # Pending resolution to bug 368
6230 !! test
6231 BUG 648: Frameless image caption with a link
6232 !! input
6233 [[Image:foobar.jpg|text with a [[link]] in it]]
6234 !! result
6235 <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>
6236 </p>
6237 !! end
6238
6239 !! test
6240 BUG 648: Frameless image caption with a link (suffix)
6241 !! input
6242 [[Image:foobar.jpg|text with a [[link]]foo in it]]
6243 !! result
6244 <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>
6245 </p>
6246 !! end
6247
6248 !! test
6249 BUG 648: Frameless image caption with an interwiki link
6250 !! input
6251 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
6252 !! result
6253 <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>
6254 </p>
6255 !! end
6256
6257 !! test
6258 BUG 648: Frameless image caption with a piped interwiki link
6259 !! input
6260 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
6261 !! result
6262 <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>
6263 </p>
6264 !! end
6265
6266 !! test
6267 Escape HTML special chars in image alt text
6268 !! input
6269 [[Image:foobar.jpg|& < > "]]
6270 !! result
6271 <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>
6272 </p>
6273 !! end
6274
6275 !! test
6276 BUG 499: Alt text should have &#1234;, not &amp;1234;
6277 !! input
6278 [[Image:foobar.jpg|&#9792;]]
6279 !! result
6280 <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>
6281 </p>
6282 !! end
6283
6284 !! test
6285 Broken image caption with link
6286 !! input
6287 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
6288 !! result
6289 <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.
6290 </p>
6291 !! end
6292
6293 !! test
6294 Image caption containing another image
6295 !! input
6296 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
6297 !! result
6298 <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>
6299
6300 !! end
6301
6302 !! test
6303 Image caption containing a newline
6304 !! input
6305 [[Image:Foobar.jpg|This
6306 *is some text]]
6307 !! result
6308 <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>
6309 </p>
6310 !!end
6311
6312
6313 !! test
6314 Bug 3090: External links other than http: in image captions
6315 !! input
6316 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
6317 !! result
6318 <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>
6319
6320 !! end
6321
6322 !! test
6323 Custom class
6324 !! input
6325 [[Image:foobar.jpg|a|class=b]]
6326 !! result
6327 <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>
6328 </p>
6329 !! end
6330
6331 !! article
6332 File:Barfoo.jpg
6333 !! text
6334 #REDIRECT [[File:Barfoo.jpg]]
6335 !! endarticle
6336
6337 !! test
6338 Redirected image
6339 !! input
6340 [[Image:Barfoo.jpg]]
6341 !! result
6342 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
6343 </p>
6344 !! end
6345
6346 !! test
6347 Missing image with uploads disabled
6348 !! options
6349 wgEnableUploads=0
6350 !! input
6351 [[Image:Foobaz.jpg]]
6352 !! result
6353 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
6354 </p>
6355 !! end
6356
6357
6358 ###
6359 ### Subpages
6360 ###
6361 !! article
6362 Subpage test/subpage
6363 !! text
6364 foo
6365 !! endarticle
6366
6367 !! test
6368 Subpage link
6369 !! options
6370 subpage title=[[Subpage test]]
6371 !! input
6372 [[/subpage]]
6373 !! result
6374 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
6375 </p>
6376 !! end
6377
6378 !! test
6379 Subpage noslash link
6380 !! options
6381 subpage title=[[Subpage test]]
6382 !!input
6383 [[/subpage/]]
6384 !! result
6385 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
6386 </p>
6387 !! end
6388
6389 !! test
6390 Disabled subpages
6391 !! input
6392 [[/subpage]]
6393 !! result
6394 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
6395 </p>
6396 !! end
6397
6398 !! test
6399 BUG 561: {{/Subpage}}
6400 !! options
6401 subpage title=[[Page]]
6402 !! input
6403 {{/Subpage}}
6404 !! result
6405 <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>
6406 </p>
6407 !! end
6408
6409 ###
6410 ### Categories
6411 ###
6412 !! article
6413 Category:MediaWiki User's Guide
6414 !! text
6415 blah
6416 !! endarticle
6417
6418 !! test
6419 Link to category
6420 !! input
6421 [[:Category:MediaWiki User's Guide]]
6422 !! result
6423 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
6424 </p>
6425 !! end
6426
6427 !! test
6428 Simple category
6429 !! options
6430 cat
6431 !! input
6432 [[Category:MediaWiki User's Guide]]
6433 !! result
6434 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
6435 !! end
6436
6437 !! test
6438 PAGESINCATEGORY invalid title fatal (r33546 fix)
6439 !! input
6440 {{PAGESINCATEGORY:<bogus>}}
6441 !! result
6442 <p>0
6443 </p>
6444 !! end
6445
6446 !! test
6447 Category with different sort key
6448 !! options
6449 cat
6450 !! input
6451 [[Category:MediaWiki User's Guide|Foo]]
6452 !! result
6453 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
6454 !! end
6455
6456 !! test
6457 Category with identical sort key
6458 !! options
6459 cat
6460 !! input
6461 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
6462 !! result
6463 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
6464 !! end
6465
6466 !! test
6467 Category with empty sort key
6468 !! options
6469 cat
6470 pst
6471 !! input
6472 [[Category:MediaWiki User's Guide|]]
6473 !! result
6474 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
6475 !! end
6476
6477 !! test
6478 Category with empty sort key and parentheses
6479 !! options
6480 cat
6481 pst
6482 !! input
6483 [[Category:Foo (bar)|]]
6484 !! result
6485 [[Category:Foo (bar)|Foo]]
6486 !! end
6487
6488 !! test
6489 Category with link tail
6490 !! options
6491 cat
6492 pst
6493 !! input
6494 123[[Category:Foo]]456
6495 !! result
6496 123[[Category:Foo]]456
6497 !! end
6498
6499 !! test
6500 Category with template
6501 !! options
6502 cat
6503 pst
6504 !! input
6505 [[Category:{{echo|Foo}}]]
6506 !! result
6507 [[Category:{{echo|Foo}}]]
6508 !! end
6509
6510 !! test
6511 Category with template in sort key
6512 !! options
6513 cat
6514 pst
6515 !! input
6516 [[Category:Foo|{{echo|Bar}}]]
6517 !! result
6518 [[Category:Foo|{{echo|Bar}}]]
6519 !! end
6520
6521 !! test
6522 Category with template in sort key and title
6523 !! options
6524 cat
6525 pst
6526 !! input
6527 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
6528 !! result
6529 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
6530 !! end
6531
6532 !! test
6533 Category / paragraph interactions
6534 !! input
6535 Foo [[Category:Baz]] Bar
6536
6537 Foo [[Category:Baz]]
6538 Bar
6539
6540 Foo
6541 [[Category:Baz]]
6542 Bar
6543
6544 Foo
6545 [[Category:Baz]] Bar
6546
6547 Foo
6548 [[Category:Baz]]
6549 [[Category:Baz]]
6550 [[Category:Baz]]
6551 Bar
6552
6553 [[Category:Baz]]
6554 [[Category:Baz]]
6555 [[Category:Baz]]
6556
6557 [[Category:Baz]]
6558 {{echo|[[Category:Baz]]}}
6559 [[Category:Baz]]
6560 !! result
6561 <p>Foo Bar
6562 </p><p>Foo
6563 Bar
6564 </p><p>Foo
6565 Bar
6566 </p><p>Foo Bar
6567 </p><p>Foo
6568 Bar
6569 </p>
6570 !! end
6571
6572 ###
6573 ### Inter-language links
6574 ###
6575 !! test
6576 Inter-language links
6577 !! options
6578 ill
6579 !! input
6580 [[es:Alimento]]
6581 [[fr:Nourriture]]
6582 [[zh:&#39135;&#21697;]]
6583 !! result
6584 es:Alimento fr:Nourriture zh:食品
6585 !! end
6586
6587 !! test
6588 Duplicate interlanguage links (bug 24502)
6589 !! options
6590 ill
6591 !! input
6592 [[es:1]]
6593 [[es:2]]
6594 [[fr:1]]
6595 [[fr:2]]
6596 !! result
6597 es:1 fr:1
6598 !! end
6599
6600 ###
6601 ### Sections
6602 ###
6603 !! test
6604 Basic section headings
6605 !! input
6606 == Headline 1 ==
6607 Some text
6608
6609 ==Headline 2==
6610 More
6611 ===Smaller headline===
6612 Blah blah
6613 !! result
6614 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline" id="Headline_1"> Headline 1 </span></h2>
6615 <p>Some text
6616 </p>
6617 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline" id="Headline_2">Headline 2</span></h2>
6618 <p>More
6619 </p>
6620 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a>]</span> <span class="mw-headline" id="Smaller_headline">Smaller headline</span></h3>
6621 <p>Blah blah
6622 </p>
6623 !! end
6624
6625 !! test
6626 Section headings with TOC
6627 !! input
6628 == Headline 1 ==
6629 === Subheadline 1 ===
6630 ===== Skipping a level =====
6631 ====== Skipping a level ======
6632
6633 == Headline 2 ==
6634 Some text
6635 ===Another headline===
6636 !! result
6637 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6638 <ul>
6639 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
6640 <ul>
6641 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
6642 <ul>
6643 <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>
6644 <ul>
6645 <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>
6646 </ul>
6647 </li>
6648 </ul>
6649 </li>
6650 </ul>
6651 </li>
6652 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
6653 <ul>
6654 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
6655 </ul>
6656 </li>
6657 </ul>
6658 </td></tr></table>
6659 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline" id="Headline_1"> Headline 1 </span></h2>
6660 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a>]</span> <span class="mw-headline" id="Subheadline_1"> Subheadline 1 </span></h3>
6661 <h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline" id="Skipping_a_level"> Skipping a level </span></h5>
6662 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline" id="Skipping_a_level_2"> Skipping a level </span></h6>
6663 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline" id="Headline_2"> Headline 2 </span></h2>
6664 <p>Some text
6665 </p>
6666 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a>]</span> <span class="mw-headline" id="Another_headline">Another headline</span></h3>
6667
6668 !! end
6669
6670 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
6671 !! test
6672 Handling of sections up to level 6 and beyond
6673 !! input
6674 = Level 1 Heading=
6675 == Level 2 Heading==
6676 === Level 3 Heading===
6677 ==== Level 4 Heading====
6678 ===== Level 5 Heading=====
6679 ====== Level 6 Heading======
6680 ======= Level 7 Heading=======
6681 ======== Level 8 Heading========
6682 ========= Level 9 Heading=========
6683 ========== Level 10 Heading==========
6684 !! result
6685 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6686 <ul>
6687 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
6688 <ul>
6689 <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>
6690 <ul>
6691 <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>
6692 <ul>
6693 <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>
6694 <ul>
6695 <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>
6696 <ul>
6697 <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>
6698 <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>
6699 <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>
6700 <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>
6701 <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>
6702 </ul>
6703 </li>
6704 </ul>
6705 </li>
6706 </ul>
6707 </li>
6708 </ul>
6709 </li>
6710 </ul>
6711 </li>
6712 </ul>
6713 </td></tr></table>
6714 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a>]</span> <span class="mw-headline" id="Level_1_Heading"> Level 1 Heading</span></h1>
6715 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a>]</span> <span class="mw-headline" id="Level_2_Heading"> Level 2 Heading</span></h2>
6716 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a>]</span> <span class="mw-headline" id="Level_3_Heading"> Level 3 Heading</span></h3>
6717 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a>]</span> <span class="mw-headline" id="Level_4_Heading"> Level 4 Heading</span></h4>
6718 <h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a>]</span> <span class="mw-headline" id="Level_5_Heading"> Level 5 Heading</span></h5>
6719 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a>]</span> <span class="mw-headline" id="Level_6_Heading"> Level 6 Heading</span></h6>
6720 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a>]</span> <span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span></h6>
6721 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a>]</span> <span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span></h6>
6722 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a>]</span> <span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span></h6>
6723 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</span> <span class="mw-headline" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D">==== Level 10 Heading====</span></h6>
6724
6725 !! end
6726
6727 !! test
6728 TOC regression (bug 9764)
6729 !! input
6730 == title 1 ==
6731 === title 1.1 ===
6732 ==== title 1.1.1 ====
6733 === title 1.2 ===
6734 == title 2 ==
6735 === title 2.1 ===
6736 !! result
6737 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6738 <ul>
6739 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
6740 <ul>
6741 <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>
6742 <ul>
6743 <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>
6744 </ul>
6745 </li>
6746 <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>
6747 </ul>
6748 </li>
6749 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
6750 <ul>
6751 <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>
6752 </ul>
6753 </li>
6754 </ul>
6755 </td></tr></table>
6756 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1"> title 1 </span></h2>
6757 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1"> title 1.1 </span></h3>
6758 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1.1"> title 1.1.1 </span></h4>
6759 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span> <span class="mw-headline" id="title_1.2"> title 1.2 </span></h3>
6760 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2"> title 2 </span></h2>
6761 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span> <span class="mw-headline" id="title_2.1"> title 2.1 </span></h3>
6762
6763 !! end
6764
6765 !! test
6766 TOC with wgMaxTocLevel=3 (bug 6204)
6767 !! options
6768 wgMaxTocLevel=3
6769 !! input
6770 == title 1 ==
6771 === title 1.1 ===
6772 ==== title 1.1.1 ====
6773 === title 1.2 ===
6774 == title 2 ==
6775 === title 2.1 ===
6776 !! result
6777 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6778 <ul>
6779 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
6780 <ul>
6781 <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>
6782 <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>
6783 </ul>
6784 </li>
6785 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
6786 <ul>
6787 <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>
6788 </ul>
6789 </li>
6790 </ul>
6791 </td></tr></table>
6792 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1"> title 1 </span></h2>
6793 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1"> title 1.1 </span></h3>
6794 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1.1"> title 1.1.1 </span></h4>
6795 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span> <span class="mw-headline" id="title_1.2"> title 1.2 </span></h3>
6796 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2"> title 2 </span></h2>
6797 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span> <span class="mw-headline" id="title_2.1"> title 2.1 </span></h3>
6798
6799 !! end
6800
6801 !! test
6802 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
6803 !! options
6804 wgMaxTocLevel=3
6805 !! input
6806 ==Section 1==
6807 ===Section 1.1===
6808 ====Section 1.1.1====
6809 ====Section 1.1.1.1====
6810 ==Section 2==
6811 !! result
6812 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6813 <ul>
6814 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
6815 <ul>
6816 <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>
6817 </ul>
6818 </li>
6819 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
6820 </ul>
6821 </td></tr></table>
6822 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h2>
6823 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1">Section 1.1</span></h3>
6824 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span></h4>
6825 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 1.1.1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span></h4>
6826 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a>]</span> <span class="mw-headline" id="Section_2">Section 2</span></h2>
6827
6828 !! end
6829
6830
6831 !! test
6832 Resolving duplicate section names
6833 !! input
6834 == Foo bar ==
6835 == Foo bar ==
6836 !! result
6837 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar"> Foo bar </span></h2>
6838 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar_2"> Foo bar </span></h2>
6839
6840 !! end
6841
6842 !! test
6843 Resolving duplicate section names with differing case (bug 10721)
6844 !! input
6845 == Foo bar ==
6846 == Foo Bar ==
6847 !! result
6848 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar"> Foo bar </span></h2>
6849 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline" id="Foo_Bar_2"> Foo Bar </span></h2>
6850
6851 !! end
6852
6853 !! article
6854 Template:sections
6855 !! text
6856 ===Section 1===
6857 ==Section 2==
6858 !! endarticle
6859
6860 !! test
6861 Template with sections, __NOTOC__
6862 !! input
6863 __NOTOC__
6864 ==Section 0==
6865 {{sections}}
6866 ==Section 4==
6867 !! result
6868 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a>]</span> <span class="mw-headline" id="Section_0">Section 0</span></h2>
6869 <h3><span class="editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h3>
6870 <h2><span class="editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a>]</span> <span class="mw-headline" id="Section_2">Section 2</span></h2>
6871 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a>]</span> <span class="mw-headline" id="Section_4">Section 4</span></h2>
6872
6873 !! end
6874
6875 !! test
6876 __NOEDITSECTION__ keyword
6877 !! input
6878 __NOEDITSECTION__
6879 ==Section 1==
6880 ==Section 2==
6881 !! result
6882 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
6883 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
6884
6885 !! end
6886
6887 !! test
6888 Link inside a section heading
6889 !! input
6890 ==Section with a [[Main Page|link]] in it==
6891 !! result
6892 <h2><span class="editsection">[<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> <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></h2>
6893
6894 !! end
6895
6896 !! test
6897 TOC regression (bug 12077)
6898 !! input
6899 __TOC__
6900 == title 1 ==
6901 === title 1.1 ===
6902 == title 2 ==
6903 !! result
6904 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6905 <ul>
6906 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
6907 <ul>
6908 <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>
6909 </ul>
6910 </li>
6911 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
6912 </ul>
6913 </td></tr></table>
6914 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1"> title 1 </span></h2>
6915 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1"> title 1.1 </span></h3>
6916 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2"> title 2 </span></h2>
6917
6918 !! end
6919
6920 !! test
6921 BUG 1219 URL next to image (good)
6922 !! input
6923 http://example.com [[Image:foobar.jpg]]
6924 !! result
6925 <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>
6926 </p>
6927 !!end
6928
6929 !! test
6930 Short headings with trailing space should match behaviour of Parser::doHeadings (bug 19910)
6931 !! input
6932 ===
6933 The line above must have a trailing space!
6934 === <!--
6935 --> <!-- -->
6936 But just in case it doesn't...
6937 !! result
6938 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a>]</span> <span class="mw-headline" id=".3D">=</span></h1>
6939 <p>The line above must have a trailing space!
6940 </p>
6941 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a>]</span> <span class="mw-headline" id=".3D_2">=</span></h1>
6942 <p>But just in case it doesn't...
6943 </p>
6944 !! end
6945
6946 !! test
6947 Header with special characters (bug 25462)
6948 !! input
6949 The tooltips shall not show entities to the user (ie. be double escaped)
6950
6951 == text > text ==
6952 section 1
6953
6954 == text < text ==
6955 section 2
6956
6957 == text & text ==
6958 section 3
6959
6960 == text ' text ==
6961 section 4
6962
6963 == text " text ==
6964 section 5
6965 !! result
6966 <p>The tooltips shall not show entities to the user (ie. be double escaped)
6967 </p>
6968 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6969 <ul>
6970 <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>
6971 <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>
6972 <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>
6973 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
6974 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
6975 </ul>
6976 </td></tr></table>
6977 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text > text">edit</a>]</span> <span class="mw-headline" id="text_.3E_text"> text &gt; text </span></h2>
6978 <p>section 1
6979 </p>
6980 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a>]</span> <span class="mw-headline" id="text_.3C_text"> text &lt; text </span></h2>
6981 <p>section 2
6982 </p>
6983 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a>]</span> <span class="mw-headline" id="text_.26_text"> text &amp; text </span></h2>
6984 <p>section 3
6985 </p>
6986 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a>]</span> <span class="mw-headline" id="text_.27_text"> text ' text </span></h2>
6987 <p>section 4
6988 </p>
6989 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a>]</span> <span class="mw-headline" id="text_.22_text"> text " text </span></h2>
6990 <p>section 5
6991 </p>
6992 !! end
6993
6994 !! test
6995 Headers with excess '=' characters
6996 (Are similar tests necessary beyond the 1st level?)
6997 !! input
6998 =foo==
6999 ==foo=
7000 =''italic'' heading==
7001 ==''italic'' heading=
7002 !! result
7003 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7004 <ul>
7005 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
7006 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
7007 <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>
7008 <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>
7009 </ul>
7010 </td></tr></table>
7011 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a>]</span> <span class="mw-headline" id="foo.3D">foo=</span></h1>
7012 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a>]</span> <span class="mw-headline" id=".3Dfoo">=foo</span></h1>
7013 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a>]</span> <span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span></h1>
7014 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a>]</span> <span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span></h1>
7015
7016 !! end
7017
7018 !! test
7019 BUG 1219 URL next to image (broken)
7020 !! input
7021 http://example.com[[Image:foobar.jpg]]
7022 !! result
7023 <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>
7024 </p>
7025 !!end
7026
7027 !! test
7028 Bug 1186 news: in the middle of text
7029 !! input
7030 http://en.wikinews.org/wiki/Wikinews:Workplace
7031 !! result
7032 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
7033 </p>
7034 !!end
7035
7036
7037 !! test
7038 Namespaced link must have a title
7039 !! input
7040 [[Project:]]
7041 !! result
7042 <p>[[Project:]]
7043 </p>
7044 !!end
7045
7046 !! test
7047 Namespaced link must have a title (bad fragment version)
7048 !! input
7049 [[Project:#fragment]]
7050 !! result
7051 <p>[[Project:#fragment]]
7052 </p>
7053 !!end
7054
7055
7056 !! test
7057 div with no attributes
7058 !! input
7059 <div>HTML rocks</div>
7060 !! result
7061 <div>HTML rocks</div>
7062
7063 !! end
7064
7065 !! test
7066 div with double-quoted attribute
7067 !! input
7068 <div id="rock">HTML rocks</div>
7069 !! result
7070 <div id="rock">HTML rocks</div>
7071
7072 !! end
7073
7074 !! test
7075 div with single-quoted attribute
7076 !! input
7077 <div id='rock'>HTML rocks</div>
7078 !! result
7079 <div id="rock">HTML rocks</div>
7080
7081 !! end
7082
7083 !! test
7084 div with unquoted attribute
7085 !! input
7086 <div id=rock>HTML rocks</div>
7087 !! result
7088 <div id="rock">HTML rocks</div>
7089
7090 !! end
7091
7092 !! test
7093 div with illegal double attributes
7094 !! input
7095 <div id="a" id="b">HTML rocks</div>
7096 !! result
7097 <div id="b">HTML rocks</div>
7098
7099 !!end
7100
7101 # FIXME: produce empty string instead of "class" in the PHP parser, following
7102 # the HTML5 spec.
7103 !! test
7104 div with empty attribute value, space before equals
7105 !! options
7106 disabled
7107 !! input
7108 <div class =>HTML rocks</div>
7109 !! result
7110 <div class="">HTML rocks</div>
7111
7112 !! end
7113
7114 # This it very inconsistent in the PHP parser: it returns
7115 # class="class" if there is a space between the name and the equal sign (see
7116 # 'div with empty attribute value, space before equals'), but strips the
7117 # attribute completely if the space is missing. We hope that not much content
7118 # depends on this, so are implementing the behavior below in Parsoid for
7119 # consistencies' sake. Disabled for the PHP parser.
7120 # FIXME: fix this behavior in the PHP parser?
7121 !! test
7122 div with empty attribute value, no space before equals
7123 !! options
7124 disabled
7125 !! input
7126 <div class=>HTML rocks</div>
7127 !! result
7128 <div class="">HTML rocks</div>
7129
7130 !! end
7131
7132 !! test
7133 HTML multiple attributes correction
7134 !! input
7135 <p class="error" class="awesome">Awesome!</p>
7136 !! result
7137 <p class="awesome">Awesome!</p>
7138
7139 !!end
7140
7141 !! test
7142 Table multiple attributes correction
7143 !! input
7144 {|
7145 !+ class="error" class="awesome"| status
7146 |}
7147 !! result
7148 <table>
7149 <tr>
7150 <th class="awesome"> status
7151 </th></tr></table>
7152
7153 !!end
7154
7155 !! test
7156 DIV IN UPPERCASE
7157 !! input
7158 <DIV ID="x">HTML ROCKS</DIV>
7159 !! result
7160 <div id="x">HTML ROCKS</div>
7161
7162 !!end
7163
7164
7165 !! test
7166 text with amp in the middle of nowhere
7167 !! input
7168 Remember AT&T?
7169 !!result
7170 <p>Remember AT&amp;T?
7171 </p>
7172 !! end
7173
7174 !! test
7175 text with character entity: eacute
7176 !! input
7177 I always thought &eacute; was a cute letter.
7178 !! result
7179 <p>I always thought &#233; was a cute letter.
7180 </p>
7181 !! end
7182
7183 !! test
7184 text with undefined character entity: xacute
7185 !! input
7186 I always thought &xacute; was a cute letter.
7187 !! result
7188 <p>I always thought &amp;xacute; was a cute letter.
7189 </p>
7190 !! end
7191
7192
7193 ###
7194 ### Media links
7195 ###
7196
7197 !! test
7198 Media link
7199 !! input
7200 [[Media:Foobar.jpg]]
7201 !! result
7202 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
7203 </p>
7204 !! end
7205
7206 !! test
7207 Media link with text
7208 !! input
7209 [[Media:Foobar.jpg|A neat file to look at]]
7210 !! result
7211 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
7212 </p>
7213 !! end
7214
7215 # FIXME: this is still bad HTML tag nesting
7216 !! test
7217 Media link with nasty text
7218 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
7219 !! input
7220 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
7221 !! result
7222 <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>
7223
7224 !! end
7225
7226 !! test
7227 Media link to nonexistent file (bug 1702)
7228 !! input
7229 [[Media:No such.jpg]]
7230 !! result
7231 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
7232 </p>
7233 !! end
7234
7235 !! test
7236 Image link to nonexistent file (bug 1850 - good)
7237 !! input
7238 [[Image:No such.jpg]]
7239 !! result
7240 <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>
7241 </p>
7242 !! end
7243
7244 !! test
7245 :Image link to nonexistent file (bug 1850 - bad)
7246 !! input
7247 [[:Image:No such.jpg]]
7248 !! result
7249 <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>
7250 </p>
7251 !! end
7252
7253
7254
7255 !! test
7256 Character reference normalization in link text (bug 1938)
7257 !! input
7258 [[Main Page|this&that]]
7259 !! result
7260 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
7261 </p>
7262 !!end
7263
7264 !! article
7265 אַ
7266 !! text
7267 Test for unicode normalization
7268
7269 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
7270 !! endarticle
7271
7272 !! test
7273 (bug 19451) Links should refer to the normalized form.
7274 !! input
7275 [[&#xFB2E;]]
7276 [[&#x5d0;&#x5b7;]]
7277 [[&#x5d0;ַ]]
7278 [[א&#x5b7;]]
7279 [[אַ]]
7280 !! result
7281 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
7282 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
7283 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
7284 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
7285 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
7286 </p>
7287 !! end
7288
7289 !! test
7290 Empty attribute crash test (bug 2067)
7291 !! input
7292 <font color="">foo</font>
7293 !! result
7294 <p><font color="">foo</font>
7295 </p>
7296 !! end
7297
7298 !! test
7299 Empty attribute crash test single-quotes (bug 2067)
7300 !! input
7301 <font color=''>foo</font>
7302 !! result
7303 <p><font color="">foo</font>
7304 </p>
7305 !! end
7306
7307 !! test
7308 Attribute test: equals, then nothing
7309 !! input
7310 <font color=>foo</font>
7311 !! result
7312 <p><font>foo</font>
7313 </p>
7314 !! end
7315
7316 !! test
7317 Attribute test: unquoted value
7318 !! input
7319 <font color=x>foo</font>
7320 !! result
7321 <p><font color="x">foo</font>
7322 </p>
7323 !! end
7324
7325 !! test
7326 Attribute test: unquoted but illegal value (hash)
7327 !! input
7328 <font color=#x>foo</font>
7329 !! result
7330 <p><font color="#x">foo</font>
7331 </p>
7332 !! end
7333
7334 !! test
7335 Attribute test: no value
7336 !! input
7337 <font color>foo</font>
7338 !! result
7339 <p><font color="color">foo</font>
7340 </p>
7341 !! end
7342
7343 !! test
7344 Bug 2095: link with three closing brackets
7345 !! input
7346 [[Main Page]]]
7347 !! result
7348 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
7349 </p>
7350 !! end
7351
7352 !! test
7353 Bug 2095: link with pipe and three closing brackets
7354 !! input
7355 [[Main Page|link]]]
7356 !! result
7357 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
7358 </p>
7359 !! end
7360
7361 !! test
7362 Bug 2095: link with pipe and three closing brackets, version 2
7363 !! input
7364 [[Main Page|[http://example.com/]]]
7365 !! result
7366 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
7367 </p>
7368 !! end
7369
7370
7371 ###
7372 ### Safety
7373 ###
7374
7375 !! article
7376 Template:Dangerous attribute
7377 !! text
7378 " onmouseover="alert(document.cookie)
7379 !! endarticle
7380
7381 !! article
7382 Template:Dangerous style attribute
7383 !! text
7384 border-size: expression(alert(document.cookie))
7385 !! endarticle
7386
7387 !! article
7388 Template:Div style
7389 !! text
7390 <div style="float: right; {{{1}}}">Magic div</div>
7391 !! endarticle
7392
7393 !! test
7394 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
7395 !! input
7396 <div title="{{test}}"></div>
7397 !! result
7398 <div title="This is a test template"></div>
7399
7400 !! end
7401
7402 !! test
7403 Bug 2304: HTML attribute safety (dangerous template; 2309)
7404 !! input
7405 <div title="{{dangerous attribute}}"></div>
7406 !! result
7407 <div title=""></div>
7408
7409 !! end
7410
7411 !! test
7412 Bug 2304: HTML attribute safety (dangerous style template; 2309)
7413 !! input
7414 <div style="{{dangerous style attribute}}"></div>
7415 !! result
7416 <div style="/* insecure input */"></div>
7417
7418 !! end
7419
7420 !! test
7421 Bug 2304: HTML attribute safety (safe parameter; 2309)
7422 !! input
7423 {{div style|width: 200px}}
7424 !! result
7425 <div style="float: right; width: 200px">Magic div</div>
7426
7427 !! end
7428
7429 !! test
7430 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
7431 !! input
7432 {{div style|width: expression(alert(document.cookie))}}
7433 !! result
7434 <div style="/* insecure input */">Magic div</div>
7435
7436 !! end
7437
7438 !! test
7439 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
7440 !! input
7441 {{div style|"><script>alert(document.cookie)</script>}}
7442 !! result
7443 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
7444
7445 !! end
7446
7447 !! test
7448 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
7449 !! input
7450 {{div style|" ><script>alert(document.cookie)</script>}}
7451 !! result
7452 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
7453
7454 !! end
7455
7456 !! test
7457 Bug 2304: HTML attribute safety (link)
7458 !! input
7459 <div title="[[Main Page]]"></div>
7460 !! result
7461 <div title="&#91;&#91;Main Page]]"></div>
7462
7463 !! end
7464
7465 !! test
7466 Bug 2304: HTML attribute safety (italics)
7467 !! input
7468 <div title="''foobar''"></div>
7469 !! result
7470 <div title="&#39;&#39;foobar&#39;&#39;"></div>
7471
7472 !! end
7473
7474 !! test
7475 Bug 2304: HTML attribute safety (bold)
7476 !! input
7477 <div title="'''foobar'''"></div>
7478 !! result
7479 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
7480
7481 !! end
7482
7483
7484 !! test
7485 Bug 2304: HTML attribute safety (ISBN)
7486 !! input
7487 <div title="ISBN 1234567890"></div>
7488 !! result
7489 <div title="&#73;SBN 1234567890"></div>
7490
7491 !! end
7492
7493 !! test
7494 Bug 2304: HTML attribute safety (RFC)
7495 !! input
7496 <div title="RFC 1234"></div>
7497 !! result
7498 <div title="&#82;FC 1234"></div>
7499
7500 !! end
7501
7502 !! test
7503 Bug 2304: HTML attribute safety (PMID)
7504 !! input
7505 <div title="PMID 1234567890"></div>
7506 !! result
7507 <div title="&#80;MID 1234567890"></div>
7508
7509 !! end
7510
7511 !! test
7512 Bug 2304: HTML attribute safety (web link)
7513 !! input
7514 <div title="http://example.com/"></div>
7515 !! result
7516 <div title="http&#58;//example.com/"></div>
7517
7518 !! end
7519
7520 !! test
7521 Bug 2304: HTML attribute safety (named web link)
7522 !! input
7523 <div title="[http://example.com/ link]"></div>
7524 !! result
7525 <div title="&#91;http&#58;//example.com/ link]"></div>
7526
7527 !! end
7528
7529 !! test
7530 Bug 3244: HTML attribute safety (extension; safe)
7531 !! input
7532 <div style="<nowiki>background:blue</nowiki>"></div>
7533 !! result
7534 <div style="background:blue"></div>
7535
7536 !! end
7537
7538 !! test
7539 Bug 3244: HTML attribute safety (extension; unsafe)
7540 !! input
7541 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
7542 !! result
7543 <div style="/* insecure input */"></div>
7544
7545 !! end
7546
7547 # More MSIE fun discovered by Tom Gilder
7548
7549 !! test
7550 MSIE CSS safety test: spurious slash
7551 !! input
7552 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
7553 !! result
7554 <div style="/* insecure input */">evil</div>
7555
7556 !! end
7557
7558 !! test
7559 MSIE CSS safety test: hex code
7560 !! input
7561 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
7562 !! result
7563 <div style="/* insecure input */">evil</div>
7564
7565 !! end
7566
7567 !! test
7568 MSIE CSS safety test: comment in url
7569 !! input
7570 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
7571 !! result
7572 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
7573
7574 !! end
7575
7576 !! test
7577 MSIE CSS safety test: comment in expression
7578 !! input
7579 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
7580 !! result
7581 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
7582
7583 !! end
7584
7585
7586 !! test
7587 Table attribute legitimate extension
7588 !! input
7589 {|
7590 !+ style="<nowiki>color:blue</nowiki>"| status
7591 |}
7592 !! result
7593 <table>
7594 <tr>
7595 <th style="color:blue"> status
7596 </th></tr></table>
7597
7598 !!end
7599
7600 !! test
7601 Table attribute safety
7602 !! input
7603 {|
7604 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
7605 |}
7606 !! result
7607 <table>
7608 <tr>
7609 <th style="/* insecure input */"> status
7610 </th></tr></table>
7611
7612 !! end
7613
7614 !! test
7615 CSS line continuation 1
7616 !! input
7617 <div style="background-image: u\&#10;rl(test.jpg);"></div>
7618 !! result
7619 <div style="/* insecure input */"></div>
7620
7621 !! end
7622
7623 !! test
7624 CSS line continuation 2
7625 !! input
7626 <div style="background-image: u\&#13;rl(test.jpg); "></div>
7627 !! result
7628 <div style="/* insecure input */"></div>
7629
7630 !! end
7631
7632 !! article
7633 Template:Identity
7634 !! text
7635 {{{1}}}
7636 !! endarticle
7637
7638 !! test
7639 Expansion of multi-line templates in attribute values (bug 6255)
7640 !! input
7641 <div style="background: {{identity|#00FF00}}">-</div>
7642 !! result
7643 <div style="background: #00FF00">-</div>
7644
7645 !! end
7646
7647
7648 !! test
7649 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
7650 !! input
7651 <div style="background:
7652 #00FF00">-</div>
7653 !! result
7654 <div style="background: #00FF00">-</div>
7655
7656 !! end
7657
7658 !! test
7659 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
7660 !! input
7661 <div style="background: &#10;#00FF00">-</div>
7662 !! result
7663 <div style="background: &#10;#00FF00">-</div>
7664
7665 !! end
7666
7667 ###
7668 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
7669 ###
7670 !! test
7671 Parser hook: empty input
7672 !! input
7673 <tag></tag>
7674 !! result
7675 <pre>
7676 ''
7677 array (
7678 )
7679 </pre>
7680
7681 !! end
7682
7683 !! test
7684 Parser hook: empty input using terminated empty elements
7685 !! input
7686 <tag/>
7687 !! result
7688 <pre>
7689 NULL
7690 array (
7691 )
7692 </pre>
7693
7694 !! end
7695
7696 !! test
7697 Parser hook: empty input using terminated empty elements (space before)
7698 !! input
7699 <tag />
7700 !! result
7701 <pre>
7702 NULL
7703 array (
7704 )
7705 </pre>
7706
7707 !! end
7708
7709 !! test
7710 Parser hook: basic input
7711 !! input
7712 <tag>input</tag>
7713 !! result
7714 <pre>
7715 'input'
7716 array (
7717 )
7718 </pre>
7719
7720 !! end
7721
7722
7723 !! test
7724 Parser hook: case insensitive
7725 !! input
7726 <TAG>input</TAG>
7727 !! result
7728 <pre>
7729 'input'
7730 array (
7731 )
7732 </pre>
7733
7734 !! end
7735
7736
7737 !! test
7738 Parser hook: case insensitive, redux
7739 !! input
7740 <TaG>input</TAg>
7741 !! result
7742 <pre>
7743 'input'
7744 array (
7745 )
7746 </pre>
7747
7748 !! end
7749
7750 !! test
7751 Parser hook: nested tags
7752 !! options
7753 noxml
7754 !! input
7755 <tag><tag></tag></tag>
7756 !! result
7757 <pre>
7758 '<tag>'
7759 array (
7760 )
7761 </pre>&lt;/tag&gt;
7762
7763 !! end
7764
7765 !! test
7766 Parser hook: basic arguments
7767 !! input
7768 <tag width=200 height = "100" depth = '50' square></tag>
7769 !! result
7770 <pre>
7771 ''
7772 array (
7773 'width' => '200',
7774 'height' => '100',
7775 'depth' => '50',
7776 'square' => 'square',
7777 )
7778 </pre>
7779
7780 !! end
7781
7782 !! test
7783 Parser hook: argument containing a forward slash (bug 5344)
7784 !! input
7785 <tag filename='/tmp/bla'></tag>
7786 !! result
7787 <pre>
7788 ''
7789 array (
7790 'filename' => '/tmp/bla',
7791 )
7792 </pre>
7793
7794 !! end
7795
7796 !! test
7797 Parser hook: empty input using terminated empty elements (bug 2374)
7798 !! input
7799 <tag foo=bar/>text
7800 !! result
7801 <pre>
7802 NULL
7803 array (
7804 'foo' => 'bar',
7805 )
7806 </pre>text
7807
7808 !! end
7809
7810 # </tag> should be output literally since there is no matching tag that begins it
7811 !! test
7812 Parser hook: basic arguments using terminated empty elements (bug 2374)
7813 !! input
7814 <tag width=200 height = "100" depth = '50' square/>
7815 other stuff
7816 </tag>
7817 !! result
7818 <pre>
7819 NULL
7820 array (
7821 'width' => '200',
7822 'height' => '100',
7823 'depth' => '50',
7824 'square' => 'square',
7825 )
7826 </pre>
7827 <p>other stuff
7828 &lt;/tag&gt;
7829 </p>
7830 !! end
7831
7832 ###
7833 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
7834 ###
7835
7836 !! test
7837 Parser hook: static parser hook not inside a comment
7838 !! input
7839 <statictag>hello, world</statictag>
7840 <statictag action=flush/>
7841 !! result
7842 <p>hello, world
7843 </p>
7844 !! end
7845
7846
7847 !! test
7848 Parser hook: static parser hook inside a comment
7849 !! input
7850 <!-- <statictag>hello, world</statictag> -->
7851 <statictag action=flush/>
7852 !! result
7853 <p><br />
7854 </p>
7855 !! end
7856
7857 # Nested template calls; this case was broken by Parser.php rev 1.506,
7858 # since reverted.
7859
7860 !! article
7861 Template:One-parameter
7862 !! text
7863 (My parameter is: {{{1}}})
7864 !! endarticle
7865
7866 !! article
7867 Template:Map-one-parameter
7868 !! text
7869 {{{{{1}}}|{{{2}}}}}
7870 !! endarticle
7871
7872 !! test
7873 Nested template calls
7874 !! input
7875 {{Map-one-parameter|One-parameter|param}}
7876 !! result
7877 <p>(My parameter is: param)
7878 </p>
7879 !! end
7880
7881
7882 ###
7883 ### Sanitizer
7884 ###
7885 !! test
7886 Sanitizer: Closing of open tags
7887 !! input
7888 <s></s><table></table>
7889 !! result
7890 <s></s><table></table>
7891
7892 !! end
7893
7894 !! test
7895 Sanitizer: Closing of open but not closed tags
7896 !! input
7897 <s>foo
7898 !! result
7899 <p><s>foo</s>
7900 </p>
7901 !! end
7902
7903 !! test
7904 Sanitizer: Closing of closed but not open tags
7905 !! input
7906 </s>
7907 !! result
7908 <p>&lt;/s&gt;
7909 </p>
7910 !! end
7911
7912 !! test
7913 Sanitizer: Closing of closed but not open table tags
7914 !! input
7915 Table not started</td></tr></table>
7916 !! result
7917 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
7918 </p>
7919 !! end
7920
7921 !! test
7922 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
7923 !! input
7924 <span id="æ: v">byte</span>[[#æ: v|backlink]]
7925 !! result
7926 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
7927 </p>
7928 !! end
7929
7930 !! test
7931 Sanitizer: Validating the contents of the id attribute (bug 4515)
7932 !! options
7933 disabled
7934 !! input
7935 <br id=9 />
7936 !! result
7937 Something, but definitely not <br id="9" />...
7938 !! end
7939
7940 !! test
7941 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
7942 !! options
7943 disabled
7944 !! input
7945 <br id="foo" /><br id="foo" />
7946 !! result
7947 Something need to be done. foo-2 ?
7948 !! end
7949
7950 !! test
7951 Language converter: output gets cut off unexpectedly (bug 5757)
7952 !! options
7953 language=zh
7954 !! input
7955 this bit is safe: }-
7956
7957 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
7958
7959 then we get cut off here: }-
7960
7961 all additional text is vanished
7962 !! result
7963 <p>this bit is safe: }-
7964 </p><p>but if we add a conversion instance: xxx
7965 </p><p>then we get cut off here: }-
7966 </p><p>all additional text is vanished
7967 </p>
7968 !! end
7969
7970 !! test
7971 Self closed html pairs (bug 5487)
7972 !! options
7973 !! input
7974 <center><font id="bug" />Centered text</center>
7975 <div><font id="bug2" />In div text</div>
7976 !! result
7977 <center>&lt;font id="bug" /&gt;Centered text</center>
7978 <div>&lt;font id="bug2" /&gt;In div text</div>
7979
7980 !! end
7981
7982 #
7983 #
7984 #
7985
7986 !! test
7987 Punctuation: nbsp before exclamation
7988 !! input
7989 C'est grave !
7990 !! result
7991 <p>C'est grave&#160;!
7992 </p>
7993 !! end
7994
7995 !! test
7996 Punctuation: CSS !important (bug 11874)
7997 !! input
7998 <div style="width:50% !important">important</div>
7999 !! result
8000 <div style="width:50% !important">important</div>
8001
8002 !!end
8003
8004 !! test
8005 Punctuation: CSS ! important (bug 11874; with space after)
8006 !! input
8007 <div style="width:50% ! important">important</div>
8008 !! result
8009 <div style="width:50% ! important">important</div>
8010
8011 !!end
8012
8013
8014 !! test
8015 HTML bullet list, closed tags (bug 5497)
8016 !! input
8017 <ul>
8018 <li>One</li>
8019 <li>Two</li>
8020 </ul>
8021 !! result
8022 <ul>
8023 <li>One</li>
8024 <li>Two</li>
8025 </ul>
8026
8027 !! end
8028
8029 !! test
8030 HTML bullet list, unclosed tags (bug 5497)
8031 !! options
8032 disabled
8033 !! input
8034 <ul>
8035 <li>One
8036 <li>Two
8037 </ul>
8038 !! result
8039 <ul>
8040 <li>One
8041 </li><li>Two
8042 </li></ul>
8043
8044 !! end
8045
8046 !! test
8047 HTML ordered list, closed tags (bug 5497)
8048 !! input
8049 <ol>
8050 <li>One</li>
8051 <li>Two</li>
8052 </ol>
8053 !! result
8054 <ol>
8055 <li>One</li>
8056 <li>Two</li>
8057 </ol>
8058
8059 !! end
8060
8061 !! test
8062 HTML ordered list, unclosed tags (bug 5497)
8063 !! options
8064 disabled
8065 !! input
8066 <ol>
8067 <li>One
8068 <li>Two
8069 </ol>
8070 !! result
8071 <ol>
8072 <li>One
8073 </li><li>Two
8074 </li></ol>
8075
8076 !! end
8077
8078 !! test
8079 HTML nested bullet list, closed tags (bug 5497)
8080 !! input
8081 <ul>
8082 <li>One</li>
8083 <li>Two:
8084 <ul>
8085 <li>Sub-one</li>
8086 <li>Sub-two</li>
8087 </ul>
8088 </li>
8089 </ul>
8090 !! result
8091 <ul>
8092 <li>One</li>
8093 <li>Two:
8094 <ul>
8095 <li>Sub-one</li>
8096 <li>Sub-two</li>
8097 </ul>
8098 </li>
8099 </ul>
8100
8101 !! end
8102
8103 !! test
8104 HTML nested bullet list, open tags (bug 5497)
8105 !! options
8106 disabled
8107 !! input
8108 <ul>
8109 <li>One
8110 <li>Two:
8111 <ul>
8112 <li>Sub-one
8113 <li>Sub-two
8114 </ul>
8115 </ul>
8116 !! result
8117 <ul>
8118 <li>One
8119 </li><li>Two:
8120 <ul>
8121 <li>Sub-one
8122 </li><li>Sub-two
8123 </li></ul>
8124 </li></ul>
8125
8126 !! end
8127
8128 !! test
8129 HTML nested ordered list, closed tags (bug 5497)
8130 !! input
8131 <ol>
8132 <li>One</li>
8133 <li>Two:
8134 <ol>
8135 <li>Sub-one</li>
8136 <li>Sub-two</li>
8137 </ol>
8138 </li>
8139 </ol>
8140 !! result
8141 <ol>
8142 <li>One</li>
8143 <li>Two:
8144 <ol>
8145 <li>Sub-one</li>
8146 <li>Sub-two</li>
8147 </ol>
8148 </li>
8149 </ol>
8150
8151 !! end
8152
8153 !! test
8154 HTML nested ordered list, open tags (bug 5497)
8155 !! options
8156 disabled
8157 !! input
8158 <ol>
8159 <li>One
8160 <li>Two:
8161 <ol>
8162 <li>Sub-one
8163 <li>Sub-two
8164 </ol>
8165 </ol>
8166 !! result
8167 <ol>
8168 <li>One
8169 </li><li>Two:
8170 <ol>
8171 <li>Sub-one
8172 </li><li>Sub-two
8173 </li></ol>
8174 </li></ol>
8175
8176 !! end
8177
8178 !! test
8179 HTML ordered list item with parameters oddity
8180 !! input
8181 <ol><li id="fragment">One</li></ol>
8182 !! result
8183 <ol><li id="fragment">One</li></ol>
8184
8185 !! end
8186
8187 !!test
8188 bug 5918: autonumbering
8189 !! input
8190 [http://first/] [http://second] [ftp://ftp]
8191
8192 ftp://inlineftp
8193
8194 [mailto:enclosed@mail.tld With target]
8195
8196 [mailto:enclosed@mail.tld]
8197
8198 mailto:inline@mail.tld
8199 !! result
8200 <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>
8201 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
8202 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
8203 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
8204 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
8205 </p>
8206 !! end
8207
8208
8209 #
8210 # Security and HTML correctness
8211 # From Nick Jenkins' fuzz testing
8212 #
8213
8214 !! test
8215 Fuzz testing: Parser13
8216 !! input
8217 {|
8218 | http://a|
8219 !! result
8220 <table>
8221 <tr>
8222 <td>
8223 </td>
8224 </tr>
8225 </table>
8226
8227 !! end
8228
8229 !! test
8230 Fuzz testing: Parser14
8231 !! input
8232 == onmouseover= ==
8233 http://__TOC__
8234 !! result
8235 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a>]</span> <span class="mw-headline" id="onmouseover.3D"> onmouseover= </span></h2>
8236 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8237 <ul>
8238 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
8239 </ul>
8240 </td></tr></table>
8241
8242 !! end
8243
8244 !! test
8245 Fuzz testing: Parser14-table
8246 !! input
8247 ==a==
8248 {| STYLE=__TOC__
8249 !! result
8250 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a>]</span> <span class="mw-headline" id="a">a</span></h2>
8251 <table style="&#95;_TOC&#95;_">
8252 <tr><td></td></tr>
8253 </table>
8254
8255 !! end
8256
8257 # Known to produce bogus xml (extra </td>)
8258 !! test
8259 Fuzz testing: Parser16
8260 !! options
8261 noxml
8262 !! input
8263 {|
8264 !https://||||||
8265 !! result
8266 <table>
8267 <tr>
8268 <th>https://</th>
8269 <th></th>
8270 <th></th>
8271 <th>
8272 </td>
8273 </tr>
8274 </table>
8275
8276 !! end
8277
8278 !! test
8279 Fuzz testing: Parser21
8280 !! input
8281 {|
8282 ! irc://{{ftp://a" onmouseover="alert('hello world');"
8283 |
8284 !! result
8285 <table>
8286 <tr>
8287 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
8288 </th>
8289 <td>
8290 </td>
8291 </tr>
8292 </table>
8293
8294 !! end
8295
8296 !! test
8297 Fuzz testing: Parser22
8298 !! input
8299 http://===r:::https://b
8300
8301 {|
8302 !!result
8303 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
8304 </p>
8305 <table>
8306 <tr><td></td></tr>
8307 </table>
8308
8309 !! end
8310
8311 # Known to produce bad XML for now
8312 !! test
8313 Fuzz testing: Parser24
8314 !! options
8315 noxml
8316 !! input
8317 {|
8318 {{{|
8319 <u CLASS=
8320 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
8321 <br style="onmouseover='alert(document.cookie);' " />
8322
8323 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
8324 |
8325 !! result
8326 <table>
8327 {{{|
8328 <u class="&#124;">}}}} &gt;
8329 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
8330
8331 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
8332 <tr>
8333 <td></u>
8334 </td>
8335 </tr>
8336 </table>
8337
8338 !! end
8339
8340 # Note: the current result listed for this is not what the original one was,
8341 # but the original bug was JavaScript injection, which is fixed in any case.
8342 # It's not clear that the original result listed was any more correct than the
8343 # current one. Original result:
8344 # <p>{{{|
8345 # </p>
8346 # <li class="&#124;&#124;">
8347 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
8348 !!test
8349 Fuzz testing: Parser25 (bug 6055)
8350 !! input
8351 {{{
8352 |
8353 <LI CLASS=||
8354 >
8355 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
8356 !! result
8357 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
8358 </p>
8359 !! end
8360
8361 !!test
8362 Fuzz testing: URL adjacent extension (with space, clean)
8363 !! options
8364 !! input
8365 http://example.com <nowiki>junk</nowiki>
8366 !! result
8367 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
8368 </p>
8369 !!end
8370
8371 !!test
8372 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
8373 !! options
8374 !! input
8375 http://example.com<nowiki>junk</nowiki>
8376 !! result
8377 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
8378 </p>
8379 !!end
8380
8381 !!test
8382 Fuzz testing: URL adjacent extension (no space, dirty; pre)
8383 !! options
8384 !! input
8385 http://example.com<pre>junk</pre>
8386 !! result
8387 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
8388
8389 !!end
8390
8391 !!test
8392 Fuzz testing: image with bogus manual thumbnail
8393 !!input
8394 [[Image:foobar.jpg|thumbnail= ]]
8395 !!result
8396 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
8397
8398 !!end
8399
8400 !! test
8401 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
8402 !! input
8403 <pre dir="&#10;"></pre>
8404 !! result
8405 <pre dir="&#10;"></pre>
8406
8407 !! end
8408
8409 !! test
8410 Parsing optional HTML elements (Bug 6171)
8411 !! options
8412 !! input
8413 <table>
8414 <tr>
8415 <td> Some tabular data</td>
8416 <td> More tabular data ...
8417 <td> And yet som tabular data</td>
8418 </tr>
8419 </table>
8420 !! result
8421 <table>
8422 <tr>
8423 <td> Some tabular data</td>
8424 <td> More tabular data ...
8425 </td><td> And yet som tabular data</td>
8426 </tr>
8427 </table>
8428
8429 !! end
8430
8431 !! test
8432 Correct handling of <td>, <tr> (Bug 6171)
8433 !! options
8434 !! input
8435 <table>
8436 <tr>
8437 <td> Some tabular data</td>
8438 <td> More tabular data ...</td>
8439 <td> And yet som tabular data</td>
8440 </tr>
8441 </table>
8442 !! result
8443 <table>
8444 <tr>
8445 <td> Some tabular data</td>
8446 <td> More tabular data ...</td>
8447 <td> And yet som tabular data</td>
8448 </tr>
8449 </table>
8450
8451 !! end
8452
8453
8454 !! test
8455 Parsing crashing regression (fr:JavaScript)
8456 !! input
8457 </body></x>
8458 !! result
8459 <p>&lt;/body&gt;&lt;/x&gt;
8460 </p>
8461 !! end
8462
8463 !! test
8464 Inline wiki vs wiki block nesting
8465 !! input
8466 '''Bold paragraph
8467
8468 New wiki paragraph
8469 !! result
8470 <p><b>Bold paragraph</b>
8471 </p><p>New wiki paragraph
8472 </p>
8473 !! end
8474
8475 !! test
8476 Inline HTML vs wiki block nesting
8477 !! options
8478 disabled
8479 !! input
8480 <b>Bold paragraph
8481
8482 New wiki paragraph
8483 !! result
8484 <p><b>Bold paragraph</b>
8485 </p><p>New wiki paragraph
8486 </p>
8487 !! end
8488
8489 # Original result was this:
8490 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
8491 # </p>
8492 # While that might be marginally more intuitive, maybe, the six-apostrophe
8493 # construct is clearly pathological and the result stated here (which is what
8494 # the parser actually does) is about as reasonable as anything.
8495 !!test
8496 Mixing markup for italics and bold
8497 !! options
8498 !! input
8499 '''bold''''''bold''bolditalics'''''
8500 !! result
8501 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
8502 </p>
8503 !! end
8504
8505
8506 !! article
8507 Xyzzyx
8508 !! text
8509 Article for special page transclusion test
8510 !! endarticle
8511
8512 !! test
8513 Special page transclusion
8514 !! options
8515 !! input
8516 {{Special:Prefixindex/Xyzzyx}}
8517 !! result
8518 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
8519
8520 !! end
8521
8522 !! test
8523 Special page transclusion twice (bug 5021)
8524 !! options
8525 !! input
8526 {{Special:Prefixindex/Xyzzyx}}
8527 {{Special:Prefixindex/Xyzzyx}}
8528 !! result
8529 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
8530 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
8531
8532 !! end
8533
8534 !! test
8535 Transclusion of default MediaWiki message
8536 !! input
8537 {{MediaWiki:Mainpage}}
8538 !!result
8539 <p>Main Page
8540 </p>
8541 !! end
8542
8543 !! test
8544 Transclusion of nonexistent MediaWiki message
8545 !! input
8546 {{MediaWiki:Mainpagexxx}}
8547 !!result
8548 <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>
8549 </p>
8550 !! end
8551
8552 !! test
8553 Transclusion of MediaWiki message with underscore
8554 !! input
8555 {{MediaWiki:history_short}}
8556 !! result
8557 <p>History
8558 </p>
8559 !! end
8560
8561 !! test
8562 Transclusion of MediaWiki message with space
8563 !! input
8564 {{MediaWiki:history short}}
8565 !! result
8566 <p>History
8567 </p>
8568 !! end
8569
8570 !! test
8571 Invalid header with following text
8572 !! input
8573 = x = y
8574 !! result
8575 <p>= x = y
8576 </p>
8577 !! end
8578
8579
8580 !! test
8581 Section extraction test (section 0)
8582 !! options
8583 section=0
8584 !! input
8585 start
8586 ==a==
8587 ===aa===
8588 ====aaa====
8589 ==b==
8590 ===ba===
8591 ===bb===
8592 ====bba====
8593 ===bc===
8594 ==c==
8595 ===ca===
8596 !! result
8597 start
8598 !! end
8599
8600 !! test
8601 Section extraction test (section 1)
8602 !! options
8603 section=1
8604 !! input
8605 start
8606 ==a==
8607 ===aa===
8608 ====aaa====
8609 ==b==
8610 ===ba===
8611 ===bb===
8612 ====bba====
8613 ===bc===
8614 ==c==
8615 ===ca===
8616 !! result
8617 ==a==
8618 ===aa===
8619 ====aaa====
8620 !! end
8621
8622 !! test
8623 Section extraction test (section 2)
8624 !! options
8625 section=2
8626 !! input
8627 start
8628 ==a==
8629 ===aa===
8630 ====aaa====
8631 ==b==
8632 ===ba===
8633 ===bb===
8634 ====bba====
8635 ===bc===
8636 ==c==
8637 ===ca===
8638 !! result
8639 ===aa===
8640 ====aaa====
8641 !! end
8642
8643 !! test
8644 Section extraction test (section 3)
8645 !! options
8646 section=3
8647 !! input
8648 start
8649 ==a==
8650 ===aa===
8651 ====aaa====
8652 ==b==
8653 ===ba===
8654 ===bb===
8655 ====bba====
8656 ===bc===
8657 ==c==
8658 ===ca===
8659 !! result
8660 ====aaa====
8661 !! end
8662
8663 !! test
8664 Section extraction test (section 4)
8665 !! options
8666 section=4
8667 !! input
8668 start
8669 ==a==
8670 ===aa===
8671 ====aaa====
8672 ==b==
8673 ===ba===
8674 ===bb===
8675 ====bba====
8676 ===bc===
8677 ==c==
8678 ===ca===
8679 !! result
8680 ==b==
8681 ===ba===
8682 ===bb===
8683 ====bba====
8684 ===bc===
8685 !! end
8686
8687 !! test
8688 Section extraction test (section 5)
8689 !! options
8690 section=5
8691 !! input
8692 start
8693 ==a==
8694 ===aa===
8695 ====aaa====
8696 ==b==
8697 ===ba===
8698 ===bb===
8699 ====bba====
8700 ===bc===
8701 ==c==
8702 ===ca===
8703 !! result
8704 ===ba===
8705 !! end
8706
8707 !! test
8708 Section extraction test (section 6)
8709 !! options
8710 section=6
8711 !! input
8712 start
8713 ==a==
8714 ===aa===
8715 ====aaa====
8716 ==b==
8717 ===ba===
8718 ===bb===
8719 ====bba====
8720 ===bc===
8721 ==c==
8722 ===ca===
8723 !! result
8724 ===bb===
8725 ====bba====
8726 !! end
8727
8728 !! test
8729 Section extraction test (section 7)
8730 !! options
8731 section=7
8732 !! input
8733 start
8734 ==a==
8735 ===aa===
8736 ====aaa====
8737 ==b==
8738 ===ba===
8739 ===bb===
8740 ====bba====
8741 ===bc===
8742 ==c==
8743 ===ca===
8744 !! result
8745 ====bba====
8746 !! end
8747
8748 !! test
8749 Section extraction test (section 8)
8750 !! options
8751 section=8
8752 !! input
8753 start
8754 ==a==
8755 ===aa===
8756 ====aaa====
8757 ==b==
8758 ===ba===
8759 ===bb===
8760 ====bba====
8761 ===bc===
8762 ==c==
8763 ===ca===
8764 !! result
8765 ===bc===
8766 !! end
8767
8768 !! test
8769 Section extraction test (section 9)
8770 !! options
8771 section=9
8772 !! input
8773 start
8774 ==a==
8775 ===aa===
8776 ====aaa====
8777 ==b==
8778 ===ba===
8779 ===bb===
8780 ====bba====
8781 ===bc===
8782 ==c==
8783 ===ca===
8784 !! result
8785 ==c==
8786 ===ca===
8787 !! end
8788
8789 !! test
8790 Section extraction test (section 10)
8791 !! options
8792 section=10
8793 !! input
8794 start
8795 ==a==
8796 ===aa===
8797 ====aaa====
8798 ==b==
8799 ===ba===
8800 ===bb===
8801 ====bba====
8802 ===bc===
8803 ==c==
8804 ===ca===
8805 !! result
8806 ===ca===
8807 !! end
8808
8809 !! test
8810 Section extraction test (nonexistent section 11)
8811 !! options
8812 section=11
8813 !! input
8814 start
8815 ==a==
8816 ===aa===
8817 ====aaa====
8818 ==b==
8819 ===ba===
8820 ===bb===
8821 ====bba====
8822 ===bc===
8823 ==c==
8824 ===ca===
8825 !! result
8826 !! end
8827
8828 !! test
8829 Section extraction test with bogus heading (section 1)
8830 !! options
8831 section=1
8832 !! input
8833 ==a==
8834 ==bogus== not a legal section
8835 ==b==
8836 !! result
8837 ==a==
8838 ==bogus== not a legal section
8839 !! end
8840
8841 !! test
8842 Section extraction test with bogus heading (section 2)
8843 !! options
8844 section=2
8845 !! input
8846 ==a==
8847 ==bogus== not a legal section
8848 ==b==
8849 !! result
8850 ==b==
8851 !! end
8852
8853 !! test
8854 Section extraction test with comment after heading (section 1)
8855 !! options
8856 section=1
8857 !! input
8858 ==a==
8859 ==b== <!-- -->
8860 ==c==
8861 !! result
8862 ==a==
8863 !! end
8864
8865 !! test
8866 Section extraction test with comment after heading (section 2)
8867 !! options
8868 section=2
8869 !! input
8870 ==a==
8871 ==b== <!-- -->
8872 ==c==
8873 !! result
8874 ==b== <!-- -->
8875 !! end
8876
8877 !! test
8878 Section extraction test with bogus <nowiki> heading (section 1)
8879 !! options
8880 section=1
8881 !! input
8882 ==a==
8883 ==bogus== <nowiki>not a legal section</nowiki>
8884 ==b==
8885 !! result
8886 ==a==
8887 ==bogus== <nowiki>not a legal section</nowiki>
8888 !! end
8889
8890 !! test
8891 Section extraction test with bogus <nowiki> heading (section 2)
8892 !! options
8893 section=2
8894 !! input
8895 ==a==
8896 ==bogus== <nowiki>not a legal section</nowiki>
8897 ==b==
8898 !! result
8899 ==b==
8900 !! end
8901
8902
8903 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
8904 # instead of respecting commented sections
8905 !! test
8906 Section extraction prefixed by comment (section 1)
8907 !! options
8908 section=1
8909 !! input
8910 <!-- -->==sec1==
8911 ==sec2==
8912 !!result
8913 ==sec2==
8914 !!end
8915
8916 !! test
8917 Section extraction prefixed by comment (section 2)
8918 !! options
8919 section=2
8920 !! input
8921 <!-- -->==sec1==
8922 ==sec2==
8923 !!result
8924
8925 !!end
8926
8927
8928 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
8929 # instead of respecting HTML-style headings
8930 !! test
8931 Section extraction, mixed wiki and html (section 1)
8932 !! options
8933 section=1
8934 !! input
8935 <h2>unmarked</h2>
8936 unmarked
8937 ==1==
8938 one
8939 ==2==
8940 two
8941 !! result
8942 ==1==
8943 one
8944 !! end
8945
8946 !! test
8947 Section extraction, mixed wiki and html (section 2)
8948 !! options
8949 section=2
8950 !! input
8951 <h2>unmarked</h2>
8952 unmarked
8953 ==1==
8954 one
8955 ==2==
8956 two
8957 !! result
8958 ==2==
8959 two
8960 !! end
8961
8962
8963 # Formerly testing for bug 3342
8964 !! test
8965 Section extraction, heading surrounded by <noinclude>
8966 !! options
8967 section=1
8968 !! input
8969 <noinclude>==unmarked==</noinclude>
8970 ==marked==
8971 !! result
8972 ==marked==
8973 !!end
8974
8975 # Test behaviour of bug 19910
8976 !! test
8977 Sectiion with all-equals
8978 !! options
8979 section=2
8980 !! input
8981 ===
8982 The line above must have a trailing space
8983 === <!--
8984 --> <!-- -->
8985 But just in case it doesn't...
8986 !! result
8987 === <!--
8988 --> <!-- -->
8989 But just in case it doesn't...
8990 !! end
8991
8992 !! test
8993 Section replacement test (section 0)
8994 !! options
8995 replace=0,"xxx"
8996 !! input
8997 start
8998 ==a==
8999 ===aa===
9000 ====aaa====
9001 ==b==
9002 ===ba===
9003 ===bb===
9004 ====bba====
9005 ===bc===
9006 ==c==
9007 ===ca===
9008 !! result
9009 xxx
9010
9011 ==a==
9012 ===aa===
9013 ====aaa====
9014 ==b==
9015 ===ba===
9016 ===bb===
9017 ====bba====
9018 ===bc===
9019 ==c==
9020 ===ca===
9021 !! end
9022
9023 !! test
9024 Section replacement test (section 1)
9025 !! options
9026 replace=1,"xxx"
9027 !! input
9028 start
9029 ==a==
9030 ===aa===
9031 ====aaa====
9032 ==b==
9033 ===ba===
9034 ===bb===
9035 ====bba====
9036 ===bc===
9037 ==c==
9038 ===ca===
9039 !! result
9040 start
9041 xxx
9042
9043 ==b==
9044 ===ba===
9045 ===bb===
9046 ====bba====
9047 ===bc===
9048 ==c==
9049 ===ca===
9050 !! end
9051
9052 !! test
9053 Section replacement test (section 2)
9054 !! options
9055 replace=2,"xxx"
9056 !! input
9057 start
9058 ==a==
9059 ===aa===
9060 ====aaa====
9061 ==b==
9062 ===ba===
9063 ===bb===
9064 ====bba====
9065 ===bc===
9066 ==c==
9067 ===ca===
9068 !! result
9069 start
9070 ==a==
9071 xxx
9072
9073 ==b==
9074 ===ba===
9075 ===bb===
9076 ====bba====
9077 ===bc===
9078 ==c==
9079 ===ca===
9080 !! end
9081
9082 !! test
9083 Section replacement test (section 3)
9084 !! options
9085 replace=3,"xxx"
9086 !! input
9087 start
9088 ==a==
9089 ===aa===
9090 ====aaa====
9091 ==b==
9092 ===ba===
9093 ===bb===
9094 ====bba====
9095 ===bc===
9096 ==c==
9097 ===ca===
9098 !! result
9099 start
9100 ==a==
9101 ===aa===
9102 xxx
9103
9104 ==b==
9105 ===ba===
9106 ===bb===
9107 ====bba====
9108 ===bc===
9109 ==c==
9110 ===ca===
9111 !! end
9112
9113 !! test
9114 Section replacement test (section 4)
9115 !! options
9116 replace=4,"xxx"
9117 !! input
9118 start
9119 ==a==
9120 ===aa===
9121 ====aaa====
9122 ==b==
9123 ===ba===
9124 ===bb===
9125 ====bba====
9126 ===bc===
9127 ==c==
9128 ===ca===
9129 !! result
9130 start
9131 ==a==
9132 ===aa===
9133 ====aaa====
9134 xxx
9135
9136 ==c==
9137 ===ca===
9138 !! end
9139
9140 !! test
9141 Section replacement test (section 5)
9142 !! options
9143 replace=5,"xxx"
9144 !! input
9145 start
9146 ==a==
9147 ===aa===
9148 ====aaa====
9149 ==b==
9150 ===ba===
9151 ===bb===
9152 ====bba====
9153 ===bc===
9154 ==c==
9155 ===ca===
9156 !! result
9157 start
9158 ==a==
9159 ===aa===
9160 ====aaa====
9161 ==b==
9162 xxx
9163
9164 ===bb===
9165 ====bba====
9166 ===bc===
9167 ==c==
9168 ===ca===
9169 !! end
9170
9171 !! test
9172 Section replacement test (section 6)
9173 !! options
9174 replace=6,"xxx"
9175 !! input
9176 start
9177 ==a==
9178 ===aa===
9179 ====aaa====
9180 ==b==
9181 ===ba===
9182 ===bb===
9183 ====bba====
9184 ===bc===
9185 ==c==
9186 ===ca===
9187 !! result
9188 start
9189 ==a==
9190 ===aa===
9191 ====aaa====
9192 ==b==
9193 ===ba===
9194 xxx
9195
9196 ===bc===
9197 ==c==
9198 ===ca===
9199 !! end
9200
9201 !! test
9202 Section replacement test (section 7)
9203 !! options
9204 replace=7,"xxx"
9205 !! input
9206 start
9207 ==a==
9208 ===aa===
9209 ====aaa====
9210 ==b==
9211 ===ba===
9212 ===bb===
9213 ====bba====
9214 ===bc===
9215 ==c==
9216 ===ca===
9217 !! result
9218 start
9219 ==a==
9220 ===aa===
9221 ====aaa====
9222 ==b==
9223 ===ba===
9224 ===bb===
9225 xxx
9226
9227 ===bc===
9228 ==c==
9229 ===ca===
9230 !! end
9231
9232 !! test
9233 Section replacement test (section 8)
9234 !! options
9235 replace=8,"xxx"
9236 !! input
9237 start
9238 ==a==
9239 ===aa===
9240 ====aaa====
9241 ==b==
9242 ===ba===
9243 ===bb===
9244 ====bba====
9245 ===bc===
9246 ==c==
9247 ===ca===
9248 !! result
9249 start
9250 ==a==
9251 ===aa===
9252 ====aaa====
9253 ==b==
9254 ===ba===
9255 ===bb===
9256 ====bba====
9257 xxx
9258
9259 ==c==
9260 ===ca===
9261 !!end
9262
9263 !! test
9264 Section replacement test (section 9)
9265 !! options
9266 replace=9,"xxx"
9267 !! input
9268 start
9269 ==a==
9270 ===aa===
9271 ====aaa====
9272 ==b==
9273 ===ba===
9274 ===bb===
9275 ====bba====
9276 ===bc===
9277 ==c==
9278 ===ca===
9279 !! result
9280 start
9281 ==a==
9282 ===aa===
9283 ====aaa====
9284 ==b==
9285 ===ba===
9286 ===bb===
9287 ====bba====
9288 ===bc===
9289 xxx
9290 !! end
9291
9292 !! test
9293 Section replacement test (section 10)
9294 !! options
9295 replace=10,"xxx"
9296 !! input
9297 start
9298 ==a==
9299 ===aa===
9300 ====aaa====
9301 ==b==
9302 ===ba===
9303 ===bb===
9304 ====bba====
9305 ===bc===
9306 ==c==
9307 ===ca===
9308 !! result
9309 start
9310 ==a==
9311 ===aa===
9312 ====aaa====
9313 ==b==
9314 ===ba===
9315 ===bb===
9316 ====bba====
9317 ===bc===
9318 ==c==
9319 xxx
9320 !! end
9321
9322 !! test
9323 Section replacement test with initial whitespace (bug 13728)
9324 !! options
9325 replace=2,"xxx"
9326 !! input
9327 Preformatted initial line
9328 ==a==
9329 ===a===
9330 !! result
9331 Preformatted initial line
9332 ==a==
9333 xxx
9334 !! end
9335
9336
9337 !! test
9338 Section extraction, heading followed by pre with 20 spaces (bug 6398)
9339 !! options
9340 section=1
9341 !! input
9342 ==a==
9343 a
9344 !! result
9345 ==a==
9346 a
9347 !! end
9348
9349 !! test
9350 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
9351 !! options
9352 section=1
9353 !! input
9354 ==a==
9355 a
9356 !! result
9357 ==a==
9358 a
9359 !! end
9360
9361
9362 !! test
9363 Section extraction, <pre> around bogus header (bug 10309)
9364 !! options
9365 noxml section=2
9366 !! input
9367 == Section One ==
9368 <pre>
9369 =======
9370 </pre>
9371
9372 == Section Two ==
9373 stuff
9374 !! result
9375 == Section Two ==
9376 stuff
9377 !! end
9378
9379 !! test
9380 Section replacement, <pre> around bogus header (bug 10309)
9381 !! options
9382 noxml replace=2,"xxx"
9383 !! input
9384 == Section One ==
9385 <pre>
9386 =======
9387 </pre>
9388
9389 == Section Two ==
9390 stuff
9391 !! result
9392 == Section One ==
9393 <pre>
9394 =======
9395 </pre>
9396
9397 xxx
9398 !! end
9399
9400
9401
9402 !! test
9403 Handling of &#x0A; in URLs
9404 !! input
9405 **irc://&#x0A;a
9406 !! result
9407 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
9408 </li></ul>
9409 </li></ul>
9410
9411 !!end
9412
9413 !! test
9414 5 quotes, code coverage +1 line
9415 !! input
9416 '''''
9417 !! result
9418 !! end
9419
9420 !! test
9421 Special:Search page linking.
9422 !! input
9423 {{Special:search}}
9424 !! result
9425 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
9426 </p>
9427 !! end
9428
9429 !! test
9430 Say the magic word
9431 !! input
9432 * {{PAGENAME}}
9433 * {{BASEPAGENAME}}
9434 * {{SUBPAGENAME}}
9435 * {{SUBPAGENAMEE}}
9436 * {{BASEPAGENAME}}
9437 * {{BASEPAGENAMEE}}
9438 * {{TALKPAGENAME}}
9439 * {{TALKPAGENAMEE}}
9440 * {{SUBJECTPAGENAME}}
9441 * {{SUBJECTPAGENAMEE}}
9442 * {{NAMESPACEE}}
9443 * {{NAMESPACE}}
9444 * {{TALKSPACE}}
9445 * {{TALKSPACEE}}
9446 * {{SUBJECTSPACE}}
9447 * {{SUBJECTSPACEE}}
9448 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
9449 !! result
9450 <ul><li> Parser test
9451 </li><li> Parser test
9452 </li><li> Parser test
9453 </li><li> Parser_test
9454 </li><li> Parser test
9455 </li><li> Parser_test
9456 </li><li> Talk:Parser test
9457 </li><li> Talk:Parser_test
9458 </li><li> Parser test
9459 </li><li> Parser_test
9460 </li><li>
9461 </li><li>
9462 </li><li> Talk
9463 </li><li> Talk
9464 </li><li>
9465 </li><li>
9466 </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>
9467 </li></ul>
9468
9469 !! end
9470 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
9471
9472 !! test
9473 Gallery
9474 !! input
9475 <gallery>
9476 image1.png |
9477 image2.gif|||||
9478
9479 image3|
9480 image4 |300px| centre
9481 image5.svg| http://///////
9482 [[x|xx]]]]
9483 * image6
9484 </gallery>
9485 !! result
9486 <ul class="gallery">
9487 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9488 <div style="height: 150px;">Image1.png</div>
9489 <div class="gallerytext">
9490 </div>
9491 </div></li>
9492 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9493 <div style="height: 150px;">Image2.gif</div>
9494 <div class="gallerytext">
9495 <p>||||
9496 </p>
9497 </div>
9498 </div></li>
9499 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9500 <div style="height: 150px;">Image3</div>
9501 <div class="gallerytext">
9502 </div>
9503 </div></li>
9504 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9505 <div style="height: 150px;">Image4</div>
9506 <div class="gallerytext">
9507 <p>300px| centre
9508 </p>
9509 </div>
9510 </div></li>
9511 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9512 <div style="height: 150px;">Image5.svg</div>
9513 <div class="gallerytext">
9514 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
9515 </p>
9516 </div>
9517 </div></li>
9518 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9519 <div style="height: 150px;">* image6</div>
9520 <div class="gallerytext">
9521 </div>
9522 </div></li>
9523 </ul>
9524
9525 !! end
9526
9527 !! test
9528 Gallery (with options)
9529 !! input
9530 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
9531 File:Nonexistant.jpg|caption
9532 File:Nonexistant.jpg
9533 image:foobar.jpg|some '''caption''' [[Main Page]]
9534 image:foobar.jpg
9535 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
9536 </gallery>
9537 !! result
9538 <ul class="gallery" style="max-width: 226px;_width: 226px;">
9539 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
9540 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9541 <div style="height: 70px;">Nonexistant.jpg</div>
9542 <div class="gallerytext">
9543 <p>caption
9544 </p>
9545 </div>
9546 </div></li>
9547 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9548 <div style="height: 70px;">Nonexistant.jpg</div>
9549 <div class="gallerytext">
9550 </div>
9551 </div></li>
9552 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9553 <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>
9554 <div class="gallerytext">
9555 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9556 </p>
9557 </div>
9558 </div></li>
9559 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9560 <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>
9561 <div class="gallerytext">
9562 </div>
9563 </div></li>
9564 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9565 <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>
9566 <div class="gallerytext">
9567 <p>Blabla|blabla.
9568 </p>
9569 </div>
9570 </div></li>
9571 </ul>
9572
9573 !! end
9574
9575 !! test
9576 Gallery with wikitext inside caption
9577 !! input
9578 <gallery>
9579 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
9580 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
9581 </gallery>
9582 !! result
9583 <ul class="gallery">
9584 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9585 <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>
9586 <div class="gallerytext">
9587 <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>
9588 </p>
9589 </div>
9590 </div></li>
9591 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9592 <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>
9593 <div class="gallerytext">
9594 <p>This is a test template
9595 </p>
9596 </div>
9597 </div></li>
9598 </ul>
9599
9600 !! end
9601
9602 !! test
9603 gallery (with showfilename option)
9604 !! input
9605 <gallery showfilename>
9606 File:Nonexistant.jpg|caption
9607 File:Nonexistant.jpg
9608 image:foobar.jpg|some '''caption''' [[Main Page]]
9609 File:Foobar.jpg
9610 </gallery>
9611 !! result
9612 <ul class="gallery">
9613 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9614 <div style="height: 150px;">Nonexistant.jpg</div>
9615 <div class="gallerytext">
9616 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
9617 caption
9618 </p>
9619 </div>
9620 </div></li>
9621 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9622 <div style="height: 150px;">Nonexistant.jpg</div>
9623 <div class="gallerytext">
9624 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
9625 </p>
9626 </div>
9627 </div></li>
9628 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9629 <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>
9630 <div class="gallerytext">
9631 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
9632 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9633 </p>
9634 </div>
9635 </div></li>
9636 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9637 <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>
9638 <div class="gallerytext">
9639 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
9640 </p>
9641 </div>
9642 </div></li>
9643 </ul>
9644
9645 !! end
9646
9647 !! test
9648 Gallery (with namespace-less filenames)
9649 !! input
9650 <gallery>
9651 File:Nonexistant.jpg
9652 Nonexistant.jpg
9653 image:foobar.jpg
9654 foobar.jpg
9655 </gallery>
9656 !! result
9657 <ul class="gallery">
9658 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9659 <div style="height: 150px;">Nonexistant.jpg</div>
9660 <div class="gallerytext">
9661 </div>
9662 </div></li>
9663 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9664 <div style="height: 150px;">Nonexistant.jpg</div>
9665 <div class="gallerytext">
9666 </div>
9667 </div></li>
9668 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9669 <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>
9670 <div class="gallerytext">
9671 </div>
9672 </div></li>
9673 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9674 <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>
9675 <div class="gallerytext">
9676 </div>
9677 </div></li>
9678 </ul>
9679
9680 !! end
9681
9682 !! test
9683 HTML Hex character encoding (spells the word "JavaScript")
9684 !! input
9685 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
9686 !! result
9687 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
9688 </p>
9689 !! end
9690
9691 !! test
9692 HTML Hex character encoding bogus encoding (bug 26437 regression check)
9693 !! input
9694 &#xsee;&#XSEE;
9695 !! result
9696 <p>&amp;#xsee;&amp;#XSEE;
9697 </p>
9698 !! end
9699
9700 !! test
9701 HTML Hex character encoding mixed case
9702 !! input
9703 &#xEE;&#Xee;
9704 !! result
9705 <p>&#xee;&#xee;
9706 </p>
9707 !! end
9708
9709 !! test
9710 __FORCETOC__ override
9711 !! input
9712 __NEWSECTIONLINK__
9713 __FORCETOC__
9714 !! result
9715 <p><br />
9716 </p>
9717 !! end
9718
9719 !! test
9720 ISBN code coverage
9721 !! input
9722 ISBN 978-0-1234-56&#x20;789
9723 !! result
9724 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
9725 </p>
9726 !! end
9727
9728 !! test
9729 ISBN followed by 5 spaces
9730 !! input
9731 ISBN
9732 !! result
9733 <p>ISBN
9734 </p>
9735 !! end
9736
9737 !! test
9738 Double ISBN
9739 !! input
9740 ISBN ISBN 1234567890
9741 !! result
9742 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
9743 </p>
9744 !! end
9745
9746 !! test
9747 Bug 22905: <abbr> followed by ISBN followed by </a>
9748 !! input
9749 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
9750 !! result
9751 <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>
9752 </p>
9753 !! end
9754
9755 !! test
9756 Double RFC
9757 !! input
9758 RFC RFC 1234
9759 !! result
9760 <p>RFC <a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
9761 </p>
9762 !! end
9763
9764 !! test
9765 Double RFC with a wiki link
9766 !! input
9767 RFC [[RFC 1234]]
9768 !! result
9769 <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>
9770 </p>
9771 !! end
9772
9773 !! test
9774 RFC code coverage
9775 !! input
9776 RFC 983&#x20;987
9777 !! result
9778 <p><a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
9779 </p>
9780 !! end
9781
9782 !! test
9783 Centre-aligned image
9784 !! input
9785 [[Image:foobar.jpg|centre]]
9786 !! result
9787 <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>
9788
9789 !!end
9790
9791 !! test
9792 None-aligned image
9793 !! input
9794 [[Image:foobar.jpg|none]]
9795 !! result
9796 <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>
9797
9798 !!end
9799
9800 !! test
9801 Width + Height sized image (using px) (height is ignored)
9802 !! input
9803 [[Image:foobar.jpg|640x480px]]
9804 !! result
9805 <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>
9806 </p>
9807 !!end
9808
9809 !! test
9810 Width-sized image (using px, no following whitespace)
9811 !! input
9812 [[Image:foobar.jpg|640px]]
9813 !! result
9814 <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>
9815 </p>
9816 !!end
9817
9818 !! test
9819 Width-sized image (using px, with following whitespace - test regression from r39467)
9820 !! input
9821 [[Image:foobar.jpg|640px ]]
9822 !! result
9823 <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>
9824 </p>
9825 !!end
9826
9827 !! test
9828 Width-sized image (using px, with preceding whitespace - test regression from r39467)
9829 !! input
9830 [[Image:foobar.jpg| 640px]]
9831 !! result
9832 <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>
9833 </p>
9834 !!end
9835
9836 !! test
9837 Another italics / bold test
9838 !! input
9839 ''' ''x'
9840 !! result
9841 <pre>'<i> </i>x'
9842 </pre>
9843 !!end
9844
9845 # Note the results may be incorrect, as parserTest output included this:
9846 # XML error: Mismatched tag at byte 6120:
9847 # ...<dd> </dt></dl> </dd...
9848 !! test
9849 dt/dd/dl test
9850 !! options
9851 disabled
9852 !! input
9853 :;;;::
9854 !! result
9855 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
9856 </dd></dl>
9857 </dd></dl>
9858 </dt></dl>
9859 </dt></dl>
9860 </dt></dl>
9861 </dd></dl>
9862
9863 !!end
9864
9865
9866 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
9867 !! test
9868 Images with the "|" character in the comment
9869 !! input
9870 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
9871 !! result
9872 <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>
9873
9874 !!end
9875
9876 !! test
9877 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
9878 !! input
9879 <html><script>alert(1);</script></html>
9880 !! result
9881 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
9882 </p>
9883 !! end
9884
9885 !! test
9886 HTML with raw HTML ($wgRawHtml==true)
9887 !! options
9888 rawhtml
9889 !! input
9890 <html><script>alert(1);</script></html>
9891 !! result
9892 <p><script>alert(1);</script>
9893 </p>
9894 !! end
9895
9896 !! test
9897 Parents of subpages, one level up
9898 !! options
9899 subpage title=[[Subpage test/L1/L2/L3]]
9900 !! input
9901 [[../|L2]]
9902 !! result
9903 <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>
9904 </p>
9905 !! end
9906
9907
9908 !! test
9909 Parents of subpages, one level up, not named
9910 !! options
9911 subpage title=[[Subpage test/L1/L2/L3]]
9912 !! input
9913 [[../]]
9914 !! result
9915 <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>
9916 </p>
9917 !! end
9918
9919
9920
9921 !! test
9922 Parents of subpages, two levels up
9923 !! options
9924 subpage title=[[Subpage test/L1/L2/L3]]
9925 !! input
9926 [[../../|L1]]2
9927
9928 [[../../|L1]]l
9929 !! result
9930 <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
9931 </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>
9932 </p>
9933 !! end
9934
9935 !! test
9936 Parents of subpages, two levels up, without trailing slash or name.
9937 !! options
9938 subpage title=[[Subpage test/L1/L2/L3]]
9939 !! input
9940 [[../..]]
9941 !! result
9942 <p>[[../..]]
9943 </p>
9944 !! end
9945
9946 !! test
9947 Parents of subpages, two levels up, with lots of extra trailing slashes.
9948 !! options
9949 subpage title=[[Subpage test/L1/L2/L3]]
9950 !! input
9951 [[../../////]]
9952 !! result
9953 <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>
9954 </p>
9955 !! end
9956
9957 !! test
9958 Definition list code coverage
9959 !! input
9960 ; title : def
9961 ; title : def
9962 ;title: def
9963 !! result
9964 <dl><dt> title &#160;</dt><dd> def
9965 </dd><dt> title&#160;</dt><dd> def
9966 </dd><dt>title</dt><dd> def
9967 </dd></dl>
9968
9969 !! end
9970
9971 !! test
9972 Don't fall for the self-closing div
9973 !! input
9974 <div>hello world</div/>
9975 !! result
9976 <div>hello world</div>
9977
9978 !! end
9979
9980 !! test
9981 MSGNW magic word
9982 !! input
9983 {{MSGNW:msg}}
9984 !! result
9985 <p>&#91;&#91;:Template:Msg&#93;&#93;
9986 </p>
9987 !! end
9988
9989 !! test
9990 RAW magic word
9991 !! input
9992 {{RAW:QUERTY}}
9993 !! result
9994 <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>
9995 </p>
9996 !! end
9997
9998 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
9999 !! test
10000 Always escape literal '>' in output, not just after '<'
10001 !! input
10002 ><>
10003 !! result
10004 <p>&gt;&lt;&gt;
10005 </p>
10006 !! end
10007
10008 !! test
10009 Template caching
10010 !! input
10011 {{Test}}
10012 {{Test}}
10013 !! result
10014 <p>This is a test template
10015 This is a test template
10016 </p>
10017 !! end
10018
10019
10020 !! article
10021 MediaWiki:Fake
10022 !! text
10023 ==header==
10024 !! endarticle
10025
10026 !! test
10027 Inclusion of !userCanEdit() content
10028 !! input
10029 {{MediaWiki:Fake}}
10030 !! result
10031 <h2><span class="editsection">[<a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a>]</span> <span class="mw-headline" id="header">header</span></h2>
10032
10033 !! end
10034
10035
10036 !! test
10037 Out-of-order TOC heading levels
10038 !! input
10039 ==2==
10040 ======6======
10041 ===3===
10042 =1=
10043 =====5=====
10044 ==2==
10045 !! result
10046 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10047 <ul>
10048 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
10049 <ul>
10050 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
10051 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
10052 </ul>
10053 </li>
10054 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
10055 <ul>
10056 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
10057 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
10058 </ul>
10059 </li>
10060 </ul>
10061 </td></tr></table>
10062 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a>]</span> <span class="mw-headline" id="2">2</span></h2>
10063 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a>]</span> <span class="mw-headline" id="6">6</span></h6>
10064 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a>]</span> <span class="mw-headline" id="3">3</span></h3>
10065 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a>]</span> <span class="mw-headline" id="1">1</span></h1>
10066 <h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a>]</span> <span class="mw-headline" id="5">5</span></h5>
10067 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a>]</span> <span class="mw-headline" id="2_2">2</span></h2>
10068
10069 !! end
10070
10071
10072 !! test
10073 ISBN with a dummy number
10074 !! input
10075 ISBN ---
10076 !! result
10077 <p>ISBN ---
10078 </p>
10079 !! end
10080
10081
10082 !! test
10083 ISBN with space-delimited number
10084 !! input
10085 ISBN 92 9017 032 8
10086 !! result
10087 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
10088 </p>
10089 !! end
10090
10091
10092 !! test
10093 ISBN with multiple spaces, no number
10094 !! input
10095 ISBN foo
10096 !! result
10097 <p>ISBN foo
10098 </p>
10099 !! end
10100
10101
10102 !! test
10103 ISBN length
10104 !! input
10105 ISBN 123456789
10106
10107 ISBN 1234567890
10108
10109 ISBN 12345678901
10110 !! result
10111 <p>ISBN 123456789
10112 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
10113 </p><p>ISBN 12345678901
10114 </p>
10115 !! end
10116
10117
10118 !! test
10119 ISBN with trailing year (bug 8110)
10120 !! input
10121 ISBN 1-234-56789-0 - 2006
10122
10123 ISBN 1 234 56789 0 - 2006
10124 !! result
10125 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
10126 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
10127 </p>
10128 !! end
10129
10130
10131 !! test
10132 anchorencode
10133 !! input
10134 {{anchorencode:foo bar©#%n}}
10135 !! result
10136 <p>foo_bar.C2.A9.23.25n
10137 </p>
10138 !! end
10139
10140 !! test
10141 anchorencode trims spaces
10142 !! input
10143 {{anchorencode: __pretty__please__}}
10144 !! result
10145 <p>pretty_please
10146 </p>
10147 !! end
10148
10149 !! test
10150 anchorencode deals with links
10151 !! input
10152 {{anchorencode: [[hello|world]] [[hi]]}}
10153 !! result
10154 <p>world_hi
10155 </p>
10156 !! end
10157
10158 !! test
10159 anchorencode deals with templates
10160 !! input
10161 {{anchorencode: {{Foo}} }}
10162 !! result
10163 <p>FOO
10164 </p>
10165 !! end
10166
10167 !! test
10168 anchorencode encodes like the TOC generator: (bug 18431)
10169 !! input
10170 === _ +:.3A%3A&&amp;]] ===
10171 {{anchorencode: _ +:.3A%3A&&amp;]] }}
10172 __NOEDITSECTION__
10173 !! result
10174 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
10175 <p>.2B:.3A.253A.26.26.5D.5D
10176 </p>
10177 !! end
10178
10179 # Expected output in the following test is not necessarily expected (there
10180 # should probably be <p> tags inside the <blockquote> in the output) -- it's
10181 # only testing for well-formedness.
10182 !! test
10183 Bug 6200: blockquotes and paragraph formatting
10184 !! input
10185 <blockquote>
10186 foo
10187 </blockquote>
10188
10189 bar
10190
10191 baz
10192 !! result
10193 <blockquote>
10194 foo
10195 </blockquote>
10196 <p>bar
10197 </p>
10198 <pre>baz
10199 </pre>
10200 !! end
10201
10202 !! test
10203 Bug 8293: Use of center tag ruins paragraph formatting
10204 !! input
10205 <center>
10206 foo
10207 </center>
10208
10209 bar
10210
10211 baz
10212 !! result
10213 <center>
10214 <p>foo
10215 </p>
10216 </center>
10217 <p>bar
10218 </p>
10219 <pre>baz
10220 </pre>
10221 !! end
10222
10223
10224 ###
10225 ### Language variants related tests
10226 ###
10227 !! test
10228 Self-link in language variants
10229 !! options
10230 title=[[Dunav]] language=sr
10231 !! input
10232 Both [[Dunav]] and [[Дунав]] are names for this river.
10233 !! result
10234 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
10235 </p>
10236 !!end
10237
10238
10239 !! test
10240 Link to pages in language variants
10241 !! options
10242 language=sr
10243 !! input
10244 Main Page can be written as [[Маин Паге]]
10245 !! result
10246 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
10247 </p>
10248 !!end
10249
10250
10251 !! test
10252 Multiple links to pages in language variants
10253 !! options
10254 language=sr
10255 !! input
10256 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
10257 !! result
10258 <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>.
10259 </p>
10260 !!end
10261
10262
10263 !! test
10264 Simple template in language variants
10265 !! options
10266 language=sr
10267 !! input
10268 {{тест}}
10269 !! result
10270 <p>This is a test template
10271 </p>
10272 !! end
10273
10274
10275 !! test
10276 Template with explicit namespace in language variants
10277 !! options
10278 language=sr
10279 !! input
10280 {{Template:тест}}
10281 !! result
10282 <p>This is a test template
10283 </p>
10284 !! end
10285
10286
10287 !! test
10288 Basic test for template parameter in language variants
10289 !! options
10290 language=sr
10291 !! input
10292 {{парамтест|param=foo}}
10293 !! result
10294 <p>This is a test template with parameter foo
10295 </p>
10296 !! end
10297
10298
10299 !! test
10300 Simple category in language variants
10301 !! options
10302 language=sr cat
10303 !! input
10304 [[Category:МедиаWики Усер'с Гуиде]]
10305 !! result
10306 <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>
10307 !! end
10308
10309
10310 !! test
10311 Stripping -{}- tags (language variants)
10312 !! options
10313 language=sr
10314 !! input
10315 Latin proverb: -{Ne nuntium necare}-
10316 !! result
10317 <p>Latin proverb: Ne nuntium necare
10318 </p>
10319 !! end
10320
10321
10322 !! test
10323 Prevent conversion with -{}- tags (language variants)
10324 !! options
10325 language=sr variant=sr-ec
10326 !! input
10327 Latinski: -{Ne nuntium necare}-
10328 !! result
10329 <p>Латински: Ne nuntium necare
10330 </p>
10331 !! end
10332
10333
10334 !! test
10335 Prevent conversion of text with -{}- tags (language variants)
10336 !! options
10337 language=sr variant=sr-ec
10338 !! input
10339 Latinski: -{Ne nuntium necare}-
10340 !! result
10341 <p>Латински: Ne nuntium necare
10342 </p>
10343 !! end
10344
10345
10346 !! test
10347 Prevent conversion of links with -{}- tags (language variants)
10348 !! options
10349 language=sr variant=sr-ec
10350 !! input
10351 -{[[Main Page]]}-
10352 !! result
10353 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10354 </p>
10355 !! end
10356
10357
10358 !! test
10359 -{}- tags within headlines (within html for parserConvert())
10360 !! options
10361 language=sr variant=sr-ec
10362 !! input
10363 == -{Naslov}- ==
10364 !! result
10365 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уредите одељак „Naslov“">уреди</a>]</span> <span class="mw-headline" id="-.7BNaslov.7D-"> Naslov </span></h2>
10366
10367 !! end
10368
10369
10370 !! test
10371 Explicit definition of language variant alternatives
10372 !! options
10373 language=zh variant=zh-tw
10374 !! input
10375 -{zh:China;zh-tw:Taiwan}-, not China
10376 !! result
10377 <p>Taiwan, not China
10378 </p>
10379 !! end
10380
10381
10382 !! test
10383 Explicit session-wise language variant mapping (A flag and - flag)
10384 !! options
10385 language=zh variant=zh-tw
10386 !! input
10387 Taiwan is not China.
10388 But -{A|zh:China;zh-tw:Taiwan}- is China,
10389 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
10390 and -{China}- is China.
10391 !! result
10392 <p>Taiwan is not China.
10393 But Taiwan is Taiwan,
10394 (This should be stripped!)
10395 and China is China.
10396 </p>
10397 !! end
10398
10399 !! test
10400 Explicit session-wise language variant mapping (H flag for hide)
10401 !! options
10402 language=zh variant=zh-tw
10403 !! input
10404 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
10405 Taiwan is China.
10406 !! result
10407 <p>(This should be stripped!)
10408 Taiwan is Taiwan.
10409 </p>
10410 !! end
10411
10412 !! test
10413 Adding explicit conversion rule for title (T flag)
10414 !! options
10415 language=zh variant=zh-tw showtitle
10416 !! input
10417 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
10418 !! result
10419 Taiwan
10420 <p>Should be stripped!
10421 </p>
10422 !! end
10423
10424 !! test
10425 Testing that changing the language variant here in the tests actually works
10426 !! options
10427 language=zh variant=zh showtitle
10428 !! input
10429 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
10430 !! result
10431 China
10432 <p>Should be stripped!
10433 </p>
10434 !! end
10435
10436 !! test
10437 Bug 24072: more test on conversion rule for title
10438 !! options
10439 language=zh variant=zh-tw showtitle
10440 !! input
10441 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
10442 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
10443 !! result
10444 Taiwan
10445 <p>This should be stripped!
10446 This won't take interferes with the title rule.
10447 </p>
10448 !! end
10449
10450 !! test
10451 Raw output of variant escape tags (R flag)
10452 !! options
10453 language=zh variant=zh-tw
10454 !! input
10455 Raw: -{R|zh:China;zh-tw:Taiwan}-
10456 !! result
10457 <p>Raw: zh:China;zh-tw:Taiwan
10458 </p>
10459 !! end
10460
10461 !! test
10462 Nested using of manual convert syntax
10463 !! options
10464 language=zh variant=zh-hk
10465 !! input
10466 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
10467 !! result
10468 <p>Nested: Hello Hong Kong!
10469 </p>
10470 !! end
10471
10472 !! test
10473 Do not convert roman numbers to language variants
10474 !! options
10475 language=sr variant=sr-ec
10476 !! input
10477 Fridrih IV je car.
10478 !! result
10479 <p>Фридрих IV је цар.
10480 </p>
10481 !! end
10482
10483 !! test
10484 Unclosed language converter markup "-{"
10485 !! options
10486 language=sr
10487 !! input
10488 -{T|hello
10489 !! result
10490 <p>-{T|hello
10491 </p>
10492 !! end
10493
10494 !! test
10495 Don't convert raw rule "-{R|=&gt;}-" to "=>"
10496 !! options
10497 language=sr
10498 !! input
10499 -{R|=&gt;}-
10500 !! result
10501 <p>=&gt;
10502 </p>
10503 !!end
10504
10505 !!article
10506 Template:Bullet
10507 !!text
10508 * Bar
10509 !!endarticle
10510
10511 !! test
10512 Bug 529: Uncovered bullet
10513 !! input
10514 * Foo {{bullet}}
10515 !! result
10516 <ul><li> Foo
10517 </li><li> Bar
10518 </li></ul>
10519
10520 !! end
10521
10522 # Plain MediaWiki does not remove empty lists, but tidy actually does.
10523 # Templates in Wikipedia rely on this behavior, as tidy has always been
10524 # enabled there. These tests are normally run *without* tidy, so specify the
10525 # full output here.
10526 # To test realistic parsing behavior, apply a tidy-like transformation to both
10527 # the expected output and your parser's output.
10528 !! test
10529 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
10530 !! input
10531 ******* Foo {{bullet}}
10532 !! result
10533 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
10534 </li></ul>
10535 </li></ul>
10536 </li></ul>
10537 </li></ul>
10538 </li></ul>
10539 </li></ul>
10540 </li><li> Bar
10541 </li></ul>
10542
10543 !! end
10544
10545 !! test
10546 Bug 529: Uncovered table already at line-start
10547 !! input
10548 x
10549
10550 {{table}}
10551 y
10552 !! result
10553 <p>x
10554 </p>
10555 <table>
10556 <tr>
10557 <td> 1 </td>
10558 <td> 2
10559 </td></tr>
10560 <tr>
10561 <td> 3 </td>
10562 <td> 4
10563 </td></tr></table>
10564 <p>y
10565 </p>
10566 !! end
10567
10568 !! test
10569 Bug 529: Uncovered bullet in parser function result
10570 !! input
10571 * Foo {{lc:{{bullet}} }}
10572 !! result
10573 <ul><li> Foo
10574 </li><li> bar
10575 </li></ul>
10576
10577 !! end
10578
10579 !! test
10580 Bug 5678: Double-parsed template argument
10581 !! input
10582 {{lc:{{{1}}}|hello}}
10583 !! result
10584 <p>{{{1}}}
10585 </p>
10586 !! end
10587
10588 !! test
10589 Bug 5678: Double-parsed template invocation
10590 !! input
10591 {{lc:{{paramtest {{!}} param = hello }} }}
10592 !! result
10593 <p>{{paramtest | param = hello }}
10594 </p>
10595 !! end
10596
10597 !! test
10598 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
10599 !! options
10600 language=cs
10601 title=[[Main Page]]
10602 !! input
10603 {{PRVNÍVELKÉ:ěščř}}
10604 {{prvnívelké:ěščř}}
10605 {{PRVNÍMALÉ:ěščř}}
10606 {{prvnímalé:ěščř}}
10607 {{MALÁ:ěščř}}
10608 {{malá:ěščř}}
10609 {{VELKÁ:ěščř}}
10610 {{velká:ěščř}}
10611 !! result
10612 <p>Ěščř
10613 Ěščř
10614 ěščř
10615 ěščř
10616 ěščř
10617 ěščř
10618 ĚŠČŘ
10619 ĚŠČŘ
10620 </p>
10621 !! end
10622
10623 !! test
10624 Morwen/13: Unclosed link followed by heading
10625 !! input
10626 [[link
10627 ==heading==
10628 !! result
10629 <p>[[link
10630 </p>
10631 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span> <span class="mw-headline" id="heading">heading</span></h2>
10632
10633 !! end
10634
10635 !! test
10636 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
10637 !! input
10638 {{foo|
10639 =heading=
10640 !! result
10641 <p>{{foo|
10642 </p>
10643 <h1> <span class="mw-headline" id="heading">heading</span></h1>
10644
10645 !! end
10646
10647 !! test
10648 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
10649 !! input
10650 {{foo|
10651 ==heading==
10652 !! result
10653 <p>{{foo|
10654 </p>
10655 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span> <span class="mw-headline" id="heading">heading</span></h2>
10656
10657 !! end
10658
10659 !! test
10660 Tildes in comments
10661 !! options
10662 pst
10663 !! input
10664 <!-- ~~~~ -->
10665 !! result
10666 <!-- ~~~~ -->
10667 !! end
10668
10669 !! test
10670 Paragraphs inside divs (no extra line breaks)
10671 !! input
10672 <div>Line one
10673
10674 Line two</div>
10675 !! result
10676 <div>Line one
10677 Line two</div>
10678
10679 !! end
10680
10681 !! test
10682 Paragraphs inside divs (extra line break on open)
10683 !! input
10684 <div>
10685 Line one
10686
10687 Line two</div>
10688 !! result
10689 <div>
10690 <p>Line one
10691 </p>
10692 Line two</div>
10693
10694 !! end
10695
10696 !! test
10697 Paragraphs inside divs (extra line break on close)
10698 !! input
10699 <div>Line one
10700
10701 Line two
10702 </div>
10703 !! result
10704 <div>Line one
10705 <p>Line two
10706 </p>
10707 </div>
10708
10709 !! end
10710
10711 !! test
10712 Paragraphs inside divs (extra line break on open and close)
10713 !! input
10714 <div>
10715 Line one
10716
10717 Line two
10718 </div>
10719 !! result
10720 <div>
10721 <p>Line one
10722 </p><p>Line two
10723 </p>
10724 </div>
10725
10726 !! end
10727
10728 !! test
10729 Nesting tags, paragraphs on lines which begin with <div>
10730 !! options
10731 disabled
10732 !! input
10733 <div></div><strong>A
10734 B</strong>
10735 !! result
10736 <div></div>
10737 <p><strong>A
10738 B</strong>
10739 </p>
10740 !! end
10741
10742 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
10743 !! test
10744 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
10745 !! options
10746 disabled
10747 !! input
10748 <blockquote>Line one
10749
10750 Line two</blockquote>
10751 !! result
10752 <blockquote>Line one
10753 Line two</blockquote>
10754
10755 !! end
10756
10757 !! test
10758 Bug 6200: paragraphs inside blockquotes (extra line break on open)
10759 !! options
10760 disabled
10761 !! input
10762 <blockquote>
10763 Line one
10764
10765 Line two</blockquote>
10766 !! result
10767 <blockquote>
10768 <p>Line one
10769 </p>
10770 Line two</blockquote>
10771
10772 !! end
10773
10774 !! test
10775 Bug 6200: paragraphs inside blockquotes (extra line break on close)
10776 !! options
10777 disabled
10778 !! input
10779 <blockquote>Line one
10780
10781 Line two
10782 </blockquote>
10783 !! result
10784 <blockquote>Line one
10785 <p>Line two
10786 </p>
10787 </blockquote>
10788
10789 !! end
10790
10791 !! test
10792 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
10793 !! options
10794 disabled
10795 !! input
10796 <blockquote>
10797 Line one
10798
10799 Line two
10800 </blockquote>
10801 !! result
10802 <blockquote>
10803 <p>Line one
10804 </p><p>Line two
10805 </p>
10806 </blockquote>
10807
10808 !! end
10809
10810 !! test
10811 Paragraphs inside blockquotes/divs (no extra line breaks)
10812 !! input
10813 <blockquote><div>Line one
10814
10815 Line two</div></blockquote>
10816 !! result
10817 <blockquote><div>Line one
10818 Line two</div></blockquote>
10819
10820 !! end
10821
10822 !! test
10823 Paragraphs inside blockquotes/divs (extra line break on open)
10824 !! input
10825 <blockquote><div>
10826 Line one
10827
10828 Line two</div></blockquote>
10829 !! result
10830 <blockquote><div>
10831 <p>Line one
10832 </p>
10833 Line two</div></blockquote>
10834
10835 !! end
10836
10837 !! test
10838 Paragraphs inside blockquotes/divs (extra line break on close)
10839 !! input
10840 <blockquote><div>Line one
10841
10842 Line two
10843 </div></blockquote>
10844 !! result
10845 <blockquote><div>Line one
10846 <p>Line two
10847 </p>
10848 </div></blockquote>
10849
10850 !! end
10851
10852 !! test
10853 Paragraphs inside blockquotes/divs (extra line break on open and close)
10854 !! input
10855 <blockquote><div>
10856 Line one
10857
10858 Line two
10859 </div></blockquote>
10860 !! result
10861 <blockquote><div>
10862 <p>Line one
10863 </p><p>Line two
10864 </p>
10865 </div></blockquote>
10866
10867 !! end
10868
10869 !! test
10870 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
10871 !! options
10872 wgLinkHolderBatchSize=0
10873 !! input
10874 [[meatball:1]]
10875 [[meatball:2]]
10876 [[meatball:3]]
10877 !! result
10878 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
10879 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
10880 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
10881 </p>
10882 !! end
10883
10884 !! test
10885 Free external link invading image caption
10886 !! input
10887 [[Image:Foobar.jpg|thumb|http://x|hello]]
10888 !! result
10889 <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>
10890
10891 !! end
10892
10893 !! test
10894 Bug 15196: localised external link numbers
10895 !! options
10896 language=fa
10897 !! input
10898 [http://en.wikipedia.org/]
10899 !! result
10900 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
10901 </p>
10902 !! end
10903
10904 !! test
10905 Multibyte character in padleft
10906 !! input
10907 {{padleft:-Hello|7|Æ}}
10908 !! result
10909 <p>Æ-Hello
10910 </p>
10911 !! end
10912
10913 !! test
10914 Multibyte character in padright
10915 !! input
10916 {{padright:Hello-|7|Æ}}
10917 !! result
10918 <p>Hello-Æ
10919 </p>
10920 !! end
10921
10922 !! test
10923 Formatted date
10924 !! config
10925 wgUseDynamicDates=1
10926 !! input
10927 [[2009-03-24]]
10928 !! result
10929 <p><span class="mw-formatted-date" title="2009-03-24"><a href="/index.php?title=2009&amp;action=edit&amp;redlink=1" class="new" title="2009 (page does not exist)">2009</a>-<a href="/index.php?title=March_24&amp;action=edit&amp;redlink=1" class="new" title="March 24 (page does not exist)">03-24</a></span>
10930 </p>
10931 !!end
10932
10933 !!test
10934 formatdate parser function
10935 !!input
10936 {{#formatdate:2009-03-24}}
10937 !! result
10938 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
10939 </p>
10940 !! end
10941
10942 !!test
10943 formatdate parser function, with default format
10944 !!input
10945 {{#formatdate:2009-03-24|mdy}}
10946 !! result
10947 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
10948 </p>
10949 !! end
10950
10951 !! test
10952 Linked date with autoformatting disabled
10953 !! config
10954 wgUseDynamicDates=false
10955 !! input
10956 [[2009-03-24]]
10957 !! result
10958 <p><a href="/index.php?title=2009-03-24&amp;action=edit&amp;redlink=1" class="new" title="2009-03-24 (page does not exist)">2009-03-24</a>
10959 </p>
10960 !! end
10961
10962 !! test
10963 Spacing of numbers in formatted dates
10964 !! input
10965 {{#formatdate:January 15}}
10966 !! result
10967 <p><span class="mw-formatted-date" title="01-15">January 15</span>
10968 </p>
10969 !! end
10970
10971 !! test
10972 Spacing of numbers in formatted dates (linked)
10973 !! config
10974 wgUseDynamicDates=true
10975 !! input
10976 [[January 15]]
10977 !! result
10978 <p><span class="mw-formatted-date" title="01-15"><a href="/index.php?title=January_15&amp;action=edit&amp;redlink=1" class="new" title="January 15 (page does not exist)">January 15</a></span>
10979 </p>
10980 !! end
10981
10982 !! test
10983 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
10984 !! options
10985 language=nl title=[[MediaWiki:Common.css]]
10986 !! input
10987 {{#formatdate:2009-03-24|dmy}}
10988 !! result
10989 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
10990 </p>
10991 !! end
10992
10993 #
10994 #
10995 #
10996
10997 #
10998 # Edit comments
10999 #
11000
11001 !! test
11002 Edit comment with link
11003 !! options
11004 comment
11005 !! input
11006 I like the [[Main Page]] a lot
11007 !! result
11008 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
11009 !!end
11010
11011 !! test
11012 Edit comment with link and link text
11013 !! options
11014 comment
11015 !! input
11016 I like the [[Main Page|best pages]] a lot
11017 !! result
11018 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
11019 !!end
11020
11021 !! test
11022 Edit comment with link and link text with suffix
11023 !! options
11024 comment
11025 !! input
11026 I like the [[Main Page|best page]]s a lot
11027 !! result
11028 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
11029 !!end
11030
11031 !! test
11032 Edit comment with section link (non-local, eg in history list)
11033 !! options
11034 comment title=[[Main Page]]
11035 !! input
11036 /* External links */ removed bogus entries
11037 !! result
11038 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
11039 !!end
11040
11041 !! test
11042 Edit comment with section link and text before it (non-local, eg in history list)
11043 !! options
11044 comment title=[[Main Page]]
11045 !! input
11046 pre-comment text /* External links */ removed bogus entries
11047 !! result
11048 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>
11049 !!end
11050
11051 !! test
11052 Edit comment with section link (local, eg in diff view)
11053 !! options
11054 comment local title=[[Main Page]]
11055 !! input
11056 /* External links */ removed bogus entries
11057 !! result
11058 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
11059 !!end
11060
11061 !! test
11062 Edit comment with subpage link (bug 14080)
11063 !! options
11064 comment
11065 subpage
11066 title=[[Subpage test]]
11067 !! input
11068 Poked at a [[/subpage]] here...
11069 !! result
11070 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
11071 !!end
11072
11073 !! test
11074 Edit comment with subpage link and link text (bug 14080)
11075 !! options
11076 comment
11077 subpage
11078 title=[[Subpage test]]
11079 !! input
11080 Poked at a [[/subpage|neat little page]] here...
11081 !! result
11082 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
11083 !!end
11084
11085 !! test
11086 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
11087 !! options
11088 comment
11089 title=[[Subpage test]]
11090 !! input
11091 Poked at a [[/subpage]] here...
11092 !! result
11093 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...
11094 !!end
11095
11096 !! test
11097 Edit comment with bare anchor link (local, as on diff)
11098 !! options
11099 comment
11100 local
11101 title=[[Main Page]]
11102 !!input
11103 [[#section]]
11104 !! result
11105 <a href="#section">#section</a>
11106 !! end
11107
11108 !! test
11109 Edit comment with bare anchor link (non-local, as on history)
11110 !! options
11111 comment
11112 title=[[Main Page]]
11113 !!input
11114 [[#section]]
11115 !! result
11116 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
11117 !! end
11118
11119 !! test
11120 Anchor starting with underscore
11121 !!input
11122 [[#_ref|One]]
11123 !! result
11124 <p><a href="#_ref">One</a>
11125 </p>
11126 !! end
11127
11128 !! test
11129 Id starting with underscore
11130 !!input
11131 <div id="_ref"></div>
11132 !! result
11133 <div id="_ref"></div>
11134
11135 !! end
11136
11137 !! test
11138 Space normalisation on autocomment (bug 22784)
11139 !! options
11140 comment
11141 title=[[Main Page]]
11142 !!input
11143 /* __hello__world__ */
11144 !! result
11145 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
11146 !! end
11147
11148 !! test
11149 percent-encoding and + signs in comments (Bug 26410)
11150 !! options
11151 comment
11152 !!input
11153 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
11154 !! result
11155 <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>
11156 !! end
11157
11158 !! test
11159 Bad images - basic functionality
11160 !! options
11161 disabled
11162 !! input
11163 [[File:Bad.jpg]]
11164 !! result
11165 !! end
11166
11167 !! test
11168 Bad images - bug 16039: text after bad image disappears
11169 !! options
11170 disabled
11171 !! input
11172 Foo bar
11173 [[File:Bad.jpg]]
11174 Bar foo
11175 !! result
11176 <p>Foo bar
11177 </p><p>Bar foo
11178 </p>
11179 !! end
11180
11181 !! test
11182 Verify that displaytitle works (bug #22501) no displaytitle
11183 !! options
11184 showtitle
11185 !! config
11186 wgAllowDisplayTitle=true
11187 wgRestrictDisplayTitle=false
11188 !! input
11189 this is not the the title
11190 !! result
11191 Parser test
11192 <p>this is not the the title
11193 </p>
11194 !! end
11195
11196 !! test
11197 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
11198 !! options
11199 showtitle
11200 title=[[Screen]]
11201 !! config
11202 wgAllowDisplayTitle=true
11203 wgRestrictDisplayTitle=false
11204 !! input
11205 this is not the the title
11206 {{DISPLAYTITLE:whatever}}
11207 !! result
11208 whatever
11209 <p>this is not the the title
11210 </p>
11211 !! end
11212
11213 !! test
11214 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
11215 !! options
11216 showtitle
11217 title=[[Screen]]
11218 !! config
11219 wgAllowDisplayTitle=true
11220 wgRestrictDisplayTitle=true
11221 !! input
11222 this is not the the title
11223 {{DISPLAYTITLE:whatever}}
11224 !! result
11225 Screen
11226 <p>this is not the the title
11227 </p>
11228 !! end
11229
11230 !! test
11231 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
11232 !! options
11233 showtitle
11234 title=[[Screen]]
11235 !! config
11236 wgAllowDisplayTitle=true
11237 wgRestrictDisplayTitle=true
11238 !! input
11239 this is not the the title
11240 {{DISPLAYTITLE:screen}}
11241 !! result
11242 screen
11243 <p>this is not the the title
11244 </p>
11245 !! end
11246
11247 !! test
11248 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
11249 !! options
11250 showtitle
11251 title=[[Screen]]
11252 !! config
11253 wgAllowDisplayTitle=false
11254 !! input
11255 this is not the the title
11256 {{DISPLAYTITLE:screen}}
11257 !! result
11258 Screen
11259 <p>this is not the the title
11260 <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>
11261 </p>
11262 !! end
11263
11264 !! test
11265 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
11266 !! options
11267 showtitle
11268 title=[[Screen]]
11269 !! config
11270 wgAllowDisplayTitle=false
11271 !! input
11272 this is not the the title
11273 !! result
11274 Screen
11275 <p>this is not the the title
11276 </p>
11277 !! end
11278
11279 !! test
11280 preload: check <noinclude> and <includeonly>
11281 !! options
11282 preload
11283 !! input
11284 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
11285 !! result
11286 Hello kind world.
11287 !! end
11288
11289 !! test
11290 preload: check <onlyinclude>
11291 !! options
11292 preload
11293 !! input
11294 Goodbye <onlyinclude>Hello world</onlyinclude>
11295 !! result
11296 Hello world
11297 !! end
11298
11299 !! test
11300 preload: can pass tags through if we want to
11301 !! options
11302 preload
11303 !! input
11304 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
11305 !! result
11306 <includeonly>Hello world</includeonly>
11307 !! end
11308
11309 !! test
11310 preload: check that it doesn't try to do tricks
11311 !! options
11312 preload
11313 !! input
11314 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
11315 !! result
11316 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
11317 !! end
11318
11319 !! test
11320 Play a bit with r67090 and bug 3158
11321 !! options
11322 disabled
11323 !! input
11324 <div style="width:50% !important">&nbsp;</div>
11325 <div style="width:50%&nbsp;!important">&nbsp;</div>
11326 <div style="width:50%&#160;!important">&nbsp;</div>
11327 <div style="border : solid;">&nbsp;</div>
11328 !! result
11329 <div style="width:50% !important">&nbsp;</div>
11330 <div style="width:50% !important">&nbsp;</div>
11331 <div style="width:50% !important">&nbsp;</div>
11332 <div style="border&#160;: solid;">&nbsp;</div>
11333
11334 !! end
11335
11336 !! test
11337 HTML5 data attributes
11338 !! input
11339 <span data-foo="bar">Baz</span>
11340 <p data-abc-def_hij="">Quuz</p>
11341 !! result
11342 <p><span data-foo="bar">Baz</span>
11343 </p>
11344 <p data-abc-def_hij="">Quuz</p>
11345
11346 !! end
11347
11348 !! test
11349 percent-encoding and + signs in internal links (Bug 26410)
11350 !! input
11351 [[User:+%]] [[Page+title%]]
11352 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
11353 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
11354 [[%33%45]] [[%33%45+]]
11355 !! result
11356 <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>
11357 <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>
11358 <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>
11359 <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>
11360 </p>
11361 !! end
11362
11363 !! test
11364 Special characters in embedded file links (bug 27679)
11365 !! input
11366 [[File:Contains & ampersand.jpg]]
11367 [[File:Does not exist.jpg|Title with & ampersand]]
11368 !! result
11369 <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>
11370 <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>
11371 </p>
11372 !! end
11373
11374
11375 !! test
11376 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
11377 !! input
11378 Text&apos;s been normalized?
11379 !! result
11380 <p>Text&#39;s been normalized?
11381 </p>
11382 !! end
11383
11384 !! test
11385 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
11386 !! input
11387 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
11388 !! result
11389 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
11390 </p>
11391 !! end
11392
11393 !! test
11394 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
11395 !! input
11396 [http://www.example.org/ ideograms]
11397 !! result
11398 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
11399 </p>
11400 !! end
11401
11402 !! test
11403 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
11404 !! input
11405 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
11406 !! result
11407 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
11408 </p>
11409 !! end
11410
11411 !! article
11412 Mediawiki:loop1
11413 !! text
11414 {{Identical|A}}
11415 !! endarticle
11416
11417 !! article
11418 Mediawiki:loop2
11419 !! text
11420 {{Identical|B}}
11421 !! endarticle
11422
11423 !! article
11424 Template:Identical
11425 !! text
11426 {{int:loop1}}
11427 {{int:loop2}}
11428 !! endarticle
11429
11430 !! test
11431 Bug 31098 Template which includes system messages which includes the template
11432 !! input
11433 {{Identical}}
11434 !! result
11435 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
11436 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
11437 </p>
11438 !! end
11439
11440 !! test
11441 Deprecated presentational attributes are converted to css
11442 !! input
11443 {|
11444 | valign=top align=left width=100 height=25% | Asdf
11445 |}
11446 <ul type="disc"></ul>
11447 !! result
11448 <table>
11449 <tr>
11450 <td style="text-align: left; height: 25%; vertical-align: top; width: 100px;"> Asdf
11451 </td></tr></table>
11452 <ul style="list-style-type: disc;"></ul>
11453
11454 !! end
11455
11456 !! test
11457 Bug31490 Turkish: ucfirst 'blah'
11458 !! options
11459 language=tr
11460 !! input
11461 {{ucfirst:blah}}
11462 !! result
11463 <p>Blah
11464 </p>
11465 !! end
11466
11467 !! test
11468 Bug31490 Turkish: ucfirst 'ix'
11469 !! options
11470 language=tr
11471 !! input
11472 {{ucfirst:ix}}
11473 !! result
11474 <p>İx
11475 </p>
11476 !! end
11477
11478 !! test
11479 Bug31490 Turkish: lcfirst 'BLAH'
11480 !! options
11481 language=tr
11482 !! input
11483 {{lcfirst:BLAH}}
11484 !! result
11485 <p>bLAH
11486 </p>
11487 !! end
11488
11489 !! test
11490 Bug31490 Turkish: ucfırst (with a dotless i)
11491 !! options
11492 language=tr
11493 !! input
11494 {{ucfırst:blah}}
11495 !! result
11496 <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>
11497 </p>
11498 !! end
11499
11500 !! test
11501 Bug31490 ucfırst (with a dotless i) with English language
11502 !! options
11503 language=en
11504 !! input
11505 {{ucfırst:blah}}
11506 !! result
11507 <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>
11508 </p>
11509 !! end
11510
11511 !! test
11512 Bug 26375: TOC with italics
11513 !! options
11514 title=[[Main Page]]
11515 !! input
11516 __TOC__
11517 == ''Lost'' episodes ==
11518 !! result
11519 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11520 <ul>
11521 <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>
11522 </ul>
11523 </td></tr></table>
11524 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Lost episodes">edit</a>]</span> <span class="mw-headline" id="Lost_episodes"> <i>Lost</i> episodes </span></h2>
11525
11526 !! end
11527
11528 !! test
11529 Bug 26375: TOC with bold
11530 !! options
11531 title=[[Main Page]]
11532 !! input
11533 __TOC__
11534 == '''should be bold''' then normal text ==
11535 !! result
11536 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11537 <ul>
11538 <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>
11539 </ul>
11540 </td></tr></table>
11541 <h2><span class="editsection">[<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> <span class="mw-headline" id="should_be_bold_then_normal_text"> <b>should be bold</b> then normal text </span></h2>
11542
11543 !! end
11544
11545 !! test
11546 Bug 33845: Headings become cursive in TOC when they contain an image
11547 !! options
11548 title=[[Main Page]]
11549 !! input
11550 __TOC__
11551 == Image [[Image:foobar.jpg]] ==
11552 !! result
11553 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11554 <ul>
11555 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
11556 </ul>
11557 </td></tr></table>
11558 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Image">edit</a>]</span> <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></h2>
11559
11560 !! end
11561
11562 !! test
11563 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
11564 !! options
11565 title=[[Main Page]]
11566 !! input
11567 __TOC__
11568 == <blockquote>Quote</blockquote> ==
11569 !! result
11570 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11571 <ul>
11572 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
11573 </ul>
11574 </td></tr></table>
11575 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a>]</span> <span class="mw-headline" id="Quote"> <blockquote>Quote</blockquote> </span></h2>
11576
11577 !! end
11578
11579 !! test
11580 Unclosed tags in TOC
11581 !! options
11582 title=[[Main Page]]
11583 !! input
11584 __TOC__
11585 == Proof: 2 < 3 ==
11586 <small>Hanc marginis exiguitas non caperet.</small>
11587 QED
11588 !! result
11589 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11590 <ul>
11591 <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>
11592 </ul>
11593 </td></tr></table>
11594 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Proof: 2 &lt; 3">edit</a>]</span> <span class="mw-headline" id="Proof:_2_.3C_3"> Proof: 2 &lt; 3 </span></h2>
11595 <p><small>Hanc marginis exiguitas non caperet.</small>
11596 QED
11597 </p>
11598 !! end
11599
11600 !! test
11601 Multiple tags in TOC
11602 !! input
11603 __TOC__
11604 == <i>Foo</i> <b>Bar</b> ==
11605
11606 == <i>Foo</i> <blockquote>Bar</blockquote> ==
11607 !! result
11608 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11609 <ul>
11610 <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>
11611 <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>
11612 </ul>
11613 </td></tr></table>
11614 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline" id="Foo_Bar"> <i>Foo</i> <b>Bar</b> </span></h2>
11615 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline" id="Foo_Bar_2"> <i>Foo</i> <blockquote>Bar</blockquote> </span></h2>
11616
11617 !! end
11618
11619 !! test
11620 Tags with parameters in TOC
11621 !! input
11622 __TOC__
11623 == <sup class="in-h2">Hello</sup> ==
11624
11625 == <sup class="a > b">Evilbye</sup> ==
11626 !! result
11627 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11628 <ul>
11629 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
11630 <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>
11631 </ul>
11632 </td></tr></table>
11633 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Hello">edit</a>]</span> <span class="mw-headline" id="Hello"> <sup class="in-h2">Hello</sup> </span></h2>
11634 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;>Evilbye">edit</a>]</span> <span class="mw-headline" id="b.22.3EEvilbye"> <sup> b"&gt;Evilbye</sup> </span></h2>
11635
11636 !! end
11637
11638 !! test
11639 span tags with directionality in TOC
11640 !! input
11641 __TOC__
11642 == <span dir="ltr">C++</span> ==
11643
11644 == <span dir="rtl">זבנג!</span> ==
11645
11646 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
11647
11648 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
11649
11650 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
11651 !! result
11652 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11653 <ul>
11654 <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>
11655 <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>
11656 <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>
11657 <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>
11658 <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>
11659 </ul>
11660 </td></tr></table>
11661 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: C++">edit</a>]</span> <span class="mw-headline" id="C.2B.2B"> <span dir="ltr">C++</span> </span></h2>
11662 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: זבנג!">edit</a>]</span> <span class="mw-headline" id=".D7.96.D7.91.D7.A0.D7.92.21"> <span dir="rtl">זבנג!</span> </span></h2>
11663 <h2><span class="editsection">[<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> <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></h2>
11664 <h2><span class="editsection">[<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> <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></h2>
11665 <h2><span class="editsection">[<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> <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></h2>
11666
11667 !! end
11668
11669 !! article
11670 MediaWiki:Bug32057
11671 !! text
11672 == {{int:headline_sample}} ==
11673 !! endarticle
11674
11675 !! test
11676 Bug 32057: Title needed when expanding <h> nodes.
11677 !! options
11678 title=[[Main Page]]
11679 !! input
11680 {{int:Bug32057}}
11681 !! result
11682 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Headline text">edit</a>]</span> <span class="mw-headline" id="Headline_text"> Headline text </span></h2>
11683
11684 !! end
11685
11686 !! test
11687 Strip marker in urlencode
11688 !! input
11689 {{urlencode:x<nowiki/>y}}
11690 {{urlencode:x<nowiki/>y|wiki}}
11691 {{urlencode:x<nowiki/>y|path}}
11692 !! result
11693 <p>xy
11694 xy
11695 xy
11696 </p>
11697 !! end
11698
11699 !! test
11700 Strip marker in lc
11701 !! input
11702 {{lc:x<nowiki/>y}}
11703 !! result
11704 <p>xy
11705 </p>
11706 !! end
11707
11708 !! test
11709 Strip marker in uc
11710 !! input
11711 {{uc:x<nowiki/>y}}
11712 !! result
11713 <p>XY
11714 </p>
11715 !! end
11716
11717 !! test
11718 Strip marker in formatNum
11719 !! input
11720 {{formatnum:1<nowiki/>2}}
11721 {{formatnum:1<nowiki/>2|R}}
11722 !! result
11723 <p>12
11724 12
11725 </p>
11726 !! end
11727
11728 !! test
11729 Strip marker in grammar
11730 !! options
11731 language=fi
11732 !! input
11733 {{grammar:elative|foo<nowiki/>bar}}
11734 !! result
11735 <p>foobarista
11736 </p>
11737 !! end
11738
11739 !! test
11740 Strip marker in padleft
11741 !! input
11742 {{padleft:|2|x<nowiki/>y}}
11743 !! result
11744 <p>xy
11745 </p>
11746 !! end
11747
11748 !! test
11749 Strip marker in padright
11750 !! input
11751 {{padright:|2|x<nowiki/>y}}
11752 !! result
11753 <p>xy
11754 </p>
11755 !! end
11756
11757 !! test
11758 Strip marker in anchorencode
11759 !! input
11760 {{anchorencode:x<nowiki/>y}}
11761 !! result
11762 <p>xy
11763 </p>
11764 !! end
11765
11766 !! test
11767 nowiki inside link inside heading (bug 18295)
11768 !! input
11769 ==[[foo|x<nowiki>y</nowiki>z]]==
11770 !! result
11771 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: xyz">edit</a>]</span> <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></h2>
11772
11773 !! end
11774
11775 !! test
11776 new support for bdi element (bug 31817)
11777 !! input
11778 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
11779 !! result
11780 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
11781
11782 !!end
11783
11784 !! test
11785 Ignore pipe between table row attributes
11786 !! input
11787 {|
11788 | quux
11789 |- id=foo | style='color: red'
11790 | bar
11791 |}
11792 !! result
11793 <table>
11794 <tr>
11795 <td> quux
11796 </td></tr>
11797 <tr id="foo" style="color: red">
11798 <td> bar
11799 </td></tr></table>
11800
11801 !! end
11802
11803 !!test
11804 Gallery override link with WikiLink (bug 34852)
11805 !! input
11806 <gallery>
11807 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
11808 </gallery>
11809 !! result
11810 <ul class="gallery">
11811 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11812 <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>
11813 <div class="gallerytext">
11814 <p>caption
11815 </p>
11816 </div>
11817 </div></li>
11818 </ul>
11819
11820 !! end
11821
11822 !!test
11823 Gallery override link with absolute external link (bug 34852)
11824 !! input
11825 <gallery>
11826 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
11827 </gallery>
11828 !! result
11829 <ul class="gallery">
11830 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11831 <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>
11832 <div class="gallerytext">
11833 <p>caption
11834 </p>
11835 </div>
11836 </div></li>
11837 </ul>
11838
11839 !! end
11840
11841 !!test
11842 Gallery override link with malicious javascript (bug 34852)
11843 !! input
11844 <gallery>
11845 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
11846 </gallery>
11847 !! result
11848 <ul class="gallery">
11849 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11850 <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>
11851 <div class="gallerytext">
11852 <p>caption
11853 </p>
11854 </div>
11855 </div></li>
11856 </ul>
11857
11858 !! end
11859
11860 !!test
11861 Language parser function
11862 !! input
11863 {{#language:ar}}
11864 !! result
11865 <p>العربية
11866 </p>
11867 !! end
11868
11869 !!test
11870 Padleft and padright as substr
11871 !! input
11872 {{padleft:|3|abcde}}
11873 {{padright:|3|abcde}}
11874 !! result
11875 <p>abc
11876 abc
11877 </p>
11878 !! end
11879
11880 !!test
11881 Bug 34939 - Case insensitive link parsing ([HttP://])
11882 !! input
11883 [HttP://MediaWiki.Org/]
11884 !! result
11885 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
11886 </p>
11887 !! end
11888
11889 !!test
11890 Bug 34939 - Case insensitive link parsing ([HttP:// title])
11891 !! input
11892 [HttP://MediaWiki.Org/ MediaWiki]
11893 !! result
11894 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
11895 </p>
11896 !! end
11897
11898 !!test
11899 Bug 34939 - Case insensitive link parsing (HttP://)
11900 !! input
11901 HttP://MediaWiki.Org/
11902 !! result
11903 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
11904 </p>
11905 !! end
11906
11907 ###
11908 ### Parsoids-specific tests
11909 ### Parsoid-PHP parser incompatibilities
11910 ###
11911 !!test
11912 1. SOL-sensitive wikitext tokens as template-args
11913 !!options
11914 disabled
11915 !!input
11916 {{echo|*a}}
11917 {{echo|#a}}
11918 {{echo|:a}}
11919 !!result
11920 <p>*a
11921 #a
11922 :a
11923 </p>
11924 !!end
11925
11926 #### The following section of tests are primarily to test
11927 #### wikitext escaping capabilities of Parsoid.
11928 #### A lot of the tests are disabled for the PHP parser either
11929 #### because of minor newline diffs or other reasons.
11930 #### As Parsoid serializer can handle newlines and other HTML
11931 #### more robustly, some of these tests might get reenabled
11932 #### for the PHP parser.
11933
11934 #### --------------- Headings ---------------
11935 #### 0. Unnested
11936 #### 1. Nested inside html <h1>=foo=</h1>
11937 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
11938 #### 3. Nested inside html with wikitext split by html tags
11939 #### 4. No escape needed
11940 #### 5. Empty headings <h1></h1>
11941 #### 6. Heading chars in SOL context
11942 #### ----------------------------------------
11943 !! test
11944 Headings: 0. Unnested
11945 !! input
11946 <nowiki>=foo=</nowiki>
11947
11948 <nowiki>=foo</nowiki>''a''=
11949 !! result
11950 <p>=foo=
11951 </p><p>=foo<i>a</i>=
11952 </p>
11953 !!end
11954
11955 !! test
11956 Headings: 1. Nested inside html
11957 !! options
11958 disabled
11959 !! input
11960 =<nowiki>=foo=</nowiki>=
11961 ==<nowiki>=foo=</nowiki>==
11962 ===<nowiki>=foo=</nowiki>===
11963 ====<nowiki>=foo=</nowiki>====
11964 =====<nowiki>=foo=</nowiki>=====
11965 ======<nowiki>=foo=</nowiki>======
11966 !! result
11967 <h1>=foo=</h1>
11968 <h2>=foo=</h2>
11969 <h3>=foo=</h3>
11970 <h4>=foo=</h4>
11971 <h5>=foo=</h5>
11972 <h6>=foo=</h6>
11973 !!end
11974
11975 !! test
11976 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
11977 !! options
11978 disabled
11979 !! input
11980 =foo=
11981 <nowiki>*bar</nowiki>
11982 =foo=
11983 =bar
11984 =foo=
11985 <nowiki>=bar=</nowiki>
11986 !! result
11987 <h1>foo</h1>*bar
11988 <h1>foo</h1>=bar
11989 <h1>foo</h1>=bar=
11990 !!end
11991
11992 !! test
11993 Headings: 3. Nested inside html with wikitext split by html tags
11994 !! options
11995 disabled
11996 !! input
11997 =<nowiki>=</nowiki>'''bold'''foo==
11998 !! result
11999 <h1>=<b>bold</b>foo=</h1>
12000 !!end
12001
12002 !! test
12003 Headings: 4. No escaping needed (testing just h1 and h2)
12004 !! options
12005 disabled
12006 !! input
12007 ==foo=
12008 =foo==
12009 ===foo==
12010 ==foo===
12011 =''=''foo==
12012 ===
12013 !! result
12014 <h1>=foo</h1>
12015 <h1>foo=</h1>
12016 <h2>=foo</h2>
12017 <h2>foo=</h2>
12018 <h1><i>=</i>foo=</h1>
12019 <h1>=</h1>
12020 !!end
12021
12022 !! test
12023 Headings: 5. Empty headings
12024 !! options
12025 disabled
12026 !! input
12027 =<nowiki></nowiki>=
12028 ==<nowiki></nowiki>==
12029 ===<nowiki></nowiki>===
12030 ====<nowiki></nowiki>====
12031 =====<nowiki></nowiki>=====
12032 ======<nowiki></nowiki>======
12033 !! result
12034 <h1></h1>
12035 <h2></h2>
12036 <h3></h3>
12037 <h4></h4>
12038 <h5></h5>
12039 <h6></h6>
12040 !!end
12041
12042 !! test
12043 Headings: 6. Heading chars in SOL context
12044 !! options
12045 disabled
12046 !! input
12047 <!--cmt--><nowiki>=h1=</nowiki>
12048 !! result
12049 <p><!--cmt-->=h1=
12050 </p>
12051 !!end
12052
12053 #### --------------- Lists ---------------
12054 #### 0. Outside nests (*foo, etc.)
12055 #### 1. Nested inside html <ul><li>*foo</li></ul>
12056 #### 2. Inside definition lists
12057 #### 3. Only bullets at start should be escaped
12058 #### 4. No escapes needed
12059 #### 5. No unnecessary escapes
12060 #### 6. Escape bullets in SOL position
12061 #### 7. Escape bullets in a multi-line context
12062 #### ----------------------------------------
12063
12064 !! test
12065 Lists: 0. Outside nests
12066 !! input
12067 <nowiki>*foo</nowiki>
12068
12069 <nowiki>#foo</nowiki>
12070 !! result
12071 <p>*foo
12072 </p><p>#foo
12073 </p>
12074 !!end
12075
12076 !! test
12077 Lists: 1. Nested inside html
12078 !! input
12079 *<nowiki>*foo</nowiki>
12080
12081 *<nowiki>#foo</nowiki>
12082
12083 *<nowiki>:foo</nowiki>
12084
12085 *<nowiki>;foo</nowiki>
12086
12087 #<nowiki>*foo</nowiki>
12088
12089 #<nowiki>#foo</nowiki>
12090
12091 #<nowiki>:foo</nowiki>
12092
12093 #<nowiki>;foo</nowiki>
12094 !! result
12095 <ul><li>*foo
12096 </li></ul>
12097 <ul><li>#foo
12098 </li></ul>
12099 <ul><li>:foo
12100 </li></ul>
12101 <ul><li>;foo
12102 </li></ul>
12103 <ol><li>*foo
12104 </li></ol>
12105 <ol><li>#foo
12106 </li></ol>
12107 <ol><li>:foo
12108 </li></ol>
12109 <ol><li>;foo
12110 </li></ol>
12111
12112 !!end
12113
12114 !! test
12115 Lists: 2. Inside definition lists
12116 !! input
12117 ;<nowiki>;foo</nowiki>
12118
12119 ;<nowiki>:foo</nowiki>
12120
12121 ;<nowiki>:foo</nowiki>
12122 :bar
12123
12124 :<nowiki>:foo</nowiki>
12125 !! result
12126 <dl><dt>;foo
12127 </dt></dl>
12128 <dl><dt>:foo
12129 </dt></dl>
12130 <dl><dt>:foo
12131 </dt><dd>bar
12132 </dd></dl>
12133 <dl><dd>:foo
12134 </dd></dl>
12135
12136 !!end
12137
12138 !! test
12139 Lists: 3. Only bullets at start of text should be escaped
12140 !! input
12141 *<nowiki>*foo*bar</nowiki>
12142
12143 *<nowiki>*foo</nowiki>''it''*bar
12144 !! result
12145 <ul><li>*foo*bar
12146 </li></ul>
12147 <ul><li>*foo<i>it</i>*bar
12148 </li></ul>
12149
12150 !!end
12151
12152 !! test
12153 Lists: 4. No escapes needed
12154 !! options
12155 disabled
12156 !! input
12157 *foo*bar
12158
12159 *''foo''*bar
12160
12161 *[[Foo]]: bar
12162 !! result
12163 <ul><li>foo*bar
12164 </li></ul>
12165 <ul><li><i>foo</i>*bar
12166 </li></ul>
12167 <ul><li><a href="Foo" rel="mw:WikiLink">Foo</a>: bar
12168 </li></ul>
12169 !!end
12170
12171 !! test
12172 Lists: 5. No unnecessary escapes
12173 !! input
12174 * bar <span><nowiki>[[foo]]</nowiki></span>
12175
12176 *=bar <span><nowiki>[[foo]]</nowiki></span>
12177
12178 *[[bar <span><nowiki>[[foo]]</nowiki></span>
12179
12180 *<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
12181
12182 *=bar <span>foo]]</span>=
12183 !! result
12184 <ul><li> bar <span>[[foo]]</span>
12185 </li></ul>
12186 <ul><li>=bar <span>[[foo]]</span>
12187 </li></ul>
12188 <ul><li>[[bar <span>[[foo]]</span>
12189 </li></ul>
12190 <ul><li>]]bar <span>[[foo]]</span>
12191 </li></ul>
12192 <ul><li>=bar <span>foo]]</span>=
12193 </li></ul>
12194
12195 !!end
12196
12197 !! test
12198 Lists: 6. Escape bullets in SOL position
12199 !! options
12200 disabled
12201 !! input
12202 <!--cmt--><nowiki>*foo</nowiki>
12203 !! result
12204 <p><!--cmt-->*foo
12205 </p>
12206 !!end
12207
12208 !! test
12209 Lists: 7. Escape bullets in a multi-line context
12210 !! input
12211 <nowiki>a
12212 *b</nowiki>
12213 !! result
12214 <p>a
12215 *b
12216 </p>
12217 !!end
12218
12219 #### --------------- HRs ---------------
12220 #### 1. Single line
12221 #### -----------------------------------
12222
12223 !! test
12224 HRs: 1. Single line
12225 !! options
12226 disabled
12227 !! input
12228 ----
12229 <nowiki>----</nowiki>
12230 ----
12231 <nowiki>=foo=</nowiki>
12232 ----
12233 <nowiki>*foo</nowiki>
12234 !! result
12235 <hr/>----
12236 <hr/>=foo=
12237 <hr/>*foo
12238 !! end
12239
12240 #### --------------- Tables ---------------
12241 #### 1a. Simple example
12242 #### 1b. No escaping needed (!foo)
12243 #### 1c. No escaping needed (|foo)
12244 #### 1d. No escaping needed (|}foo)
12245 ####
12246 #### 2a. Nested in td (<td>foo|bar</td>)
12247 #### 2b. Nested in td (<td>foo||bar</td>)
12248 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
12249 ####
12250 #### 3a. Nested in th (<th>foo!bar</th>)
12251 #### 3b. Nested in th (<th>foo!!bar</th>)
12252 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
12253 ####
12254 #### 4a. Escape -
12255 #### 4b. Escape +
12256 #### 4c. No escaping needed
12257 #### --------------------------------------
12258
12259 !! test
12260 Tables: 1a. Simple example
12261 !! input
12262 <nowiki>{|
12263 |}</nowiki>
12264 !! result
12265 <p>{|
12266 |}
12267 </p>
12268 !! end
12269
12270 !! test
12271 Tables: 1b. No escaping needed
12272 !! input
12273 !foo
12274 !! result
12275 <p>!foo
12276 </p>
12277 !! end
12278
12279 !! test
12280 Tables: 1c. No escaping needed
12281 !! input
12282 |foo
12283 !! result
12284 <p>|foo
12285 </p>
12286 !! end
12287
12288 !! test
12289 Tables: 1d. No escaping needed
12290 !! input
12291 |}foo
12292 !! result
12293 <p>|}foo
12294 </p>
12295 !! end
12296
12297 !! test
12298 Tables: 2a. Nested in td
12299 !! options
12300 disabled
12301 !! input
12302 {|
12303 |<nowiki>foo|bar</nowiki>
12304 |}
12305 !! result
12306 <table>
12307 <tr><td>foo|bar
12308 </td></tr></table>
12309
12310 !! end
12311
12312 !! test
12313 Tables: 2b. Nested in td
12314 !! options
12315 disabled
12316 !! input
12317 {|
12318 |<nowiki>foo||bar</nowiki>
12319 |''it''<nowiki>foo||bar</nowiki>
12320 |}
12321 !! result
12322 <table>
12323 <tr><td>foo||bar
12324 </td><td><i>it</i>foo||bar
12325 </td></tr></table>
12326
12327 !! end
12328
12329 !! test
12330 Tables: 2c. Nested in td -- no escaping needed
12331 !! options
12332 disabled
12333 !! input
12334 {|
12335 |foo!!bar
12336 |}
12337 !! result
12338 <table>
12339 <tr><td>foo!!bar
12340 </td></tr></table>
12341
12342 !! end
12343
12344 !! test
12345 Tables: 3a. Nested in th
12346 !! options
12347 disabled
12348 !! input
12349 {|
12350 !foo!bar
12351 |}
12352 !! result
12353 <table>
12354 <tr><th>foo!bar
12355 </th></tr></table>
12356
12357 !! end
12358
12359 !! test
12360 Tables: 3b. Nested in th
12361 !! options
12362 disabled
12363 !! input
12364 {|
12365 !<nowiki>foo!!bar</nowiki>
12366 |}
12367 !! result
12368 <table>
12369 <tr><th>foo!!bar
12370 </th></tr></table>
12371
12372 !! end
12373
12374 !! test
12375 Tables: 3c. Nested in th -- no escaping needed
12376 !! options
12377 disabled
12378 !! input
12379 {|
12380 !foo||bar
12381 |}
12382 !! result
12383 <table>
12384 <tr><th>foo||bar
12385 </th></tr></table>
12386
12387 !! end
12388
12389 !! test
12390 Tables: 4a. Escape -
12391 !! options
12392 disabled
12393 !! input
12394 {|
12395 |-
12396 !-bar
12397 |-
12398 |<nowiki>-bar</nowiki>
12399 |}
12400 !! result
12401 <table><tbody>
12402 <tr><th>-bar</th></tr>
12403 <tr><td>-bar</td></tr>
12404 </tbody></table>
12405 !! end
12406
12407 !! test
12408 Tables: 4b. Escape +
12409 !! options
12410 disabled
12411 !! input
12412 {|
12413 |-
12414 !+bar
12415 |-
12416 |<nowiki>+bar</nowiki>
12417 |}
12418 !! result
12419 <table><tbody>
12420 <tr><th>+bar</th></tr>
12421 <tr><td>+bar</td></tr>
12422 </tbody></table>
12423 !! end
12424
12425 !! test
12426 Tables: 4c. No escaping needed
12427 !! options
12428 disabled
12429 !! input
12430 {|
12431 |-
12432 |foo-bar
12433 |foo+bar
12434 |-
12435 |''foo''-bar
12436 |''foo''+bar
12437 |}
12438 !! result
12439 <table><tbody>
12440 <tr><td>foo-bar</td><td>foo+bar</td></tr>
12441 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
12442 </tbody></table>
12443 !! end
12444
12445 #### --------------- Links ---------------
12446 #### 1. Quote marks in link text
12447 #### 2. Wikilinks: Escapes needed
12448 #### 3. Wikilinks: No escapes needed
12449 #### 4. Extlinks: Escapes needed
12450 #### 5. Extlinks: No escapes needed
12451 #### --------------------------------------
12452 !! test
12453 Links 1. Quote marks in link text
12454 !! options
12455 disabled
12456 !! input
12457 [[Foo|<nowiki>Foo''boo''</nowiki>]]
12458 !! result
12459 <a rel="mw:WikiLink" href="Foo" data-parsoid="{&quot;tsr&quot;:[0,7],&quot;contentPos&quot;:[5,5],&quot;src&quot;:&quot;[[Foo]]&quot;,&quot;bsp&quot;:[0,7],&quot;stx&quot;:&quot;simple&quot;}">Foo''boo''</a>
12460 !! end
12461
12462 !! test
12463 Links 2. WikiLinks: Escapes needed
12464 !! options
12465 disabled
12466 !! input
12467 [[Foo|<nowiki>[Foobar]</nowiki>]]
12468 [[Foo|<nowiki>Foobar]</nowiki>]]
12469 [[Foo|<nowiki>x [Foobar] x</nowiki>]]
12470 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
12471 [[Foo|<nowiki>[[Bar]]</nowiki>]]
12472 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
12473 [[Foo|<nowiki>|Bar</nowiki>]]
12474 !! result
12475 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
12476 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
12477 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
12478 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
12479 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
12480 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
12481 <a href="Foo" rel="mw:WikiLink">|Bar</a>
12482 !! end
12483
12484 !! test
12485 Links 3. WikiLinks: No escapes needed
12486 !! options
12487 disabled
12488 !! input
12489 [[Foo|[Foobar]]
12490 [[Foo|foo|bar]]
12491 !! result
12492 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
12493 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
12494 !! end
12495
12496 !! test
12497 Links 4. ExtLinks: Escapes needed
12498 !! options
12499 disabled
12500 !! input
12501 [http://google.com <nowiki>[google]</nowiki>]
12502 [http://google.com <nowiki>google]</nowiki>]
12503 !! result
12504 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
12505 <a href="http://google.com" rel="mw:ExtLink">google]</a>
12506 !! end
12507
12508 !! test
12509 Links 5. ExtLinks: No escapes needed
12510 !! options
12511 disabled
12512 !! input
12513 [http://google.com [google]
12514 !! result
12515 <a href="http://google.com" rel="mw:ExtLink">[google</a>
12516 !! end
12517
12518 #### --------------- Quotes ---------------
12519 #### 1. Quotes inside <b> and <i>
12520 #### 2. Link fragments separated by <i> and <b> tags
12521 #### 3. Link fragments inside <i> and <b>
12522 #### --------------------------------------
12523 !! test
12524 1. Quotes inside <b> and <i>
12525 !! input
12526 ''<nowiki>'foo'</nowiki>''
12527 ''<nowiki>''foo''</nowiki>''
12528 ''<nowiki>'''foo'''</nowiki>''
12529 '''<nowiki>'foo'</nowiki>'''
12530 '''<nowiki>''foo''</nowiki>'''
12531 '''<nowiki>'''foo'''</nowiki>'''
12532 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
12533 !! result
12534 <p><i>'foo'</i>
12535 <i>''foo''</i>
12536 <i>'''foo'''</i>
12537 <b>'foo'</b>
12538 <b>''foo''</b>
12539 <b>'''foo'''</b>
12540 <b>foo'<i>bar'</i>baz</b>
12541 </p>
12542 !! end
12543
12544 !! test
12545 2. Link fragments separated by <i> and <b> tags
12546 !! input
12547 [[''foo''<nowiki>hello]]</nowiki>
12548
12549 [['''foo'''<nowiki>hello]]</nowiki>
12550 !! result
12551 <p>[[<i>foo</i>hello]]
12552 </p><p>[[<b>foo</b>hello]]
12553 </p>
12554 !! end
12555
12556 !! test
12557 2. Link fragments inside <i> and <b>
12558 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
12559 this is one of the shortcomings of this format)
12560 !! input
12561 ''[[foo''<nowiki>]]</nowiki>
12562
12563 '''[[foo'''<nowiki>]]</nowiki>
12564 !! result
12565 <p><i>[[foo</i>]]
12566 </p><p><b>[[foo</b>]]
12567 </p>
12568 !! end
12569
12570 #### --------------- Paragraphs ---------------
12571 #### 1. No unnecessary escapes
12572 #### --------------------------------------
12573
12574 !! test
12575 1. No unnecessary escapes
12576 !! input
12577 bar <span><nowiki>[[foo]]</nowiki></span>
12578
12579 =bar <span><nowiki>[[foo]]</nowiki></span>
12580
12581 [[bar <span><nowiki>[[foo]]</nowiki></span>
12582
12583 <nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
12584
12585 <nowiki>=bar </nowiki><span>foo]]</span>=
12586 !! result
12587 <p>bar <span>[[foo]]</span>
12588 </p><p>=bar <span>[[foo]]</span>
12589 </p><p>[[bar <span>[[foo]]</span>
12590 </p><p>]]bar <span>[[foo]]</span>
12591 </p><p>=bar <span>foo]]</span>=
12592 </p>
12593 !!end
12594
12595 #### --------------- PRE ------------------
12596 #### 1. Leading space in SOL context should be escaped
12597 #### --------------------------------------
12598 !! test
12599 1. Leading space in SOL context should be escaped
12600 !! options
12601 disabled
12602 !! input
12603 <nowiki> foo</nowiki>
12604 <!--cmt--><nowiki> foo</nowiki>
12605 !! result
12606 <p> foo
12607 <!--cmt--> foo
12608 </p>
12609 !! end
12610
12611 #### --------------- HTML tags ---------------
12612 #### 1. a tags
12613 #### 2. other tags
12614 #### 3. multi-line html tag
12615 #### --------------------------------------
12616 !! test
12617 1. a tags
12618 !! options
12619 disabled
12620 !! input
12621 <a href="http://google.com">google</a>
12622 !! result
12623 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
12624 !! end
12625
12626 !! test
12627 2. other tags
12628 !! input
12629 <nowiki><div>foo</div>
12630 <div style="color:red">foo</div></nowiki>
12631 !! result
12632 <p>&lt;div&gt;foo&lt;/div&gt;
12633 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
12634 </p>
12635 !! end
12636
12637 !! test
12638 3. multi-line html tag
12639 !! input
12640 <nowiki><div
12641 >foo</div
12642 ></nowiki>
12643 !! result
12644 <p>&lt;div
12645 &gt;foo&lt;/div
12646 &gt;
12647 </p>
12648 !! end
12649
12650 #### --------------- Others ---------------
12651 !! test
12652 Escaping nowikis
12653 !! input
12654 &lt;nowiki&gt;foo&lt;/nowiki&gt;
12655 !! result
12656 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
12657 </p>
12658 !! end
12659
12660 TODO:
12661 more images
12662 more tables
12663 character entities
12664 and much more
12665 Try for 100% code coverage