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