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