Merge "Fix prop=userid in list=protectedtitles"
[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 ###
2828 ### Internal links
2829 ###
2830 !! test
2831 Plain link, capitalized
2832 !! input
2833 [[Main Page]]
2834 !! result
2835 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
2836 </p>
2837 !! end
2838
2839 !! test
2840 Plain link, uncapitalized
2841 !! input
2842 [[main Page]]
2843 !! result
2844 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
2845 </p>
2846 !! end
2847
2848 !! test
2849 Piped link
2850 !! input
2851 [[Main Page|The Main Page]]
2852 !! result
2853 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
2854 </p>
2855 !! end
2856
2857 !! test
2858 Broken link
2859 !! input
2860 [[Zigzagzogzagzig]]
2861 !! result
2862 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
2863 </p>
2864 !! end
2865
2866 !! test
2867 Broken link with fragment
2868 !! input
2869 [[Zigzagzogzagzig#zug]]
2870 !! result
2871 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
2872 </p>
2873 !! end
2874
2875 !! test
2876 Special page link with fragment
2877 !! input
2878 [[Special:Version#anchor]]
2879 !! result
2880 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
2881 </p>
2882 !! end
2883
2884 !! test
2885 Nonexistent special page link with fragment
2886 !! input
2887 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
2888 !! result
2889 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
2890 </p>
2891 !! end
2892
2893 !! test
2894 Link with prefix
2895 !! input
2896 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
2897 !! result
2898 <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>
2899 </p>
2900 !! end
2901
2902 !! test
2903 Link with suffix
2904 !! input
2905 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
2906 !! result
2907 <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>!!!
2908 </p>
2909 !! end
2910
2911 !! test
2912 Link with 3 brackets
2913 !! input
2914 [[[main page]]]
2915 !! result
2916 <p>[[[main page]]]
2917 </p>
2918 !! end
2919
2920 !! test
2921 Piped link with 3 brackets
2922 !! input
2923 [[[main page|the main page]]]
2924 !! result
2925 <p>[[[main page|the main page]]]
2926 </p>
2927 !! end
2928
2929 !! test
2930 Link with multiple pipes
2931 !! input
2932 [[Main Page|The|Main|Page]]
2933 !! result
2934 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
2935 </p>
2936 !! end
2937
2938 !! test
2939 Link to namespaces
2940 !! input
2941 [[Talk:Parser testing]], [[Meta:Disclaimers]]
2942 !! result
2943 <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>
2944 </p>
2945 !! end
2946
2947 !! test
2948 Piped link to namespace
2949 !! input
2950 [[Meta:Disclaimers|The disclaimers]]
2951 !! result
2952 <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>
2953 </p>
2954 !! end
2955
2956 !! test
2957 Link containing }
2958 !! input
2959 [[Usually caused by a typo (oops}]]
2960 !! result
2961 <p>[[Usually caused by a typo (oops}]]
2962 </p>
2963 !! end
2964
2965 !! test
2966 Link containing % (not as a hex sequence)
2967 !! input
2968 [[7% Solution]]
2969 !! result
2970 <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>
2971 </p>
2972 !! end
2973
2974 !! test
2975 Link containing % as a single hex sequence interpreted to char
2976 !! input
2977 [[7%25 Solution]]
2978 !! result
2979 <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>
2980 </p>
2981 !!end
2982
2983 !! test
2984 Link containing % as a double hex sequence interpreted to hex sequence
2985 !! input
2986 [[7%2525 Solution]]
2987 !! result
2988 <p>[[7%2525 Solution]]
2989 </p>
2990 !!end
2991
2992 !! test
2993 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
2994 Example for such a section: == < ==
2995 !! input
2996 [[%23%3c]][[%23%3e]]
2997 !! result
2998 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
2999 </p>
3000 !! end
3001
3002 !! test
3003 Link containing "<#" and ">#" as a hex sequences
3004 !! input
3005 [[%3c%23]][[%3e%23]]
3006 !! result
3007 <p>[[%3c%23]][[%3e%23]]
3008 </p>
3009 !! end
3010
3011 !! test
3012 Link containing double-single-quotes '' (bug 4598)
3013 !! input
3014 [[Lista d''e paise d''o munno]]
3015 !! result
3016 <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>
3017 </p>
3018 !! end
3019
3020 !! test
3021 Link containing double-single-quotes '' in text (bug 4598 sanity check)
3022 !! input
3023 Some [[Link|pretty ''italics'' and stuff]]!
3024 !! result
3025 <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>!
3026 </p>
3027 !! end
3028
3029 !! test
3030 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
3031 !! input
3032 ''Some [[Link|pretty ''italics'' and stuff]]!
3033 !! result
3034 <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>
3035 </p>
3036 !! end
3037
3038 !! test
3039 Link with double quotes in title part (literal) and alternate part (interpreted)
3040 !! input
3041 [[File:Denys Savchenko ''Pentecoste''.jpg]]
3042
3043 [[''Pentecoste'']]
3044
3045 [[''Pentecoste''|Pentecoste]]
3046
3047 [[''Pentecoste''|''Pentecoste'']]
3048 !! result
3049 <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>
3050 </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>
3051 </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>
3052 </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>
3053 </p>
3054 !! end
3055
3056 !! test
3057 Broken image links with HTML captions (bug 39700)
3058 !! input
3059 [[File:Nonexistent|<script></script>]]
3060 [[File:Nonexistent|100px|<script></script>]]
3061 [[File:Nonexistent|&lt;]]
3062 [[File:Nonexistent|a<i>b</i>c]]
3063 !! result
3064 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3065 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3066 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
3067 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
3068 </p>
3069 !! end
3070
3071 !! test
3072 Plain link to URL
3073 !! input
3074 [[http://www.example.com]]
3075 !! result
3076 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
3077 </p>
3078 !! end
3079
3080 !! test
3081 Plain link to URL with link text
3082 !! input
3083 [[http://www.example.com Link text]]
3084 !! result
3085 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
3086 </p>
3087 !! end
3088
3089 !! test
3090 Plain link to protocol-relative URL
3091 !! input
3092 [[//www.example.com]]
3093 !! result
3094 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
3095 </p>
3096 !! end
3097
3098 !! test
3099 Plain link to protocol-relative URL with link text
3100 !! input
3101 [[//www.example.com Link text]]
3102 !! result
3103 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
3104 </p>
3105 !! end
3106
3107
3108 # I'm fairly sure the expected result here is wrong.
3109 # We want these to be URL links, not pseudo-pages with URLs for titles....
3110 # However the current output is also pretty screwy.
3111 #
3112 # ----
3113 # I'm changing it to match the current output--it arguably makes more
3114 # sense in the light of the test above. Old expected result was:
3115 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
3116 #</p>
3117 # But I think this test is bordering on "garbage in, garbage out" anyway.
3118 # -- wtm
3119 !! test
3120 Piped link to URL
3121 !! input
3122 Piped link to URL: [[http://www.example.com|an example URL]]
3123 !! result
3124 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
3125 </p>
3126 !! end
3127
3128 !! test
3129 BUG 2: [[page|http://url/]] should link to page, not http://url/
3130 !! input
3131 [[Main Page|http://url/]]
3132 !! result
3133 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
3134 </p>
3135 !! end
3136
3137 !! test
3138 BUG 337: Escaped self-links should be bold
3139 !! options
3140 title=[[Bug462]]
3141 !! input
3142 [[Bu&#103;462]] [[Bug462]]
3143 !! result
3144 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
3145 </p>
3146 !! end
3147
3148 !! test
3149 Self-link to section should not be bold
3150 !! options
3151 title=[[Main Page]]
3152 !! input
3153 [[Main Page#section]]
3154 !! result
3155 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
3156 </p>
3157 !! end
3158
3159 !! article
3160 00
3161 !! text
3162 This is 00.
3163 !! endarticle
3164
3165 !!test
3166 Self-link to numeric title
3167 !!options
3168 title=[[0]]
3169 !!input
3170 [[0]]
3171 !!result
3172 <p><strong class="selflink">0</strong>
3173 </p>
3174 !!end
3175
3176 !!test
3177 Link to numeric-equivalent title
3178 !!options
3179 title=[[0]]
3180 !!input
3181 [[00]]
3182 !!result
3183 <p><a href="/wiki/00" title="00">00</a>
3184 </p>
3185 !!end
3186
3187 !! test
3188 <nowiki> inside a link
3189 !! input
3190 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
3191 !! result
3192 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
3193 </p>
3194 !! end
3195
3196 !! test
3197 Non-breaking spaces in title
3198 !! input
3199 [[&nbsp; Main &nbsp; Page &nbsp;]]
3200 !! result
3201 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
3202 </p>
3203 !!end
3204
3205 !! test
3206 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
3207 !! options
3208 language=ca
3209 !! input
3210 '''[[Main Page]]'''
3211 !! result
3212 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
3213 </p>
3214 !! end
3215
3216 !! test
3217 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
3218 !! options
3219 language=ca
3220 !! input
3221 ''[[Main Page]]''
3222 !! result
3223 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
3224 </p>
3225 !! end
3226
3227 !! test
3228 Internal link with en linktrail: no apostrophes (bug 27473)
3229 !! options
3230 language=en
3231 !! input
3232 [[Something]]'nice
3233 !! result
3234 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
3235 </p>
3236 !! end
3237
3238 !! test
3239 Internal link with ca linktrail with apostrophes (bug 27473)
3240 !! options
3241 language=ca
3242 !! input
3243 [[Something]]'nice
3244 !! result
3245 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
3246 </p>
3247 !! end
3248
3249 !! test
3250 Internal link with kaa linktrail with apostrophes (bug 27473)
3251 !! options
3252 language=kaa
3253 !! input
3254 [[Something]]'nice
3255 !! result
3256 <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>
3257 </p>
3258 !! end
3259
3260 ###
3261 ### Interwiki links (see maintenance/interwiki.sql)
3262 ###
3263
3264 !! test
3265 Inline interwiki link
3266 !! input
3267 [[MeatBall:SoftSecurity]]
3268 !! result
3269 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
3270 </p>
3271 !! end
3272
3273 !! test
3274 Inline interwiki link with empty title (bug 2372)
3275 !! input
3276 [[MeatBall:]]
3277 !! result
3278 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
3279 </p>
3280 !! end
3281
3282 !! test
3283 Interwiki link encoding conversion (bug 1636)
3284 !! input
3285 *[[Wikipedia:ro:Olteni&#0355;a]]
3286 *[[Wikipedia:ro:Olteni&#355;a]]
3287 !! result
3288 <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>
3289 </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>
3290 </li></ul>
3291
3292 !! end
3293
3294 !! test
3295 Interwiki link with fragment (bug 2130)
3296 !! input
3297 [[MeatBall:SoftSecurity#foo]]
3298 !! result
3299 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
3300 </p>
3301 !! end
3302
3303 !! test
3304 Interlanguage link
3305 !! input
3306 Blah blah blah
3307 [[zh:Chinese]]
3308 !!result
3309 <p>Blah blah blah
3310 </p>
3311 !! end
3312
3313 !! test
3314 Double interlanguage link
3315 !! input
3316 Blah blah blah
3317 [[es:Spanish]]
3318 [[zh:Chinese]]
3319 !!result
3320 <p>Blah blah blah
3321 </p>
3322 !! end
3323
3324 !! test
3325 Interlanguage link, with prefix links
3326 !! options
3327 language=ln
3328 !! input
3329 Blah blah blah
3330 [[zh:Chinese]]
3331 !!result
3332 <p>Blah blah blah
3333 </p>
3334 !! end
3335
3336 !! test
3337 Double interlanguage link, with prefix links (bug 8897)
3338 !! options
3339 language=ln
3340 !! input
3341 Blah blah blah
3342 [[es:Spanish]]
3343 [[zh:Chinese]]
3344 !!result
3345 <p>Blah blah blah
3346 </p>
3347 !! end
3348
3349 !! test
3350 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
3351 !! options
3352 language=ln
3353 !! input
3354 [[WW&nbsp;II]]
3355 !!result
3356 <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>
3357 </p>
3358 !! end
3359
3360 ##
3361 ## XHTML tidiness
3362 ###
3363
3364 !! test
3365 <br> to <br />
3366 !! input
3367 1<br>2<br />3
3368 !! result
3369 <p>1<br />2<br />3
3370 </p>
3371 !! end
3372
3373 !! test
3374 Broken br tag sanitization
3375 !! input
3376 </br>
3377 !! result
3378 <p>&lt;/br&gt;
3379 </p>
3380 !! end
3381
3382 !! test
3383 Incorrecly removing closing slashes from correctly formed XHTML
3384 !! input
3385 <br style="clear:both;" />
3386 !! result
3387 <p><br style="clear:both;" />
3388 </p>
3389 !! end
3390
3391 !! test
3392 Failing to transform badly formed HTML into correct XHTML
3393 !! input
3394 <br style="clear: left;">
3395 <br style="clear: right;">
3396 <br style="clear: both;">
3397 !! result
3398 <p><br style="clear: left;" />
3399 <br style="clear: right;" />
3400 <br style="clear: both;" />
3401 </p>
3402 !!end
3403
3404 !! test
3405 Handling html with a div self-closing tag
3406 !! input
3407 <div title />
3408 <div title/>
3409 <div title/ >
3410 <div title=bar />
3411 <div title=bar/>
3412 <div title=bar/ >
3413 !! result
3414 <p>&lt;div title /&gt;
3415 &lt;div title/&gt;
3416 </p>
3417 <div>
3418 <p>&lt;div title=bar /&gt;
3419 &lt;div title=bar/&gt;
3420 </p>
3421 <div title="bar/"></div>
3422 </div>
3423
3424 !! end
3425
3426 !! test
3427 Handling html with a br self-closing tag
3428 !! input
3429 <br title />
3430 <br title/>
3431 <br title/ >
3432 <br title=bar />
3433 <br title=bar/>
3434 <br title=bar/ >
3435 !! result
3436 <p><br title="title" />
3437 <br title="title" />
3438 <br />
3439 <br title="bar" />
3440 <br title="bar" />
3441 <br title="bar/" />
3442 </p>
3443 !! end
3444
3445 !! test
3446 Horizontal ruler (should it add that extra space?)
3447 !! input
3448 <hr>
3449 <hr >
3450 foo <hr
3451 > bar
3452 !! result
3453 <hr />
3454 <hr />
3455 foo <hr /> bar
3456
3457 !! end
3458
3459 !! test
3460 Horizontal ruler -- 4+ dashes render hr
3461 !! input
3462 ----
3463 !! result
3464 <hr />
3465
3466 !! end
3467
3468 !! test
3469 Horizontal ruler -- eats additional dashes on the same line
3470 !! input
3471 ---------
3472 !! result
3473 <hr />
3474
3475 !! end
3476
3477 !! test
3478 Horizontal ruler -- does not collaps dashes on consecutive lines
3479 !! input
3480 ----
3481 ----
3482 !! result
3483 <hr />
3484 <hr />
3485
3486 !! end
3487
3488 !! test
3489 Horizontal ruler -- <4 dashes render as plain text
3490 !! input
3491 ---
3492 !! result
3493 <p>---
3494 </p>
3495 !! end
3496
3497 ###
3498 ### Block-level elements
3499 ###
3500 !! test
3501 Common list
3502 !! input
3503 *Common list
3504 * item 2
3505 *item 3
3506 !! result
3507 <ul><li>Common list
3508 </li><li> item 2
3509 </li><li>item 3
3510 </li></ul>
3511
3512 !! end
3513
3514 !! test
3515 Numbered list
3516 !! input
3517 #Numbered list
3518 #item 2
3519 # item 3
3520 !! result
3521 <ol><li>Numbered list
3522 </li><li>item 2
3523 </li><li> item 3
3524 </li></ol>
3525
3526 !! end
3527
3528 !! test
3529 Mixed list
3530 !! input
3531 *Mixed list
3532 *# with numbers
3533 ** and bullets
3534 *# and numbers
3535 *bullets again
3536 **bullet level 2
3537 ***bullet level 3
3538 ***#Number on level 4
3539 **bullet level 2
3540 **#Number on level 3
3541 **#Number on level 3
3542 *#number level 2
3543 *Level 1
3544 *** Level 3
3545 #** Level 3, but ordered
3546 !! result
3547 <ul><li>Mixed list
3548 <ol><li> with numbers
3549 </li></ol>
3550 <ul><li> and bullets
3551 </li></ul>
3552 <ol><li> and numbers
3553 </li></ol>
3554 </li><li>bullets again
3555 <ul><li>bullet level 2
3556 <ul><li>bullet level 3
3557 <ol><li>Number on level 4
3558 </li></ol>
3559 </li></ul>
3560 </li><li>bullet level 2
3561 <ol><li>Number on level 3
3562 </li><li>Number on level 3
3563 </li></ol>
3564 </li></ul>
3565 <ol><li>number level 2
3566 </li></ol>
3567 </li><li>Level 1
3568 <ul><li><ul><li> Level 3
3569 </li></ul>
3570 </li></ul>
3571 </li></ul>
3572 <ol><li><ul><li><ul><li> Level 3, but ordered
3573 </li></ul>
3574 </li></ul>
3575 </li></ol>
3576
3577 !! end
3578
3579 !! test
3580 Nested lists 1
3581 !! input
3582 *foo
3583 **bar
3584 !! result
3585 <ul><li>foo
3586 <ul><li>bar
3587 </li></ul>
3588 </li></ul>
3589
3590 !! end
3591
3592 !! test
3593 Nested lists 2
3594 !! input
3595 **foo
3596 *bar
3597 !! result
3598 <ul><li><ul><li>foo
3599 </li></ul>
3600 </li><li>bar
3601 </li></ul>
3602
3603 !! end
3604
3605 !! test
3606 Nested lists 3 (first element empty)
3607 !! input
3608 *
3609 **bar
3610 !! result
3611 <ul><li>
3612 <ul><li>bar
3613 </li></ul>
3614 </li></ul>
3615
3616 !! end
3617
3618 !! test
3619 Nested lists 4 (first element empty)
3620 !! input
3621 **
3622 *bar
3623 !! result
3624 <ul><li><ul><li>
3625 </li></ul>
3626 </li><li>bar
3627 </li></ul>
3628
3629 !! end
3630
3631 !! test
3632 Nested lists 5 (both elements empty)
3633 !! input
3634 **
3635 *
3636 !! result
3637 <ul><li><ul><li>
3638 </li></ul>
3639 </li><li>
3640 </li></ul>
3641
3642 !! end
3643
3644 !! test
3645 Nested lists 6 (both elements empty)
3646 !! input
3647 *
3648 **
3649 !! result
3650 <ul><li>
3651 <ul><li>
3652 </li></ul>
3653 </li></ul>
3654
3655 !! end
3656
3657 !! test
3658 Nested lists 7 (skip initial nesting levels)
3659 !! input
3660 *** foo
3661 !! result
3662 <ul><li><ul><li><ul><li> foo
3663 </li></ul>
3664 </li></ul>
3665 </li></ul>
3666
3667 !! end
3668
3669 !! test
3670 Nested lists 8 (multiple nesting transitions)
3671 !! input
3672 * foo
3673 *** bar
3674 ** baz
3675 * boo
3676 !! result
3677 <ul><li> foo
3678 <ul><li><ul><li> bar
3679 </li></ul>
3680 </li><li> baz
3681 </li></ul>
3682 </li><li> boo
3683 </li></ul>
3684
3685 !! end
3686
3687 !! test
3688 1. Lists with start-of-line-transparent tokens before bullets: Comments
3689 !! input
3690 *foo
3691 *<!--cmt-->bar
3692 <!--cmt-->*baz
3693 !! result
3694 <ul><li>foo
3695 </li><li>bar
3696 </li><li>baz
3697 </li></ul>
3698
3699 !! end
3700
3701 !! test
3702 2. Lists with start-of-line-transparent tokens before bullets: Template close
3703 !! input
3704 *foo {{echo|bar
3705 }}*baz
3706 !! result
3707 <ul><li>foo bar
3708 </li><li>baz
3709 </li></ul>
3710
3711 !! end
3712
3713 !! test
3714 List items are not parsed correctly following a <pre> block (bug 785)
3715 !! input
3716 * <pre>foo</pre>
3717 * <pre>bar</pre>
3718 * zar
3719 !! result
3720 <ul><li> <pre>foo</pre>
3721 </li><li> <pre>bar</pre>
3722 </li><li> zar
3723 </li></ul>
3724
3725 !! end
3726
3727 !! test
3728 List items from template
3729 !! input
3730
3731 {{inner list}}
3732 * item 2
3733
3734 * item 0
3735 {{inner list}}
3736 * item 2
3737
3738 * item 0
3739 * notSOL{{inner list}}
3740 * item 2
3741 !! result
3742 <ul><li> item 1
3743 </li><li> item 2
3744 </li></ul>
3745 <ul><li> item 0
3746 </li><li> item 1
3747 </li><li> item 2
3748 </li></ul>
3749 <ul><li> item 0
3750 </li><li> notSOL
3751 </li><li> item 1
3752 </li><li> item 2
3753 </li></ul>
3754
3755 !! end
3756
3757 !! test
3758 List interrupted by empty line or heading
3759 !! input
3760 * foo
3761
3762 ** bar
3763 == A heading ==
3764 * Another list item
3765 !! result
3766 <ul><li> foo
3767 </li></ul>
3768 <ul><li><ul><li> bar
3769 </li></ul>
3770 </li></ul>
3771 <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>
3772 <ul><li> Another list item
3773 </li></ul>
3774
3775 !!end
3776
3777
3778 ###
3779 ### Magic Words
3780 ###
3781
3782 !! test
3783 Magic Word: {{CURRENTDAY}}
3784 !! input
3785 {{CURRENTDAY}}
3786 !! result
3787 <p>1
3788 </p>
3789 !! end
3790
3791 !! test
3792 Magic Word: {{CURRENTDAY2}}
3793 !! input
3794 {{CURRENTDAY2}}
3795 !! result
3796 <p>01
3797 </p>
3798 !! end
3799
3800 !! test
3801 Magic Word: {{CURRENTDAYNAME}}
3802 !! input
3803 {{CURRENTDAYNAME}}
3804 !! result
3805 <p>Thursday
3806 </p>
3807 !! end
3808
3809 !! test
3810 Magic Word: {{CURRENTDOW}}
3811 !! input
3812 {{CURRENTDOW}}
3813 !! result
3814 <p>4
3815 </p>
3816 !! end
3817
3818 !! test
3819 Magic Word: {{CURRENTMONTH}}
3820 !! input
3821 {{CURRENTMONTH}}
3822 !! result
3823 <p>01
3824 </p>
3825 !! end
3826
3827 !! test
3828 Magic Word: {{CURRENTMONTHABBREV}}
3829 !! input
3830 {{CURRENTMONTHABBREV}}
3831 !! result
3832 <p>Jan
3833 </p>
3834 !! end
3835
3836 !! test
3837 Magic Word: {{CURRENTMONTHNAME}}
3838 !! input
3839 {{CURRENTMONTHNAME}}
3840 !! result
3841 <p>January
3842 </p>
3843 !! end
3844
3845 !! test
3846 Magic Word: {{CURRENTMONTHNAMEGEN}}
3847 !! input
3848 {{CURRENTMONTHNAMEGEN}}
3849 !! result
3850 <p>January
3851 </p>
3852 !! end
3853
3854 !! test
3855 Magic Word: {{CURRENTTIME}}
3856 !! input
3857 {{CURRENTTIME}}
3858 !! result
3859 <p>00:02
3860 </p>
3861 !! end
3862
3863 !! test
3864 Magic Word: {{CURRENTWEEK}} (@bug 4594)
3865 !! input
3866 {{CURRENTWEEK}}
3867 !! result
3868 <p>1
3869 </p>
3870 !! end
3871
3872 !! test
3873 Magic Word: {{CURRENTYEAR}}
3874 !! input
3875 {{CURRENTYEAR}}
3876 !! result
3877 <p>1970
3878 </p>
3879 !! end
3880
3881 !! test
3882 Magic Word: {{FULLPAGENAME}}
3883 !! options
3884 title=[[User:Ævar Arnfjörð Bjarmason]]
3885 !! input
3886 {{FULLPAGENAME}}
3887 !! result
3888 <p>User:Ævar Arnfjörð Bjarmason
3889 </p>
3890 !! end
3891
3892 !! test
3893 Magic Word: {{FULLPAGENAMEE}}
3894 !! options
3895 title=[[User:Ævar Arnfjörð Bjarmason]]
3896 !! input
3897 {{FULLPAGENAMEE}}
3898 !! result
3899 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
3900 </p>
3901 !! end
3902
3903 !! test
3904 Magic Word: {{NAMESPACE}}
3905 !! options
3906 title=[[User:Ævar Arnfjörð Bjarmason]]
3907 !! input
3908 {{NAMESPACE}}
3909 !! result
3910 <p>User
3911 </p>
3912 !! end
3913
3914 !! test
3915 Magic Word: {{NAMESPACEE}}
3916 !! options
3917 title=[[User:Ævar Arnfjörð Bjarmason]]
3918 !! input
3919 {{NAMESPACEE}}
3920 !! result
3921 <p>User
3922 </p>
3923 !! end
3924
3925 !! test
3926 Magic Word: {{NAMESPACENUMBER}}
3927 !! options
3928 title=[[User:Ævar Arnfjörð Bjarmason]]
3929 !! input
3930 {{NAMESPACENUMBER}}
3931 !! result
3932 <p>2
3933 </p>
3934 !! end
3935
3936 !! test
3937 Magic Word: {{NUMBEROFFILES}}
3938 !! input
3939 {{NUMBEROFFILES}}
3940 !! result
3941 <p>2
3942 </p>
3943 !! end
3944
3945 !! test
3946 Magic Word: {{PAGENAME}}
3947 !! options
3948 title=[[User:Ævar Arnfjörð Bjarmason]]
3949 !! input
3950 {{PAGENAME}}
3951 !! result
3952 <p>Ævar Arnfjörð Bjarmason
3953 </p>
3954 !! end
3955
3956 !! test
3957 Magic Word: {{PAGENAME}} with metacharacters
3958 !! options
3959 title=[['foo & bar = baz']]
3960 !! input
3961 ''{{PAGENAME}}''
3962 !! result
3963 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
3964 </p>
3965 !! end
3966
3967 !! test
3968 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
3969 !! options
3970 title=[[*RFC 1234 http://example.com/]]
3971 !! input
3972 {{PAGENAME}}
3973 !! result
3974 <p>&#42;RFC&#32;1234 http&#58;//example.com/
3975 </p>
3976 !! end
3977
3978 !! test
3979 Magic Word: {{PAGENAMEE}}
3980 !! options
3981 title=[[User:Ævar Arnfjörð Bjarmason]]
3982 !! input
3983 {{PAGENAMEE}}
3984 !! result
3985 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
3986 </p>
3987 !! end
3988
3989 !! test
3990 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
3991 !! options
3992 title=[[*RFC 1234 http://example.com/]]
3993 !! input
3994 {{PAGENAMEE}}
3995 !! result
3996 <p>&#42;RFC_1234_http&#58;//example.com/
3997 </p>
3998 !! end
3999
4000 !! test
4001 Magic Word: {{REVISIONID}}
4002 !! input
4003 {{REVISIONID}}
4004 !! result
4005 <p>1337
4006 </p>
4007 !! end
4008
4009 !! test
4010 Magic Word: {{SCRIPTPATH}}
4011 !! input
4012 {{SCRIPTPATH}}
4013 !! result
4014 <p>/
4015 </p>
4016 !! end
4017
4018 !! test
4019 Magic Word: {{SERVER}}
4020 !! input
4021 {{SERVER}}
4022 !! result
4023 <p><a rel="nofollow" class="external free" href="http://Britney-Spears">http://Britney-Spears</a>
4024 </p>
4025 !! end
4026
4027 !! test
4028 Magic Word: {{SERVERNAME}}
4029 !! input
4030 {{SERVERNAME}}
4031 !! result
4032 <p>Britney-Spears
4033 </p>
4034 !! end
4035
4036 !! test
4037 Magic Word: {{SITENAME}}
4038 !! input
4039 {{SITENAME}}
4040 !! result
4041 <p>MediaWiki
4042 </p>
4043 !! end
4044
4045 !! test
4046 Namespace 1 {{ns:1}}
4047 !! input
4048 {{ns:1}}
4049 !! result
4050 <p>Talk
4051 </p>
4052 !! end
4053
4054 !! test
4055 Namespace 1 {{ns:01}}
4056 !! input
4057 {{ns:01}}
4058 !! result
4059 <p>Talk
4060 </p>
4061 !! end
4062
4063 !! test
4064 Namespace 0 {{ns:0}} (bug 4783)
4065 !! input
4066 {{ns:0}}
4067 !! result
4068
4069 !! end
4070
4071 !! test
4072 Namespace 0 {{ns:00}} (bug 4783)
4073 !! input
4074 {{ns:00}}
4075 !! result
4076
4077 !! end
4078
4079 !! test
4080 Namespace -1 {{ns:-1}}
4081 !! input
4082 {{ns:-1}}
4083 !! result
4084 <p>Special
4085 </p>
4086 !! end
4087
4088 !! test
4089 Namespace User {{ns:User}}
4090 !! input
4091 {{ns:User}}
4092 !! result
4093 <p>User
4094 </p>
4095 !! end
4096
4097 !! test
4098 Namespace User talk {{ns:User_talk}}
4099 !! input
4100 {{ns:User_talk}}
4101 !! result
4102 <p>User talk
4103 </p>
4104 !! end
4105
4106 !! test
4107 Namespace User talk {{ns:uSeR tAlK}}
4108 !! input
4109 {{ns:uSeR tAlK}}
4110 !! result
4111 <p>User talk
4112 </p>
4113 !! end
4114
4115 !! test
4116 Namespace File {{ns:File}}
4117 !! input
4118 {{ns:File}}
4119 !! result
4120 <p>File
4121 </p>
4122 !! end
4123
4124 !! test
4125 Namespace File {{ns:Image}}
4126 !! input
4127 {{ns:Image}}
4128 !! result
4129 <p>File
4130 </p>
4131 !! end
4132
4133 !! test
4134 Namespace (lang=de) Benutzer {{ns:User}}
4135 !! options
4136 language=de
4137 !! input
4138 {{ns:User}}
4139 !! result
4140 <p>Benutzer
4141 </p>
4142 !! end
4143
4144 !! test
4145 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
4146 !! options
4147 language=de
4148 !! input
4149 {{ns:3}}
4150 !! result
4151 <p>Benutzer Diskussion
4152 </p>
4153 !! end
4154
4155
4156 !! test
4157 Urlencode
4158 !! input
4159 {{urlencode:hi world?!}}
4160 {{urlencode:hi world?!|WIKI}}
4161 {{urlencode:hi world?!|PATH}}
4162 {{urlencode:hi world?!|QUERY}}
4163 !! result
4164 <p>hi+world%3F%21
4165 hi_world%3F!
4166 hi%20world%3F%21
4167 hi+world%3F%21
4168 </p>
4169 !! end
4170
4171 ###
4172 ### Magic links
4173 ###
4174 !! test
4175 Magic links: internal link to RFC (bug 479)
4176 !! input
4177 [[RFC 123]]
4178 !! result
4179 <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>
4180 </p>
4181 !! end
4182
4183 !! test
4184 Magic links: RFC (bug 479)
4185 !! input
4186 RFC 822
4187 !! result
4188 <p><a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc822">RFC 822</a>
4189 </p>
4190 !! end
4191
4192 !! test
4193 Magic links: ISBN (bug 1937)
4194 !! input
4195 ISBN 0-306-40615-2
4196 !! result
4197 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
4198 </p>
4199 !! end
4200
4201 !! test
4202 Magic links: PMID incorrectly converts space to underscore
4203 !! input
4204 PMID 1234
4205 !! result
4206 <p><a class="external mw-magiclink-pmid" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
4207 </p>
4208 !! end
4209
4210 ###
4211 ### Templates
4212 ####
4213
4214 !! test
4215 Nonexistent template
4216 !! input
4217 {{thistemplatedoesnotexist}}
4218 !! result
4219 <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>
4220 </p>
4221 !! end
4222
4223 !! article
4224 Template:test
4225 !! text
4226 This is a test template
4227 !! endarticle
4228
4229 !! test
4230 Simple template
4231 !! input
4232 {{test}}
4233 !! result
4234 <p>This is a test template
4235 </p>
4236 !! end
4237
4238 !! test
4239 Template with explicit namespace
4240 !! input
4241 {{Template:test}}
4242 !! result
4243 <p>This is a test template
4244 </p>
4245 !! end
4246
4247
4248 !! article
4249 Template:paramtest
4250 !! text
4251 This is a test template with parameter {{{param}}}
4252 !! endarticle
4253
4254 !! test
4255 Template parameter
4256 !! input
4257 {{paramtest|param=foo}}
4258 !! result
4259 <p>This is a test template with parameter foo
4260 </p>
4261 !! end
4262
4263 !! article
4264 Template:paramtestnum
4265 !! text
4266 [[{{{1}}}|{{{2}}}]]
4267 !! endarticle
4268
4269 !! test
4270 Template unnamed parameter
4271 !! input
4272 {{paramtestnum|Main Page|the main page}}
4273 !! result
4274 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
4275 </p>
4276 !! end
4277
4278 !! article
4279 Template:templatesimple
4280 !! text
4281 (test)
4282 !! endarticle
4283
4284 !! article
4285 Template:templateredirect
4286 !! text
4287 #redirect [[Template:templatesimple]]
4288 !! endarticle
4289
4290 !! article
4291 Template:templateasargtestnum
4292 !! text
4293 {{{{{1}}}}}
4294 !! endarticle
4295
4296 !! article
4297 Template:templateasargtest
4298 !! text
4299 {{template{{{templ}}}}}
4300 !! endarticle
4301
4302 !! article
4303 Template:templateasargtest2
4304 !! text
4305 {{{{{templ}}}}}
4306 !! endarticle
4307
4308 !! test
4309 Template with template name as unnamed argument
4310 !! input
4311 {{templateasargtestnum|templatesimple}}
4312 !! result
4313 <p>(test)
4314 </p>
4315 !! end
4316
4317 !! test
4318 Template with template name as argument
4319 !! input
4320 {{templateasargtest|templ=simple}}
4321 !! result
4322 <p>(test)
4323 </p>
4324 !! end
4325
4326 !! test
4327 Template with template name as argument (2)
4328 !! input
4329 {{templateasargtest2|templ=templatesimple}}
4330 !! result
4331 <p>(test)
4332 </p>
4333 !! end
4334
4335 !! article
4336 Template:templateasargtestdefault
4337 !! text
4338 {{{{{templ|templatesimple}}}}}
4339 !! endarticle
4340
4341 !! article
4342 Template:templa
4343 !! text
4344 '''templ'''
4345 !! endarticle
4346
4347 !! test
4348 Template with default value
4349 !! input
4350 {{templateasargtestdefault}}
4351 !! result
4352 <p>(test)
4353 </p>
4354 !! end
4355
4356 !! test
4357 Template with default value (value set)
4358 !! input
4359 {{templateasargtestdefault|templ=templa}}
4360 !! result
4361 <p><b>templ</b>
4362 </p>
4363 !! end
4364
4365 !! test
4366 Template redirect
4367 !! input
4368 {{templateredirect}}
4369 !! result
4370 <p>(test)
4371 </p>
4372 !! end
4373
4374 !! test
4375 Template with argument in separate line
4376 !! input
4377 {{ templateasargtest |
4378 templ = simple }}
4379 !! result
4380 <p>(test)
4381 </p>
4382 !! end
4383
4384 !! test
4385 Template with complex template as argument
4386 !! input
4387 {{paramtest|
4388 param ={{ templateasargtest |
4389 templ = simple }}}}
4390 !! result
4391 <p>This is a test template with parameter (test)
4392 </p>
4393 !! end
4394
4395 !! test
4396 Template with thumb image (with link in description)
4397 !! input
4398 {{paramtest|
4399 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
4400 !! result
4401 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>
4402
4403 !! end
4404
4405 !! article
4406 Template:complextemplate
4407 !! text
4408 {{{1}}} {{paramtest|
4409 param ={{{param}}}}}
4410 !! endarticle
4411
4412 !! test
4413 Template with complex arguments
4414 !! input
4415 {{complextemplate|
4416 param ={{ templateasargtest |
4417 templ = simple }}|[[Template:complextemplate|link]]}}
4418 !! result
4419 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
4420 </p>
4421 !! end
4422
4423 !! test
4424 BUG 553: link with two variables in a piped link
4425 !! input
4426 {|
4427 |[[{{{1}}}|{{{2}}}]]
4428 |}
4429 !! result
4430 <table>
4431 <tr>
4432 <td>[[{{{1}}}|{{{2}}}]]
4433 </td></tr></table>
4434
4435 !! end
4436
4437 !! test
4438 Magic variable as template parameter
4439 !! input
4440 {{paramtest|param={{SITENAME}}}}
4441 !! result
4442 <p>This is a test template with parameter MediaWiki
4443 </p>
4444 !! end
4445
4446 !! article
4447 Template:linktest
4448 !! text
4449 [[{{{param}}}|link]]
4450 !! endarticle
4451
4452 !! test
4453 Template parameter as link source
4454 !! input
4455 {{linktest|param=Main Page}}
4456 !! result
4457 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
4458 </p>
4459 !! end
4460
4461 !!test
4462 Template-generated attribute string (k='v')
4463 !!input
4464 <span {{attr_str|id|v1}}>bar</span>
4465 !!result
4466 <p><span id="v1">bar</span>
4467 </p>
4468 !!end
4469
4470 !!article
4471 Template:paramtest2
4472 !! text
4473 including another template, {{paramtest|param={{{arg}}}}}
4474 !! endarticle
4475
4476 !! test
4477 Template passing argument to another template
4478 !! input
4479 {{paramtest2|arg='hmm'}}
4480 !! result
4481 <p>including another template, This is a test template with parameter 'hmm'
4482 </p>
4483 !! end
4484
4485 !! article
4486 Template:Linktest2
4487 !! text
4488 Main Page
4489 !! endarticle
4490
4491 !! test
4492 Template as link source
4493 !! input
4494 [[{{linktest2}}]]
4495 !! result
4496 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4497 </p>
4498 !! end
4499
4500
4501 !! article
4502 Template:loop1
4503 !! text
4504 {{loop2}}
4505 !! endarticle
4506
4507 !! article
4508 Template:loop2
4509 !! text
4510 {{loop1}}
4511 !! endarticle
4512
4513 !! test
4514 Template infinite loop
4515 !! input
4516 {{loop1}}
4517 !! result
4518 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
4519 </p>
4520 !! end
4521
4522 !! test
4523 Template from main namespace
4524 !! input
4525 {{:Main Page}}
4526 !! result
4527 <p>blah blah
4528 </p>
4529 !! end
4530
4531 !! article
4532 Template:table
4533 !! text
4534 {|
4535 | 1 || 2
4536 |-
4537 | 3 || 4
4538 |}
4539 !! endarticle
4540
4541 !! test
4542 BUG 529: Template with table, not included at beginning of line
4543 !! input
4544 foo {{table}}
4545 !! result
4546 <p>foo
4547 </p>
4548 <table>
4549 <tr>
4550 <td> 1 </td>
4551 <td> 2
4552 </td></tr>
4553 <tr>
4554 <td> 3 </td>
4555 <td> 4
4556 </td></tr></table>
4557
4558 !! end
4559
4560 !! test
4561 BUG 523: Template shouldn't eat newline (or add an extra one before table)
4562 !! input
4563 foo
4564 {{table}}
4565 !! result
4566 <p>foo
4567 </p>
4568 <table>
4569 <tr>
4570 <td> 1 </td>
4571 <td> 2
4572 </td></tr>
4573 <tr>
4574 <td> 3 </td>
4575 <td> 4
4576 </td></tr></table>
4577
4578 !! end
4579
4580 !! test
4581 BUG 41: Template parameters shown as broken links
4582 !! input
4583 {{{parameter}}}
4584 !! result
4585 <p>{{{parameter}}}
4586 </p>
4587 !! end
4588
4589 !! test
4590 Template with targets containing wikilinks
4591 !! input
4592 {{[[foo]]}}
4593
4594 {{[[{{echo|foo}}]]}}
4595
4596 {{{{echo|[[foo}}]]}}
4597 !! result
4598 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
4599 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
4600 </p><p>{{[[foo}}]]
4601 </p>
4602 !! end
4603
4604 !! article
4605 Template:MSGNW test
4606 !! text
4607 ''None'' of '''this''' should be
4608 * interpreted
4609 but rather passed unmodified
4610 {{test}}
4611 !! endarticle
4612
4613 # hmm, fix this or just deprecate msgnw and document its behavior?
4614 !! test
4615 msgnw keyword
4616 !! options
4617 disabled
4618 !! input
4619 {{msgnw:MSGNW test}}
4620 !! result
4621 <p>''None'' of '''this''' should be
4622 * interpreted
4623 but rather passed unmodified
4624 {{test}}
4625 </p>
4626 !! end
4627
4628 !! test
4629 int keyword
4630 !! input
4631 {{int:youhavenewmessages|lots of money|not!}}
4632 !! result
4633 <p>You have lots of money (not!).
4634 </p>
4635 !! end
4636
4637 !! article
4638 Template:Includes
4639 !! text
4640 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
4641 !! endarticle
4642
4643 !! test
4644 <includeonly> and <noinclude> being included
4645 !! input
4646 {{Includes}}
4647 !! result
4648 <p>Foobar
4649 </p>
4650 !! end
4651
4652 !! article
4653 Template:Includes2
4654 !! text
4655 <onlyinclude>Foo</onlyinclude>bar
4656 !! endarticle
4657
4658 !! test
4659 <onlyinclude> being included
4660 !! input
4661 {{Includes2}}
4662 !! result
4663 <p>Foo
4664 </p>
4665 !! end
4666
4667
4668 !! article
4669 Template:Includes3
4670 !! text
4671 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
4672 !! endarticle
4673
4674 !! test
4675 <onlyinclude> and <includeonly> being included
4676 !! input
4677 {{Includes3}}
4678 !! result
4679 <p>Foo
4680 </p>
4681 !! end
4682
4683 !! test
4684 <includeonly> and <noinclude> on a page
4685 !! input
4686 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
4687 !! result
4688 <p>Foozar
4689 </p>
4690 !! end
4691
4692 !! test
4693 <onlyinclude> on a page
4694 !! input
4695 <onlyinclude>Foo</onlyinclude>bar
4696 !! result
4697 <p>Foobar
4698 </p>
4699 !! end
4700
4701 !! article
4702 Template:Includeonly section
4703 !! text
4704 <includeonly>
4705 ==Includeonly section==
4706 </includeonly>
4707 ==Section T-1==
4708 !!endarticle
4709
4710 !! test
4711 Bug 6563: Edit link generation for section shown by <includeonly>
4712 !! input
4713 {{includeonly section}}
4714 !! result
4715 <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>
4716 <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>
4717
4718 !! end
4719
4720 # Uses same input as the contents of [[Template:Includeonly section]]
4721 !! test
4722 Bug 6563: Section extraction for section shown by <includeonly>
4723 !! options
4724 section=T-2
4725 !! input
4726 <includeonly>
4727 ==Includeonly section==
4728 </includeonly>
4729 ==Section T-2==
4730 !! result
4731 ==Section T-2==
4732 !! end
4733
4734 !! test
4735 Bug 6563: Edit link generation for section suppressed by <includeonly>
4736 !! input
4737 <includeonly>
4738 ==Includeonly section==
4739 </includeonly>
4740 ==Section 1==
4741 !! result
4742 <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>
4743
4744 !! end
4745
4746 !! test
4747 Bug 6563: Section extraction for section suppressed by <includeonly>
4748 !! options
4749 section=1
4750 !! input
4751 <includeonly>
4752 ==Includeonly section==
4753 </includeonly>
4754 ==Section 1==
4755 !! result
4756 ==Section 1==
4757 !! end
4758
4759 ###
4760 ### <includeonly> and <noinclude> in attributes
4761 ###
4762 !!test
4763 0. includeonly around the entire attribute
4764 !!input
4765 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
4766 !!result
4767 <p><span id="v2">bar</span>
4768 </p>
4769 !!end
4770
4771 !!test
4772 1. includeonly in html attr key
4773 !!input
4774 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
4775 !!result
4776 <p><span id="foo">bar</span>
4777 </p>
4778 !!end
4779
4780 !!test
4781 2. includeonly in html attr value
4782 !!input
4783 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
4784 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
4785 !!result
4786 <p><span id="v1">bar</span>
4787 <span id="v1">bar</span>
4788 </p>
4789 !!end
4790
4791 !!test
4792 3. includeonly in part of an attr value
4793 !!input
4794 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
4795 !!result
4796 <p><span style="color:red;">bar</span>
4797 </p>
4798 !!end
4799
4800 ###
4801 ### Testing parsing of templates where a template arg
4802 ### has the same name as the template itself.
4803 ###
4804
4805 !! article
4806 Template:quote
4807 !! text
4808 {{{quote|{{{1}}}}}}
4809 !! endarticle
4810
4811 !!test
4812 Templates: Template Name/Arg clash: 1. Use of positional param
4813 !!input
4814 {{quote|foo}}
4815 !!result
4816 <p>foo
4817 </p>
4818 !!end
4819
4820 !!test
4821 Templates: Template Name/Arg clash: 2. Use of named param
4822 !!input
4823 {{quote|quote=foo}}
4824 !!result
4825 <p>foo
4826 </p>
4827 !!end
4828
4829 !!test
4830 Templates: Template Name/Arg clash: 3. Use of named param with empty input
4831 !!input
4832 {{quote|quote}}
4833 !!result
4834 <p>quote
4835 </p>
4836 !!end
4837
4838 ###
4839 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
4840 ###
4841
4842 !!test
4843 Templates: 1. Simple use
4844 !!input
4845 {{echo|Foo}}
4846 !!result
4847 <p>Foo
4848 </p>
4849 !!end
4850
4851 !!test
4852 Templates: 2. Inside a block tag
4853 !!input
4854 <div>{{echo|Foo}}</div>
4855 !!result
4856 <div>Foo</div>
4857
4858 !!end
4859
4860 !!test
4861 Templates: P-wrapping: 1a. Templates on consecutive lines
4862 !!input
4863 {{echo|Foo}}
4864 {{echo|bar}}
4865 !!result
4866 <p>Foo
4867 bar
4868 </p>
4869 !!end
4870
4871 !!test
4872 Templates: P-wrapping: 1b. Templates on consecutive lines
4873 !!input
4874 Foo
4875
4876 {{echo|bar}}
4877 {{echo|baz}}
4878 !!result
4879 <p>Foo
4880 </p><p>bar
4881 baz
4882 </p>
4883 !!end
4884
4885 !!test
4886 Templates: P-wrapping: 1c. Templates on consecutive lines
4887 !!input
4888 {{echo|Foo}}
4889 {{echo|bar}} <div>baz</div>
4890 !!result
4891 <p>Foo
4892 </p>
4893 bar <div>baz</div>
4894
4895 !!end
4896
4897 !!test
4898 Templates: Inline Text: 1. Multiple tmeplate uses
4899 !!input
4900 {{echo|Foo}}bar{{echo|baz}}
4901 !!result
4902 <p>Foobarbaz
4903 </p>
4904 !!end
4905
4906 !!test
4907 Templates: Inline Text: 2. Back-to-back template uses
4908 !!input
4909 {{echo|Foo}}{{echo|bar}}
4910 !!result
4911 <p>Foobar
4912 </p>
4913 !!end
4914
4915 !!test
4916 Templates: Block Tags: 1. Multiple template uses
4917 !!input
4918 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
4919 !!result
4920 <div>Foo</div><div>bar</div><div>baz</div>
4921
4922 !!end
4923
4924 !!test
4925 Templates: Block Tags: 2. Back-to-back template uses
4926 !!input
4927 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
4928 !!result
4929 <div>Foo</div><div>bar</div>
4930
4931 !!end
4932
4933 !!test
4934 Templates: Links: 1. Simple example
4935 !!input
4936 {{echo|[[Foo|bar]]}}
4937 !!result
4938 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
4939 </p>
4940 !!end
4941
4942 !!test
4943 Templates: Links: 2. Generation of link href
4944 !!input
4945 [[{{echo|Foo}}|bar]]
4946 !!result
4947 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
4948 </p>
4949 !!end
4950
4951 !!test
4952 Templates: Links: 3. Generation of part of a link href
4953 !!input
4954 [[Fo{{echo|o}}|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: 4. Multiple templates generating link href
4962 !!input
4963 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
4964 !!result
4965 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
4966 </p>
4967 !!end
4968
4969 !!test
4970 Templates: Links: 5. Generation of link text
4971 !!input
4972 [[Foo|{{echo|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: 5. Nested templates (only outermost template should be marked)
4980 !!input
4981 {{echo|[[{{echo|Foo}}|bar]]}}
4982 !!result
4983 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
4984 </p>
4985 !!end
4986
4987 !!test
4988 Templates: HTML Tag: 1. Generation of HTML attr. key
4989 !!input
4990 <div {{echo|style}}="color:red;">foo</div>
4991 !!result
4992 <div style="color:red;">foo</div>
4993
4994 !!end
4995
4996 !!test
4997 Templates: HTML Tag: 2. Generation of HTML attr. value
4998 !!input
4999 <div style={{echo|'color:red;'}}>foo</div>
5000 !!result
5001 <div style="color:red;">foo</div>
5002
5003 !!end
5004
5005 !!test
5006 Templates: HTML Tag: 3. Generation of HTML attr key and value
5007 !!input
5008 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
5009 !!result
5010 <div style="color:red;">foo</div>
5011
5012 !!end
5013
5014 !!test
5015 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
5016 !!input
5017 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
5018 !!result
5019 <div title="This is a long title with just one piece templated">foo</div>
5020
5021 !!end
5022
5023 !!test
5024 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
5025 !!input
5026 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
5027 !!result
5028 <div title="This is a long title with just one piece templated">foo</div>
5029
5030 !!end
5031
5032 !!test
5033 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
5034 !!input
5035 <div title="This is a long title with just one piece {{echo|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 Tables: 1. Generating start of a HTML table
5043 !!input
5044 {{echo|<table><tr><td>foo</td>}}</tr></table>
5045 !!result
5046 <table><tr><td>foo</td></tr></table>
5047
5048 !!end
5049
5050 !!test
5051 Templates: HTML Tables: 2a. Generating middle of a HTML table
5052 !!input
5053 <table><tr>{{echo|<td>foo</td>}}</tr></table>
5054 !!result
5055 <table><tr><td>foo</td></tr></table>
5056
5057 !!end
5058
5059 !!test
5060 Templates: HTML Tables: 2b. Generating middle of a HTML table
5061 !!input
5062 <table>{{echo|<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: 3. Generating end 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: 4a. Generating a single tag of a HTML table
5079 !!input
5080 {{echo|<table>}}<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: 4b. Generating a single tag of a HTML table
5088 !!input
5089 <table>{{echo|<tr>}}<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: 4c. Generating a single tag of a HTML table
5097 !!input
5098 <table><tr>{{echo|<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: 4d. Generating a single tag of a HTML table
5106 !!input
5107 <table><tr><td>foo{{echo|</td>}}</tr></table>
5108 !!result
5109 <table><tr><td>foo</td></tr></table>
5110
5111 !!end
5112
5113 !!test
5114 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
5115 !!input
5116 <table><tr><td>foo</td>{{echo|</tr>}}</table>
5117 !!result
5118 <table><tr><td>foo</td></tr></table>
5119
5120 !!end
5121
5122 !!test
5123 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
5124 !!input
5125 <table><tr><td>foo</td></tr>{{echo|</table>}}
5126 !!result
5127 <table><tr><td>foo</td></tr></table>
5128
5129 !!end
5130
5131 !!test
5132 Templates: Wiki Tables: 1. Fostering of entire template content
5133 !!input
5134 {|
5135 {{echo|a}}
5136 |}
5137 !!result
5138 <table>
5139 a
5140 <tr><td></td></tr></table>
5141
5142 !!end
5143
5144 !!test
5145 Templates: Wiki Tables: 2. Fostering of partial template content
5146 !!input
5147 {|
5148 {{echo|a
5149 <div>b</div>}}
5150 |}
5151 !!result
5152 <table>
5153 a
5154 <div>b</div>
5155 <tr><td></td></tr></table>
5156
5157 !!end
5158
5159 !!test
5160 Templates: Wiki Tables: 3. td-content via multiple templates
5161 !!input
5162 {|
5163 {{echo|{{pipe}}a}}{{echo|b}}
5164 |}
5165 !!result
5166 <table>
5167 <tr>
5168 <td>ab
5169 </td></tr></table>
5170
5171 !!end
5172
5173 !!test
5174 Templates: Lists: Multi-line list-items via templates
5175 !!input
5176 *{{echo|a {{nonexistent|
5177 unused}}}}
5178 *{{echo|b {{nonexistent|
5179 unused}}}}
5180 !!result
5181 <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>
5182 </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>
5183 </li></ul>
5184
5185 !!end
5186
5187 !!test
5188 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
5189 !!input
5190 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
5191 !!result
5192 <p><i>ab</i>c<i>d</i>e
5193 </p>
5194 !!end
5195
5196 !!test
5197 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
5198 (PHP parser generates misnested html)
5199 !! options
5200 disabled
5201 !!input
5202 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
5203 !!result
5204 <p><span><i>a</i></span><i><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
5205 !!end
5206
5207 !!test
5208 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
5209 (PHP parser generates misnested html)
5210 !! options
5211 disabled
5212 !!input
5213 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
5214 !!result
5215 <div><i>a</i></div>
5216 <div><i>b</i>c<i>d</i></div>
5217 <div>e</div>
5218 !!end
5219
5220 !!test
5221 Templates: Ugly nesting: 4. Divs opened/closed across templates
5222 !!input
5223 a<div>b{{echo|c</div>d}}e
5224 !!result
5225 a<div>bc</div>de
5226
5227 !!end
5228
5229 !!test
5230 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
5231 (Parsoid-centric)
5232 !! options
5233 disabled
5234 !!input
5235 {|
5236 |{{echo|foo</table>}}
5237 |bar
5238 |}
5239 !!result
5240 <table data-parsoid="{&quot;src&quot;:&quot;{|\n|{{echo|foo&lt;/table&gt;}}\n|bar\n|}&quot;}" about="#mwt1" typeof="mw:Object/Template ">
5241 <tbody><tr><td>foo</td></tr></tbody></table><span about="#mwt1">
5242 bar</span><span about="#mwt1">
5243 </span>
5244 !!end
5245
5246 !!test
5247 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
5248 (Parsoid-centric)
5249 !! options
5250 disabled
5251 !!input
5252 <table>
5253 <tr>
5254 <td>
5255 <table>
5256 <tr>
5257 <td>1. {{echo|foo </table>}}</td>
5258 <td> bar </td>
5259 <td>2. {{echo|baz </table>}}</td>
5260 </tr>
5261 <tr>
5262 <td>abc</td>
5263 </tr>
5264 </table>
5265 </td>
5266 </tr>
5267 <tr>
5268 <td>xyz</td>
5269 </tr>
5270 </table>
5271 !!result
5272 <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">
5273 <tbody><tr data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">
5274 <td data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">
5275 <table data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">
5276 <tbody><tr data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">
5277 <td data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">1. foo </td></tr></tbody></table></td>
5278 <td data-parsoid="{&quot;stx&quot;:&quot;html&quot;}"> bar </td>
5279 <td data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">2. baz </td></tr></tbody></table><span about="#mwt1">
5280 </span><span about="#mwt1">
5281
5282 abc</span><span about="#mwt1">
5283 </span><span about="#mwt1">
5284 </span><span about="#mwt1">
5285 </span><span about="#mwt1">
5286 </span><span about="#mwt1">
5287
5288 xyz</span><span about="#mwt1">
5289 </span><span about="#mwt1">
5290 </span>
5291 !!end
5292
5293 !!test
5294 Parser Functions: 1. Simple example
5295 !!input
5296 {{uc:foo}}
5297 !!result
5298 <p>FOO
5299 </p>
5300 !!end
5301
5302 !!test
5303 Parser Functions: 2. Nested use (only outermost should be marked up)
5304 !!input
5305 {{uc:{{lc:FOO}}}}
5306 !!result
5307 <p>FOO
5308 </p>
5309 !!end
5310
5311 ###
5312 ### Pre-save transform tests
5313 ###
5314 !! test
5315 pre-save transform: subst:
5316 !! options
5317 PST
5318 !! input
5319 {{subst:test}}
5320 !! result
5321 This is a test template
5322 !! end
5323
5324 !! test
5325 pre-save transform: normal template
5326 !! options
5327 PST
5328 !! input
5329 {{test}}
5330 !! result
5331 {{test}}
5332 !! end
5333
5334 !! test
5335 pre-save transform: nonexistent template
5336 !! options
5337 PST
5338 !! input
5339 {{thistemplatedoesnotexist}}
5340 !! result
5341 {{thistemplatedoesnotexist}}
5342 !! end
5343
5344
5345 !! test
5346 pre-save transform: subst magic variables
5347 !! options
5348 PST
5349 !! input
5350 {{subst:SITENAME}}
5351 !! result
5352 MediaWiki
5353 !! end
5354
5355 # This is bug 89, which I fixed. -- wtm
5356 !! test
5357 pre-save transform: subst: templates with parameters
5358 !! options
5359 pst
5360 !! input
5361 {{subst:paramtest|param="something else"}}
5362 !! result
5363 This is a test template with parameter "something else"
5364 !! end
5365
5366 !! article
5367 Template:nowikitest
5368 !! text
5369 <nowiki>'''not wiki'''</nowiki>
5370 !! endarticle
5371
5372 !! test
5373 pre-save transform: nowiki in subst (bug 1188)
5374 !! options
5375 pst
5376 !! input
5377 {{subst:nowikitest}}
5378 !! result
5379 <nowiki>'''not wiki'''</nowiki>
5380 !! end
5381
5382
5383 !! article
5384 Template:commenttest
5385 !! text
5386 This template has <!-- a comment --> in it.
5387 !! endarticle
5388
5389 !! test
5390 pre-save transform: comment in subst (bug 1936)
5391 !! options
5392 pst
5393 !! input
5394 {{subst:commenttest}}
5395 !! result
5396 This template has <!-- a comment --> in it.
5397 !! end
5398
5399 !! test
5400 pre-save transform: unclosed tag
5401 !! options
5402 pst noxml
5403 !! input
5404 <nowiki>'''not wiki'''
5405 !! result
5406 <nowiki>'''not wiki'''
5407 !! end
5408
5409 !! test
5410 pre-save transform: mixed tag case
5411 !! options
5412 pst noxml
5413 !! input
5414 <NOwiki>'''not wiki'''</noWIKI>
5415 !! result
5416 <NOwiki>'''not wiki'''</noWIKI>
5417 !! end
5418
5419 !! test
5420 pre-save transform: unclosed comment in <nowiki>
5421 !! options
5422 pst noxml
5423 !! input
5424 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
5425 !! result
5426 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
5427 !!end
5428
5429 !! article
5430 Template:dangerous
5431 !!text
5432 <span onmouseover="alert('crap')">Oh no</span>
5433 !!endarticle
5434
5435 !!test
5436 (confirming safety of fix for subst bug 1936)
5437 !! input
5438 {{Template:dangerous}}
5439 !! result
5440 <p><span>Oh no</span>
5441 </p>
5442 !! end
5443
5444 !! test
5445 pre-save transform: comment containing gallery (bug 5024)
5446 !! options
5447 pst
5448 !! input
5449 <!-- <gallery>data</gallery> -->
5450 !!result
5451 <!-- <gallery>data</gallery> -->
5452 !!end
5453
5454 !! test
5455 pre-save transform: comment containing extension
5456 !! options
5457 pst
5458 !! input
5459 <!-- <tag>data</tag> -->
5460 !!result
5461 <!-- <tag>data</tag> -->
5462 !!end
5463
5464 !! test
5465 pre-save transform: comment containing nowiki
5466 !! options
5467 pst
5468 !! input
5469 <!-- <nowiki>data</nowiki> -->
5470 !!result
5471 <!-- <nowiki>data</nowiki> -->
5472 !!end
5473
5474 !! test
5475 pre-save transform: <noinclude> in subst (bug 3298)
5476 !! options
5477 pst
5478 !! input
5479 {{subst:Includes}}
5480 !! result
5481 Foobar
5482 !! end
5483
5484 !! test
5485 pre-save transform: <onlyinclude> in subst (bug 3298)
5486 !! options
5487 pst
5488 !! input
5489 {{subst:Includes2}}
5490 !! result
5491 Foo
5492 !! end
5493
5494 !! article
5495 Template:SubstTest
5496 !!text
5497 {{<includeonly>subst:</includeonly>Includes}}
5498 !! endarticle
5499
5500 !! article
5501 Template:SafeSubstTest
5502 !! text
5503 {{<includeonly>safesubst:</includeonly>Includes}}
5504 !! endarticle
5505
5506 !! test
5507 bug 22297: safesubst: works during PST
5508 !! options
5509 pst
5510 !! input
5511 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
5512 !! result
5513 FoobarFoobar
5514 !! end
5515
5516 !! test
5517 bug 22297: safesubst: works during normal parse
5518 !! input
5519 {{SafeSubstTest}}
5520 !! result
5521 <p>Foobar
5522 </p>
5523 !! end
5524
5525 !! test:
5526 subst: does not work during normal parse
5527 !! input
5528 {{SubstTest}}
5529 !! result
5530 <p>{{subst:Includes}}
5531 </p>
5532 !! end
5533
5534 !! test
5535 pre-save transform: context links ("pipe trick")
5536 !! options
5537 pst
5538 !! input
5539 [[Article (context)|]]
5540 [[Bar:Article|]]
5541 [[:Bar:Article|]]
5542 [[Bar:Article (context)|]]
5543 [[:Bar:Article (context)|]]
5544 [[|Article]]
5545 [[|Article (context)]]
5546 [[Bar:X (Y) Z|]]
5547 [[:Bar:X (Y) Z|]]
5548 !! result
5549 [[Article (context)|Article]]
5550 [[Bar:Article|Article]]
5551 [[:Bar:Article|Article]]
5552 [[Bar:Article (context)|Article]]
5553 [[:Bar:Article (context)|Article]]
5554 [[Article]]
5555 [[Article (context)]]
5556 [[Bar:X (Y) Z|X (Y) Z]]
5557 [[:Bar:X (Y) Z|X (Y) Z]]
5558 !! end
5559
5560 !! test
5561 pre-save transform: context links ("pipe trick") with interwiki prefix
5562 !! options
5563 pst
5564 !! input
5565 [[interwiki:Article|]]
5566 [[:interwiki:Article|]]
5567 [[interwiki:Bar:Article|]]
5568 [[:interwiki:Bar:Article|]]
5569 !! result
5570 [[interwiki:Article|Article]]
5571 [[:interwiki:Article|Article]]
5572 [[interwiki:Bar:Article|Bar:Article]]
5573 [[:interwiki:Bar:Article|Bar:Article]]
5574 !! end
5575
5576 !! test
5577 pre-save transform: context links ("pipe trick") with parens in title
5578 !! options
5579 pst title=[[Somearticle (context)]]
5580 !! input
5581 [[|Article]]
5582 !! result
5583 [[Article (context)|Article]]
5584 !! end
5585
5586 !! test
5587 pre-save transform: context links ("pipe trick") with comma in title
5588 !! options
5589 pst title=[[Someplace, Somewhere]]
5590 !! input
5591 [[|Otherplace]]
5592 [[Otherplace, Elsewhere|]]
5593 [[Otherplace, Elsewhere, Anywhere|]]
5594 !! result
5595 [[Otherplace, Somewhere|Otherplace]]
5596 [[Otherplace, Elsewhere|Otherplace]]
5597 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
5598 !! end
5599
5600 !! test
5601 pre-save transform: context links ("pipe trick") with parens and comma
5602 !! options
5603 pst title=[[Someplace (IGNORED), Somewhere]]
5604 !! input
5605 [[|Otherplace]]
5606 [[Otherplace (place), Elsewhere|]]
5607 !! result
5608 [[Otherplace, Somewhere|Otherplace]]
5609 [[Otherplace (place), Elsewhere|Otherplace]]
5610 !! end
5611
5612 !! test
5613 pre-save transform: context links ("pipe trick") with comma and parens
5614 !! options
5615 pst title=[[Who, me? (context)]]
5616 !! input
5617 [[|Yes, you.]]
5618 [[Me, Myself, and I (1937 song)|]]
5619 !! result
5620 [[Yes, you. (context)|Yes, you.]]
5621 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
5622 !! end
5623
5624 !! test
5625 pre-save transform: context links ("pipe trick") with namespace
5626 !! options
5627 pst title=[[Ns:Somearticle]]
5628 !! input
5629 [[|Article]]
5630 !! result
5631 [[Ns:Article|Article]]
5632 !! end
5633
5634 !! test
5635 pre-save transform: context links ("pipe trick") with namespace and parens
5636 !! options
5637 pst title=[[Ns:Somearticle (context)]]
5638 !! input
5639 [[|Article]]
5640 !! result
5641 [[Ns:Article (context)|Article]]
5642 !! end
5643
5644 !! test
5645 pre-save transform: context links ("pipe trick") with namespace and comma
5646 !! options
5647 pst title=[[Ns:Somearticle, Context, Whatever]]
5648 !! input
5649 [[|Article]]
5650 !! result
5651 [[Ns:Article, Context, Whatever|Article]]
5652 !! end
5653
5654 !! test
5655 pre-save transform: context links ("pipe trick") with namespace, comma and parens
5656 !! options
5657 pst title=[[Ns:Somearticle, Context (context)]]
5658 !! input
5659 [[|Article]]
5660 !! result
5661 [[Ns:Article (context)|Article]]
5662 !! end
5663
5664 !! test
5665 pre-save transform: context links ("pipe trick") with namespace, parens and comma
5666 !! options
5667 pst title=[[Ns:Somearticle (IGNORED), Context]]
5668 !! input
5669 [[|Article]]
5670 !! result
5671 [[Ns:Article, Context|Article]]
5672 !! end
5673
5674 !! test
5675 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
5676 !! options
5677 pst
5678 !! input
5679 [[Article(context)|]]
5680 [[Bar:Article(context)|]]
5681 [[:Bar:Article(context)|]]
5682 [[|Article(context)]]
5683 [[Bar:X(Y)Z|]]
5684 [[:Bar:X(Y)Z|]]
5685 !! result
5686 [[Article(context)|Article]]
5687 [[Bar:Article(context)|Article]]
5688 [[:Bar:Article(context)|Article]]
5689 [[Article(context)]]
5690 [[Bar:X(Y)Z|X(Y)Z]]
5691 [[:Bar:X(Y)Z|X(Y)Z]]
5692 !! end
5693
5694 !! test
5695 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
5696 !! options
5697 pst
5698 !! input
5699 [[Article (context)|]]
5700 [[Bar:Article (context)|]]
5701 [[:Bar:Article (context)|]]
5702 [[|Article (context)]]
5703 [[Bar:X (Y) Z|]]
5704 [[:Bar:X (Y) Z|]]
5705 !! result
5706 [[Article (context)|Article]]
5707 [[Bar:Article (context)|Article]]
5708 [[:Bar:Article (context)|Article]]
5709 [[Article (context)]]
5710 [[Bar:X (Y) Z|X (Y) Z]]
5711 [[:Bar:X (Y) Z|X (Y) Z]]
5712 !! end
5713
5714 !! test
5715 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
5716 !! options
5717 pst
5718 !! input
5719 [[Article(context)|]]
5720 [[Bar:Article(context)|]]
5721 [[:Bar:Article(context)|]]
5722 [[|Article(context)]]
5723 [[Bar:X(Y)Z|]]
5724 [[:Bar:X(Y)Z|]]
5725 !! result
5726 [[Article(context)|Article]]
5727 [[Bar:Article(context)|Article]]
5728 [[:Bar:Article(context)|Article]]
5729 [[Article(context)]]
5730 [[Bar:X(Y)Z|X(Y)Z]]
5731 [[:Bar:X(Y)Z|X(Y)Z]]
5732 !! end
5733
5734 !! test
5735 pre-save transform: context links ("pipe trick") with commas (bug 21660)
5736 !! options
5737 pst
5738 !! input
5739 [[Article (context), context|]]
5740 [[Article (context),context|]]
5741 [[Bar:Article (context), context|]]
5742 [[Bar:Article (context),context|]]
5743 [[:Bar:Article (context), context|]]
5744 [[:Bar:Article (context),context|]]
5745 !! result
5746 [[Article (context), context|Article]]
5747 [[Article (context),context|Article]]
5748 [[Bar:Article (context), context|Article]]
5749 [[Bar:Article (context),context|Article]]
5750 [[:Bar:Article (context), context|Article]]
5751 [[:Bar:Article (context),context|Article]]
5752 !! end
5753
5754 !! test
5755 pre-save transform: trim trailing empty lines
5756 !! options
5757 pst
5758 !! input
5759 Empty lines are trimmed
5760
5761
5762
5763
5764 !! result
5765 Empty lines are trimmed
5766 !! end
5767
5768 !! test
5769 pre-save transform: Signature expansion
5770 !! options
5771 pst
5772 !! input
5773 * ~~~
5774 * <noinclude>~~~</noinclude>
5775 * <includeonly>~~~</includeonly>
5776 * <onlyinclude>~~~</onlyinclude>
5777 !! result
5778 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
5779 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
5780 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
5781 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
5782 !! end
5783
5784
5785 !! test
5786 pre-save transform: Signature expansion in nowiki tags (bug 93)
5787 !! options
5788 pst disabled
5789 !! input
5790 Shall not expand:
5791
5792 <nowiki>~~~~</nowiki>
5793
5794 <includeonly><nowiki>~~~~</nowiki></includeonly>
5795
5796 <noinclude><nowiki>~~~~</nowiki></noinclude>
5797
5798 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
5799
5800 {{subst:Foo}} shall be converted to FOO
5801
5802 As well as inside noinclude/onlyinclude
5803 <noinclude>{{subst:Foo}}</noinclude>
5804 <onlyinclude>{{subst:Foo}}</onlyinclude>
5805
5806 But not inside includeonly
5807 <includeonly>{{subst:Foo}}</includeonly>
5808 !! result
5809 Shall not expand:
5810
5811 <nowiki>~~~~</nowiki>
5812
5813 <includeonly><nowiki>~~~~</nowiki></includeonly>
5814
5815 <noinclude><nowiki>~~~~</nowiki></noinclude>
5816
5817 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
5818
5819 FOO shall be converted to FOO
5820
5821 As well as inside noinclude/onlyinclude
5822 <noinclude>FOO</noinclude>
5823 <onlyinclude>FOO</onlyinclude>
5824
5825 But not inside includeonly
5826 <includeonly>{{subst:Foo}}</includeonly>
5827 !! end
5828
5829 ###
5830 ### Message transform tests
5831 ###
5832 !! test
5833 message transform: magic variables
5834 !! options
5835 msg
5836 !! input
5837 {{SITENAME}}
5838 !! result
5839 MediaWiki
5840 !! end
5841
5842 !! test
5843 message transform: should not transform wiki markup
5844 !! options
5845 msg
5846 !! input
5847 ''test''
5848 !! result
5849 ''test''
5850 !! end
5851
5852 !! test
5853 message transform: <noinclude> in transcluded template (bug 4926)
5854 !! options
5855 msg
5856 !! input
5857 {{Includes}}
5858 !! result
5859 Foobar
5860 !! end
5861
5862 !! test
5863 message transform: <onlyinclude> in transcluded template (bug 4926)
5864 !! options
5865 msg
5866 !! input
5867 {{Includes2}}
5868 !! result
5869 Foo
5870 !! end
5871
5872 !! test
5873 {{#special:}} page name, known
5874 !! options
5875 msg
5876 !! input
5877 {{#special:Recentchanges}}
5878 !! result
5879 Special:RecentChanges
5880 !! end
5881
5882 !! test
5883 {{#special:}} page name with subpage, known
5884 !! options
5885 msg
5886 !! input
5887 {{#special:Recentchanges/param}}
5888 !! result
5889 Special:RecentChanges/param
5890 !! end
5891
5892 !! test
5893 {{#special:}} page name, unknown
5894 !! options
5895 msg
5896 !! input
5897 {{#special:foobarnonexistent}}
5898 !! result
5899 No such special page
5900 !! end
5901
5902 !! test
5903 {{#speciale:}} page name, known
5904 !! options
5905 msg
5906 !! input
5907 {{#speciale:Recentchanges}}
5908 !! result
5909 Special:RecentChanges
5910 !! end
5911
5912 !! test
5913 {{#speciale:}} page name with subpage, known
5914 !! options
5915 msg
5916 !! input
5917 {{#speciale:Recentchanges/param}}
5918 !! result
5919 Special:RecentChanges/param
5920 !! end
5921
5922 !! test
5923 {{#speciale:}} page name, unknown
5924 !! options
5925 msg
5926 !! input
5927 {{#speciale:foobarnonexistent}}
5928 !! result
5929 No_such_special_page
5930 !! end
5931
5932 ###
5933 ### Images
5934 ###
5935 !! test
5936 Simple image
5937 !! input
5938 [[Image:foobar.jpg]]
5939 !! result
5940 <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>
5941 </p>
5942 !! end
5943
5944 !! test
5945 Right-aligned image
5946 !! input
5947 [[Image:foobar.jpg|right]]
5948 !! result
5949 <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>
5950
5951 !! end
5952
5953 !! test
5954 Simple image (using File: namespace, now canonical)
5955 !! input
5956 [[File: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 Image with caption
5964 !! input
5965 [[Image:foobar.jpg|right|Caption text]]
5966 !! result
5967 <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>
5968
5969 !! end
5970
5971 !! test
5972 Image with empty attribute
5973 !! input
5974 [[Image:foobar.jpg|right||Caption text]]
5975 !! result
5976 <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>
5977
5978 !! end
5979
5980 !! test
5981 Image with link tails
5982 !! input
5983 123[[Image:foobar.jpg]]456
5984 123[[Image:foobar.jpg|right]]456
5985 123[[Image:foobar.jpg|thumb]]456
5986 !! result
5987 <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
5988 </p>
5989 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
5990 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
5991
5992 !! end
5993
5994 !! test
5995 Image with multiple captions -- only last one is accepted
5996 !! input
5997 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
5998 !! result
5999 <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>
6000
6001 !! end
6002
6003 !! test
6004 Image with link parameter, wiki target
6005 !! input
6006 [[Image:foobar.jpg|link=Target page]]
6007 !! result
6008 <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>
6009 </p>
6010 !! end
6011
6012 !! test
6013 Image with link parameter, URL target
6014 !! input
6015 [[Image:foobar.jpg|link=http://example.com/]]
6016 !! result
6017 <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>
6018 </p>
6019 !! end
6020
6021 !! test
6022 Image with link parameter, wgExternalLinkTarget
6023 !! input
6024 [[Image:foobar.jpg|link=http://example.com/]]
6025 !! config
6026 wgExternalLinkTarget='foobar'
6027 !! result
6028 <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>
6029 </p>
6030 !! end
6031
6032 !! test
6033 Image with link parameter, wgNoFollowLinks set to false
6034 !! input
6035 [[Image:foobar.jpg|link=http://example.com/]]
6036 !! config
6037 wgNoFollowLinks=false
6038 !! result
6039 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6040 </p>
6041 !! end
6042
6043 !! test
6044 Image with link parameter, wgNoFollowDomainExceptions
6045 !! input
6046 [[Image:foobar.jpg|link=http://example.com/]]
6047 !! config
6048 wgNoFollowDomainExceptions='example.com'
6049 !! result
6050 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6051 </p>
6052 !! end
6053
6054 !! test
6055 Image with link parameter, wgExternalLinkTarget, unnamed parameter
6056 !! input
6057 [[Image:foobar.jpg|link=http://example.com/|Title]]
6058 !! config
6059 wgExternalLinkTarget='foobar'
6060 !! result
6061 <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>
6062 </p>
6063 !! end
6064
6065 !! test
6066 Image with empty link parameter
6067 !! input
6068 [[Image:foobar.jpg|link=]]
6069 !! result
6070 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
6071 </p>
6072 !! end
6073
6074 !! test
6075 Image with link parameter (wiki target) and unnamed parameter
6076 !! input
6077 [[Image:foobar.jpg|link=Target page|Title]]
6078 !! result
6079 <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>
6080 </p>
6081 !! end
6082
6083 !! test
6084 Image with link parameter (URL target) and unnamed parameter
6085 !! input
6086 [[Image:foobar.jpg|link=http://example.com/|Title]]
6087 !! result
6088 <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>
6089 </p>
6090 !! end
6091
6092 !! test
6093 Thumbnail image with link parameter
6094 !! input
6095 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
6096 !! result
6097 <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>
6098
6099 !! end
6100
6101 !! test
6102 Image with frame and link
6103 !! input
6104 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
6105 !! result
6106 <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>
6107
6108 !! end
6109
6110 !! test
6111 Image with frame and link and explicit alt
6112 !! input
6113 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
6114 !! result
6115 <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>
6116
6117 !! end
6118
6119 !! test
6120 Image with wiki markup in implicit alt
6121 !! input
6122 [[Image:Foobar.jpg|testing '''bold''' in alt]]
6123 !! result
6124 <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>
6125 </p>
6126 !! end
6127
6128 !! test
6129 Image with wiki markup in explicit alt
6130 !! input
6131 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
6132 !! result
6133 <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>
6134 </p>
6135 !! end
6136
6137 !! test
6138 Link to image page- image page normally doesn't exists, hence edit link
6139 Add test with existing image page
6140 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
6141 !! input
6142 [[:Image:test]]
6143 !! result
6144 <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>
6145 </p>
6146 !! end
6147
6148 !! test
6149 bug 18784 Link to non-existent image page with caption should use caption as link text
6150 !! input
6151 [[:Image:test|caption]]
6152 !! result
6153 <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>
6154 </p>
6155 !! end
6156
6157 !! test
6158 Frameless image caption with a free URL
6159 !! input
6160 [[Image:foobar.jpg|http://example.com]]
6161 !! result
6162 <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>
6163 </p>
6164 !! end
6165
6166 !! test
6167 Thumbnail image caption with a free URL
6168 !! input
6169 [[Image:foobar.jpg|thumb|http://example.com]]
6170 !! result
6171 <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>
6172
6173 !! end
6174
6175 !! test
6176 Thumbnail image caption with a free URL and explicit alt
6177 !! input
6178 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
6179 !! result
6180 <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>
6181
6182 !! end
6183
6184 !! test
6185 BUG 1887: A ISBN with a thumbnail
6186 !! input
6187 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
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 href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
6190
6191 !! end
6192
6193 !! test
6194 BUG 1887: A RFC with a thumbnail
6195 !! input
6196 [[Image:foobar.jpg|thumb|This is RFC 12354]]
6197 !! result
6198 <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>
6199
6200 !! end
6201
6202 !! test
6203 BUG 1887: A mailto link with a thumbnail
6204 !! input
6205 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
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>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
6208
6209 !! end
6210
6211 # Pending resolution to bug 368
6212 !! test
6213 BUG 648: Frameless image caption with a link
6214 !! input
6215 [[Image:foobar.jpg|text with a [[link]] in it]]
6216 !! result
6217 <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>
6218 </p>
6219 !! end
6220
6221 !! test
6222 BUG 648: Frameless image caption with a link (suffix)
6223 !! input
6224 [[Image:foobar.jpg|text with a [[link]]foo in it]]
6225 !! result
6226 <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>
6227 </p>
6228 !! end
6229
6230 !! test
6231 BUG 648: Frameless image caption with an interwiki link
6232 !! input
6233 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
6234 !! result
6235 <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>
6236 </p>
6237 !! end
6238
6239 !! test
6240 BUG 648: Frameless image caption with a piped interwiki link
6241 !! input
6242 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
6243 !! result
6244 <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>
6245 </p>
6246 !! end
6247
6248 !! test
6249 Escape HTML special chars in image alt text
6250 !! input
6251 [[Image:foobar.jpg|& < > "]]
6252 !! result
6253 <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>
6254 </p>
6255 !! end
6256
6257 !! test
6258 BUG 499: Alt text should have &#1234;, not &amp;1234;
6259 !! input
6260 [[Image:foobar.jpg|&#9792;]]
6261 !! result
6262 <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>
6263 </p>
6264 !! end
6265
6266 !! test
6267 Broken image caption with link
6268 !! input
6269 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
6270 !! result
6271 <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.
6272 </p>
6273 !! end
6274
6275 !! test
6276 Image caption containing another image
6277 !! input
6278 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
6279 !! result
6280 <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>
6281
6282 !! end
6283
6284 !! test
6285 Image caption containing a newline
6286 !! input
6287 [[Image:Foobar.jpg|This
6288 *is some text]]
6289 !! result
6290 <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>
6291 </p>
6292 !!end
6293
6294
6295 !! test
6296 Bug 3090: External links other than http: in image captions
6297 !! input
6298 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
6299 !! result
6300 <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>
6301
6302 !! end
6303
6304 !! test
6305 Custom class
6306 !! input
6307 [[Image:foobar.jpg|a|class=b]]
6308 !! result
6309 <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>
6310 </p>
6311 !! end
6312
6313 !! article
6314 File:Barfoo.jpg
6315 !! text
6316 #REDIRECT [[File:Barfoo.jpg]]
6317 !! endarticle
6318
6319 !! test
6320 Redirected image
6321 !! input
6322 [[Image:Barfoo.jpg]]
6323 !! result
6324 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
6325 </p>
6326 !! end
6327
6328 !! test
6329 Missing image with uploads disabled
6330 !! options
6331 wgEnableUploads=0
6332 !! input
6333 [[Image:Foobaz.jpg]]
6334 !! result
6335 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
6336 </p>
6337 !! end
6338
6339
6340 ###
6341 ### Subpages
6342 ###
6343 !! article
6344 Subpage test/subpage
6345 !! text
6346 foo
6347 !! endarticle
6348
6349 !! test
6350 Subpage link
6351 !! options
6352 subpage title=[[Subpage test]]
6353 !! input
6354 [[/subpage]]
6355 !! result
6356 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
6357 </p>
6358 !! end
6359
6360 !! test
6361 Subpage noslash link
6362 !! options
6363 subpage title=[[Subpage test]]
6364 !!input
6365 [[/subpage/]]
6366 !! result
6367 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
6368 </p>
6369 !! end
6370
6371 !! test
6372 Disabled subpages
6373 !! input
6374 [[/subpage]]
6375 !! result
6376 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
6377 </p>
6378 !! end
6379
6380 !! test
6381 BUG 561: {{/Subpage}}
6382 !! options
6383 subpage title=[[Page]]
6384 !! input
6385 {{/Subpage}}
6386 !! result
6387 <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>
6388 </p>
6389 !! end
6390
6391 ###
6392 ### Categories
6393 ###
6394 !! article
6395 Category:MediaWiki User's Guide
6396 !! text
6397 blah
6398 !! endarticle
6399
6400 !! test
6401 Link to category
6402 !! input
6403 [[:Category:MediaWiki User's Guide]]
6404 !! result
6405 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
6406 </p>
6407 !! end
6408
6409 !! test
6410 Simple category
6411 !! options
6412 cat
6413 !! input
6414 [[Category:MediaWiki User's Guide]]
6415 !! result
6416 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
6417 !! end
6418
6419 !! test
6420 PAGESINCATEGORY invalid title fatal (r33546 fix)
6421 !! input
6422 {{PAGESINCATEGORY:<bogus>}}
6423 !! result
6424 <p>0
6425 </p>
6426 !! end
6427
6428 !! test
6429 Category with different sort key
6430 !! options
6431 cat
6432 !! input
6433 [[Category:MediaWiki User's Guide|Foo]]
6434 !! result
6435 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
6436 !! end
6437
6438 !! test
6439 Category with identical sort key
6440 !! options
6441 cat
6442 !! input
6443 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
6444 !! result
6445 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
6446 !! end
6447
6448 !! test
6449 Category with empty sort key
6450 !! options
6451 cat
6452 pst
6453 !! input
6454 [[Category:MediaWiki User's Guide|]]
6455 !! result
6456 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
6457 !! end
6458
6459 !! test
6460 Category with empty sort key and parentheses
6461 !! options
6462 cat
6463 pst
6464 !! input
6465 [[Category:Foo (bar)|]]
6466 !! result
6467 [[Category:Foo (bar)|Foo]]
6468 !! end
6469
6470 !! test
6471 Category with link tail
6472 !! options
6473 cat
6474 pst
6475 !! input
6476 123[[Category:Foo]]456
6477 !! result
6478 123[[Category:Foo]]456
6479 !! end
6480
6481 !! test
6482 Category with template
6483 !! options
6484 cat
6485 pst
6486 !! input
6487 [[Category:{{echo|Foo}}]]
6488 !! result
6489 [[Category:{{echo|Foo}}]]
6490 !! end
6491
6492 !! test
6493 Category with template in sort key
6494 !! options
6495 cat
6496 pst
6497 !! input
6498 [[Category:Foo|{{echo|Bar}}]]
6499 !! result
6500 [[Category:Foo|{{echo|Bar}}]]
6501 !! end
6502
6503 !! test
6504 Category with template in sort key and title
6505 !! options
6506 cat
6507 pst
6508 !! input
6509 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
6510 !! result
6511 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
6512 !! end
6513
6514 !! test
6515 Category / paragraph interactions
6516 !! input
6517 Foo [[Category:Baz]] Bar
6518
6519 Foo [[Category:Baz]]
6520 Bar
6521
6522 Foo
6523 [[Category:Baz]]
6524 Bar
6525
6526 Foo
6527 [[Category:Baz]] Bar
6528
6529 Foo
6530 [[Category:Baz]]
6531 [[Category:Baz]]
6532 [[Category:Baz]]
6533 Bar
6534
6535 [[Category:Baz]]
6536 [[Category:Baz]]
6537 [[Category:Baz]]
6538
6539 [[Category:Baz]]
6540 {{echo|[[Category:Baz]]}}
6541 [[Category:Baz]]
6542 !! result
6543 <p>Foo Bar
6544 </p><p>Foo
6545 Bar
6546 </p><p>Foo
6547 Bar
6548 </p><p>Foo Bar
6549 </p><p>Foo
6550 Bar
6551 </p>
6552 !! end
6553
6554 ###
6555 ### Inter-language links
6556 ###
6557 !! test
6558 Inter-language links
6559 !! options
6560 ill
6561 !! input
6562 [[es:Alimento]]
6563 [[fr:Nourriture]]
6564 [[zh:&#39135;&#21697;]]
6565 !! result
6566 es:Alimento fr:Nourriture zh:食品
6567 !! end
6568
6569 !! test
6570 Duplicate interlanguage links (bug 24502)
6571 !! options
6572 ill
6573 !! input
6574 [[es:1]]
6575 [[es:2]]
6576 [[fr:1]]
6577 [[fr:2]]
6578 !! result
6579 es:1 fr:1
6580 !! end
6581
6582 ###
6583 ### Sections
6584 ###
6585 !! test
6586 Basic section headings
6587 !! input
6588 == Headline 1 ==
6589 Some text
6590
6591 ==Headline 2==
6592 More
6593 ===Smaller headline===
6594 Blah blah
6595 !! result
6596 <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>
6597 <p>Some text
6598 </p>
6599 <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>
6600 <p>More
6601 </p>
6602 <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>
6603 <p>Blah blah
6604 </p>
6605 !! end
6606
6607 !! test
6608 Section headings with TOC
6609 !! input
6610 == Headline 1 ==
6611 === Subheadline 1 ===
6612 ===== Skipping a level =====
6613 ====== Skipping a level ======
6614
6615 == Headline 2 ==
6616 Some text
6617 ===Another headline===
6618 !! result
6619 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6620 <ul>
6621 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
6622 <ul>
6623 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
6624 <ul>
6625 <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>
6626 <ul>
6627 <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>
6628 </ul>
6629 </li>
6630 </ul>
6631 </li>
6632 </ul>
6633 </li>
6634 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
6635 <ul>
6636 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
6637 </ul>
6638 </li>
6639 </ul>
6640 </td></tr></table>
6641 <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>
6642 <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>
6643 <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>
6644 <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>
6645 <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>
6646 <p>Some text
6647 </p>
6648 <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>
6649
6650 !! end
6651
6652 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
6653 !! test
6654 Handling of sections up to level 6 and beyond
6655 !! input
6656 = Level 1 Heading=
6657 == Level 2 Heading==
6658 === Level 3 Heading===
6659 ==== Level 4 Heading====
6660 ===== Level 5 Heading=====
6661 ====== Level 6 Heading======
6662 ======= Level 7 Heading=======
6663 ======== Level 8 Heading========
6664 ========= Level 9 Heading=========
6665 ========== Level 10 Heading==========
6666 !! result
6667 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6668 <ul>
6669 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
6670 <ul>
6671 <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>
6672 <ul>
6673 <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>
6674 <ul>
6675 <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>
6676 <ul>
6677 <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>
6678 <ul>
6679 <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>
6680 <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>
6681 <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>
6682 <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>
6683 <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>
6684 </ul>
6685 </li>
6686 </ul>
6687 </li>
6688 </ul>
6689 </li>
6690 </ul>
6691 </li>
6692 </ul>
6693 </li>
6694 </ul>
6695 </td></tr></table>
6696 <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>
6697 <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>
6698 <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>
6699 <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>
6700 <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>
6701 <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>
6702 <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>
6703 <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>
6704 <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>
6705 <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>
6706
6707 !! end
6708
6709 !! test
6710 TOC regression (bug 9764)
6711 !! input
6712 == title 1 ==
6713 === title 1.1 ===
6714 ==== title 1.1.1 ====
6715 === title 1.2 ===
6716 == title 2 ==
6717 === title 2.1 ===
6718 !! result
6719 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6720 <ul>
6721 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
6722 <ul>
6723 <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>
6724 <ul>
6725 <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>
6726 </ul>
6727 </li>
6728 <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>
6729 </ul>
6730 </li>
6731 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
6732 <ul>
6733 <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>
6734 </ul>
6735 </li>
6736 </ul>
6737 </td></tr></table>
6738 <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>
6739 <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>
6740 <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>
6741 <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>
6742 <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>
6743 <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>
6744
6745 !! end
6746
6747 !! test
6748 TOC with wgMaxTocLevel=3 (bug 6204)
6749 !! options
6750 wgMaxTocLevel=3
6751 !! input
6752 == title 1 ==
6753 === title 1.1 ===
6754 ==== title 1.1.1 ====
6755 === title 1.2 ===
6756 == title 2 ==
6757 === title 2.1 ===
6758 !! result
6759 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6760 <ul>
6761 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
6762 <ul>
6763 <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>
6764 <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>
6765 </ul>
6766 </li>
6767 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
6768 <ul>
6769 <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>
6770 </ul>
6771 </li>
6772 </ul>
6773 </td></tr></table>
6774 <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>
6775 <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>
6776 <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>
6777 <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>
6778 <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>
6779 <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>
6780
6781 !! end
6782
6783 !! test
6784 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
6785 !! options
6786 wgMaxTocLevel=3
6787 !! input
6788 ==Section 1==
6789 ===Section 1.1===
6790 ====Section 1.1.1====
6791 ====Section 1.1.1.1====
6792 ==Section 2==
6793 !! result
6794 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6795 <ul>
6796 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
6797 <ul>
6798 <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>
6799 </ul>
6800 </li>
6801 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
6802 </ul>
6803 </td></tr></table>
6804 <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>
6805 <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>
6806 <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>
6807 <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>
6808 <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>
6809
6810 !! end
6811
6812
6813 !! test
6814 Resolving duplicate section names
6815 !! input
6816 == Foo bar ==
6817 == Foo bar ==
6818 !! result
6819 <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>
6820 <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>
6821
6822 !! end
6823
6824 !! test
6825 Resolving duplicate section names with differing case (bug 10721)
6826 !! input
6827 == Foo bar ==
6828 == Foo Bar ==
6829 !! result
6830 <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>
6831 <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>
6832
6833 !! end
6834
6835 !! article
6836 Template:sections
6837 !! text
6838 ===Section 1===
6839 ==Section 2==
6840 !! endarticle
6841
6842 !! test
6843 Template with sections, __NOTOC__
6844 !! input
6845 __NOTOC__
6846 ==Section 0==
6847 {{sections}}
6848 ==Section 4==
6849 !! result
6850 <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>
6851 <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>
6852 <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>
6853 <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>
6854
6855 !! end
6856
6857 !! test
6858 __NOEDITSECTION__ keyword
6859 !! input
6860 __NOEDITSECTION__
6861 ==Section 1==
6862 ==Section 2==
6863 !! result
6864 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
6865 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
6866
6867 !! end
6868
6869 !! test
6870 Link inside a section heading
6871 !! input
6872 ==Section with a [[Main Page|link]] in it==
6873 !! result
6874 <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>
6875
6876 !! end
6877
6878 !! test
6879 TOC regression (bug 12077)
6880 !! input
6881 __TOC__
6882 == title 1 ==
6883 === title 1.1 ===
6884 == title 2 ==
6885 !! result
6886 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6887 <ul>
6888 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
6889 <ul>
6890 <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>
6891 </ul>
6892 </li>
6893 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
6894 </ul>
6895 </td></tr></table>
6896 <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>
6897 <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>
6898 <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>
6899
6900 !! end
6901
6902 !! test
6903 BUG 1219 URL next to image (good)
6904 !! input
6905 http://example.com [[Image:foobar.jpg]]
6906 !! result
6907 <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>
6908 </p>
6909 !!end
6910
6911 !! test
6912 Short headings with trailing space should match behaviour of Parser::doHeadings (bug 19910)
6913 !! input
6914 ===
6915 The line above must have a trailing space!
6916 === <!--
6917 --> <!-- -->
6918 But just in case it doesn't...
6919 !! result
6920 <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>
6921 <p>The line above must have a trailing space!
6922 </p>
6923 <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>
6924 <p>But just in case it doesn't...
6925 </p>
6926 !! end
6927
6928 !! test
6929 Header with special characters (bug 25462)
6930 !! input
6931 The tooltips shall not show entities to the user (ie. be double escaped)
6932
6933 == text > text ==
6934 section 1
6935
6936 == text < text ==
6937 section 2
6938
6939 == text & text ==
6940 section 3
6941
6942 == text ' text ==
6943 section 4
6944
6945 == text " text ==
6946 section 5
6947 !! result
6948 <p>The tooltips shall not show entities to the user (ie. be double escaped)
6949 </p>
6950 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6951 <ul>
6952 <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>
6953 <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>
6954 <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>
6955 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
6956 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
6957 </ul>
6958 </td></tr></table>
6959 <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>
6960 <p>section 1
6961 </p>
6962 <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>
6963 <p>section 2
6964 </p>
6965 <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>
6966 <p>section 3
6967 </p>
6968 <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>
6969 <p>section 4
6970 </p>
6971 <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>
6972 <p>section 5
6973 </p>
6974 !! end
6975
6976 !! test
6977 Headers with excess '=' characters
6978 (Are similar tests necessary beyond the 1st level?)
6979 !! input
6980 =foo==
6981 ==foo=
6982 =''italic'' heading==
6983 ==''italic'' heading=
6984 !! result
6985 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6986 <ul>
6987 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
6988 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
6989 <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>
6990 <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>
6991 </ul>
6992 </td></tr></table>
6993 <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>
6994 <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>
6995 <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>
6996 <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>
6997
6998 !! end
6999
7000 !! test
7001 BUG 1219 URL next to image (broken)
7002 !! input
7003 http://example.com[[Image:foobar.jpg]]
7004 !! result
7005 <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>
7006 </p>
7007 !!end
7008
7009 !! test
7010 Bug 1186 news: in the middle of text
7011 !! input
7012 http://en.wikinews.org/wiki/Wikinews:Workplace
7013 !! result
7014 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
7015 </p>
7016 !!end
7017
7018
7019 !! test
7020 Namespaced link must have a title
7021 !! input
7022 [[Project:]]
7023 !! result
7024 <p>[[Project:]]
7025 </p>
7026 !!end
7027
7028 !! test
7029 Namespaced link must have a title (bad fragment version)
7030 !! input
7031 [[Project:#fragment]]
7032 !! result
7033 <p>[[Project:#fragment]]
7034 </p>
7035 !!end
7036
7037
7038 !! test
7039 div with no attributes
7040 !! input
7041 <div>HTML rocks</div>
7042 !! result
7043 <div>HTML rocks</div>
7044
7045 !! end
7046
7047 !! test
7048 div with double-quoted attribute
7049 !! input
7050 <div id="rock">HTML rocks</div>
7051 !! result
7052 <div id="rock">HTML rocks</div>
7053
7054 !! end
7055
7056 !! test
7057 div with single-quoted attribute
7058 !! input
7059 <div id='rock'>HTML rocks</div>
7060 !! result
7061 <div id="rock">HTML rocks</div>
7062
7063 !! end
7064
7065 !! test
7066 div with unquoted 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 illegal double attributes
7076 !! input
7077 <div id="a" id="b">HTML rocks</div>
7078 !! result
7079 <div id="b">HTML rocks</div>
7080
7081 !!end
7082
7083 !! test
7084 HTML multiple attributes correction
7085 !! input
7086 <p class="error" class="awesome">Awesome!</p>
7087 !! result
7088 <p class="awesome">Awesome!</p>
7089
7090 !!end
7091
7092 !! test
7093 Table multiple attributes correction
7094 !! input
7095 {|
7096 !+ class="error" class="awesome"| status
7097 |}
7098 !! result
7099 <table>
7100 <tr>
7101 <th class="awesome"> status
7102 </th></tr></table>
7103
7104 !!end
7105
7106 !! test
7107 DIV IN UPPERCASE
7108 !! input
7109 <DIV ID="x">HTML ROCKS</DIV>
7110 !! result
7111 <div id="x">HTML ROCKS</div>
7112
7113 !!end
7114
7115
7116 !! test
7117 text with amp in the middle of nowhere
7118 !! input
7119 Remember AT&T?
7120 !!result
7121 <p>Remember AT&amp;T?
7122 </p>
7123 !! end
7124
7125 !! test
7126 text with character entity: eacute
7127 !! input
7128 I always thought &eacute; was a cute letter.
7129 !! result
7130 <p>I always thought &#233; was a cute letter.
7131 </p>
7132 !! end
7133
7134 !! test
7135 text with undefined character entity: xacute
7136 !! input
7137 I always thought &xacute; was a cute letter.
7138 !! result
7139 <p>I always thought &amp;xacute; was a cute letter.
7140 </p>
7141 !! end
7142
7143
7144 ###
7145 ### Media links
7146 ###
7147
7148 !! test
7149 Media link
7150 !! input
7151 [[Media:Foobar.jpg]]
7152 !! result
7153 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
7154 </p>
7155 !! end
7156
7157 !! test
7158 Media link with text
7159 !! input
7160 [[Media:Foobar.jpg|A neat file to look at]]
7161 !! result
7162 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
7163 </p>
7164 !! end
7165
7166 # FIXME: this is still bad HTML tag nesting
7167 !! test
7168 Media link with nasty text
7169 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
7170 !! input
7171 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
7172 !! result
7173 <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>
7174
7175 !! end
7176
7177 !! test
7178 Media link to nonexistent file (bug 1702)
7179 !! input
7180 [[Media:No such.jpg]]
7181 !! result
7182 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
7183 </p>
7184 !! end
7185
7186 !! test
7187 Image link to nonexistent file (bug 1850 - good)
7188 !! input
7189 [[Image:No such.jpg]]
7190 !! result
7191 <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>
7192 </p>
7193 !! end
7194
7195 !! test
7196 :Image link to nonexistent file (bug 1850 - bad)
7197 !! input
7198 [[:Image:No such.jpg]]
7199 !! result
7200 <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>
7201 </p>
7202 !! end
7203
7204
7205
7206 !! test
7207 Character reference normalization in link text (bug 1938)
7208 !! input
7209 [[Main Page|this&that]]
7210 !! result
7211 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
7212 </p>
7213 !!end
7214
7215 !! article
7216 אַ
7217 !! text
7218 Test for unicode normalization
7219
7220 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
7221 !! endarticle
7222
7223 !! test
7224 (bug 19451) Links should refer to the normalized form.
7225 !! input
7226 [[&#xFB2E;]]
7227 [[&#x5d0;&#x5b7;]]
7228 [[&#x5d0;ַ]]
7229 [[א&#x5b7;]]
7230 [[אַ]]
7231 !! result
7232 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
7233 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
7234 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
7235 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
7236 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
7237 </p>
7238 !! end
7239
7240 !! test
7241 Empty attribute crash test (bug 2067)
7242 !! input
7243 <font color="">foo</font>
7244 !! result
7245 <p><font color="">foo</font>
7246 </p>
7247 !! end
7248
7249 !! test
7250 Empty attribute crash test single-quotes (bug 2067)
7251 !! input
7252 <font color=''>foo</font>
7253 !! result
7254 <p><font color="">foo</font>
7255 </p>
7256 !! end
7257
7258 !! test
7259 Attribute test: equals, then nothing
7260 !! input
7261 <font color=>foo</font>
7262 !! result
7263 <p><font>foo</font>
7264 </p>
7265 !! end
7266
7267 !! test
7268 Attribute test: unquoted value
7269 !! input
7270 <font color=x>foo</font>
7271 !! result
7272 <p><font color="x">foo</font>
7273 </p>
7274 !! end
7275
7276 !! test
7277 Attribute test: unquoted but illegal value (hash)
7278 !! input
7279 <font color=#x>foo</font>
7280 !! result
7281 <p><font color="#x">foo</font>
7282 </p>
7283 !! end
7284
7285 !! test
7286 Attribute test: no value
7287 !! input
7288 <font color>foo</font>
7289 !! result
7290 <p><font color="color">foo</font>
7291 </p>
7292 !! end
7293
7294 !! test
7295 Bug 2095: link with three closing brackets
7296 !! input
7297 [[Main Page]]]
7298 !! result
7299 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
7300 </p>
7301 !! end
7302
7303 !! test
7304 Bug 2095: link with pipe and three closing brackets
7305 !! input
7306 [[Main Page|link]]]
7307 !! result
7308 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
7309 </p>
7310 !! end
7311
7312 !! test
7313 Bug 2095: link with pipe and three closing brackets, version 2
7314 !! input
7315 [[Main Page|[http://example.com/]]]
7316 !! result
7317 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
7318 </p>
7319 !! end
7320
7321
7322 ###
7323 ### Safety
7324 ###
7325
7326 !! article
7327 Template:Dangerous attribute
7328 !! text
7329 " onmouseover="alert(document.cookie)
7330 !! endarticle
7331
7332 !! article
7333 Template:Dangerous style attribute
7334 !! text
7335 border-size: expression(alert(document.cookie))
7336 !! endarticle
7337
7338 !! article
7339 Template:Div style
7340 !! text
7341 <div style="float: right; {{{1}}}">Magic div</div>
7342 !! endarticle
7343
7344 !! test
7345 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
7346 !! input
7347 <div title="{{test}}"></div>
7348 !! result
7349 <div title="This is a test template"></div>
7350
7351 !! end
7352
7353 !! test
7354 Bug 2304: HTML attribute safety (dangerous template; 2309)
7355 !! input
7356 <div title="{{dangerous attribute}}"></div>
7357 !! result
7358 <div title=""></div>
7359
7360 !! end
7361
7362 !! test
7363 Bug 2304: HTML attribute safety (dangerous style template; 2309)
7364 !! input
7365 <div style="{{dangerous style attribute}}"></div>
7366 !! result
7367 <div style="/* insecure input */"></div>
7368
7369 !! end
7370
7371 !! test
7372 Bug 2304: HTML attribute safety (safe parameter; 2309)
7373 !! input
7374 {{div style|width: 200px}}
7375 !! result
7376 <div style="float: right; width: 200px">Magic div</div>
7377
7378 !! end
7379
7380 !! test
7381 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
7382 !! input
7383 {{div style|width: expression(alert(document.cookie))}}
7384 !! result
7385 <div style="/* insecure input */">Magic div</div>
7386
7387 !! end
7388
7389 !! test
7390 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
7391 !! input
7392 {{div style|"><script>alert(document.cookie)</script>}}
7393 !! result
7394 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
7395
7396 !! end
7397
7398 !! test
7399 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
7400 !! input
7401 {{div style|" ><script>alert(document.cookie)</script>}}
7402 !! result
7403 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
7404
7405 !! end
7406
7407 !! test
7408 Bug 2304: HTML attribute safety (link)
7409 !! input
7410 <div title="[[Main Page]]"></div>
7411 !! result
7412 <div title="&#91;&#91;Main Page]]"></div>
7413
7414 !! end
7415
7416 !! test
7417 Bug 2304: HTML attribute safety (italics)
7418 !! input
7419 <div title="''foobar''"></div>
7420 !! result
7421 <div title="&#39;&#39;foobar&#39;&#39;"></div>
7422
7423 !! end
7424
7425 !! test
7426 Bug 2304: HTML attribute safety (bold)
7427 !! input
7428 <div title="'''foobar'''"></div>
7429 !! result
7430 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
7431
7432 !! end
7433
7434
7435 !! test
7436 Bug 2304: HTML attribute safety (ISBN)
7437 !! input
7438 <div title="ISBN 1234567890"></div>
7439 !! result
7440 <div title="&#73;SBN 1234567890"></div>
7441
7442 !! end
7443
7444 !! test
7445 Bug 2304: HTML attribute safety (RFC)
7446 !! input
7447 <div title="RFC 1234"></div>
7448 !! result
7449 <div title="&#82;FC 1234"></div>
7450
7451 !! end
7452
7453 !! test
7454 Bug 2304: HTML attribute safety (PMID)
7455 !! input
7456 <div title="PMID 1234567890"></div>
7457 !! result
7458 <div title="&#80;MID 1234567890"></div>
7459
7460 !! end
7461
7462 !! test
7463 Bug 2304: HTML attribute safety (web link)
7464 !! input
7465 <div title="http://example.com/"></div>
7466 !! result
7467 <div title="http&#58;//example.com/"></div>
7468
7469 !! end
7470
7471 !! test
7472 Bug 2304: HTML attribute safety (named web link)
7473 !! input
7474 <div title="[http://example.com/ link]"></div>
7475 !! result
7476 <div title="&#91;http&#58;//example.com/ link]"></div>
7477
7478 !! end
7479
7480 !! test
7481 Bug 3244: HTML attribute safety (extension; safe)
7482 !! input
7483 <div style="<nowiki>background:blue</nowiki>"></div>
7484 !! result
7485 <div style="background:blue"></div>
7486
7487 !! end
7488
7489 !! test
7490 Bug 3244: HTML attribute safety (extension; unsafe)
7491 !! input
7492 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
7493 !! result
7494 <div style="/* insecure input */"></div>
7495
7496 !! end
7497
7498 # More MSIE fun discovered by Tom Gilder
7499
7500 !! test
7501 MSIE CSS safety test: spurious slash
7502 !! input
7503 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
7504 !! result
7505 <div style="/* insecure input */">evil</div>
7506
7507 !! end
7508
7509 !! test
7510 MSIE CSS safety test: hex code
7511 !! input
7512 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
7513 !! result
7514 <div style="/* insecure input */">evil</div>
7515
7516 !! end
7517
7518 !! test
7519 MSIE CSS safety test: comment in url
7520 !! input
7521 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
7522 !! result
7523 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
7524
7525 !! end
7526
7527 !! test
7528 MSIE CSS safety test: comment in expression
7529 !! input
7530 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
7531 !! result
7532 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
7533
7534 !! end
7535
7536
7537 !! test
7538 Table attribute legitimate extension
7539 !! input
7540 {|
7541 !+ style="<nowiki>color:blue</nowiki>"| status
7542 |}
7543 !! result
7544 <table>
7545 <tr>
7546 <th style="color:blue"> status
7547 </th></tr></table>
7548
7549 !!end
7550
7551 !! test
7552 Table attribute safety
7553 !! input
7554 {|
7555 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
7556 |}
7557 !! result
7558 <table>
7559 <tr>
7560 <th style="/* insecure input */"> status
7561 </th></tr></table>
7562
7563 !! end
7564
7565 !! test
7566 CSS line continuation 1
7567 !! input
7568 <div style="background-image: u\&#10;rl(test.jpg);"></div>
7569 !! result
7570 <div style="/* insecure input */"></div>
7571
7572 !! end
7573
7574 !! test
7575 CSS line continuation 2
7576 !! input
7577 <div style="background-image: u\&#13;rl(test.jpg); "></div>
7578 !! result
7579 <div style="/* insecure input */"></div>
7580
7581 !! end
7582
7583 !! article
7584 Template:Identity
7585 !! text
7586 {{{1}}}
7587 !! endarticle
7588
7589 !! test
7590 Expansion of multi-line templates in attribute values (bug 6255)
7591 !! input
7592 <div style="background: {{identity|#00FF00}}">-</div>
7593 !! result
7594 <div style="background: #00FF00">-</div>
7595
7596 !! end
7597
7598
7599 !! test
7600 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
7601 !! input
7602 <div style="background:
7603 #00FF00">-</div>
7604 !! result
7605 <div style="background: #00FF00">-</div>
7606
7607 !! end
7608
7609 !! test
7610 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
7611 !! input
7612 <div style="background: &#10;#00FF00">-</div>
7613 !! result
7614 <div style="background: &#10;#00FF00">-</div>
7615
7616 !! end
7617
7618 ###
7619 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
7620 ###
7621 !! test
7622 Parser hook: empty input
7623 !! input
7624 <tag></tag>
7625 !! result
7626 <pre>
7627 ''
7628 array (
7629 )
7630 </pre>
7631
7632 !! end
7633
7634 !! test
7635 Parser hook: empty input using terminated empty elements
7636 !! input
7637 <tag/>
7638 !! result
7639 <pre>
7640 NULL
7641 array (
7642 )
7643 </pre>
7644
7645 !! end
7646
7647 !! test
7648 Parser hook: empty input using terminated empty elements (space before)
7649 !! input
7650 <tag />
7651 !! result
7652 <pre>
7653 NULL
7654 array (
7655 )
7656 </pre>
7657
7658 !! end
7659
7660 !! test
7661 Parser hook: basic input
7662 !! input
7663 <tag>input</tag>
7664 !! result
7665 <pre>
7666 'input'
7667 array (
7668 )
7669 </pre>
7670
7671 !! end
7672
7673
7674 !! test
7675 Parser hook: case insensitive
7676 !! input
7677 <TAG>input</TAG>
7678 !! result
7679 <pre>
7680 'input'
7681 array (
7682 )
7683 </pre>
7684
7685 !! end
7686
7687
7688 !! test
7689 Parser hook: case insensitive, redux
7690 !! input
7691 <TaG>input</TAg>
7692 !! result
7693 <pre>
7694 'input'
7695 array (
7696 )
7697 </pre>
7698
7699 !! end
7700
7701 !! test
7702 Parser hook: nested tags
7703 !! options
7704 noxml
7705 !! input
7706 <tag><tag></tag></tag>
7707 !! result
7708 <pre>
7709 '<tag>'
7710 array (
7711 )
7712 </pre>&lt;/tag&gt;
7713
7714 !! end
7715
7716 !! test
7717 Parser hook: basic arguments
7718 !! input
7719 <tag width=200 height = "100" depth = '50' square></tag>
7720 !! result
7721 <pre>
7722 ''
7723 array (
7724 'width' => '200',
7725 'height' => '100',
7726 'depth' => '50',
7727 'square' => 'square',
7728 )
7729 </pre>
7730
7731 !! end
7732
7733 !! test
7734 Parser hook: argument containing a forward slash (bug 5344)
7735 !! input
7736 <tag filename='/tmp/bla'></tag>
7737 !! result
7738 <pre>
7739 ''
7740 array (
7741 'filename' => '/tmp/bla',
7742 )
7743 </pre>
7744
7745 !! end
7746
7747 !! test
7748 Parser hook: empty input using terminated empty elements (bug 2374)
7749 !! input
7750 <tag foo=bar/>text
7751 !! result
7752 <pre>
7753 NULL
7754 array (
7755 'foo' => 'bar',
7756 )
7757 </pre>text
7758
7759 !! end
7760
7761 # </tag> should be output literally since there is no matching tag that begins it
7762 !! test
7763 Parser hook: basic arguments using terminated empty elements (bug 2374)
7764 !! input
7765 <tag width=200 height = "100" depth = '50' square/>
7766 other stuff
7767 </tag>
7768 !! result
7769 <pre>
7770 NULL
7771 array (
7772 'width' => '200',
7773 'height' => '100',
7774 'depth' => '50',
7775 'square' => 'square',
7776 )
7777 </pre>
7778 <p>other stuff
7779 &lt;/tag&gt;
7780 </p>
7781 !! end
7782
7783 ###
7784 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
7785 ###
7786
7787 !! test
7788 Parser hook: static parser hook not inside a comment
7789 !! input
7790 <statictag>hello, world</statictag>
7791 <statictag action=flush/>
7792 !! result
7793 <p>hello, world
7794 </p>
7795 !! end
7796
7797
7798 !! test
7799 Parser hook: static parser hook inside a comment
7800 !! input
7801 <!-- <statictag>hello, world</statictag> -->
7802 <statictag action=flush/>
7803 !! result
7804 <p><br />
7805 </p>
7806 !! end
7807
7808 # Nested template calls; this case was broken by Parser.php rev 1.506,
7809 # since reverted.
7810
7811 !! article
7812 Template:One-parameter
7813 !! text
7814 (My parameter is: {{{1}}})
7815 !! endarticle
7816
7817 !! article
7818 Template:Map-one-parameter
7819 !! text
7820 {{{{{1}}}|{{{2}}}}}
7821 !! endarticle
7822
7823 !! test
7824 Nested template calls
7825 !! input
7826 {{Map-one-parameter|One-parameter|param}}
7827 !! result
7828 <p>(My parameter is: param)
7829 </p>
7830 !! end
7831
7832
7833 ###
7834 ### Sanitizer
7835 ###
7836 !! test
7837 Sanitizer: Closing of open tags
7838 !! input
7839 <s></s><table></table>
7840 !! result
7841 <s></s><table></table>
7842
7843 !! end
7844
7845 !! test
7846 Sanitizer: Closing of open but not closed tags
7847 !! input
7848 <s>foo
7849 !! result
7850 <p><s>foo</s>
7851 </p>
7852 !! end
7853
7854 !! test
7855 Sanitizer: Closing of closed but not open tags
7856 !! input
7857 </s>
7858 !! result
7859 <p>&lt;/s&gt;
7860 </p>
7861 !! end
7862
7863 !! test
7864 Sanitizer: Closing of closed but not open table tags
7865 !! input
7866 Table not started</td></tr></table>
7867 !! result
7868 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
7869 </p>
7870 !! end
7871
7872 !! test
7873 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
7874 !! input
7875 <span id="æ: v">byte</span>[[#æ: v|backlink]]
7876 !! result
7877 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
7878 </p>
7879 !! end
7880
7881 !! test
7882 Sanitizer: Validating the contents of the id attribute (bug 4515)
7883 !! options
7884 disabled
7885 !! input
7886 <br id=9 />
7887 !! result
7888 Something, but definitely not <br id="9" />...
7889 !! end
7890
7891 !! test
7892 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
7893 !! options
7894 disabled
7895 !! input
7896 <br id="foo" /><br id="foo" />
7897 !! result
7898 Something need to be done. foo-2 ?
7899 !! end
7900
7901 !! test
7902 Language converter: output gets cut off unexpectedly (bug 5757)
7903 !! options
7904 language=zh
7905 !! input
7906 this bit is safe: }-
7907
7908 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
7909
7910 then we get cut off here: }-
7911
7912 all additional text is vanished
7913 !! result
7914 <p>this bit is safe: }-
7915 </p><p>but if we add a conversion instance: xxx
7916 </p><p>then we get cut off here: }-
7917 </p><p>all additional text is vanished
7918 </p>
7919 !! end
7920
7921 !! test
7922 Self closed html pairs (bug 5487)
7923 !! options
7924 !! input
7925 <center><font id="bug" />Centered text</center>
7926 <div><font id="bug2" />In div text</div>
7927 !! result
7928 <center>&lt;font id="bug" /&gt;Centered text</center>
7929 <div>&lt;font id="bug2" /&gt;In div text</div>
7930
7931 !! end
7932
7933 #
7934 #
7935 #
7936
7937 !! test
7938 Punctuation: nbsp before exclamation
7939 !! input
7940 C'est grave !
7941 !! result
7942 <p>C'est grave&#160;!
7943 </p>
7944 !! end
7945
7946 !! test
7947 Punctuation: CSS !important (bug 11874)
7948 !! input
7949 <div style="width:50% !important">important</div>
7950 !! result
7951 <div style="width:50% !important">important</div>
7952
7953 !!end
7954
7955 !! test
7956 Punctuation: CSS ! important (bug 11874; with space after)
7957 !! input
7958 <div style="width:50% ! important">important</div>
7959 !! result
7960 <div style="width:50% ! important">important</div>
7961
7962 !!end
7963
7964
7965 !! test
7966 HTML bullet list, closed tags (bug 5497)
7967 !! input
7968 <ul>
7969 <li>One</li>
7970 <li>Two</li>
7971 </ul>
7972 !! result
7973 <ul>
7974 <li>One</li>
7975 <li>Two</li>
7976 </ul>
7977
7978 !! end
7979
7980 !! test
7981 HTML bullet list, unclosed tags (bug 5497)
7982 !! options
7983 disabled
7984 !! input
7985 <ul>
7986 <li>One
7987 <li>Two
7988 </ul>
7989 !! result
7990 <ul>
7991 <li>One
7992 </li><li>Two
7993 </li></ul>
7994
7995 !! end
7996
7997 !! test
7998 HTML ordered list, closed tags (bug 5497)
7999 !! input
8000 <ol>
8001 <li>One</li>
8002 <li>Two</li>
8003 </ol>
8004 !! result
8005 <ol>
8006 <li>One</li>
8007 <li>Two</li>
8008 </ol>
8009
8010 !! end
8011
8012 !! test
8013 HTML ordered list, unclosed tags (bug 5497)
8014 !! options
8015 disabled
8016 !! input
8017 <ol>
8018 <li>One
8019 <li>Two
8020 </ol>
8021 !! result
8022 <ol>
8023 <li>One
8024 </li><li>Two
8025 </li></ol>
8026
8027 !! end
8028
8029 !! test
8030 HTML nested bullet list, closed tags (bug 5497)
8031 !! input
8032 <ul>
8033 <li>One</li>
8034 <li>Two:
8035 <ul>
8036 <li>Sub-one</li>
8037 <li>Sub-two</li>
8038 </ul>
8039 </li>
8040 </ul>
8041 !! result
8042 <ul>
8043 <li>One</li>
8044 <li>Two:
8045 <ul>
8046 <li>Sub-one</li>
8047 <li>Sub-two</li>
8048 </ul>
8049 </li>
8050 </ul>
8051
8052 !! end
8053
8054 !! test
8055 HTML nested bullet list, open tags (bug 5497)
8056 !! options
8057 disabled
8058 !! input
8059 <ul>
8060 <li>One
8061 <li>Two:
8062 <ul>
8063 <li>Sub-one
8064 <li>Sub-two
8065 </ul>
8066 </ul>
8067 !! result
8068 <ul>
8069 <li>One
8070 </li><li>Two:
8071 <ul>
8072 <li>Sub-one
8073 </li><li>Sub-two
8074 </li></ul>
8075 </li></ul>
8076
8077 !! end
8078
8079 !! test
8080 HTML nested ordered list, closed tags (bug 5497)
8081 !! input
8082 <ol>
8083 <li>One</li>
8084 <li>Two:
8085 <ol>
8086 <li>Sub-one</li>
8087 <li>Sub-two</li>
8088 </ol>
8089 </li>
8090 </ol>
8091 !! result
8092 <ol>
8093 <li>One</li>
8094 <li>Two:
8095 <ol>
8096 <li>Sub-one</li>
8097 <li>Sub-two</li>
8098 </ol>
8099 </li>
8100 </ol>
8101
8102 !! end
8103
8104 !! test
8105 HTML nested ordered list, open tags (bug 5497)
8106 !! options
8107 disabled
8108 !! input
8109 <ol>
8110 <li>One
8111 <li>Two:
8112 <ol>
8113 <li>Sub-one
8114 <li>Sub-two
8115 </ol>
8116 </ol>
8117 !! result
8118 <ol>
8119 <li>One
8120 </li><li>Two:
8121 <ol>
8122 <li>Sub-one
8123 </li><li>Sub-two
8124 </li></ol>
8125 </li></ol>
8126
8127 !! end
8128
8129 !! test
8130 HTML ordered list item with parameters oddity
8131 !! input
8132 <ol><li id="fragment">One</li></ol>
8133 !! result
8134 <ol><li id="fragment">One</li></ol>
8135
8136 !! end
8137
8138 !!test
8139 bug 5918: autonumbering
8140 !! input
8141 [http://first/] [http://second] [ftp://ftp]
8142
8143 ftp://inlineftp
8144
8145 [mailto:enclosed@mail.tld With target]
8146
8147 [mailto:enclosed@mail.tld]
8148
8149 mailto:inline@mail.tld
8150 !! result
8151 <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>
8152 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
8153 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
8154 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
8155 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
8156 </p>
8157 !! end
8158
8159
8160 #
8161 # Security and HTML correctness
8162 # From Nick Jenkins' fuzz testing
8163 #
8164
8165 !! test
8166 Fuzz testing: Parser13
8167 !! input
8168 {|
8169 | http://a|
8170 !! result
8171 <table>
8172 <tr>
8173 <td>
8174 </td>
8175 </tr>
8176 </table>
8177
8178 !! end
8179
8180 !! test
8181 Fuzz testing: Parser14
8182 !! input
8183 == onmouseover= ==
8184 http://__TOC__
8185 !! result
8186 <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>
8187 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8188 <ul>
8189 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
8190 </ul>
8191 </td></tr></table>
8192
8193 !! end
8194
8195 !! test
8196 Fuzz testing: Parser14-table
8197 !! input
8198 ==a==
8199 {| STYLE=__TOC__
8200 !! result
8201 <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>
8202 <table style="&#95;_TOC&#95;_">
8203 <tr><td></td></tr>
8204 </table>
8205
8206 !! end
8207
8208 # Known to produce bogus xml (extra </td>)
8209 !! test
8210 Fuzz testing: Parser16
8211 !! options
8212 noxml
8213 !! input
8214 {|
8215 !https://||||||
8216 !! result
8217 <table>
8218 <tr>
8219 <th>https://</th>
8220 <th></th>
8221 <th></th>
8222 <th>
8223 </td>
8224 </tr>
8225 </table>
8226
8227 !! end
8228
8229 !! test
8230 Fuzz testing: Parser21
8231 !! input
8232 {|
8233 ! irc://{{ftp://a" onmouseover="alert('hello world');"
8234 |
8235 !! result
8236 <table>
8237 <tr>
8238 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
8239 </th>
8240 <td>
8241 </td>
8242 </tr>
8243 </table>
8244
8245 !! end
8246
8247 !! test
8248 Fuzz testing: Parser22
8249 !! input
8250 http://===r:::https://b
8251
8252 {|
8253 !!result
8254 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
8255 </p>
8256 <table>
8257 <tr><td></td></tr>
8258 </table>
8259
8260 !! end
8261
8262 # Known to produce bad XML for now
8263 !! test
8264 Fuzz testing: Parser24
8265 !! options
8266 noxml
8267 !! input
8268 {|
8269 {{{|
8270 <u CLASS=
8271 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
8272 <br style="onmouseover='alert(document.cookie);' " />
8273
8274 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
8275 |
8276 !! result
8277 <table>
8278 {{{|
8279 <u class="&#124;">}}}} &gt;
8280 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
8281
8282 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
8283 <tr>
8284 <td></u>
8285 </td>
8286 </tr>
8287 </table>
8288
8289 !! end
8290
8291 # Note: the current result listed for this is not what the original one was,
8292 # but the original bug was JavaScript injection, which is fixed in any case.
8293 # It's not clear that the original result listed was any more correct than the
8294 # current one. Original result:
8295 # <p>{{{|
8296 # </p>
8297 # <li class="&#124;&#124;">
8298 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
8299 !!test
8300 Fuzz testing: Parser25 (bug 6055)
8301 !! input
8302 {{{
8303 |
8304 <LI CLASS=||
8305 >
8306 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
8307 !! result
8308 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
8309 </p>
8310 !! end
8311
8312 !!test
8313 Fuzz testing: URL adjacent extension (with space, clean)
8314 !! options
8315 !! input
8316 http://example.com <nowiki>junk</nowiki>
8317 !! result
8318 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
8319 </p>
8320 !!end
8321
8322 !!test
8323 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
8324 !! options
8325 !! input
8326 http://example.com<nowiki>junk</nowiki>
8327 !! result
8328 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
8329 </p>
8330 !!end
8331
8332 !!test
8333 Fuzz testing: URL adjacent extension (no space, dirty; pre)
8334 !! options
8335 !! input
8336 http://example.com<pre>junk</pre>
8337 !! result
8338 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
8339
8340 !!end
8341
8342 !!test
8343 Fuzz testing: image with bogus manual thumbnail
8344 !!input
8345 [[Image:foobar.jpg|thumbnail= ]]
8346 !!result
8347 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
8348
8349 !!end
8350
8351 !! test
8352 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
8353 !! input
8354 <pre dir="&#10;"></pre>
8355 !! result
8356 <pre dir="&#10;"></pre>
8357
8358 !! end
8359
8360 !! test
8361 Parsing optional HTML elements (Bug 6171)
8362 !! options
8363 !! input
8364 <table>
8365 <tr>
8366 <td> Some tabular data</td>
8367 <td> More tabular data ...
8368 <td> And yet som tabular data</td>
8369 </tr>
8370 </table>
8371 !! result
8372 <table>
8373 <tr>
8374 <td> Some tabular data</td>
8375 <td> More tabular data ...
8376 </td><td> And yet som tabular data</td>
8377 </tr>
8378 </table>
8379
8380 !! end
8381
8382 !! test
8383 Correct handling of <td>, <tr> (Bug 6171)
8384 !! options
8385 !! input
8386 <table>
8387 <tr>
8388 <td> Some tabular data</td>
8389 <td> More tabular data ...</td>
8390 <td> And yet som tabular data</td>
8391 </tr>
8392 </table>
8393 !! result
8394 <table>
8395 <tr>
8396 <td> Some tabular data</td>
8397 <td> More tabular data ...</td>
8398 <td> And yet som tabular data</td>
8399 </tr>
8400 </table>
8401
8402 !! end
8403
8404
8405 !! test
8406 Parsing crashing regression (fr:JavaScript)
8407 !! input
8408 </body></x>
8409 !! result
8410 <p>&lt;/body&gt;&lt;/x&gt;
8411 </p>
8412 !! end
8413
8414 !! test
8415 Inline wiki vs wiki block nesting
8416 !! input
8417 '''Bold paragraph
8418
8419 New wiki paragraph
8420 !! result
8421 <p><b>Bold paragraph</b>
8422 </p><p>New wiki paragraph
8423 </p>
8424 !! end
8425
8426 !! test
8427 Inline HTML vs wiki block nesting
8428 !! options
8429 disabled
8430 !! input
8431 <b>Bold paragraph
8432
8433 New wiki paragraph
8434 !! result
8435 <p><b>Bold paragraph</b>
8436 </p><p>New wiki paragraph
8437 </p>
8438 !! end
8439
8440 # Original result was this:
8441 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
8442 # </p>
8443 # While that might be marginally more intuitive, maybe, the six-apostrophe
8444 # construct is clearly pathological and the result stated here (which is what
8445 # the parser actually does) is about as reasonable as anything.
8446 !!test
8447 Mixing markup for italics and bold
8448 !! options
8449 !! input
8450 '''bold''''''bold''bolditalics'''''
8451 !! result
8452 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
8453 </p>
8454 !! end
8455
8456
8457 !! article
8458 Xyzzyx
8459 !! text
8460 Article for special page transclusion test
8461 !! endarticle
8462
8463 !! test
8464 Special page transclusion
8465 !! options
8466 !! input
8467 {{Special:Prefixindex/Xyzzyx}}
8468 !! result
8469 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
8470
8471 !! end
8472
8473 !! test
8474 Special page transclusion twice (bug 5021)
8475 !! options
8476 !! input
8477 {{Special:Prefixindex/Xyzzyx}}
8478 {{Special:Prefixindex/Xyzzyx}}
8479 !! result
8480 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
8481 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
8482
8483 !! end
8484
8485 !! test
8486 Transclusion of default MediaWiki message
8487 !! input
8488 {{MediaWiki:Mainpage}}
8489 !!result
8490 <p>Main Page
8491 </p>
8492 !! end
8493
8494 !! test
8495 Transclusion of nonexistent MediaWiki message
8496 !! input
8497 {{MediaWiki:Mainpagexxx}}
8498 !!result
8499 <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>
8500 </p>
8501 !! end
8502
8503 !! test
8504 Transclusion of MediaWiki message with underscore
8505 !! input
8506 {{MediaWiki:history_short}}
8507 !! result
8508 <p>History
8509 </p>
8510 !! end
8511
8512 !! test
8513 Transclusion of MediaWiki message with space
8514 !! input
8515 {{MediaWiki:history short}}
8516 !! result
8517 <p>History
8518 </p>
8519 !! end
8520
8521 !! test
8522 Invalid header with following text
8523 !! input
8524 = x = y
8525 !! result
8526 <p>= x = y
8527 </p>
8528 !! end
8529
8530
8531 !! test
8532 Section extraction test (section 0)
8533 !! options
8534 section=0
8535 !! input
8536 start
8537 ==a==
8538 ===aa===
8539 ====aaa====
8540 ==b==
8541 ===ba===
8542 ===bb===
8543 ====bba====
8544 ===bc===
8545 ==c==
8546 ===ca===
8547 !! result
8548 start
8549 !! end
8550
8551 !! test
8552 Section extraction test (section 1)
8553 !! options
8554 section=1
8555 !! input
8556 start
8557 ==a==
8558 ===aa===
8559 ====aaa====
8560 ==b==
8561 ===ba===
8562 ===bb===
8563 ====bba====
8564 ===bc===
8565 ==c==
8566 ===ca===
8567 !! result
8568 ==a==
8569 ===aa===
8570 ====aaa====
8571 !! end
8572
8573 !! test
8574 Section extraction test (section 2)
8575 !! options
8576 section=2
8577 !! input
8578 start
8579 ==a==
8580 ===aa===
8581 ====aaa====
8582 ==b==
8583 ===ba===
8584 ===bb===
8585 ====bba====
8586 ===bc===
8587 ==c==
8588 ===ca===
8589 !! result
8590 ===aa===
8591 ====aaa====
8592 !! end
8593
8594 !! test
8595 Section extraction test (section 3)
8596 !! options
8597 section=3
8598 !! input
8599 start
8600 ==a==
8601 ===aa===
8602 ====aaa====
8603 ==b==
8604 ===ba===
8605 ===bb===
8606 ====bba====
8607 ===bc===
8608 ==c==
8609 ===ca===
8610 !! result
8611 ====aaa====
8612 !! end
8613
8614 !! test
8615 Section extraction test (section 4)
8616 !! options
8617 section=4
8618 !! input
8619 start
8620 ==a==
8621 ===aa===
8622 ====aaa====
8623 ==b==
8624 ===ba===
8625 ===bb===
8626 ====bba====
8627 ===bc===
8628 ==c==
8629 ===ca===
8630 !! result
8631 ==b==
8632 ===ba===
8633 ===bb===
8634 ====bba====
8635 ===bc===
8636 !! end
8637
8638 !! test
8639 Section extraction test (section 5)
8640 !! options
8641 section=5
8642 !! input
8643 start
8644 ==a==
8645 ===aa===
8646 ====aaa====
8647 ==b==
8648 ===ba===
8649 ===bb===
8650 ====bba====
8651 ===bc===
8652 ==c==
8653 ===ca===
8654 !! result
8655 ===ba===
8656 !! end
8657
8658 !! test
8659 Section extraction test (section 6)
8660 !! options
8661 section=6
8662 !! input
8663 start
8664 ==a==
8665 ===aa===
8666 ====aaa====
8667 ==b==
8668 ===ba===
8669 ===bb===
8670 ====bba====
8671 ===bc===
8672 ==c==
8673 ===ca===
8674 !! result
8675 ===bb===
8676 ====bba====
8677 !! end
8678
8679 !! test
8680 Section extraction test (section 7)
8681 !! options
8682 section=7
8683 !! input
8684 start
8685 ==a==
8686 ===aa===
8687 ====aaa====
8688 ==b==
8689 ===ba===
8690 ===bb===
8691 ====bba====
8692 ===bc===
8693 ==c==
8694 ===ca===
8695 !! result
8696 ====bba====
8697 !! end
8698
8699 !! test
8700 Section extraction test (section 8)
8701 !! options
8702 section=8
8703 !! input
8704 start
8705 ==a==
8706 ===aa===
8707 ====aaa====
8708 ==b==
8709 ===ba===
8710 ===bb===
8711 ====bba====
8712 ===bc===
8713 ==c==
8714 ===ca===
8715 !! result
8716 ===bc===
8717 !! end
8718
8719 !! test
8720 Section extraction test (section 9)
8721 !! options
8722 section=9
8723 !! input
8724 start
8725 ==a==
8726 ===aa===
8727 ====aaa====
8728 ==b==
8729 ===ba===
8730 ===bb===
8731 ====bba====
8732 ===bc===
8733 ==c==
8734 ===ca===
8735 !! result
8736 ==c==
8737 ===ca===
8738 !! end
8739
8740 !! test
8741 Section extraction test (section 10)
8742 !! options
8743 section=10
8744 !! input
8745 start
8746 ==a==
8747 ===aa===
8748 ====aaa====
8749 ==b==
8750 ===ba===
8751 ===bb===
8752 ====bba====
8753 ===bc===
8754 ==c==
8755 ===ca===
8756 !! result
8757 ===ca===
8758 !! end
8759
8760 !! test
8761 Section extraction test (nonexistent section 11)
8762 !! options
8763 section=11
8764 !! input
8765 start
8766 ==a==
8767 ===aa===
8768 ====aaa====
8769 ==b==
8770 ===ba===
8771 ===bb===
8772 ====bba====
8773 ===bc===
8774 ==c==
8775 ===ca===
8776 !! result
8777 !! end
8778
8779 !! test
8780 Section extraction test with bogus heading (section 1)
8781 !! options
8782 section=1
8783 !! input
8784 ==a==
8785 ==bogus== not a legal section
8786 ==b==
8787 !! result
8788 ==a==
8789 ==bogus== not a legal section
8790 !! end
8791
8792 !! test
8793 Section extraction test with bogus heading (section 2)
8794 !! options
8795 section=2
8796 !! input
8797 ==a==
8798 ==bogus== not a legal section
8799 ==b==
8800 !! result
8801 ==b==
8802 !! end
8803
8804 !! test
8805 Section extraction test with comment after heading (section 1)
8806 !! options
8807 section=1
8808 !! input
8809 ==a==
8810 ==b== <!-- -->
8811 ==c==
8812 !! result
8813 ==a==
8814 !! end
8815
8816 !! test
8817 Section extraction test with comment after heading (section 2)
8818 !! options
8819 section=2
8820 !! input
8821 ==a==
8822 ==b== <!-- -->
8823 ==c==
8824 !! result
8825 ==b== <!-- -->
8826 !! end
8827
8828 !! test
8829 Section extraction test with bogus <nowiki> heading (section 1)
8830 !! options
8831 section=1
8832 !! input
8833 ==a==
8834 ==bogus== <nowiki>not a legal section</nowiki>
8835 ==b==
8836 !! result
8837 ==a==
8838 ==bogus== <nowiki>not a legal section</nowiki>
8839 !! end
8840
8841 !! test
8842 Section extraction test with bogus <nowiki> heading (section 2)
8843 !! options
8844 section=2
8845 !! input
8846 ==a==
8847 ==bogus== <nowiki>not a legal section</nowiki>
8848 ==b==
8849 !! result
8850 ==b==
8851 !! end
8852
8853
8854 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
8855 # instead of respecting commented sections
8856 !! test
8857 Section extraction prefixed by comment (section 1)
8858 !! options
8859 section=1
8860 !! input
8861 <!-- -->==sec1==
8862 ==sec2==
8863 !!result
8864 ==sec2==
8865 !!end
8866
8867 !! test
8868 Section extraction prefixed by comment (section 2)
8869 !! options
8870 section=2
8871 !! input
8872 <!-- -->==sec1==
8873 ==sec2==
8874 !!result
8875
8876 !!end
8877
8878
8879 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
8880 # instead of respecting HTML-style headings
8881 !! test
8882 Section extraction, mixed wiki and html (section 1)
8883 !! options
8884 section=1
8885 !! input
8886 <h2>unmarked</h2>
8887 unmarked
8888 ==1==
8889 one
8890 ==2==
8891 two
8892 !! result
8893 ==1==
8894 one
8895 !! end
8896
8897 !! test
8898 Section extraction, mixed wiki and html (section 2)
8899 !! options
8900 section=2
8901 !! input
8902 <h2>unmarked</h2>
8903 unmarked
8904 ==1==
8905 one
8906 ==2==
8907 two
8908 !! result
8909 ==2==
8910 two
8911 !! end
8912
8913
8914 # Formerly testing for bug 3342
8915 !! test
8916 Section extraction, heading surrounded by <noinclude>
8917 !! options
8918 section=1
8919 !! input
8920 <noinclude>==unmarked==</noinclude>
8921 ==marked==
8922 !! result
8923 ==marked==
8924 !!end
8925
8926 # Test behaviour of bug 19910
8927 !! test
8928 Sectiion with all-equals
8929 !! options
8930 section=2
8931 !! input
8932 ===
8933 The line above must have a trailing space
8934 === <!--
8935 --> <!-- -->
8936 But just in case it doesn't...
8937 !! result
8938 === <!--
8939 --> <!-- -->
8940 But just in case it doesn't...
8941 !! end
8942
8943 !! test
8944 Section replacement test (section 0)
8945 !! options
8946 replace=0,"xxx"
8947 !! input
8948 start
8949 ==a==
8950 ===aa===
8951 ====aaa====
8952 ==b==
8953 ===ba===
8954 ===bb===
8955 ====bba====
8956 ===bc===
8957 ==c==
8958 ===ca===
8959 !! result
8960 xxx
8961
8962 ==a==
8963 ===aa===
8964 ====aaa====
8965 ==b==
8966 ===ba===
8967 ===bb===
8968 ====bba====
8969 ===bc===
8970 ==c==
8971 ===ca===
8972 !! end
8973
8974 !! test
8975 Section replacement test (section 1)
8976 !! options
8977 replace=1,"xxx"
8978 !! input
8979 start
8980 ==a==
8981 ===aa===
8982 ====aaa====
8983 ==b==
8984 ===ba===
8985 ===bb===
8986 ====bba====
8987 ===bc===
8988 ==c==
8989 ===ca===
8990 !! result
8991 start
8992 xxx
8993
8994 ==b==
8995 ===ba===
8996 ===bb===
8997 ====bba====
8998 ===bc===
8999 ==c==
9000 ===ca===
9001 !! end
9002
9003 !! test
9004 Section replacement test (section 2)
9005 !! options
9006 replace=2,"xxx"
9007 !! input
9008 start
9009 ==a==
9010 ===aa===
9011 ====aaa====
9012 ==b==
9013 ===ba===
9014 ===bb===
9015 ====bba====
9016 ===bc===
9017 ==c==
9018 ===ca===
9019 !! result
9020 start
9021 ==a==
9022 xxx
9023
9024 ==b==
9025 ===ba===
9026 ===bb===
9027 ====bba====
9028 ===bc===
9029 ==c==
9030 ===ca===
9031 !! end
9032
9033 !! test
9034 Section replacement test (section 3)
9035 !! options
9036 replace=3,"xxx"
9037 !! input
9038 start
9039 ==a==
9040 ===aa===
9041 ====aaa====
9042 ==b==
9043 ===ba===
9044 ===bb===
9045 ====bba====
9046 ===bc===
9047 ==c==
9048 ===ca===
9049 !! result
9050 start
9051 ==a==
9052 ===aa===
9053 xxx
9054
9055 ==b==
9056 ===ba===
9057 ===bb===
9058 ====bba====
9059 ===bc===
9060 ==c==
9061 ===ca===
9062 !! end
9063
9064 !! test
9065 Section replacement test (section 4)
9066 !! options
9067 replace=4,"xxx"
9068 !! input
9069 start
9070 ==a==
9071 ===aa===
9072 ====aaa====
9073 ==b==
9074 ===ba===
9075 ===bb===
9076 ====bba====
9077 ===bc===
9078 ==c==
9079 ===ca===
9080 !! result
9081 start
9082 ==a==
9083 ===aa===
9084 ====aaa====
9085 xxx
9086
9087 ==c==
9088 ===ca===
9089 !! end
9090
9091 !! test
9092 Section replacement test (section 5)
9093 !! options
9094 replace=5,"xxx"
9095 !! input
9096 start
9097 ==a==
9098 ===aa===
9099 ====aaa====
9100 ==b==
9101 ===ba===
9102 ===bb===
9103 ====bba====
9104 ===bc===
9105 ==c==
9106 ===ca===
9107 !! result
9108 start
9109 ==a==
9110 ===aa===
9111 ====aaa====
9112 ==b==
9113 xxx
9114
9115 ===bb===
9116 ====bba====
9117 ===bc===
9118 ==c==
9119 ===ca===
9120 !! end
9121
9122 !! test
9123 Section replacement test (section 6)
9124 !! options
9125 replace=6,"xxx"
9126 !! input
9127 start
9128 ==a==
9129 ===aa===
9130 ====aaa====
9131 ==b==
9132 ===ba===
9133 ===bb===
9134 ====bba====
9135 ===bc===
9136 ==c==
9137 ===ca===
9138 !! result
9139 start
9140 ==a==
9141 ===aa===
9142 ====aaa====
9143 ==b==
9144 ===ba===
9145 xxx
9146
9147 ===bc===
9148 ==c==
9149 ===ca===
9150 !! end
9151
9152 !! test
9153 Section replacement test (section 7)
9154 !! options
9155 replace=7,"xxx"
9156 !! input
9157 start
9158 ==a==
9159 ===aa===
9160 ====aaa====
9161 ==b==
9162 ===ba===
9163 ===bb===
9164 ====bba====
9165 ===bc===
9166 ==c==
9167 ===ca===
9168 !! result
9169 start
9170 ==a==
9171 ===aa===
9172 ====aaa====
9173 ==b==
9174 ===ba===
9175 ===bb===
9176 xxx
9177
9178 ===bc===
9179 ==c==
9180 ===ca===
9181 !! end
9182
9183 !! test
9184 Section replacement test (section 8)
9185 !! options
9186 replace=8,"xxx"
9187 !! input
9188 start
9189 ==a==
9190 ===aa===
9191 ====aaa====
9192 ==b==
9193 ===ba===
9194 ===bb===
9195 ====bba====
9196 ===bc===
9197 ==c==
9198 ===ca===
9199 !! result
9200 start
9201 ==a==
9202 ===aa===
9203 ====aaa====
9204 ==b==
9205 ===ba===
9206 ===bb===
9207 ====bba====
9208 xxx
9209
9210 ==c==
9211 ===ca===
9212 !!end
9213
9214 !! test
9215 Section replacement test (section 9)
9216 !! options
9217 replace=9,"xxx"
9218 !! input
9219 start
9220 ==a==
9221 ===aa===
9222 ====aaa====
9223 ==b==
9224 ===ba===
9225 ===bb===
9226 ====bba====
9227 ===bc===
9228 ==c==
9229 ===ca===
9230 !! result
9231 start
9232 ==a==
9233 ===aa===
9234 ====aaa====
9235 ==b==
9236 ===ba===
9237 ===bb===
9238 ====bba====
9239 ===bc===
9240 xxx
9241 !! end
9242
9243 !! test
9244 Section replacement test (section 10)
9245 !! options
9246 replace=10,"xxx"
9247 !! input
9248 start
9249 ==a==
9250 ===aa===
9251 ====aaa====
9252 ==b==
9253 ===ba===
9254 ===bb===
9255 ====bba====
9256 ===bc===
9257 ==c==
9258 ===ca===
9259 !! result
9260 start
9261 ==a==
9262 ===aa===
9263 ====aaa====
9264 ==b==
9265 ===ba===
9266 ===bb===
9267 ====bba====
9268 ===bc===
9269 ==c==
9270 xxx
9271 !! end
9272
9273 !! test
9274 Section replacement test with initial whitespace (bug 13728)
9275 !! options
9276 replace=2,"xxx"
9277 !! input
9278 Preformatted initial line
9279 ==a==
9280 ===a===
9281 !! result
9282 Preformatted initial line
9283 ==a==
9284 xxx
9285 !! end
9286
9287
9288 !! test
9289 Section extraction, heading followed by pre with 20 spaces (bug 6398)
9290 !! options
9291 section=1
9292 !! input
9293 ==a==
9294 a
9295 !! result
9296 ==a==
9297 a
9298 !! end
9299
9300 !! test
9301 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
9302 !! options
9303 section=1
9304 !! input
9305 ==a==
9306 a
9307 !! result
9308 ==a==
9309 a
9310 !! end
9311
9312
9313 !! test
9314 Section extraction, <pre> around bogus header (bug 10309)
9315 !! options
9316 noxml section=2
9317 !! input
9318 == Section One ==
9319 <pre>
9320 =======
9321 </pre>
9322
9323 == Section Two ==
9324 stuff
9325 !! result
9326 == Section Two ==
9327 stuff
9328 !! end
9329
9330 !! test
9331 Section replacement, <pre> around bogus header (bug 10309)
9332 !! options
9333 noxml replace=2,"xxx"
9334 !! input
9335 == Section One ==
9336 <pre>
9337 =======
9338 </pre>
9339
9340 == Section Two ==
9341 stuff
9342 !! result
9343 == Section One ==
9344 <pre>
9345 =======
9346 </pre>
9347
9348 xxx
9349 !! end
9350
9351
9352
9353 !! test
9354 Handling of &#x0A; in URLs
9355 !! input
9356 **irc://&#x0A;a
9357 !! result
9358 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
9359 </li></ul>
9360 </li></ul>
9361
9362 !!end
9363
9364 !! test
9365 5 quotes, code coverage +1 line
9366 !! input
9367 '''''
9368 !! result
9369 !! end
9370
9371 !! test
9372 Special:Search page linking.
9373 !! input
9374 {{Special:search}}
9375 !! result
9376 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
9377 </p>
9378 !! end
9379
9380 !! test
9381 Say the magic word
9382 !! input
9383 * {{PAGENAME}}
9384 * {{BASEPAGENAME}}
9385 * {{SUBPAGENAME}}
9386 * {{SUBPAGENAMEE}}
9387 * {{BASEPAGENAME}}
9388 * {{BASEPAGENAMEE}}
9389 * {{TALKPAGENAME}}
9390 * {{TALKPAGENAMEE}}
9391 * {{SUBJECTPAGENAME}}
9392 * {{SUBJECTPAGENAMEE}}
9393 * {{NAMESPACEE}}
9394 * {{NAMESPACE}}
9395 * {{TALKSPACE}}
9396 * {{TALKSPACEE}}
9397 * {{SUBJECTSPACE}}
9398 * {{SUBJECTSPACEE}}
9399 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
9400 !! result
9401 <ul><li> Parser test
9402 </li><li> Parser test
9403 </li><li> Parser test
9404 </li><li> Parser_test
9405 </li><li> Parser test
9406 </li><li> Parser_test
9407 </li><li> Talk:Parser test
9408 </li><li> Talk:Parser_test
9409 </li><li> Parser test
9410 </li><li> Parser_test
9411 </li><li>
9412 </li><li>
9413 </li><li> Talk
9414 </li><li> Talk
9415 </li><li>
9416 </li><li>
9417 </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>
9418 </li></ul>
9419
9420 !! end
9421 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
9422
9423 !! test
9424 Gallery
9425 !! input
9426 <gallery>
9427 image1.png |
9428 image2.gif|||||
9429
9430 image3|
9431 image4 |300px| centre
9432 image5.svg| http://///////
9433 [[x|xx]]]]
9434 * image6
9435 </gallery>
9436 !! result
9437 <ul class="gallery">
9438 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9439 <div style="height: 150px;">Image1.png</div>
9440 <div class="gallerytext">
9441 </div>
9442 </div></li>
9443 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9444 <div style="height: 150px;">Image2.gif</div>
9445 <div class="gallerytext">
9446 <p>||||
9447 </p>
9448 </div>
9449 </div></li>
9450 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9451 <div style="height: 150px;">Image3</div>
9452 <div class="gallerytext">
9453 </div>
9454 </div></li>
9455 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9456 <div style="height: 150px;">Image4</div>
9457 <div class="gallerytext">
9458 <p>300px| centre
9459 </p>
9460 </div>
9461 </div></li>
9462 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9463 <div style="height: 150px;">Image5.svg</div>
9464 <div class="gallerytext">
9465 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
9466 </p>
9467 </div>
9468 </div></li>
9469 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9470 <div style="height: 150px;">* image6</div>
9471 <div class="gallerytext">
9472 </div>
9473 </div></li>
9474 </ul>
9475
9476 !! end
9477
9478 !! test
9479 Gallery (with options)
9480 !! input
9481 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
9482 File:Nonexistant.jpg|caption
9483 File:Nonexistant.jpg
9484 image:foobar.jpg|some '''caption''' [[Main Page]]
9485 image:foobar.jpg
9486 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
9487 </gallery>
9488 !! result
9489 <ul class="gallery" style="max-width: 226px;_width: 226px;">
9490 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
9491 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9492 <div style="height: 70px;">Nonexistant.jpg</div>
9493 <div class="gallerytext">
9494 <p>caption
9495 </p>
9496 </div>
9497 </div></li>
9498 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9499 <div style="height: 70px;">Nonexistant.jpg</div>
9500 <div class="gallerytext">
9501 </div>
9502 </div></li>
9503 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9504 <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>
9505 <div class="gallerytext">
9506 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9507 </p>
9508 </div>
9509 </div></li>
9510 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9511 <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>
9512 <div class="gallerytext">
9513 </div>
9514 </div></li>
9515 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9516 <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>
9517 <div class="gallerytext">
9518 <p>Blabla|blabla.
9519 </p>
9520 </div>
9521 </div></li>
9522 </ul>
9523
9524 !! end
9525
9526 !! test
9527 Gallery with wikitext inside caption
9528 !! input
9529 <gallery>
9530 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
9531 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
9532 </gallery>
9533 !! result
9534 <ul class="gallery">
9535 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9536 <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>
9537 <div class="gallerytext">
9538 <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>
9539 </p>
9540 </div>
9541 </div></li>
9542 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9543 <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>
9544 <div class="gallerytext">
9545 <p>This is a test template
9546 </p>
9547 </div>
9548 </div></li>
9549 </ul>
9550
9551 !! end
9552
9553 !! test
9554 gallery (with showfilename option)
9555 !! input
9556 <gallery showfilename>
9557 File:Nonexistant.jpg|caption
9558 File:Nonexistant.jpg
9559 image:foobar.jpg|some '''caption''' [[Main Page]]
9560 File:Foobar.jpg
9561 </gallery>
9562 !! result
9563 <ul class="gallery">
9564 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9565 <div style="height: 150px;">Nonexistant.jpg</div>
9566 <div class="gallerytext">
9567 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
9568 caption
9569 </p>
9570 </div>
9571 </div></li>
9572 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9573 <div style="height: 150px;">Nonexistant.jpg</div>
9574 <div class="gallerytext">
9575 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
9576 </p>
9577 </div>
9578 </div></li>
9579 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9580 <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>
9581 <div class="gallerytext">
9582 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
9583 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9584 </p>
9585 </div>
9586 </div></li>
9587 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9588 <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>
9589 <div class="gallerytext">
9590 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
9591 </p>
9592 </div>
9593 </div></li>
9594 </ul>
9595
9596 !! end
9597
9598 !! test
9599 Gallery (with namespace-less filenames)
9600 !! input
9601 <gallery>
9602 File:Nonexistant.jpg
9603 Nonexistant.jpg
9604 image:foobar.jpg
9605 foobar.jpg
9606 </gallery>
9607 !! result
9608 <ul class="gallery">
9609 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9610 <div style="height: 150px;">Nonexistant.jpg</div>
9611 <div class="gallerytext">
9612 </div>
9613 </div></li>
9614 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9615 <div style="height: 150px;">Nonexistant.jpg</div>
9616 <div class="gallerytext">
9617 </div>
9618 </div></li>
9619 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9620 <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>
9621 <div class="gallerytext">
9622 </div>
9623 </div></li>
9624 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9625 <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>
9626 <div class="gallerytext">
9627 </div>
9628 </div></li>
9629 </ul>
9630
9631 !! end
9632
9633 !! test
9634 HTML Hex character encoding (spells the word "JavaScript")
9635 !! input
9636 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
9637 !! result
9638 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
9639 </p>
9640 !! end
9641
9642 !! test
9643 HTML Hex character encoding bogus encoding (bug 26437 regression check)
9644 !! input
9645 &#xsee;&#XSEE;
9646 !! result
9647 <p>&amp;#xsee;&amp;#XSEE;
9648 </p>
9649 !! end
9650
9651 !! test
9652 HTML Hex character encoding mixed case
9653 !! input
9654 &#xEE;&#Xee;
9655 !! result
9656 <p>&#xee;&#xee;
9657 </p>
9658 !! end
9659
9660 !! test
9661 __FORCETOC__ override
9662 !! input
9663 __NEWSECTIONLINK__
9664 __FORCETOC__
9665 !! result
9666 <p><br />
9667 </p>
9668 !! end
9669
9670 !! test
9671 ISBN code coverage
9672 !! input
9673 ISBN 978-0-1234-56&#x20;789
9674 !! result
9675 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
9676 </p>
9677 !! end
9678
9679 !! test
9680 ISBN followed by 5 spaces
9681 !! input
9682 ISBN
9683 !! result
9684 <p>ISBN
9685 </p>
9686 !! end
9687
9688 !! test
9689 Double ISBN
9690 !! input
9691 ISBN ISBN 1234567890
9692 !! result
9693 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
9694 </p>
9695 !! end
9696
9697 !! test
9698 Bug 22905: <abbr> followed by ISBN followed by </a>
9699 !! input
9700 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
9701 !! result
9702 <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>
9703 </p>
9704 !! end
9705
9706 !! test
9707 Double RFC
9708 !! input
9709 RFC RFC 1234
9710 !! result
9711 <p>RFC <a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
9712 </p>
9713 !! end
9714
9715 !! test
9716 Double RFC with a wiki link
9717 !! input
9718 RFC [[RFC 1234]]
9719 !! result
9720 <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>
9721 </p>
9722 !! end
9723
9724 !! test
9725 RFC code coverage
9726 !! input
9727 RFC 983&#x20;987
9728 !! result
9729 <p><a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
9730 </p>
9731 !! end
9732
9733 !! test
9734 Centre-aligned image
9735 !! input
9736 [[Image:foobar.jpg|centre]]
9737 !! result
9738 <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>
9739
9740 !!end
9741
9742 !! test
9743 None-aligned image
9744 !! input
9745 [[Image:foobar.jpg|none]]
9746 !! result
9747 <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>
9748
9749 !!end
9750
9751 !! test
9752 Width + Height sized image (using px) (height is ignored)
9753 !! input
9754 [[Image:foobar.jpg|640x480px]]
9755 !! result
9756 <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>
9757 </p>
9758 !!end
9759
9760 !! test
9761 Width-sized image (using px, no following whitespace)
9762 !! input
9763 [[Image:foobar.jpg|640px]]
9764 !! result
9765 <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>
9766 </p>
9767 !!end
9768
9769 !! test
9770 Width-sized image (using px, with following whitespace - test regression from r39467)
9771 !! input
9772 [[Image:foobar.jpg|640px ]]
9773 !! result
9774 <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>
9775 </p>
9776 !!end
9777
9778 !! test
9779 Width-sized image (using px, with preceding whitespace - test regression from r39467)
9780 !! input
9781 [[Image:foobar.jpg| 640px]]
9782 !! result
9783 <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>
9784 </p>
9785 !!end
9786
9787 !! test
9788 Another italics / bold test
9789 !! input
9790 ''' ''x'
9791 !! result
9792 <pre>'<i> </i>x'
9793 </pre>
9794 !!end
9795
9796 # Note the results may be incorrect, as parserTest output included this:
9797 # XML error: Mismatched tag at byte 6120:
9798 # ...<dd> </dt></dl> </dd...
9799 !! test
9800 dt/dd/dl test
9801 !! options
9802 disabled
9803 !! input
9804 :;;;::
9805 !! result
9806 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
9807 </dd></dl>
9808 </dd></dl>
9809 </dt></dl>
9810 </dt></dl>
9811 </dt></dl>
9812 </dd></dl>
9813
9814 !!end
9815
9816
9817 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
9818 !! test
9819 Images with the "|" character in the comment
9820 !! input
9821 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
9822 !! result
9823 <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>
9824
9825 !!end
9826
9827 !! test
9828 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
9829 !! input
9830 <html><script>alert(1);</script></html>
9831 !! result
9832 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
9833 </p>
9834 !! end
9835
9836 !! test
9837 HTML with raw HTML ($wgRawHtml==true)
9838 !! options
9839 rawhtml
9840 !! input
9841 <html><script>alert(1);</script></html>
9842 !! result
9843 <p><script>alert(1);</script>
9844 </p>
9845 !! end
9846
9847 !! test
9848 Parents of subpages, one level up
9849 !! options
9850 subpage title=[[Subpage test/L1/L2/L3]]
9851 !! input
9852 [[../|L2]]
9853 !! result
9854 <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>
9855 </p>
9856 !! end
9857
9858
9859 !! test
9860 Parents of subpages, one level up, not named
9861 !! options
9862 subpage title=[[Subpage test/L1/L2/L3]]
9863 !! input
9864 [[../]]
9865 !! result
9866 <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>
9867 </p>
9868 !! end
9869
9870
9871
9872 !! test
9873 Parents of subpages, two levels up
9874 !! options
9875 subpage title=[[Subpage test/L1/L2/L3]]
9876 !! input
9877 [[../../|L1]]2
9878
9879 [[../../|L1]]l
9880 !! result
9881 <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
9882 </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>
9883 </p>
9884 !! end
9885
9886 !! test
9887 Parents of subpages, two levels up, without trailing slash or name.
9888 !! options
9889 subpage title=[[Subpage test/L1/L2/L3]]
9890 !! input
9891 [[../..]]
9892 !! result
9893 <p>[[../..]]
9894 </p>
9895 !! end
9896
9897 !! test
9898 Parents of subpages, two levels up, with lots of extra trailing slashes.
9899 !! options
9900 subpage title=[[Subpage test/L1/L2/L3]]
9901 !! input
9902 [[../../////]]
9903 !! result
9904 <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>
9905 </p>
9906 !! end
9907
9908 !! test
9909 Definition list code coverage
9910 !! input
9911 ; title : def
9912 ; title : def
9913 ;title: def
9914 !! result
9915 <dl><dt> title &#160;</dt><dd> def
9916 </dd><dt> title&#160;</dt><dd> def
9917 </dd><dt>title</dt><dd> def
9918 </dd></dl>
9919
9920 !! end
9921
9922 !! test
9923 Don't fall for the self-closing div
9924 !! input
9925 <div>hello world</div/>
9926 !! result
9927 <div>hello world</div>
9928
9929 !! end
9930
9931 !! test
9932 MSGNW magic word
9933 !! input
9934 {{MSGNW:msg}}
9935 !! result
9936 <p>&#91;&#91;:Template:Msg&#93;&#93;
9937 </p>
9938 !! end
9939
9940 !! test
9941 RAW magic word
9942 !! input
9943 {{RAW:QUERTY}}
9944 !! result
9945 <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>
9946 </p>
9947 !! end
9948
9949 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
9950 !! test
9951 Always escape literal '>' in output, not just after '<'
9952 !! input
9953 ><>
9954 !! result
9955 <p>&gt;&lt;&gt;
9956 </p>
9957 !! end
9958
9959 !! test
9960 Template caching
9961 !! input
9962 {{Test}}
9963 {{Test}}
9964 !! result
9965 <p>This is a test template
9966 This is a test template
9967 </p>
9968 !! end
9969
9970
9971 !! article
9972 MediaWiki:Fake
9973 !! text
9974 ==header==
9975 !! endarticle
9976
9977 !! test
9978 Inclusion of !userCanEdit() content
9979 !! input
9980 {{MediaWiki:Fake}}
9981 !! result
9982 <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>
9983
9984 !! end
9985
9986
9987 !! test
9988 Out-of-order TOC heading levels
9989 !! input
9990 ==2==
9991 ======6======
9992 ===3===
9993 =1=
9994 =====5=====
9995 ==2==
9996 !! result
9997 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9998 <ul>
9999 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
10000 <ul>
10001 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
10002 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
10003 </ul>
10004 </li>
10005 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
10006 <ul>
10007 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
10008 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
10009 </ul>
10010 </li>
10011 </ul>
10012 </td></tr></table>
10013 <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>
10014 <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>
10015 <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>
10016 <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>
10017 <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>
10018 <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>
10019
10020 !! end
10021
10022
10023 !! test
10024 ISBN with a dummy number
10025 !! input
10026 ISBN ---
10027 !! result
10028 <p>ISBN ---
10029 </p>
10030 !! end
10031
10032
10033 !! test
10034 ISBN with space-delimited number
10035 !! input
10036 ISBN 92 9017 032 8
10037 !! result
10038 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
10039 </p>
10040 !! end
10041
10042
10043 !! test
10044 ISBN with multiple spaces, no number
10045 !! input
10046 ISBN foo
10047 !! result
10048 <p>ISBN foo
10049 </p>
10050 !! end
10051
10052
10053 !! test
10054 ISBN length
10055 !! input
10056 ISBN 123456789
10057
10058 ISBN 1234567890
10059
10060 ISBN 12345678901
10061 !! result
10062 <p>ISBN 123456789
10063 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
10064 </p><p>ISBN 12345678901
10065 </p>
10066 !! end
10067
10068
10069 !! test
10070 ISBN with trailing year (bug 8110)
10071 !! input
10072 ISBN 1-234-56789-0 - 2006
10073
10074 ISBN 1 234 56789 0 - 2006
10075 !! result
10076 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
10077 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
10078 </p>
10079 !! end
10080
10081
10082 !! test
10083 anchorencode
10084 !! input
10085 {{anchorencode:foo bar©#%n}}
10086 !! result
10087 <p>foo_bar.C2.A9.23.25n
10088 </p>
10089 !! end
10090
10091 !! test
10092 anchorencode trims spaces
10093 !! input
10094 {{anchorencode: __pretty__please__}}
10095 !! result
10096 <p>pretty_please
10097 </p>
10098 !! end
10099
10100 !! test
10101 anchorencode deals with links
10102 !! input
10103 {{anchorencode: [[hello|world]] [[hi]]}}
10104 !! result
10105 <p>world_hi
10106 </p>
10107 !! end
10108
10109 !! test
10110 anchorencode deals with templates
10111 !! input
10112 {{anchorencode: {{Foo}} }}
10113 !! result
10114 <p>FOO
10115 </p>
10116 !! end
10117
10118 !! test
10119 anchorencode encodes like the TOC generator: (bug 18431)
10120 !! input
10121 === _ +:.3A%3A&&amp;]] ===
10122 {{anchorencode: _ +:.3A%3A&&amp;]] }}
10123 __NOEDITSECTION__
10124 !! result
10125 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
10126 <p>.2B:.3A.253A.26.26.5D.5D
10127 </p>
10128 !! end
10129
10130 # Expected output in the following test is not necessarily expected (there
10131 # should probably be <p> tags inside the <blockquote> in the output) -- it's
10132 # only testing for well-formedness.
10133 !! test
10134 Bug 6200: blockquotes and paragraph formatting
10135 !! input
10136 <blockquote>
10137 foo
10138 </blockquote>
10139
10140 bar
10141
10142 baz
10143 !! result
10144 <blockquote>
10145 foo
10146 </blockquote>
10147 <p>bar
10148 </p>
10149 <pre>baz
10150 </pre>
10151 !! end
10152
10153 !! test
10154 Bug 8293: Use of center tag ruins paragraph formatting
10155 !! input
10156 <center>
10157 foo
10158 </center>
10159
10160 bar
10161
10162 baz
10163 !! result
10164 <center>
10165 <p>foo
10166 </p>
10167 </center>
10168 <p>bar
10169 </p>
10170 <pre>baz
10171 </pre>
10172 !! end
10173
10174
10175 ###
10176 ### Language variants related tests
10177 ###
10178 !! test
10179 Self-link in language variants
10180 !! options
10181 title=[[Dunav]] language=sr
10182 !! input
10183 Both [[Dunav]] and [[Дунав]] are names for this river.
10184 !! result
10185 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
10186 </p>
10187 !!end
10188
10189
10190 !! test
10191 Link to pages in language variants
10192 !! options
10193 language=sr
10194 !! input
10195 Main Page can be written as [[Маин Паге]]
10196 !! result
10197 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
10198 </p>
10199 !!end
10200
10201
10202 !! test
10203 Multiple links to pages in language variants
10204 !! options
10205 language=sr
10206 !! input
10207 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
10208 !! result
10209 <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>.
10210 </p>
10211 !!end
10212
10213
10214 !! test
10215 Simple template in language variants
10216 !! options
10217 language=sr
10218 !! input
10219 {{тест}}
10220 !! result
10221 <p>This is a test template
10222 </p>
10223 !! end
10224
10225
10226 !! test
10227 Template with explicit namespace in language variants
10228 !! options
10229 language=sr
10230 !! input
10231 {{Template:тест}}
10232 !! result
10233 <p>This is a test template
10234 </p>
10235 !! end
10236
10237
10238 !! test
10239 Basic test for template parameter in language variants
10240 !! options
10241 language=sr
10242 !! input
10243 {{парамтест|param=foo}}
10244 !! result
10245 <p>This is a test template with parameter foo
10246 </p>
10247 !! end
10248
10249
10250 !! test
10251 Simple category in language variants
10252 !! options
10253 language=sr cat
10254 !! input
10255 [[Category:МедиаWики Усер'с Гуиде]]
10256 !! result
10257 <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>
10258 !! end
10259
10260
10261 !! test
10262 Stripping -{}- tags (language variants)
10263 !! options
10264 language=sr
10265 !! input
10266 Latin proverb: -{Ne nuntium necare}-
10267 !! result
10268 <p>Latin proverb: Ne nuntium necare
10269 </p>
10270 !! end
10271
10272
10273 !! test
10274 Prevent conversion with -{}- tags (language variants)
10275 !! options
10276 language=sr variant=sr-ec
10277 !! input
10278 Latinski: -{Ne nuntium necare}-
10279 !! result
10280 <p>Латински: Ne nuntium necare
10281 </p>
10282 !! end
10283
10284
10285 !! test
10286 Prevent conversion of text with -{}- tags (language variants)
10287 !! options
10288 language=sr variant=sr-ec
10289 !! input
10290 Latinski: -{Ne nuntium necare}-
10291 !! result
10292 <p>Латински: Ne nuntium necare
10293 </p>
10294 !! end
10295
10296
10297 !! test
10298 Prevent conversion of links with -{}- tags (language variants)
10299 !! options
10300 language=sr variant=sr-ec
10301 !! input
10302 -{[[Main Page]]}-
10303 !! result
10304 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10305 </p>
10306 !! end
10307
10308
10309 !! test
10310 -{}- tags within headlines (within html for parserConvert())
10311 !! options
10312 language=sr variant=sr-ec
10313 !! input
10314 == -{Naslov}- ==
10315 !! result
10316 <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>
10317
10318 !! end
10319
10320
10321 !! test
10322 Explicit definition of language variant alternatives
10323 !! options
10324 language=zh variant=zh-tw
10325 !! input
10326 -{zh:China;zh-tw:Taiwan}-, not China
10327 !! result
10328 <p>Taiwan, not China
10329 </p>
10330 !! end
10331
10332
10333 !! test
10334 Explicit session-wise language variant mapping (A flag and - flag)
10335 !! options
10336 language=zh variant=zh-tw
10337 !! input
10338 Taiwan is not China.
10339 But -{A|zh:China;zh-tw:Taiwan}- is China,
10340 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
10341 and -{China}- is China.
10342 !! result
10343 <p>Taiwan is not China.
10344 But Taiwan is Taiwan,
10345 (This should be stripped!)
10346 and China is China.
10347 </p>
10348 !! end
10349
10350 !! test
10351 Explicit session-wise language variant mapping (H flag for hide)
10352 !! options
10353 language=zh variant=zh-tw
10354 !! input
10355 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
10356 Taiwan is China.
10357 !! result
10358 <p>(This should be stripped!)
10359 Taiwan is Taiwan.
10360 </p>
10361 !! end
10362
10363 !! test
10364 Adding explicit conversion rule for title (T flag)
10365 !! options
10366 language=zh variant=zh-tw showtitle
10367 !! input
10368 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
10369 !! result
10370 Taiwan
10371 <p>Should be stripped!
10372 </p>
10373 !! end
10374
10375 !! test
10376 Testing that changing the language variant here in the tests actually works
10377 !! options
10378 language=zh variant=zh showtitle
10379 !! input
10380 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
10381 !! result
10382 China
10383 <p>Should be stripped!
10384 </p>
10385 !! end
10386
10387 !! test
10388 Bug 24072: more test on conversion rule for title
10389 !! options
10390 language=zh variant=zh-tw showtitle
10391 !! input
10392 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
10393 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
10394 !! result
10395 Taiwan
10396 <p>This should be stripped!
10397 This won't take interferes with the title rule.
10398 </p>
10399 !! end
10400
10401 !! test
10402 Raw output of variant escape tags (R flag)
10403 !! options
10404 language=zh variant=zh-tw
10405 !! input
10406 Raw: -{R|zh:China;zh-tw:Taiwan}-
10407 !! result
10408 <p>Raw: zh:China;zh-tw:Taiwan
10409 </p>
10410 !! end
10411
10412 !! test
10413 Nested using of manual convert syntax
10414 !! options
10415 language=zh variant=zh-hk
10416 !! input
10417 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
10418 !! result
10419 <p>Nested: Hello Hong Kong!
10420 </p>
10421 !! end
10422
10423 !! test
10424 Do not convert roman numbers to language variants
10425 !! options
10426 language=sr variant=sr-ec
10427 !! input
10428 Fridrih IV je car.
10429 !! result
10430 <p>Фридрих IV је цар.
10431 </p>
10432 !! end
10433
10434 !! test
10435 Unclosed language converter markup "-{"
10436 !! options
10437 language=sr
10438 !! input
10439 -{T|hello
10440 !! result
10441 <p>-{T|hello
10442 </p>
10443 !! end
10444
10445 !! test
10446 Don't convert raw rule "-{R|=&gt;}-" to "=>"
10447 !! options
10448 language=sr
10449 !! input
10450 -{R|=&gt;}-
10451 !! result
10452 <p>=&gt;
10453 </p>
10454 !!end
10455
10456 !!article
10457 Template:Bullet
10458 !!text
10459 * Bar
10460 !!endarticle
10461
10462 !! test
10463 Bug 529: Uncovered bullet
10464 !! input
10465 * Foo {{bullet}}
10466 !! result
10467 <ul><li> Foo
10468 </li><li> Bar
10469 </li></ul>
10470
10471 !! end
10472
10473 # Plain MediaWiki does not remove empty lists, but tidy actually does.
10474 # Templates in Wikipedia rely on this behavior, as tidy has always been
10475 # enabled there. These tests are normally run *without* tidy, so specify the
10476 # full output here.
10477 # To test realistic parsing behavior, apply a tidy-like transformation to both
10478 # the expected output and your parser's output.
10479 !! test
10480 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
10481 !! input
10482 ******* Foo {{bullet}}
10483 !! result
10484 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
10485 </li></ul>
10486 </li></ul>
10487 </li></ul>
10488 </li></ul>
10489 </li></ul>
10490 </li></ul>
10491 </li><li> Bar
10492 </li></ul>
10493
10494 !! end
10495
10496 !! test
10497 Bug 529: Uncovered table already at line-start
10498 !! input
10499 x
10500
10501 {{table}}
10502 y
10503 !! result
10504 <p>x
10505 </p>
10506 <table>
10507 <tr>
10508 <td> 1 </td>
10509 <td> 2
10510 </td></tr>
10511 <tr>
10512 <td> 3 </td>
10513 <td> 4
10514 </td></tr></table>
10515 <p>y
10516 </p>
10517 !! end
10518
10519 !! test
10520 Bug 529: Uncovered bullet in parser function result
10521 !! input
10522 * Foo {{lc:{{bullet}} }}
10523 !! result
10524 <ul><li> Foo
10525 </li><li> bar
10526 </li></ul>
10527
10528 !! end
10529
10530 !! test
10531 Bug 5678: Double-parsed template argument
10532 !! input
10533 {{lc:{{{1}}}|hello}}
10534 !! result
10535 <p>{{{1}}}
10536 </p>
10537 !! end
10538
10539 !! test
10540 Bug 5678: Double-parsed template invocation
10541 !! input
10542 {{lc:{{paramtest {{!}} param = hello }} }}
10543 !! result
10544 <p>{{paramtest | param = hello }}
10545 </p>
10546 !! end
10547
10548 !! test
10549 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
10550 !! options
10551 language=cs
10552 title=[[Main Page]]
10553 !! input
10554 {{PRVNÍVELKÉ:ěščř}}
10555 {{prvnívelké:ěščř}}
10556 {{PRVNÍMALÉ:ěščř}}
10557 {{prvnímalé:ěščř}}
10558 {{MALÁ:ěščř}}
10559 {{malá:ěščř}}
10560 {{VELKÁ:ěščř}}
10561 {{velká:ěščř}}
10562 !! result
10563 <p>Ěščř
10564 Ěščř
10565 ěščř
10566 ěščř
10567 ěščř
10568 ěščř
10569 ĚŠČŘ
10570 ĚŠČŘ
10571 </p>
10572 !! end
10573
10574 !! test
10575 Morwen/13: Unclosed link followed by heading
10576 !! input
10577 [[link
10578 ==heading==
10579 !! result
10580 <p>[[link
10581 </p>
10582 <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>
10583
10584 !! end
10585
10586 !! test
10587 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
10588 !! input
10589 {{foo|
10590 =heading=
10591 !! result
10592 <p>{{foo|
10593 </p>
10594 <h1> <span class="mw-headline" id="heading">heading</span></h1>
10595
10596 !! end
10597
10598 !! test
10599 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
10600 !! input
10601 {{foo|
10602 ==heading==
10603 !! result
10604 <p>{{foo|
10605 </p>
10606 <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>
10607
10608 !! end
10609
10610 !! test
10611 Tildes in comments
10612 !! options
10613 pst
10614 !! input
10615 <!-- ~~~~ -->
10616 !! result
10617 <!-- ~~~~ -->
10618 !! end
10619
10620 !! test
10621 Paragraphs inside divs (no extra line breaks)
10622 !! input
10623 <div>Line one
10624
10625 Line two</div>
10626 !! result
10627 <div>Line one
10628 Line two</div>
10629
10630 !! end
10631
10632 !! test
10633 Paragraphs inside divs (extra line break on open)
10634 !! input
10635 <div>
10636 Line one
10637
10638 Line two</div>
10639 !! result
10640 <div>
10641 <p>Line one
10642 </p>
10643 Line two</div>
10644
10645 !! end
10646
10647 !! test
10648 Paragraphs inside divs (extra line break on close)
10649 !! input
10650 <div>Line one
10651
10652 Line two
10653 </div>
10654 !! result
10655 <div>Line one
10656 <p>Line two
10657 </p>
10658 </div>
10659
10660 !! end
10661
10662 !! test
10663 Paragraphs inside divs (extra line break on open and close)
10664 !! input
10665 <div>
10666 Line one
10667
10668 Line two
10669 </div>
10670 !! result
10671 <div>
10672 <p>Line one
10673 </p><p>Line two
10674 </p>
10675 </div>
10676
10677 !! end
10678
10679 !! test
10680 Nesting tags, paragraphs on lines which begin with <div>
10681 !! options
10682 disabled
10683 !! input
10684 <div></div><strong>A
10685 B</strong>
10686 !! result
10687 <div></div>
10688 <p><strong>A
10689 B</strong>
10690 </p>
10691 !! end
10692
10693 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
10694 !! test
10695 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
10696 !! options
10697 disabled
10698 !! input
10699 <blockquote>Line one
10700
10701 Line two</blockquote>
10702 !! result
10703 <blockquote>Line one
10704 Line two</blockquote>
10705
10706 !! end
10707
10708 !! test
10709 Bug 6200: paragraphs inside blockquotes (extra line break on open)
10710 !! options
10711 disabled
10712 !! input
10713 <blockquote>
10714 Line one
10715
10716 Line two</blockquote>
10717 !! result
10718 <blockquote>
10719 <p>Line one
10720 </p>
10721 Line two</blockquote>
10722
10723 !! end
10724
10725 !! test
10726 Bug 6200: paragraphs inside blockquotes (extra line break on close)
10727 !! options
10728 disabled
10729 !! input
10730 <blockquote>Line one
10731
10732 Line two
10733 </blockquote>
10734 !! result
10735 <blockquote>Line one
10736 <p>Line two
10737 </p>
10738 </blockquote>
10739
10740 !! end
10741
10742 !! test
10743 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
10744 !! options
10745 disabled
10746 !! input
10747 <blockquote>
10748 Line one
10749
10750 Line two
10751 </blockquote>
10752 !! result
10753 <blockquote>
10754 <p>Line one
10755 </p><p>Line two
10756 </p>
10757 </blockquote>
10758
10759 !! end
10760
10761 !! test
10762 Paragraphs inside blockquotes/divs (no extra line breaks)
10763 !! input
10764 <blockquote><div>Line one
10765
10766 Line two</div></blockquote>
10767 !! result
10768 <blockquote><div>Line one
10769 Line two</div></blockquote>
10770
10771 !! end
10772
10773 !! test
10774 Paragraphs inside blockquotes/divs (extra line break on open)
10775 !! input
10776 <blockquote><div>
10777 Line one
10778
10779 Line two</div></blockquote>
10780 !! result
10781 <blockquote><div>
10782 <p>Line one
10783 </p>
10784 Line two</div></blockquote>
10785
10786 !! end
10787
10788 !! test
10789 Paragraphs inside blockquotes/divs (extra line break on close)
10790 !! input
10791 <blockquote><div>Line one
10792
10793 Line two
10794 </div></blockquote>
10795 !! result
10796 <blockquote><div>Line one
10797 <p>Line two
10798 </p>
10799 </div></blockquote>
10800
10801 !! end
10802
10803 !! test
10804 Paragraphs inside blockquotes/divs (extra line break on open and close)
10805 !! input
10806 <blockquote><div>
10807 Line one
10808
10809 Line two
10810 </div></blockquote>
10811 !! result
10812 <blockquote><div>
10813 <p>Line one
10814 </p><p>Line two
10815 </p>
10816 </div></blockquote>
10817
10818 !! end
10819
10820 !! test
10821 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
10822 !! options
10823 wgLinkHolderBatchSize=0
10824 !! input
10825 [[meatball:1]]
10826 [[meatball:2]]
10827 [[meatball:3]]
10828 !! result
10829 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
10830 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
10831 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
10832 </p>
10833 !! end
10834
10835 !! test
10836 Free external link invading image caption
10837 !! input
10838 [[Image:Foobar.jpg|thumb|http://x|hello]]
10839 !! result
10840 <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>
10841
10842 !! end
10843
10844 !! test
10845 Bug 15196: localised external link numbers
10846 !! options
10847 language=fa
10848 !! input
10849 [http://en.wikipedia.org/]
10850 !! result
10851 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
10852 </p>
10853 !! end
10854
10855 !! test
10856 Multibyte character in padleft
10857 !! input
10858 {{padleft:-Hello|7|Æ}}
10859 !! result
10860 <p>Æ-Hello
10861 </p>
10862 !! end
10863
10864 !! test
10865 Multibyte character in padright
10866 !! input
10867 {{padright:Hello-|7|Æ}}
10868 !! result
10869 <p>Hello-Æ
10870 </p>
10871 !! end
10872
10873 !! test
10874 Formatted date
10875 !! config
10876 wgUseDynamicDates=1
10877 !! input
10878 [[2009-03-24]]
10879 !! result
10880 <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>
10881 </p>
10882 !!end
10883
10884 !!test
10885 formatdate parser function
10886 !!input
10887 {{#formatdate:2009-03-24}}
10888 !! result
10889 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
10890 </p>
10891 !! end
10892
10893 !!test
10894 formatdate parser function, with default format
10895 !!input
10896 {{#formatdate:2009-03-24|mdy}}
10897 !! result
10898 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
10899 </p>
10900 !! end
10901
10902 !! test
10903 Linked date with autoformatting disabled
10904 !! config
10905 wgUseDynamicDates=false
10906 !! input
10907 [[2009-03-24]]
10908 !! result
10909 <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>
10910 </p>
10911 !! end
10912
10913 !! test
10914 Spacing of numbers in formatted dates
10915 !! input
10916 {{#formatdate:January 15}}
10917 !! result
10918 <p><span class="mw-formatted-date" title="01-15">January 15</span>
10919 </p>
10920 !! end
10921
10922 !! test
10923 Spacing of numbers in formatted dates (linked)
10924 !! config
10925 wgUseDynamicDates=true
10926 !! input
10927 [[January 15]]
10928 !! result
10929 <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>
10930 </p>
10931 !! end
10932
10933 !! test
10934 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
10935 !! options
10936 language=nl title=[[MediaWiki:Common.css]]
10937 !! input
10938 {{#formatdate:2009-03-24|dmy}}
10939 !! result
10940 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
10941 </p>
10942 !! end
10943
10944 #
10945 #
10946 #
10947
10948 #
10949 # Edit comments
10950 #
10951
10952 !! test
10953 Edit comment with link
10954 !! options
10955 comment
10956 !! input
10957 I like the [[Main Page]] a lot
10958 !! result
10959 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
10960 !!end
10961
10962 !! test
10963 Edit comment with link and link text
10964 !! options
10965 comment
10966 !! input
10967 I like the [[Main Page|best pages]] a lot
10968 !! result
10969 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
10970 !!end
10971
10972 !! test
10973 Edit comment with link and link text with suffix
10974 !! options
10975 comment
10976 !! input
10977 I like the [[Main Page|best page]]s a lot
10978 !! result
10979 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
10980 !!end
10981
10982 !! test
10983 Edit comment with section link (non-local, eg in history list)
10984 !! options
10985 comment title=[[Main Page]]
10986 !! input
10987 /* External links */ removed bogus entries
10988 !! result
10989 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
10990 !!end
10991
10992 !! test
10993 Edit comment with section link and text before it (non-local, eg in history list)
10994 !! options
10995 comment title=[[Main Page]]
10996 !! input
10997 pre-comment text /* External links */ removed bogus entries
10998 !! result
10999 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>
11000 !!end
11001
11002 !! test
11003 Edit comment with section link (local, eg in diff view)
11004 !! options
11005 comment local title=[[Main Page]]
11006 !! input
11007 /* External links */ removed bogus entries
11008 !! result
11009 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
11010 !!end
11011
11012 !! test
11013 Edit comment with subpage link (bug 14080)
11014 !! options
11015 comment
11016 subpage
11017 title=[[Subpage test]]
11018 !! input
11019 Poked at a [[/subpage]] here...
11020 !! result
11021 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
11022 !!end
11023
11024 !! test
11025 Edit comment with subpage link and link text (bug 14080)
11026 !! options
11027 comment
11028 subpage
11029 title=[[Subpage test]]
11030 !! input
11031 Poked at a [[/subpage|neat little page]] here...
11032 !! result
11033 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
11034 !!end
11035
11036 !! test
11037 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
11038 !! options
11039 comment
11040 title=[[Subpage test]]
11041 !! input
11042 Poked at a [[/subpage]] here...
11043 !! result
11044 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...
11045 !!end
11046
11047 !! test
11048 Edit comment with bare anchor link (local, as on diff)
11049 !! options
11050 comment
11051 local
11052 title=[[Main Page]]
11053 !!input
11054 [[#section]]
11055 !! result
11056 <a href="#section">#section</a>
11057 !! end
11058
11059 !! test
11060 Edit comment with bare anchor link (non-local, as on history)
11061 !! options
11062 comment
11063 title=[[Main Page]]
11064 !!input
11065 [[#section]]
11066 !! result
11067 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
11068 !! end
11069
11070 !! test
11071 Anchor starting with underscore
11072 !!input
11073 [[#_ref|One]]
11074 !! result
11075 <p><a href="#_ref">One</a>
11076 </p>
11077 !! end
11078
11079 !! test
11080 Id starting with underscore
11081 !!input
11082 <div id="_ref"></div>
11083 !! result
11084 <div id="_ref"></div>
11085
11086 !! end
11087
11088 !! test
11089 Space normalisation on autocomment (bug 22784)
11090 !! options
11091 comment
11092 title=[[Main Page]]
11093 !!input
11094 /* __hello__world__ */
11095 !! result
11096 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
11097 !! end
11098
11099 !! test
11100 percent-encoding and + signs in comments (Bug 26410)
11101 !! options
11102 comment
11103 !!input
11104 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
11105 !! result
11106 <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>
11107 !! end
11108
11109 !! test
11110 Bad images - basic functionality
11111 !! options
11112 disabled
11113 !! input
11114 [[File:Bad.jpg]]
11115 !! result
11116 !! end
11117
11118 !! test
11119 Bad images - bug 16039: text after bad image disappears
11120 !! options
11121 disabled
11122 !! input
11123 Foo bar
11124 [[File:Bad.jpg]]
11125 Bar foo
11126 !! result
11127 <p>Foo bar
11128 </p><p>Bar foo
11129 </p>
11130 !! end
11131
11132 !! test
11133 Verify that displaytitle works (bug #22501) no displaytitle
11134 !! options
11135 showtitle
11136 !! config
11137 wgAllowDisplayTitle=true
11138 wgRestrictDisplayTitle=false
11139 !! input
11140 this is not the the title
11141 !! result
11142 Parser test
11143 <p>this is not the the title
11144 </p>
11145 !! end
11146
11147 !! test
11148 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
11149 !! options
11150 showtitle
11151 title=[[Screen]]
11152 !! config
11153 wgAllowDisplayTitle=true
11154 wgRestrictDisplayTitle=false
11155 !! input
11156 this is not the the title
11157 {{DISPLAYTITLE:whatever}}
11158 !! result
11159 whatever
11160 <p>this is not the the title
11161 </p>
11162 !! end
11163
11164 !! test
11165 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
11166 !! options
11167 showtitle
11168 title=[[Screen]]
11169 !! config
11170 wgAllowDisplayTitle=true
11171 wgRestrictDisplayTitle=true
11172 !! input
11173 this is not the the title
11174 {{DISPLAYTITLE:whatever}}
11175 !! result
11176 Screen
11177 <p>this is not the the title
11178 </p>
11179 !! end
11180
11181 !! test
11182 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
11183 !! options
11184 showtitle
11185 title=[[Screen]]
11186 !! config
11187 wgAllowDisplayTitle=true
11188 wgRestrictDisplayTitle=true
11189 !! input
11190 this is not the the title
11191 {{DISPLAYTITLE:screen}}
11192 !! result
11193 screen
11194 <p>this is not the the title
11195 </p>
11196 !! end
11197
11198 !! test
11199 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
11200 !! options
11201 showtitle
11202 title=[[Screen]]
11203 !! config
11204 wgAllowDisplayTitle=false
11205 !! input
11206 this is not the the title
11207 {{DISPLAYTITLE:screen}}
11208 !! result
11209 Screen
11210 <p>this is not the the title
11211 <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>
11212 </p>
11213 !! end
11214
11215 !! test
11216 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
11217 !! options
11218 showtitle
11219 title=[[Screen]]
11220 !! config
11221 wgAllowDisplayTitle=false
11222 !! input
11223 this is not the the title
11224 !! result
11225 Screen
11226 <p>this is not the the title
11227 </p>
11228 !! end
11229
11230 !! test
11231 preload: check <noinclude> and <includeonly>
11232 !! options
11233 preload
11234 !! input
11235 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
11236 !! result
11237 Hello kind world.
11238 !! end
11239
11240 !! test
11241 preload: check <onlyinclude>
11242 !! options
11243 preload
11244 !! input
11245 Goodbye <onlyinclude>Hello world</onlyinclude>
11246 !! result
11247 Hello world
11248 !! end
11249
11250 !! test
11251 preload: can pass tags through if we want to
11252 !! options
11253 preload
11254 !! input
11255 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
11256 !! result
11257 <includeonly>Hello world</includeonly>
11258 !! end
11259
11260 !! test
11261 preload: check that it doesn't try to do tricks
11262 !! options
11263 preload
11264 !! input
11265 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
11266 !! result
11267 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
11268 !! end
11269
11270 !! test
11271 Play a bit with r67090 and bug 3158
11272 !! options
11273 disabled
11274 !! input
11275 <div style="width:50% !important">&nbsp;</div>
11276 <div style="width:50%&nbsp;!important">&nbsp;</div>
11277 <div style="width:50%&#160;!important">&nbsp;</div>
11278 <div style="border : solid;">&nbsp;</div>
11279 !! result
11280 <div style="width:50% !important">&nbsp;</div>
11281 <div style="width:50% !important">&nbsp;</div>
11282 <div style="width:50% !important">&nbsp;</div>
11283 <div style="border&#160;: solid;">&nbsp;</div>
11284
11285 !! end
11286
11287 !! test
11288 HTML5 data attributes
11289 !! input
11290 <span data-foo="bar">Baz</span>
11291 <p data-abc-def_hij="">Quuz</p>
11292 !! result
11293 <p><span data-foo="bar">Baz</span>
11294 </p>
11295 <p data-abc-def_hij="">Quuz</p>
11296
11297 !! end
11298
11299 !! test
11300 percent-encoding and + signs in internal links (Bug 26410)
11301 !! input
11302 [[User:+%]] [[Page+title%]]
11303 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
11304 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
11305 [[%33%45]] [[%33%45+]]
11306 !! result
11307 <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>
11308 <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>
11309 <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>
11310 <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>
11311 </p>
11312 !! end
11313
11314 !! test
11315 Special characters in embedded file links (bug 27679)
11316 !! input
11317 [[File:Contains & ampersand.jpg]]
11318 [[File:Does not exist.jpg|Title with & ampersand]]
11319 !! result
11320 <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>
11321 <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>
11322 </p>
11323 !! end
11324
11325
11326 !! test
11327 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
11328 !! input
11329 Text&apos;s been normalized?
11330 !! result
11331 <p>Text&#39;s been normalized?
11332 </p>
11333 !! end
11334
11335 !! test
11336 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
11337 !! input
11338 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
11339 !! result
11340 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
11341 </p>
11342 !! end
11343
11344 !! test
11345 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
11346 !! input
11347 [http://www.example.org/ ideograms]
11348 !! result
11349 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
11350 </p>
11351 !! end
11352
11353 !! test
11354 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
11355 !! input
11356 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
11357 !! result
11358 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
11359 </p>
11360 !! end
11361
11362 !! article
11363 Mediawiki:loop1
11364 !! text
11365 {{Identical|A}}
11366 !! endarticle
11367
11368 !! article
11369 Mediawiki:loop2
11370 !! text
11371 {{Identical|B}}
11372 !! endarticle
11373
11374 !! article
11375 Template:Identical
11376 !! text
11377 {{int:loop1}}
11378 {{int:loop2}}
11379 !! endarticle
11380
11381 !! test
11382 Bug 31098 Template which includes system messages which includes the template
11383 !! input
11384 {{Identical}}
11385 !! result
11386 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
11387 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
11388 </p>
11389 !! end
11390
11391 !! test
11392 Deprecated presentational attributes are converted to css
11393 !! input
11394 {|
11395 | valign=top align=left width=100 height=25% | Asdf
11396 |}
11397 <ul type="disc"></ul>
11398 !! result
11399 <table>
11400 <tr>
11401 <td style="text-align: left; height: 25%; vertical-align: top; width: 100px;"> Asdf
11402 </td></tr></table>
11403 <ul style="list-style-type: disc;"></ul>
11404
11405 !! end
11406
11407 !! test
11408 Bug31490 Turkish: ucfirst 'blah'
11409 !! options
11410 language=tr
11411 !! input
11412 {{ucfirst:blah}}
11413 !! result
11414 <p>Blah
11415 </p>
11416 !! end
11417
11418 !! test
11419 Bug31490 Turkish: ucfirst 'ix'
11420 !! options
11421 language=tr
11422 !! input
11423 {{ucfirst:ix}}
11424 !! result
11425 <p>İx
11426 </p>
11427 !! end
11428
11429 !! test
11430 Bug31490 Turkish: lcfirst 'BLAH'
11431 !! options
11432 language=tr
11433 !! input
11434 {{lcfirst:BLAH}}
11435 !! result
11436 <p>bLAH
11437 </p>
11438 !! end
11439
11440 !! test
11441 Bug31490 Turkish: ucfırst (with a dotless i)
11442 !! options
11443 language=tr
11444 !! input
11445 {{ucfırst:blah}}
11446 !! result
11447 <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>
11448 </p>
11449 !! end
11450
11451 !! test
11452 Bug31490 ucfırst (with a dotless i) with English language
11453 !! options
11454 language=en
11455 !! input
11456 {{ucfırst:blah}}
11457 !! result
11458 <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>
11459 </p>
11460 !! end
11461
11462 !! test
11463 Bug 26375: TOC with italics
11464 !! options
11465 title=[[Main Page]]
11466 !! input
11467 __TOC__
11468 == ''Lost'' episodes ==
11469 !! result
11470 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11471 <ul>
11472 <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>
11473 </ul>
11474 </td></tr></table>
11475 <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>
11476
11477 !! end
11478
11479 !! test
11480 Bug 26375: TOC with bold
11481 !! options
11482 title=[[Main Page]]
11483 !! input
11484 __TOC__
11485 == '''should be bold''' then normal text ==
11486 !! result
11487 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11488 <ul>
11489 <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>
11490 </ul>
11491 </td></tr></table>
11492 <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>
11493
11494 !! end
11495
11496 !! test
11497 Bug 33845: Headings become cursive in TOC when they contain an image
11498 !! options
11499 title=[[Main Page]]
11500 !! input
11501 __TOC__
11502 == Image [[Image:foobar.jpg]] ==
11503 !! result
11504 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11505 <ul>
11506 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
11507 </ul>
11508 </td></tr></table>
11509 <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>
11510
11511 !! end
11512
11513 !! test
11514 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
11515 !! options
11516 title=[[Main Page]]
11517 !! input
11518 __TOC__
11519 == <blockquote>Quote</blockquote> ==
11520 !! result
11521 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11522 <ul>
11523 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
11524 </ul>
11525 </td></tr></table>
11526 <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>
11527
11528 !! end
11529
11530 !! test
11531 Unclosed tags in TOC
11532 !! options
11533 title=[[Main Page]]
11534 !! input
11535 __TOC__
11536 == Proof: 2 < 3 ==
11537 <small>Hanc marginis exiguitas non caperet.</small>
11538 QED
11539 !! result
11540 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11541 <ul>
11542 <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>
11543 </ul>
11544 </td></tr></table>
11545 <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>
11546 <p><small>Hanc marginis exiguitas non caperet.</small>
11547 QED
11548 </p>
11549 !! end
11550
11551 !! test
11552 Multiple tags in TOC
11553 !! input
11554 __TOC__
11555 == <i>Foo</i> <b>Bar</b> ==
11556
11557 == <i>Foo</i> <blockquote>Bar</blockquote> ==
11558 !! result
11559 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11560 <ul>
11561 <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>
11562 <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>
11563 </ul>
11564 </td></tr></table>
11565 <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>
11566 <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>
11567
11568 !! end
11569
11570 !! test
11571 Tags with parameters in TOC
11572 !! input
11573 __TOC__
11574 == <sup class="in-h2">Hello</sup> ==
11575
11576 == <sup class="a > b">Evilbye</sup> ==
11577 !! result
11578 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11579 <ul>
11580 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
11581 <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>
11582 </ul>
11583 </td></tr></table>
11584 <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>
11585 <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>
11586
11587 !! end
11588
11589 !! test
11590 span tags with directionality in TOC
11591 !! input
11592 __TOC__
11593 == <span dir="ltr">C++</span> ==
11594
11595 == <span dir="rtl">זבנג!</span> ==
11596
11597 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
11598
11599 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
11600
11601 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
11602 !! result
11603 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11604 <ul>
11605 <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>
11606 <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>
11607 <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>
11608 <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>
11609 <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>
11610 </ul>
11611 </td></tr></table>
11612 <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>
11613 <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>
11614 <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>
11615 <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>
11616 <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>
11617
11618 !! end
11619
11620 !! article
11621 MediaWiki:Bug32057
11622 !! text
11623 == {{int:headline_sample}} ==
11624 !! endarticle
11625
11626 !! test
11627 Bug 32057: Title needed when expanding <h> nodes.
11628 !! options
11629 title=[[Main Page]]
11630 !! input
11631 {{int:Bug32057}}
11632 !! result
11633 <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>
11634
11635 !! end
11636
11637 !! test
11638 Strip marker in urlencode
11639 !! input
11640 {{urlencode:x<nowiki/>y}}
11641 {{urlencode:x<nowiki/>y|wiki}}
11642 {{urlencode:x<nowiki/>y|path}}
11643 !! result
11644 <p>xy
11645 xy
11646 xy
11647 </p>
11648 !! end
11649
11650 !! test
11651 Strip marker in lc
11652 !! input
11653 {{lc:x<nowiki/>y}}
11654 !! result
11655 <p>xy
11656 </p>
11657 !! end
11658
11659 !! test
11660 Strip marker in uc
11661 !! input
11662 {{uc:x<nowiki/>y}}
11663 !! result
11664 <p>XY
11665 </p>
11666 !! end
11667
11668 !! test
11669 Strip marker in formatNum
11670 !! input
11671 {{formatnum:1<nowiki/>2}}
11672 {{formatnum:1<nowiki/>2|R}}
11673 !! result
11674 <p>12
11675 12
11676 </p>
11677 !! end
11678
11679 !! test
11680 Strip marker in grammar
11681 !! options
11682 language=fi
11683 !! input
11684 {{grammar:elative|foo<nowiki/>bar}}
11685 !! result
11686 <p>foobarista
11687 </p>
11688 !! end
11689
11690 !! test
11691 Strip marker in padleft
11692 !! input
11693 {{padleft:|2|x<nowiki/>y}}
11694 !! result
11695 <p>xy
11696 </p>
11697 !! end
11698
11699 !! test
11700 Strip marker in padright
11701 !! input
11702 {{padright:|2|x<nowiki/>y}}
11703 !! result
11704 <p>xy
11705 </p>
11706 !! end
11707
11708 !! test
11709 Strip marker in anchorencode
11710 !! input
11711 {{anchorencode:x<nowiki/>y}}
11712 !! result
11713 <p>xy
11714 </p>
11715 !! end
11716
11717 !! test
11718 nowiki inside link inside heading (bug 18295)
11719 !! input
11720 ==[[foo|x<nowiki>y</nowiki>z]]==
11721 !! result
11722 <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>
11723
11724 !! end
11725
11726 !! test
11727 new support for bdi element (bug 31817)
11728 !! input
11729 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
11730 !! result
11731 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
11732
11733 !!end
11734
11735 !! test
11736 Ignore pipe between table row attributes
11737 !! input
11738 {|
11739 | quux
11740 |- id=foo | style='color: red'
11741 | bar
11742 |}
11743 !! result
11744 <table>
11745 <tr>
11746 <td> quux
11747 </td></tr>
11748 <tr id="foo" style="color: red">
11749 <td> bar
11750 </td></tr></table>
11751
11752 !! end
11753
11754 !!test
11755 Gallery override link with WikiLink (bug 34852)
11756 !! input
11757 <gallery>
11758 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
11759 </gallery>
11760 !! result
11761 <ul class="gallery">
11762 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11763 <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>
11764 <div class="gallerytext">
11765 <p>caption
11766 </p>
11767 </div>
11768 </div></li>
11769 </ul>
11770
11771 !! end
11772
11773 !!test
11774 Gallery override link with absolute external link (bug 34852)
11775 !! input
11776 <gallery>
11777 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
11778 </gallery>
11779 !! result
11780 <ul class="gallery">
11781 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11782 <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>
11783 <div class="gallerytext">
11784 <p>caption
11785 </p>
11786 </div>
11787 </div></li>
11788 </ul>
11789
11790 !! end
11791
11792 !!test
11793 Gallery override link with malicious javascript (bug 34852)
11794 !! input
11795 <gallery>
11796 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
11797 </gallery>
11798 !! result
11799 <ul class="gallery">
11800 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11801 <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>
11802 <div class="gallerytext">
11803 <p>caption
11804 </p>
11805 </div>
11806 </div></li>
11807 </ul>
11808
11809 !! end
11810
11811 !!test
11812 Language parser function
11813 !! input
11814 {{#language:ar}}
11815 !! result
11816 <p>العربية
11817 </p>
11818 !! end
11819
11820 !!test
11821 Padleft and padright as substr
11822 !! input
11823 {{padleft:|3|abcde}}
11824 {{padright:|3|abcde}}
11825 !! result
11826 <p>abc
11827 abc
11828 </p>
11829 !! end
11830
11831 !!test
11832 Bug 34939 - Case insensitive link parsing ([HttP://])
11833 !! input
11834 [HttP://MediaWiki.Org/]
11835 !! result
11836 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
11837 </p>
11838 !! end
11839
11840 !!test
11841 Bug 34939 - Case insensitive link parsing ([HttP:// title])
11842 !! input
11843 [HttP://MediaWiki.Org/ MediaWiki]
11844 !! result
11845 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
11846 </p>
11847 !! end
11848
11849 !!test
11850 Bug 34939 - Case insensitive link parsing (HttP://)
11851 !! input
11852 HttP://MediaWiki.Org/
11853 !! result
11854 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
11855 </p>
11856 !! end
11857
11858 ###
11859 ### Parsoids-specific tests
11860 ### Parsoid-PHP parser incompatibilities
11861 ###
11862 !!test
11863 1. SOL-sensitive wikitext tokens as template-args
11864 !!options
11865 disabled
11866 !!input
11867 {{echo|*a}}
11868 {{echo|#a}}
11869 {{echo|:a}}
11870 !!result
11871 <p>*a
11872 #a
11873 :a
11874 </p>
11875 !!end
11876
11877 #### The following section of tests are primarily to test
11878 #### wikitext escaping capabilities of Parsoid.
11879 #### A lot of the tests are disabled for the PHP parser either
11880 #### because of minor newline diffs or other reasons.
11881 #### As Parsoid serializer can handle newlines and other HTML
11882 #### more robustly, some of these tests might get reenabled
11883 #### for the PHP parser.
11884
11885 #### --------------- Headings ---------------
11886 #### 0. Unnested
11887 #### 1. Nested inside html <h1>=foo=</h1>
11888 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
11889 #### 3. Nested inside html with wikitext split by html tags
11890 #### 4. No escape needed
11891 #### 5. Empty headings <h1></h1>
11892 #### 6. Heading chars in SOL context
11893 #### ----------------------------------------
11894 !! test
11895 Headings: 0. Unnested
11896 !! input
11897 <nowiki>=foo=</nowiki>
11898
11899 <nowiki>=foo</nowiki>''a''=
11900 !! result
11901 <p>=foo=
11902 </p><p>=foo<i>a</i>=
11903 </p>
11904 !!end
11905
11906 !! test
11907 Headings: 1. Nested inside html
11908 !! options
11909 disabled
11910 !! input
11911 =<nowiki>=foo=</nowiki>=
11912 ==<nowiki>=foo=</nowiki>==
11913 ===<nowiki>=foo=</nowiki>===
11914 ====<nowiki>=foo=</nowiki>====
11915 =====<nowiki>=foo=</nowiki>=====
11916 ======<nowiki>=foo=</nowiki>======
11917 !! result
11918 <h1>=foo=</h1>
11919 <h2>=foo=</h2>
11920 <h3>=foo=</h3>
11921 <h4>=foo=</h4>
11922 <h5>=foo=</h5>
11923 <h6>=foo=</h6>
11924 !!end
11925
11926 !! test
11927 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
11928 !! options
11929 disabled
11930 !! input
11931 =foo=
11932 <nowiki>*bar</nowiki>
11933 =foo=
11934 =bar
11935 =foo=
11936 <nowiki>=bar=</nowiki>
11937 !! result
11938 <h1>foo</h1>*bar
11939 <h1>foo</h1>=bar
11940 <h1>foo</h1>=bar=
11941 !!end
11942
11943 !! test
11944 Headings: 3. Nested inside html with wikitext split by html tags
11945 !! options
11946 disabled
11947 !! input
11948 =<nowiki>=</nowiki>'''bold'''foo==
11949 !! result
11950 <h1>=<b>bold</b>foo=</h1>
11951 !!end
11952
11953 !! test
11954 Headings: 4. No escaping needed (testing just h1 and h2)
11955 !! options
11956 disabled
11957 !! input
11958 ==foo=
11959 =foo==
11960 ===foo==
11961 ==foo===
11962 =''=''foo==
11963 ===
11964 !! result
11965 <h1>=foo</h1>
11966 <h1>foo=</h1>
11967 <h2>=foo</h2>
11968 <h2>foo=</h2>
11969 <h1><i>=</i>foo=</h1>
11970 <h1>=</h1>
11971 !!end
11972
11973 !! test
11974 Headings: 5. Empty headings
11975 !! options
11976 disabled
11977 !! input
11978 =<nowiki></nowiki>=
11979 ==<nowiki></nowiki>==
11980 ===<nowiki></nowiki>===
11981 ====<nowiki></nowiki>====
11982 =====<nowiki></nowiki>=====
11983 ======<nowiki></nowiki>======
11984 !! result
11985 <h1></h1>
11986 <h2></h2>
11987 <h3></h3>
11988 <h4></h4>
11989 <h5></h5>
11990 <h6></h6>
11991 !!end
11992
11993 !! test
11994 Headings: 6. Heading chars in SOL context
11995 !! options
11996 disabled
11997 !! input
11998 <!--cmt--><nowiki>=h1=</nowiki>
11999 !! result
12000 <p><!--cmt-->=h1=
12001 </p>
12002 !!end
12003
12004 #### --------------- Lists ---------------
12005 #### 0. Outside nests (*foo, etc.)
12006 #### 1. Nested inside html <ul><li>*foo</li></ul>
12007 #### 2. Inside definition lists
12008 #### 3. Only bullets at start should be escaped
12009 #### 4. No escapes needed
12010 #### 5. No unnecessary escapes
12011 #### 6. Escape bullets in SOL position
12012 #### 7. Escape bullets in a multi-line context
12013 #### ----------------------------------------
12014
12015 !! test
12016 Lists: 0. Outside nests
12017 !! input
12018 <nowiki>*foo</nowiki>
12019
12020 <nowiki>#foo</nowiki>
12021 !! result
12022 <p>*foo
12023 </p><p>#foo
12024 </p>
12025 !!end
12026
12027 !! test
12028 Lists: 1. Nested inside html
12029 !! input
12030 *<nowiki>*foo</nowiki>
12031
12032 *<nowiki>#foo</nowiki>
12033
12034 *<nowiki>:foo</nowiki>
12035
12036 *<nowiki>;foo</nowiki>
12037
12038 #<nowiki>*foo</nowiki>
12039
12040 #<nowiki>#foo</nowiki>
12041
12042 #<nowiki>:foo</nowiki>
12043
12044 #<nowiki>;foo</nowiki>
12045 !! result
12046 <ul><li>*foo
12047 </li></ul>
12048 <ul><li>#foo
12049 </li></ul>
12050 <ul><li>:foo
12051 </li></ul>
12052 <ul><li>;foo
12053 </li></ul>
12054 <ol><li>*foo
12055 </li></ol>
12056 <ol><li>#foo
12057 </li></ol>
12058 <ol><li>:foo
12059 </li></ol>
12060 <ol><li>;foo
12061 </li></ol>
12062
12063 !!end
12064
12065 !! test
12066 Lists: 2. Inside definition lists
12067 !! input
12068 ;<nowiki>;foo</nowiki>
12069
12070 ;<nowiki>:foo</nowiki>
12071
12072 ;<nowiki>:foo</nowiki>
12073 :bar
12074
12075 :<nowiki>:foo</nowiki>
12076 !! result
12077 <dl><dt>;foo
12078 </dt></dl>
12079 <dl><dt>:foo
12080 </dt></dl>
12081 <dl><dt>:foo
12082 </dt><dd>bar
12083 </dd></dl>
12084 <dl><dd>:foo
12085 </dd></dl>
12086
12087 !!end
12088
12089 !! test
12090 Lists: 3. Only bullets at start of text should be escaped
12091 !! input
12092 *<nowiki>*foo*bar</nowiki>
12093
12094 *<nowiki>*foo</nowiki>''it''*bar
12095 !! result
12096 <ul><li>*foo*bar
12097 </li></ul>
12098 <ul><li>*foo<i>it</i>*bar
12099 </li></ul>
12100
12101 !!end
12102
12103 !! test
12104 Lists: 4. No escapes needed
12105 !! options
12106 disabled
12107 !! input
12108 *foo*bar
12109
12110 *''foo''*bar
12111
12112 *[[Foo]]: bar
12113 !! result
12114 <ul><li>foo*bar
12115 </li></ul>
12116 <ul><li><i>foo</i>*bar
12117 </li></ul>
12118 <ul><li><a href="Foo" rel="mw:WikiLink">Foo</a>: bar
12119 </li></ul>
12120 !!end
12121
12122 !! test
12123 Lists: 5. No unnecessary escapes
12124 !! input
12125 * bar <span><nowiki>[[foo]]</nowiki></span>
12126
12127 *=bar <span><nowiki>[[foo]]</nowiki></span>
12128
12129 *[[bar <span><nowiki>[[foo]]</nowiki></span>
12130
12131 *<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
12132
12133 *=bar <span>foo]]</span>=
12134 !! result
12135 <ul><li> bar <span>[[foo]]</span>
12136 </li></ul>
12137 <ul><li>=bar <span>[[foo]]</span>
12138 </li></ul>
12139 <ul><li>[[bar <span>[[foo]]</span>
12140 </li></ul>
12141 <ul><li>]]bar <span>[[foo]]</span>
12142 </li></ul>
12143 <ul><li>=bar <span>foo]]</span>=
12144 </li></ul>
12145
12146 !!end
12147
12148 !! test
12149 Lists: 6. Escape bullets in SOL position
12150 !! options
12151 disabled
12152 !! input
12153 <!--cmt--><nowiki>*foo</nowiki>
12154 !! result
12155 <p><!--cmt-->*foo
12156 </p>
12157 !!end
12158
12159 !! test
12160 Lists: 7. Escape bullets in a multi-line context
12161 !! input
12162 <nowiki>a
12163 *b</nowiki>
12164 !! result
12165 <p>a
12166 *b
12167 </p>
12168 !!end
12169
12170 #### --------------- HRs ---------------
12171 #### 1. Single line
12172 #### -----------------------------------
12173
12174 !! test
12175 HRs: 1. Single line
12176 !! options
12177 disabled
12178 !! input
12179 ----
12180 <nowiki>----</nowiki>
12181 ----
12182 <nowiki>=foo=</nowiki>
12183 ----
12184 <nowiki>*foo</nowiki>
12185 !! result
12186 <hr/>----
12187 <hr/>=foo=
12188 <hr/>*foo
12189 !! end
12190
12191 #### --------------- Tables ---------------
12192 #### 1a. Simple example
12193 #### 1b. No escaping needed (!foo)
12194 #### 1c. No escaping needed (|foo)
12195 #### 1d. No escaping needed (|}foo)
12196 ####
12197 #### 2a. Nested in td (<td>foo|bar</td>)
12198 #### 2b. Nested in td (<td>foo||bar</td>)
12199 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
12200 ####
12201 #### 3a. Nested in th (<th>foo!bar</th>)
12202 #### 3b. Nested in th (<th>foo!!bar</th>)
12203 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
12204 ####
12205 #### 4a. Escape -
12206 #### 4b. Escape +
12207 #### 4c. No escaping needed
12208 #### --------------------------------------
12209
12210 !! test
12211 Tables: 1a. Simple example
12212 !! input
12213 <nowiki>{|
12214 |}</nowiki>
12215 !! result
12216 <p>{|
12217 |}
12218 </p>
12219 !! end
12220
12221 !! test
12222 Tables: 1b. No escaping needed
12223 !! input
12224 !foo
12225 !! result
12226 <p>!foo
12227 </p>
12228 !! end
12229
12230 !! test
12231 Tables: 1c. No escaping needed
12232 !! input
12233 |foo
12234 !! result
12235 <p>|foo
12236 </p>
12237 !! end
12238
12239 !! test
12240 Tables: 1d. No escaping needed
12241 !! input
12242 |}foo
12243 !! result
12244 <p>|}foo
12245 </p>
12246 !! end
12247
12248 !! test
12249 Tables: 2a. Nested in td
12250 !! options
12251 disabled
12252 !! input
12253 {|
12254 |<nowiki>foo|bar</nowiki>
12255 |}
12256 !! result
12257 <table>
12258 <tr><td>foo|bar
12259 </td></tr></table>
12260
12261 !! end
12262
12263 !! test
12264 Tables: 2b. Nested in td
12265 !! options
12266 disabled
12267 !! input
12268 {|
12269 |<nowiki>foo||bar</nowiki>
12270 |''it''<nowiki>foo||bar</nowiki>
12271 |}
12272 !! result
12273 <table>
12274 <tr><td>foo||bar
12275 </td><td><i>it</i>foo||bar
12276 </td></tr></table>
12277
12278 !! end
12279
12280 !! test
12281 Tables: 2c. Nested in td -- no escaping needed
12282 !! options
12283 disabled
12284 !! input
12285 {|
12286 |foo!!bar
12287 |}
12288 !! result
12289 <table>
12290 <tr><td>foo!!bar
12291 </td></tr></table>
12292
12293 !! end
12294
12295 !! test
12296 Tables: 3a. Nested in th
12297 !! options
12298 disabled
12299 !! input
12300 {|
12301 !foo!bar
12302 |}
12303 !! result
12304 <table>
12305 <tr><th>foo!bar
12306 </th></tr></table>
12307
12308 !! end
12309
12310 !! test
12311 Tables: 3b. Nested in th
12312 !! options
12313 disabled
12314 !! input
12315 {|
12316 !<nowiki>foo!!bar</nowiki>
12317 |}
12318 !! result
12319 <table>
12320 <tr><th>foo!!bar
12321 </th></tr></table>
12322
12323 !! end
12324
12325 !! test
12326 Tables: 3c. Nested in th -- no escaping needed
12327 !! options
12328 disabled
12329 !! input
12330 {|
12331 !foo||bar
12332 |}
12333 !! result
12334 <table>
12335 <tr><th>foo||bar
12336 </th></tr></table>
12337
12338 !! end
12339
12340 !! test
12341 Tables: 4a. Escape -
12342 !! options
12343 disabled
12344 !! input
12345 {|
12346 |-
12347 !-bar
12348 |-
12349 |<nowiki>-bar</nowiki>
12350 |}
12351 !! result
12352 <table><tbody>
12353 <tr><th>-bar</th></tr>
12354 <tr><td>-bar</td></tr>
12355 </tbody></table>
12356 !! end
12357
12358 !! test
12359 Tables: 4b. Escape +
12360 !! options
12361 disabled
12362 !! input
12363 {|
12364 |-
12365 !+bar
12366 |-
12367 |<nowiki>+bar</nowiki>
12368 |}
12369 !! result
12370 <table><tbody>
12371 <tr><th>+bar</th></tr>
12372 <tr><td>+bar</td></tr>
12373 </tbody></table>
12374 !! end
12375
12376 !! test
12377 Tables: 4c. No escaping needed
12378 !! options
12379 disabled
12380 !! input
12381 {|
12382 |-
12383 |foo-bar
12384 |foo+bar
12385 |-
12386 |''foo''-bar
12387 |''foo''+bar
12388 |}
12389 !! result
12390 <table><tbody>
12391 <tr><td>foo-bar</td><td>foo+bar</td></tr>
12392 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
12393 </tbody></table>
12394 !! end
12395
12396 #### --------------- Links ---------------
12397 #### 1. Quote marks in link text
12398 #### 2. Wikilinks: Escapes needed
12399 #### 3. Wikilinks: No escapes needed
12400 #### 4. Extlinks: Escapes needed
12401 #### 5. Extlinks: No escapes needed
12402 #### --------------------------------------
12403 !! test
12404 Links 1. Quote marks in link text
12405 !! options
12406 disabled
12407 !! input
12408 [[Foo|<nowiki>Foo''boo''</nowiki>]]
12409 !! result
12410 <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>
12411 !! end
12412
12413 !! test
12414 Links 2. WikiLinks: Escapes needed
12415 !! options
12416 disabled
12417 !! input
12418 [[Foo|<nowiki>[Foobar]</nowiki>]]
12419 [[Foo|<nowiki>Foobar]</nowiki>]]
12420 [[Foo|<nowiki>x [Foobar] x</nowiki>]]
12421 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
12422 [[Foo|<nowiki>[[Bar]]</nowiki>]]
12423 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
12424 [[Foo|<nowiki>|Bar</nowiki>]]
12425 !! result
12426 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
12427 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
12428 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
12429 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
12430 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
12431 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
12432 <a href="Foo" rel="mw:WikiLink">|Bar</a>
12433 !! end
12434
12435 !! test
12436 Links 3. WikiLinks: No escapes needed
12437 !! options
12438 disabled
12439 !! input
12440 [[Foo|[Foobar]]
12441 [[Foo|foo|bar]]
12442 !! result
12443 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
12444 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
12445 !! end
12446
12447 !! test
12448 Links 4. ExtLinks: Escapes needed
12449 !! options
12450 disabled
12451 !! input
12452 [http://google.com <nowiki>[google]</nowiki>]
12453 [http://google.com <nowiki>google]</nowiki>]
12454 !! result
12455 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
12456 <a href="http://google.com" rel="mw:ExtLink">google]</a>
12457 !! end
12458
12459 !! test
12460 Links 5. ExtLinks: No escapes needed
12461 !! options
12462 disabled
12463 !! input
12464 [http://google.com [google]
12465 !! result
12466 <a href="http://google.com" rel="mw:ExtLink">[google</a>
12467 !! end
12468
12469 #### --------------- Quotes ---------------
12470 #### 1. Quotes inside <b> and <i>
12471 #### 2. Link fragments separated by <i> and <b> tags
12472 #### 3. Link fragments inside <i> and <b>
12473 #### --------------------------------------
12474 !! test
12475 1. Quotes inside <b> and <i>
12476 !! input
12477 ''<nowiki>'foo'</nowiki>''
12478 ''<nowiki>''foo''</nowiki>''
12479 ''<nowiki>'''foo'''</nowiki>''
12480 '''<nowiki>'foo'</nowiki>'''
12481 '''<nowiki>''foo''</nowiki>'''
12482 '''<nowiki>'''foo'''</nowiki>'''
12483 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
12484 !! result
12485 <p><i>'foo'</i>
12486 <i>''foo''</i>
12487 <i>'''foo'''</i>
12488 <b>'foo'</b>
12489 <b>''foo''</b>
12490 <b>'''foo'''</b>
12491 <b>foo'<i>bar'</i>baz</b>
12492 </p>
12493 !! end
12494
12495 !! test
12496 2. Link fragments separated by <i> and <b> tags
12497 !! input
12498 [[''foo''<nowiki>hello]]</nowiki>
12499
12500 [['''foo'''<nowiki>hello]]</nowiki>
12501 !! result
12502 <p>[[<i>foo</i>hello]]
12503 </p><p>[[<b>foo</b>hello]]
12504 </p>
12505 !! end
12506
12507 !! test
12508 2. Link fragments inside <i> and <b>
12509 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
12510 this is one of the shortcomings of this format)
12511 !! input
12512 ''[[foo''<nowiki>]]</nowiki>
12513
12514 '''[[foo'''<nowiki>]]</nowiki>
12515 !! result
12516 <p><i>[[foo</i>]]
12517 </p><p><b>[[foo</b>]]
12518 </p>
12519 !! end
12520
12521 #### --------------- Paragraphs ---------------
12522 #### 1. No unnecessary escapes
12523 #### --------------------------------------
12524
12525 !! test
12526 1. No unnecessary escapes
12527 !! input
12528 bar <span><nowiki>[[foo]]</nowiki></span>
12529
12530 =bar <span><nowiki>[[foo]]</nowiki></span>
12531
12532 [[bar <span><nowiki>[[foo]]</nowiki></span>
12533
12534 <nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
12535
12536 <nowiki>=bar </nowiki><span>foo]]</span>=
12537 !! result
12538 <p>bar <span>[[foo]]</span>
12539 </p><p>=bar <span>[[foo]]</span>
12540 </p><p>[[bar <span>[[foo]]</span>
12541 </p><p>]]bar <span>[[foo]]</span>
12542 </p><p>=bar <span>foo]]</span>=
12543 </p>
12544 !!end
12545
12546 #### --------------- PRE ------------------
12547 #### 1. Leading space in SOL context should be escaped
12548 #### --------------------------------------
12549 !! test
12550 1. Leading space in SOL context should be escaped
12551 !! options
12552 disabled
12553 !! input
12554 <nowiki> foo</nowiki>
12555 <!--cmt--><nowiki> foo</nowiki>
12556 !! result
12557 <p> foo
12558 <!--cmt--> foo
12559 </p>
12560 !! end
12561
12562 #### --------------- HTML tags ---------------
12563 #### 1. a tags
12564 #### 2. other tags
12565 #### 3. multi-line html tag
12566 #### --------------------------------------
12567 !! test
12568 1. a tags
12569 !! options
12570 disabled
12571 !! input
12572 <a href="http://google.com">google</a>
12573 !! result
12574 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
12575 !! end
12576
12577 !! test
12578 2. other tags
12579 !! input
12580 <nowiki><div>foo</div>
12581 <div style="color:red">foo</div></nowiki>
12582 !! result
12583 <p>&lt;div&gt;foo&lt;/div&gt;
12584 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
12585 </p>
12586 !! end
12587
12588 !! test
12589 3. multi-line html tag
12590 !! input
12591 <nowiki><div
12592 >foo</div
12593 ></nowiki>
12594 !! result
12595 <p>&lt;div
12596 &gt;foo&lt;/div
12597 &gt;
12598 </p>
12599 !! end
12600
12601 #### --------------- Others ---------------
12602 !! test
12603 Escaping nowikis
12604 !! input
12605 &lt;nowiki&gt;foo&lt;/nowiki&gt;
12606 !! result
12607 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
12608 </p>
12609 !! end
12610
12611 TODO:
12612 more images
12613 more tables
12614 character entities
12615 and much more
12616 Try for 100% code coverage