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