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