Merge "Add new parserTests for image attributes coming from templates."
[mediawiki.git] / tests / parser / parserTests.txt
blob5e5931a2016f5898b29de3ae1ea5a671b8ff246a
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
5 # The syntax should be fairly self-explanatory.
7 # Currently supported test options:
8 # One of the following three:
10 #  (default)  generate HTML output
11 #  pst        apply pre-save transform
12 #  msg        apply message transform
14 # Plus any combination of these:
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 # parsoid       parsoid-only test (not run by PHP parser)
25 # php           php-only test (not run by the parsoid parser)
26 # showtitle     make the first line the title
27 # comment       run through Linker::formatComment() instead of main parser
28 # local         format section links in edit comment text as local links
30 # You can also set the following parser properties via test options:
31 #  wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
32 #  wgLinkHolderBatchSize, wgRawHtml
34 # For testing purposes, temporary articles can created:
35 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
36 # where '/' denotes a newline.
38 # This is the standard article assumed to exist.
39 !! article
40 Main Page
41 !! text
42 blah blah
43 !! endarticle
45 !!article
46 Template:Foo
47 !!text
48 FOO
49 !!endarticle
51 !! article
52 Template:Blank
53 !! text
54 !! endarticle
56 !! article
57 Template:pipe
58 !! text
60 !! endarticle
62 !!article
63 MediaWiki:bad image list
64 !!text
65 * [[File:Bad.jpg]] except [[Nasty page]]
66 !!endarticle
68 !! article
69 Template:inner list
70 !! text
71 * item 1
72 !! endarticle
74 !! article
75 Template:tbl-start
76 !! text
78 !! endarticle
80 !! article
81 Template:tbl-end
82 !! text
84 !! endarticle
86 !! article
87 Template:!
88 !! text
90 !! endarticle
92 !! article
93 Template:echo
94 !! text
95 {{{1}}}
96 !! endarticle
98 !! article
99 Template:echo_with_span
100 !! text
101 <span>{{{1}}}</span>
102 !! endarticle
104 !! article
105 Template:echo_with_div
106 !! text
107 <div>{{{1}}}</div>
108 !! endarticle
110 !! article
111 Template:attr_str
112 !! text
113 {{{1}}}="{{{2}}}"
114 !! endarticle
116 !! article
117 Template:table_attribs
118 !! text
119 <noinclude>
120 |</noinclude>style="color: red"| Foo
121 !! endarticle
123 !! article
124 Template:table_cells
125 !! text
126 {{table_attribs}} || Bar || Baz
127 !! endarticle
129 !! article
130 Template:image_attribs
131 !! text
132 <noinclude>
133 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
134 !! endarticle
136 !! article
138 !! text
139 Weirdo titles!
140 !! endarticle
143 ### Basic tests
145 !! test
146 Blank input
147 !! input
148 !! result
149 !! end
152 !! test
153 Simple paragraph
154 !! input
155 This is a simple paragraph.
156 !! result
157 <p>This is a simple paragraph.
158 </p>
159 !! end
161 !! test
162 Paragraphs with extra newline spacing
163 !! input
173 booz
174 !! result
175 <p>foo
176 </p><p>bar
177 </p><p><br />
179 </p><p><br />
180 </p><p>booz
181 </p>
182 !! end
184 !! test
185 Paragraphs with newline spacing with comment lines in between
186 !! input
187 ----
189 <!--foo-->
191 ----
193 <!--foo--><!--More than 1 comment disables stripping of this line!-->
195 ----
197 <!--foo-->
200 ----
203 <!--foo-->
205 ----
207 <!--foo-->
211 ----
215 <!--foo-->
217 ----
218 !! result
219 <hr />
220 <p>a
222 </p>
223 <hr />
224 <p>a
225 </p><p>b
226 </p>
227 <hr />
228 <p>a
229 </p><p>b
230 </p>
231 <hr />
232 <p>a
233 </p><p>b
234 </p>
235 <hr />
236 <p>a
237 </p><p><br />
239 </p>
240 <hr />
241 <p>a
242 </p><p><br />
244 </p>
245 <hr />
247 !! end
249 !! test
250 Paragraphs with newline spacing with non-empty white-space lines in between
251 !! input
252 ----
256 ----
261 ----
262 !! result
263 <hr />
264 <p>a
265 </p><p>b
266 </p>
267 <hr />
268 <p>a
269 </p><p><br /> 
271 </p>
272 <hr />
274 !! end
276 !! test
277 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
278 !! input
279 ----
281  <!--foo-->
283 ----
285  <!--foo--><!--More than 1 comment disables stripping of this line!-->
287 ----
290 <!--foo-->
291  <!--bar-->
293 ----
296  <!--foo-->
297  <!--bar-->
300 ----
301 !! result
302 <hr />
303 <p>a
305 </p>
306 <hr />
307 <p>a
308 </p><p>b
309 </p>
310 <hr />
311 <p>a
312 </p><p>b
313 </p>
314 <hr />
315 <p>a
316 </p><p><br /> 
318 </p>
319 <hr />
321 !! end
323 !! test
324 Extra newlines: More paragraphs with indented comment
325 !! input
328    <!--boo-->
331 !!result
332 <p>a
333 </p><p><br />
335 </p>
336 !!end
338 !! test
339 Extra newlines followed by heading
340 !! input
346 [[a]]
350 !! result
351 <p>a
352 </p><p><br />
353 </p>
354 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
355 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
356 </p><p><br />
357 </p>
358 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
360 !! end
362 !! test
363 Extra newlines between heading and content are swallowed
364 !! input
369 [[a]]
370 !! result
371 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
372 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
373 </p>
374 !! end
376 !! test
377 Parsing an URL
378 !! input
379 http://fr.wikipedia.org/wiki/🍺
380 <!-- EasterEgg we love beer, better be able be able to link to it -->
381 !! result
382 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
383 </p>
384 !! end
386 !! test
387 Simple list
388 !! input
389 * Item 1
390 * Item 2
391 !! result
392 <ul><li> Item 1
393 </li><li> Item 2
394 </li></ul>
396 !! end
398 !! test
399 Italics and bold
400 !! input
401 * plain
402 * plain''italic''plain
403 * plain''italic''plain''italic''plain
404 * plain'''bold'''plain
405 * plain'''bold'''plain'''bold'''plain
406 * plain''italic''plain'''bold'''plain
407 * plain'''bold'''plain''italic''plain
408 * plain''italic'''bold-italic'''italic''plain
409 * plain'''bold''bold-italic''bold'''plain
410 * plain'''''bold-italic'''italic''plain
411 * plain'''''bold-italic''bold'''plain
412 * plain''italic'''bold-italic'''''plain
413 * plain'''bold''bold-italic'''''plain
414 * plain l'''italic''plain
415 * plain l''''bold''' plain
416 !! result
417 <ul><li> plain
418 </li><li> plain<i>italic</i>plain
419 </li><li> plain<i>italic</i>plain<i>italic</i>plain
420 </li><li> plain<b>bold</b>plain
421 </li><li> plain<b>bold</b>plain<b>bold</b>plain
422 </li><li> plain<i>italic</i>plain<b>bold</b>plain
423 </li><li> plain<b>bold</b>plain<i>italic</i>plain
424 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
425 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
426 </li><li> plain<i><b>bold-italic</b>italic</i>plain
427 </li><li> plain<b><i>bold-italic</i>bold</b>plain
428 </li><li> plain<i>italic<b>bold-italic</b></i>plain
429 </li><li> plain<b>bold<i>bold-italic</i></b>plain
430 </li><li> plain l'<i>italic</i>plain
431 </li><li> plain l'<b>bold</b> plain
432 </li></ul>
434 !! end
436 # this example taken from the simple/Moon article
437 !! test
438 Italics and possessives
439 !! input
440 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
441 !! result
442 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
443 </p>
444 !! end
447 ### 2-quote opening sequence tests
449 !! test
450 Italics and bold: 2-quote opening sequence: (2,2)
451 !! input
452 ''foo''
453 !! result
454 <p><i>foo</i>
455 </p>
456 !!end
459 !! test
460 Italics and bold: 2-quote opening sequence: (2,3)
461 !! input
462 ''foo'''
463 !! result
464 <p><i>foo'</i>
465 </p>
466 !!end
469 !! test
470 Italics and bold: 2-quote opening sequence: (2,4)
471 !! input
472 ''foo''''
473 !! result
474 <p><i>foo''</i>
475 </p>
476 !!end
479 !! test
480 Italics and bold: 2-quote opening sequence: (2,5) (php)
481 !! options
483 !! input
484 ''foo'''''
485 !! result
486 <p><i>foo</i>
487 </p>
488 !!end
489 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
490 !! test
491 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
492 !! options
493 parsoid
494 !! input
495 ''foo'''''
496 !! result
497 <p><i>foo</i><b></b>
498 </p>
499 !!end
503 ### 3-quote opening sequence tests
506 !! test
507 Italics and bold: 3-quote opening sequence: (3,2)
508 !! input
509 '''foo''
510 !! result
511 <p>'<i>foo</i>
512 </p>
513 !!end
516 !! test
517 Italics and bold: 3-quote opening sequence: (3,3)
518 !! input
519 '''foo'''
520 !! result
521 <p><b>foo</b>
522 </p>
523 !!end
526 !! test
527 Italics and bold: 3-quote opening sequence: (3,4)
528 !! input
529 '''foo''''
530 !! result
531 <p><b>foo'</b>
532 </p>
533 !!end
536 !! test
537 Italics and bold: 3-quote opening sequence: (3,5) (php)
538 !! options
540 !! input
541 '''foo'''''
542 !! result
543 <p><b>foo</b>
544 </p>
545 !!end
546 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
547 !! test
548 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
549 !! options
550 parsoid
551 !! input
552 '''foo'''''
553 !! result
554 <p><b>foo<i></i></b>
555 </p>
556 !!end
560 ### 4-quote opening sequence tests
563 !! test
564 Italics and bold: 4-quote opening sequence: (4,2)
565 !! input
566 ''''foo''
567 !! result
568 <p>''<i>foo</i>
569 </p>
570 !!end
573 !! test
574 Italics and bold: 4-quote opening sequence: (4,3)
575 !! input
576 ''''foo'''
577 !! result
578 <p>'<b>foo</b>
579 </p>
580 !!end
583 !! test
584 Italics and bold: 4-quote opening sequence: (4,4)
585 !! input
586 ''''foo''''
587 !! result
588 <p>'<b>foo'</b>
589 </p>
590 !!end
593 !! test
594 Italics and bold: 4-quote opening sequence: (4,5) (php)
595 !! options
597 !! input
598 ''''foo'''''
599 !! result
600 <p>'<b>foo</b>
601 </p>
602 !!end
603 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
604 !! test
605 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
606 !! options
607 parsoid
608 !! input
609 ''''foo'''''
610 !! result
611 <p>'<b>foo<i></i></b>
612 </p>
613 !!end
617 ### 5-quote opening sequence tests
620 !! test
621 Italics and bold: 5-quote opening sequence: (5,2) (php)
622 !! options
624 !! input
625 '''''foo''
626 !! result
627 <p><b><i>foo</i></b>
628 </p>
629 !!end
630 # Parsoid reverses the nesting order, compared to the PHP parser
631 !! test
632 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
633 !! options
634 parsoid
635 !! input
636 '''''foo''
637 !! result
638 <p><i><b>foo</b></i>
639 </p>
640 !!end
643 !! test
644 Italics and bold: 5-quote opening sequence: (5,3)
645 !! input
646 '''''foo'''
647 !! result
648 <p><i><b>foo</b></i>
649 </p>
650 !!end
653 !! test
654 Italics and bold: 5-quote opening sequence: (5,4)
655 !! input
656 '''''foo''''
657 !! result
658 <p><i><b>foo'</b></i>
659 </p>
660 !!end
663 !! test
664 Italics and bold: 5-quote opening sequence: (5,5)
665 !! input
666 '''''foo'''''
667 !! result
668 <p><i><b>foo</b></i>
669 </p>
670 !!end
673 ### multiple quote sequences in a line
675 !! test
676 Italics and bold: multiple quote sequences: (2,4,2)
677 !! input
678 ''foo''''bar''
679 !! result
680 <p><i>foo'<b>bar</b></i>
681 </p>
682 !!end
685 !! test
686 Italics and bold: multiple quote sequences: (2,4,3)
687 !! input
688 ''foo''''bar'''
689 !! result
690 <p><i>foo'<b>bar</b></i>
691 </p>
692 !!end
695 !! test
696 Italics and bold: multiple quote sequences: (2,4,4)
697 !! input
698 ''foo''''bar''''
699 !! result
700 <p><i>foo'<b>bar'</b></i>
701 </p>
702 !!end
705 !! test
706 Italics and bold: multiple quote sequences: (3,4,2) (php)
707 !! options
709 !! input
710 '''foo''''bar''
711 !! result
712 <p><b>foo'</b>bar
713 </p>
714 !!end
715 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
716 !! test
717 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
718 !! options
719 parsoid
720 !! input
721 '''foo''''bar''
722 !! result
723 <p><b>foo'</b>bar<i></i>
724 </p>
725 !!end
728 !! test
729 Italics and bold: multiple quote sequences: (3,4,3) (php)
730 !! options
732 !! input
733 '''foo''''bar'''
734 !! result
735 <p><b>foo'</b>bar
736 </p>
737 !!end
738 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
739 !! test
740 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
741 !! options
742 parsoid
743 !! input
744 '''foo''''bar'''
745 !! result
746 <p><b>foo'</b>bar<b></b>
747 </p>
748 !!end
751 ### other quote tests
753 !! test
754 Italics and bold: other quote tests: (2,3,5)
755 !! input
756 ''this is about '''foo's family'''''
757 !! result
758 <p><i>this is about <b>foo's family</b></i>
759 </p>
760 !!end
763 !! test
764 Italics and bold: other quote tests: (2,(3,3),2)
765 !! input
766 ''this is about '''foo's''' family''
767 !! result
768 <p><i>this is about <b>foo's</b> family</i>
769 </p>
770 !!end
773 !! test
774 Italics and bold: other quote tests: (3,2,3,2)
775 !! input
776 '''this is about ''foo'''s family''
777 !! result
778 <p><b>this is about <i>foo</i></b><i>s family</i>
779 </p>
780 !!end
783 # The Parsoid team believes the PHP parser's output on this test is wrong.
784 # It only checks for convert-to-bold-on-single-character-word when the word
785 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
786 # This means that the bold token in position 2 (0-indexed) gets converted by
787 # parsoid, but doesn't get changed by the PHP parser.
788 !! test
789 Italics and bold: other quote tests: (3,2,3,3) (php)
790 !! options
792 !! input
793 '''this is about ''foo'''s family'''
794 !! result
795 <p>'<i>this is about </i>foo<b>s family</b>
796 </p>
797 !!end
798 # This is the output the Parsoid team believes to be correct.
799 !! test
800 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
801 !! options
802 parsoid
803 !! input
804 '''this is about ''foo'''s family'''
805 !! result
806 <p><b>this is about <i>foo'</i>s family</b>
807 </p>
808 !!end
811 !! test
812 Italics and bold: other quote tests: (3,(2,2),3)
813 !! input
814 '''this is about ''foo's'' family'''
815 !! result
816 <p><b>this is about <i>foo's</i> family</b>
817 </p>
818 !!end
821 !! test
822 Italicized possessive
823 !! input
824 The ''[[Main Page]]'''s talk page.
825 !! result
826 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
827 </p>
828 !! end
830 !! test
831 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
832 (Requires tidy for PHP parser output to be fixed up)
833 !! options
834 parsoid=wt2html,wt2wt
835 !! input
837 !''a!!''b
838 |''a||''b
840 !! result
841 <table>
842 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
843 <td><i>a</i></td><td><i>b</i></td></tr>
844 </tbody></table>
845 !! end
848 ### Non-html5 tags
851 !! test
852 Non-html5 tags should be accepted
853 !! input
854 <center>''foo''</center>
855 <big>''foo''</big>
856 <font>''foo''</font>
857 <strike>''foo''</strike>
858 <tt>''foo''</tt>
859 !! result
860 <center><i>foo</i></center>
861 <p><big><i>foo</i></big>
862 <font><i>foo</i></font>
863 <strike><i>foo</i></strike>
864 <tt><i>foo</i></tt>
865 </p>
866 !! end
869 ### <nowiki> test cases
872 !! test
873 <nowiki> unordered list
874 !! input
875 <nowiki>* This is not an unordered list item.</nowiki>
876 !! result
877 <p>* This is not an unordered list item.
878 </p>
879 !! end
881 !! test
882 <nowiki> spacing
883 !! input
884 <nowiki>Lorem ipsum dolor
886 sed abit.
887   sed nullum.
889 :and a colon
890 </nowiki>
891 !! result
892 <p>Lorem ipsum dolor
894 sed abit.
895   sed nullum.
897 :and a colon
899 </p>
900 !! end
902 !! test
903 nowiki 3
904 !! input
905 :There is not nowiki.
906 :There is <nowiki>nowiki</nowiki>.
908 #There is not nowiki.
909 #There is <nowiki>nowiki</nowiki>.
911 *There is not nowiki.
912 *There is <nowiki>nowiki</nowiki>.
913 !! result
914 <dl><dd>There is not nowiki.
915 </dd><dd>There is nowiki.
916 </dd></dl>
917 <ol><li>There is not nowiki.
918 </li><li>There is nowiki.
919 </li></ol>
920 <ul><li>There is not nowiki.
921 </li><li>There is nowiki.
922 </li></ul>
924 !! end
926 !! test
927 Entities inside <nowiki>
928 !! input
929 <nowiki>&lt;</nowiki>
930 !! result
931 <p>&lt;
932 </p>
933 !! end
935 !! test
936 Entities inside template parameters
937 !! options
938 parsoid
939 !! input
940 {{echo|&ndash;}}
941 !! result
942 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}'>&ndash;</span>
943 </p>
944 !! end
947 ### Comments
949 !! test
950 Comments and Indent-Pre
951 !! input
952 <!-- comment 1 --> asdf
954 <!-- comment 1 --> asdf
955 <!-- comment 2 -->
957 <!-- comment 1 --> asdf
958 <!-- comment 2 -->xyz
960 <!-- comment 1 --> asdf
961 <!-- comment 2 --> xyz
962 !! result
963 <pre>asdf
964 </pre>
965 <pre>asdf
966 </pre>
967 <pre>asdf
968 </pre>
969 <p>xyz
970 </p>
971 <pre>asdf
973 </pre>
974 !! end
976 !! test
977 Comment test 2a
978 !! input
979 asdf
980 <!-- comment 1 -->
982 !! result
983 <p>asdf
985 </p>
986 !! end
988 !! test
989 Comment test 2b
990 !! input
991 asdf
992 <!-- comment 1 -->
995 !! result
996 <p>asdf
997 </p><p>jkl
998 </p>
999 !! end
1001 !! test
1002 Comment test 3
1003 !! input
1004 asdf
1005 <!-- comment 1 -->
1006 <!-- comment 2 -->
1008 !! result
1009 <p>asdf
1011 </p>
1012 !! end
1014 !! test
1015 Comment test 4
1016 !! input
1017 asdf<!-- comment 1 -->jkl
1018 !! result
1019 <p>asdfjkl
1020 </p>
1021 !! end
1023 !! test
1024 Comment spacing
1025 !! input
1027  <!-- foo --> b <!-- bar -->
1029 !! result
1030 <p>a
1031 </p>
1032 <pre> b 
1033 </pre>
1034 <p>c
1035 </p>
1036 !! end
1038 !! test
1039 Comment whitespace
1040 !! input
1041 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1042 !! result
1044 !! end
1046 !! test
1047 Comment semantics and delimiters
1048 !! input
1049 <!-- --><!----><!-----><!------>
1050 !! result
1052 !! end
1054 !! test
1055 Comment semantics and delimiters, redux
1056 !! input
1057 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1058 -- foo -- funky huh? ... -->
1059 !! result
1061 !! end
1063 !! test
1064 Comment semantics and delimiters: directors cut
1065 !! input
1066 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1067 everything starting with < followed by !-- until the first -- and > we see,
1068 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1069 -->-->
1070 !! result
1071 <p>--&gt;
1072 </p>
1073 !! end
1075 !! test
1076 Comment semantics: nesting
1077 !! input
1078 <!--<!-- no, we're not going to do anything fancy here -->-->
1079 !! result
1080 <p>--&gt;
1081 </p>
1082 !! end
1084 !! test
1085 Comment semantics: unclosed comment at end
1086 !! input
1087 <!--This comment will run out to the end of the document
1088 !! result
1090 !! end
1092 !! test
1093 Comment in template title
1094 !! input
1095 {{f<!---->oo}}
1096 !! result
1097 <p>FOO
1098 </p>
1099 !! end
1101 !! test
1102 Comment on its own line post-expand
1103 !! input
1105 {{blank}}<!---->
1107 !! result
1108 <p>a
1109 </p><p>b
1110 </p>
1111 !! end
1113 !! test
1114 Comment on its own line post-expand with non-significant whitespace
1115 !! input
1117  {{blank}} <!----> 
1119 !! result
1120 <p>a
1121 </p><p>b
1122 </p>
1123 !! end
1126 ### paragraph wrapping tests
1128 !! test
1129 No block tags
1130 !! input
1134 !! result
1135 <p>a
1136 </p><p>b
1137 </p>
1138 !! end
1139 !! test
1140 Block tag on one line
1141 !! input
1142 a <div>foo</div>
1145 !! result
1146 a <div>foo</div>
1147 <p>b
1148 </p>
1149 !! end
1151 !! test
1152 Block tag on both lines
1153 !! input
1154 a <div>foo</div>
1156 b <div>foo</div>
1157 !! result
1158 a <div>foo</div>
1159 b <div>foo</div>
1161 !! end
1163 !! test
1164 Multiple lines without block tags
1165 !! input
1166 <div>foo</div> a
1169 d<!--foo--> e
1170 x <div>foo</div> z
1171 !! result
1172 <div>foo</div> a
1173 <p>b
1175 d e
1176 </p>
1177 x <div>foo</div> z
1179 !! end
1181 !! test
1182 Empty lines between lines with block tags
1183 !! input
1184 <div></div>
1187 <div></div>a
1190 <div>a</div>b
1192 <div>b</div>d
1195 <div>e</div>
1196 !! result
1197 <div></div>
1198 <p><br />
1199 </p>
1200 <div></div>a
1201 <p>b
1202 </p>
1203 <div>a</div>b
1204 <div>b</div>d
1205 <p><br />
1206 </p>
1207 <div>e</div>
1209 !! end
1212 ### Preformatted text
1214 !! test
1215 Preformatted text
1216 !! input
1217  This is some
1218  Preformatted text
1219  With ''italic''
1220  And '''bold'''
1221  And a [[Main Page|link]]
1222 !! result
1223 <pre>This is some
1224 Preformatted text
1225 With <i>italic</i>
1226 And <b>bold</b>
1227 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1228 </pre>
1229 !! end
1231 !! test
1232 Ident preformatting with inline content
1233 !! input
1235  ''b''
1236 !! result
1237 <pre>a
1238 <i>b</i>
1239 </pre>
1240 !! end
1242 !! test
1243 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1244 !! input
1245 <pre><nowiki>
1247 <cite>
1248 <em>
1249 </nowiki></pre>
1250 !! result
1251 <pre>
1252 &lt;b&gt;
1253 &lt;cite&gt;
1254 &lt;em&gt;
1255 </pre>
1257 !! end
1259 !! test
1260 Regression with preformatted in <center>
1261 !! input
1262 <center>
1263  Blah
1264 </center>
1265 !! result
1266 <center>
1267 <pre>Blah
1268 </pre>
1269 </center>
1271 !! end
1273 # Expected output in the following test is not really expected (there should be
1274 # <pre> in the output) -- it's only testing for well-formedness.
1275 !! test
1276 Bug 6200: Preformatted in <blockquote>
1277 !! input
1278 <blockquote>
1279  Blah
1280 </blockquote>
1281 !! result
1282 <blockquote>
1283  Blah
1284 </blockquote>
1286 !! end
1288 !! test
1289 <pre> with attributes (bug 3202)
1290 !! input
1291 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1292 !! result
1293 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1295 !! end
1297 !! test
1298 <pre> with width attribute (bug 3202)
1299 !! input
1300 <pre width="8">Narrow screen goodies</pre>
1301 !! result
1302 <pre width="8">Narrow screen goodies</pre>
1304 !! end
1306 !! test
1307 <pre> with forbidden attribute (bug 3202)
1308 !! input
1309 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1310 !! result
1311 <pre width="8">Narrow screen goodies</pre>
1313 !! end
1315 !! test
1316 Entities inside <pre>
1317 !! input
1318 <pre>&lt;</pre>
1319 !! result
1320 <pre>&lt;</pre>
1322 !! end
1324 !! test
1325 <pre> with forbidden attribute values (bug 3202)
1326 !! input
1327 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1328 !! result
1329 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1331 !! end
1333 !! test
1334 <nowiki> inside <pre> (bug 13238)
1335 !! input
1336 <pre>
1337 <nowiki>
1338 </pre>
1339 <pre>
1340 <nowiki></nowiki>
1341 </pre>
1342 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1343 !! result
1344 <pre>
1345 &lt;nowiki&gt;
1346 </pre>
1347 <pre>
1349 </pre>
1350 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1352 !! end
1354 !! test
1355 <nowiki> and <pre> preference (first one wins)
1356 !! input
1357 <pre>
1358 <nowiki>
1359 </pre>
1360 </nowiki>
1361 </pre>
1363 <nowiki>
1364 <pre>
1365 <nowiki>
1366 </pre>
1367 </nowiki>
1368 </pre>
1370 !! result
1371 <pre>
1372 &lt;nowiki&gt;
1373 </pre>
1374 <p>&lt;/nowiki&gt;
1375 &lt;/pre&gt;
1376 </p><p>
1377 &lt;pre&gt;
1378 &lt;nowiki&gt;
1379 &lt;/pre&gt;
1381 &lt;/pre&gt;
1382 </p>
1383 !! end
1385 !! test
1386 </pre> inside nowiki
1387 !! input
1388 <nowiki></pre></nowiki>
1389 !! result
1390 <p>&lt;/pre&gt;
1391 </p>
1392 !! end
1394 !!test
1395 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1396 !!input
1397  {{echo|}}
1398 !!result
1400 !!end
1402 !!test
1403 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1404 !!input
1405  {{echo|
1406 foo}}
1407 !!result
1408 <p>foo
1409 </p>
1410 !!end
1412 !! test
1413 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1414 !! input
1415  {{echo|a
1417 !!result
1418 <pre>a
1419 </pre>
1420 <p>b
1421 </p>
1422 !!end
1424 !! test
1425 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1426 !! input
1427  {{echo|a
1433 !!result
1434 <pre>a
1435 </pre>
1436 <p>b
1438 </p>
1439 <pre>d
1440 </pre>
1441 <p>e
1442 </p>
1443 !!end
1445 !!test
1446 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1447 !!input
1448 {{echo| foo}}
1450 {{echo| foo}}{{echo| bar}}
1452 {{echo| foo}}
1453 {{echo| bar}}
1455 {{echo|<!--cmt--> foo}}
1457 <!--cmt-->{{echo| foo}}
1459 {{echo|{{echo| }}bar}}
1460 !!result
1461 <pre>foo
1462 </pre>
1463 <pre>foo bar
1464 </pre>
1465 <pre>foo
1467 </pre>
1468 <pre>foo
1469 </pre>
1470 <pre>foo
1471 </pre>
1472 <pre>bar
1473 </pre>
1474 !!end
1476 !! test
1477 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1478 !! input
1479 {{echo| }}a
1481 {{echo|
1482  }}a
1484 {{echo|
1485  b}}
1487 {{echo|a
1488  }}b
1490 {{echo|a
1491 }} b
1492 !!result
1493 <pre>a
1494 </pre>
1495 <p><br />
1496 </p>
1497 <pre>a
1498 </pre>
1499 <p><br />
1500 </p>
1501 <pre>b
1502 </pre>
1503 <p>a
1504 </p>
1505 <pre>b
1506 </pre>
1507 <p>a
1508 </p>
1509 <pre>b
1510 </pre>
1511 !!end
1513 !! test
1514 Templates: Single-line variant of parameter whitespace stripping test
1515 !! input
1516 {{echo| a}}
1518 {{echo|1= a}}
1520 {{echo|{{echo| a}}}}
1522 {{echo|1={{echo| a}}}}
1523 !! result
1524 <pre>a
1525 </pre>
1526 <p>a
1527 </p>
1528 <pre>a
1529 </pre>
1530 <p>a
1531 </p>
1532 !! end
1534 !! test
1535 Templates: Strip whitespace from named parameters, but not positional ones
1536 !! input
1537 {{echo|
1538  foo}}
1540 {{echo|
1541 * foo}}
1543 {{echo| 1 =
1544  foo}}
1546 {{echo| 1 =
1547 * foo}}
1548 !! result
1549 <pre>foo
1550 </pre>
1551 <p><br />
1552 </p>
1553 <ul><li> foo
1554 </li></ul>
1555 <p>foo
1556 </p>
1557 <ul><li> foo
1558 </li></ul>
1560 !! end
1562 !! test
1563 Templates: Dont strip whitespace from whitespace/comment-only arguments
1564 !! input
1565 {{echo| }}
1566 {{echo|<!--cmt-->}}
1567 {{echo| <!--cmt--> }}
1568 !! result
1569 <p><br />
1570 </p>
1571 !! end
1573 !! test
1574 Templates: Parsoid parameter escaping test 1
1575 !! options
1576 parsoid
1577 !! input
1578 {{echo|[foo]|{{echo|[bar]}}}}
1579 !! result
1580 <p about="#mwt1" typeof="mw:Transclusion"
1581 data-mw="{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;[foo]&quot;},&quot;2&quot;:{&quot;wt&quot;:&quot;{{echo|[bar]}}&quot;}},&quot;i&quot;:0}">[foo]</p>
1582 !! end
1584 !! test
1585 Parsoid: Pipes in external links in template parameter
1586 !! options
1587 parsoid
1588 !! input
1589 {{echo|[{{echo|http://example.com}} link]}}
1590 !! result
1591 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw="{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;[{{echo|http://example.com}} link]&quot;}},&quot;i&quot;:0}">link</a></p>
1592 !! end
1594 !! test
1595 Parsoid: pipe in transclusion parameter
1596 !! options
1597 parsoid
1598 !! input
1599 {{echo|http://foo.com/a&#124;b}}
1600 !! result
1601 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1602 typeof="mw:Transclusion"
1603 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a|b"}},"i":0}'>http://foo.com/a|b</a></p>
1604 !! end
1606 !! test
1607 Parsoid: Pipe in external link target and content in template parameter
1608 !! options
1609 parsoid=html2wt,wt2wt
1610 !! input
1611 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1612 !! result
1613 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1614 typeof="mw:Transclusion"
1615 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},
1616 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}'>a|b</a></p>
1617 !! end
1619 !! test
1620 Templates: Dont escape already nowiki-escaped text in template parameters
1621 !! options
1622 parsoid=html2wt,wt2wt
1623 !! input
1624 {{echo|foo<nowiki>|</nowiki>bar}}
1625 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1626 {{echo|<nowiki></nowiki>}}
1627 !! result
1628 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
1629 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
1630 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}'></span>
1631 </p>
1632 !! end
1635 ### Parsoid-centric tests for testing RT edge cases for pre
1638 !!test
1639 1a. Indent-Pre and Comments
1640 !!input
1642 <!--a-->
1644 !!result
1645 <pre>a
1646 </pre>
1647 <p>c
1648 </p>
1649 !!end
1651 !!test
1652 1b. Indent-Pre and Comments
1653 !!input
1655  <!--a-->
1657 !!result
1658 <pre>a
1659 </pre>
1660 <p>c
1661 </p>
1662 !!end
1664 !!test
1665 1c. Indent-Pre and Comments
1666 !!input
1667 <!--a-->  a
1669  <!--a--> a
1670 !!result
1671 <pre> a
1672 </pre>
1673 <pre> a
1674 </pre>
1675 !!end
1677 !!test
1678 2a. Indent-Pre and tables
1679 !!input
1680  {|
1681  |-
1682  !h1!!h2
1683  |foo||bar
1684  |}
1685 !!result
1686 <table>
1688 <tr>
1689 <th>h1</th>
1690 <th>h2
1691 </th>
1692 <td>foo</td>
1693 <td>bar
1694 </td></tr></table>
1696 !!end
1698 !!test
1699 2b. Indent-Pre and tables
1700 !!input
1701   {|
1702  |-
1703 |foo
1705 !!result
1706 <table>
1708 <tr>
1709 <td>foo
1710 </td></tr></table>
1712 !!end
1714 !!test
1715 2c. Indent-Pre and tables (bug 42252)
1716 !!input
1718  |+ foo
1719  !  | bar
1721 !!result
1722 <table>
1723 <caption> foo
1724 </caption>
1725 <tr>
1726 <th> bar
1727 </th></tr></table>
1729 !!end
1731 !!test
1732 3a. Indent-Pre and block tags (single-line html)
1733 !!input
1734  <p> foo </p>
1735  <div> foo </div>
1736  <span> foo </span>
1737 !!result
1738  <p> foo </p>
1739  <div> foo </div>
1740 <pre><span> foo </span>
1741 </pre>
1742 !!end
1744 !!test
1745 3b. Indent-Pre and block tags (pre-content on separate line)
1746 !!input
1748  foo
1749 </p>
1751 <div>
1752  foo
1753 </div>
1755 <center>
1756  foo
1757 </center>
1759 <blockquote>
1760  foo
1761 </blockquote>
1763 <table><tr><td>
1764  foo
1765 </td></tr></table>
1767 <ul><li>
1768   foo
1769 </li></ul>
1771 !!result
1773  foo
1774 </p>
1775 <div>
1776 <pre>foo
1777 </pre>
1778 </div>
1779 <center>
1780 <pre>foo
1781 </pre>
1782 </center>
1783 <blockquote>
1784  foo
1785 </blockquote>
1786 <table><tr><td>
1787 <pre>foo
1788 </pre>
1789 </td></tr></table>
1790 <ul><li>
1791   foo
1792 </li></ul>
1794 !!end
1796 !!test
1797 4. Multiple spaces at start-of-line
1798 !!input
1799     <p> foo </p>
1800     foo
1801         {|
1802 |foo
1804 !!result
1805     <p> foo </p>
1806 <pre>   foo
1807 </pre>
1808 <table>
1809 <tr>
1810 <td>foo
1811 </td></tr></table>
1813 !!end
1815 !! test
1816 5. White-space in indent-pre
1817 NOTE: the white-space char on 2nd line is significant
1818 !! input
1819  a<br/>
1822 !! result
1823 <pre>a<br />
1826 </pre>
1827 !! end
1830 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1833 !!test
1834 HTML-pre: 1. embedded newlines
1835 !!input
1836 <pre>foo</pre>
1838 <pre>
1840 </pre>
1842 <pre>
1845 </pre>
1847 <pre>
1851 </pre>
1852 !!result
1853 <pre>foo</pre>
1854 <pre>
1856 </pre>
1857 <pre>
1860 </pre>
1861 <pre>
1865 </pre>
1867 !!end
1869 !!test
1870 HTML-pre: 2: indented text
1871 !!input
1872 <pre>
1873  foo
1874 </pre>
1875 !!result
1876 <pre>
1877  foo
1878 </pre>
1880 !!end
1882 !!test
1883 HTML-pre: 3: other wikitext
1884 !!input
1885 <pre>
1886 * foo
1887 # bar
1888 = no-h =
1889 '' no-italic ''
1890 [[ NoLink ]]
1891 </pre>
1892 !!result
1893 <pre>
1894 * foo
1895 # bar
1896 = no-h =
1897 '' no-italic ''
1898 [[ NoLink ]]
1899 </pre>
1901 !!end
1904 ### Definition lists
1906 !! test
1907 Simple definition
1908 !! input
1909 ; name : Definition
1910 !! result
1911 <dl><dt> name&#160;</dt><dd> Definition
1912 </dd></dl>
1914 !! end
1916 !! test
1917 Definition list for indentation only
1918 !! input
1919 : Indented text
1920 !! result
1921 <dl><dd> Indented text
1922 </dd></dl>
1924 !! end
1926 !! test
1927 Definition list with no space
1928 !! input
1929 ;name:Definition
1930 !! result
1931 <dl><dt>name</dt><dd>Definition
1932 </dd></dl>
1934 !!end
1936 !! test
1937 Definition list with URL link
1938 !! input
1939 ; http://example.com/ : definition
1940 !! result
1941 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1942 </dd></dl>
1944 !! end
1946 !! test
1947 Definition list with bracketed URL link
1948 !! input
1949 ;[http://www.example.com/ Example]:Something about it
1950 !! result
1951 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1952 </dd></dl>
1954 !! end
1956 !! test
1957 Definition list with wikilink containing colon
1958 !! input
1959 ; [[Help:FAQ]]: The least-read page on Wikipedia
1960 !! result
1961 <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
1962 </dd></dl>
1964 !! end
1966 # At Brion's and JeLuF's insistence... :)
1967 !! test
1968 Definition list with news link containing colon
1969 !! input
1970 ;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
1971 !! result
1972 <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!
1973 </dd></dl>
1975 !! end
1977 !! test
1978 Malformed definition list with colon
1979 !! input
1980 ;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1981 !! result
1982 <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
1983 </dt></dl>
1985 !! end
1987 !! test
1988 Definition lists: colon in external link text
1989 !! input
1990 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1991 !! result
1992 <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
1993 </dd></dl>
1995 !! end
1997 !! test
1998 Definition lists: colon in HTML attribute
1999 !! input
2000 ;<b style="display: inline">bold</b>
2001 !! result
2002 <dl><dt><b style="display: inline">bold</b>
2003 </dt></dl>
2005 !! end
2007 !! test
2008 Definition lists: self-closed tag
2009 !! input
2010 ;one<br/>two : two-line fun
2011 !! result
2012 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
2013 </dd></dl>
2015 !! end
2017 !! test
2018 Bug 11748: Literal closing tags
2019 !! input
2020 <dl>
2021 <dt>test 1</dt>
2022 <dd>test test test test test</dd>
2023 <dt>test 2</dt>
2024 <dd>test test test test test</dd>
2025 </dl>
2026 !! result
2027 <dl>
2028 <dt>test 1</dt>
2029 <dd>test test test test test</dd>
2030 <dt>test 2</dt>
2031 <dd>test test test test test</dd>
2032 </dl>
2034 !! end
2036 !! test
2037 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2038 !! input
2039 <ul><li>
2040 ; term : description
2041 * unordered
2042 </li>
2043 </ul>
2044 !! result
2045 <ul><li>
2046 <dl><dt> term&#160;</dt><dd> description
2047 </dd></dl>
2048 <ul><li> unordered
2049 </li></ul>
2050 </li>
2051 </ul>
2053 !! end
2055 !! test
2057 Definition list with empty definition and following paragraph
2058 !! input
2059 ; term:
2060 Paragraph text
2061 !! result
2062 <dl><dt> term</dt><dd>
2063 </dd></dl>
2064 <p>Paragraph text
2065 </p>
2066 !! end
2068 !! test
2069 Nested definition lists using html syntax
2070 !! input
2071 <dl><dd>
2072 <dl>
2073 <dd>Foo</dd>
2074 </dl>
2075 </dd></dl>
2076 !! result
2077 <dl><dd>
2078 <dl>
2079 <dd>Foo</dd>
2080 </dl>
2081 </dd></dl>
2083 !! end
2085 !! test
2086 Definition Lists: No nesting: Multiple dd's
2087 !! input
2091 !! result
2092 <dl><dt>x
2093 </dt><dd>a
2094 </dd><dd>b
2095 </dd></dl>
2097 !! end
2099 !! test
2100 Definition Lists: Indentation: Regular
2101 !! input
2103 ::i2
2104 :::i3
2105 !! result
2106 <dl><dd>i1
2107 <dl><dd>i2
2108 <dl><dd>i3
2109 </dd></dl>
2110 </dd></dl>
2111 </dd></dl>
2113 !! end
2115 !! test
2116 Definition Lists: Indentation: Missing 1st level
2117 !! input
2118 ::i2
2119 :::i3
2120 !! result
2121 <dl><dd><dl><dd>i2
2122 <dl><dd>i3
2123 </dd></dl>
2124 </dd></dl>
2125 </dd></dl>
2127 !! end
2129 !! test
2130 Definition Lists: Indentation: Multi-level indent
2131 !! input
2132 :::i3
2133 !! result
2134 <dl><dd><dl><dd><dl><dd>i3
2135 </dd></dl>
2136 </dd></dl>
2137 </dd></dl>
2139 !! end
2141 !! test
2142 Definition Lists: Hacky use to indent tables
2143 !! input
2144 ::{|
2145 |foo
2146 |bar
2148 this text
2149 should be left alone
2150 !! result
2151 <dl><dd><dl><dd><table>
2152 <tr>
2153 <td>foo
2154 </td>
2155 <td>bar
2156 </td></tr></table></dd></dl></dd></dl>
2157 <p>this text
2158 should be left alone
2159 </p>
2160 !! end
2161 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2162 ## as an empty dt item.  It also ignores all but the last ";" when followed
2163 ## by ":" later on.  So, ";" are not ignored in ";;;t3" but are ignored  in
2164 ## ";;;t3 :d1".  So, PHP parser behavior is a little inconsistent wrt multiple
2165 ## ";"s.
2167 ## Ex: ";;t2 ::d2" is transformed into:
2169 ## <dl>
2170 ##   <dt>t2 </dt>
2171 ##   <dd>
2172 ##     <dl>
2173 ##       <dt></dt>
2174 ##       <dd>d2</dd>
2175 ##     </dl>
2176 ##   </dd>
2177 ## </dl>
2179 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2180 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2182 ## <dl>
2183 ##   <dt>
2184 ##     <dl>
2185 ##       <dt>t2 </dt>
2186 ##       <dd>:d2</dd>
2187 ##     </dl>
2188 ##    </dt>
2189 ## </dl>
2191 ## All Parsoid only definition list tests have this difference.
2193 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2194 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2196 !! test
2197 Table / list interaction: indented table with lists in table contents
2198 !! input
2201 | a
2202 * b
2204 | c
2205 * d
2207 !! result
2208 <dl><dd><table>
2210 <tr>
2211 <td> a
2212 <ul><li> b
2213 </li></ul>
2214 </td></tr>
2215 <tr>
2216 <td> c
2217 <ul><li> d
2218 </li></ul>
2219 </td></tr></table></dd></dl>
2221 !! end
2223 !!test
2224 Table / list interaction: lists nested in tables nested in indented lists
2225 !!input
2237 !!result
2238 <dl><dd><table>
2239 <tr>
2240 <td>
2241 <dl><dd>a
2242 </dd><dd>b
2243 </dd></dl>
2244 </td>
2245 <td>
2246 <ul><li>c
2247 </li><li>d
2248 </li></ul>
2249 </td></tr></table></dd></dl>
2250 <ul><li>e
2251 </li><li>f
2252 </li></ul>
2254 !!end
2256 !! test
2257 Definition Lists: Nesting: Multi-level (Parsoid only)
2258 !! options
2259 parsoid
2260 !! input
2261 ;t1 :d1
2262 ;;t2 ::d2
2263 ;;;t3 :::d3
2264 !! result
2265 <dl>
2266   <dt>t1 </dt>
2267   <dd>d1</dd>
2268   <dt>
2269     <dl>
2270       <dt>t2 </dt>
2271       <dd>:d2</dd>
2272       <dt>
2273         <dl>
2274           <dt>t3 </dt>
2275           <dd>::d3</dd>
2276         </dl>
2277       </dt>
2278     </dl>
2279   </dt>
2280 </dl>
2283 !! end
2286 !! test
2287 Definition Lists: Nesting: Test 2 (Parsoid only)
2288 !! options
2289 parsoid
2290 !! input
2292 ::d2
2293 !! result
2294 <dl>
2295   <dt>t1</dt>
2296   <dd>
2297     <dl>
2298       <dd>d2</dd>
2299     </dl>
2300   </dd>
2301 </dl>
2303 !! end
2306 !! test
2307 Definition Lists: Nesting: Test 3 (Parsoid only)
2308 !! options
2309 parsoid
2310 !! input
2311 :;t1
2312 ::::d2
2313 !! result
2314 <dl>
2315   <dd>
2316     <dl>
2317       <dt>t1</dt>
2318       <dd>
2319         <dl>
2320           <dd>
2321             <dl>
2322               <dd>d2</dd>
2323             </dl>
2324           </dd>
2325         </dl>
2326       </dd>
2327     </dl>
2328   </dd>
2329 </dl>
2331 !! end
2334 !! test
2335 Definition Lists: Nesting: Test 4
2336 !! input
2337 ::;t3
2338 :::d3
2339 !! result
2340 <dl><dd><dl><dd><dl><dt>t3
2341 </dt><dd>d3
2342 </dd></dl>
2343 </dd></dl>
2344 </dd></dl>
2346 !! end
2349 ## The Parsoid team believes the following three test exposes a
2350 ## bug in the PHP parser.  (Parsoid team thinks the PHP parser is
2351 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2352 !! test
2353 Definition Lists: Mixed Lists: Test 1 (php)
2354 !! options
2356 !! input
2357 :;* foo
2358 ::* bar
2359 :; baz
2360 !! result
2361 <dl><dd><dl><dt><ul><li> foo
2362 </li><li> bar
2363 </li></ul>
2364 </dt></dl>
2365 <dl><dt> baz
2366 </dt></dl>
2367 </dd></dl>
2369 !! end
2370 !! test
2371 Definition Lists: Mixed Lists: Test 1 (parsoid)
2372 !! options
2373 parsoid
2374 !! input
2375 :;* foo
2376 ::* bar
2377 :; baz
2378 !! result
2379 <dl><dd><dl><dt><ul><li> foo
2380 </li></ul></dt><dd><ul><li> bar
2381 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2382 !! end
2384 !! test
2385 Definition Lists: Mixed Lists: Test 2
2386 !! input
2387 *: d1
2388 *: d2
2389 !! result
2390 <ul><li><dl><dd> d1
2391 </dd><dd> d2
2392 </dd></dl>
2393 </li></ul>
2395 !! end
2398 !! test
2399 Definition Lists: Mixed Lists: Test 3
2400 !! input
2401 *::: d1
2402 *::: d2
2403 !! result
2404 <ul><li><dl><dd><dl><dd><dl><dd> d1
2405 </dd><dd> d2
2406 </dd></dl>
2407 </dd></dl>
2408 </dd></dl>
2409 </li></ul>
2411 !! end
2414 !! test
2415 Definition Lists: Mixed Lists: Test 4
2416 !! input
2417 *;d1 :d2
2418 *;d3 :d4
2419 !! result
2420 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2421 </dd><dt>d3&#160;</dt><dd>d4
2422 </dd></dl>
2423 </li></ul>
2425 !! end
2428 !! test
2429 Definition Lists: Mixed Lists: Test 5
2430 !! input
2431 *:d1
2432 *:: d2
2433 !! result
2434 <ul><li><dl><dd>d1
2435 <dl><dd> d2
2436 </dd></dl>
2437 </dd></dl>
2438 </li></ul>
2440 !! end
2443 !! test
2444 Definition Lists: Mixed Lists: Test 6
2445 !! input
2446 #*:d1
2447 #*::: d3
2448 !! result
2449 <ol><li><ul><li><dl><dd>d1
2450 <dl><dd><dl><dd> d3
2451 </dd></dl>
2452 </dd></dl>
2453 </dd></dl>
2454 </li></ul>
2455 </li></ol>
2457 !! end
2460 !! test
2461 Definition Lists: Mixed Lists: Test 7
2462 !! input
2463 :* d1
2464 :* d2
2465 !! result
2466 <dl><dd><ul><li> d1
2467 </li><li> d2
2468 </li></ul>
2469 </dd></dl>
2471 !! end
2474 !! test
2475 Definition Lists: Mixed Lists: Test 8
2476 !! input
2477 :* d1
2478 ::* d2
2479 !! result
2480 <dl><dd><ul><li> d1
2481 </li></ul>
2482 <dl><dd><ul><li> d2
2483 </li></ul>
2484 </dd></dl>
2485 </dd></dl>
2487 !! end
2490 !! test
2491 Definition Lists: Mixed Lists: Test 9
2492 !! input
2493 *;foo :bar
2494 !! result
2495 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2496 </dd></dl>
2497 </li></ul>
2499 !! end
2502 !! test
2503 Definition Lists: Mixed Lists: Test 10
2504 !! input
2505 *#;foo :bar
2506 !! result
2507 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2508 </dd></dl>
2509 </li></ol>
2510 </li></ul>
2512 !! end
2514 # The Parsoid team disagrees with the PHP parser's seemingly-random
2515 # rules regarding dd/dt on the next two tests.  Parsoid is more
2516 # consistent, and recognizes the shared nesting and keeps the
2517 # still-open tags around until the nesting is complete.
2519 !! test
2520 Definition Lists: Mixed Lists: Test 11 (php)
2521 !! options
2523 !! input
2524 *#*#;*;;foo :bar
2525 *#*#;boo :baz
2526 !! result
2527 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2528 </dt></dl>
2529 </dd></dl>
2530 </li></ul>
2531 </dd></dl>
2532 <dl><dt>boo&#160;</dt><dd>baz
2533 </dd></dl>
2534 </li></ol>
2535 </li></ul>
2536 </li></ol>
2537 </li></ul>
2539 !! end
2540 !! test
2541 Definition Lists: Mixed Lists: Test 11 (parsoid)
2542 !! options
2543 parsoid
2544 !! input
2545 *#*#;*;;foo :bar
2546 *#*#;boo :baz
2547 !! result
2548 <ul>
2549 <li>
2550 <ol>
2551 <li>
2552 <ul>
2553 <li>
2554 <ol>
2555 <li>
2556 <dl>
2557 <dt>
2558 <ul>
2559 <li>
2560 <dl>
2561 <dt>
2562 <dl>
2563 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2564 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2565 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2566 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2567 !! end
2570 !! test
2571 Definition Lists: Weird Ones: Test 1 (php)
2572 !! options
2574 !! input
2575 *#;*::;; foo : bar (who uses this?)
2576 !! result
2577 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2578 </dt></dl>
2579 </dd></dl>
2580 </dd></dl>
2581 </dd></dl>
2582 </li></ul>
2583 </dd></dl>
2584 </li></ol>
2585 </li></ul>
2587 !! end
2588 !! test
2589 Definition Lists: Weird Ones: Test 1 (parsoid)
2590 !! options
2591 parsoid
2592 !! input
2593 *#;*::;; foo : bar (who uses this?)
2594 !! result
2595 <ul>
2596 <li>
2597 <ol>
2598 <li>
2599 <dl>
2600 <dt>
2601 <ul>
2602 <li>
2603 <dl>
2604 <dd>
2605 <dl>
2606 <dd>
2607 <dl>
2608 <dt>
2609 <dl>
2610 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2611 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd></dl></dt></dl></dd></dl></dd></dl></li></ul></dt></dl></li></ol></li></ul>
2612 !! end
2615 ### External links
2617 !! test
2618 External links: non-bracketed
2619 !! input
2620 Non-bracketed: http://example.com
2621 !! result
2622 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2623 </p>
2624 !! end
2626 !! test
2627 External links: numbered
2628 !! input
2629 Numbered: [http://example.com]
2630 Numbered: [http://example.net]
2631 Numbered: [http://example.com]
2632 !! result
2633 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2634 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2635 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2636 </p>
2637 !!end
2639 !! test
2640 External links: specified text
2641 !! input
2642 Specified text: [http://example.com link]
2643 !! result
2644 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2645 </p>
2646 !!end
2648 !! test
2649 External links: trail
2650 !! input
2651 Linktrails should not work for external links: [http://example.com link]s
2652 !! result
2653 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2654 </p>
2655 !! end
2657 !! test
2658 External links: dollar sign in URL
2659 !! input
2660 http://example.com/1$2345
2661 !! result
2662 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2663 </p>
2664 !! end
2666 !! test
2667 External links: dollar sign in URL (named)
2668 !! input
2669 [http://example.com/1$2345]
2670 !! result
2671 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2672 </p>
2673 !!end
2675 !! test
2676 External links: open square bracket forbidden in URL (bug 4377)
2677 !! input
2678 http://example.com/1[2345
2679 !! result
2680 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2681 </p>
2682 !! end
2684 !! test
2685 External links: open square bracket forbidden in URL (named) (bug 4377)
2686 !! input
2687 [http://example.com/1[2345]
2688 !! result
2689 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2690 </p>
2691 !!end
2693 !! test
2694 External links: nowiki in URL link text (bug 6230)
2695 !!input
2696 [http://example.com/ <nowiki>''example site''</nowiki>]
2697 !! result
2698 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2699 </p>
2700 !! end
2702 !! test
2703 External links: newline forbidden in text (bug 6230 regression check)
2704 !! input
2705 [http://example.com/ first
2706 second]
2707 !! result
2708 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2709 second]
2710 </p>
2711 !!end
2713 !! test
2714 External links: Pipe char between url and text
2715 !! input
2716 [http://example.com | link]
2717 !! result
2718 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2719 </p>
2720 !!end
2722 !! test
2723 External links: protocol-relative URL in brackets
2724 !! input
2725 [//example.com/ Test]
2726 !! result
2727 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2728 </p>
2729 !! end
2731 !! test
2732 External links: protocol-relative URL in brackets without text
2733 !! input
2734 [//example.com]
2735 !! result
2736 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2737 </p>
2738 !! end
2740 !! test
2741 External links: protocol-relative URL in free text is left alone
2742 !! input
2743 //example.com/Foo
2744 !! result
2745 <p>//example.com/Foo
2746 </p>
2747 !!end
2749 !! test
2750 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2751 !! input
2752 foo//example.com/Foo
2753 !! result
2754 <p>foo//example.com/Foo
2755 </p>
2756 !! end
2758 !! test
2759 External image
2760 !! input
2761 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2762 !! result
2763 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2764 </p>
2765 !! end
2767 !! test
2768 External image from https
2769 !! input
2770 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2771 !! result
2772 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2773 </p>
2774 !! end
2776 !! test
2777 External image (when not allowed)
2778 !! options
2779 wgAllowExternalImages=0
2780 !! input
2781 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2782 !! result
2783 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
2784 </p>
2785 !! end
2787 !! test
2788 Link to non-http image, no img tag
2789 !! input
2790 Link to non-http image, no img tag: ftp://example.com/test.jpg
2791 !! result
2792 <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>
2793 </p>
2794 !! end
2796 !! test
2797 External links: terminating separator
2798 !! input
2799 Terminating separator: http://example.com/thing,
2800 !! result
2801 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2802 </p>
2803 !! end
2805 !! test
2806 External links: intervening separator
2807 !! input
2808 Intervening separator: http://example.com/1,2,3
2809 !! result
2810 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2811 </p>
2812 !! end
2814 !! test
2815 External links: old bug with URL in query
2816 !! input
2817 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2818 !! result
2819 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2820 </p>
2821 !! end
2823 !! test
2824 External links: old URL-in-URL bug, mixed protocols
2825 !! input
2826 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2827 !! result
2828 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2829 </p>
2830 !!end
2832 !! test
2833 External links: URL in text
2834 !! input
2835 URL in text: [http://example.com http://example.com]
2836 !! result
2837 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2838 </p>
2839 !! end
2841 !! test
2842 External links: Clickable images
2843 !! input
2844 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2845 !! result
2846 <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>
2847 </p>
2848 !!end
2850 !! test
2851 External links: raw ampersand
2852 !! input
2853 Old &amp; use: http://x&y
2854 !! result
2855 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2856 </p>
2857 !! end
2859 !! test
2860 External links: encoded ampersand
2861 !! input
2862 Old &amp; use: http://x&amp;y
2863 !! result
2864 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2865 </p>
2866 !! end
2868 !! test
2869 External links: encoded equals (bug 6102)
2870 !! input
2871 http://example.com/?foo&#61;bar
2872 !! result
2873 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2874 </p>
2875 !! end
2877 !! test
2878 External links: [raw ampersand]
2879 !! input
2880 Old &amp; use: [http://x&y]
2881 !! result
2882 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2883 </p>
2884 !! end
2886 !! test
2887 External links: [encoded ampersand]
2888 !! input
2889 Old &amp; use: [http://x&amp;y]
2890 !! result
2891 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2892 </p>
2893 !! end
2895 !! test
2896 External links: [encoded equals] (bug 6102)
2897 !! input
2898 [http://example.com/?foo&#61;bar]
2899 !! result
2900 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2901 </p>
2902 !! end
2904 !! test
2905 External links: [IDN ignored character reference in hostname; strip it right off]
2906 !! input
2907 [http://e&zwnj;xample.com/]
2908 !! result
2909 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2910 </p>
2911 !! end
2913 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2914 # Where an external link could easily circumvent the sanitization of the text of
2915 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2916 # test demands a higher standard. That's a bit strange.
2918 # Example:
2920 # http://e‌xample.com -> [http://example.com|http://example.com]
2921 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2923 # The first example is sanitized, but the second is not. Any security benefits
2924 # from this production are trivial to circumvent. Either remove this test and
2925 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2926 # the test accordingly.
2928 # All our love,
2929 # The Parsoid team.
2930 !! test
2931 External links: IDN ignored character reference in hostname; strip it right off
2932 !! input
2933 http://e&zwnj;xample.com/
2934 !! result
2935 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2936 </p>
2937 !! end
2939 !! test
2940 External links: www.jpeg.org (bug 554)
2941 !! input
2942 http://www.jpeg.org
2943 !!result
2944 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2945 </p>
2946 !! end
2948 !! test
2949 External links: URL within URL (original bug 2)
2950 !! input
2951 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2952 !! result
2953 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2954 </p>
2955 !! end
2957 !! test
2958 BUG 361: URL inside bracketed URL
2959 !! input
2960 [http://www.example.com/foo http://www.example.com/bar]
2961 !! result
2962 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2963 </p>
2964 !! end
2966 !! test
2967 BUG 361: URL within URL, not bracketed
2968 !! input
2969 http://www.example.com/foo?=http://www.example.com/bar
2970 !! result
2971 <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>
2972 </p>
2973 !! end
2975 !! test
2976 BUG 289: ">"-token in URL-tail
2977 !! input
2978 http://www.example.com/<hello>
2979 !! result
2980 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2981 </p>
2982 !!end
2984 !! test
2985 BUG 289: literal ">"-token in URL-tail
2986 !! input
2987 http://www.example.com/<b>html</b>
2988 !! result
2989 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2990 </p>
2991 !!end
2993 !! test
2994 BUG 289: ">"-token in bracketed URL
2995 !! input
2996 [http://www.example.com/<hello> stuff]
2997 !! result
2998 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2999 </p>
3000 !!end
3002 !! test
3003 BUG 289: literal ">"-token in bracketed URL
3004 !! input
3005 [http://www.example.com/<b>html</b> stuff]
3006 !! result
3007 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3008 </p>
3009 !!end
3011 !! test
3012 BUG 289: literal double quote at end of URL
3013 !! input
3014 http://www.example.com/"hello"
3015 !! result
3016 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3017 </p>
3018 !!end
3020 !! test
3021 BUG 289: literal double quote in bracketed URL
3022 !! input
3023 [http://www.example.com/"hello" stuff]
3024 !! result
3025 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3026 </p>
3027 !!end
3029 !! test
3030 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3031 !! input
3032 [http://www.example.com  test]
3033 !! result
3034 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3035 </p>
3036 !! end
3038 !! test
3039 External links: link text with spaces
3040 !! input
3041 [http://www.example.com a b c]
3042 [http://www.example.com ''a'' ''b'']
3043 !! result
3044 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3045 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3046 </p>
3047 !! end
3049 !! test
3050 External links: wiki links within external link (Bug 3695)
3051 !! input
3052 [http://example.com [[wikilink]] embedded in ext link]
3053 !! result
3054 <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>
3055 </p>
3056 !! end
3058 !! test
3059 BUG 787: Links with one slash after the url protocol are invalid
3060 !! input
3061 http:/example.com
3063 [http:/example.com title]
3064 !! result
3065 <p>http:/example.com
3066 </p><p>[http:/example.com title]
3067 </p>
3068 !! end
3070 !! test
3071 Bracketed external links with template-generated invalid target
3072 !! input
3073 [{{echo|http:/example.com}} title]
3074 !! result
3075 <p>[http:/example.com title]
3076 </p>
3077 !! end
3079 !! test
3080 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3081 !! input
3082 ''[http://example.com text'']
3083 [http://example.com '''text]'''
3084 ''Something [http://example.com in italic'']
3085 ''Something [http://example.com mixed''''', even bold]'''
3086 '''''Now [http://example.com both''''']
3087 !! result
3088 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3089 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3090 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3091 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3092 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3093 </p>
3094 !! end
3097 !! test
3098 Bug 4781: %26 in URL
3099 !! input
3100 http://www.example.com/?title=AT%26T
3101 !! result
3102 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3103 </p>
3104 !! end
3106 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3107 # % is actually legal in HTML5. Any change in output would need testing though.
3108 !! test
3109 Bug 4781, 5267: %25 in URL
3110 !! input
3111 http://www.example.com/?title=100%25_Bran
3112 !! result
3113 <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>
3114 </p>
3115 !! end
3117 !! test
3118 Bug 4781, 5267: %28, %29 in URL
3119 !! input
3120 http://www.example.com/?title=Ben-Hur_%281959_film%29
3121 !! result
3122 <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>
3123 </p>
3124 !! end
3127 !! test
3128 Bug 4781: %26 in autonumber URL
3129 !! input
3130 [http://www.example.com/?title=AT%26T]
3131 !! result
3132 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3133 </p>
3134 !! end
3136 !! test
3137 Bug 4781, 5267: %26 in autonumber URL
3138 !! input
3139 [http://www.example.com/?title=100%25_Bran]
3140 !! result
3141 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3142 </p>
3143 !! end
3145 !! test
3146 Bug 4781, 5267: %28, %29 in autonumber URL
3147 !! input
3148 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3149 !! result
3150 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3151 </p>
3152 !! end
3155 !! test
3156 Bug 4781: %26 in bracketed URL
3157 !! input
3158 [http://www.example.com/?title=AT%26T link]
3159 !! result
3160 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3161 </p>
3162 !! end
3164 !! test
3165 Bug 4781, 5267: %26 in bracketed URL
3166 !! input
3167 [http://www.example.com/?title=100%25_Bran link]
3168 !! result
3169 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3170 </p>
3171 !! end
3173 !! test
3174 Bug 4781, 5267: %28, %29 in bracketed URL
3175 !! input
3176 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3177 !! result
3178 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3179 </p>
3180 !! end
3182 !! test
3183 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3184 !! input
3185 Some [http://example.com/ pretty ''italics'' and stuff]!
3186 !! result
3187 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3188 </p>
3189 !! end
3191 !! test
3192 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3193 !! input
3194 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3195 !! result
3196 <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>
3197 </p>
3198 !! end
3200 !! test
3201 External link containing double-single-quotes with no space separating the url from text in italics
3202 !! input
3203 [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]].]
3204 !! result
3205 <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>
3206 </p>
3207 !! end
3209 !! test
3210 External link with comments in link text
3211 !! input
3212 [http://www.google.com Google <!-- comment -->]
3213 !! result
3214 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3215 </p>
3216 !! end
3218 !! test
3219 URL-encoding in URL functions (single parameter)
3220 !! input
3221 {{localurl:Some page|amp=&}}
3222 !! result
3223 <p>/index.php?title=Some_page&amp;amp=&amp;
3224 </p>
3225 !! end
3227 !! test
3228 URL-encoding in URL functions (multiple parameters)
3229 !! input
3230 {{localurl:Some page|q=?&amp=&}}
3231 !! result
3232 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3233 </p>
3234 !! end
3236 !! test
3237 Brackets in urls
3238 !! input
3239 http://example.com/index.php?foozoid%5B%5D=bar
3241 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3242 !! result
3243 <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>
3244 </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>
3245 </p>
3246 !! end
3248 !! test
3249 IPv6 urls (bug 21261)
3250 !! options
3251 disabled
3252 !! input
3253 http://[2404:130:0:1000::187:2]/index.php
3254 !! result
3255 <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>
3256 </p>
3257 !! end
3259 !! test
3260 Non-extlinks in brackets
3261 !! input
3262 [foo]
3263 [foo bar]
3264 [foo ''bar'']
3265 [fool's] errand
3266 [fool's errand]
3267 [{{echo|foo}}]
3268 [{{echo|foo}} bar]
3269 [{{echo|foo}} ''bar'']
3270 [{{echo|foo}}l's] errand
3271 [{{echo|foo}}l's errand]
3272 [url={{echo|foo}}]
3273 [url=http://example.com]
3274 !! result
3275 <p>[foo]
3276 [foo bar]
3277 [foo <i>bar</i>]
3278 [fool's] errand
3279 [fool's errand]
3280 [foo]
3281 [foo bar]
3282 [foo <i>bar</i>]
3283 [fool's] errand
3284 [fool's errand]
3285 [url=foo]
3286 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3287 </p>
3288 !! end
3290 !! test
3291 Parsoid: Percent encoding in external links
3292 !! options
3293 parsoid
3294 !! input
3295 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3296 !! result
3297 <p><a rel="mw:ExtLink"
3298 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3299 !! end
3301 !! test
3302 Parsoid: use url link syntax for links where the content is equal the link
3303 target
3304 !! options
3305 parsoid
3306 !! input
3307 http://example.com
3308 !! result
3309 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3310 !! end
3313 ### Quotes
3316 !! test
3317 Quotes
3318 !! input
3319 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3321 Normal text. '''''Bold italic text.''''' Normal text.
3322 !!result
3323 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3324 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3325 </p>
3326 !! end
3329 !! test
3330 Unclosed and unmatched quotes (php)
3331 !! options
3333 !! input
3334 '''''Bold italic text '''with bold deactivated''' in between.'''''
3336 '''''Bold italic text ''with italic deactivated'' in between.'''''
3338 '''Bold text..
3340 ..spanning two paragraphs (should not work).'''
3342 '''Bold tag left open
3344 ''Italic tag left open
3346 Normal text.
3348 <!-- Unmatching number of opening, closing tags: -->
3349 '''This year''''s election ''should'' beat '''last year''''s.
3351 ''Tom'''s car is bigger than ''Susan'''s.
3353 Plain ''italic'''s plain
3354 !! result
3355 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3356 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3357 </p><p><b>Bold text..</b>
3358 </p><p>..spanning two paragraphs (should not work).
3359 </p><p><b>Bold tag left open</b>
3360 </p><p><i>Italic tag left open</i>
3361 </p><p>Normal text.
3362 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3363 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3364 </p><p>Plain <i>italic'</i>s plain
3365 </p>
3366 !! end
3367 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3368 # parser strips. The wikitext contains just the first half of the bold
3369 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3370 # differently than the PHP parser.)
3371 !! test
3372 Unclosed and unmatched quotes (parsoid)
3373 !! options
3374 parsoid
3375 !! input
3376 '''''Bold italic text '''with bold deactivated''' in between.'''''
3378 '''''Bold italic text ''with italic deactivated'' in between.'''''
3380 '''Bold text..
3382 ..spanning two paragraphs (should not work).'''
3384 '''Bold tag left open
3386 ''Italic tag left open
3388 Normal text.
3390 <!-- Unmatching number of opening, closing tags: -->
3391 '''This year''''s election ''should'' beat '''last year''''s.
3393 ''Tom'''s car is bigger than ''Susan'''s.
3395 Plain ''italic'''s plain
3396 !! result
3397 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3398 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3399 </p><p><b>Bold text..</b>
3400 </p><p>..spanning two paragraphs (should not work).<b></b>
3401 </p><p><b>Bold tag left open</b>
3402 </p><p><i>Italic tag left open</i>
3403 </p><p>Normal text.
3404 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3405 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3406 </p><p>Plain <i>italic'</i>s plain
3407 </p>
3408 !! end
3411 ### Tables
3413 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3416 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3417 # is the bare minimum required by the spec, see:
3418 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3419 !! test
3420 A table with no data. (php)
3421 !! options
3423 !! input
3424 {||}
3425 !! result
3426 !! end
3427 # Parsoid team replies: empty table tags are legal in HTML5
3428 !! test
3429 A table with no data. (parsoid)
3430 !! options
3431 parsoid
3432 !! input
3433 {||}
3434 !! result
3435 <table></table>
3436 !! end
3438 # A table with nothing but a caption is invalid XHTML, we might want to render
3439 # this as <p>caption</p>
3440 !! test
3441 A table with nothing but a caption (php)
3442 !! options
3444 !! input
3446 |+ caption
3448 !! result
3449 <table>
3450 <caption> caption
3451 </caption><tr><td></td></tr></table>
3453 !! end
3454 # Parsoid team replies: table with only a caption is legal in HTML5
3455 !! test
3456 A table with nothing but a caption (parsoid)
3457 !! options
3458 parsoid
3459 !! input
3461 |+ caption
3463 !! result
3464 <table><caption> caption</caption></table>
3465 !! end
3467 !! test
3468 A table with caption with default-spaced attributes and a table row
3469 !! input
3471 |+ style="color: red;" | caption1
3473 | foo
3475 !! result
3476 <table>
3477 <caption style="color: red;"> caption1
3478 </caption>
3479 <tr>
3480 <td> foo
3481 </td></tr></table>
3483 !! end
3485 !! test
3486 A table with captions with non-default spaced attributes and a table row
3487 !! input
3489 |+style="color: red;"|caption2
3490 |+ style="color: red;"| caption3
3492 | foo
3494 !! result
3495 <table>
3496 <caption style="color: red;">caption2
3497 </caption>
3498 <caption style="color: red;"> caption3
3499 </caption>
3500 <tr>
3501 <td> foo
3502 </td></tr></table>
3504 !! end
3506 !! test
3507 Table td-cell syntax variations
3508 !! input
3510 | foo bar foo | baz
3511 | foo bar foo || baz
3512 | style='color:red;' | baz
3513 | style='color:red;' || baz
3515 !! result
3516 <table>
3517 <tr>
3518 <td> baz
3519 </td>
3520 <td> foo bar foo </td>
3521 <td> baz
3522 </td>
3523 <td style="color:red;"> baz
3524 </td>
3525 <td> style='color:red;' </td>
3526 <td> baz
3527 </td></tr></table>
3529 !! end
3531 !! test
3532 Simple table
3533 !! input
3535 | 1 || 2
3537 | 3 || 4
3539 !! result
3540 <table>
3541 <tr>
3542 <td> 1 </td>
3543 <td> 2
3544 </td></tr>
3545 <tr>
3546 <td> 3 </td>
3547 <td> 4
3548 </td></tr></table>
3550 !! end
3552 !! test
3553 Simple table but with multiple dashes for row wikitext
3554 !! input
3556 | foo
3557 |-----
3558 | bar
3560 !! result
3561 <table>
3562 <tr>
3563 <td> foo
3564 </td></tr>
3565 <tr>
3566 <td> bar
3567 </td></tr></table>
3569 !! end
3570 !! test
3571 Multiplication table
3572 !! input
3573 {| border="1" cellpadding="2"
3574 |+Multiplication table
3576 ! &times; !! 1 !! 2 !! 3
3578 ! 1
3579 | 1 || 2 || 3
3581 ! 2
3582 | 2 || 4 || 6
3584 ! 3
3585 | 3 || 6 || 9
3587 ! 4
3588 | 4 || 8 || 12
3590 ! 5
3591 | 5 || 10 || 15
3593 !! result
3594 <table border="1" cellpadding="2">
3595 <caption>Multiplication table
3596 </caption>
3597 <tr>
3598 <th> &#215; </th>
3599 <th> 1 </th>
3600 <th> 2 </th>
3601 <th> 3
3602 </th></tr>
3603 <tr>
3604 <th> 1
3605 </th>
3606 <td> 1 </td>
3607 <td> 2 </td>
3608 <td> 3
3609 </td></tr>
3610 <tr>
3611 <th> 2
3612 </th>
3613 <td> 2 </td>
3614 <td> 4 </td>
3615 <td> 6
3616 </td></tr>
3617 <tr>
3618 <th> 3
3619 </th>
3620 <td> 3 </td>
3621 <td> 6 </td>
3622 <td> 9
3623 </td></tr>
3624 <tr>
3625 <th> 4
3626 </th>
3627 <td> 4 </td>
3628 <td> 8 </td>
3629 <td> 12
3630 </td></tr>
3631 <tr>
3632 <th> 5
3633 </th>
3634 <td> 5 </td>
3635 <td> 10 </td>
3636 <td> 15
3637 </td></tr></table>
3639 !! end
3641 !! test
3642 Accept "||" in table headings
3643 !! input
3645 !h1 || h2
3647 !! result
3648 <table>
3649 <tr>
3650 <th>h1 </th>
3651 <th> h2
3652 </th></tr></table>
3654 !! end
3656 !! test
3657 Accept "||" in indented table headings
3658 !! input
3660 !h1 || h2
3662 !! result
3663 <dl><dd><table>
3664 <tr>
3665 <th>h1 </th>
3666 <th> h2
3667 </th></tr></table></dd></dl>
3669 !! end
3671 !! test
3672 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3673 !! input
3675 !| h1
3676 || a
3678 !! result
3679 <table>
3680 <tr>
3681 <th> h1
3682 </th>
3683 <td> a
3684 </td></tr></table>
3686 !! end
3688 !!test
3689 Accept "| !" at start of line in tables (ignore !-attribute)
3690 !!input
3693 | !style="color:red" | bar
3695 !!result
3696 <table>
3698 <tr>
3699 <td> bar
3700 </td></tr></table>
3702 !!end
3704 !!test
3705 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/- 
3706 !!input
3709 |style='color:red;'|+1
3710 |style='color:blue;'|-1
3712 | 1 || 2 || 3
3713 | 1 ||+2 ||-3
3715 | +1
3716 | -1
3718 !!result
3719 <table>
3721 <tr>
3722 <td style="color:red;">+1
3723 </td>
3724 <td style="color:blue;">-1
3725 </td></tr>
3726 <tr>
3727 <td> 1 </td>
3728 <td> 2 </td>
3729 <td> 3
3730 </td>
3731 <td> 1 </td>
3732 <td>+2 </td>
3733 <td>-3
3734 </td></tr>
3735 <tr>
3736 <td> +1
3737 </td>
3738 <td> -1
3739 </td></tr></table>
3741 !!end
3743 !! test
3744 Table rowspan
3745 !! input
3746 {| border=1
3747 | Cell 1, row 1
3748 |rowspan=2| Cell 2, row 1 (and 2)
3749 | Cell 3, row 1
3751 | Cell 1, row 2
3752 | Cell 3, row 2
3754 !! result
3755 <table border="1">
3756 <tr>
3757 <td> Cell 1, row 1
3758 </td>
3759 <td rowspan="2"> Cell 2, row 1 (and 2)
3760 </td>
3761 <td> Cell 3, row 1
3762 </td></tr>
3763 <tr>
3764 <td> Cell 1, row 2
3765 </td>
3766 <td> Cell 3, row 2
3767 </td></tr></table>
3769 !! end
3771 !! test
3772 Nested table
3773 !! input
3774 {| border=1
3775 | &alpha;
3777 {| bgcolor=#ABCDEF border=2
3778 |nested
3780 |table
3782 |the original table again
3784 !! result
3785 <table border="1">
3786 <tr>
3787 <td> &#945;
3788 </td>
3789 <td>
3790 <table bgcolor="#ABCDEF" border="2">
3791 <tr>
3792 <td>nested
3793 </td></tr>
3794 <tr>
3795 <td>table
3796 </td></tr></table>
3797 </td>
3798 <td>the original table again
3799 </td></tr></table>
3801 !! end
3803 !! test
3804 Invalid attributes in table cell (bug 1830)
3805 !! input
3807 |Cell:|broken
3809 !! result
3810 <table>
3811 <tr>
3812 <td>broken
3813 </td></tr></table>
3815 !! end
3818 !! test
3819 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3820 !! input
3822 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3823 !! result
3824 <table>
3825 <tr>
3826 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3827 <td>]" onmouseover="alert(document.cookie)"&gt;test
3828 </td>
3829 </tr>
3830 </table>
3832 !! end
3835 !! test
3836 Indented table markup mixed with indented pre content (proposed in bug 6200)
3837 !! input
3838  <table>
3839  <tr>
3840  <td>
3841  Text that should be rendered preformatted
3842  </td>
3843  </tr>
3844  </table>
3845 !! result
3846  <table>
3847  <tr>
3848  <td>
3849 <pre>Text that should be rendered preformatted
3850 </pre>
3851  </td>
3852  </tr>
3853  </table>
3855 !! end
3857 !! test
3858 Template-generated table cell attributes and cell content
3859 !! input
3861 |{{table_attribs}}
3863 !! result
3864 <table>
3865 <tr>
3866 <td style="color: red"> Foo
3867 </td></tr></table>
3869 !! end
3871 !! test
3872 Template-generated table cell attributes and cell content (2)
3873 !! input
3875 |align=center {{table_attribs}}
3877 !! result
3878 <table>
3879 <tr>
3880 <td align="center" style="color: red"> Foo
3881 </td></tr></table>
3883 !! end
3885 !! test
3886 Template-generated table cell attributes and cell content (3)
3887 !! input
3889 |align=center {{table_cells}}
3891 !! result
3892 <table>
3893 <tr>
3894 <td align="center" style="color: red"> Foo </td>
3895 <td> Bar </td>
3896 <td> Baz
3897 </td></tr></table>
3899 !! end
3901 !! test
3902 Table with row followed by newlines and table heading
3903 !! input
3907 ! foo
3909 !! result
3910 <table>
3913 <tr>
3914 <th> foo
3915 </th></tr></table>
3917 !! end
3919 !! test
3920 Table with empty line following the start tag
3921 !! input
3925 | foo
3927 !! result
3928 <table>
3931 <tr>
3932 <td> foo
3933 </td></tr></table>
3935 !! end
3937 # FIXME: Preserve the attribute properly (with an empty string as value) in
3938 # the PHP parser. Parsoid implements the behavior below.
3939 !! test
3940 Table attributes with empty value
3941 !! options
3942 parsoid
3943 !! input
3945 | style=| hello
3947 !! result
3948 <table>
3949 <tbody>
3950 <tr>
3951 <td style=""> hello
3952 </td></tr></tbody></table>
3954 !! end
3956 !! test
3957 Wikitext table with a lot of comments
3958 !! input
3960 <!-- c0 -->
3961 | foo
3962 <!-- c1 -->
3963 |- <!-- c2 -->
3964 <!-- c3 -->
3965 |<!-- c4 -->
3966 <!-- c5 -->
3968 !! result
3969 <table>
3970 <tr>
3971 <td> foo
3972 </td></tr>
3973 <tr>
3974 <td>
3975 </td></tr></table>
3977 !! end
3979 !! test
3980 Wikitext table with double-line table cell
3981 !! input
3986 !! result
3987 <table>
3988 <tr>
3989 <td>a
3990 <p>b
3991 </p>
3992 </td></tr></table>
3994 !! end
3996 !! test
3997 Table cell with a single comment
3998 !! input
4000 | <!-- c1 -->
4001 | a
4003 !! result
4004 <table>
4005 <tr>
4006 <td>
4007 </td>
4008 <td> a
4009 </td></tr></table>
4011 !! end
4013 # The expected HTML structure in this test is debatable. The PHP parser does
4014 # not parse this kind of table at all. The main focus for Parsoid is on
4015 # round-tripping, so this output is ok for now. TODO: revisit!
4016 !! test
4017 Wikitext table with html-syntax row (Parsoid)
4018 !! options
4019 parsoid
4020 !! input
4023 <td>foo</td>
4025 !! result
4026 <table>
4027 <tbody>
4028 <tr>
4029 <td>foo</td></tr></tbody></table>
4030 !! end
4032 !! test
4033 Implicit <td> after a |-
4034 (PHP parser relies on Tidy to add the missing <td> tags)
4035 !! options
4036 parsoid=wt2html,wt2wt
4037 !! input
4042 !! result
4043 <table>
4044 <tr><td>a</td></tr>
4045 </table>
4046 !! end
4048 !! test
4049 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4050 (PHP parser relies on Tidy to add the missing <td> tags)
4051 !! options
4052 parsoid=wt2html,wt2wt
4053 !! input
4061 !! result
4062 <table>
4063 <tbody>
4064 <tr><td><pre>a</pre></td></tr>
4065 <tr><td> b</td></tr>
4066 </tbody>
4067 </table>
4068 !! end
4070 !! test
4071 Lists should be recognized in an implicit <td> context
4072 (PHP parser relies on Tidy to add the missing <td> tags)
4073 !! options
4074 parsoid=wt2html,wt2wt
4075 !! input
4080 !! result
4081 <table>
4082 <tr>
4083 <td><ul><li>a</li></ul></td>
4084 </tr>
4085 </table>
4086 !! end
4089 ### Internal links
4091 !! test
4092 Plain link, capitalized
4093 !! input
4094 [[Main Page]]
4095 !! result
4096 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4097 </p>
4098 !! end
4100 !! test
4101 Plain link, uncapitalized
4102 !! input
4103 [[main Page]]
4104 !! result
4105 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4106 </p>
4107 !! end
4109 !! test
4110 Piped link
4111 !! input
4112 [[Main Page|The Main Page]]
4113 !! result
4114 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4115 </p>
4116 !! end
4118 !! test
4119 Piped link with comment in link text
4120 !! input
4121 [[Main Page|The Main<!--front--> Page]]
4122 !! result
4123 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4124 </p>
4125 !! end
4127 !! test
4128 Broken link
4129 !! input
4130 [[Zigzagzogzagzig]]
4131 !! result
4132 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4133 </p>
4134 !! end
4136 !! test
4137 Broken link with fragment
4138 !! input
4139 [[Zigzagzogzagzig#zug]]
4140 !! result
4141 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4142 </p>
4143 !! end
4145 !! test
4146 Special page link with fragment
4147 !! input
4148 [[Special:Version#anchor]]
4149 !! result
4150 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4151 </p>
4152 !! end
4154 !! test
4155 Nonexistent special page link with fragment
4156 !! input
4157 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4158 !! result
4159 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4160 </p>
4161 !! end
4163 !! test
4164 Link with prefix
4165 !! input
4166 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4167 !! result
4168 <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>
4169 </p>
4170 !! end
4172 !! test
4173 Link with suffix
4174 !! input
4175 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4176 !! result
4177 <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>!!!
4178 </p>
4179 !! end
4181 !! article
4182 prefixed article
4183 !! text
4184 Some text
4185 !! endarticle
4187 !! test
4188 Bug 43661: Piped links with identical prefixes
4189 !! input
4190 [[prefixed article|prefixed articles with spaces]]
4192 [[prefixed article|prefixed articlesaoeu]]
4194 [[Main Page|Main Page test]]
4195 !! result
4196 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4197 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4198 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4199 </p>
4200 !! end
4203 !! test
4204 Link with HTML entity in suffix / tail
4205 !! input
4206 [[Main Page]]&quot;, [[Main Page]]&#97;
4207 !! result
4208 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
4209 </p>
4210 !! end
4212 !! test
4213 Link with 3 brackets
4214 !! input
4215 [[[main page]]]
4216 !! result
4217 <p>[[[main page]]]
4218 </p>
4219 !! end
4221 !! test
4222 Piped link with 3 brackets
4223 !! input
4224 [[[main page|the main page]]]
4225 !! result
4226 <p>[[[main page|the main page]]]
4227 </p>
4228 !! end
4230 !! test
4231 Link with multiple pipes
4232 !! input
4233 [[Main Page|The|Main|Page]]
4234 !! result
4235 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4236 </p>
4237 !! end
4239 !! test
4240 Link to namespaces
4241 !! input
4242 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4243 !! result
4244 <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>
4245 </p>
4246 !! end
4248 !! test
4249 Piped link to namespace
4250 !! input
4251 [[Meta:Disclaimers|The disclaimers]]
4252 !! result
4253 <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>
4254 </p>
4255 !! end
4257 !! test
4258 Link containing }
4259 !! input
4260 [[Usually caused by a typo (oops}]]
4261 !! result
4262 <p>[[Usually caused by a typo (oops}]]
4263 </p>
4264 !! end
4266 !! test
4267 Link containing % (not as a hex sequence)
4268 !! input
4269 [[7% Solution]]
4270 !! result
4271 <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>
4272 </p>
4273 !! end
4275 !! test
4276 Link containing % as a single hex sequence interpreted to char
4277 !! input
4278 [[7%25 Solution]]
4279 !! result
4280 <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>
4281 </p>
4282 !!end
4284 !! test
4285 Link containing % as a double hex sequence interpreted to hex sequence
4286 !! input
4287 [[7%2525 Solution]]
4288 !! result
4289 <p>[[7%2525 Solution]]
4290 </p>
4291 !!end
4293 !! test
4294 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4295 Example for such a section: == < ==
4296 !! input
4297 [[%23%3c]][[%23%3e]]
4298 !! result
4299 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4300 </p>
4301 !! end
4303 !! test
4304 Link containing "<#" and ">#" as a hex sequences
4305 !! input
4306 [[%3c%23]][[%3e%23]]
4307 !! result
4308 <p>[[%3c%23]][[%3e%23]]
4309 </p>
4310 !! end
4312 !! test
4313 Link containing an equals sign
4314 !! input
4315 [[Special:BookSources/isbn=4-00-026157-6]]
4316 !! result
4317 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
4318 </p>
4319 !! end
4321 !! article
4322 Foo~bar
4323 !! text
4324 Just a test of an article title containing a tilde.
4325 !! endarticle
4327 # note that links containing signatures, like [[Foo~~~~]], are
4328 # massaged by the pre-save transform (PST) and so the tildes are never
4329 # seen by the parser.
4330 !! test
4331 Link containing a tilde
4332 !! input
4333 [[Foo~bar]]
4334 !! result
4335 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4336 </p>
4337 !! end
4339 !! test
4340 Link containing double-single-quotes '' (bug 4598)
4341 !! input
4342 [[Lista d''e paise d''o munno]]
4343 !! result
4344 <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>
4345 </p>
4346 !! end
4348 !! test
4349 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4350 !! input
4351 Some [[Link|pretty ''italics'' and stuff]]!
4352 !! result
4353 <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>!
4354 </p>
4355 !! end
4357 !! test
4358 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4359 !! input
4360 ''Some [[Link|pretty ''italics'' and stuff]]!
4361 !! result
4362 <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>
4363 </p>
4364 !! end
4366 !! test
4367 Link with double quotes in title part (literal) and alternate part (interpreted)
4368 !! input
4369 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4371 [[''Pentecoste'']]
4373 [[''Pentecoste''|Pentecoste]]
4375 [[''Pentecoste''|''Pentecoste'']]
4376 !! result
4377 <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>
4378 </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>
4379 </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>
4380 </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>
4381 </p>
4382 !! end
4384 !! test
4385 Broken image links with HTML captions (bug 39700)
4386 !! input
4387 [[File:Nonexistent|<script></script>]]
4388 [[File:Nonexistent|100px|<script></script>]]
4389 [[File:Nonexistent|&lt;]]
4390 [[File:Nonexistent|a<i>b</i>c]]
4391 !! result
4392 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4393 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4394 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4395 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4396 </p>
4397 !! end
4399 !! test
4400 Plain link to URL
4401 !! input
4402 [[http://www.example.com]]
4403 !! result
4404 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4405 </p>
4406 !! end
4408 !! test
4409 Plain link to URL with link text
4410 !! input
4411 [[http://www.example.com Link text]]
4412 !! result
4413 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4414 </p>
4415 !! end
4417 !! test
4418 Plain link to protocol-relative URL
4419 !! input
4420 [[//www.example.com]]
4421 !! result
4422 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4423 </p>
4424 !! end
4426 !! test
4427 Plain link to protocol-relative URL with link text
4428 !! input
4429 [[//www.example.com Link text]]
4430 !! result
4431 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4432 </p>
4433 !! end
4435 !! test
4436 Plain link to page with question mark in title
4437 !! input
4438 [[A?b]]
4440 [[A?b|Baz]]
4441 !! result
4442 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4443 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4444 </p>
4445 !! end
4448 # I'm fairly sure the expected result here is wrong.
4449 # We want these to be URL links, not pseudo-pages with URLs for titles....
4450 # However the current output is also pretty screwy.
4452 # ----
4453 # I'm changing it to match the current output--it arguably makes more
4454 # sense in the light of the test above. Old expected result was:
4455 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4456 #</p>
4457 # But I think this test is bordering on "garbage in, garbage out" anyway.
4458 # -- wtm
4459 !! test
4460 Piped link to URL
4461 !! input
4462 Piped link to URL: [[http://www.example.com|an example URL]]
4463 !! result
4464 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4465 </p>
4466 !! end
4468 !! test
4469 BUG 2: [[page|http://url/]] should link to page, not http://url/
4470 !! input
4471 [[Main Page|http://url/]]
4472 !! result
4473 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4474 </p>
4475 !! end
4477 !! test
4478 BUG 337: Escaped self-links should be bold
4479 !! options
4480 title=[[Bug462]]
4481 !! input
4482 [[Bu&#103;462]] [[Bug462]]
4483 !! result
4484 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4485 </p>
4486 !! end
4488 !! test
4489 Self-link to section should not be bold
4490 !! options
4491 title=[[Main Page]]
4492 !! input
4493 [[Main Page#section]]
4494 !! result
4495 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4496 </p>
4497 !! end
4499 !! article
4501 !! text
4502 This is 00.
4503 !! endarticle
4505 !!test
4506 Self-link to numeric title
4507 !!options
4508 title=[[0]]
4509 !!input
4510 [[0]]
4511 !!result
4512 <p><strong class="selflink">0</strong>
4513 </p>
4514 !!end
4516 !!test
4517 Link to numeric-equivalent title
4518 !!options
4519 title=[[0]]
4520 !!input
4521 [[00]]
4522 !!result
4523 <p><a href="/wiki/00" title="00">00</a>
4524 </p>
4525 !!end
4527 !! test
4528 <nowiki> inside a link
4529 !! input
4530 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4531 !! result
4532 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4533 </p>
4534 !! end
4536 !! test
4537 Non-breaking spaces in title
4538 !! input
4539 [[&nbsp; Main &nbsp; Page &nbsp;]]
4540 !! result
4541 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4542 </p>
4543 !!end
4545 !! test
4546 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4547 !! options
4548 language=ca
4549 !! input
4550 '''[[Main Page]]'''
4551 !! result
4552 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4553 </p>
4554 !! end
4556 !! test
4557 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4558 !! options
4559 language=ca
4560 !! input
4561 ''[[Main Page]]''
4562 !! result
4563 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4564 </p>
4565 !! end
4567 !! test
4568 Internal link with en linktrail: no apostrophes (bug 27473)
4569 !! options
4570 language=en
4571 !! input
4572 [[Something]]'nice
4573 !! result
4574 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4575 </p>
4576 !! end
4578 !! test
4579 Internal link with ca linktrail with apostrophes (bug 27473)
4580 !! options
4581 language=ca
4582 !! input
4583 [[Something]]'nice
4584 !! result
4585 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4586 </p>
4587 !! end
4589 !! test
4590 Internal link with kaa linktrail with apostrophes (bug 27473)
4591 !! options
4592 language=kaa
4593 !! input
4594 [[Something]]'nice
4595 !! result
4596 <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>
4597 </p>
4598 !! end
4600 !! article
4601 Söfnuður
4602 !! text
4603 Test.
4604 !! endarticle
4606 !! test
4607 Internal link with is link prefix
4608 !! options
4609 language=is
4610 !! input
4611 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4612 !! result
4613 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4614 </p>
4615 !! end
4617 !! article
4618 Mótmælendatrú
4619 !! text
4620 Test.
4621 !! endarticle
4623 !! test
4624 Internal link with is link trail and link prefix
4625 !! options
4626 language=is
4627 !! input
4628 [[mótmælendatrú|xxx]]ar
4629 [[mótmælendatrú]]ar
4630 mótmælenda[[söfnuður]]
4631 mótmælenda[[söfnuður|söfnuðir]]
4632 mótmælenda[[söfnuður|söfnuðir]]xxx
4633 !! result
4634 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4635 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4636 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4637 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4638 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4639 </p>
4640 !! end
4642 !! test
4643 Parsoid link trail escaping
4644 !! options
4645 parsoid=html2wt,html2html
4646 !! input
4647 [[apple]]<nowiki/>s
4648 !! result
4649 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4650 !! end
4652 !! test
4653 Parsoid link prefix escaping
4654 !! options
4655 language=is
4656 parsoid=html2wt,html2html
4657 !! input
4658 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4659 !! result
4660 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4661 !! end
4663 !! test
4664 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4665 !! input
4666 [[Foo|  bar]]
4668 [[Foo|  ''bar'']]
4670 [http://wp.org   foo]
4672 [http://wp.org   ''foo'']
4673 !! result
4674 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">  bar</a>
4675 </p><p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">  <i>bar</i></a>
4676 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4677 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4678 </p>
4679 !! end
4682 ### Interwiki links (see maintenance/interwiki.sql)
4685 !! test
4686 Inline interwiki link
4687 !! input
4688 [[MeatBall:SoftSecurity]]
4689 !! result
4690 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4691 </p>
4692 !! end
4694 !! test
4695 Inline interwiki link with empty title (bug 2372)
4696 !! input
4697 [[MeatBall:]]
4698 !! result
4699 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4700 </p>
4701 !! end
4703 !! test
4704 Interwiki link encoding conversion (bug 1636)
4705 !! input
4706 *[[Wikipedia:ro:Olteni&#0355;a]]
4707 *[[Wikipedia:ro:Olteni&#355;a]]
4708 !! result
4709 <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>
4710 </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>
4711 </li></ul>
4713 !! end
4715 !! test
4716 Interwiki link with fragment (bug 2130)
4717 !! input
4718 [[MeatBall:SoftSecurity#foo]]
4719 !! result
4720 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4721 </p>
4722 !! end
4724 !! test
4725 Interlanguage link
4726 !! input
4727 Blah blah blah
4728 [[zh:Chinese]]
4729 !!result
4730 <p>Blah blah blah
4731 </p>
4732 !! end
4734 !! test
4735 Double interlanguage link
4736 !! input
4737 Blah blah blah
4738 [[es:Spanish]]
4739 [[zh:Chinese]]
4740 !!result
4741 <p>Blah blah blah
4742 </p>
4743 !! end
4745 !! test
4746 Interlanguage link, with prefix links
4747 !! options
4748 language=ln
4749 !! input
4750 Blah blah blah
4751 [[zh:Chinese]]
4752 !!result
4753 <p>Blah blah blah
4754 </p>
4755 !! end
4757 !! test
4758 Double interlanguage link, with prefix links (bug 8897)
4759 !! options
4760 language=ln
4761 !! input
4762 Blah blah blah
4763 [[es:Spanish]]
4764 [[zh:Chinese]]
4765 !!result
4766 <p>Blah blah blah
4767 </p>
4768 !! end
4770 !! test
4771 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4772 !! options
4773 language=ln
4774 !! input
4775 [[WW&nbsp;II]]
4776 !!result
4777 <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>
4778 </p>
4779 !! end
4781 !! test
4782 Parsoid: handle constructor well
4783 !! options
4784 parsoid
4785 !! input
4786 [[constructor]]
4788 [[constructor:foo]]
4789 !! result
4790 <p data-parsoid="{&quot;dsr&quot;:[0,15,0,0]}"><a rel="mw:WikiLink" href="./Constructor" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Constructor&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor&quot;},&quot;dsr&quot;:[0,15,2,2]}">constructor</a></p>
4793 <p data-parsoid="{&quot;dsr&quot;:[17,36,0,0]}"><a rel="mw:WikiLink" href="./Foo" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Foo&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor:foo&quot;},&quot;dsr&quot;:[17,36,2,2]}">constructor:foo</a></p>
4794 !! end
4797 ## Redirects, Parsoid-only
4799 !! test
4800 Simple redirect to page
4801 !! options
4802 parsoid
4803 !! input
4804 #REDIRECT [[Main Page]]
4805 !! result
4806 <link rel="mw:PageProp/redirect" href="./Main_Page">
4807 !! end
4809 !! test
4810 Redirect to category
4811 !! options
4812 parsoid=wt2html
4813 !! input
4814 #REDIRECT [[Category:Foo]]
4815 !! result
4816 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
4817 !! end
4819 !! test
4820 Redirect to category page
4821 !! options
4822 parsoid=wt2html,html2html
4823 !! input
4824 #REDIRECT [[:Category:Foo]]
4825 !! result
4826 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
4827 !! end
4829 !! test
4830 Redirect to image page
4831 !! options
4832 parsoid
4833 !! input
4834 #REDIRECT [[File:Wiki.png]]
4835 !! result
4836 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
4837 !! end
4839 !! test
4840 Redirect to language
4841 !! options
4842 parsoid
4843 !! input
4844 #REDIRECT [[en:File:Wiki.png]]
4845 !! result
4846 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4847 !! end
4849 !! test
4850 Redirect to interwiki
4851 !! options
4852 parsoid
4853 !! input
4854 #REDIRECT [[meatball:File:Wiki.png]]
4855 !! result
4856 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4857 !! end
4860 ## XHTML tidiness
4863 !! test
4864 <br> to <br />
4865 !! input
4866 1<br>2<br />3
4867 !! result
4868 <p>1<br />2<br />3
4869 </p>
4870 !! end
4872 !! test
4873 Broken br tag sanitization
4874 !! options
4876 !! input
4877 </br>
4878 !! result
4879 <p>&lt;/br&gt;
4880 </p>
4881 !! end
4883 # TODO: Fix html2html mode (bug 51055)!
4884 !! test
4885 Parsoid: Broken br tag recognition
4886 !! options
4887 parsoid=wt2html
4888 !! input
4889 </br>
4890 !! result
4891 <p><br></p>
4892 !! end
4894 !! test
4895 Incorrecly removing closing slashes from correctly formed XHTML
4896 !! input
4897 <br style="clear:both;" />
4898 !! result
4899 <p><br style="clear:both;" />
4900 </p>
4901 !! end
4903 !! test
4904 Failing to transform badly formed HTML into correct XHTML
4905 !! input
4906 <br style="clear: left;">
4907 <br style="clear: right;">
4908 <br style="clear: both;">
4909 !! result
4910 <p><br style="clear: left;" />
4911 <br style="clear: right;" />
4912 <br style="clear: both;" />
4913 </p>
4914 !!end
4916 !! test
4917 Handling html with a div self-closing tag
4918 !! input
4919 <div title />
4920 <div title/>
4921 <div title/ >
4922 <div title=bar />
4923 <div title=bar/>
4924 <div title=bar/ >
4925 !! result
4926 <p>&lt;div title /&gt;
4927 &lt;div title/&gt;
4928 </p>
4929 <div>
4930 <p>&lt;div title=bar /&gt;
4931 &lt;div title=bar/&gt;
4932 </p>
4933 <div title="bar/"></div>
4934 </div>
4936 !! end
4938 !! test
4939 Handling html with a br self-closing tag
4940 !! input
4941 <br title />
4942 <br title/>
4943 <br title/ >
4944 <br title=bar />
4945 <br title=bar/>
4946 <br title=bar/ >
4947 !! result
4948 <p><br title="title" />
4949 <br title="title" />
4950 <br />
4951 <br title="bar" />
4952 <br title="bar" />
4953 <br title="bar/" />
4954 </p>
4955 !! end
4957 !! test
4958 Horizontal ruler (should it add that extra space?)
4959 !! input
4960 <hr>
4961 <hr >
4962 foo <hr
4963 > bar
4964 !! result
4965 <hr />
4966 <hr />
4967 foo <hr /> bar
4969 !! end
4971 !! test
4972 Horizontal ruler -- 4+ dashes render hr
4973 !! input
4974 ----
4975 !! result
4976 <hr />
4978 !! end
4980 !! test
4981 Horizontal ruler -- eats additional dashes on the same line
4982 !! input
4983 ---------
4984 !! result
4985 <hr />
4987 !! end
4989 !! test
4990 Horizontal ruler -- does not collapse dashes on consecutive lines
4991 !! input
4992 ----
4993 ----
4994 !! result
4995 <hr />
4996 <hr />
4998 !! end
5000 !! test
5001 Horizontal ruler -- <4 dashes render as plain text
5002 !! input
5004 !! result
5005 <p>---
5006 </p>
5007 !! end
5009 !! test
5010 Horizontal ruler -- Supports content following dashes on same line
5011 !! input
5012 ---- Foo
5013 !! result
5014 <hr /> Foo
5016 !! end
5019 ### Block-level elements
5021 !! test
5022 Common list
5023 !! input
5024 *Common list
5025 * item 2
5026 *item 3
5027 !! result
5028 <ul><li>Common list
5029 </li><li> item 2
5030 </li><li>item 3
5031 </li></ul>
5033 !! end
5035 !! test
5036 Numbered list
5037 !! input
5038 #Numbered list
5039 #item 2
5040 # item 3
5041 !! result
5042 <ol><li>Numbered list
5043 </li><li>item 2
5044 </li><li> item 3
5045 </li></ol>
5047 !! end
5049 !! test
5050 Mixed list
5051 !! input
5052 *Mixed list
5053 *# with numbers
5054 ** and bullets
5055 *# and numbers
5056 *bullets again
5057 **bullet level 2
5058 ***bullet level 3
5059 ***#Number on level 4
5060 **bullet level 2
5061 **#Number on level 3
5062 **#Number on level 3
5063 *#number level 2
5064 *Level 1
5065 *** Level 3
5066 #** Level 3, but ordered
5067 !! result
5068 <ul><li>Mixed list
5069 <ol><li> with numbers
5070 </li></ol>
5071 <ul><li> and bullets
5072 </li></ul>
5073 <ol><li> and numbers
5074 </li></ol>
5075 </li><li>bullets again
5076 <ul><li>bullet level 2
5077 <ul><li>bullet level 3
5078 <ol><li>Number on level 4
5079 </li></ol>
5080 </li></ul>
5081 </li><li>bullet level 2
5082 <ol><li>Number on level 3
5083 </li><li>Number on level 3
5084 </li></ol>
5085 </li></ul>
5086 <ol><li>number level 2
5087 </li></ol>
5088 </li><li>Level 1
5089 <ul><li><ul><li> Level 3
5090 </li></ul>
5091 </li></ul>
5092 </li></ul>
5093 <ol><li><ul><li><ul><li> Level 3, but ordered
5094 </li></ul>
5095 </li></ul>
5096 </li></ol>
5098 !! end
5100 !! test
5101 Nested lists 1
5102 !! input
5103 *foo
5104 **bar
5105 !! result
5106 <ul><li>foo
5107 <ul><li>bar
5108 </li></ul>
5109 </li></ul>
5111 !! end
5113 !! test
5114 Nested lists 2
5115 !! input
5116 **foo
5117 *bar
5118 !! result
5119 <ul><li><ul><li>foo
5120 </li></ul>
5121 </li><li>bar
5122 </li></ul>
5124 !! end
5126 !! test
5127 Nested lists 3 (first element empty)
5128 !! input
5130 **bar
5131 !! result
5132 <ul><li>
5133 <ul><li>bar
5134 </li></ul>
5135 </li></ul>
5137 !! end
5139 !! test
5140 Nested lists 4 (first element empty)
5141 !! input
5143 *bar
5144 !! result
5145 <ul><li><ul><li>
5146 </li></ul>
5147 </li><li>bar
5148 </li></ul>
5150 !! end
5152 !! test
5153 Nested lists 5 (both elements empty)
5154 !! input
5157 !! result
5158 <ul><li><ul><li>
5159 </li></ul>
5160 </li><li>
5161 </li></ul>
5163 !! end
5165 !! test
5166 Nested lists 6 (both elements empty)
5167 !! input
5170 !! result
5171 <ul><li>
5172 <ul><li>
5173 </li></ul>
5174 </li></ul>
5176 !! end
5178 !! test
5179 Nested lists 7 (skip initial nesting levels)
5180 !! input
5181 *** foo
5182 !! result
5183 <ul><li><ul><li><ul><li> foo
5184 </li></ul>
5185 </li></ul>
5186 </li></ul>
5188 !! end
5190 !! test
5191 Nested lists 8 (multiple nesting transitions)
5192 !! input
5193 * foo
5194 *** bar
5195 ** baz
5196 * boo
5197 !! result
5198 <ul><li> foo
5199 <ul><li><ul><li> bar
5200 </li></ul>
5201 </li><li> baz
5202 </li></ul>
5203 </li><li> boo
5204 </li></ul>
5206 !! end
5208 !! test
5209 1. Lists with start-of-line-transparent tokens before bullets: Comments
5210 !! input
5211 *foo
5212 *<!--cmt-->bar
5213 <!--cmt-->*baz
5214 !! result
5215 <ul><li>foo
5216 </li><li>bar
5217 </li><li>baz
5218 </li></ul>
5220 !! end
5222 !! test
5223 2. Lists with start-of-line-transparent tokens before bullets: Template close
5224 !! input
5225 *foo {{echo|bar
5226 }}*baz
5227 !! result
5228 <ul><li>foo bar
5229 </li><li>baz
5230 </li></ul>
5232 !! end
5234 !! test
5235 List items are not parsed correctly following a <pre> block (bug 785)
5236 !! input
5237 * <pre>foo</pre>
5238 * <pre>bar</pre>
5239 * zar
5240 !! result
5241 <ul><li> <pre>foo</pre>
5242 </li><li> <pre>bar</pre>
5243 </li><li> zar
5244 </li></ul>
5246 !! end
5248 !! test
5249 List items from template
5250 !! input
5252 {{inner list}}
5253 * item 2
5255 * item 0
5256 {{inner list}}
5257 * item 2
5259 * item 0
5260 * notSOL{{inner list}}
5261 * item 2
5262 !! result
5263 <ul><li> item 1
5264 </li><li> item 2
5265 </li></ul>
5266 <ul><li> item 0
5267 </li><li> item 1
5268 </li><li> item 2
5269 </li></ul>
5270 <ul><li> item 0
5271 </li><li> notSOL
5272 </li><li> item 1
5273 </li><li> item 2
5274 </li></ul>
5276 !! end
5278 !! test
5279 List interrupted by empty line or heading
5280 !! input
5281 * foo
5283 ** bar
5284 == A heading ==
5285 * Another list item
5286 !! result
5287 <ul><li> foo
5288 </li></ul>
5289 <ul><li><ul><li> bar
5290 </li></ul>
5291 </li></ul>
5292 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
5293 <ul><li> Another list item
5294 </li></ul>
5296 !!end
5298 !!test
5299 Multiple list tags generated by templates
5300 !!input
5301 {{echo|<li>}}a
5302 {{echo|<li>}}b
5303 {{echo|<li>}}c
5304 !!result
5305 <li>a
5306 <li>b
5307 <li>c</li>
5308 </li>
5309 </li>
5311 !!end
5313 !!test
5314 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
5315 !!input
5317 <!--This line will NOT split the list-->
5319  <!--This line will NOT split the list either-->
5321  <!--foo--> <!--This line with more than 1 comment will split the list-->
5323 !!result
5324 <ul><li>a
5325 </li><li>b
5326 </li><li>c
5327 </li></ul>
5328 <ul><li>d
5329 </li></ul>
5331 !!end
5333 !!test
5334 Test the li-hack
5335 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5336 !!options
5337 parsoid=wt2html,wt2wt
5338 !!input
5339 * foo
5340 * <li>li-hack
5341 * {{echo|<li>templated li-hack}}
5342 * <!--foo--> <li> unsupported li-hack with preceding comments
5344 <ul>
5345 <li><li>not a li-hack
5346 </li>
5347 </ul>
5348 !!result
5349 <ul><li> foo</li>
5350 <li>li-hack</li>
5351 <li about="#mwt1" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>templated li-hack"}}}'>templated li-hack</li>
5352 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5354 <ul>
5355 <li></li><li>not a li-hack
5356 </li>
5357 </ul>
5358 !!end
5360 !! test
5361 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5362 !! options
5363 parsoid
5364 !! input
5365 # foo
5366 ## bar
5367 * foo
5368 ** bar
5369 : foo
5370 :: bar
5371 !! result
5372 <ol><li> foo<ol><li> bar</li></ol></li></ol><ul><li> foo<ul><li> bar</li></ul></li></ul><dl><dd> foo<dl><dd> bar</dd></dl></dd></dl>
5373 !! end
5375 # ------------------------------------------------------------------------
5376 # The next set of tests are about Parsoid's ability to handle badly nested
5377 # tags (parse, minimize scope of fixup, and roundtrip back)
5378 # ------------------------------------------------------------------------
5380 !! test
5381 Unbalanced closing block tags break a list
5382 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5383 !! options
5384 parsoid
5385 !! input
5386 <div>
5387 *a</div><div>
5388 *b</div>
5389 !! result
5390 <div>
5391 <ul><li>a
5392 </li></ul></div><div>
5393 <ul><li>b
5394 </li></ul></div>
5395 !! end
5397 !! test
5398 Unbalanced closing non-block tags don't break a list
5399 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5400 !! options
5401 parsoid
5402 !! input
5403 <span>
5404 *a</span><span>
5405 *b</span>
5406 !! result
5407 <p><span></span>
5408 </p>
5409 <ul><li>a<span></span>
5410 </li><li>b
5411 </li></ul>
5412 !! end
5414 !! test
5415 Unclosed formatting tags that straddle lists are closed and reopened
5416 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5417 !! options
5418 parsoid
5419 !! input
5420 # <s> a
5421 # b </s>
5422 !! result
5423 <ol><li> <s> a </s>
5424 </li><li> <s> b </s>
5425 </li></ol>
5426 !! end
5428 !!test
5429 List embedded in a non-block tag
5430 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5431 !! options
5432 parsoid
5433 !!input
5434 <small>
5435 * foo
5436 </small>
5437 !!result
5438 <p><small></small></p>
5439 <small>
5440 <ul>
5441 <li> foo</li>
5442 </ul>
5443 </small>
5444 <p><small></small></p>
5445 !!end
5448 ### Magic Words
5451 !! test
5452 Magic Word: {{CURRENTDAY}}
5453 !! input
5454 {{CURRENTDAY}}
5455 !! result
5456 <p>1
5457 </p>
5458 !! end
5460 !! test
5461 Magic Word: {{CURRENTDAY2}}
5462 !! input
5463 {{CURRENTDAY2}}
5464 !! result
5465 <p>01
5466 </p>
5467 !! end
5469 !! test
5470 Magic Word: {{CURRENTDAYNAME}}
5471 !! input
5472 {{CURRENTDAYNAME}}
5473 !! result
5474 <p>Thursday
5475 </p>
5476 !! end
5478 !! test
5479 Magic Word: {{CURRENTDOW}}
5480 !! input
5481 {{CURRENTDOW}}
5482 !! result
5483 <p>4
5484 </p>
5485 !! end
5487 !! test
5488 Magic Word: {{CURRENTMONTH}}
5489 !! input
5490 {{CURRENTMONTH}}
5491 !! result
5492 <p>01
5493 </p>
5494 !! end
5496 !! test
5497 Magic Word: {{CURRENTMONTHABBREV}}
5498 !! input
5499 {{CURRENTMONTHABBREV}}
5500 !! result
5501 <p>Jan
5502 </p>
5503 !! end
5505 !! test
5506 Magic Word: {{CURRENTMONTHNAME}}
5507 !! input
5508 {{CURRENTMONTHNAME}}
5509 !! result
5510 <p>January
5511 </p>
5512 !! end
5514 !! test
5515 Magic Word: {{CURRENTMONTHNAMEGEN}}
5516 !! input
5517 {{CURRENTMONTHNAMEGEN}}
5518 !! result
5519 <p>January
5520 </p>
5521 !! end
5523 !! test
5524 Magic Word: {{CURRENTTIME}}
5525 !! input
5526 {{CURRENTTIME}}
5527 !! result
5528 <p>00:02
5529 </p>
5530 !! end
5532 !! test
5533 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5534 !! input
5535 {{CURRENTWEEK}}
5536 !! result
5537 <p>1
5538 </p>
5539 !! end
5541 !! test
5542 Magic Word: {{CURRENTYEAR}}
5543 !! input
5544 {{CURRENTYEAR}}
5545 !! result
5546 <p>1970
5547 </p>
5548 !! end
5550 !! test
5551 Magic Word: {{FULLPAGENAME}}
5552 !! options
5553 title=[[User:Ævar Arnfjörð Bjarmason]]
5554 !! input
5555 {{FULLPAGENAME}}
5556 !! result
5557 <p>User:Ævar Arnfjörð Bjarmason
5558 </p>
5559 !! end
5561 !! test
5562 Magic Word: {{FULLPAGENAMEE}}
5563 !! options
5564 title=[[User:Ævar Arnfjörð Bjarmason]]
5565 !! input
5566 {{FULLPAGENAMEE}}
5567 !! result
5568 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5569 </p>
5570 !! end
5572 !! test
5573 Magic Word: {{NAMESPACE}}
5574 !! options
5575 title=[[User:Ævar Arnfjörð Bjarmason]]
5576 !! input
5577 {{NAMESPACE}}
5578 !! result
5579 <p>User
5580 </p>
5581 !! end
5583 !! test
5584 Magic Word: {{NAMESPACEE}}
5585 !! options
5586 title=[[User:Ævar Arnfjörð Bjarmason]]
5587 !! input
5588 {{NAMESPACEE}}
5589 !! result
5590 <p>User
5591 </p>
5592 !! end
5594 !! test
5595 Magic Word: {{NAMESPACENUMBER}}
5596 !! options
5597 title=[[User:Ævar Arnfjörð Bjarmason]]
5598 !! input
5599 {{NAMESPACENUMBER}}
5600 !! result
5601 <p>2
5602 </p>
5603 !! end
5605 !! test
5606 Magic Word: {{NUMBEROFFILES}}
5607 !! input
5608 {{NUMBEROFFILES}}
5609 !! result
5610 <p>4
5611 </p>
5612 !! end
5614 !! test
5615 Magic Word: {{PAGENAME}}
5616 !! options
5617 title=[[User:Ævar Arnfjörð Bjarmason]]
5618 !! input
5619 {{PAGENAME}}
5620 !! result
5621 <p>Ævar Arnfjörð Bjarmason
5622 </p>
5623 !! end
5625 !! test
5626 Magic Word: {{PAGENAME}} with metacharacters
5627 !! options
5628 title=[['foo & bar = baz']]
5629 !! input
5630 ''{{PAGENAME}}''
5631 !! result
5632 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5633 </p>
5634 !! end
5636 !! test
5637 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5638 !! options
5639 title=[[*RFC 1234 http://example.com/]]
5640 !! input
5641 {{PAGENAME}}
5642 !! result
5643 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5644 </p>
5645 !! end
5647 !! test
5648 Magic Word: {{PAGENAMEE}}
5649 !! options
5650 title=[[User:Ævar Arnfjörð Bjarmason]]
5651 !! input
5652 {{PAGENAMEE}}
5653 !! result
5654 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5655 </p>
5656 !! end
5658 !! test
5659 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5660 !! options
5661 title=[[*RFC 1234 http://example.com/]]
5662 !! input
5663 {{PAGENAMEE}}
5664 !! result
5665 <p>&#42;RFC_1234_http&#58;//example.com/
5666 </p>
5667 !! end
5669 !! test
5670 Magic Word: {{REVISIONID}}
5671 !! input
5672 {{REVISIONID}}
5673 !! result
5674 <p>1337
5675 </p>
5676 !! end
5678 !! test
5679 Magic Word: {{SCRIPTPATH}}
5680 !! input
5681 {{SCRIPTPATH}}
5682 !! result
5683 <p>/
5684 </p>
5685 !! end
5687 !! test
5688 Magic Word: {{SERVER}}
5689 !! input
5690 {{SERVER}}
5691 !! result
5692 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5693 </p>
5694 !! end
5696 !! test
5697 Magic Word: {{SERVERNAME}}
5698 !! input
5699 {{SERVERNAME}}
5700 !! result
5701 <p>example.org
5702 </p>
5703 !! end
5705 !! test
5706 Magic Word: {{SITENAME}}
5707 !! input
5708 {{SITENAME}}
5709 !! result
5710 <p>MediaWiki
5711 </p>
5712 !! end
5714 !! test
5715 Case-sensitive magic words, when cased differently, should just be template transclusions
5716 !! input
5717 {{CurrentMonth}}
5718 {{currentday}}
5719 {{cURreNTweEK}}
5720 {{currentHour}}
5721 !! result
5722 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
5723 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
5724 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
5725 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
5726 </p>
5727 !! end
5729 !! test
5730 Case-insensitive magic words should still work with weird casing.
5731 !! input
5732 {{sErVeRNaMe}}
5733 {{LCFirst:AOEU}}
5734 {{ucFIRST:aoeu}}
5735 {{SERver}}
5736 !! result
5737 <p>example.org
5738 aOEU
5739 Aoeu
5740 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5741 </p>
5742 !! end
5744 !! test
5745 Namespace 1 {{ns:1}}
5746 !! input
5747 {{ns:1}}
5748 !! result
5749 <p>Talk
5750 </p>
5751 !! end
5753 !! test
5754 Namespace 1 {{ns:01}}
5755 !! input
5756 {{ns:01}}
5757 !! result
5758 <p>Talk
5759 </p>
5760 !! end
5762 !! test
5763 Namespace 0 {{ns:0}} (bug 4783)
5764 !! input
5765 {{ns:0}}
5766 !! result
5768 !! end
5770 !! test
5771 Namespace 0 {{ns:00}} (bug 4783)
5772 !! input
5773 {{ns:00}}
5774 !! result
5776 !! end
5778 !! test
5779 Namespace -1 {{ns:-1}}
5780 !! input
5781 {{ns:-1}}
5782 !! result
5783 <p>Special
5784 </p>
5785 !! end
5787 !! test
5788 Namespace User {{ns:User}}
5789 !! input
5790 {{ns:User}}
5791 !! result
5792 <p>User
5793 </p>
5794 !! end
5796 !! test
5797 Namespace User talk {{ns:User_talk}}
5798 !! input
5799 {{ns:User_talk}}
5800 !! result
5801 <p>User talk
5802 </p>
5803 !! end
5805 !! test
5806 Namespace User talk {{ns:uSeR tAlK}}
5807 !! input
5808 {{ns:uSeR tAlK}}
5809 !! result
5810 <p>User talk
5811 </p>
5812 !! end
5814 !! test
5815 Namespace File {{ns:File}}
5816 !! input
5817 {{ns:File}}
5818 !! result
5819 <p>File
5820 </p>
5821 !! end
5823 !! test
5824 Namespace File {{ns:Image}}
5825 !! input
5826 {{ns:Image}}
5827 !! result
5828 <p>File
5829 </p>
5830 !! end
5832 !! test
5833 Namespace (lang=de) Benutzer {{ns:User}}
5834 !! options
5835 language=de
5836 !! input
5837 {{ns:User}}
5838 !! result
5839 <p>Benutzer
5840 </p>
5841 !! end
5843 !! test
5844 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5845 !! options
5846 language=de
5847 !! input
5848 {{ns:3}}
5849 !! result
5850 <p>Benutzer Diskussion
5851 </p>
5852 !! end
5855 !! test
5856 Urlencode
5857 !! input
5858 {{urlencode:hi world?!}}
5859 {{urlencode:hi world?!|WIKI}}
5860 {{urlencode:hi world?!|PATH}}
5861 {{urlencode:hi world?!|QUERY}}
5862 !! result
5863 <p>hi+world%3F%21
5864 hi_world%3F!
5865 hi%20world%3F%21
5866 hi+world%3F%21
5867 </p>
5868 !! end
5871 ### Magic links
5873 !! test
5874 Magic links: internal link to RFC (bug 479)
5875 !! input
5876 [[RFC 123]]
5877 !! result
5878 <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>
5879 </p>
5880 !! end
5882 !! test
5883 Magic links: RFC (bug 479)
5884 !! input
5885 RFC 822
5886 !! result
5887 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5888 </p>
5889 !! end
5891 !! test
5892 Magic links: ISBN (bug 1937)
5893 !! input
5894 ISBN 0-306-40615-2
5895 !! result
5896 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5897 </p>
5898 !! end
5900 !! test
5901 Magic links: PMID incorrectly converts space to underscore
5902 !! input
5903 PMID 1234
5904 !! result
5905 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5906 </p>
5907 !! end
5910 ### Templates
5911 ####
5913 !! test
5914 Nonexistent template
5915 !! input
5916 {{thistemplatedoesnotexist}}
5917 !! result
5918 <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>
5919 </p>
5920 !! end
5922 !! test
5923 Template with invalid target containing tags
5924 !! input
5925 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5926 !! result
5927 <p>{{a<b>b</b>|foo|a=b|a = b}}
5928 </p>
5929 !! end
5931 !! test
5932 Template with invalid target containing unclosed tag
5933 !! input
5934 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5935 !! result
5936 <p>{{a<b>|foo|a=b|a = b}}</b>
5937 </p>
5938 !! end
5940 !! article
5941 Template:test
5942 !! text
5943 This is a test template
5944 !! endarticle
5946 !! test
5947 Simple template
5948 !! input
5949 {{test}}
5950 !! result
5951 <p>This is a test template
5952 </p>
5953 !! end
5955 !! test
5956 Template with explicit namespace
5957 !! input
5958 {{Template:test}}
5959 !! result
5960 <p>This is a test template
5961 </p>
5962 !! end
5965 !! article
5966 Template:paramtest
5967 !! text
5968 This is a test template with parameter {{{param}}}
5969 !! endarticle
5971 !! test
5972 Template parameter
5973 !! input
5974 {{paramtest|param=foo}}
5975 !! result
5976 <p>This is a test template with parameter foo
5977 </p>
5978 !! end
5980 !! article
5981 Template:paramtestnum
5982 !! text
5983 [[{{{1}}}|{{{2}}}]]
5984 !! endarticle
5986 !! test
5987 Template unnamed parameter
5988 !! input
5989 {{paramtestnum|Main Page|the main page}}
5990 !! result
5991 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5992 </p>
5993 !! end
5995 !! article
5996 Template:templatesimple
5997 !! text
5998 (test)
5999 !! endarticle
6001 !! article
6002 Template:templateredirect
6003 !! text
6004 #redirect [[Template:templatesimple]]
6005 !! endarticle
6007 !! article
6008 Template:templateasargtestnum
6009 !! text
6010 {{{{{1}}}}}
6011 !! endarticle
6013 !! article
6014 Template:templateasargtest
6015 !! text
6016 {{template{{{templ}}}}}
6017 !! endarticle
6019 !! article
6020 Template:templateasargtest2
6021 !! text
6022 {{{{{templ}}}}}
6023 !! endarticle
6025 !! test
6026 Template with template name as unnamed argument
6027 !! input
6028 {{templateasargtestnum|templatesimple}}
6029 !! result
6030 <p>(test)
6031 </p>
6032 !! end
6034 !! test
6035 Template with template name as argument
6036 !! input
6037 {{templateasargtest|templ=simple}}
6038 !! result
6039 <p>(test)
6040 </p>
6041 !! end
6043 !! test
6044 Template with template name as argument (2)
6045 !! input
6046 {{templateasargtest2|templ=templatesimple}}
6047 !! result
6048 <p>(test)
6049 </p>
6050 !! end
6052 !! article
6053 Template:templateasargtestdefault
6054 !! text
6055 {{{{{templ|templatesimple}}}}}
6056 !! endarticle
6058 !! article
6059 Template:templa
6060 !! text
6061 '''templ'''
6062 !! endarticle
6064 !! test
6065 Template with default value
6066 !! input
6067 {{templateasargtestdefault}}
6068 !! result
6069 <p>(test)
6070 </p>
6071 !! end
6073 !! test
6074 Template with default value (value set)
6075 !! input
6076 {{templateasargtestdefault|templ=templa}}
6077 !! result
6078 <p><b>templ</b>
6079 </p>
6080 !! end
6082 !! test
6083 Template redirect
6084 !! input
6085 {{templateredirect}}
6086 !! result
6087 <p>(test)
6088 </p>
6089 !! end
6091 !! test
6092 Template with argument in separate line
6093 !! input
6094 {{ templateasargtest  |
6095  templ = simple }}
6096 !! result
6097 <p>(test)
6098 </p>
6099 !! end
6101 !! test
6102 Template with complex template as argument
6103 !! input
6104 {{paramtest|
6105   param ={{ templateasargtest  |
6106  templ = simple }}}}
6107 !! result
6108 <p>This is a test template with parameter (test)
6109 </p>
6110 !! end
6112 !! test
6113 Template with thumb image (with link in description)
6114 !! input
6115 {{paramtest|
6116   param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6117 !! result
6118 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>
6120 !! end
6122 !! article
6123 Template:complextemplate
6124 !! text
6125 {{{1}}} {{paramtest|
6126   param ={{{param}}}}}
6127 !! endarticle
6129 !! test
6130 Template with complex arguments
6131 !! input
6132 {{complextemplate|
6133   param ={{ templateasargtest  |
6134  templ = simple }}|[[Template:complextemplate|link]]}}
6135 !! result
6136 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6137 </p>
6138 !! end
6140 !! test
6141 BUG 553: link with two variables in a piped link
6142 !! input
6144 |[[{{{1}}}|{{{2}}}]]
6146 !! result
6147 <table>
6148 <tr>
6149 <td>[[{{{1}}}|{{{2}}}]]
6150 </td></tr></table>
6152 !! end
6154 !! test
6155 Magic variable as template parameter
6156 !! input
6157 {{paramtest|param={{SITENAME}}}}
6158 !! result
6159 <p>This is a test template with parameter MediaWiki
6160 </p>
6161 !! end
6163 !! article
6164 Template:linktest
6165 !! text
6166 [[{{{param}}}|link]]
6167 !! endarticle
6169 !! test
6170 Template parameter as link source
6171 !! input
6172 {{linktest|param=Main Page}}
6173 !! result
6174 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
6175 </p>
6176 !! end
6178 !!test
6179 Template-generated attribute string (k='v')
6180 !!input
6181 <span {{attr_str|id|v1}}>bar</span>
6182 !!result
6183 <p><span id="v1">bar</span>
6184 </p>
6185 !!end
6187 !!article
6188 Template:paramtest2
6189 !! text
6190 including another template, {{paramtest|param={{{arg}}}}}
6191 !! endarticle
6193 !! test
6194 Template passing argument to another template
6195 !! input
6196 {{paramtest2|arg='hmm'}}
6197 !! result
6198 <p>including another template, This is a test template with parameter 'hmm'
6199 </p>
6200 !! end
6202 !! article
6203 Template:Linktest2
6204 !! text
6205 Main Page
6206 !! endarticle
6208 !! test
6209 Template as link source
6210 !! input
6211 [[{{linktest2}}]]
6213 [[{{linktest2}}|Main Page]]
6215 [[{{linktest2}}]]Page
6216 !! result
6217 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6218 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6219 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
6220 </p>
6221 !! end
6224 !! article
6225 Template:loop1
6226 !! text
6227 {{loop2}}
6228 !! endarticle
6230 !! article
6231 Template:loop2
6232 !! text
6233 {{loop1}}
6234 !! endarticle
6236 !! test
6237 Template infinite loop
6238 !! input
6239 {{loop1}}
6240 !! result
6241 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
6242 </p>
6243 !! end
6245 !! test
6246 Template from main namespace
6247 !! input
6248 {{:Main Page}}
6249 !! result
6250 <p>blah blah
6251 </p>
6252 !! end
6254 !! article
6255 Template:table
6256 !! text
6258 | 1 || 2
6260 | 3 || 4
6262 !! endarticle
6264 !! test
6265 BUG 529: Template with table, not included at beginning of line
6266 !! input
6267 foo {{table}}
6268 !! result
6269 <p>foo 
6270 </p>
6271 <table>
6272 <tr>
6273 <td> 1 </td>
6274 <td> 2
6275 </td></tr>
6276 <tr>
6277 <td> 3 </td>
6278 <td> 4
6279 </td></tr></table>
6281 !! end
6283 !! test
6284 BUG 523: Template shouldn't eat newline (or add an extra one before table)
6285 !! input
6287 {{table}}
6288 !! result
6289 <p>foo
6290 </p>
6291 <table>
6292 <tr>
6293 <td> 1 </td>
6294 <td> 2
6295 </td></tr>
6296 <tr>
6297 <td> 3 </td>
6298 <td> 4
6299 </td></tr></table>
6301 !! end
6303 !! test
6304 BUG 41: Template parameters shown as broken links
6305 !! input
6306 {{{parameter}}}
6307 !! result
6308 <p>{{{parameter}}}
6309 </p>
6310 !! end
6312 !! test
6313 Template with targets containing wikilinks
6314 !! input
6315 {{[[foo]]}}
6317 {{[[{{echo|foo}}]]}}
6319 {{{{echo|[[foo}}]]}}
6320 !! result
6321 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6322 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6323 </p><p>{{[[foo}}]]
6324 </p>
6325 !! end
6327 !! article
6328 Template:MSGNW test
6329 !! text
6330 ''None'' of '''this''' should be 
6331 * interpreted
6332  but rather passed unmodified
6333 {{test}}
6334 !! endarticle
6336 # hmm, fix this or just deprecate msgnw and document its behavior?
6337 !! test
6338 msgnw keyword
6339 !! options
6340 disabled
6341 !! input
6342 {{msgnw:MSGNW test}}
6343 !! result
6344 <p>''None'' of '''this''' should be 
6345 * interpreted
6346  but rather passed unmodified
6347 {{test}}
6348 </p>
6349 !! end
6351 !! test
6352 int keyword
6353 !! input
6354 {{int:youhavenewmessages|lots of money|not!}}
6355 !! result
6356 <p>You have lots of money (not!).
6357 </p>
6358 !! end
6360 !! article
6361 Template:Includes
6362 !! text
6363 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6364 !! endarticle
6366 !! test
6367 <includeonly> and <noinclude> being included
6368 !! input
6369 {{Includes}}
6370 !! result
6371 <p>Foobar
6372 </p>
6373 !! end
6375 !! article
6376 Template:Includes2
6377 !! text
6378 <onlyinclude>Foo</onlyinclude>bar
6379 !! endarticle
6381 !! test
6382 <onlyinclude> being included
6383 !! input
6384 {{Includes2}}
6385 !! result
6386 <p>Foo
6387 </p>
6388 !! end
6391 !! article
6392 Template:Includes3
6393 !! text
6394 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6395 !! endarticle
6397 !! test
6398 <onlyinclude> and <includeonly> being included
6399 !! input
6400 {{Includes3}}
6401 !! result
6402 <p>Foo
6403 </p>
6404 !! end
6406 !! test
6407 <includeonly> and <noinclude> on a page
6408 !! input
6409 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6410 !! result
6411 <p>Foozar
6412 </p>
6413 !! end
6415 !! test
6416 Un-closed <noinclude>
6417 !! input
6418 <noinclude>
6419 !! result
6420 !! end
6422 !! test
6423 <onlyinclude> on a page
6424 !! input
6425 <onlyinclude>Foo</onlyinclude>bar
6426 !! result
6427 <p>Foobar
6428 </p>
6429 !! end
6431 !! test
6432 Un-closed <onlyinclude>
6433 !! input
6434 <onlyinclude>
6435 !! result
6436 !! end
6438 !!test
6439 Self-closed noinclude, includeonly, onlyinclude tags
6440 !!input
6441 <noinclude />
6442 <includeonly />
6443 <onlyinclude />
6444 !!result
6445 <p><br />
6446 </p>
6447 !!end
6449 !!test
6450 Unbalanced includeonly and noinclude tags
6451 !!input
6453 |a</noinclude>
6454 |b</noinclude></noinclude>
6455 |c</noinclude></includeonly>
6456 |d</includeonly></includeonly>
6458 !!result
6459 <table>
6460 <tr>
6461 <td>a
6462 </td>
6463 <td>b
6464 </td>
6465 <td>c&lt;/includeonly&gt;
6466 </td>
6467 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6468 </td></tr></table>
6470 !!end
6472 !! article
6473 Template:Includeonly section
6474 !! text
6475 <includeonly>
6476 ==Includeonly section==
6477 </includeonly>
6478 ==Section T-1==
6479 !!endarticle
6481 !! test
6482 Bug 6563: Edit link generation for section shown by <includeonly>
6483 !! input
6484 {{includeonly section}}
6485 !! result
6486 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
6487 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
6489 !! end
6491 # Uses same input as the contents of [[Template:Includeonly section]]
6492 !! test
6493 Bug 6563: Section extraction for section shown by <includeonly>
6494 !! options
6495 section=T-2
6496 !! input
6497 <includeonly>
6498 ==Includeonly section==
6499 </includeonly>
6500 ==Section T-2==
6501 !! result
6502 ==Section T-2==
6503 !! end
6505 !! test
6506 Bug 6563: Edit link generation for section suppressed by <includeonly>
6507 !! input
6508 <includeonly>
6509 ==Includeonly section==
6510 </includeonly>
6511 ==Section 1==
6512 !! result
6513 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
6515 !! end
6517 !! test
6518 Bug 6563: Section extraction for section suppressed by <includeonly>
6519 !! options
6520 section=1
6521 !! input
6522 <includeonly>
6523 ==Includeonly section==
6524 </includeonly>
6525 ==Section 1==
6526 !! result
6527 ==Section 1==
6528 !! end
6530 !! test
6531 Un-closed <includeonly>
6532 !! input
6533 <includeonly>
6534 !! result
6535 !! end
6538 ### <includeonly> and <noinclude> in attributes
6540 !!test
6541 0. includeonly around the entire attribute
6542 !!input
6543 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6544 !!result
6545 <p><span id="v2">bar</span>
6546 </p>
6547 !!end
6549 !!test
6550 1. includeonly in html attr key
6551 !!input
6552 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6553 !!result
6554 <p><span id="foo">bar</span>
6555 </p>
6556 !!end
6558 !!test
6559 2. includeonly in html attr value
6560 !!input
6561 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6562 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6563 !!result
6564 <p><span id="v1">bar</span>
6565 <span id="v1">bar</span>
6566 </p>
6567 !!end
6569 !!test
6570 3. includeonly in part of an attr value
6571 !!input
6572 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6573 !!result
6574 <p><span style="color:red;">bar</span>
6575 </p>
6576 !!end
6579 ### Testing parsing of templates where a template arg
6580 ### has the same name as the template itself.
6583 !! article
6584 Template:quote
6585 !! text
6586 {{{quote|{{{1}}}}}}
6587 !! endarticle
6589 !!test
6590 Templates: Template Name/Arg clash: 1. Use of positional param
6591 !!input
6592 {{quote|foo}}
6593 !!result
6594 <p>foo
6595 </p>
6596 !!end
6598 !!test
6599 Templates: Template Name/Arg clash: 2. Use of named param
6600 !!input
6601 {{quote|quote=foo}}
6602 !!result
6603 <p>foo
6604 </p>
6605 !!end
6607 !!test
6608 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6609 !!input
6610 {{quote|quote}}
6611 !!result
6612 <p>quote
6613 </p>
6614 !!end
6617 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6620 !!test
6621 Templates: 1. Simple use
6622 !!input
6623 {{echo|Foo}}
6624 !!result
6625 <p>Foo
6626 </p>
6627 !!end
6629 !!test
6630 Templates: 2. Inside a block tag
6631 !!input
6632 <div>{{echo|Foo}}</div>
6633 !!result
6634 <div>Foo</div>
6636 !!end
6638 !!test
6639 Templates: P-wrapping: 1a. Templates on consecutive lines
6640 !!input
6641 {{echo|Foo}}
6642 {{echo|bar}}
6643 !!result
6644 <p>Foo
6646 </p>
6647 !!end
6649 !!test
6650 Templates: P-wrapping: 1b. Templates on consecutive lines
6651 !!input
6654 {{echo|bar}}
6655 {{echo|baz}}
6656 !!result
6657 <p>Foo
6658 </p><p>bar
6660 </p>
6661 !!end
6663 !!test
6664 Templates: P-wrapping: 1c. Templates on consecutive lines
6665 !!input
6666 {{echo|Foo}}
6667 {{echo|bar}} <div>baz</div>
6668 !!result
6669 <p>Foo
6670 </p>
6671 bar <div>baz</div>
6673 !!end
6675 !!test
6676 Templates: P-wrapping: 1d. Template preceded by comment-only line
6677 !!options
6678 parsoid=wt2html,wt2wt
6679 !!input
6680 <!-- foo -->
6681 {{echo|Bar}}
6682 !!result
6683 <!-- foo -->
6684 <p typeof="mw:Transclusion">Bar
6685 </p>
6686 !!end
6688 !!test
6689 Templates: Inline Text: 1. Multiple tmeplate uses
6690 !!input
6691 {{echo|Foo}}bar{{echo|baz}}
6692 !!result
6693 <p>Foobarbaz
6694 </p>
6695 !!end
6697 !!test
6698 Templates: Inline Text: 2. Back-to-back template uses
6699 !!input
6700 {{echo|Foo}}{{echo|bar}}
6701 !!result
6702 <p>Foobar
6703 </p>
6704 !!end
6706 !!test
6707 Templates: Block Tags: 1. Multiple template uses
6708 !!input
6709 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6710 !!result
6711 <div>Foo</div><div>bar</div><div>baz</div>
6713 !!end
6715 !!test
6716 Templates: Block Tags: 2. Back-to-back template uses
6717 !!input
6718 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6719 !!result
6720 <div>Foo</div><div>bar</div>
6722 !!end
6724 !!test
6725 Templates: Links: 1. Simple example
6726 !!input
6727 {{echo|[[Foo|bar]]}}
6728 !!result
6729 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6730 </p>
6731 !!end
6733 !!test
6734 Templates: Links: 2. Generation of link href
6735 !!input
6736 [[{{echo|Foo}}|bar]]
6737 !!result
6738 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6739 </p>
6740 !!end
6742 !!test
6743 Templates: Links: 3. Generation of part of a link href
6744 !!input
6745 [[Fo{{echo|o}}|bar]]
6747 [[Foo{{echo|bar}}]]
6749 [[Foo{{echo|bar}}baz]]
6751 [[Foo{{echo|bar}}|bar]]
6753 [[:Foo{{echo|bar}}]]
6755 [[:Foo{{echo|bar}}|bar]]
6756 !!result
6757 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6758 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6759 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6760 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6761 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6762 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6763 </p>
6764 !!end
6766 !!test
6767 Templates: Links: 4. Multiple templates generating link href
6768 !!input
6769 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6770 !!result
6771 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6772 </p>
6773 !!end
6775 !!test
6776 Templates: Links: 5. Generation of link text
6777 !!input
6778 [[Foo|{{echo|bar}}]]
6779 !!result
6780 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6781 </p>
6782 !!end
6784 !!test
6785 Templates: Links: 5. Nested templates (only outermost template should be marked)
6786 !!input
6787 {{echo|[[{{echo|Foo}}|bar]]}}
6788 !!result
6789 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6790 </p>
6791 !!end
6793 !!test
6794 Templates: HTML Tag: 1. Generation of HTML attr. key
6795 !!input
6796 <div {{echo|style}}="color:red;">foo</div>
6797 !!result
6798 <div style="color:red;">foo</div>
6800 !!end
6802 !!test
6803 Templates: HTML Tag: 2. Generation of HTML attr. value
6804 !!input
6805 <div style={{echo|'color:red;'}}>foo</div>
6806 !!result
6807 <div style="color:red;">foo</div>
6809 !!end
6811 !!test
6812 Templates: HTML Tag: 3. Generation of HTML attr key and value
6813 !!input
6814 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6815 !!result
6816 <div style="color:red;">foo</div>
6818 !!end
6820 !!test
6821 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6822 !!input
6823 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6824 !!result
6825 <div title="This is a long title with just one piece templated">foo</div>
6827 !!end
6829 !!test
6830 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6831 !!input
6832 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6833 !!result
6834 <div title="This is a long title with just one piece templated">foo</div>
6836 !!end
6838 !!test
6839 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6840 !!input
6841 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6842 !!result
6843 <div title="This is a long title with just one piece templated">foo</div>
6845 !!end
6847 !!test
6848 Templates: HTML Tag: 7. Generation of partial attribute key string
6849 !!input
6850 <div st{{echo|yle}}="color:red;">foo</div>
6851 !!result
6852 <div style="color:red;">foo</div>
6854 !!end
6856 !!test
6857 Templates: HTML Tables: 1. Generating start of a HTML table
6858 !!input
6859 {{echo|<table><tr><td>foo</td>}}</tr></table>
6860 !!result
6861 <table><tr><td>foo</td></tr></table>
6863 !!end
6865 !!test
6866 Templates: HTML Tables: 2a. Generating middle of a HTML table
6867 !!input
6868 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6869 !!result
6870 <table><tr><td>foo</td></tr></table>
6872 !!end
6874 !!test
6875 Templates: HTML Tables: 2b. Generating middle of a HTML table
6876 !!input
6877 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6878 !!result
6879 <table><tr><td>foo</td></tr></table>
6881 !!end
6883 !!test
6884 Templates: HTML Tables: 3. Generating end of a HTML table
6885 !!input
6886 <table><tr>{{echo|<td>foo</td></tr></table>}}
6887 !!result
6888 <table><tr><td>foo</td></tr></table>
6890 !!end
6892 !!test
6893 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6894 !!input
6895 {{echo|<table>}}<tr><td>foo</td></tr></table>
6896 !!result
6897 <table><tr><td>foo</td></tr></table>
6899 !!end
6901 !!test
6902 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6903 !!input
6904 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6905 !!result
6906 <table><tr><td>foo</td></tr></table>
6908 !!end
6910 !!test
6911 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6912 !!input
6913 <table><tr>{{echo|<td>}}foo</td></tr></table>
6914 !!result
6915 <table><tr><td>foo</td></tr></table>
6917 !!end
6919 !!test
6920 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6921 !!input
6922 <table><tr><td>foo{{echo|</td>}}</tr></table>
6923 !!result
6924 <table><tr><td>foo</td></tr></table>
6926 !!end
6928 !!test
6929 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6930 !!input
6931 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6932 !!result
6933 <table><tr><td>foo</td></tr></table>
6935 !!end
6937 !!test
6938 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6939 !!input
6940 <table><tr><td>foo</td></tr>{{echo|</table>}}
6941 !!result
6942 <table><tr><td>foo</td></tr></table>
6944 !!end
6946 !!test
6947 Templates: HTML Tables: 5. Proper fostering of categories from inside
6948 !!options
6949 parsoid=wt2html,wt2wt
6950 !!input
6951 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
6952 <!--Two categories (Bug 50330)-->
6953 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
6954 !!result
6955 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
6956 <!--Two categories (Bug 50330)-->
6957 <link rel="mw:WikiLink/Category" href="./Category:Bar1"><link rel="mw:WikiLink/Category" href="./Category:Bar2"><table><tbody><tr><td>foo</td></tr></tbody></table>
6958 !!end
6960 !!test
6961 Templates: Wiki Tables: 1a. Fostering of entire template content
6962 !!input
6964 {{echo|a}}
6966 !!result
6967 <table>
6969 <tr><td></td></tr></table>
6971 !!end
6973 !!test
6974 Templates: Wiki Tables: 1b. Fostering of entire template content
6975 !!input
6977 {{echo|<div>}}
6979 {{echo|</div>}}
6981 !!result
6982 <table>
6983 <div>
6984 <p>foo
6985 </p>
6986 </div>
6987 <tr><td></td></tr></table>
6989 !!end
6991 !!test
6992 Templates: Wiki Tables: 2. Fostering of partial template content
6993 !!input
6995 {{echo|a
6996 <div>b</div>}}
6998 !!result
6999 <table>
7001 <div>b</div>
7002 <tr><td></td></tr></table>
7004 !!end
7006 !!test
7007 Templates: Wiki Tables: 3. td-content via multiple templates
7008 !!input
7010 {{echo|{{pipe}}a}}{{echo|b}}
7012 !!result
7013 <table>
7014 <tr>
7015 <td>ab
7016 </td></tr></table>
7018 !!end
7020 !!test
7021 Templates: Wiki Tables: 4. Templated tags, no content
7022 !!input
7023 {{tbl-start}}
7024 {{tbl-end}}
7025 !!result
7026 <table>
7027 <tr><td></td></tr></table>
7029 !!end
7031 !!test
7032 Templates: Wiki Tables: 5. Templated tags, regular td-tags
7033 !!input
7034 {{tbl-start}}
7035 |foo
7036 {{tbl-end}}
7037 !!result
7038 <table>
7039 <tr>
7040 <td>foo
7041 </td></tr></table>
7043 !!end
7045 !!test
7046 Templates: Wiki Tables: 6. Templated tags, templated td-tags
7047 !!input
7048 {{tbl-start}}
7049 {{!}}foo
7050 {{tbl-end}}
7051 !!result
7052 <table>
7053 <tr>
7054 <td>foo
7055 </td></tr></table>
7057 !!end
7059 !!test
7060 Templates: Lists: Multi-line list-items via templates
7061 !!input
7062 *{{echo|a {{nonexistent|
7063 unused}}}}
7064 *{{echo|b {{nonexistent|
7065 unused}}}}
7066 !!result
7067 <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>
7068 </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>
7069 </li></ul>
7071 !!end
7073 !!test
7074 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
7075 !!input
7076 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
7077 !!result
7078 <p><i>ab</i>c<i>d</i>e
7079 </p>
7080 !!end
7082 !!test
7083 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7084 (PHP parser generates misnested html)
7085 !! options
7086 parsoid=wt2html,wt2wt
7087 !!input
7088 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
7089 !!result
7090 <p><span typeof="mw:Transclusion"><i>a</i></span><i typeof="mw:Transclusion"><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
7091 !!end
7093 !!test
7094 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
7095 (PHP parser generates misnested html)
7096 !! options
7097 parsoid=wt2html,wt2wt
7098 !!input
7099 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
7100 !!result
7101 <div typeof="mw:Transclusion"><i>a</i></div>
7102 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
7103 <div typeof="mw:Transclusion">e</div>
7104 !!end
7106 !!test
7107 Templates: Ugly nesting: 4. Divs opened/closed across templates
7108 !!input
7109 a<div>b{{echo|c</div>d}}e
7110 !!result
7111 a<div>bc</div>de
7113 !!end
7115 !!test
7116 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
7117 (Parsoid-centric)
7118 !! options
7119 parsoid
7120 !!input
7122 |{{echo|foo</table>}}
7123 |bar
7125 !!result
7126 <table typeof="mw:Transclusion">
7127 <tbody>
7128 <tr>
7129 <td>foo</td></tr></tbody></table><span>bar</span>
7130 !!end
7132 !!test
7133 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
7134 (Parsoid-centric)
7135 !! options
7136 parsoid
7137 !!input
7138 <table>
7139   <tr>
7140     <td>
7141     <table>
7142       <tr>
7143         <td>1. {{echo|foo </table>}}</td>
7144         <td> bar </td>
7145         <td>2. {{echo|baz </table>}}</td>
7146       </tr>
7147       <tr>
7148         <td>abc</td>
7149       </tr>
7150     </table>
7151     </td>
7152   </tr>
7153   <tr>
7154     <td>xyz</td>
7155   </tr>
7156 </table>
7157 !!result
7158 <table  about="#mwt1" typeof="mw:Transclusion">
7159   <tbody><tr >
7160     <td >
7161     <table >
7162       <tbody><tr >
7163         <td >1. foo </td></tr></tbody></table></td>
7164         <td > bar </td>
7165         <td >2. baz </td></tr></tbody></table><span about="#mwt1">
7166       </span><span about="#mwt1">
7167       
7168         abc</span><span about="#mwt1">
7169       </span><span about="#mwt1">
7170     </span><span about="#mwt1">
7171     </span><span about="#mwt1">
7172   </span><span about="#mwt1">
7173   
7174     xyz</span><span about="#mwt1">
7175   </span><span about="#mwt1">
7176 </span>
7177 !!end
7179 !! test
7180 Templates: Ugly templates: 3. newline-only template parameter
7181 !! input
7182 foo {{echo|
7184 !! result
7185 <p>foo 
7186 </p>
7187 !! end
7189 # This looks like a bug: a single newline triggers p/br for some reason.
7190 !! test
7191 Templates: Ugly templates: 4. newline-only template parameter inconsistency
7192 !! input
7193 {{echo|
7195 !! result
7196 <p><br />
7197 </p>
7198 !! end
7201 !!test
7202 Parser Functions: 1. Simple example
7203 !!input
7204 {{uc:foo}}
7205 !!result
7206 <p>FOO
7207 </p>
7208 !!end
7210 !!test
7211 Parser Functions: 2. Nested use (only outermost should be marked up)
7212 !!input
7213 {{uc:{{lc:FOO}}}}
7214 !!result
7215 <p>FOO
7216 </p>
7217 !!end
7220 ### Pre-save transform tests
7222 !! test
7223 pre-save transform: subst:
7224 !! options
7226 !! input
7227 {{subst:test}}
7228 !! result
7229 This is a test template
7230 !! end
7232 !! test
7233 pre-save transform: normal template
7234 !! options
7236 !! input
7237 {{test}}
7238 !! result
7239 {{test}}
7240 !! end
7242 !! test
7243 pre-save transform: nonexistent template
7244 !! options
7246 !! input
7247 {{thistemplatedoesnotexist}}
7248 !! result
7249 {{thistemplatedoesnotexist}}
7250 !! end
7253 !! test
7254 pre-save transform: subst magic variables
7255 !! options
7257 !! input
7258 {{subst:SITENAME}}
7259 !! result
7260 MediaWiki
7261 !! end
7263 # This is bug 89, which I fixed. -- wtm
7264 !! test
7265 pre-save transform: subst: templates with parameters
7266 !! options
7268 !! input
7269 {{subst:paramtest|param="something else"}}
7270 !! result
7271 This is a test template with parameter "something else"
7272 !! end
7274 !! article
7275 Template:nowikitest
7276 !! text
7277 <nowiki>'''not wiki'''</nowiki>
7278 !! endarticle
7280 !! test
7281 pre-save transform: nowiki in subst (bug 1188)
7282 !! options
7284 !! input
7285 {{subst:nowikitest}}
7286 !! result
7287 <nowiki>'''not wiki'''</nowiki>
7288 !! end
7291 !! article
7292 Template:commenttest
7293 !! text
7294 This template has <!-- a comment --> in it.
7295 !! endarticle
7297 !! test
7298 pre-save transform: comment in subst (bug 1936)
7299 !! options
7301 !! input
7302 {{subst:commenttest}}
7303 !! result
7304 This template has <!-- a comment --> in it.
7305 !! end
7307 !! test
7308 pre-save transform: unclosed tag
7309 !! options
7310 pst noxml
7311 !! input
7312 <nowiki>'''not wiki'''
7313 !! result
7314 <nowiki>'''not wiki'''
7315 !! end
7317 !! test
7318 pre-save transform: mixed tag case
7319 !! options
7320 pst noxml
7321 !! input
7322 <NOwiki>'''not wiki'''</noWIKI>
7323 !! result
7324 <NOwiki>'''not wiki'''</noWIKI>
7325 !! end
7327 !! test
7328 pre-save transform: unclosed comment in <nowiki>
7329 !! options
7330 pst noxml
7331 !! input
7332 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7333 !! result
7334 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7335 !!end
7337 # Leading @ in this template definition works around a limitation
7338 # in parsoid's parserTests which otherwise strips the <span> from the
7339 # result (confusing it for a template wrapper)
7340 !! article
7341 Template:dangerous
7342 !!text
7343 @<span onmouseover="alert('crap')">Oh no</span>
7344 !!endarticle
7346 !!test
7347 (confirming safety of fix for subst bug 1936)
7348 !! input
7349 {{Template:dangerous}}
7350 !! result
7351 <p>@<span>Oh no</span>
7352 </p>
7353 !! end
7355 !! test
7356 pre-save transform: comment containing gallery (bug 5024)
7357 !! options
7359 !! input
7360 <!-- <gallery>data</gallery> -->
7361 !!result
7362 <!-- <gallery>data</gallery> -->
7363 !!end
7365 !! test
7366 pre-save transform: comment containing extension
7367 !! options
7369 !! input
7370 <!-- <tag>data</tag> -->
7371 !!result
7372 <!-- <tag>data</tag> -->
7373 !!end
7375 !! test
7376 pre-save transform: comment containing nowiki
7377 !! options
7379 !! input
7380 <!-- <nowiki>data</nowiki> -->
7381 !!result
7382 <!-- <nowiki>data</nowiki> -->
7383 !!end
7385 !! test
7386 pre-save transform: <noinclude> in subst (bug 3298)
7387 !! options
7389 !! input
7390 {{subst:Includes}}
7391 !! result
7392 Foobar
7393 !! end
7395 !! test
7396 pre-save transform: <onlyinclude> in subst (bug 3298)
7397 !! options
7399 !! input
7400 {{subst:Includes2}}
7401 !! result
7403 !! end
7405 !! article
7406 Template:SubstTest
7407 !!text
7408 {{<includeonly>subst:</includeonly>Includes}}
7409 !! endarticle
7411 !! article
7412 Template:SafeSubstTest
7413 !! text
7414 {{<includeonly>safesubst:</includeonly>Includes}}
7415 !! endarticle
7417 !! test
7418 bug 22297: safesubst: works during PST
7419 !! options
7421 !! input
7422 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
7423 !! result
7424 FoobarFoobar
7425 !! end
7427 !! test
7428 bug 22297: safesubst: works during normal parse
7429 !! input
7430 {{SafeSubstTest}}
7431 !! result
7432 <p>Foobar
7433 </p>
7434 !! end
7436 !! test:
7437 subst: does not work during normal parse
7438 !! input
7439 {{SubstTest}}
7440 !! result
7441 <p>{{subst:Includes}}
7442 </p>
7443 !! end
7445 !! test
7446 pre-save transform: context links ("pipe trick")
7447 !! options
7449 !! input
7450 [[Article (context)|]]
7451 [[Bar:Article|]]
7452 [[:Bar:Article|]]
7453 [[Bar:Article (context)|]]
7454 [[:Bar:Article (context)|]]
7455 [[|Article]]
7456 [[|Article (context)]]
7457 [[Bar:X (Y) Z|]]
7458 [[:Bar:X (Y) Z|]]
7459 !! result
7460 [[Article (context)|Article]]
7461 [[Bar:Article|Article]]
7462 [[:Bar:Article|Article]]
7463 [[Bar:Article (context)|Article]]
7464 [[:Bar:Article (context)|Article]]
7465 [[Article]]
7466 [[Article (context)]]
7467 [[Bar:X (Y) Z|X (Y) Z]]
7468 [[:Bar:X (Y) Z|X (Y) Z]]
7469 !! end
7471 !! test
7472 pre-save transform: context links ("pipe trick") with interwiki prefix
7473 !! options
7475 !! input
7476 [[interwiki:Article|]]
7477 [[:interwiki:Article|]]
7478 [[interwiki:Bar:Article|]]
7479 [[:interwiki:Bar:Article|]]
7480 !! result
7481 [[interwiki:Article|Article]]
7482 [[:interwiki:Article|Article]]
7483 [[interwiki:Bar:Article|Bar:Article]]
7484 [[:interwiki:Bar:Article|Bar:Article]]
7485 !! end
7487 !! test
7488 pre-save transform: context links ("pipe trick") with parens in title
7489 !! options
7490 pst title=[[Somearticle (context)]]
7491 !! input
7492 [[|Article]]
7493 !! result
7494 [[Article (context)|Article]]
7495 !! end
7497 !! test
7498 pre-save transform: context links ("pipe trick") with comma in title
7499 !! options
7500 pst title=[[Someplace, Somewhere]]
7501 !! input
7502 [[|Otherplace]]
7503 [[Otherplace, Elsewhere|]]
7504 [[Otherplace, Elsewhere, Anywhere|]]
7505 !! result
7506 [[Otherplace, Somewhere|Otherplace]]
7507 [[Otherplace, Elsewhere|Otherplace]]
7508 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
7509 !! end
7511 !! test
7512 pre-save transform: context links ("pipe trick") with parens and comma
7513 !! options
7514 pst title=[[Someplace (IGNORED), Somewhere]]
7515 !! input
7516 [[|Otherplace]]
7517 [[Otherplace (place), Elsewhere|]]
7518 !! result
7519 [[Otherplace, Somewhere|Otherplace]]
7520 [[Otherplace (place), Elsewhere|Otherplace]]
7521 !! end
7523 !! test
7524 pre-save transform: context links ("pipe trick") with comma and parens
7525 !! options
7526 pst title=[[Who, me? (context)]]
7527 !! input
7528 [[|Yes, you.]]
7529 [[Me, Myself, and I (1937 song)|]]
7530 !! result
7531 [[Yes, you. (context)|Yes, you.]]
7532 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7533 !! end
7535 !! test
7536 pre-save transform: context links ("pipe trick") with namespace
7537 !! options
7538 pst title=[[Ns:Somearticle]]
7539 !! input
7540 [[|Article]]
7541 !! result
7542 [[Ns:Article|Article]]
7543 !! end
7545 !! test
7546 pre-save transform: context links ("pipe trick") with namespace and parens
7547 !! options
7548 pst title=[[Ns:Somearticle (context)]]
7549 !! input
7550 [[|Article]]
7551 !! result
7552 [[Ns:Article (context)|Article]]
7553 !! end
7555 !! test
7556 pre-save transform: context links ("pipe trick") with namespace and comma
7557 !! options
7558 pst title=[[Ns:Somearticle, Context, Whatever]]
7559 !! input
7560 [[|Article]]
7561 !! result
7562 [[Ns:Article, Context, Whatever|Article]]
7563 !! end
7565 !! test
7566 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7567 !! options
7568 pst title=[[Ns:Somearticle, Context (context)]]
7569 !! input
7570 [[|Article]]
7571 !! result
7572 [[Ns:Article (context)|Article]]
7573 !! end
7575 !! test
7576 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7577 !! options
7578 pst title=[[Ns:Somearticle (IGNORED), Context]]
7579 !! input
7580 [[|Article]]
7581 !! result
7582 [[Ns:Article, Context|Article]]
7583 !! end
7585 !! test
7586 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7587 !! options
7589 !! input
7590 [[Article(context)|]]
7591 [[Bar:Article(context)|]]
7592 [[:Bar:Article(context)|]]
7593 [[|Article(context)]]
7594 [[Bar:X(Y)Z|]]
7595 [[:Bar:X(Y)Z|]]
7596 !! result
7597 [[Article(context)|Article]]
7598 [[Bar:Article(context)|Article]]
7599 [[:Bar:Article(context)|Article]]
7600 [[Article(context)]]
7601 [[Bar:X(Y)Z|X(Y)Z]]
7602 [[:Bar:X(Y)Z|X(Y)Z]]
7603 !! end
7605 !! test
7606 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7607 !! options
7609 !! input
7610 [[Article (context)|]]
7611 [[Bar:Article (context)|]]
7612 [[:Bar:Article (context)|]]
7613 [[|Article (context)]]
7614 [[Bar:X (Y) Z|]]
7615 [[:Bar:X (Y) Z|]]
7616 !! result
7617 [[Article (context)|Article]]
7618 [[Bar:Article (context)|Article]]
7619 [[:Bar:Article (context)|Article]]
7620 [[Article (context)]]
7621 [[Bar:X (Y) Z|X (Y) Z]]
7622 [[:Bar:X (Y) Z|X (Y) Z]]
7623 !! end
7625 !! test
7626 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7627 !! options
7629 !! input
7630 [[Article(context)|]]
7631 [[Bar:Article(context)|]]
7632 [[:Bar:Article(context)|]]
7633 [[|Article(context)]]
7634 [[Bar:X(Y)Z|]]
7635 [[:Bar:X(Y)Z|]]
7636 !! result
7637 [[Article(context)|Article]]
7638 [[Bar:Article(context)|Article]]
7639 [[:Bar:Article(context)|Article]]
7640 [[Article(context)]]
7641 [[Bar:X(Y)Z|X(Y)Z]]
7642 [[:Bar:X(Y)Z|X(Y)Z]]
7643 !! end
7645 !! test
7646 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7647 !! options
7649 !! input
7650 [[Article (context), context|]]
7651 [[Article (context),context|]]
7652 [[Bar:Article (context), context|]]
7653 [[Bar:Article (context),context|]]
7654 [[:Bar:Article (context), context|]]
7655 [[:Bar:Article (context),context|]]
7656 !! result
7657 [[Article (context), context|Article]]
7658 [[Article (context),context|Article]]
7659 [[Bar:Article (context), context|Article]]
7660 [[Bar:Article (context),context|Article]]
7661 [[:Bar:Article (context), context|Article]]
7662 [[:Bar:Article (context),context|Article]]
7663 !! end
7665 !! test
7666 pre-save transform: trim trailing empty lines
7667 !! options
7669 !! input
7670 Empty lines are trimmed
7675 !! result
7676 Empty lines are trimmed
7677 !! end
7679 !! test
7680 pre-save transform: Signature expansion
7681 !! options
7683 !! input
7684 * ~~~
7685 * <noinclude>~~~</noinclude>
7686 * <includeonly>~~~</includeonly>
7687 * <onlyinclude>~~~</onlyinclude>
7688 !! result
7689 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7690 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7691 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7692 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7693 !! end
7696 !! test
7697 pre-save transform: Signature expansion in nowiki tags (bug 93)
7698 !! options
7699 pst disabled
7700 !! input
7701 Shall not expand:
7703 <nowiki>~~~~</nowiki>
7705 <includeonly><nowiki>~~~~</nowiki></includeonly>
7707 <noinclude><nowiki>~~~~</nowiki></noinclude>
7709 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7711 {{subst:Foo}} shall be converted to FOO
7713 As well as inside noinclude/onlyinclude
7714 <noinclude>{{subst:Foo}}</noinclude>
7715 <onlyinclude>{{subst:Foo}}</onlyinclude>
7717 But not inside includeonly
7718 <includeonly>{{subst:Foo}}</includeonly>
7719 !! result
7720 Shall not expand:
7722 <nowiki>~~~~</nowiki>
7724 <includeonly><nowiki>~~~~</nowiki></includeonly>
7726 <noinclude><nowiki>~~~~</nowiki></noinclude>
7728 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7730 FOO shall be converted to FOO
7732 As well as inside noinclude/onlyinclude
7733 <noinclude>FOO</noinclude>
7734 <onlyinclude>FOO</onlyinclude>
7736 But not inside includeonly
7737 <includeonly>{{subst:Foo}}</includeonly>
7738 !! end
7741 ### Message transform tests
7743 !! test
7744 message transform: magic variables
7745 !! options
7747 !! input
7748 {{SITENAME}}
7749 !! result
7750 MediaWiki
7751 !! end
7753 !! test
7754 message transform: should not transform wiki markup
7755 !! options
7757 !! input
7758 ''test''
7759 !! result
7760 ''test''
7761 !! end
7763 !! test
7764 message transform: <noinclude> in transcluded template (bug 4926)
7765 !! options
7767 !! input
7768 {{Includes}}
7769 !! result
7770 Foobar
7771 !! end
7773 !! test
7774 message transform: <onlyinclude> in transcluded template (bug 4926)
7775 !! options
7777 !! input
7778 {{Includes2}}
7779 !! result
7781 !! end
7783 !! test
7784 {{#special:}} page name, known
7785 !! options
7787 !! input
7788 {{#special:Recentchanges}}
7789 !! result
7790 Special:RecentChanges
7791 !! end
7793 !! test
7794 {{#special:}} page name with subpage, known
7795 !! options
7797 !! input
7798 {{#special:Recentchanges/param}}
7799 !! result
7800 Special:RecentChanges/param
7801 !! end
7803 !! test
7804 {{#special:}} page name, unknown
7805 !! options
7807 !! input
7808 {{#special:foobar nonexistent}}
7809 !! result
7810 Special:Foobar nonexistent
7811 !! end
7813 !! test
7814 {{#speciale:}} page name, known
7815 !! options
7817 !! input
7818 {{#speciale:Recentchanges}}
7819 !! result
7820 Special:RecentChanges
7821 !! end
7823 !! test
7824 {{#speciale:}} page name with subpage, known
7825 !! options
7827 !! input
7828 {{#speciale:Recentchanges/param}}
7829 !! result
7830 Special:RecentChanges/param
7831 !! end
7833 !! test
7834 {{#speciale:}} page name, unknown
7835 !! options
7837 !! input
7838 {{#speciale:foobar nonexistent}}
7839 !! result
7840 Special:Foobar_nonexistent
7841 !! end
7844 ### Images
7846 !! test
7847 Simple image
7848 !! input
7849 [[Image:foobar.jpg]]
7850 !! result
7851 <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>
7852 </p>
7853 !! end
7855 !! test
7856 Right-aligned image
7857 !! input
7858 [[Image:foobar.jpg|right]]
7859 !! result
7860 <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>
7862 !! end
7864 !! test
7865 Simple image (using File: namespace, now canonical)
7866 !! input
7867 [[File:foobar.jpg]]
7868 !! result
7869 <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>
7870 </p>
7871 !! end
7873 !! test
7874 Image with caption
7875 !! input
7876 [[Image:foobar.jpg|right|Caption text]]
7877 !! result
7878 <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>
7880 !! end
7882 !! test
7883 Image with empty attribute
7884 !! input
7885 [[Image:foobar.jpg|right||Caption text]]
7886 !! result
7887 <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>
7889 !! end
7891 !! test
7892 Image with attributes from template.
7893 !! input
7894 [[Image:foobar.jpg|{{image_attribs}}]]
7895 !! result
7896 <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>
7898 !! end
7900 !! test
7901 Image with link tails
7902 !! input
7903 123[[Image:foobar.jpg]]456
7904 123[[Image:foobar.jpg|right]]456
7905 123[[Image:foobar.jpg|thumb]]456
7906 !! result
7907 <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
7908 </p>
7909 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
7910 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
7912 !! end
7914 !! test
7915 Image with multiple captions -- only last one is accepted
7916 !! input
7917 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7918 !! result
7919 <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>
7921 !! end
7923 !! test
7924 Image with width attribute at different positions
7925 !! input
7926 [[Image:foobar.jpg|200px|right|Caption]]
7927 [[Image:foobar.jpg|right|200px|Caption]]
7928 [[Image:foobar.jpg|right|Caption|200px]]
7929 !! result
7930 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" 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>
7931 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" 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>
7932 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" 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>
7934 !! end
7936 !! test
7937 Image with link parameter, wiki target
7938 !! input
7939 [[Image:foobar.jpg|link=Target page]]
7940 !! result
7941 <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>
7942 </p>
7943 !! end
7945 !! test
7946 Image with link parameter, URL target
7947 !! input
7948 [[Image:foobar.jpg|link=http://example.com/]]
7949 !! result
7950 <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>
7951 </p>
7952 !! end
7954 !! test
7955 Image with link parameter, wgExternalLinkTarget
7956 !! input
7957 [[Image:foobar.jpg|link=http://example.com/]]
7958 !! config
7959 wgExternalLinkTarget='foobar'
7960 !! result
7961 <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>
7962 </p>
7963 !! end
7965 !! test
7966 Image with link parameter, wgNoFollowLinks set to false
7967 !! input
7968 [[Image:foobar.jpg|link=http://example.com/]]
7969 !! config
7970 wgNoFollowLinks=false
7971 !! result
7972 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7973 </p>
7974 !! end
7976 !! test
7977 Image with link parameter, wgNoFollowDomainExceptions
7978 !! input
7979 [[Image:foobar.jpg|link=http://example.com/]]
7980 !! config
7981 wgNoFollowDomainExceptions='example.com'
7982 !! result
7983 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7984 </p>
7985 !! end
7987 !! test
7988 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7989 !! input
7990 [[Image:foobar.jpg|link=http://example.com/|Title]]
7991 !! config
7992 wgExternalLinkTarget='foobar'
7993 !! result
7994 <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>
7995 </p>
7996 !! end
7998 !! test
7999 Image with empty link parameter
8000 !! input
8001 [[Image:foobar.jpg|link=]]
8002 !! result
8003 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
8004 </p>
8005 !! end
8007 !! test
8008 Image with link parameter (wiki target) and unnamed parameter
8009 !! input
8010 [[Image:foobar.jpg|link=Target page|Title]]
8011 !! result
8012 <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>
8013 </p>
8014 !! end
8016 !! test
8017 Image with link parameter (URL target) and unnamed parameter
8018 !! input
8019 [[Image:foobar.jpg|link=http://example.com/|Title]]
8020 !! result
8021 <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>
8022 </p>
8023 !! end
8025 !! test
8026 Thumbnail image with link parameter
8027 !! options
8029 !! input
8030 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
8031 !! result
8032 <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>
8034 !! end
8036 !! test
8037 Manually-specified thumbnail image
8038 !! options
8040 !! input
8041 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
8042 !! result
8043 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></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>
8045 !! end
8047 !! test
8048 Manually-specified thumbnail image with explicit link to wiki page
8049 !! options
8051 !! input
8052 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
8053 !! result
8054 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></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>
8056 !! end
8058 !! test
8059 Manually-specified thumbnail image with explicit link to url
8060 !! options
8062 !! input
8063 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
8064 !! result
8065 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="http://example.com"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></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>
8067 !! end
8069 !! test
8070 Manually-specified thumbnail image with explicit no link
8071 !! options
8073 !! input
8074 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
8075 !! result
8076 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" />  <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>
8078 !! end
8080 !! test
8081 Manually-specified thumbnail image with explicit link and alt text
8082 !! options
8084 !! input
8085 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
8086 !! result
8087 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></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>
8089 !! end
8091 !! test
8092 Image with frame and link
8093 !! input
8094 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
8095 !! result
8096 <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>
8098 !! end
8100 !! test
8101 Image with frame and link and explicit alt
8102 !! input
8103 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
8104 !! result
8105 <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>
8107 !! end
8109 !! test
8110 Image with wiki markup in implicit alt
8111 !! input
8112 [[Image:Foobar.jpg|testing '''bold''' in alt]]
8113 !! result
8114 <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>
8115 </p>
8116 !! end
8118 !! test
8119 Image with wiki markup in explicit alt
8120 !! input
8121 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
8122 !! result
8123 <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>
8124 </p>
8125 !! end
8127 !! test
8128 Link to image page- image page normally doesn't exists, hence edit link
8129 Add test with existing image page
8130 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
8131 !! input
8132 [[:Image:test]]
8133 !! result
8134 <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>
8135 </p>
8136 !! end
8138 !! test
8139 bug 18784  Link to non-existent image page with caption should use caption as link text
8140 !! input
8141 [[:Image:test|caption]]
8142 !! result
8143 <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>
8144 </p>
8145 !! end
8147 !! test
8148 Frameless image caption with a free URL
8149 !! input
8150 [[Image:foobar.jpg|http://example.com]]
8151 !! result
8152 <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>
8153 </p>
8154 !! end
8156 !! test
8157 Thumbnail image caption with a free URL
8158 !! input
8159 [[Image:foobar.jpg|thumb|http://example.com]]
8160 !! result
8161 <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>
8163 !! end
8165 !! test
8166 Thumbnail image caption with a free URL and explicit alt
8167 !! input
8168 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
8169 !! result
8170 <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>
8172 !! end
8174 !! test
8175 SVG thumbnails with no language set
8176 !! options
8177 !! input
8178 [[File:Foobar.svg|thumb|width=200]]
8179 !! result
8180 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="180" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>width=200</div></div></div>
8182 !! end
8184 !! test
8185 SVG thumbnails with language de
8186 !! options
8187 !! input
8188 [[File:Foobar.svg|thumb|width=200|lang=de]]
8189 !! result
8190 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=File:Foobar.svg&amp;lang=de" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/langde-180px-Foobar.svg.png" width="180" height="180" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langde-270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/langde-360px-Foobar.svg.png 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>width=200</div></div></div>
8192 !! end
8194 !! test
8195 SVG thumbnails with invalid language code
8196 !! options
8197 !! input
8198 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
8199 !! result
8200 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="180" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>lang=invalid.language.code</div></div></div>
8202 !! end
8204 !! test
8205 BUG 1887: A ISBN with a thumbnail
8206 !! input
8207 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
8208 !! result
8209 <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>
8211 !! end
8213 !! test
8214 BUG 1887: A RFC with a thumbnail
8215 !! input
8216 [[Image:foobar.jpg|thumb|This is RFC 12354]]
8217 !! result
8218 <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" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
8220 !! end
8222 !! test
8223 BUG 1887: A mailto link with a thumbnail
8224 !! input
8225 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
8226 !! result
8227 <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>
8229 !! end
8231 # Pending resolution to bug 368
8232 !! test
8233 BUG 648: Frameless image caption with a link
8234 !! input
8235 [[Image:foobar.jpg|text with a [[link]] in it]]
8236 !! result
8237 <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>
8238 </p>
8239 !! end
8241 !! test
8242 BUG 648: Frameless image caption with a link (suffix)
8243 !! input
8244 [[Image:foobar.jpg|text with a [[link]]foo in it]]
8245 !! result
8246 <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>
8247 </p>
8248 !! end
8250 !! test
8251 BUG 648: Frameless image caption with an interwiki link
8252 !! input
8253 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
8254 !! result
8255 <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>
8256 </p>
8257 !! end
8259 !! test
8260 BUG 648: Frameless image caption with a piped interwiki link
8261 !! input
8262 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
8263 !! result
8264 <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>
8265 </p>
8266 !! end
8268 !! test
8269 Escape HTML special chars in image alt text
8270 !! input
8271 [[Image:foobar.jpg|& < > "]]
8272 !! result
8273 <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>
8274 </p>
8275 !! end
8277 !! test
8278 BUG 499: Alt text should have &#1234;, not &amp;1234;
8279 !! input
8280 [[Image:foobar.jpg|&#9792;]]
8281 !! result
8282 <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>
8283 </p>
8284 !! end
8286 !! test
8287 Broken image caption with link
8288 !! input
8289 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
8290 !! result
8291 <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.
8292 </p>
8293 !! end
8295 !! test
8296 Image caption containing another image
8297 !! input
8298 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
8299 !! result
8300 <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>
8302 !! end
8304 !! test
8305 Image caption containing a newline
8306 !! input
8307 [[Image:Foobar.jpg|This
8308 *is some text]]
8309 !! result
8310 <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>
8311 </p>
8312 !!end
8314 !!test
8315 Parsoid: Image caption containing leading space
8316 (The leading space should not trigger nowiki escaping in wt2wt mode)
8317 !! input
8318 [[Image:Foobar.jpg|thumb| bar]]
8319 !! result
8320 <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>bar</div></div></div>
8322 !!end
8324 !! test
8325 Bug 3090: External links other than http: in image captions
8326 !! input
8327 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
8328 !! result
8329 <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>
8331 !! end
8333 !! test
8334 Custom class
8335 !! input
8336 [[Image:foobar.jpg|a|class=b]]
8337 !! result
8338 <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>
8339 </p>
8340 !! end
8342 !! test
8343 Localized image handling (1).
8344 !! options
8345 language=es
8346 !! input
8347 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
8348 !! result
8349 <div class="floatleft"><a href="/wiki/Foo" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
8351 !! end
8353 !! test
8354 Localized image handling (2).
8355 !! options
8356 language=es
8357 !! input
8358 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
8359 !! result
8360 <div class="thumb tleft"><div class="thumbinner" style="width:182px;"><a href="/wiki/Foo" title="Foo"><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/Archivo:Foobar.jpg" class="internal" title="Aumentar"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
8362 !! end
8364 !! test
8365 "border", "frameless" and "class" attributes on an image.
8366 !! input
8367 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
8368 !! result
8369 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="extra thumbborder" 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>
8370 </p>
8371 !! end
8373 !! article
8374 File:Barfoo.jpg
8375 !! text
8376 #REDIRECT [[File:Barfoo.jpg]]
8377 !! endarticle
8379 !! test
8380 Redirected image
8381 !! input
8382 [[Image:Barfoo.jpg]]
8383 !! result
8384 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
8385 </p>
8386 !! end
8388 !! test
8389 Missing image with uploads disabled
8390 !! options
8391 wgEnableUploads=0
8392 !! input
8393 [[Image:Foobaz.jpg]]
8394 !! result
8395 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
8396 </p>
8397 !! end
8399 # Parsoid-specific testing for images
8400 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8401 # Currently imperfect due to a flaw in the Parsoid testrunner
8402 # Work in progress
8404 !! test
8405 Parsoid-specific image handling - simple image
8406 !! options
8407 parsoid
8408 !! input
8409 [[Image:Foobar.jpg]]
8410 !! result
8412 <span class="mw-default-size" typeof="mw:Image">
8413 <a href="File:Foobar.jpg">
8414 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8415 </a>
8416 </span>
8417 </p>
8418 !! end
8420 !! test
8421 Parsoid-specific image handling - simple image without link
8422 !! options
8423 parsoid
8424 !! input
8425 [[Image:Foobar.jpg|link=]]
8426 !! result
8428 <span class="mw-default-size" typeof="mw:Image">
8429 <span>
8430 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8431 </span>
8432 </span>
8433 </p>
8434 !! end
8436 !! test
8437 Parsoid-specific image handling - simple image with specific link
8438 !! options
8439 parsoid
8440 !! input
8441 [[Image:Foobar.jpg|link=Main Page]]
8442 !! result
8444 <span class="mw-default-size" typeof="mw:Image">
8445 <a href="Main_Page">
8446 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8447 </a>
8448 </span>
8449 </p>
8450 !! end
8452 !! test
8453 Parsoid-specific image handling - simple image with size and middle alignment
8454 !! options
8455 parsoid
8456 !! input
8457 [[Image:Foobar.jpg|50px|middle]]
8458 !! result
8460 <span class="mw-valign-middle" typeof="mw:Image">
8461 <a href="File:Foobar.jpg">
8462 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8463 </a>
8464 </span>
8465 </p>
8466 !! end
8468 !! test
8469 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
8470 !! options
8471 parsoid
8472 !! input
8473 [[Image:Foobar.jpg|500x10px|baseline|caption]]
8474 !! result
8476 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8477 <a href="File:Foobar.jpg">
8478 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
8479 </a>
8480 </span>
8481 </p>
8482 !! end
8484 !! test
8485 Parsoid-specific image handling - simple image with border and size spec
8486 !! options
8487 parsoid
8488 !! input
8489 [[Image:Foobar.jpg|50px|border|caption]]
8490 !! result
8492 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8493 <a href="File:Foobar.jpg">
8494 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8495 </a>
8496 </span>
8497 </p>
8498 !! end
8500 !! test
8501 Parsoid-specific image handling - thumbnail with halign, valign, and caption
8502 !! options
8503 parsoid
8504 !! input
8505 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
8506 !! result
8507 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
8508 <a href="File:Foobar.jpg">
8509 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
8510 </a>
8511 <figcaption>caption content</figcaption>
8512 </figure>
8513 !! end
8515 !! test
8516 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
8517 !! options
8518 parsoid
8519 !! input
8520 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
8521 !! result
8522 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
8523 <a href="File:Foobar.jpg">
8524 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
8525 </a>
8526 <figcaption>caption</figcaption>
8527 </figure>
8528 !! end
8530 !! test
8531 Parsoid-specific image handling - framed image with specific size and caption
8532 !! options
8533 parsoid
8534 !! input
8535 [[Image:Foobar.jpg|500x50px|frame|caption]]
8536 !! result
8537 <figure typeof="mw:Image/Frame">
8538 <a href="File:Foobar.jpg">
8539 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8540 </a>
8541 <figcaption>caption</figcaption>
8542 </figure>
8543 !! end
8545 !! test
8546 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
8547 !! options
8548 parsoid
8549 !! input
8550 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
8551 !! result
8552 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
8553 <a href="File:Foobar.jpg">
8554 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8555 </a>
8556 <figcaption>caption</figcaption>
8557 </figure>
8558 !! end
8560 !! test
8561 Parsoid-specific image handling - frameless image with specific size, border, and caption
8562 !! options
8563 parsoid
8564 !! input
8565 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
8566 !! result
8568 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8569 <a href="File:Foobar.jpg">
8570 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8571 </a>
8572 </p>
8573 !! end
8575 #!! test
8576 #Parsoid-specific image handling - simple image with a formatted caption
8577 #!! options
8578 #parsoid
8579 #!! input
8580 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
8581 #!! result
8582 #<p>
8583 #<span typeof="mw:Image">
8584 #<a class="mw-default-size" href="Image:Foobar.jpg">
8585 #<img alt="Foobar.jpg" class="mw-default-size" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8586 #</a>
8587 #<span>abc</span>
8588 #</span>
8589 #</p>
8593 ### Subpages
8595 !! article
8596 Subpage test/subpage
8597 !! text
8599 !! endarticle
8601 !! test
8602 Subpage link
8603 !! options
8604 subpage title=[[Subpage test]]
8605 !! input
8606 [[/subpage]]
8607 !! result
8608 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
8609 </p>
8610 !! end
8612 !! test
8613 Subpage noslash link
8614 !! options
8615 subpage title=[[Subpage test]]
8616 !!input
8617 [[/subpage/]]
8618 !! result
8619 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
8620 </p>
8621 !! end
8623 # TODO: make this PHP-parser compatible!
8624 !! test
8625 Relative subpage noslash link
8626 !! options
8627 parsoid=wt2wt,wt2html,html2html
8628 subpage title=[[Subpage test/1/2/3/4]]
8629 !!input
8630 [[../../subpage/]]
8632 [[../../subpage]]
8633 !! result
8634 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
8635 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
8636 !! end
8638 # TODO: make this PHP-parser compatible!
8639 !! test
8640 Parsoid: dot-slash prefixed wikilinks
8641 !! options
8642 parsoid=wt2wt,wt2html,html2html
8643 !!input
8644 [[./foo]]
8646 [[././bar]]
8648 [[././baz/]]
8649 !! result
8650 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
8651 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
8652 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
8653 !! end
8655 !! test
8656 Disabled subpages
8657 !! input
8658 [[/subpage]]
8659 !! result
8660 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
8661 </p>
8662 !! end
8664 !! test
8665 BUG 561: {{/Subpage}}
8666 !! options
8667 subpage title=[[Page]]
8668 !! input
8669 {{/Subpage}}
8670 !! result
8671 <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>
8672 </p>
8673 !! end
8676 ### Categories
8678 !! article
8679 Category:MediaWiki User's Guide
8680 !! text
8681 blah
8682 !! endarticle
8684 !! test
8685 Link to category
8686 !! input
8687 [[:Category:MediaWiki User's Guide]]
8688 !! result
8689 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
8690 </p>
8691 !! end
8693 !! test
8694 Simple category
8695 !! options
8697 !! input
8698 [[Category:MediaWiki User's Guide]]
8699 !! result
8700 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8701 !! end
8703 !! test
8704 PAGESINCATEGORY invalid title fatal (r33546 fix)
8705 !! input
8706 {{PAGESINCATEGORY:<bogus>}}
8707 !! result
8708 <p>0
8709 </p>
8710 !! end
8712 !! test
8713 Category with different sort key
8714 !! options
8716 !! input
8717 [[Category:MediaWiki User's Guide|Foo]]
8718 !! result
8719 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8720 !! end
8722 !! test
8723 Category with identical sort key
8724 !! options
8726 !! input
8727 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8728 !! result
8729 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8730 !! end
8732 !! test
8733 Category with empty sort key
8734 !! options
8737 !! input
8738 [[Category:MediaWiki User's Guide|]]
8739 !! result
8740 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8741 !! end
8743 !! test
8744 Category with empty sort key and parentheses
8745 !! options
8748 !! input
8749 [[Category:Foo (bar)|]]
8750 !! result
8751 [[Category:Foo (bar)|Foo]]
8752 !! end
8754 !! test
8755 Category with link tail
8756 !! options
8759 !! input
8760 123[[Category:Foo]]456
8761 !! result
8762 123[[Category:Foo]]456
8763 !! end
8765 !! test
8766 Category with template
8767 !! options
8770 !! input
8771 [[Category:{{echo|Foo}}]]
8772 !! result
8773 [[Category:{{echo|Foo}}]]
8774 !! end
8776 !! test
8777 Category with template in sort key
8778 !! options
8781 !! input
8782 [[Category:Foo|{{echo|Bar}}]]
8783 !! result
8784 [[Category:Foo|{{echo|Bar}}]]
8785 !! end
8787 !! test
8788 Category with template in sort key and title
8789 !! options
8792 !! input
8793 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8794 !! result
8795 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8796 !! end
8798 !! test
8799 Category / paragraph interactions
8800 !! input
8801 Foo [[Category:Baz]] Bar
8803 Foo [[Category:Baz]]
8807 [[Category:Baz]]
8811 [[Category:Baz]] Bar
8814 [[Category:Baz]]
8815  [[Category:Baz]]
8816 [[Category:Baz]]
8819 [[Category:Baz]]
8820  [[Category:Baz]]
8821 [[Category:Baz]]
8823 [[Category:Baz]]
8824  {{echo|[[Category:Baz]]}}
8825 [[Category:Baz]]
8826 !! result
8827 <p>Foo Bar
8828 </p><p>Foo
8830 </p><p>Foo
8832 </p><p>Foo Bar
8833 </p><p>Foo
8835 </p>
8836 !! end
8838 !! test
8839 Parsoid: Serialize link to category page with colon escape
8840 !! options
8841 parsoid
8842 !! input
8844 [[:Category:Foo]]
8845 [[:Category:Foo|Bar]]
8846 !! result
8848 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
8849 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
8850 </p>
8851 !! end
8853 !! test
8854 Parsoid: Link prefix/suffixes aren't applied to category links
8855 !! options
8856 parsoid=wt2html,wt2wt,html2html
8857 language=is
8858 !! input
8859 x[[Category:Foo]]y
8860 !! result
8861 <p>x<link rel="mw:WikiLink/Category" href="Category:Foo">y</p>
8862 !! end
8864 !! test
8865 Parsoid: Serialize link to file page with colon escape
8866 !! options
8867 parsoid
8868 !! input
8870 [[:File:Foo.png]]
8871 [[:File:Foo.png|Bar]]
8872 !! result
8874 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
8875 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
8876 </p>
8877 !! end
8879 !! test
8880 Parsoid: Serialize a genuine category link without colon escape
8881 !! options
8882 parsoid
8883 !! input
8884 [[Category:Foo]]
8885 [[Category:Foo|Bar]]
8886 !! result
8887 <link rel="mw:WikiLink/Category" href="Category:Foo">
8888 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
8889 !! end
8892 ### Inter-language links
8894 !! test
8895 Inter-language links
8896 !! options
8898 !! input
8899 [[es:Alimento]]
8900 [[fr:Nourriture]]
8901 [[zh:&#39135;&#21697;]]
8902 !! result
8903 es:Alimento fr:Nourriture zh:食品
8904 !! end
8906 !! test
8907 Duplicate interlanguage links (bug 24502)
8908 !! options
8910 !! input
8911 [[es:1]]
8912 [[es:2]]
8913 [[fr:1]]
8914 [[fr:2]]
8915 !! result
8916 es:1 fr:1
8917 !! end
8920 ### Sections
8922 !! test
8923 Basic section headings
8924 !! input
8925 == Headline 1 ==
8926 Some text
8928 ==Headline 2==
8929 More
8930 ===Smaller headline===
8931 Blah blah
8932 !! result
8933 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8934 <p>Some text
8935 </p>
8936 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8937 <p>More
8938 </p>
8939 <h3><span class="mw-headline" id="Smaller_headline">Smaller headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
8940 <p>Blah blah
8941 </p>
8942 !! end
8944 !! test
8945 Section headings with TOC
8946 !! input
8947 == Headline 1 ==
8948 === Subheadline 1 ===
8949 ===== Skipping a level =====
8950 ====== Skipping a level ======
8952 == Headline 2 ==
8953 Some text
8954 ===Another headline===
8955 !! result
8956 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8957 <ul>
8958 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
8959 <ul>
8960 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
8961 <ul>
8962 <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>
8963 <ul>
8964 <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>
8965 </ul>
8966 </li>
8967 </ul>
8968 </li>
8969 </ul>
8970 </li>
8971 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
8972 <ul>
8973 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
8974 </ul>
8975 </li>
8976 </ul>
8977 </div>
8978 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8979 <h3><span class="mw-headline" id="Subheadline_1">Subheadline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
8980 <h5><span class="mw-headline" id="Skipping_a_level">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
8981 <h6><span class="mw-headline" id="Skipping_a_level_2">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
8982 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8983 <p>Some text
8984 </p>
8985 <h3><span class="mw-headline" id="Another_headline">Another headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
8987 !! end
8989 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
8990 !! test
8991 Handling of sections up to level 6 and beyond
8992 !! input
8993 = Level 1 Heading=
8994 == Level 2 Heading==
8995 === Level 3 Heading===
8996 ==== Level 4 Heading====
8997 ===== Level 5 Heading=====
8998 ====== Level 6 Heading======
8999 ======= Level 7 Heading=======
9000 ======== Level 8 Heading========
9001 ========= Level 9 Heading=========
9002 ========== Level 10 Heading==========
9003 !! result
9004 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9005 <ul>
9006 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
9007 <ul>
9008 <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>
9009 <ul>
9010 <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>
9011 <ul>
9012 <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>
9013 <ul>
9014 <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>
9015 <ul>
9016 <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>
9017 <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>
9018 <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>
9019 <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>
9020 <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>
9021 </ul>
9022 </li>
9023 </ul>
9024 </li>
9025 </ul>
9026 </li>
9027 </ul>
9028 </li>
9029 </ul>
9030 </li>
9031 </ul>
9032 </div>
9033 <h1><span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
9034 <h2><span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9035 <h3><span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9036 <h4><span class="mw-headline" id="Level_4_Heading">Level 4 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
9037 <h5><span class="mw-headline" id="Level_5_Heading">Level 5 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
9038 <h6><span class="mw-headline" id="Level_6_Heading">Level 6 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
9039 <h6><span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
9040 <h6><span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
9041 <h6><span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
9042 <h6><span class="mw-headline" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D">==== Level 10 Heading====</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
9044 !! end
9046 !! test
9047 TOC regression (bug 9764)
9048 !! input
9049 == title 1 ==
9050 === title 1.1 ===
9051 ==== title 1.1.1 ====
9052 === title 1.2 ===
9053 == title 2 ==
9054 === title 2.1 ===
9055 !! result
9056 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9057 <ul>
9058 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9059 <ul>
9060 <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>
9061 <ul>
9062 <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>
9063 </ul>
9064 </li>
9065 <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>
9066 </ul>
9067 </li>
9068 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9069 <ul>
9070 <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>
9071 </ul>
9072 </li>
9073 </ul>
9074 </div>
9075 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9076 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9077 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
9078 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9079 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9080 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9082 !! end
9084 !! test
9085 TOC with wgMaxTocLevel=3 (bug 6204)
9086 !! options
9087 wgMaxTocLevel=3
9088 !! input
9089 == title 1 ==
9090 === title 1.1 ===
9091 ==== title 1.1.1 ====
9092 === title 1.2 ===
9093 == title 2 ==
9094 === title 2.1 ===
9095 !! result
9096 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9097 <ul>
9098 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9099 <ul>
9100 <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>
9101 <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>
9102 </ul>
9103 </li>
9104 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9105 <ul>
9106 <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>
9107 </ul>
9108 </li>
9109 </ul>
9110 </div>
9111 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9112 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9113 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
9114 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9115 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9116 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9118 !! end
9120 !! test
9121 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
9122 !! options
9123 wgMaxTocLevel=3
9124 !! input
9125 ==Section 1==
9126 ===Section 1.1===
9127 ====Section 1.1.1====
9128 ====Section 1.1.1.1====
9129 ==Section 2==
9130 !! result
9131 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9132 <ul>
9133 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
9134 <ul>
9135 <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>
9136 </ul>
9137 </li>
9138 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
9139 </ul>
9140 </div>
9141 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9142 <h3><span class="mw-headline" id="Section_1.1">Section 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9143 <h4><span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
9144 <h4><span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 1.1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
9145 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9147 !! end
9150 !! test
9151 Resolving duplicate section names
9152 !! input
9153 == Foo bar ==
9154 == Foo bar ==
9155 !! result
9156 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9157 <h2><span class="mw-headline" id="Foo_bar_2">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9159 !! end
9161 !! test
9162 Resolving duplicate section names with differing case (bug 10721)
9163 !! input
9164 == Foo bar ==
9165 == Foo Bar ==
9166 !! result
9167 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9168 <h2><span class="mw-headline" id="Foo_Bar_2">Foo Bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9170 !! end
9172 !! article
9173 Template:sections
9174 !! text
9175 ===Section 1===
9176 ==Section 2==
9177 !! endarticle
9179 !! test
9180 Template with sections, __NOTOC__
9181 !! input
9182 __NOTOC__
9183 ==Section 0==
9184 {{sections}}
9185 ==Section 4==
9186 !! result
9187 <h2><span class="mw-headline" id="Section_0">Section 0</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9188 <h3><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9189 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9190 <h2><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9192 !! end
9194 !! test
9195 __NOEDITSECTION__ keyword
9196 !! input
9197 __NOEDITSECTION__
9198 ==Section 1==
9199 ==Section 2==
9200 !! result
9201 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
9202 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
9204 !! end
9206 !! test
9207 Link inside a section heading
9208 !! input
9209 ==Section with a [[Main Page|link]] in it==
9210 !! result
9211 <h2><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><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><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 class="mw-editsection-bracket">]</span></span></h2>
9213 !! end
9215 !! test
9216 TOC regression (bug 12077)
9217 !! input
9218 __TOC__
9219 == title 1 ==
9220 === title 1.1 ===
9221 == title 2 ==
9222 !! result
9223 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9224 <ul>
9225 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9226 <ul>
9227 <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>
9228 </ul>
9229 </li>
9230 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
9231 </ul>
9232 </div>
9233 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9234 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9235 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9237 !! end
9239 !! test
9240 BUG 1219 URL next to image (good)
9241 !! input
9242 http://example.com [[Image:foobar.jpg]]
9243 !! result
9244 <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>
9245 </p>
9246 !!end
9248 !! test
9249 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
9250 !! input
9251 === 
9252 The line above must have a trailing space!
9253 === <!--
9254 --> <!-- -->
9255 But just in case it doesn't...
9256 !! result
9257 <h1><span class="mw-headline" id=".3D">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
9258 <p>The line above must have a trailing space!
9259 </p>
9260 <h1><span class="mw-headline" id=".3D_2">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
9261 <p>But just in case it doesn't...
9262 </p>
9263 !! end
9265 !! test
9266 Header with special characters (bug 25462)
9267 !! input
9268 The tooltips shall not show entities to the user (ie. be double escaped)
9270 == text > text ==
9271 section 1
9273 == text < text ==
9274 section 2
9276 == text & text ==
9277 section 3
9279 == text ' text ==
9280 section 4
9282 == text " text ==
9283 section 5
9284 !! result
9285 <p>The tooltips shall not show entities to the user (ie. be double escaped)
9286 </p>
9287 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9288 <ul>
9289 <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>
9290 <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>
9291 <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>
9292 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
9293 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
9294 </ul>
9295 </div>
9296 <h2><span class="mw-headline" id="text_.3E_text">text &gt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text > text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9297 <p>section 1
9298 </p>
9299 <h2><span class="mw-headline" id="text_.3C_text">text &lt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9300 <p>section 2
9301 </p>
9302 <h2><span class="mw-headline" id="text_.26_text">text &amp; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9303 <p>section 3
9304 </p>
9305 <h2><span class="mw-headline" id="text_.27_text">text ' text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9306 <p>section 4
9307 </p>
9308 <h2><span class="mw-headline" id="text_.22_text">text " text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9309 <p>section 5
9310 </p>
9311 !! end
9313 !! test
9314 Headers with excess '=' characters
9315 (Are similar tests necessary beyond the 1st level?)
9316 !! input
9317 =foo==
9318 ==foo=
9319 =''italic'' heading==
9320 ==''italic'' heading=
9321 !! result
9322 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9323 <ul>
9324 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
9325 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
9326 <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>
9327 <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>
9328 </ul>
9329 </div>
9330 <h1><span class="mw-headline" id="foo.3D">foo=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
9331 <h1><span class="mw-headline" id=".3Dfoo">=foo</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
9332 <h1><span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
9333 <h1><span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
9335 !! end
9337 !! test
9338 HTML headers vs TOC (bug 23393)
9339 (__NOEDITSECTION__ for clearer output, doesn't matter here)
9340 !! input
9341 <h1>Header 1</h1>
9342 == Header 1.1 ==
9343 == Header 1.2 ==
9345 <h1>Header 2
9346 </h1>
9347 == Header 2.1 ==
9348 == Header 2.2 ==
9349 __NOEDITSECTION__
9350 !! result
9351 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9352 <ul>
9353 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
9354 <ul>
9355 <li class="toclevel-2 tocsection-1"><a href="#Header_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Header 1.1</span></a></li>
9356 <li class="toclevel-2 tocsection-2"><a href="#Header_1.2"><span class="tocnumber">1.2</span> <span class="toctext">Header 1.2</span></a></li>
9357 </ul>
9358 </li>
9359 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
9360 <ul>
9361 <li class="toclevel-2 tocsection-3"><a href="#Header_2.1"><span class="tocnumber">2.1</span> <span class="toctext">Header 2.1</span></a></li>
9362 <li class="toclevel-2 tocsection-4"><a href="#Header_2.2"><span class="tocnumber">2.2</span> <span class="toctext">Header 2.2</span></a></li>
9363 </ul>
9364 </li>
9365 </ul>
9366 </div>
9367 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
9368 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
9369 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
9370 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
9371 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
9372 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
9374 !! end
9376 !! test
9377 BUG 1219 URL next to image (broken)
9378 !! input
9379 http://example.com[[Image:foobar.jpg]]
9380 !! result
9381 <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>
9382 </p>
9383 !!end
9385 !! test
9386 Bug 1186 news: in the middle of text
9387 !! input
9388 http://en.wikinews.org/wiki/Wikinews:Workplace
9389 !! result
9390 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
9391 </p>
9392 !!end
9395 !! test
9396 Namespaced link must have a title
9397 !! input
9398 [[Project:]]
9399 !! result
9400 <p>[[Project:]]
9401 </p>
9402 !!end
9404 !! test
9405 Namespaced link must have a title (bad fragment version)
9406 !! input
9407 [[Project:#fragment]]
9408 !! result
9409 <p>[[Project:#fragment]]
9410 </p>
9411 !!end
9415 ### HTML tags and HTML attributes
9418 !! test
9419 div with no attributes
9420 !! input
9421 <div>HTML rocks</div>
9422 !! result
9423 <div>HTML rocks</div>
9425 !! end
9427 !! test
9428 div with double-quoted attribute
9429 !! input
9430 <div id="rock">HTML rocks</div>
9431 !! result
9432 <div id="rock">HTML rocks</div>
9434 !! end
9436 !! test
9437 div with single-quoted attribute
9438 !! input
9439 <div id='rock'>HTML rocks</div>
9440 !! result
9441 <div id="rock">HTML rocks</div>
9443 !! end
9445 !! test
9446 div with unquoted attribute
9447 !! input
9448 <div id=rock>HTML rocks</div>
9449 !! result
9450 <div id="rock">HTML rocks</div>
9452 !! end
9454 !! test
9455 div with illegal double attributes
9456 !! input
9457 <div id="a" id="b">HTML rocks</div>
9458 !! result
9459 <div id="b">HTML rocks</div>
9461 !!end
9463 # FIXME: produce empty string instead of "class" in the PHP parser, following
9464 # the HTML5 spec.
9465 !! test
9466 div with empty attribute value, space before equals
9467 !! options
9468 parsoid
9469 !! input
9470 <div class =>HTML rocks</div>
9471 !! result
9472 <div class="">HTML rocks</div>
9474 !! end
9476 # The PHP parser escapes the opening brace to &#123; for some reason, so
9477 # disabled this test for it.
9478 !! test
9479 div with braces in attribute value
9480 !! options
9481 parsoid
9482 !! input
9483 <div title="{}">Foo</div>
9484 !! result
9485 <div title="{}">Foo</div>
9486 !! end
9488 # This it very inconsistent in the PHP parser: it returns 
9489 # class="class" if there is a space between the name and the equal sign (see
9490 # 'div with empty attribute value, space before equals'), but strips the
9491 # attribute completely if the space is missing. We hope that not much content
9492 # depends on this, so are implementing the behavior below in Parsoid for
9493 # consistencies' sake. Disabled for the PHP parser. 
9494 # FIXME: fix this behavior in the PHP parser?
9495 !! test
9496 div with empty attribute value, no space before equals
9497 !! options
9498 parsoid
9499 !! input
9500 <div class=>HTML rocks</div>
9501 !! result
9502 <div class="">HTML rocks</div>
9504 !! end
9506 !! test
9507 HTML multiple attributes correction
9508 !! input
9509 <p class="error" class="awesome">Awesome!</p>
9510 !! result
9511 <p class="awesome">Awesome!</p>
9513 !!end
9515 !! test
9516 Table multiple attributes correction
9517 !! input
9519 !+ class="error" class="awesome"| status
9521 !! result
9522 <table>
9523 <tr>
9524 <th class="awesome"> status
9525 </th></tr></table>
9527 !!end
9529 !! test
9530 DIV IN UPPERCASE
9531 !! input
9532 <DIV ID="x">HTML ROCKS</DIV>
9533 !! result
9534 <div id="x">HTML ROCKS</div>
9536 !!end
9538 !! test
9539 Non-ASCII pseudo-tags are rendered as text
9540 !! input
9541 <khyô>
9542 !! result
9543 <p>&lt;khyô&gt;
9544 </p>
9545 !! end
9547 !! test
9548 Pseudo-tag with URL 'name' renders as url link
9549 !! input
9550 <http://example.com/>
9551 !! result
9552 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
9553 </p>
9554 !! end
9556 !! test
9557 text with amp in the middle of nowhere
9558 !! input
9559 Remember AT&T?
9560 !!result
9561 <p>Remember AT&amp;T?
9562 </p>
9563 !! end
9565 !! test
9566 text with character entity: eacute
9567 !! input
9568 I always thought &eacute; was a cute letter.
9569 !! result
9570 <p>I always thought &#233; was a cute letter.
9571 </p>
9572 !! end
9574 !! test
9575 text with entity-escaped character entity-like string: eacute
9576 !! input
9577 I always thought &amp;eacute; was a cute letter.
9578 !! result
9579 <p>I always thought &amp;eacute; was a cute letter.
9580 </p>
9581 !! end
9583 !! test
9584 text with undefined character entity: xacute
9585 !! input
9586 I always thought &xacute; was a cute letter.
9587 !! result
9588 <p>I always thought &amp;xacute; was a cute letter.
9589 </p>
9590 !! end
9594 ### Nesting tests (see bug 41545, 50604, 51081)
9597 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
9598 # Note that html2wt is considerably more difficult if we use <b> in
9599 # the test case, instead of <big>
9600 !! test
9601 Ensure that HTML adoption agency algorithm is properly implemented.
9602 !! input
9603 <big>X<big>Y</big>Z</big>
9604 !! result
9605 <p><big>X<big>Y</big>Z</big>
9606 </p>
9607 !! end
9609 # This was bug 41545 in the PHP parser.
9610 !! test
9611 Nesting of <kbd>
9612 !! input
9613 <kbd>X<kbd>Y</kbd>Z</kbd>
9614 !! result
9615 <p><kbd>X<kbd>Y</kbd>Z</kbd>
9616 </p>
9617 !! end
9619 # The following cases were bug 51081 in the PHP parser.
9620 # Note that there are some other nestable tags (b, i, etc) which are
9621 # not covered; see bug 51081 for discussion.
9622 !! test
9623 Nesting of <em>
9624 !! input
9625 <em>X<em>Y</em>Z</em>
9626 !! result
9627 <p><em>X<em>Y</em>Z</em>
9628 </p>
9629 !! end
9631 !! test
9632 Nesting of <strong>
9633 !! input
9634 <strong>X<strong>Y</strong>Z</strong>
9635 !! result
9636 <p><strong>X<strong>Y</strong>Z</strong>
9637 </p>
9638 !! end
9640 !! test
9641 Nesting of <q>
9642 !! input
9643 <q>X<q>Y</q>Z</q>
9644 !! result
9645 <p><q>X<q>Y</q>Z</q>
9646 </p>
9647 !! end
9649 !! test
9650 Nesting of <ruby>
9651 !! input
9652 <ruby>X<ruby>Y</ruby>Z</ruby>
9653 !! result
9654 <p><ruby>X<ruby>Y</ruby>Z</ruby>
9655 </p>
9656 !! end
9658 !! test
9659 Nesting of <bdo>
9660 !! input
9661 <bdo>X<bdo>Y</bdo>Z</bdo>
9662 !! result
9663 <p><bdo>X<bdo>Y</bdo>Z</bdo>
9664 </p>
9665 !! end
9669 ### Media links
9672 !! test
9673 Media link
9674 !! input
9675 [[Media:Foobar.jpg]]
9676 !! result
9677 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
9678 </p>
9679 !! end
9681 !! test
9682 Media link with text
9683 !! input
9684 [[Media:Foobar.jpg|A neat file to look at]]
9685 !! result
9686 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
9687 </p>
9688 !! end
9690 # FIXME: this is still bad HTML tag nesting
9691 !! test
9692 Media link with nasty text
9693 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
9694 !! input
9695 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
9696 !! result
9697 <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>
9699 !! end
9701 !! test
9702 Media link to nonexistent file (bug 1702)
9703 !! input
9704 [[Media:No such.jpg]]
9705 !! result
9706 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
9707 </p>
9708 !! end
9710 !! test
9711 Image link to nonexistent file (bug 1850 - good)
9712 !! input
9713 [[Image:No such.jpg]]
9714 !! result
9715 <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>
9716 </p>
9717 !! end
9719 !! test
9720 :Image link to nonexistent file (bug 1850 - bad)
9721 !! input
9722 [[:Image:No such.jpg]]
9723 !! result
9724 <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>
9725 </p>
9726 !! end
9730 !! test
9731 Character reference normalization in link text (bug 1938)
9732 !! input
9733 [[Main Page|this&that]]
9734 !! result
9735 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
9736 </p>
9737 !!end
9739 !! article
9740 אַ
9741 !! text
9742 Test for unicode normalization
9744 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
9745 !! endarticle
9747 !! test
9748 (bug 19451) Links should refer to the normalized form.
9749 !! input
9750 [[&#xFB2E;]]
9751 [[&#x5d0;&#x5b7;]]
9752 [[&#x5d0;ַ]]
9753 [[א&#x5b7;]]
9754 [[אַ]]
9755 !! result
9756 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
9757 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
9758 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
9759 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
9760 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
9761 </p>
9762 !! end
9764 !! test
9765 Empty attribute crash test (bug 2067)
9766 !! input
9767 <font color="">foo</font>
9768 !! result
9769 <p><font color="">foo</font>
9770 </p>
9771 !! end
9773 !! test
9774 Empty attribute crash test single-quotes (bug 2067)
9775 !! input
9776 <font color=''>foo</font>
9777 !! result
9778 <p><font color="">foo</font>
9779 </p>
9780 !! end
9782 !! test
9783 Attribute test: equals, then nothing
9784 !! input
9785 <font color=>foo</font>
9786 !! result
9787 <p><font>foo</font>
9788 </p>
9789 !! end
9791 !! test
9792 Attribute test: unquoted value
9793 !! input
9794 <font color=x>foo</font>
9795 !! result
9796 <p><font color="x">foo</font>
9797 </p>
9798 !! end
9800 !! test
9801 Attribute test: unquoted but illegal value (hash)
9802 !! input
9803 <font color=#x>foo</font>
9804 !! result
9805 <p><font color="#x">foo</font>
9806 </p>
9807 !! end
9809 !! test
9810 Attribute test: no value
9811 !! input
9812 <font color>foo</font>
9813 !! result
9814 <p><font color="color">foo</font>
9815 </p>
9816 !! end
9818 !! test
9819 Bug 2095: link with three closing brackets
9820 !! input
9821 [[Main Page]]]
9822 !! result
9823 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
9824 </p>
9825 !! end
9827 !! test
9828 Bug 2095: link with pipe and three closing brackets
9829 !! input
9830 [[Main Page|link]]]
9831 !! result
9832 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
9833 </p>
9834 !! end
9836 !! test
9837 Bug 2095: link with pipe and three closing brackets, version 2
9838 !! input
9839 [[Main Page|[http://example.com/]]]
9840 !! result
9841 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
9842 </p>
9843 !! end
9847 ### Safety
9850 !! article
9851 Template:Dangerous attribute
9852 !! text
9853 " onmouseover="alert(document.cookie)
9854 !! endarticle
9856 !! article
9857 Template:Dangerous style attribute
9858 !! text
9859 border-size: expression(alert(document.cookie))
9860 !! endarticle
9862 !! article
9863 Template:Div style
9864 !! text
9865 <div style="float: right; {{{1}}}">Magic div</div>
9866 !! endarticle
9868 !! test
9869 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
9870 !! input
9871 <div title="{{test}}"></div>
9872 !! result
9873 <div title="This is a test template"></div>
9875 !! end
9877 !! test
9878 Bug 2304: HTML attribute safety (dangerous template; 2309)
9879 !! input
9880 <div title="{{dangerous attribute}}"></div>
9881 !! result
9882 <div title=""></div>
9884 !! end
9886 !! test
9887 Bug 2304: HTML attribute safety (dangerous style template; 2309)
9888 !! input
9889 <div style="{{dangerous style attribute}}"></div>
9890 !! result
9891 <div style="/* insecure input */"></div>
9893 !! end
9895 !! test
9896 Bug 2304: HTML attribute safety (safe parameter; 2309)
9897 !! input
9898 {{div style|width: 200px}}
9899 !! result
9900 <div style="float: right; width: 200px">Magic div</div>
9902 !! end
9904 !! test
9905 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
9906 !! input
9907 {{div style|width: expression(alert(document.cookie))}}
9908 !! result
9909 <div style="/* insecure input */">Magic div</div>
9911 !! end
9913 !! test
9914 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
9915 !! input
9916 {{div style|"><script>alert(document.cookie)</script>}}
9917 !! result
9918 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9920 !! end
9922 !! test
9923 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
9924 !! input
9925 {{div style|" ><script>alert(document.cookie)</script>}}
9926 !! result
9927 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9929 !! end
9931 !! test
9932 Bug 2304: HTML attribute safety (link)
9933 !! input
9934 <div title="[[Main Page]]"></div>
9935 !! result
9936 <div title="&#91;&#91;Main Page]]"></div>
9938 !! end
9940 !! test
9941 Bug 2304: HTML attribute safety (italics)
9942 !! input
9943 <div title="''foobar''"></div>
9944 !! result
9945 <div title="&#39;&#39;foobar&#39;&#39;"></div>
9947 !! end
9949 !! test
9950 Bug 2304: HTML attribute safety (bold)
9951 !! input
9952 <div title="'''foobar'''"></div>
9953 !! result
9954 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
9956 !! end
9959 !! test
9960 Bug 2304: HTML attribute safety (ISBN)
9961 !! input
9962 <div title="ISBN 1234567890"></div>
9963 !! result
9964 <div title="&#73;SBN 1234567890"></div>
9966 !! end
9968 !! test
9969 Bug 2304: HTML attribute safety (RFC)
9970 !! input
9971 <div title="RFC 1234"></div>
9972 !! result
9973 <div title="&#82;FC 1234"></div>
9975 !! end
9977 !! test
9978 Bug 2304: HTML attribute safety (PMID)
9979 !! input
9980 <div title="PMID 1234567890"></div>
9981 !! result
9982 <div title="&#80;MID 1234567890"></div>
9984 !! end
9986 !! test
9987 Bug 2304: HTML attribute safety (web link)
9988 !! input
9989 <div title="http://example.com/"></div>
9990 !! result
9991 <div title="http&#58;//example.com/"></div>
9993 !! end
9995 !! test
9996 Bug 2304: HTML attribute safety (named web link)
9997 !! input
9998 <div title="[http://example.com/ link]"></div>
9999 !! result
10000 <div title="&#91;http&#58;//example.com/ link]"></div>
10002 !! end
10004 !! test
10005 Bug 3244: HTML attribute safety (extension; safe)
10006 !! input
10007 <div style="<nowiki>background:blue</nowiki>"></div>
10008 !! result
10009 <div style="background:blue"></div>
10011 !! end
10013 !! test
10014 Bug 3244: HTML attribute safety (extension; unsafe)
10015 !! input
10016 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
10017 !! result
10018 <div style="/* insecure input */"></div>
10020 !! end
10022 # More MSIE fun discovered by Tom Gilder
10024 !! test
10025 MSIE CSS safety test: spurious slash
10026 !! input
10027 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
10028 !! result
10029 <div style="/* insecure input */">evil</div>
10031 !! end
10033 !! test
10034 MSIE CSS safety test: hex code
10035 !! input
10036 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
10037 !! result
10038 <div style="/* insecure input */">evil</div>
10040 !! end
10042 !! test
10043 MSIE CSS safety test: comment in url
10044 !! input
10045 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
10046 !! result
10047 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
10049 !! end
10051 !! test
10052 MSIE CSS safety test: comment in expression
10053 !! input
10054 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
10055 !! result
10056 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
10058 !! end
10061 !! test
10062 Table attribute legitimate extension
10063 !! input
10065 !+ style="<nowiki>color:blue</nowiki>"| status
10067 !! result
10068 <table>
10069 <tr>
10070 <th style="color:blue"> status
10071 </th></tr></table>
10073 !!end
10075 !! test
10076 Table attribute safety
10077 !! input
10079 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
10081 !! result
10082 <table>
10083 <tr>
10084 <th style="/* insecure input */"> status
10085 </th></tr></table>
10087 !! end
10089 !! test
10090 CSS line continuation 1
10091 !! input
10092 <div style="background-image: u\&#10;rl(test.jpg);"></div>
10093 !! result
10094 <div style="/* insecure input */"></div>
10096 !! end
10098 !! test
10099 CSS line continuation 2
10100 !! input
10101 <div style="background-image: u\&#13;rl(test.jpg); "></div>
10102 !! result
10103 <div style="/* insecure input */"></div>
10105 !! end
10107 !! article
10108 Template:Identity
10109 !! text
10110 {{{1}}}
10111 !! endarticle
10113 !! test
10114 Expansion of multi-line templates in attribute values (bug 6255)
10115 !! input
10116 <div style="background: {{identity|#00FF00}}">-</div>
10117 !! result
10118 <div style="background: #00FF00">-</div>
10120 !! end
10123 !! test
10124 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
10125 !! input
10126 <div style="background: 
10127 #00FF00">-</div>
10128 !! result
10129 <div style="background: #00FF00">-</div>
10131 !! end
10133 !! test
10134 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
10135 !! input
10136 <div style="background: &#10;#00FF00">-</div>
10137 !! result
10138 <div style="background: &#10;#00FF00">-</div>
10140 !! end
10143 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
10145 !! test
10146 Parser hook: empty input
10147 !! input
10148 <tag></tag>
10149 !! result
10150 <pre>
10152 array (
10154 </pre>
10156 !! end
10158 !! test
10159 Parser hook: empty input using terminated empty elements
10160 !! input
10161 <tag/>
10162 !! result
10163 <pre>
10164 NULL
10165 array (
10167 </pre>
10169 !! end
10171 !! test
10172 Parser hook: empty input using terminated empty elements (space before)
10173 !! input
10174 <tag />
10175 !! result
10176 <pre>
10177 NULL
10178 array (
10180 </pre>
10182 !! end
10184 !! test
10185 Parser hook: basic input
10186 !! input
10187 <tag>input</tag>
10188 !! result
10189 <pre>
10190 'input'
10191 array (
10193 </pre>
10195 !! end
10198 !! test
10199 Parser hook: case insensitive
10200 !! input
10201 <TAG>input</TAG>
10202 !! result
10203 <pre>
10204 'input'
10205 array (
10207 </pre>
10209 !! end
10212 !! test
10213 Parser hook: case insensitive, redux
10214 !! input
10215 <TaG>input</TAg>
10216 !! result
10217 <pre>
10218 'input'
10219 array (
10221 </pre>
10223 !! end
10225 !! test
10226 Parser hook: nested tags
10227 !! options
10228 noxml
10229 !! input
10230 <tag><tag></tag></tag>
10231 !! result
10232 <pre>
10233 '<tag>'
10234 array (
10236 </pre>&lt;/tag&gt;
10238 !! end
10240 !! test
10241 Parser hook: basic arguments
10242 !! input
10243 <tag width=200 height = "100" depth = '50' square></tag>
10244 !! result
10245 <pre>
10247 array (
10248   'width' => '200',
10249   'height' => '100',
10250   'depth' => '50',
10251   'square' => 'square',
10253 </pre>
10255 !! end
10257 !! test
10258 Parser hook: argument containing a forward slash (bug 5344)
10259 !! input
10260 <tag filename='/tmp/bla'></tag>
10261 !! result
10262 <pre>
10264 array (
10265   'filename' => '/tmp/bla',
10267 </pre>
10269 !! end
10271 !! test
10272 Parser hook: empty input using terminated empty elements (bug 2374)
10273 !! input
10274 <tag foo=bar/>text
10275 !! result
10276 <pre>
10277 NULL
10278 array (
10279   'foo' => 'bar',
10281 </pre>text
10283 !! end
10285 # </tag> should be output literally since there is no matching tag that begins it
10286 !! test
10287 Parser hook: basic arguments using terminated empty elements (bug 2374)
10288 !! input
10289 <tag width=200 height = "100" depth = '50' square/>
10290 other stuff
10291 </tag>
10292 !! result
10293 <pre>
10294 NULL
10295 array (
10296   'width' => '200',
10297   'height' => '100',
10298   'depth' => '50',
10299   'square' => 'square',
10301 </pre>
10302 <p>other stuff
10303 &lt;/tag&gt;
10304 </p>
10305 !! end
10308 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
10311 !! test
10312 Parser hook: static parser hook not inside a comment
10313 !! input
10314 <statictag>hello, world</statictag>
10315 <statictag action=flush/>
10316 !! result
10317 <p>hello, world
10318 </p>
10319 !! end
10322 !! test
10323 Parser hook: static parser hook inside a comment
10324 !! input
10325 <!-- <statictag>hello, world</statictag> -->
10326 <statictag action=flush/>
10327 !! result
10328 <p><br />
10329 </p>
10330 !! end
10332 # Nested template calls; this case was broken by Parser.php rev 1.506,
10333 # since reverted.
10335 !! article
10336 Template:One-parameter
10337 !! text
10338 (My parameter is: {{{1}}})
10339 !! endarticle
10341 !! article
10342 Template:Map-one-parameter
10343 !! text
10344 {{{{{1}}}|{{{2}}}}}
10345 !! endarticle
10347 !! test
10348 Nested template calls
10349 !! input
10350 {{Map-one-parameter|One-parameter|param}}
10351 !! result
10352 <p>(My parameter is: param)
10353 </p>
10354 !! end
10358 ### Sanitizer
10360 !! test
10361 Sanitizer: Closing of open tags
10362 !! input
10363 <s></s><table></table>
10364 !! result
10365 <s></s><table></table>
10367 !! end
10369 !! test
10370 Sanitizer: Closing of open but not closed tags
10371 !! input
10372 <s>foo
10373 !! result
10374 <p><s>foo</s>
10375 </p>
10376 !! end
10378 !! test
10379 Sanitizer: Closing of closed but not open tags
10380 !! input
10381 </s>
10382 !! result
10383 <p>&lt;/s&gt;
10384 </p>
10385 !! end
10387 !! test
10388 Sanitizer: Closing of closed but not open table tags
10389 !! input
10390 Table not started</td></tr></table>
10391 !! result
10392 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
10393 </p>
10394 !! end
10396 !! test
10397 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
10398 !! input
10399 <span id="æ: v">byte</span>[[#æ: v|backlink]]
10400 !! result
10401 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
10402 </p>
10403 !! end
10405 !! test
10406 Sanitizer: Validating the contents of the id attribute (bug 4515)
10407 !! options
10408 disabled
10409 !! input
10410 <br id=9 />
10411 !! result
10412 Something, but definitely not <br id="9" />...
10413 !! end
10415 !! test
10416 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
10417 !! options
10418 disabled
10419 !! input
10420 <br id="foo" /><br id="foo" />
10421 !! result
10422 Something need to be done. foo-2 ? 
10423 !! end
10425 !! test
10426 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
10427 !! input
10428 <div itemscope>
10429         <meta itemprop="hello" content="world">
10430         <meta http-equiv="refresh" content="5">
10431         <meta itemprop="hello" http-equiv="refresh" content="5">
10432         <link itemprop="hello" href="{{SERVER}}">
10433         <link rel="stylesheet" href="{{SERVER}}">
10434         <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
10435 </div>
10436 !! result
10437 <div itemscope="itemscope">
10438 <p>     <meta itemprop="hello" content="world" />
10439         &lt;meta http-equiv="refresh" content="5"&gt;
10440         <meta itemprop="hello" content="5" />
10441 </p>
10442         <link itemprop="hello" href="http&#58;//example.org" />
10443         &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
10444         <link itemprop="hello" href="http&#58;//example.org" />
10445 </div>
10447 !! end
10449 !! test
10450 Language converter: output gets cut off unexpectedly (bug 5757)
10451 !! options
10452 language=zh
10453 !! input
10454 this bit is safe: }-
10456 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
10458 then we get cut off here: }-
10460 all additional text is vanished
10461 !! result
10462 <p>this bit is safe: }-
10463 </p><p>but if we add a conversion instance: xxx
10464 </p><p>then we get cut off here: }-
10465 </p><p>all additional text is vanished
10466 </p>
10467 !! end
10469 !! test
10470 Self closed html pairs (bug 5487)
10471 !! options
10472 !! input
10473 <center><font id="bug" />Centered text</center>
10474 <div><font id="bug2" />In div text</div>
10475 !! result
10476 <center>&lt;font id="bug" /&gt;Centered text</center>
10477 <div>&lt;font id="bug2" /&gt;In div text</div>
10479 !! end
10485 !! test
10486 Punctuation: nbsp before exclamation
10487 !! input
10488 C'est grave !
10489 !! result
10490 <p>C'est grave&#160;!
10491 </p>
10492 !! end
10494 !! test
10495 Punctuation: CSS !important (bug 11874)
10496 !! input
10497 <div style="width:50% !important">important</div>
10498 !! result
10499 <div style="width:50% !important">important</div>
10501 !!end
10503 !! test
10504 Punctuation: CSS ! important (bug 11874; with space after)
10505 !! input
10506 <div style="width:50% ! important">important</div>
10507 !! result
10508 <div style="width:50% ! important">important</div>
10510 !!end
10513 !! test
10514 HTML bullet list, closed tags (bug 5497)
10515 !! input
10516 <ul>
10517 <li>One</li>
10518 <li>Two</li>
10519 </ul>
10520 !! result
10521 <ul>
10522 <li>One</li>
10523 <li>Two</li>
10524 </ul>
10526 !! end
10528 !! test
10529 HTML bullet list, unclosed tags (bug 5497)
10530 !! options
10531 disabled
10532 !! input
10533 <ul>
10534 <li>One
10535 <li>Two
10536 </ul>
10537 !! result
10538 <ul>
10539 <li>One
10540 </li><li>Two
10541 </li></ul>
10543 !! end
10545 !! test
10546 HTML ordered list, closed tags (bug 5497)
10547 !! input
10548 <ol>
10549 <li>One</li>
10550 <li>Two</li>
10551 </ol>
10552 !! result
10553 <ol>
10554 <li>One</li>
10555 <li>Two</li>
10556 </ol>
10558 !! end
10560 !! test
10561 HTML ordered list, unclosed tags (bug 5497)
10562 !! options
10563 disabled
10564 !! input
10565 <ol>
10566 <li>One
10567 <li>Two
10568 </ol>
10569 !! result
10570 <ol>
10571 <li>One
10572 </li><li>Two
10573 </li></ol>
10575 !! end
10577 !! test
10578 HTML nested bullet list, closed tags (bug 5497)
10579 !! input
10580 <ul>
10581 <li>One</li>
10582 <li>Two:
10583 <ul>
10584 <li>Sub-one</li>
10585 <li>Sub-two</li>
10586 </ul>
10587 </li>
10588 </ul>
10589 !! result
10590 <ul>
10591 <li>One</li>
10592 <li>Two:
10593 <ul>
10594 <li>Sub-one</li>
10595 <li>Sub-two</li>
10596 </ul>
10597 </li>
10598 </ul>
10600 !! end
10602 !! test
10603 HTML nested bullet list, open tags (bug 5497)
10604 !! options
10605 disabled
10606 !! input
10607 <ul>
10608 <li>One
10609 <li>Two:
10610 <ul>
10611 <li>Sub-one
10612 <li>Sub-two
10613 </ul>
10614 </ul>
10615 !! result
10616 <ul>
10617 <li>One
10618 </li><li>Two:
10619 <ul>
10620 <li>Sub-one
10621 </li><li>Sub-two
10622 </li></ul>
10623 </li></ul>
10625 !! end
10627 !! test
10628 HTML nested ordered list, closed tags (bug 5497)
10629 !! input
10630 <ol>
10631 <li>One</li>
10632 <li>Two:
10633 <ol>
10634 <li>Sub-one</li>
10635 <li>Sub-two</li>
10636 </ol>
10637 </li>
10638 </ol>
10639 !! result
10640 <ol>
10641 <li>One</li>
10642 <li>Two:
10643 <ol>
10644 <li>Sub-one</li>
10645 <li>Sub-two</li>
10646 </ol>
10647 </li>
10648 </ol>
10650 !! end
10652 !! test
10653 HTML nested ordered list, open tags (bug 5497)
10654 !! options
10655 disabled
10656 !! input
10657 <ol>
10658 <li>One
10659 <li>Two:
10660 <ol>
10661 <li>Sub-one
10662 <li>Sub-two
10663 </ol>
10664 </ol>
10665 !! result
10666 <ol>
10667 <li>One
10668 </li><li>Two:
10669 <ol>
10670 <li>Sub-one
10671 </li><li>Sub-two
10672 </li></ol>
10673 </li></ol>
10675 !! end
10677 !! test
10678 HTML ordered list item with parameters oddity
10679 !! input
10680 <ol><li id="fragment">One</li></ol>
10681 !! result
10682 <ol><li id="fragment">One</li></ol>
10684 !! end
10686 !!test
10687 bug 5918: autonumbering
10688 !! input
10689 [http://first/] [http://second] [ftp://ftp]
10691 ftp://inlineftp
10693 [mailto:enclosed@mail.tld With target]
10695 [mailto:enclosed@mail.tld]
10697 mailto:inline@mail.tld
10698 !! result
10699 <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>
10700 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
10701 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
10702 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
10703 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
10704 </p>
10705 !! end
10709 # Security and HTML correctness
10710 # From Nick Jenkins' fuzz testing
10713 !! test
10714 Fuzz testing: Parser13
10715 !! input
10716 {| 
10717 | http://a|
10718 !! result
10719 <table>
10720 <tr>
10721 <td>
10722 </td>
10723 </tr>
10724 </table>
10726 !! end
10728 !! test
10729 Fuzz testing: Parser14
10730 !! input
10731 == onmouseover= ==
10732 http://__TOC__
10733 !! result
10734 <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
10735 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10736 <ul>
10737 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
10738 </ul>
10739 </div>
10741 !! end
10743 !! test
10744 Fuzz testing: Parser14-table
10745 !! input
10746 ==a==
10747 {| STYLE=__TOC__
10748 !! result
10749 <h2><span class="mw-headline" id="a">a</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
10750 <table style="&#95;_TOC&#95;_">
10751 <tr><td></td></tr>
10752 </table>
10754 !! end
10756 # Known to produce bogus xml (extra </td>)
10757 !! test
10758 Fuzz testing: Parser16
10759 !! options
10760 noxml
10761 !! input
10763 !https://||||||
10764 !! result
10765 <table>
10766 <tr>
10767 <th>https://</th>
10768 <th></th>
10769 <th></th>
10770 <th>
10771 </td>
10772 </tr>
10773 </table>
10775 !! end
10777 !! test
10778 Fuzz testing: Parser21
10779 !! input
10781 ! irc://{{ftp://a" onmouseover="alert('hello world');"
10783 !! result
10784 <table>
10785 <tr>
10786 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
10787 </th>
10788 <td>
10789 </td>
10790 </tr>
10791 </table>
10793 !! end
10795 !! test
10796 Fuzz testing: Parser22
10797 !! input
10798 http://===r:::https://b
10801 !!result
10802 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
10803 </p>
10804 <table>
10805 <tr><td></td></tr>
10806 </table>
10808 !! end
10810 # Known to produce bad XML for now
10811 !! test
10812 Fuzz testing: Parser24
10813 !! options
10814 noxml
10815 !! input
10817 {{{|
10818 <u CLASS=
10819 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
10820 <br style="onmouseover='alert(document.cookie);' " />
10822 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10824 !! result
10825 <table>
10826 {{{|
10827 <u class="&#124;">}}}} &gt;
10828 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
10830 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10831 <tr>
10832 <td></u>
10833 </td>
10834 </tr>
10835 </table>
10837 !! end
10839 # Note: the current result listed for this is not what the original one was,
10840 # but the original bug was JavaScript injection, which is fixed in any case.
10841 # It's not clear that the original result listed was any more correct than the
10842 # current one.  Original result:
10843 # <p>{{{| 
10844 # </p>
10845 # <li class="&#124;&#124;">
10846 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10847 !!test
10848 Fuzz testing: Parser25 (bug 6055)
10849 !! input
10852 <LI CLASS=||
10854 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
10855 !! result
10856 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10857 </p>
10858 !! end
10860 !!test
10861 Fuzz testing: URL adjacent extension (with space, clean)
10862 !! options
10863 !! input
10864 http://example.com <nowiki>junk</nowiki>
10865 !! result
10866 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
10867 </p>
10868 !!end
10870 !!test
10871 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
10872 !! options
10873 !! input
10874 http://example.com<nowiki>junk</nowiki>
10875 !! result
10876 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
10877 </p>
10878 !!end
10880 !!test
10881 Fuzz testing: URL adjacent extension (no space, dirty; pre)
10882 !! options
10883 !! input
10884 http://example.com<pre>junk</pre>
10885 !! result
10886 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
10888 !!end
10890 !!test
10891 Fuzz testing: image with bogus manual thumbnail
10892 !!input
10893 [[Image:foobar.jpg|thumbnail= ]]
10894 !!result
10895 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail:   <div class="thumbcaption"></div></div></div>
10897 !!end
10899 !! test
10900 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
10901 !! input
10902 <pre dir="&#10;"></pre>
10903 !! result
10904 <pre dir="&#10;"></pre>
10906 !! end
10908 !! test
10909 Parsing optional HTML elements (Bug 6171)
10910 !! options
10911 !! input
10912 <table>
10913   <tr>
10914     <td> Some tabular data</td>
10915     <td> More tabular data ...
10916     <td> And yet som tabular data</td>
10917   </tr>
10918 </table>
10919 !! result
10920 <table>
10921   <tr>
10922     <td> Some tabular data</td>
10923     <td> More tabular data ...
10924     </td><td> And yet som tabular data</td>
10925   </tr>
10926 </table>
10928 !! end
10930 !! test
10931 Correct handling of <td>, <tr> (Bug 6171)
10932 !! options
10933 !! input
10934 <table>
10935   <tr>
10936     <td> Some tabular data</td>
10937     <td> More tabular data ...</td>
10938     <td> And yet som tabular data</td>
10939   </tr>
10940 </table>
10941 !! result
10942 <table>
10943   <tr>
10944     <td> Some tabular data</td>
10945     <td> More tabular data ...</td>
10946     <td> And yet som tabular data</td>
10947   </tr>
10948 </table>
10950 !! end
10953 !! test
10954 Parsing crashing regression (fr:JavaScript)
10955 !! input
10956 </body></x>
10957 !! result
10958 <p>&lt;/body&gt;&lt;/x&gt;
10959 </p>
10960 !! end
10962 !! test
10963 Inline wiki vs wiki block nesting
10964 !! input
10965 '''Bold paragraph
10967 New wiki paragraph
10968 !! result
10969 <p><b>Bold paragraph</b>
10970 </p><p>New wiki paragraph
10971 </p>
10972 !! end
10974 !! test
10975 Inline HTML vs wiki block nesting
10976 !! options
10977 disabled
10978 !! input
10979 <b>Bold paragraph
10981 New wiki paragraph
10982 !! result
10983 <p><b>Bold paragraph</b>
10984 </p><p>New wiki paragraph
10985 </p>
10986 !! end
10988 # Original result was this:
10989 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10990 # </p>
10991 # While that might be marginally more intuitive, maybe, the six-apostrophe
10992 # construct is clearly pathological and the result stated here (which is what
10993 # the parser actually does) is about as reasonable as anything.
10994 !!test
10995 Mixing markup for italics and bold
10996 !! options
10997 !! input
10998 '''bold''''''bold''bolditalics'''''
10999 !! result
11000 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
11001 </p>
11002 !! end
11005 !! article
11006 Xyzzyx
11007 !! text
11008 Article for special page transclusion test
11009 !! endarticle
11011 !! test
11012 Special page transclusion
11013 !! options
11014 !! input
11015 {{Special:Prefixindex/Xyzzyx}}
11016 !! result
11017 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11019 !! end
11021 !! test
11022 Special page transclusion twice (bug 5021)
11023 !! options
11024 !! input
11025 {{Special:Prefixindex/Xyzzyx}}
11026 {{Special:Prefixindex/Xyzzyx}}
11027 !! result
11028 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11029 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11031 !! end
11033 !! test
11034 Transclusion of default MediaWiki message
11035 !! input
11036 {{MediaWiki:Mainpage}}
11037 !!result
11038 <p>Main Page
11039 </p>
11040 !! end
11042 !! test
11043 Transclusion of nonexistent MediaWiki message
11044 !! input
11045 {{MediaWiki:Mainpagexxx}}
11046 !!result
11047 <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>
11048 </p>
11049 !! end
11051 !! test
11052 Transclusion of MediaWiki message with underscore
11053 !! input
11054 {{MediaWiki:history_short}}
11055 !! result
11056 <p>History
11057 </p>
11058 !! end
11060 !! test
11061 Transclusion of MediaWiki message with space
11062 !! input
11063 {{MediaWiki:history short}}
11064 !! result
11065 <p>History
11066 </p>
11067 !! end
11069 !! test
11070 Invalid header with following text
11071 !! input
11072 = x = y
11073 !! result
11074 <p>= x = y
11075 </p>
11076 !! end
11079 !! test
11080 Section extraction test (section 0)
11081 !! options
11082 section=0
11083 !! input
11084 start
11085 ==a==
11086 ===aa===
11087 ====aaa====
11088 ==b==
11089 ===ba===
11090 ===bb===
11091 ====bba====
11092 ===bc===
11093 ==c==
11094 ===ca===
11095 !! result
11096 start
11097 !! end
11099 !! test
11100 Section extraction test (section 1)
11101 !! options
11102 section=1
11103 !! input
11104 start
11105 ==a==
11106 ===aa===
11107 ====aaa====
11108 ==b==
11109 ===ba===
11110 ===bb===
11111 ====bba====
11112 ===bc===
11113 ==c==
11114 ===ca===
11115 !! result
11116 ==a==
11117 ===aa===
11118 ====aaa====
11119 !! end
11121 !! test
11122 Section extraction test (section 2)
11123 !! options
11124 section=2
11125 !! input
11126 start
11127 ==a==
11128 ===aa===
11129 ====aaa====
11130 ==b==
11131 ===ba===
11132 ===bb===
11133 ====bba====
11134 ===bc===
11135 ==c==
11136 ===ca===
11137 !! result
11138 ===aa===
11139 ====aaa====
11140 !! end
11142 !! test
11143 Section extraction test (section 3)
11144 !! options
11145 section=3
11146 !! input
11147 start
11148 ==a==
11149 ===aa===
11150 ====aaa====
11151 ==b==
11152 ===ba===
11153 ===bb===
11154 ====bba====
11155 ===bc===
11156 ==c==
11157 ===ca===
11158 !! result
11159 ====aaa====
11160 !! end
11162 !! test
11163 Section extraction test (section 4)
11164 !! options
11165 section=4
11166 !! input
11167 start
11168 ==a==
11169 ===aa===
11170 ====aaa====
11171 ==b==
11172 ===ba===
11173 ===bb===
11174 ====bba====
11175 ===bc===
11176 ==c==
11177 ===ca===
11178 !! result
11179 ==b==
11180 ===ba===
11181 ===bb===
11182 ====bba====
11183 ===bc===
11184 !! end
11186 !! test
11187 Section extraction test (section 5)
11188 !! options
11189 section=5
11190 !! input
11191 start
11192 ==a==
11193 ===aa===
11194 ====aaa====
11195 ==b==
11196 ===ba===
11197 ===bb===
11198 ====bba====
11199 ===bc===
11200 ==c==
11201 ===ca===
11202 !! result
11203 ===ba===
11204 !! end
11206 !! test
11207 Section extraction test (section 6)
11208 !! options
11209 section=6
11210 !! input
11211 start
11212 ==a==
11213 ===aa===
11214 ====aaa====
11215 ==b==
11216 ===ba===
11217 ===bb===
11218 ====bba====
11219 ===bc===
11220 ==c==
11221 ===ca===
11222 !! result
11223 ===bb===
11224 ====bba====
11225 !! end
11227 !! test
11228 Section extraction test (section 7)
11229 !! options
11230 section=7
11231 !! input
11232 start
11233 ==a==
11234 ===aa===
11235 ====aaa====
11236 ==b==
11237 ===ba===
11238 ===bb===
11239 ====bba====
11240 ===bc===
11241 ==c==
11242 ===ca===
11243 !! result
11244 ====bba====
11245 !! end
11247 !! test
11248 Section extraction test (section 8)
11249 !! options
11250 section=8
11251 !! input
11252 start
11253 ==a==
11254 ===aa===
11255 ====aaa====
11256 ==b==
11257 ===ba===
11258 ===bb===
11259 ====bba====
11260 ===bc===
11261 ==c==
11262 ===ca===
11263 !! result
11264 ===bc===
11265 !! end
11267 !! test
11268 Section extraction test (section 9)
11269 !! options
11270 section=9
11271 !! input
11272 start
11273 ==a==
11274 ===aa===
11275 ====aaa====
11276 ==b==
11277 ===ba===
11278 ===bb===
11279 ====bba====
11280 ===bc===
11281 ==c==
11282 ===ca===
11283 !! result
11284 ==c==
11285 ===ca===
11286 !! end
11288 !! test
11289 Section extraction test (section 10)
11290 !! options
11291 section=10
11292 !! input
11293 start
11294 ==a==
11295 ===aa===
11296 ====aaa====
11297 ==b==
11298 ===ba===
11299 ===bb===
11300 ====bba====
11301 ===bc===
11302 ==c==
11303 ===ca===
11304 !! result
11305 ===ca===
11306 !! end
11308 !! test
11309 Section extraction test (nonexistent section 11)
11310 !! options
11311 section=11
11312 !! input
11313 start
11314 ==a==
11315 ===aa===
11316 ====aaa====
11317 ==b==
11318 ===ba===
11319 ===bb===
11320 ====bba====
11321 ===bc===
11322 ==c==
11323 ===ca===
11324 !! result
11325 !! end
11327 !! test
11328 Section extraction test with bogus heading (section 1)
11329 !! options
11330 section=1
11331 !! input
11332 ==a==
11333 ==bogus== not a legal section
11334 ==b==
11335 !! result
11336 ==a==
11337 ==bogus== not a legal section
11338 !! end
11340 !! test
11341 Section extraction test with bogus heading (section 2)
11342 !! options
11343 section=2
11344 !! input
11345 ==a==
11346 ==bogus== not a legal section
11347 ==b==
11348 !! result
11349 ==b==
11350 !! end
11352 !! test
11353 Section extraction test with comment after heading (section 1)
11354 !! options
11355 section=1
11356 !! input
11357 ==a==
11358 ==b== <!-- -->
11359 ==c==
11360 !! result
11361 ==a==
11362 !! end
11364 !! test
11365 Section extraction test with comment after heading (section 2)
11366 !! options
11367 section=2
11368 !! input
11369 ==a==
11370 ==b== <!-- -->
11371 ==c==
11372 !! result
11373 ==b== <!-- -->
11374 !! end
11376 !! test
11377 Section extraction test with bogus <nowiki> heading (section 1)
11378 !! options
11379 section=1
11380 !! input
11381 ==a==
11382 ==bogus== <nowiki>not a legal section</nowiki>
11383 ==b==
11384 !! result
11385 ==a==
11386 ==bogus== <nowiki>not a legal section</nowiki>
11387 !! end
11389 !! test
11390 Section extraction test with bogus <nowiki> heading (section 2)
11391 !! options
11392 section=2
11393 !! input
11394 ==a==
11395 ==bogus== <nowiki>not a legal section</nowiki>
11396 ==b==
11397 !! result
11398 ==b==
11399 !! end
11402 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
11403 # instead of respecting commented sections
11404 !! test
11405 Section extraction prefixed by comment (section 1)
11406 !! options
11407 section=1
11408 !! input
11409 <!-- -->==sec1==
11410 ==sec2==
11411 !!result
11412 ==sec2==
11413 !!end
11415 !! test
11416 Section extraction prefixed by comment (section 2)
11417 !! options
11418 section=2
11419 !! input
11420 <!-- -->==sec1==
11421 ==sec2==
11422 !!result
11424 !!end
11427 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
11428 # instead of respecting HTML-style headings
11429 !! test
11430 Section extraction, mixed wiki and html (section 1)
11431 !! options
11432 section=1
11433 !! input
11434 <h2>unmarked</h2>
11435 unmarked
11436 ==1==
11438 ==2==
11440 !! result
11441 ==1==
11443 !! end
11445 !! test
11446 Section extraction, mixed wiki and html (section 2)
11447 !! options
11448 section=2
11449 !! input
11450 <h2>unmarked</h2>
11451 unmarked
11452 ==1==
11454 ==2==
11456 !! result
11457 ==2==
11459 !! end
11462 # Formerly testing for bug 3342
11463 !! test
11464 Section extraction, heading surrounded by <noinclude>
11465 !! options
11466 section=1
11467 !! input
11468 <noinclude>==unmarked==</noinclude>
11469 ==marked==
11470 !! result
11471 ==marked==
11472 !!end
11474 # Test behavior of bug 19910
11475 !! test
11476 Sectiion with all-equals
11477 !! options
11478 section=2
11479 !! input
11480 === 
11481 The line above must have a trailing space
11482 === <!--
11483 --> <!-- -->
11484 But just in case it doesn't...
11485 !! result
11486 === <!--
11487 --> <!-- -->
11488 But just in case it doesn't...
11489 !! end
11491 !! test
11492 Section replacement test (section 0)
11493 !! options
11494 replace=0,"xxx"
11495 !! input
11496 start
11497 ==a==
11498 ===aa===
11499 ====aaa====
11500 ==b==
11501 ===ba===
11502 ===bb===
11503 ====bba====
11504 ===bc===
11505 ==c==
11506 ===ca===
11507 !! result
11510 ==a==
11511 ===aa===
11512 ====aaa====
11513 ==b==
11514 ===ba===
11515 ===bb===
11516 ====bba====
11517 ===bc===
11518 ==c==
11519 ===ca===
11520 !! end
11522 !! test
11523 Section replacement test (section 1)
11524 !! options
11525 replace=1,"xxx"
11526 !! input
11527 start
11528 ==a==
11529 ===aa===
11530 ====aaa====
11531 ==b==
11532 ===ba===
11533 ===bb===
11534 ====bba====
11535 ===bc===
11536 ==c==
11537 ===ca===
11538 !! result
11539 start
11542 ==b==
11543 ===ba===
11544 ===bb===
11545 ====bba====
11546 ===bc===
11547 ==c==
11548 ===ca===
11549 !! end
11551 !! test
11552 Section replacement test (section 2)
11553 !! options
11554 replace=2,"xxx"
11555 !! input
11556 start
11557 ==a==
11558 ===aa===
11559 ====aaa====
11560 ==b==
11561 ===ba===
11562 ===bb===
11563 ====bba====
11564 ===bc===
11565 ==c==
11566 ===ca===
11567 !! result
11568 start
11569 ==a==
11572 ==b==
11573 ===ba===
11574 ===bb===
11575 ====bba====
11576 ===bc===
11577 ==c==
11578 ===ca===
11579 !! end
11581 !! test
11582 Section replacement test (section 3)
11583 !! options
11584 replace=3,"xxx"
11585 !! input
11586 start
11587 ==a==
11588 ===aa===
11589 ====aaa====
11590 ==b==
11591 ===ba===
11592 ===bb===
11593 ====bba====
11594 ===bc===
11595 ==c==
11596 ===ca===
11597 !! result
11598 start
11599 ==a==
11600 ===aa===
11603 ==b==
11604 ===ba===
11605 ===bb===
11606 ====bba====
11607 ===bc===
11608 ==c==
11609 ===ca===
11610 !! end
11612 !! test
11613 Section replacement test (section 4)
11614 !! options
11615 replace=4,"xxx"
11616 !! input
11617 start
11618 ==a==
11619 ===aa===
11620 ====aaa====
11621 ==b==
11622 ===ba===
11623 ===bb===
11624 ====bba====
11625 ===bc===
11626 ==c==
11627 ===ca===
11628 !! result
11629 start
11630 ==a==
11631 ===aa===
11632 ====aaa====
11635 ==c==
11636 ===ca===
11637 !! end
11639 !! test
11640 Section replacement test (section 5)
11641 !! options
11642 replace=5,"xxx"
11643 !! input
11644 start
11645 ==a==
11646 ===aa===
11647 ====aaa====
11648 ==b==
11649 ===ba===
11650 ===bb===
11651 ====bba====
11652 ===bc===
11653 ==c==
11654 ===ca===
11655 !! result
11656 start
11657 ==a==
11658 ===aa===
11659 ====aaa====
11660 ==b==
11663 ===bb===
11664 ====bba====
11665 ===bc===
11666 ==c==
11667 ===ca===
11668 !! end
11670 !! test
11671 Section replacement test (section 6)
11672 !! options
11673 replace=6,"xxx"
11674 !! input
11675 start
11676 ==a==
11677 ===aa===
11678 ====aaa====
11679 ==b==
11680 ===ba===
11681 ===bb===
11682 ====bba====
11683 ===bc===
11684 ==c==
11685 ===ca===
11686 !! result
11687 start
11688 ==a==
11689 ===aa===
11690 ====aaa====
11691 ==b==
11692 ===ba===
11695 ===bc===
11696 ==c==
11697 ===ca===
11698 !! end
11700 !! test
11701 Section replacement test (section 7)
11702 !! options
11703 replace=7,"xxx"
11704 !! input
11705 start
11706 ==a==
11707 ===aa===
11708 ====aaa====
11709 ==b==
11710 ===ba===
11711 ===bb===
11712 ====bba====
11713 ===bc===
11714 ==c==
11715 ===ca===
11716 !! result
11717 start
11718 ==a==
11719 ===aa===
11720 ====aaa====
11721 ==b==
11722 ===ba===
11723 ===bb===
11726 ===bc===
11727 ==c==
11728 ===ca===
11729 !! end
11731 !! test
11732 Section replacement test (section 8)
11733 !! options
11734 replace=8,"xxx"
11735 !! input
11736 start
11737 ==a==
11738 ===aa===
11739 ====aaa====
11740 ==b==
11741 ===ba===
11742 ===bb===
11743 ====bba====
11744 ===bc===
11745 ==c==
11746 ===ca===
11747 !! result
11748 start
11749 ==a==
11750 ===aa===
11751 ====aaa====
11752 ==b==
11753 ===ba===
11754 ===bb===
11755 ====bba====
11758 ==c==
11759 ===ca===
11760 !!end
11762 !! test
11763 Section replacement test (section 9)
11764 !! options
11765 replace=9,"xxx"
11766 !! input
11767 start
11768 ==a==
11769 ===aa===
11770 ====aaa====
11771 ==b==
11772 ===ba===
11773 ===bb===
11774 ====bba====
11775 ===bc===
11776 ==c==
11777 ===ca===
11778 !! result
11779 start
11780 ==a==
11781 ===aa===
11782 ====aaa====
11783 ==b==
11784 ===ba===
11785 ===bb===
11786 ====bba====
11787 ===bc===
11789 !! end
11791 !! test
11792 Section replacement test (section 10)
11793 !! options
11794 replace=10,"xxx"
11795 !! input
11796 start
11797 ==a==
11798 ===aa===
11799 ====aaa====
11800 ==b==
11801 ===ba===
11802 ===bb===
11803 ====bba====
11804 ===bc===
11805 ==c==
11806 ===ca===
11807 !! result
11808 start
11809 ==a==
11810 ===aa===
11811 ====aaa====
11812 ==b==
11813 ===ba===
11814 ===bb===
11815 ====bba====
11816 ===bc===
11817 ==c==
11819 !! end
11821 !! test
11822 Section replacement test with initial whitespace (bug 13728)
11823 !! options
11824 replace=2,"xxx"
11825 !! input
11826  Preformatted initial line
11827 ==a==
11828 ===a===
11829 !! result
11830  Preformatted initial line
11831 ==a==
11833 !! end
11836 !! test
11837 Section extraction, heading followed by pre with 20 spaces (bug 6398)
11838 !! options
11839 section=1
11840 !! input
11841 ==a==
11842                     a
11843 !! result
11844 ==a==
11845                     a
11846 !! end
11848 !! test
11849 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
11850 !! options
11851 section=1
11852 !! input
11853 ==a==
11854                    a
11855 !! result
11856 ==a==
11857                    a
11858 !! end
11861 !! test
11862 Section extraction, <pre> around bogus header (bug 10309)
11863 !! options
11864 noxml section=2
11865 !! input
11866 == Section One ==
11867 <pre>
11868 =======
11869 </pre>
11871 == Section Two ==
11872 stuff
11873 !! result
11874 == Section Two ==
11875 stuff
11876 !! end
11878 !! test
11879 Section replacement, <pre> around bogus header (bug 10309)
11880 !! options
11881 noxml replace=2,"xxx"
11882 !! input
11883 == Section One ==
11884 <pre>
11885 =======
11886 </pre>
11888 == Section Two ==
11889 stuff
11890 !! result
11891 == Section One ==
11892 <pre>
11893 =======
11894 </pre>
11897 !! end
11901 !! test
11902 Handling of &#x0A; in URLs
11903 !! input
11904 **irc://&#x0A;a
11905 !! result
11906 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
11907 </li></ul>
11908 </li></ul>
11910 !!end
11912 !! test
11913 5 quotes, code coverage +1 line (php)
11914 !! options
11916 !! input
11917 '''''
11918 !! result
11919 !! end
11920 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
11921 !! test
11922 5 quotes, code coverage +1 line (parsoid)
11923 !! options
11924 parsoid
11925 !! input
11926 '''''
11927 !! result
11928 <p><i><b></b></i></p>
11929 !! end
11931 !! test
11932 Special:Search page linking.
11933 !! input
11934 {{Special:search}}
11935 !! result
11936 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
11937 </p>
11938 !! end
11940 !! test
11941 Say the magic word
11942 !! input
11943 * {{PAGENAME}}
11944 * {{BASEPAGENAME}}
11945 * {{SUBPAGENAME}}
11946 * {{SUBPAGENAMEE}}
11947 * {{ROOTPAGENAME}}
11948 * {{ROOTPAGENAMEE}}
11949 * {{BASEPAGENAME}}
11950 * {{BASEPAGENAMEE}}
11951 * {{TALKPAGENAME}}
11952 * {{TALKPAGENAMEE}}
11953 * {{SUBJECTPAGENAME}}
11954 * {{SUBJECTPAGENAMEE}}
11955 * {{NAMESPACEE}}
11956 * {{NAMESPACE}}
11957 * {{TALKSPACE}}
11958 * {{TALKSPACEE}}
11959 * {{SUBJECTSPACE}}
11960 * {{SUBJECTSPACEE}}
11961 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
11962 !! result
11963 <ul><li> Parser test
11964 </li><li> Parser test
11965 </li><li> Parser test
11966 </li><li> Parser_test
11967 </li><li> Parser test
11968 </li><li> Parser_test
11969 </li><li> Parser test
11970 </li><li> Parser_test
11971 </li><li> Talk:Parser test
11972 </li><li> Talk:Parser_test
11973 </li><li> Parser test
11974 </li><li> Parser_test
11975 </li><li> 
11976 </li><li> 
11977 </li><li> Talk
11978 </li><li> Talk
11979 </li><li> 
11980 </li><li> 
11981 </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>
11982 </li></ul>
11984 !! end
11985 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
11987 !! test
11988 Gallery
11989 !! input
11990 <gallery>
11991 image1.png |
11992 image2.gif|||||
11994 image3|
11995 image4    |300px| centre
11996  image5.svg| http://///////
11997 [[x|xx]]]]
11998 * image6
11999 </gallery>
12000 !! result
12001 <ul class="gallery">
12002                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12003                         <div style="height: 150px;">Image1.png</div>
12004                         <div class="gallerytext">
12005                         </div>
12006                 </div></li>
12007                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12008                         <div style="height: 150px;">Image2.gif</div>
12009                         <div class="gallerytext">
12010 <p>||||
12011 </p>
12012                         </div>
12013                 </div></li>
12014                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12015                         <div style="height: 150px;">Image3</div>
12016                         <div class="gallerytext">
12017                         </div>
12018                 </div></li>
12019                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12020                         <div style="height: 150px;">Image4</div>
12021                         <div class="gallerytext">
12022 <p>300px| centre
12023 </p>
12024                         </div>
12025                 </div></li>
12026                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12027                         <div style="height: 150px;">Image5.svg</div>
12028                         <div class="gallerytext">
12029 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
12030 </p>
12031                         </div>
12032                 </div></li>
12033                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12034                         <div style="height: 150px;">* image6</div>
12035                         <div class="gallerytext">
12036                         </div>
12037                 </div></li>
12038 </ul>
12040 !! end
12042 !! test
12043 Gallery (with options)
12044 !! input
12045 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
12046 File:Nonexistant.jpg|caption
12047 File:Nonexistant.jpg
12048 image:foobar.jpg|some '''caption''' [[Main Page]]
12049 image:foobar.jpg
12050 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
12051 </gallery>
12052 !! result
12053 <ul class="gallery" style="max-width: 226px;_width: 226px;">
12054         <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
12055                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12056                         <div style="height: 70px;">Nonexistant.jpg</div>
12057                         <div class="gallerytext">
12058 <p>caption
12059 </p>
12060                         </div>
12061                 </div></li>
12062                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12063                         <div style="height: 70px;">Nonexistant.jpg</div>
12064                         <div class="gallerytext">
12065                         </div>
12066                 </div></li>
12067                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12068                         <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>
12069                         <div class="gallerytext">
12070 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12071 </p>
12072                         </div>
12073                 </div></li>
12074                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12075                         <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>
12076                         <div class="gallerytext">
12077                         </div>
12078                 </div></li>
12079                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12080                         <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>
12081                         <div class="gallerytext">
12082 <p>Blabla|blabla.
12083 </p>
12084                         </div>
12085                 </div></li>
12086 </ul>
12088 !! end
12090 !! test
12091 Gallery with wikitext inside caption
12092 !! input
12093 <gallery>
12094 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
12095 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
12096 </gallery>
12097 !! result
12098 <ul class="gallery">
12099                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12100                         <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>
12101                         <div class="gallerytext">
12102 <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>
12103 </p>
12104                         </div>
12105                 </div></li>
12106                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12107                         <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>
12108                         <div class="gallerytext">
12109 <p>This is a test template
12110 </p>
12111                         </div>
12112                 </div></li>
12113 </ul>
12115 !! end
12117 !! test
12118 gallery (with showfilename option)
12119 !! input
12120 <gallery showfilename>
12121 File:Nonexistant.jpg|caption
12122 File:Nonexistant.jpg
12123 image:foobar.jpg|some '''caption''' [[Main Page]]
12124 File:Foobar.jpg
12125 </gallery>
12126 !! result
12127 <ul class="gallery">
12128                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12129                         <div style="height: 150px;">Nonexistant.jpg</div>
12130                         <div class="gallerytext">
12131 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12132 caption
12133 </p>
12134                         </div>
12135                 </div></li>
12136                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12137                         <div style="height: 150px;">Nonexistant.jpg</div>
12138                         <div class="gallerytext">
12139 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12140 </p>
12141                         </div>
12142                 </div></li>
12143                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12144                         <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>
12145                         <div class="gallerytext">
12146 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12147 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12148 </p>
12149                         </div>
12150                 </div></li>
12151                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12152                         <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>
12153                         <div class="gallerytext">
12154 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12155 </p>
12156                         </div>
12157                 </div></li>
12158 </ul>
12160 !! end
12162 !! test
12163 Gallery (with namespace-less filenames)
12164 !! input
12165 <gallery>
12166 File:Nonexistant.jpg
12167 Nonexistant.jpg
12168 image:foobar.jpg
12169 foobar.jpg
12170 </gallery>
12171 !! result
12172 <ul class="gallery">
12173                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12174                         <div style="height: 150px;">Nonexistant.jpg</div>
12175                         <div class="gallerytext">
12176                         </div>
12177                 </div></li>
12178                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12179                         <div style="height: 150px;">Nonexistant.jpg</div>
12180                         <div class="gallerytext">
12181                         </div>
12182                 </div></li>
12183                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12184                         <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>
12185                         <div class="gallerytext">
12186                         </div>
12187                 </div></li>
12188                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12189                         <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>
12190                         <div class="gallerytext">
12191                         </div>
12192                 </div></li>
12193 </ul>
12195 !! end
12197 !! test
12198 HTML Hex character encoding (spells the word "JavaScript")
12199 !! input
12200 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
12201 !! result
12202 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
12203 </p>
12204 !! end
12206 !! test
12207 HTML Hex character encoding bogus encoding (bug 26437 regression check)
12208 !! input
12209 &#xsee;&#XSEE;
12210 !! result
12211 <p>&amp;#xsee;&amp;#XSEE;
12212 </p>
12213 !! end
12215 !! test
12216 HTML Hex character encoding mixed case
12217 !! input
12218 &#xEE;&#Xee;
12219 !! result
12220 <p>&#xee;&#xee;
12221 </p>
12222 !! end
12224 !! test
12225 __FORCETOC__ override
12226 !! input
12227 __NEWSECTIONLINK__
12228 __FORCETOC__
12229 !! result
12230 <p><br />
12231 </p>
12232 !! end
12234 !! test
12235 ISBN code coverage
12236 !! input
12237 ISBN  978-0-1234-56&#x20;789
12238 !! result
12239 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
12240 </p>
12241 !! end
12243 !! test
12244 ISBN followed by 5 spaces
12245 !! input
12246 ISBN    
12247 !! result
12248 <p>ISBN    
12249 </p>
12250 !! end
12252 !! test
12253 Double ISBN
12254 !! input
12255 ISBN ISBN 1234567890
12256 !! result
12257 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12258 </p>
12259 !! end
12261 !! test
12262 Bug 22905: <abbr> followed by ISBN followed by </a>
12263 !! input
12264 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
12265 !! result
12266 <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>
12267 </p>
12268 !! end
12270 !! test
12271 Double RFC
12272 !! input
12273 RFC RFC 1234
12274 !! result
12275 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
12276 </p>
12277 !! end
12279 !! test
12280 Double RFC with a wiki link
12281 !! input
12282 RFC [[RFC 1234]]
12283 !! result
12284 <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>
12285 </p>
12286 !! end
12288 !! test
12289 RFC code coverage
12290 !! input
12291 RFC   983&#x20;987
12292 !! result
12293 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
12294 </p>
12295 !! end
12297 !! test
12298 Centre-aligned image
12299 !! input
12300 [[Image:foobar.jpg|centre]]
12301 !! result
12302 <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>
12304 !!end
12306 !! test
12307 None-aligned image
12308 !! input
12309 [[Image:foobar.jpg|none]]
12310 !! result
12311 <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>
12313 !!end
12315 !! test
12316 Width + Height sized image (using px) (height is ignored)
12317 !! input
12318 [[Image:foobar.jpg|640x480px]]
12319 !! result
12320 <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>
12321 </p>
12322 !!end
12324 !! test
12325 Width-sized image (using px, no following whitespace)
12326 !! input
12327 [[Image:foobar.jpg|640px]]
12328 !! result
12329 <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>
12330 </p>
12331 !!end
12333 !! test
12334 Width-sized image (using px, with following whitespace - test regression from r39467)
12335 !! input
12336 [[Image:foobar.jpg|640px ]]
12337 !! result
12338 <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>
12339 </p>
12340 !!end
12342 !! test
12343 Width-sized image (using px, with preceding whitespace - test regression from r39467)
12344 !! input
12345 [[Image:foobar.jpg| 640px]]
12346 !! result
12347 <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>
12348 </p>
12349 !!end
12351 !! test
12352 Another italics / bold test
12353 !! input
12354  ''' ''x'
12355 !! result
12356 <pre>'<i> </i>x'
12357 </pre>
12358 !!end
12360 # Note the results may be incorrect, as parserTest output included this:
12361 # XML error: Mismatched tag at byte 6120:
12362 # ...<dd> </dt></dl> </dd...
12363 !! test
12364 dt/dd/dl test
12365 !! options
12366 disabled
12367 !! input
12368 :;;;::
12369 !! result
12370 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
12371 </dd></dl>
12372 </dd></dl>
12373 </dt></dl>
12374 </dt></dl>
12375 </dt></dl>
12376 </dd></dl>
12378 !!end
12381 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
12382 !! test
12383 Images with the "|" character in the comment
12384 !! input
12385 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
12386 !! result
12387 <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>
12389 !!end
12391 !! test
12392 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
12393 !! input
12394 <html><script>alert(1);</script></html>
12395 !! result
12396 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
12397 </p>
12398 !! end
12400 !! test
12401 HTML with raw HTML ($wgRawHtml==true)
12402 !! options
12403 wgRawHtml=1
12404 !! input
12405 <html><script>alert(1);</script></html>
12406 !! result
12407 <p><script>alert(1);</script>
12408 </p>
12409 !! end
12411 !! test
12412 Parents of subpages, one level up
12413 !! options
12414 subpage title=[[Subpage test/L1/L2/L3]]
12415 !! input
12416 [[../|L2]]
12417 !! result
12418 <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>
12419 </p>
12420 !! end
12423 !! test
12424 Parents of subpages, one level up, not named
12425 !! options
12426 subpage title=[[Subpage test/L1/L2/L3]]
12427 !! input
12428 [[../]]
12429 !! result
12430 <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>
12431 </p>
12432 !! end
12436 !! test
12437 Parents of subpages, two levels up
12438 !! options
12439 subpage title=[[Subpage test/L1/L2/L3]]
12440 !! input
12441 [[../../|L1]]2
12443 [[../../|L1]]l
12444 !! result
12445 <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
12446 </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>
12447 </p>
12448 !! end
12450 !! test
12451 Parents of subpages, two levels up, without trailing slash or name.
12452 !! options
12453 subpage title=[[Subpage test/L1/L2/L3]]
12454 !! input
12455 [[../..]]
12456 !! result
12457 <p>[[../..]]
12458 </p>
12459 !! end
12461 !! test
12462 Parents of subpages, two levels up, with lots of extra trailing slashes.
12463 !! options
12464 subpage title=[[Subpage test/L1/L2/L3]]
12465 !! input
12466 [[../../////]]
12467 !! result
12468 <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>
12469 </p>
12470 !! end
12472 !! article
12473 Subpage test/L1/L2/L3Sibling
12474 !! text
12475 Sibling article
12476 !! endarticle
12478 !! test
12479 Transclusion of a sibling page (one level up)
12480 !! options
12481 subpage title=[[Subpage test/L1/L2/L3]]
12482 !! input
12483 {{../L3Sibling}}
12484 !! result
12485 <p>Sibling article
12486 </p>
12487 !! end
12489 !! test
12490 Transclusion of a child page
12491 !! options
12492 subpage title=[[Subpage test/L1/L2]]
12493 !! input
12494 {{/L3Sibling}}
12495 !! result
12496 <p>Sibling article
12497 </p>
12498 !! end
12500 !! test
12501 Non-transclusion because of too many up levels
12502 !! options
12503 subpage title=[[Subpage test/L1/L2/L3]]
12504 !! input
12505 {{../../../../More than parent}}
12506 !! result
12507 <p>{{../../../../More than parent}}
12508 </p>
12509 !! end
12511 !! test
12512 Definition list code coverage
12513 !! input
12514 ; title   : def
12515 ; title : def
12516 ;title: def
12517 !! result
12518 <dl><dt> title  &#160;</dt><dd> def
12519 </dd><dt> title&#160;</dt><dd> def
12520 </dd><dt>title</dt><dd> def
12521 </dd></dl>
12523 !! end
12525 !! test
12526 Don't fall for the self-closing div
12527 !! input
12528 <div>hello world</div/>
12529 !! result
12530 <div>hello world</div>
12532 !! end
12534 !! test
12535 MSGNW magic word
12536 !! input
12537 {{MSGNW:msg}}
12538 !! result
12539 <p>&#91;&#91;:Template:Msg&#93;&#93;
12540 </p>
12541 !! end
12543 !! test
12544 RAW magic word
12545 !! input
12546 {{RAW:QUERTY}}
12547 !! result
12548 <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>
12549 </p>
12550 !! end
12552 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
12553 !! test
12554 Always escape literal '>' in output, not just after '<'
12555 !! input
12557 !! result
12558 <p>&gt;&lt;&gt;
12559 </p>
12560 !! end
12562 !! test
12563 Template caching
12564 !! input
12565 {{Test}}
12566 {{Test}}
12567 !! result
12568 <p>This is a test template
12569 This is a test template
12570 </p>
12571 !! end
12574 !! article
12575 MediaWiki:Fake
12576 !! text
12577 ==header==
12578 !! endarticle
12580 !! test
12581 Inclusion of !userCanEdit() content
12582 !! input
12583 {{MediaWiki:Fake}}
12584 !! result
12585 <h2><span class="mw-headline" id="header">header</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12587 !! end
12590 !! test
12591 Out-of-order TOC heading levels
12592 !! input
12593 ==2==
12594 ======6======
12595 ===3===
12597 =====5=====
12598 ==2==
12599 !! result
12600 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12601 <ul>
12602 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
12603 <ul>
12604 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
12605 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
12606 </ul>
12607 </li>
12608 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
12609 <ul>
12610 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
12611 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
12612 </ul>
12613 </li>
12614 </ul>
12615 </div>
12616 <h2><span class="mw-headline" id="2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12617 <h6><span class="mw-headline" id="6">6</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
12618 <h3><span class="mw-headline" id="3">3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
12619 <h1><span class="mw-headline" id="1">1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
12620 <h5><span class="mw-headline" id="5">5</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
12621 <h2><span class="mw-headline" id="2_2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12623 !! end
12626 !! test
12627 ISBN with a dummy number
12628 !! input
12629 ISBN ---
12630 !! result
12631 <p>ISBN ---
12632 </p>
12633 !! end
12636 !! test
12637 ISBN with space-delimited number
12638 !! input
12639 ISBN 92 9017 032 8
12640 !! result
12641 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
12642 </p>
12643 !! end
12646 !! test
12647 ISBN with multiple spaces, no number
12648 !! input
12649 ISBN  foo
12650 !! result
12651 <p>ISBN  foo
12652 </p>
12653 !! end
12656 !! test
12657 ISBN length
12658 !! input
12659 ISBN 123456789
12661 ISBN 1234567890
12663 ISBN 12345678901
12664 !! result
12665 <p>ISBN 123456789
12666 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12667 </p><p>ISBN 12345678901
12668 </p>
12669 !! end
12672 !! test
12673 ISBN with trailing year (bug 8110)
12674 !! input
12675 ISBN 1-234-56789-0 - 2006
12677 ISBN 1 234 56789 0 - 2006
12678 !! result
12679 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
12680 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
12681 </p>
12682 !! end
12685 !! test
12686 anchorencode
12687 !! input
12688 {{anchorencode:foo bar©#%n}}
12689 !! result
12690 <p>foo_bar.C2.A9.23.25n
12691 </p>
12692 !! end
12694 !! test
12695 anchorencode trims spaces
12696 !! input
12697 {{anchorencode: __pretty__please__}}
12698 !! result
12699 <p>pretty_please
12700 </p>
12701 !! end
12703 !! test
12704 anchorencode deals with links
12705 !! input
12706 {{anchorencode: [[hello|world]] [[hi]]}}
12707 !! result
12708 <p>world_hi
12709 </p>
12710 !! end
12712 !! test
12713 anchorencode deals with templates
12714 !! input
12715 {{anchorencode: {{Foo}} }}
12716 !! result
12717 <p>FOO
12718 </p>
12719 !! end
12721 !! test
12722 anchorencode encodes like the TOC generator: (bug 18431)
12723 !! input
12724 === _ +:.3A%3A&&amp;]] ===
12725 {{anchorencode: _ +:.3A%3A&&amp;]] }}
12726 __NOEDITSECTION__
12727 !! result
12728 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
12729 <p>.2B:.3A.253A.26.26.5D.5D
12730 </p>
12731 !! end
12733 # Expected output in the following test is not necessarily expected (there
12734 # should probably be <p> tags inside the <blockquote> in the output) -- it's
12735 # only testing for well-formedness.
12736 !! test
12737 Bug 6200: blockquotes and paragraph formatting
12738 !! input
12739 <blockquote>
12741 </blockquote>
12745  baz
12746 !! result
12747 <blockquote>
12749 </blockquote>
12750 <p>bar
12751 </p>
12752 <pre>baz
12753 </pre>
12754 !! end
12756 !! test
12757 Bug 8293: Use of center tag ruins paragraph formatting
12758 !! input
12759 <center>
12761 </center>
12765  baz
12766 !! result
12767 <center>
12768 <p>foo
12769 </p>
12770 </center>
12771 <p>bar
12772 </p>
12773 <pre>baz
12774 </pre>
12775 !! end
12777 !!test
12778 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
12779 !!options
12781 !!input
12782 <span><s>x</span></s>
12783 !!result
12784 <p><span><s>x&lt;/span&gt;</s></span>
12785 </p>
12786 !!end
12788 !!test
12789 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
12790 !!options
12791 parsoid
12792 !!input
12793 <span><s>x</span></s>
12794 !!result
12795 <p><span><s>x</s></span><s></s>
12796 </p>
12797 !!end
12800 ### Language variants related tests
12802 !! test
12803 Self-link in language variants
12804 !! options
12805 title=[[Dunav]] language=sr
12806 !! input
12807 Both [[Dunav]] and [[Дунав]] are names for this river.
12808 !! result
12809 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
12810 </p>
12811 !!end
12813 !! article
12814 Дуна
12815 !! text
12816 content
12817 !! endarticle
12819 !! test
12820 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
12821 !! options
12822 title=[[Duna]] language=sr
12823 !! input
12824 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
12825 !! result
12826 <p><a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Дуна</a> is not a self-link while <strong class="selflink">Duna</strong> and <strong class="selflink">Dуна</strong> are still self-links.
12827 </p>
12828 !! end
12830 !! test
12831 Link to pages in language variants
12832 !! options
12833 language=sr
12834 !! input
12835 Main Page can be written as [[Маин Паге]]
12836 !! result
12837 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
12838 </p>
12839 !!end
12842 !! test
12843 Multiple links to pages in language variants
12844 !! options
12845 language=sr
12846 !! input
12847 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
12848 !! result
12849 <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>.
12850 </p>
12851 !!end
12854 !! test
12855 Simple template in language variants
12856 !! options
12857 language=sr
12858 !! input
12859 {{тест}}
12860 !! result
12861 <p>This is a test template
12862 </p>
12863 !! end
12866 !! test
12867 Template with explicit namespace in language variants
12868 !! options
12869 language=sr
12870 !! input
12871 {{Template:тест}}
12872 !! result
12873 <p>This is a test template
12874 </p>
12875 !! end
12878 !! test
12879 Basic test for template parameter in language variants
12880 !! options
12881 language=sr
12882 !! input
12883 {{парамтест|param=foo}}
12884 !! result
12885 <p>This is a test template with parameter foo
12886 </p>
12887 !! end
12890 !! test
12891 Simple category in language variants
12892 !! options
12893 language=sr cat
12894 !! input
12895 [[Category:МедиаWики Усер'с Гуиде]]
12896 !! result
12897 <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>
12898 !! end
12901 !! article
12902 Category:分类
12903 !! text
12904 blah
12905 !! endarticle
12907 !! article
12908 Category:分類
12909 !! text
12910 blah
12911 !! endarticle
12913 !! test
12914 Don't convert blue categorylinks to another variant (bug 33210)
12915 !! options
12916 language=zh cat
12917 !! input
12918 [[A]][[Category:分类]]
12919 !! result
12920 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
12921 !! end
12924 !! test
12925 Stripping -{}- tags (language variants)
12926 !! options
12927 language=sr
12928 !! input
12929 Latin proverb: -{Ne nuntium necare}-
12930 !! result
12931 <p>Latin proverb: Ne nuntium necare
12932 </p>
12933 !! end
12936 !! test
12937 Prevent conversion with -{}- tags (language variants)
12938 !! options
12939 language=sr variant=sr-ec
12940 !! input
12941 Latinski: -{Ne nuntium necare}-
12942 !! result
12943 <p>Латински: Ne nuntium necare
12944 </p>
12945 !! end
12948 !! test
12949 Prevent conversion of text with -{}- tags (language variants)
12950 !! options
12951 language=sr variant=sr-ec
12952 !! input
12953 Latinski: -{Ne nuntium necare}-
12954 !! result
12955 <p>Латински: Ne nuntium necare
12956 </p>
12957 !! end
12960 !! test
12961 Prevent conversion of links with -{}- tags (language variants)
12962 !! options
12963 language=sr variant=sr-ec
12964 !! input
12965 -{[[Main Page]]}-
12966 !! result
12967 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12968 </p>
12969 !! end
12972 !! test
12973 -{}- tags within headlines (within html for parserConvert())
12974 !! options
12975 language=sr variant=sr-ec
12976 !! input
12977 == -{Naslov}- ==
12978 !! result
12979 <h2><span class="mw-headline" id="-.7BNaslov.7D-">Naslov</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уредите одељак „Naslov“">уреди</a><span class="mw-editsection-bracket">]</span></span></h2>
12981 !! end
12984 !! test
12985 Explicit definition of language variant alternatives
12986 !! options
12987 language=zh variant=zh-tw
12988 !! input
12989 -{zh:China;zh-tw:Taiwan}-, not China
12990 !! result
12991 <p>Taiwan, not China
12992 </p>
12993 !! end
12996 !! test
12997 Conversion around HTML tags
12998 !! options
12999 language=sr variant=sr-ec
13000 !! input
13001 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
13002 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
13003 !! result
13005 <span title="ЛаCтин">ски</span>
13006 </p>
13007 !! end
13010 !! test
13011 Explicit session-wise language variant mapping (A flag and - flag)
13012 !! options
13013 language=zh variant=zh-tw
13014 !! input
13015 Taiwan is not China.
13016 But -{A|zh:China;zh-tw:Taiwan}- is China,
13017 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
13018 and -{China}- is China.
13019 !! result
13020 <p>Taiwan is not China.
13021 But Taiwan is Taiwan,
13022 (This should be stripped!)
13023 and China is China.
13024 </p>
13025 !! end
13027 !! test
13028 Explicit session-wise language variant mapping (H flag for hide)
13029 !! options
13030 language=zh variant=zh-tw
13031 !! input
13032 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
13033 Taiwan is China.
13034 !! result
13035 <p>(This should be stripped!)
13036 Taiwan is Taiwan.
13037 </p>
13038 !! end
13040 !! test
13041 Adding explicit conversion rule for title (T flag)
13042 !! options
13043 language=zh variant=zh-tw showtitle
13044 !! input
13045 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13046 !! result
13047 Taiwan
13048 <p>Should be stripped!
13049 </p>
13050 !! end
13052 !! test
13053 Testing that changing the language variant here in the tests actually works
13054 !! options
13055 language=zh variant=zh showtitle
13056 !! input
13057 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13058 !! result
13059 China
13060 <p>Should be stripped!
13061 </p>
13062 !! end
13064 !! test
13065 Recursive conversion of alt and title attrs shouldn't clear converter state
13066 !! options
13067 language=zh variant=zh-cn showtitle
13068 !! input
13069 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
13070 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
13071 !! result
13072 China
13074 Should be stripped<span title="Exclamation">!</span>
13075 </p>
13076 !! end
13078 !! test
13079 Bug 24072: more test on conversion rule for title
13080 !! options
13081 language=zh variant=zh-tw showtitle
13082 !! input
13083 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13084 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
13085 !! result
13086 Taiwan
13087 <p>This should be stripped!
13088 This won't take interferes with the title rule.
13089 </p>
13090 !! end
13092 !! test
13093 Partly disable title conversion if variant == main language code
13094 !! options
13095 language=zh variant=zh title=[[ZH]] showtitle
13096 !! input
13097 -{T|zh-cn:CN;zh-tw:TW}-
13098 !! result
13101 </p>
13102 !! end
13104 !! test
13105 Partly disable title conversion if variant == main language code, more
13106 !! options
13107 language=zh variant=zh title=[[ZH]] showtitle
13108 !! input
13109 -{T|TW}-
13110 !! result
13113 </p>
13114 !! end
13116 !! test
13117 Raw output of variant escape tags (R flag)
13118 !! options
13119 language=zh variant=zh-tw
13120 !! input
13121 Raw: -{R|zh:China;zh-tw:Taiwan}-
13122 !! result
13123 <p>Raw: zh:China;zh-tw:Taiwan
13124 </p>
13125 !! end
13127 !! test
13128 Nested using of manual convert syntax
13129 !! options
13130 language=zh variant=zh-hk
13131 !! input
13132 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
13133 !! result
13134 <p>Nested: Hello Hong Kong!
13135 </p>
13136 !! end
13138 !! test
13139 Proper conversion of text in external links
13140 !! options
13141 language=sr variant=sr-ec
13142 !! input
13143 http://www.google.com
13144 gopher://www.google.com
13145 [http://www.google.com http://www.google.com]
13146 [gopher://www.google.com gopher://www.google.com]
13147 [https://www.google.com irc://www.google.com]
13148 [ftp://www.google.com www.google.com/ftp://dir]
13149 [//www.google.com www.google.com]
13150 !! result
13151 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13152 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13153 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13154 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13155 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
13156 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
13157 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
13158 </p>
13159 !! end
13161 !! test
13162 Do not convert roman numbers to language variants
13163 !! options
13164 language=sr variant=sr-ec
13165 !! input
13166 Fridrih IV je car.
13167 !! result
13168 <p>Фридрих IV је цар.
13169 </p>
13170 !! end
13172 !! test
13173 Unclosed language converter markup "-{"
13174 !! options
13175 language=sr
13176 !! input
13177 -{T|hello
13178 !! result
13179 <p>-{T|hello
13180 </p>
13181 !! end
13183 !! test
13184 Don't convert raw rule "-{R|=&gt;}-" to "=>"
13185 !! options
13186 language=sr
13187 !! input
13188 -{R|=&gt;}-
13189 !! result
13190 <p>=&gt;
13191 </p>
13192 !!end
13194 !!article
13195 Template:Bullet
13196 !!text
13197 * Bar
13198 !!endarticle
13200 !! test
13201 Bug 529: Uncovered bullet
13202 !! input
13203 * Foo {{bullet}}
13204 !! result
13205 <ul><li> Foo 
13206 </li><li> Bar
13207 </li></ul>
13209 !! end
13211 # Plain MediaWiki does not remove empty lists, but tidy actually does.
13212 # Templates in Wikipedia rely on this behavior, as tidy has always been
13213 # enabled there. These tests are normally run *without* tidy, so specify the
13214 # full output here. 
13215 # To test realistic parsing behavior, apply a tidy-like transformation to both
13216 # the expected output and your parser's output.
13217 !! test
13218 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
13219 !! input
13220 ******* Foo {{bullet}}
13221 !! result
13222 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo 
13223 </li></ul>
13224 </li></ul>
13225 </li></ul>
13226 </li></ul>
13227 </li></ul>
13228 </li></ul>
13229 </li><li> Bar
13230 </li></ul>
13232 !! end
13234 !! test
13235 Bug 529: Uncovered table already at line-start
13236 !! input
13239 {{table}}
13241 !! result
13242 <p>x
13243 </p>
13244 <table>
13245 <tr>
13246 <td> 1 </td>
13247 <td> 2
13248 </td></tr>
13249 <tr>
13250 <td> 3 </td>
13251 <td> 4
13252 </td></tr></table>
13253 <p>y
13254 </p>
13255 !! end
13257 !! test
13258 Bug 529: Uncovered bullet in parser function result
13259 !! input
13260 * Foo {{lc:{{bullet}} }}
13261 !! result
13262 <ul><li> Foo 
13263 </li><li> bar
13264 </li></ul>
13266 !! end
13268 !! test
13269 Bug 5678: Double-parsed template argument
13270 !! input
13271 {{lc:{{{1}}}|hello}}
13272 !! result
13273 <p>{{{1}}}
13274 </p>
13275 !! end
13277 !! test
13278 Bug 5678: Double-parsed template invocation
13279 !! input
13280 {{lc:{{paramtest {{!}} param = hello }} }}
13281 !! result
13282 <p>{{paramtest | param = hello }}
13283 </p>
13284 !! end
13286 !! test
13287 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
13288 !! options
13289 language=cs
13290 title=[[Main Page]]
13291 !! input
13292 {{PRVNÍVELKÉ:ěščř}}
13293 {{prvnívelké:ěščř}}
13294 {{PRVNÍMALÉ:ěščř}}
13295 {{prvnímalé:ěščř}}
13296 {{MALÁ:ěščř}}
13297 {{malá:ěščř}}
13298 {{VELKÁ:ěščř}}
13299 {{velká:ěščř}}
13300 !! result
13301 <p>Ěščř
13302 Ěščř
13303 ěščř
13304 ěščř
13305 ěščř
13306 ěščř
13307 ĚŠČŘ
13308 ĚŠČŘ
13309 </p>
13310 !! end
13312 !! test
13313 Morwen/13: Unclosed link followed by heading
13314 !! input
13315 [[link
13316 ==heading==
13317 !! result
13318 <p>[[link
13319 </p>
13320 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13322 !! end
13324 !! test
13325 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
13326 !! input
13327 {{foo|
13328 =heading=
13329 !! result
13330 <p>{{foo|
13331 </p>
13332 <h1><span class="mw-headline" id="heading">heading</span></h1>
13334 !! end
13336 !! test
13337 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
13338 !! input
13339 {{foo|
13340 ==heading==
13341 !! result
13342 <p>{{foo|
13343 </p>
13344 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13346 !! end
13348 !! test
13349 Tildes in comments
13350 !! options
13352 !! input
13353 <!-- ~~~~ -->
13354 !! result
13355 <!-- ~~~~ -->
13356 !! end
13358 !! test
13359 Paragraphs inside divs (no extra line breaks)
13360 !! input
13361 <div>Line one
13363 Line two</div>
13364 !! result
13365 <div>Line one
13366 Line two</div>
13368 !! end
13370 !! test
13371 Paragraphs inside divs (extra line break on open)
13372 !! input
13373 <div>
13374 Line one
13376 Line two</div>
13377 !! result
13378 <div>
13379 <p>Line one
13380 </p>
13381 Line two</div>
13383 !! end
13385 !! test
13386 Paragraphs inside divs (extra line break on close)
13387 !! input
13388 <div>Line one
13390 Line two
13391 </div>
13392 !! result
13393 <div>Line one
13394 <p>Line two
13395 </p>
13396 </div>
13398 !! end
13400 !! test
13401 Paragraphs inside divs (extra line break on open and close)
13402 !! input
13403 <div>
13404 Line one
13406 Line two
13407 </div>
13408 !! result
13409 <div>
13410 <p>Line one
13411 </p><p>Line two
13412 </p>
13413 </div>
13415 !! end
13417 !! test
13418 Nesting tags, paragraphs on lines which begin with <div>
13419 !! options
13420 disabled
13421 !! input
13422 <div></div><strong>A
13423 B</strong>
13424 !! result
13425 <div></div>
13426 <p><strong>A
13427 B</strong>
13428 </p>
13429 !! end
13431 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
13432 !! test
13433 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
13434 !! options
13435 disabled
13436 !! input
13437 <blockquote>Line one
13439 Line two</blockquote>
13440 !! result
13441 <blockquote>Line one
13442 Line two</blockquote>
13444 !! end
13446 !! test
13447 Bug 6200: paragraphs inside blockquotes (extra line break on open)
13448 !! options
13449 disabled
13450 !! input
13451 <blockquote>
13452 Line one
13454 Line two</blockquote>
13455 !! result
13456 <blockquote>
13457 <p>Line one
13458 </p>
13459 Line two</blockquote>
13461 !! end
13463 !! test
13464 Bug 6200: paragraphs inside blockquotes (extra line break on close)
13465 !! options
13466 disabled
13467 !! input
13468 <blockquote>Line one
13470 Line two
13471 </blockquote>
13472 !! result
13473 <blockquote>Line one
13474 <p>Line two
13475 </p>
13476 </blockquote>
13478 !! end
13480 !! test
13481 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
13482 !! options
13483 disabled
13484 !! input
13485 <blockquote>
13486 Line one
13488 Line two
13489 </blockquote>
13490 !! result
13491 <blockquote>
13492 <p>Line one
13493 </p><p>Line two
13494 </p>
13495 </blockquote>
13497 !! end
13499 !! test
13500 Paragraphs inside blockquotes/divs (no extra line breaks)
13501 !! input
13502 <blockquote><div>Line one
13504 Line two</div></blockquote>
13505 !! result
13506 <blockquote><div>Line one
13507 Line two</div></blockquote>
13509 !! end
13511 !! test
13512 Paragraphs inside blockquotes/divs (extra line break on open)
13513 !! input
13514 <blockquote><div>
13515 Line one
13517 Line two</div></blockquote>
13518 !! result
13519 <blockquote><div>
13520 <p>Line one
13521 </p>
13522 Line two</div></blockquote>
13524 !! end
13526 !! test
13527 Paragraphs inside blockquotes/divs (extra line break on close)
13528 !! input
13529 <blockquote><div>Line one
13531 Line two
13532 </div></blockquote>
13533 !! result
13534 <blockquote><div>Line one
13535 <p>Line two
13536 </p>
13537 </div></blockquote>
13539 !! end
13541 !! test
13542 Paragraphs inside blockquotes/divs (extra line break on open and close)
13543 !! input
13544 <blockquote><div>
13545 Line one
13547 Line two
13548 </div></blockquote>
13549 !! result
13550 <blockquote><div>
13551 <p>Line one
13552 </p><p>Line two
13553 </p>
13554 </div></blockquote>
13556 !! end
13558 !! test
13559 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
13560 !! options
13561 wgLinkHolderBatchSize=0
13562 !! input
13563 [[meatball:1]]
13564 [[meatball:2]]
13565 [[meatball:3]]
13566 !! result
13567 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
13568 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
13569 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
13570 </p>
13571 !! end
13573 !! test
13574 Free external link invading image caption
13575 !! input
13576 [[Image:Foobar.jpg|thumb|http://x|hello]]
13577 !! result
13578 <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>
13580 !! end
13582 !! test
13583 Bug 15196: localised external link numbers
13584 !! options
13585 language=fa
13586 !! input
13587 [http://en.wikipedia.org/]
13588 !! result
13589 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
13590 </p>
13591 !! end
13593 !! test
13594 Multibyte character in padleft
13595 !! input
13596 {{padleft:-Hello|7|Æ}}
13597 !! result
13598 <p>Æ-Hello
13599 </p>
13600 !! end
13602 !! test
13603 Multibyte character in padright
13604 !! input
13605 {{padright:Hello-|7|Æ}}
13606 !! result
13607 <p>Hello-Æ
13608 </p>
13609 !! end
13611 !!test
13612 formatdate parser function
13613 !!input
13614 {{#formatdate:2009-03-24}}
13615 !! result
13616 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
13617 </p>
13618 !! end
13620 !!test
13621 formatdate parser function, with default format
13622 !!input
13623 {{#formatdate:2009-03-24|mdy}}
13624 !! result
13625 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
13626 </p>
13627 !! end
13629 !! test
13630 Spacing of numbers in formatted dates
13631 !! input
13632 {{#formatdate:January 15}}
13633 !! result
13634 <p><span class="mw-formatted-date" title="01-15">January 15</span>
13635 </p>
13636 !! end
13638 !! test
13639 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
13640 !! options
13641 language=nl title=[[MediaWiki:Common.css]]
13642 !! input
13643 {{#formatdate:2009-03-24|dmy}}
13644 !! result
13645 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
13646 </p>
13647 !! end
13654 # Edit comments
13657 !! test
13658 Edit comment with link
13659 !! options
13660 comment
13661 !! input
13662 I like the [[Main Page]] a lot
13663 !! result
13664 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
13665 !!end
13667 !! test
13668 Edit comment with link and link text
13669 !! options
13670 comment
13671 !! input
13672 I like the [[Main Page|best pages]] a lot
13673 !! result
13674 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13675 !!end
13677 !! test
13678 Edit comment with link and link text with suffix
13679 !! options
13680 comment
13681 !! input
13682 I like the [[Main Page|best page]]s a lot
13683 !! result
13684 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13685 !!end
13687 !! test
13688 Edit comment with section link (non-local, eg in history list)
13689 !! options
13690 comment title=[[Main Page]]
13691 !! input
13692 /* External links */ removed bogus entries
13693 !! result
13694 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13695 !!end
13697 !! test
13698 Edit comment with section link and text before it (non-local, eg in history list)
13699 !! options
13700 comment title=[[Main Page]]
13701 !! input
13702 pre-comment text /* External links */ removed bogus entries
13703 !! result
13704 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>
13705 !!end
13707 !! test
13708 Edit comment with section link (local, eg in diff view)
13709 !! options
13710 comment local title=[[Main Page]]
13711 !! input
13712 /* External links */ removed bogus entries
13713 !! result
13714 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13715 !!end
13717 !! test
13718 Edit comment with subpage link (bug 14080)
13719 !! options
13720 comment
13721 subpage
13722 title=[[Subpage test]]
13723 !! input
13724 Poked at a [[/subpage]] here...
13725 !! result
13726 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
13727 !!end
13729 !! test
13730 Edit comment with subpage link and link text (bug 14080)
13731 !! options
13732 comment
13733 subpage
13734 title=[[Subpage test]]
13735 !! input
13736 Poked at a [[/subpage|neat little page]] here...
13737 !! result
13738 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
13739 !!end
13741 !! test
13742 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
13743 !! options
13744 comment
13745 title=[[Subpage test]]
13746 !! input
13747 Poked at a [[/subpage]] here...
13748 !! result
13749 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...
13750 !!end
13752 !! test
13753 Edit comment with bare anchor link (local, as on diff)
13754 !! options
13755 comment
13756 local
13757 title=[[Main Page]]
13758 !!input
13759 [[#section]]
13760 !! result
13761 <a href="#section">#section</a>
13762 !! end
13764 !! test
13765 Edit comment with bare anchor link (non-local, as on history)
13766 !! options
13767 comment
13768 title=[[Main Page]]
13769 !!input
13770 [[#section]]
13771 !! result
13772 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
13773 !! end
13775 !! test
13776 Anchor starting with underscore
13777 !!input
13778 [[#_ref|One]]
13779 !! result
13780 <p><a href="#_ref">One</a>
13781 </p>
13782 !! end
13784 !! test
13785 Id starting with underscore
13786 !!input
13787 <div id="_ref"></div>
13788 !! result
13789 <div id="_ref"></div>
13791 !! end
13793 !! test
13794 Space normalisation on autocomment (bug 22784)
13795 !! options
13796 comment
13797 title=[[Main Page]]
13798 !!input
13799 /* __hello__world__ */
13800 !! result
13801 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
13802 !! end
13804 !! test
13805 percent-encoding and + signs in comments (Bug 26410)
13806 !! options
13807 comment
13808 !!input
13809 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
13810 !! result
13811 <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>
13812 !! end
13814 !! test
13815 Bad images - basic functionality
13816 !! options
13817 disabled
13818 !! input
13819 [[File:Bad.jpg]]
13820 !! result
13821 !! end
13823 !! test
13824 Bad images - bug 16039: text after bad image disappears
13825 !! options
13826 disabled
13827 !! input
13828 Foo bar
13829 [[File:Bad.jpg]]
13830 Bar foo
13831 !! result
13832 <p>Foo bar
13833 </p><p>Bar foo
13834 </p>
13835 !! end
13837 !! test
13838 Verify that displaytitle works (bug #22501) no displaytitle
13839 !! options
13840 showtitle
13841 !! config
13842 wgAllowDisplayTitle=true
13843 wgRestrictDisplayTitle=false
13844 !! input
13845 this is not the the title
13846 !! result
13847 Parser test
13848 <p>this is not the the title
13849 </p>
13850 !! end
13852 !! test
13853 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
13854 !! options
13855 showtitle
13856 title=[[Screen]]
13857 !! config
13858 wgAllowDisplayTitle=true
13859 wgRestrictDisplayTitle=false
13860 !! input
13861 this is not the the title
13862 {{DISPLAYTITLE:whatever}}
13863 !! result
13864 whatever
13865 <p>this is not the the title
13866 </p>
13867 !! end
13869 !! test
13870 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
13871 !! options
13872 showtitle
13873 title=[[Screen]]
13874 !! config
13875 wgAllowDisplayTitle=true
13876 wgRestrictDisplayTitle=true
13877 !! input
13878 this is not the the title
13879 {{DISPLAYTITLE:whatever}}
13880 !! result
13881 Screen
13882 <p>this is not the the title
13883 </p>
13884 !! end
13886 !! test
13887 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
13888 !! options
13889 showtitle
13890 title=[[Screen]]
13891 !! config
13892 wgAllowDisplayTitle=true
13893 wgRestrictDisplayTitle=true
13894 !! input
13895 this is not the the title
13896 {{DISPLAYTITLE:screen}}
13897 !! result
13898 screen
13899 <p>this is not the the title
13900 </p>
13901 !! end
13903 !! test
13904 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
13905 !! options
13906 showtitle
13907 title=[[Screen]]
13908 !! config
13909 wgAllowDisplayTitle=false
13910 !! input
13911 this is not the the title
13912 {{DISPLAYTITLE:screen}}
13913 !! result
13914 Screen
13915 <p>this is not the the title
13916 <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>
13917 </p>
13918 !! end
13920 !! test
13921 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
13922 !! options
13923 showtitle
13924 title=[[Screen]]
13925 !! config
13926 wgAllowDisplayTitle=false
13927 !! input
13928 this is not the the title
13929 !! result
13930 Screen
13931 <p>this is not the the title
13932 </p>
13933 !! end
13935 !! test
13936 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
13937 !! options
13938 showtitle
13939 title=[[Screen]]
13940 !! config
13941 wgAllowDisplayTitle=true
13942 wgRestrictDisplayTitle=true
13943 !! input
13944 this is not the the title
13945 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
13946 !! result
13947 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
13948 <p>this is not the the title
13949 </p>
13950 !! end
13952 !! test
13953 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
13954 !! options
13955 showtitle
13956 title=[[Screen]]
13957 !! config
13958 wgAllowDisplayTitle=true
13959 wgRestrictDisplayTitle=true
13960 !! input
13961 this is not the the title
13962 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
13963 !! result
13964 <span style="color: red;">s</span>creen
13965 <p>this is not the the title
13966 </p>
13967 !! end
13969 !! test
13970 preload: check <noinclude> and <includeonly>
13971 !! options
13972 preload
13973 !! input
13974 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
13975 !! result
13976 Hello kind world.
13977 !! end
13979 !! test
13980 preload: check <onlyinclude>
13981 !! options
13982 preload
13983 !! input
13984 Goodbye <onlyinclude>Hello world</onlyinclude>
13985 !! result
13986 Hello world
13987 !! end
13989 !! test
13990 preload: can pass tags through if we want to
13991 !! options
13992 preload
13993 !! input
13994 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
13995 !! result
13996 <includeonly>Hello world</includeonly>
13997 !! end
13999 !! test
14000 preload: check that it doesn't try to do tricks
14001 !! options
14002 preload
14003 !! input
14004 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14005 !! result
14006 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14007 !! end
14009 !! test
14010 Play a bit with r67090 and bug 3158
14011 !! options
14012 disabled
14013 !! input
14014 <div style="width:50% !important">&nbsp;</div>
14015 <div style="width:50%&nbsp;!important">&nbsp;</div>
14016 <div style="width:50%&#160;!important">&nbsp;</div>
14017 <div style="border : solid;">&nbsp;</div>
14018 !! result
14019 <div style="width:50% !important">&nbsp;</div>
14020 <div style="width:50% !important">&nbsp;</div>
14021 <div style="width:50% !important">&nbsp;</div>
14022 <div style="border&#160;: solid;">&nbsp;</div>
14024 !! end
14026 !! test
14027 HTML5 data attributes
14028 !! input
14029 <span data-foo="bar">Baz</span>
14030 <p data-abc-def_hij="">Quuz</p>
14031 !! result
14032 <p><span data-foo="bar">Baz</span>
14033 </p>
14034 <p data-abc-def_hij="">Quuz</p>
14036 !! end
14038 !! test
14039 percent-encoding and + signs in internal links (Bug 26410)
14040 !! input
14041 [[User:+%]] [[Page+title%]]
14042 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
14043 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
14044 [[%33%45]] [[%33%45+]]
14045 !! result
14046 <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>
14047 <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>
14048 <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>
14049 <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>
14050 </p>
14051 !! end
14053 !! test
14054 Special characters in embedded file links (bug 27679)
14055 !! input
14056 [[File:Contains & ampersand.jpg]]
14057 [[File:Does not exist.jpg|Title with & ampersand]]
14058 !! result
14059 <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>
14060 <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>
14061 </p>
14062 !! end
14065 !! test
14066 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
14067 !! input
14068 Text&apos;s been normalized?
14069 !! result
14070 <p>Text&#39;s been normalized?
14071 </p>
14072 !! end
14074 !! test
14075 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
14076 !! input
14077 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
14078 !! result
14079 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
14080 </p>
14081 !! end
14083 !! test
14084 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
14085 !! input
14086 [http://www.example.org/ ideograms]
14087 !! result
14088 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
14089 </p>
14090 !! end
14092 !! test
14093 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
14094 !! input
14095 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
14096 !! result
14097 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
14098 </p>
14099 !! end
14101 !! article
14102 Mediawiki:loop1
14103 !! text
14104 {{Identical|A}}
14105 !! endarticle
14107 !! article
14108 Mediawiki:loop2
14109 !! text
14110 {{Identical|B}}
14111 !! endarticle
14113 !! article
14114 Template:Identical
14115 !! text
14116 {{int:loop1}}
14117 {{int:loop2}}
14118 !! endarticle
14120 !! test
14121 Bug 31098 Template which includes system messages which includes the template
14122 !! input
14123 {{Identical}}
14124 !! result
14125 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14126 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14127 </p>
14128 !! end
14130 !! test
14131 Bug31490 Turkish: ucfirst 'blah'
14132 !! options
14133 language=tr
14134 !! input
14135 {{ucfirst:blah}}
14136 !! result
14137 <p>Blah
14138 </p>
14139 !! end
14141 !! test
14142 Bug31490 Turkish: ucfirst 'ix'
14143 !! options
14144 language=tr
14145 !! input
14146 {{ucfirst:ix}}
14147 !! result
14148 <p>İx
14149 </p>
14150 !! end
14152 !! test
14153 Bug31490 Turkish: lcfirst 'BLAH'
14154 !! options
14155 language=tr
14156 !! input
14157 {{lcfirst:BLAH}}
14158 !! result
14159 <p>bLAH
14160 </p>
14161 !! end
14163 !! test
14164 Bug31490 Turkish: ucfırst (with a dotless i)
14165 !! options
14166 language=tr
14167 !! input
14168 {{ucfırst:blah}}
14169 !! result
14170 <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>
14171 </p>
14172 !! end
14174 !! test
14175 Bug31490 ucfırst (with a dotless i) with English language
14176 !! options
14177 language=en
14178 !! input
14179 {{ucfırst:blah}}
14180 !! result
14181 <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>
14182 </p>
14183 !! end
14185 !! test
14186 Bug 26375: TOC with italics
14187 !! options
14188 title=[[Main Page]]
14189 !! input
14190 __TOC__
14191 == ''Lost'' episodes ==
14192 !! result
14193 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14194 <ul>
14195 <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>
14196 </ul>
14197 </div>
14198 <h2><span class="mw-headline" id="Lost_episodes"><i>Lost</i> episodes</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Lost episodes">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14200 !! end
14202 !! test
14203 Bug 26375: TOC with bold
14204 !! options
14205 title=[[Main Page]]
14206 !! input
14207 __TOC__
14208 == '''should be bold''' then normal text ==
14209 !! result
14210 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14211 <ul>
14212 <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>
14213 </ul>
14214 </div>
14215 <h2><span class="mw-headline" id="should_be_bold_then_normal_text"><b>should be bold</b> then normal text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><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 class="mw-editsection-bracket">]</span></span></h2>
14217 !! end
14219 !! test
14220 Bug 33845: Headings become cursive in TOC when they contain an image
14221 !! options
14222 title=[[Main Page]]
14223 !! input
14224 __TOC__
14225 == Image [[Image:foobar.jpg]] ==
14226 !! result
14227 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14228 <ul>
14229 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
14230 </ul>
14231 </div>
14232 <h2><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><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Image">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14234 !! end
14236 !! test
14237 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
14238 !! options
14239 title=[[Main Page]]
14240 !! input
14241 __TOC__
14242 == <blockquote>Quote</blockquote> ==
14243 !! result
14244 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14245 <ul>
14246 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
14247 </ul>
14248 </div>
14249 <h2><span class="mw-headline" id="Quote"><blockquote>Quote</blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14251 !! end
14253 !! test
14254 Unclosed tags in TOC
14255 !! options
14256 title=[[Main Page]]
14257 !! input
14258 __TOC__
14259 == Proof: 2 < 3 ==
14260 <small>Hanc marginis exiguitas non caperet.</small>
14262 !! result
14263 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14264 <ul>
14265 <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>
14266 </ul>
14267 </div>
14268 <h2><span class="mw-headline" id="Proof:_2_.3C_3">Proof: 2 &lt; 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Proof: 2 &lt; 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14269 <p><small>Hanc marginis exiguitas non caperet.</small>
14271 </p>
14272 !! end
14274 !! test
14275 Multiple tags in TOC
14276 !! input
14277 __TOC__
14278 == <i>Foo</i> <b>Bar</b> ==
14280 == <i>Foo</i> <blockquote>Bar</blockquote> ==
14281 !! result
14282 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14283 <ul>
14284 <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>
14285 <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>
14286 </ul>
14287 </div>
14288 <h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14289 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote>Bar</blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14291 !! end
14293 !! test
14294 Tags with parameters in TOC
14295 !! input
14296 __TOC__
14297 == <sup class="in-h2">Hello</sup> ==
14299 == <sup class="a > b">Evilbye</sup> ==
14300 !! result
14301 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14302 <ul>
14303 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
14304 <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>
14305 </ul>
14306 </div>
14307 <h2><span class="mw-headline" id="Hello"><sup class="in-h2">Hello</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Hello">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14308 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup> b"&gt;Evilbye</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;>Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14310 !! end
14312 !! test
14313 span tags with directionality in TOC
14314 !! input
14315 __TOC__
14316 == <span dir="ltr">C++</span> ==
14318 == <span dir="rtl">זבנג!</span> ==
14320 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
14322 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
14324 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
14325 !! result
14326 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14327 <ul>
14328 <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>
14329 <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>
14330 <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>
14331 <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>
14332 <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>
14333 </ul>
14334 </div>
14335 <h2><span class="mw-headline" id="C.2B.2B"><span dir="ltr">C++</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: C++">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14336 <h2><span class="mw-headline" id=".D7.96.D7.91.D7.A0.D7.92.21"><span dir="rtl">זבנג!</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: זבנג!">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14337 <h2><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><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><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 class="mw-editsection-bracket">]</span></span></h2>
14338 <h2><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><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><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 class="mw-editsection-bracket">]</span></span></h2>
14339 <h2><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><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><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 class="mw-editsection-bracket">]</span></span></h2>
14341 !! end
14343 !! article
14344 MediaWiki:Bug32057
14345 !! text
14346 == {{int:headline_sample}} ==
14347 !! endarticle
14349 !! test
14350 Bug 32057: Title needed when expanding <h> nodes.
14351 !! options
14352 title=[[Main Page]]
14353 !! input
14354 {{int:Bug32057}}
14355 !! result
14356 <h2><span class="mw-headline" id="Headline_text">Headline text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Headline text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14358 !! end
14360 !! test
14361 Strip marker in urlencode
14362 !! input
14363 {{urlencode:x<nowiki/>y}}
14364 {{urlencode:x<nowiki/>y|wiki}}
14365 {{urlencode:x<nowiki/>y|path}}
14366 !! result
14367 <p>xy
14370 </p>
14371 !! end
14373 !! test
14374 Strip marker in lc
14375 !! input
14376 {{lc:x<nowiki/>y}}
14377 !! result
14378 <p>xy
14379 </p>
14380 !! end
14382 !! test
14383 Strip marker in uc
14384 !! input
14385 {{uc:x<nowiki/>y}}
14386 !! result
14387 <p>XY
14388 </p>
14389 !! end
14391 !! test
14392 Strip marker in formatNum
14393 !! input
14394 {{formatnum:1<nowiki/>2}}
14395 {{formatnum:1<nowiki/>2|R}}
14396 !! result
14397 <p>12
14399 </p>
14400 !! end
14402 !! test
14403 Check noCommafy in formatNum
14404 !! options
14405 language=be-tarask
14406 !! input
14407 {{formatnum:123456.78}}
14408 {{formatnum:123456.78|NOSEP}}
14409 !! result
14410 <p>123 456,78
14411 123456.78
14412 </p>
14413 !! end
14415 !! test
14416 Strip marker in grammar
14417 !! options
14418 language=fi
14419 !! input
14420 {{grammar:elative|foo<nowiki/>bar}}
14421 !! result
14422 <p>foobarista
14423 </p>
14424 !! end
14426 !! test
14427 Strip marker in padleft
14428 !! input
14429 {{padleft:|2|x<nowiki/>y}}
14430 !! result
14431 <p>xy
14432 </p>
14433 !! end
14435 !! test
14436 Strip marker in padright
14437 !! input
14438 {{padright:|2|x<nowiki/>y}}
14439 !! result
14440 <p>xy
14441 </p>
14442 !! end
14444 !! test
14445 Strip marker in anchorencode
14446 !! input
14447 {{anchorencode:x<nowiki/>y}}
14448 !! result
14449 <p>xy
14450 </p>
14451 !! end
14453 !! test
14454 nowiki inside link inside heading (bug 18295)
14455 !! input
14456 ==[[foo|x<nowiki>y</nowiki>z]]==
14457 !! result
14458 <h2><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><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: xyz">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14460 !! end
14462 !! test
14463 new support for bdi element (bug 31817)
14464 !! input
14465 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14466 !! result
14467 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14469 !!end
14471 !! test
14472 Ignore pipe between table row attributes
14473 !! input
14475 | quux
14476 |- id=foo | style='color: red'
14477 | bar
14479 !! result
14480 <table>
14481 <tr>
14482 <td> quux
14483 </td></tr>
14484 <tr id="foo" style="color: red">
14485 <td> bar
14486 </td></tr></table>
14488 !! end
14490 !!test
14491 Gallery override link with WikiLink (bug 34852)
14492 !! input
14493 <gallery>
14494 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
14495 </gallery>
14496 !! result
14497 <ul class="gallery">
14498                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14499                         <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>
14500                         <div class="gallerytext">
14501 <p>caption
14502 </p>
14503                         </div>
14504                 </div></li>
14505 </ul>
14507 !! end
14509 !!test
14510 Gallery override link with absolute external link (bug 34852)
14511 !! input
14512 <gallery>
14513 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
14514 </gallery>
14515 !! result
14516 <ul class="gallery">
14517                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14518                         <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>
14519                         <div class="gallerytext">
14520 <p>caption
14521 </p>
14522                         </div>
14523                 </div></li>
14524 </ul>
14526 !! end
14528 !!test
14529 Gallery override link with malicious javascript (bug 34852)
14530 !! input
14531 <gallery>
14532 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
14533 </gallery>
14534 !! result
14535 <ul class="gallery">
14536                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14537                         <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>
14538                         <div class="gallerytext">
14539 <p>caption
14540 </p>
14541                         </div>
14542                 </div></li>
14543 </ul>
14545 !! end
14547 !!test
14548 Gallery with invalid title as link (bug 43964)
14549 !! input
14550 <gallery>
14551 File:foobar.jpg|link=<
14552 </gallery>
14553 !! result
14554 <ul class="gallery">
14555                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14556                         <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>
14557                         <div class="gallerytext">
14558                         </div>
14559                 </div></li>
14560 </ul>
14562 !! end
14564 !!test
14565 Language parser function
14566 !! input
14567 {{#language:ar}}
14568 !! result
14569 <p>العربية
14570 </p>
14571 !! end
14573 !!test
14574 Padleft and padright as substr
14575 !! input
14576 {{padleft:|3|abcde}}
14577 {{padright:|3|abcde}}
14578 !! result
14579 <p>abc
14581 </p>
14582 !! end
14584 !!test
14585 Special parser function
14586 !! input
14587 {{#special:RandomPage}}
14588 {{#special:BaDtItLe}}
14589 {{#special:Foobar}}
14590 !! result
14591 <p>Special:Random
14592 Special:Badtitle
14593 Special:Foobar
14594 </p>
14595 !! end
14597 !!test
14598 Bug 34939 - Case insensitive link parsing ([HttP://])
14599 !! input
14600 [HttP://MediaWiki.Org/]
14601 !! result
14602 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
14603 </p>
14604 !! end
14606 !!test
14607 Bug 34939 - Case insensitive link parsing ([HttP:// title])
14608 !! input
14609 [HttP://MediaWiki.Org/ MediaWiki]
14610 !! result
14611 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
14612 </p>
14613 !! end
14615 !!test
14616 Bug 34939 - Case insensitive link parsing (HttP://)
14617 !! input
14618 HttP://MediaWiki.Org/
14619 !! result
14620 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
14621 </p>
14622 !! end
14626 ### Parsoids-specific tests
14627 ### Parsoid-PHP parser incompatibilities
14629 !!test
14630 1. SOL-sensitive wikitext tokens as template-args
14631 !!options
14632 parsoid=wt2html,wt2wt
14633 !!input
14634 {{echo|*a}}
14635 {{echo|#a}}
14636 {{echo|:a}}
14637 !!result
14638 <span about="#mwt1" typeof="mw:Transclusion">
14639 </span><ul about="#mwt1"><li>a</li></ul>
14640 <span about="#mwt2" typeof="mw:Transclusion">
14641 </span><ol about="#mwt2"><li>a</li></ol>
14642 <span about="#mwt3" typeof="mw:Transclusion">
14643 </span><dl about="#mwt3"><dd>a</dd></dl>
14644 !!end
14646 #### ----------------------------------------------------------------
14647 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
14648 #### tags. Parsoid's output for these tags differs from that of the
14649 #### PHP parser.
14650 #### ----------------------------------------------------------------
14652 !!test
14653 Ref: 1. ref-location should be replaced with an index span
14654 !!options
14655 parsoid
14656 !!input
14657 A <ref>foo</ref>
14658 B <ref name="x">foo</ref>
14659 C <ref name="y" />
14660 !!result
14661 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
14662 B <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-2">[2]</a></span>
14663 C <span about="#mwt3" class="reference" data-mw='{"name":"ref","attrs":{"name":"y"}}' id="cite_ref-y-3-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-y-3">[3]</a></span></p>
14664 !!end
14666 !!test
14667 Ref: 2. ref-tags with identical names should all get the same index
14668 !!options
14669 parsoid
14670 !!input
14671 A <ref name="x">foo</ref>
14672 B <ref name="x" />
14673 !!result
14674 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span>
14675 B <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span></p>
14676 !!end
14678 !!test
14679 Ref: 3. spaces in ref-names should be ignored
14680 !!options
14681 parsoid
14682 !!input
14683 A <ref name="x">foo</ref>
14684 B <ref name=" x " />
14685 C <ref name= x  />
14686 !!result
14687 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span>
14688 B <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span>
14689 C <span about="#mwt3" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-2" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span></p>
14690 !!end
14692 !!test
14693 Ref: 4. 'constructor' should be accepted as a valid ref-name
14694 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
14695 !!options
14696 parsoid
14697 !!input
14698 A <ref name="constructor">foo</ref>
14699 !!result
14700 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"constructor"}}' id="cite_ref-constructor-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-constructor-1">[1]</a></span></p>
14701 !!end
14703 !!test
14704 Ref: 5. body should accept generic wikitext
14705 !!options
14706 parsoid
14707 !!input
14708 A <ref>
14709  This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
14710 </ref>
14712 <references />
14713 !!result
14714 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"This is a <b data-parsoid=\"{&amp;quot;dsr&amp;quot;:[19,40,3,3]}\"><a rel=\"mw:WikiLink\" href=\"./Bolded_link\" data-parsoid=\"{&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Bolded_link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;bolded link&amp;quot;},&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;dsr&amp;quot;:[22,37,2,2]}\">bolded link</a></b> and this is a <span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;transclusion&amp;quot;}}}\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;{{echo|transclusion}}&amp;quot;,&amp;quot;dsr&amp;quot;:[55,76,null,null]}\">transclusion</span>\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
14716 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14717 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> This is a <b><a rel="mw:WikiLink" href="./Bolded_link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}}}'>transclusion</span>
14718 </li></ol>
14719 !!end
14721 !!test
14722 Ref: 6. indent-pres should not be output in ref-body
14723 !!options
14724 parsoid
14725 !!input
14726 A <ref>
14727  foo
14728  bar
14729  baz
14730 </ref>
14732 <references />
14733 !!result
14734 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo\n bar\n baz\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
14736 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14737 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14738  bar
14739  baz
14740 </li></ol>
14741 !!end
14743 !!test
14744 Ref: 6. No p-wrapping in ref-body
14745 !!options
14746 parsoid
14747 !!input
14748 A <ref>
14758 booz
14759 </ref>
14761 <references />
14762 !!result
14763 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo\n\nbar\n\n\nbaz\n\n\n\nbooz\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
14765 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14766 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14775 booz
14776 </li></ol>
14777 !!end
14779 !!test
14780 Ref: 8. transclusion wikitext has lower precedence
14781 !!options
14782 parsoid
14783 !!input
14784 A <ref> foo {{echo|</ref> B C}}
14786 <references />
14787 !!result
14788 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo <span typeof=\"mw:Nowiki\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;{{&amp;quot;,&amp;quot;dsr&amp;quot;:[12,14,2,null]}\">{{</span>echo|"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B C<span typeof="mw:Nowiki">}}</span></p>
14790 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14791 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <span typeof="mw:Nowiki">{{</span>echo|</li></ol>
14792 !!end
14794 !!test
14795 Ref: 9. unclosed comments should not leak out of ref-body
14796 !!options
14797 parsoid
14798 !!input
14799 A <ref> foo <!--</ref> B C
14801 <references />
14802 !!result
14803 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo <!---->"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B C</p>
14805 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14806 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
14807 !!end
14809 !!test
14810 Ref: 10. Unclosed HTML tags should not leak out of ref-body
14811 !!options
14812 parsoid
14813 !!input
14814 A <ref> <b> foo </ref> B C
14816 <references />
14817 !!result
14818 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"<b data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;autoInsertedEnd&amp;quot;:true,&amp;quot;dsr&amp;quot;:[8,16,3,0]}\"> foo </b>"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B C</p>
14820 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14821 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> <b> foo </b></li></ol>
14822 !!end
14824 !!test
14825 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
14826 !!options
14827 parsoid
14828 !!input
14829 A <ref>foo</ref> B
14830 C <ref>bar</ref> D
14831 !!result
14832 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B
14833 C <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span> D</p>
14834 !!end
14836 !!test
14837 Ref: 12. ref-tags act as trailing newline migration barrier
14838 !!options
14839 parsoid
14840 !!input
14841 <!--the newline at the end of this line moves out of the p-tag-->a
14843 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
14844 <ref />
14847 !!result
14848 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
14851 <p>b<!--the newline at the end of this line stays inside the p-tag--> <span about="#mwt1" class="reference" data-mw='{"name":"ref","attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
14852 <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span></p>
14855 <p>c</p>
14856 !!end
14858 !!test
14859 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
14860 !!options
14861 parsoid
14862 !!input
14863 <ref>foo</ref> A
14864 <ref>bar
14865 </ref> B
14866 !!result
14867 <p><span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> A
14868 <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"bar\n"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span> B</p>
14869 !!end
14871 !!test
14872 Ref: 14. A nested ref-tag should be emitted as plain text
14873 !!options
14874 parsoid
14875 !!input
14876 <ref>foo <ref>bar</ref> baz</ref>
14878 <references />
14879 !!result
14880 <span about="#mwt1" class="reference" data-mw="{&quot;name&quot;:&quot;ref&quot;,&quot;body&quot;:{&quot;html&quot;:&quot;foo &amp;lt;ref&amp;gt;bar&amp;lt;/ref&amp;gt; baz&quot;},&quot;attrs&quot;:{}}" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
14882 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
14883 <li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo &lt;ref&gt;bar&lt;/ref&gt; baz</li></ol>
14884 !!end
14886 !!test
14887 Ref: 15. ref-tags with identical names should get identical indexes
14888 !!options
14889 parsoid
14890 !!input
14891 A1 <ref name="a">foo</ref> A2 <ref name="a" />
14892 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
14894 <references />
14895 !!result
14896 <p>A1 <span about="#mwt3" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a"}}' id="cite_ref-a-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-a-1">[1]</a></span> A2 <span about="#mwt4" class="reference" data-mw='{"name":"ref","attrs":{"name":"a"}}' id="cite_ref-a-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-a-1">[1]</a></span>
14897 B1 <span about="#mwt7" class="reference" data-mw='{"name":"ref","attrs":{"name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-b-2">[2]</a></span> B2 <span about="#mwt8" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}' id="cite_ref-b-2-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-b-2">[2]</a></span></p>
14899 <ol about="#mwt10" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-a-1-0">1.0</a> <a href="#cite_ref-a-1-1">1.1</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy">↑ <a href="#cite_ref-b-2-0">2.0</a> <a href="#cite_ref-b-2-1">2.1</a></span> bar</li></ol>
14900 !!end
14902 !!test
14903 References: 1. references tag without any refs should be handled properly
14904 !!options
14905 parsoid
14906 !!input
14907 <references />
14908 !!result
14909 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
14910 !!end
14912 !!test
14913 References: 2. references tag with group only outputs references from that group
14914 !!options
14915 parsoid
14916 !!input
14917 A <ref group="a">foo</ref>
14918 B <ref group="b">bar</ref>
14920 <references group='a' />
14921 !!result
14922 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"group":"a"}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[a 1]</a></span>
14923 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"group":"b"}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[b 1]</a></span></p>
14925 <ol about="#mwt6" class="references" data-mw='{"name":"references","attrs":{"group":"a"}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
14926 !!end
14928 !!test
14929 References: 3. ref list should be cleared after processing references
14930 !!options
14931 parsoid
14932 !!input
14933 A <ref>foo</ref>
14935 <references />
14937 B <ref>bar</ref>
14939 <references />
14940 !!result
14941 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
14943 <ol about="#mwt4" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
14945 <p>B <span about="#mwt6" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
14947 <ol about="#mwt8" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> bar</li></ol>
14948 !!end
14950 !!test
14951 References: 4. only referenced group should be cleared after processing references
14952 !!options
14953 parsoid
14954 !!input
14955 A <ref group="a">afoo</ref>
14956 B <ref>bfoo</ref>
14958 <references group="a"/>
14960 C <ref>cfoo</ref>
14962 <references />
14963 !!result
14964 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"afoo"},"attrs":{"group":"a"}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[a 1]</a></span>
14965 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bfoo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"<ref>bfoo</ref>","dsr":[30,45,5,6]}'><a href="#cite_note-1">[1]</a></span></p>
14967 <ol about="#mwt6" class="references" data-mw='{"name":"references","attrs":{"group":"a"}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> afoo</li></ol>
14969 <p>C <span about="#mwt8" class="reference" data-mw='{"name":"ref","body":{"html":"cfoo"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span></p>
14971 <ol about="#mwt10" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> bfoo</li><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2-0">↑</a></span> cfoo</li></ol>
14972 !!end
14974 !!test
14975 References: 5. ref tags in references should be processed while ignoring all other content
14976 !!options
14977 parsoid
14978 !!input
14979 A <ref name="a" />
14980 B <ref name="b">bar</ref>
14982 <references>
14983 <ref name="a">foo</ref>
14984 This should just get lost.
14985 </references>
14986 !!result
14987 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"a"}}' id="cite_ref-a-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-a-1">[1]</a></span>
14988 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-b-2">[2]</a></span></p>
14990 <ol about="#mwt7" class="references" data-mw='{"name":"references","body":{"extsrc":"<ref name=\"a\">foo</ref>\nThis should just get lost."},"attrs":{}}' typeof="mw:Extension/references"><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="#cite_ref-a-1-0">↑</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> bar</li></ol>
14991 !!end
14993 !!test
14994 References: 6. <references /> from a transclusion
14995 !!options
14996 parsoid
14997 !!input
14998 {{echo|<references />}}
14999 !!result
15000 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}'></ol>
15001 !!end
15003 #### ----------------------------------------------------------------
15004 #### The following section of tests are primarily to test
15005 #### wikitext escaping capabilities of Parsoid.  Given that
15006 #### escaping can be done any number of ways, the wikitext (input)
15007 #### is always adjusted to reflect how Parsoid adds nowiki
15008 #### escape tags.
15009 ####
15010 #### We are marking several tests as parsoid-only since the
15011 #### HTML in the result section is different from what the
15012 #### PHP parser generates for it.
15013 #### ----------------------------------------------------------------
15016 #### --------------- Headings ---------------
15017 #### 0. Unnested
15018 #### 1. Nested inside html <h1>=foo=</h1>
15019 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
15020 #### 3. Nested inside html with wikitext split by html tags
15021 #### 4. No escape needed
15022 #### 5. Empty headings <h1></h1>
15023 #### 6. Heading chars in SOL context
15024 #### ----------------------------------------
15025 !! test
15026 Headings: 0. Unnested
15027 !! options
15028 parsoid
15029 !! input
15030 <nowiki>=foo=</nowiki>
15032 <nowiki> =foo= </nowiki>
15033 <!--cmt-->
15034 <nowiki>=foo=</nowiki>
15036 =foo''a''<nowiki>=</nowiki>
15037 !! result
15038 <p><span typeof="mw:Nowiki">=foo=</span></p>
15040 <p><span typeof="mw:Nowiki"> =foo= </span>
15041 <!--cmt-->
15042 <span typeof="mw:Nowiki">=foo=</span></p>
15044 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
15045 !!end
15047 !! test
15048 Headings: 1. Nested inside html
15049 !! options
15050 parsoid
15051 !! input
15052 =<nowiki>=foo=</nowiki>=
15054 ==<nowiki>=foo=</nowiki>==
15056 ===<nowiki>=foo=</nowiki>===
15058 ====<nowiki>=foo=</nowiki>====
15060 =====<nowiki>=foo=</nowiki>=====
15062 ======<nowiki>=foo=</nowiki>======
15063 !! result
15064 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
15065 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
15066 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
15067 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
15068 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
15069 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
15070 !!end
15072 !! test
15073 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
15074 !! options
15075 parsoid
15076 !! input
15077 =foo=
15078 <nowiki>*</nowiki>bar
15080 =foo=
15081 =bar
15083 =foo=
15084 <nowiki>=bar=</nowiki>
15085 !! result
15086 <h1>foo</h1>*bar
15087 <h1>foo</h1>=bar
15088 <h1>foo</h1>=bar=
15089 !!end
15091 !! test
15092 Headings: 3. Nested inside html with wikitext split by html tags
15093 !! options
15094 parsoid
15095 !! input
15096 =='''bold'''<nowiki>foo=</nowiki>=
15097 !! result
15098 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
15099 !!end
15101 !! test
15102 Headings: 4a. No escaping needed (testing just h1 and h2)
15103 !! options
15104 parsoid
15105 !! input
15106 ==foo=
15108 =foo==
15110 = =foo= =
15112 ==foo= bar=
15114 ===foo==
15116 ==foo===
15118 =''=''foo==
15120 =<nowiki>=</nowiki>=
15121 !! result
15122 <h1>=foo</h1>
15123 <h1>foo=</h1>
15124 <h1> =foo= </h1>
15125 <h1>=foo= bar</h1>
15126 <h2>=foo</h2>
15127 <h2>foo=</h2>
15128 <h1><i>=</i>foo=</h1>
15129 <h1><span typeof="mw:Nowiki">=</span></h1>
15130 !!end
15132 !! test
15133 Headings: 4b. No escaping needed (inside p-tags)
15134 !! options
15135 parsoid
15136 !! input
15138 =foo= x
15139 =foo= <s></s>
15140 !! result
15141 <p>===
15142 =foo= x
15143 =foo= <s></s>
15144 </p>
15145 !!end
15147 !! test
15148 Headings: 5. Empty headings
15149 !! options
15150 parsoid
15151 !! input
15152 =<nowiki/>=
15154 ==<nowiki/>==
15156 ===<nowiki/>===
15158 ====<nowiki/>====
15160 =====<nowiki/>=====
15162 ======<nowiki/>======
15163 !! result
15164 <h1></h1>
15165 <h2></h2>
15166 <h3></h3>
15167 <h4></h4>
15168 <h5></h5>
15169 <h6></h6>
15170 !!end
15172 !! test
15173 Headings: 6a. Heading chars in SOL context (with trailing spaces)
15174 !! options
15175 parsoid
15176 !! input
15177 <nowiki>=a=</nowiki>
15179 <nowiki>=a=</nowiki> 
15181 <nowiki>=a=</nowiki>    
15183 <nowiki>=a=</nowiki>    
15184 !! result
15185 <p>=a=</p>
15186 <p>=a= </p>
15187 <p>=a=  </p>
15188 <p>=a=  </p>
15189 !!end
15191 !! test
15192 Headings: 6b. Heading chars in SOL context (with trailing newlines)
15193 !! options
15194 parsoid
15195 !! input
15196 <nowiki>=a=
15197 b</nowiki>
15199 <nowiki>=a= 
15200 b</nowiki>
15202 <nowiki>=a=     
15203 b</nowiki>
15205 <nowiki>=a=      
15206 b</nowiki>
15207 !! result
15208 <p>=a=
15209 b</p>
15210 <p>=a= 
15211 b</p>
15212 <p>=a=  
15213 b</p>
15214 <p>=a=   
15215 b</p>
15216 </p>
15217 !!end
15219 !! test
15220 Headings: 6c. Heading chars in SOL context (leading newline break)
15221 !! options
15222 parsoid
15223 !! input
15225 <nowiki>=b=</nowiki>
15226 !! result
15227 <p>a
15228 =b=</p>
15229 !!end
15231 !! test
15232 Headings: 6d. Heading chars in SOL context (with interspersed comments)
15233 !! options
15234 parsoid
15235 !! input
15236 <!--c0--><nowiki>=a=</nowiki>
15237 <!--c1-->
15238 <nowiki>=a=</nowiki> <!--c2-->   <!--c3-->
15239 !! result
15240 <p><!--c0-->=a=</p>
15241 <p><!--c1-->=a= <!--c2-->        <!--c3--></p>
15242 !!end
15244 !! test
15245 Headings: 6d. Heading chars in SOL context (No escaping needed)
15246 !! options
15247 parsoid=html2wt
15248 !! input
15249 =a=<div>b</div>
15250 !! result
15251 =a=<div>b</div>
15252 !!end
15254 #### --------------- Lists ---------------
15255 #### 0. Outside nests (*foo, etc.)
15256 #### 1. Nested inside html <ul><li>*foo</li></ul>
15257 #### 2. Inside definition lists
15258 #### 3. Only bullets at start should be escaped
15259 #### 4. No escapes needed
15260 #### 5. No unnecessary escapes
15261 #### 6. Escape bullets in SOL position
15262 #### 7. Escape bullets in a multi-line context
15263 #### ----------------------------------------
15265 !! test
15266 Lists: 0. Outside nests
15267 !! input
15268 <nowiki>*</nowiki>foo
15270 <nowiki>#</nowiki>foo
15271 !! result
15272 <p>*foo
15273 </p><p>#foo
15274 </p>
15275 !!end
15277 !! test
15278 Lists: 1. Nested inside html
15279 !! input
15280 *<nowiki>*foo</nowiki>
15282 *<nowiki>#foo</nowiki>
15284 *<nowiki>:foo</nowiki>
15286 *<nowiki>;foo</nowiki>
15288 #<nowiki>*foo</nowiki>
15290 #<nowiki>#foo</nowiki>
15292 #<nowiki>:foo</nowiki>
15294 #<nowiki>;foo</nowiki>
15295 !! result
15296 <ul><li>*foo
15297 </li></ul>
15298 <ul><li>#foo
15299 </li></ul>
15300 <ul><li>:foo
15301 </li></ul>
15302 <ul><li>;foo
15303 </li></ul>
15304 <ol><li>*foo
15305 </li></ol>
15306 <ol><li>#foo
15307 </li></ol>
15308 <ol><li>:foo
15309 </li></ol>
15310 <ol><li>;foo
15311 </li></ol>
15313 !!end
15315 !! test
15316 Lists: 2. Inside definition lists
15317 !! input
15318 ;<nowiki>;foo</nowiki>
15320 ;<nowiki>:foo</nowiki>
15322 ;<nowiki>:foo</nowiki>
15323 :bar
15325 :<nowiki>:foo</nowiki>
15326 !! result
15327 <dl><dt>;foo
15328 </dt></dl>
15329 <dl><dt>:foo
15330 </dt></dl>
15331 <dl><dt>:foo
15332 </dt><dd>bar
15333 </dd></dl>
15334 <dl><dd>:foo
15335 </dd></dl>
15337 !!end
15339 !! test
15340 Lists: 3. Only bullets at start of text should be escaped
15341 !! input
15342 *<nowiki>*foo*bar</nowiki>
15344 *<nowiki>*foo</nowiki>''it''*bar
15345 !! result
15346 <ul><li>*foo*bar
15347 </li></ul>
15348 <ul><li>*foo<i>it</i>*bar
15349 </li></ul>
15351 !!end
15353 !! test
15354 Lists: 4. No escapes needed
15355 !! options
15356 parsoid
15357 !! input
15358 *foo*bar
15360 *''foo''*bar
15362 *[[Foo]]: bar
15363 !! result
15364 <ul><li>foo*bar
15365 </li></ul>
15366 <ul><li><i>foo</i>*bar
15367 </li></ul>
15368 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
15369 </li></ul>
15370 !!end
15372 !! test
15373 Lists: 5. No unnecessary escapes
15374 !! input
15375 * bar <span><nowiki>[[foo]]</nowiki></span>
15377 *=bar <span><nowiki>[[foo]]</nowiki></span>
15379 *[[bar <span><nowiki>[[foo]]</nowiki></span>
15381 *]]bar <span><nowiki>[[foo]]</nowiki></span>
15383 *=bar <span>foo]]</span>=
15385 * <s></s>: a
15386 !! result
15387 <ul><li> bar <span>[[foo]]</span>
15388 </li></ul>
15389 <ul><li>=bar <span>[[foo]]</span>
15390 </li></ul>
15391 <ul><li>[[bar <span>[[foo]]</span>
15392 </li></ul>
15393 <ul><li>]]bar <span>[[foo]]</span>
15394 </li></ul>
15395 <ul><li>=bar <span>foo]]</span>=
15396 </li></ul>
15397 <ul><li> <s></s>: a
15398 </li></ul>
15400 !!end
15402 !! test
15403 Lists: 6. Escape bullets in SOL position
15404 !! options
15405 parsoid
15406 !! input
15407 <!--cmt--><nowiki>*foo</nowiki>
15408 !! result
15409 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
15410 !!end
15412 !! test
15413 Lists: 7. Escape bullets in a multi-line context
15414 !! input
15416 <nowiki>*</nowiki>b
15417 !! result
15418 <p>a
15420 </p>
15421 !!end
15423 #### --------------- HRs ---------------
15424 #### 1. Single line
15425 #### -----------------------------------
15427 !! test
15428 HRs: 1. Single line
15429 !! options
15430 parsoid
15431 !! input
15432 ----<nowiki>----</nowiki>
15433 ----=foo=
15434 ----*foo
15435 !! result
15436 <hr><span typeof="mw:Nowiki">----</span>
15437 <hr>=foo=
15438 <hr>*foo
15439 !! end
15441 #### --------------- Tables ---------------
15442 #### 1a. Simple example
15443 #### 1b. No escaping needed (!foo)
15444 #### 1c. No escaping needed (|foo)
15445 #### 1d. No escaping needed (|}foo)
15446 ####
15447 #### 2a. Nested in td (<td>foo|bar</td>)
15448 #### 2b. Nested in td (<td>foo||bar</td>)
15449 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
15450 ####
15451 #### 3a. Nested in th (<th>foo!bar</th>)
15452 #### 3b. Nested in th (<th>foo!!bar</th>)
15453 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
15454 ####
15455 #### 4a. Escape -
15456 #### 4b. Escape +
15457 #### 4c. No escaping needed
15458 #### --------------------------------------
15460 !! test
15461 Tables: 1a. Simple example
15462 !! input
15463 <nowiki>{|
15464 |}</nowiki>
15465 !! result
15466 <p>{|
15468 </p>
15469 !! end
15471 !! test
15472 Tables: 1b. No escaping needed
15473 !! input
15474 !foo
15475 !! result
15476 <p>!foo
15477 </p>
15478 !! end
15480 !! test
15481 Tables: 1c. No escaping needed
15482 !! input
15483 |foo
15484 !! result
15485 <p>|foo
15486 </p>
15487 !! end
15489 !! test
15490 Tables: 1d. No escaping needed
15491 !! input
15492 |}foo
15493 !! result
15494 <p>|}foo
15495 </p>
15496 !! end
15498 !! test
15499 Tables: 2a. Nested in td
15500 !! options
15501 parsoid
15502 !! input
15504 |<nowiki>foo|bar</nowiki>
15506 !! result
15507 <table><tbody><tr>
15508 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
15509 !! end
15511 !! test
15512 Tables: 2b. Nested in td
15513 !! options
15514 parsoid
15515 !! input
15517 |<nowiki>foo||bar</nowiki>
15518 |''it''<nowiki>foo||bar</nowiki>
15520 !! result
15521 <table><tbody><tr>
15522 <td><span typeof="mw:Nowiki">foo||bar</span></td>
15523 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
15524 !! end
15526 !! test
15527 Tables: 2c. Nested in td -- no escaping needed
15528 !! options
15529 parsoid
15530 !! input
15532 |foo!!bar
15534 !! result
15535 <table><tbody><tr><td>foo!!bar
15536 </td></tr></tbody></table>
15538 !! end
15540 !! test
15541 Tables: 3a. Nested in th
15542 !! options
15543 parsoid
15544 !! input
15546 !foo!bar
15548 !! result
15549 <table><tbody><tr><th>foo!bar
15550 </th></tr></tbody></table>
15552 !! end
15554 !! test
15555 Tables: 3b. Nested in th
15556 !! options
15557 parsoid
15558 !! input
15560 !<nowiki>foo!!bar</nowiki>
15562 !! result
15563 <table>
15564 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
15565 </tbody></table>
15566 !! end
15568 !! test
15569 Tables: 3c. Nested in th -- no escaping needed
15570 !! options
15571 parsoid
15572 !! input
15574 !<nowiki>foo||bar</nowiki>
15576 !! result
15577 <table><tbody><tr>
15578 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
15579 !! end
15581 !! test
15582 Tables: 4a. Escape -
15583 !! options
15584 parsoid
15585 !! input
15588 !-bar
15590 |<nowiki>-bar</nowiki>
15592 !! result
15593 <table><tbody>
15594 <tr><th>-bar</th></tr>
15595 <tr>
15596 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
15597 !! end
15599 !! test
15600 Tables: 4b. Escape +
15601 !! options
15602 parsoid
15603 !! input
15606 !+bar
15608 |<nowiki>+bar</nowiki>
15610 !! result
15611 <table><tbody>
15612 <tr><th>+bar</th></tr>
15613 <tr>
15614 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
15615 !! end
15617 !! test
15618 Tables: 4c. No escaping needed
15619 !! options
15620 parsoid
15621 !! input
15624 |foo-bar
15625 |foo+bar
15627 |''foo''-bar
15628 |''foo''+bar
15630 !! result
15631 <table><tbody>
15632 <tr><td>foo-bar</td><td>foo+bar</td></tr>
15633 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
15634 </tbody></table>
15635 !! end
15637 ### SSS FIXME: Disabled right now because accurate html2wt
15638 ### on this snippet requires data-parsoid flags that we've
15639 ### stripped out of these tests.  We should scheme how we
15640 ### we want to handle these kind of tests that require
15641 ### data-parsoid flags for accurate html2wt serialization
15643 !! test
15644 Tables: 4d. No escaping needed
15645 !! options
15646 disabled
15647 !! input
15649 ||+1
15650 ||-2
15652 !! result
15653 <table>
15654 <tr>
15655 <td>+1
15656 </td>
15657 <td>-2
15658 </td></tr></table>
15660 !! end
15662 #### --------------- Links ----------------
15663 #### 1. Quote marks in link text
15664 #### 2. Wikilinks: Escapes needed
15665 #### 3. Wikilinks: No escapes needed
15666 #### 4. Extlinks: Escapes needed
15667 #### 5. Extlinks: No escapes needed
15668 #### --------------------------------------
15669 !! test
15670 Links 1. Quote marks in link text
15671 !! options
15672 parsoid
15673 !! input
15674 [[Foo|Foo<nowiki>''boo''</nowiki>]]
15675 !! result
15676 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
15677 !! end
15679 !! test
15680 Links 2. WikiLinks: Escapes needed
15681 !! options
15682 parsoid
15683 !! input
15684 [[Foo|<nowiki>[Foobar]</nowiki>]]
15685 [[Foo|<nowiki>Foobar]</nowiki>]]
15686 [[Foo|x [Foobar] x]]
15687 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
15688 [[Foo|<nowiki>[[Bar]]</nowiki>]]
15689 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
15690 [[Foo|<nowiki>|Bar</nowiki>]]
15691 [[Foo|<nowiki>]]bar</nowiki>]]
15692 [[Foo|<nowiki>[[bar</nowiki>]]
15693 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
15694 !! result
15695 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
15696 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
15697 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
15698 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
15699 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
15700 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
15701 <a href="Foo" rel="mw:WikiLink">|Bar</a>
15702 <a href="Foo" rel="mw:WikiLink">]]bar</a>
15703 <a href="Foo" rel="mw:WikiLink">[[bar</a>
15704 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
15705 !! end
15707 !! test
15708 Links 3. WikiLinks: No escapes needed
15709 !! options
15710 parsoid
15711 !! input
15712 [[Foo|[Foobar]]
15713 [[Foo|foo|bar]]
15714 !! result
15715 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
15716 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
15717 !! end
15719 !! test
15720 Links 4. ExtLinks: Escapes needed
15721 !! options
15722 parsoid
15723 !! input
15724 [http://google.com <nowiki>[google]</nowiki>]
15725 [http://google.com <nowiki>google]</nowiki>]
15726 !! result
15727 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
15728 <a href="http://google.com" rel="mw:ExtLink">google]</a>
15729 !! end
15731 !! test
15732 Links 5. ExtLinks: No escapes needed
15733 !! options
15734 parsoid
15735 !! input
15736 [http://google.com [google]
15737 !! result
15738 <a href="http://google.com" rel="mw:ExtLink">[google</a>
15739 !! end
15741 #### --------------- Quotes ---------------
15742 #### 1. Quotes inside <b> and <i>
15743 #### 2. Link fragments separated by <i> and <b> tags
15744 #### 3. Link fragments inside <i> and <b>
15745 #### --------------------------------------
15746 !! test
15747 1. Quotes inside <b> and <i>
15748 !! input
15749 ''<nowiki>'foo'</nowiki>''
15750 ''<nowiki>''foo''</nowiki>''
15751 ''<nowiki>'''foo'''</nowiki>''
15752 ''foo''<nowiki>'s</nowiki>
15753 '''<nowiki>'foo'</nowiki>'''
15754 '''<nowiki>''foo''</nowiki>'''
15755 '''<nowiki>'''foo'''</nowiki>'''
15756 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
15757 '''foo'''<nowiki>'s</nowiki>
15758 !! result
15759 <p><i>'foo'</i>
15760 <i>''foo''</i>
15761 <i>'''foo'''</i>
15762 <i>foo</i>'s
15763 <b>'foo'</b>
15764 <b>''foo''</b>
15765 <b>'''foo'''</b>
15766 <b>foo'<i>bar'</i>baz</b>
15767 <b>foo</b>'s
15768 </p>
15769 !! end
15771 !! test
15772 2. Link fragments separated by <i> and <b> tags
15773 !! input
15774 [[''foo''<nowiki>hello]]</nowiki>
15776 [['''foo'''<nowiki>hello]]</nowiki>
15777 !! result
15778 <p>[[<i>foo</i>hello]]
15779 </p><p>[[<b>foo</b>hello]]
15780 </p>
15781 !! end
15783 !! test
15784 2. Link fragments inside <i> and <b>
15785 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
15786  this is one of the shortcomings of this format)
15787 !! input
15788 ''[[foo''<nowiki>]]</nowiki>
15790 '''[[foo'''<nowiki>]]</nowiki>
15791 !! result
15792 <p><i>[[foo</i>]]
15793 </p><p><b>[[foo</b>]]
15794 </p>
15795 !! end
15797 #### ----------- Paragraphs ---------------
15798 #### 1. No unnecessary escapes
15799 #### --------------------------------------
15801 !! test
15802 1. No unnecessary escapes
15803 !! input
15804 bar <span><nowiki>[[foo]]</nowiki></span>
15806 =bar <span><nowiki>[[foo]]</nowiki></span>
15808 [[bar <span><nowiki>[[foo]]</nowiki></span>
15810 ]]bar <span><nowiki>[[foo]]</nowiki></span>
15812 =bar <span>foo]]</span><nowiki>=</nowiki>
15813 !! result
15814 <p>bar <span>[[foo]]</span>
15815 </p><p>=bar <span>[[foo]]</span>
15816 </p><p>[[bar <span>[[foo]]</span>
15817 </p><p>]]bar <span>[[foo]]</span>
15818 </p><p>=bar <span>foo]]</span>=
15819 </p>
15820 !!end
15822 #### ----------------------- PRE --------------------------
15823 #### 1. Leading whitespace in SOL context should be escaped
15824 #### ------------------------------------------------------
15825 !! test
15826 1. Leading whitespace in SOL context should be escaped
15827 !! options
15828 parsoid
15829 !! input
15830 <nowiki> </nowiki>a
15832 <nowiki> </nowiki> a
15834 <nowiki>        </nowiki>a(tab)
15836 <nowiki> </nowiki>      a
15837 <!--cmt-->
15838 <nowiki> </nowiki> a
15841 <nowiki> </nowiki>b
15844 <nowiki>        </nowiki>b
15847 <nowiki>        </nowiki> b
15848 !! result
15849 <p> a</p>
15850 <p>  a</p>
15851 <p>     a(tab)</p>
15852 <p>     a</p>
15853 <p><!--cmt-->  a</p>
15854 <p>a
15855  b</p>
15856 <p>a
15857         b</p>
15858 <p>a
15859          b</p>
15860 !! end
15862 #### --------------- HTML tags ---------------
15863 #### 1. a tags
15864 #### 2. other tags
15865 #### 3. multi-line html tag
15866 #### -----------------------------------------
15867 !! test
15868 1. a tags
15869 !! options
15870 parsoid
15871 !! input
15872 <a href="http://google.com">google</a>
15873 !! result
15874 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
15875 !! end
15877 !! test
15878 2. other tags
15879 !! input
15880 <nowiki><div>foo</div>
15881 <div style="color:red">foo</div></nowiki>
15882 !! result
15883 <p>&lt;div&gt;foo&lt;/div&gt;
15884 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
15885 </p>
15886 !! end
15888 !! test
15889 3. multi-line html tag
15890 !! input
15891 <nowiki><div
15892 >foo</div
15893 ></nowiki>
15894 !! result
15895 <p>&lt;div
15896 &gt;foo&lt;/div
15897 &gt;
15898 </p>
15899 !! end
15901 !! test
15902 4. extension tags
15903 !! input
15904 <nowiki><ref>foo</ref></nowiki>
15905 !! result
15906 <p>&lt;ref&gt;foo&lt;/ref&gt;
15907 </p>
15908 !! end
15910 #### --------------- Others ---------------
15911 !! test
15912 Escaping nowikis
15913 !! input
15914 &lt;nowiki&gt;foo&lt;/nowiki&gt;
15915 !! result
15916 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
15917 </p>
15918 !! end
15919 !! test
15921 Tag-like HTML structures are passed through as text
15922 !! input
15923 <x y>
15925 <x.y>
15927 <x-y>
15935 1<d e>f
15936 !! result
15937 <p>&lt;x y&gt;
15938 </p><p>&lt;x.y&gt;
15939 </p><p>&lt;x-y&gt;
15940 </p><p>1&gt;2
15941 </p><p>x&lt;y
15942 </p><p>a&gt;b
15943 </p><p>1&lt;d e&gt;f
15944 </p>
15945 !! end
15948 # This fails in the PHP parser (see bug 40670,
15949 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
15950 !! test
15951 Tag names followed by punctuation should not be recognized as tags
15952 !! options
15953 parsoid
15954 !! input
15955 <s.ome> text
15956 !! result
15957 <p>&lt;s.ome&gt; text
15958 </p>
15959 !! end
15961 !! test
15962 HTML tag with necessary entities in attributes
15963 !! input
15964 <span title="&amp;amp;">foo</span>
15965 !! result
15966 <p><span title="&amp;amp;">foo</span>
15967 </p>
15968 !! end
15970 !! test
15971 HTML tag with 'unnecessary' entity encoding in attributes
15972 !! input
15973 <span title="&amp;">foo</span>
15974 !! result
15975 <p><span title="&amp;">foo</span>
15976 </p>
15977 !! end
15979 !! test
15980 HTML tag with broken attribute value quoting
15981 !! input
15982 <span title="Hello world>Foo</span>
15983 !! result
15984 <p><span>Foo</span>
15985 </p>
15986 !! end
15988 !! test
15989 Parsoid-only: HTML tag with broken attribute value quoting
15990 !! options
15991 parsoid
15992 !! input
15993 <span title="Hello world>Foo</span>
15994 !! result
15995 <p><span title="Hello world">Foo</span>
15996 </p>
15997 !! end
15999 !! test
16000 Table with broken attribute value quoting
16001 !! input
16003 | title="Hello world|Foo
16005 !! result
16006 <table>
16007 <tr>
16008 <td>Foo
16009 </td></tr></table>
16011 !! end
16013 !! test
16014 Table with broken attribute value quoting on consecutive lines
16015 !! input
16017 | title="Hello world|Foo
16018 | style="color:red|Bar
16020 !! result
16021 <table>
16022 <tr>
16023 <td>Foo
16024 </td>
16025 <td>Bar
16026 </td></tr></table>
16028 !! end
16030 !! test
16031 Parsoid-only: Table with broken attribute value quoting on consecutive lines
16032 !! options
16033 parsoid
16034 !! input
16036 | title="Hello world|Foo
16037 | style="color:red|Bar
16039 !! result
16040 <table><tbody>
16041 <tr>
16042 <td title="Hello world">Foo
16043 </td><td style="color: red">Bar
16044 </td></tr></tbody></table>
16046 !! end
16048 !! test
16049 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16050 !! options
16051 parsoid
16052 !! input
16053 {{}}
16054 !! result
16055 {{}}
16056 !! end
16058 !! test
16059 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16060 !! options
16061 parsoid
16062 !! input
16063 }}{{
16064 !! result
16065 }}{{
16066 !! end
16068 !!test
16069 Accept empty td cell attribute
16070 !!input
16072 | align="center" | foo ||  |
16074 !!result
16075 <table>
16076 <tr>
16077 <td align="center"> foo </td>
16078 <td>
16079 </td></tr></table>
16081 !!end
16083 !!test
16084 Non-empty attributes in th-cells
16085 !!input
16087 ! Foo !! style="color: red" | Bar
16089 !!result
16090 <table>
16091 <tr>
16092 <th> Foo </th>
16093 <th style="color: red"> Bar
16094 </th></tr></table>
16096 !!end
16098 !!test
16099 Accept empty attributes in th-cells
16100 !!input
16102 !| foo !!| bar
16104 !!result
16105 <table>
16106 <tr>
16107 <th> foo </th>
16108 <th> bar
16109 </th></tr></table>
16111 !!end
16113 !!test
16114 Empty table rows go away
16115 !!input
16117 | Hello
16118 | there
16119 |- class="foo"
16122 !! result
16123 <table>
16124 <tr>
16125 <td> Hello
16126 </td>
16127 <td> there
16128 </td></tr>
16130 </table>
16132 !! end
16135 ### Parsoid-centric tests for testing RTing of inter-element separators
16136 ### Edge cases not tested by existing parser tests and specific to
16137 ### Parsoid-specific serialization strategies.
16140 !!test
16141 RT-ed inter-element separators should be valid separators
16142 !!input
16144 |- [[foo]]
16146 !!result
16147 <table>
16149 </table>
16151 !!end
16153 !!test
16154 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
16155 (Parsoid-only since PHP parser relies on Tidy for correct output)
16156 !!options
16157 parsoid
16158 !!input
16160 |<small>foo
16165 |<small>foo<small>
16167 !!result
16168 !!end
16170 !!test
16171 Empty TD followed by TD with tpl-generated attribute
16172 !!input
16176 |{{echo|style='color:red'}}|foo
16178 !!result
16179 <table>
16181 <tr>
16182 <td>
16183 </td>
16184 <td>foo
16185 </td></tr></table>
16187 !!end
16189 !!test
16190 Indented table with an empty td
16191 !!input
16192  {|
16193  |-
16195  |foo
16196  |}
16197 !!result
16198 <table>
16200 <tr>
16201 <td>
16202 </td>
16203 <td>foo
16204 </td></tr></table>
16206 !!end
16208 !!test
16209 Empty TR followed by a template-generated TR
16210 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
16211 !!options
16212 parsoid=wt2html,wt2wt
16213 !!input
16216 {{echo|<tr><td>foo</td></tr>}}
16218 !!result
16219 <table>
16220 <tbody>
16221 <tr></tr>
16222 <tr typeof="mw:Transclusion">
16223 <td>foo</td></tr></tbody></table>
16224 !!end
16226 ## PHP and parsoid output differ for this, and since this is primarily
16227 ## for testing Parsoid's serializer, marking this Parsoid only
16228 !!test
16229 Empty TR followed by mixed-ws-comment line should RT correctly
16230 !!options
16231 parsoid
16232 !!input
16235  <!--c-->
16237 <!--c--> <!--d-->
16239 !!result
16240 <table>
16241 <tbody>
16242 <tr>
16243 <td> <!--c--></td></tr>
16244 <tr>
16245 <td><!--c--> <!--d--></td></tr>
16246 </tbody></table>
16248 !!end
16250 !!test
16251 Multi-line image caption generated by templates with/without trailing newlines
16252 !!options
16253 parsoid
16254 !!input
16255 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
16256 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
16257 !!result
16258 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a>  <div class="thumbcaption">foo\nA\nB\nC</div></div></div>
16259 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a>  <div class="thumbcaption">foo\nA\nB\nC\n\n</div></div></div>
16261 !!end
16263 ## PHP emits broken html for this, and since this is primarily
16264 ## a Parsoid serializer test, marking this Parsoid only
16265 !!test
16266 Improperly nested inline or quotes tags with whitespace in between
16267 !!options
16268 parsoid
16269 !!input
16270 <span> <s>x</span> </s>
16271 ''' ''x''' ''
16272 !!result
16273 <p><span> <s>x</s></span><s> </s>
16274 <b> <i>x</i></b><i> </i>
16275 </p>
16276 !!end
16278 # -----------------------------------------------------------------
16279 # The following section of tests are primarily to spec requirements
16280 # around serialization of new/edited content.
16282 # All these tests are marked Parsoid html2wt and html2html only
16283 # ----------------------------------------------------------------
16285 !! test
16286 Image: Modifying size of an image
16287 !! options
16288 parsoid=html2wt
16289 !! input
16290 [[Image:Wiki.png|230x230px]]
16291 !! result
16292 <p data-parsoid='{"dsr":[0,24,0,0]}'><span typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100px"}],"cacheKey":"[[Image:Wiki.png|100px]]","img":{"h":115,"w":100,"wdset":true},"dsr":[0,24,null,null]}'><a href="./File:Wiki.png" data-parsoid='{"a":{"href":"./File:Wiki.png"}}'><img resource="./File:Wiki.png" src="//upload.wikimedia.org/wikipedia/en/thumb/b/bc/Wiki.png/100px-Wiki.png" height="230" width="200" data-parsoid='{"a":{"resource":"./File:Wiki.png"},"sa":{"resource":"Image:Wiki.png"}}'></a></span></p>
16293 !!end
16295 !! test
16296 Image: New block level image should have \n before and after
16297 !! options
16298 parsoid=html2wt
16299 !! input
16301 [[File:Wiki.png|right|thumb|150x150px]]
16303 !! result
16304 <p>123</p><figure typeof="mw:Image/Thumb" class="mw-halign-right"><a href="./File:Wiki.png"><img src="http://192.168.142.128/mw/images/thumb/b/bc/Wiki.png/131px-Wiki.png" width="131" height="150" resource="./File:Wiki.png"></a></figure><p>456</p>
16305 !!end
16307 !! test
16308 Lists: Add space after bullets
16309 !! options
16310 parsoid=html2wt
16311 !! input
16313 * foo
16314 * bar
16315 * <span> baz</span>
16316 !! result
16317 <ul>
16318 <li>foo</li>
16319 <li> bar</li>
16320 <li><span> baz</span></li>
16321 </ul>
16322 !! end
16324 !! test
16325 Parsoid: Serialize positional parameters with = in them as named parameter
16326 !! options
16327 parsoid=html2wt
16328 !! input
16329 {{echo|1 = f=oo}}
16330 !! result
16331 <p about="#mwt1" typeof="mw:Transclusion"
16332 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}'
16333 >foo</p>
16334 !! end
16336 # -----------------------------------------------------------------
16337 # End of section for Parsoid-only html2wt tests for serialization
16338 # of new content
16339 # -----------------------------------------------------------------
16341 TODO:
16342 more images
16343 more tables
16344 character entities
16345 and much more
16346 Try for 100% code coverage