Clean up: Consistently use "$" instead of "$( document ).ready"
[mediawiki.git] / tests / parser / parserTests.txt
blob93377c2e4df25a337020be8e83517219fc94c751
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
125 !! text
126 Weirdo titles!
127 !! endarticle
130 ### Basic tests
132 !! test
133 Blank input
134 !! input
135 !! result
136 !! end
139 !! test
140 Simple paragraph
141 !! input
142 This is a simple paragraph.
143 !! result
144 <p>This is a simple paragraph.
145 </p>
146 !! end
148 !! test
149 Paragraphs with extra newline spacing
150 !! input
160 booz
161 !! result
162 <p>foo
163 </p><p>bar
164 </p><p><br />
166 </p><p><br />
167 </p><p>booz
168 </p>
169 !! end
171 !! test
172 Paragraphs with newline spacing with comment lines in between
173 !! input
174 ----
176 <!--foo-->
178 ----
180 <!--foo--><!--More than 1 comment disables stripping of this line!-->
182 ----
184 <!--foo-->
187 ----
190 <!--foo-->
192 ----
194 <!--foo-->
198 ----
202 <!--foo-->
204 ----
205 !! result
206 <hr />
207 <p>a
209 </p>
210 <hr />
211 <p>a
212 </p><p>b
213 </p>
214 <hr />
215 <p>a
216 </p><p>b
217 </p>
218 <hr />
219 <p>a
220 </p><p>b
221 </p>
222 <hr />
223 <p>a
224 </p><p><br />
226 </p>
227 <hr />
228 <p>a
229 </p><p><br />
231 </p>
232 <hr />
234 !! end
236 !! test
237 Paragraphs with newline spacing with non-empty white-space lines in between
238 !! input
239 ----
243 ----
248 ----
249 !! result
250 <hr />
251 <p>a
252 </p><p>b
253 </p>
254 <hr />
255 <p>a
256 </p><p><br /> 
258 </p>
259 <hr />
261 !! end
263 !! test
264 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
265 !! input
266 ----
268  <!--foo-->
270 ----
272  <!--foo--><!--More than 1 comment disables stripping of this line!-->
274 ----
277 <!--foo-->
278  <!--bar-->
280 ----
283  <!--foo-->
284  <!--bar-->
287 ----
288 !! result
289 <hr />
290 <p>a
292 </p>
293 <hr />
294 <p>a
295 </p><p>b
296 </p>
297 <hr />
298 <p>a
299 </p><p>b
300 </p>
301 <hr />
302 <p>a
303 </p><p><br /> 
305 </p>
306 <hr />
308 !! end
310 !! test
311 Extra newlines: More paragraphs with indented comment
312 !! input
315    <!--boo-->
318 !!result
319 <p>a
320 </p><p><br />
322 </p>
323 !!end
325 !! test
326 Extra newlines followed by heading
327 !! input
333 [[a]]
337 !! result
338 <p>a
339 </p><p><br />
340 </p>
341 <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>
342 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
343 </p><p><br />
344 </p>
345 <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>
347 !! end
349 !! test
350 Extra newlines between heading and content are swallowed
351 !! input
356 [[a]]
357 !! result
358 <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>
359 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
360 </p>
361 !! end
363 !! test
364 Parsing an URL
365 !! input
366 http://fr.wikipedia.org/wiki/🍺
367 <!-- EasterEgg we love beer, better be able be able to link to it -->
368 !! result
369 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
370 </p>
371 !! end
373 !! test
374 Simple list
375 !! input
376 * Item 1
377 * Item 2
378 !! result
379 <ul><li> Item 1
380 </li><li> Item 2
381 </li></ul>
383 !! end
385 !! test
386 Italics and bold
387 !! input
388 * plain
389 * plain''italic''plain
390 * plain''italic''plain''italic''plain
391 * plain'''bold'''plain
392 * plain'''bold'''plain'''bold'''plain
393 * plain''italic''plain'''bold'''plain
394 * plain'''bold'''plain''italic''plain
395 * plain''italic'''bold-italic'''italic''plain
396 * plain'''bold''bold-italic''bold'''plain
397 * plain'''''bold-italic'''italic''plain
398 * plain'''''bold-italic''bold'''plain
399 * plain''italic'''bold-italic'''''plain
400 * plain'''bold''bold-italic'''''plain
401 * plain l'''italic''plain
402 * plain l''''bold''' plain
403 !! result
404 <ul><li> plain
405 </li><li> plain<i>italic</i>plain
406 </li><li> plain<i>italic</i>plain<i>italic</i>plain
407 </li><li> plain<b>bold</b>plain
408 </li><li> plain<b>bold</b>plain<b>bold</b>plain
409 </li><li> plain<i>italic</i>plain<b>bold</b>plain
410 </li><li> plain<b>bold</b>plain<i>italic</i>plain
411 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
412 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
413 </li><li> plain<i><b>bold-italic</b>italic</i>plain
414 </li><li> plain<b><i>bold-italic</i>bold</b>plain
415 </li><li> plain<i>italic<b>bold-italic</b></i>plain
416 </li><li> plain<b>bold<i>bold-italic</i></b>plain
417 </li><li> plain l'<i>italic</i>plain
418 </li><li> plain l'<b>bold</b> plain
419 </li></ul>
421 !! end
423 # this example taken from the simple/Moon article
424 !! test
425 Italics and possessives
426 !! input
427 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
428 !! result
429 <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
430 </p>
431 !! end
434 ### 2-quote opening sequence tests
436 !! test
437 Italics and bold: 2-quote opening sequence: (2,2)
438 !! input
439 ''foo''
440 !! result
441 <p><i>foo</i>
442 </p>
443 !!end
446 !! test
447 Italics and bold: 2-quote opening sequence: (2,3)
448 !! input
449 ''foo'''
450 !! result
451 <p><i>foo'</i>
452 </p>
453 !!end
456 !! test
457 Italics and bold: 2-quote opening sequence: (2,4)
458 !! input
459 ''foo''''
460 !! result
461 <p><i>foo''</i>
462 </p>
463 !!end
466 !! test
467 Italics and bold: 2-quote opening sequence: (2,5) (php)
468 !! options
470 !! input
471 ''foo'''''
472 !! result
473 <p><i>foo</i>
474 </p>
475 !!end
476 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
477 !! test
478 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
479 !! options
480 parsoid
481 !! input
482 ''foo'''''
483 !! result
484 <p><i>foo</i><b></b>
485 </p>
486 !!end
490 ### 3-quote opening sequence tests
493 !! test
494 Italics and bold: 3-quote opening sequence: (3,2)
495 !! input
496 '''foo''
497 !! result
498 <p>'<i>foo</i>
499 </p>
500 !!end
503 !! test
504 Italics and bold: 3-quote opening sequence: (3,3)
505 !! input
506 '''foo'''
507 !! result
508 <p><b>foo</b>
509 </p>
510 !!end
513 !! test
514 Italics and bold: 3-quote opening sequence: (3,4)
515 !! input
516 '''foo''''
517 !! result
518 <p><b>foo'</b>
519 </p>
520 !!end
523 !! test
524 Italics and bold: 3-quote opening sequence: (3,5) (php)
525 !! options
527 !! input
528 '''foo'''''
529 !! result
530 <p><b>foo</b>
531 </p>
532 !!end
533 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
534 !! test
535 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
536 !! options
537 parsoid
538 !! input
539 '''foo'''''
540 !! result
541 <p><b>foo<i></i></b>
542 </p>
543 !!end
547 ### 4-quote opening sequence tests
550 !! test
551 Italics and bold: 4-quote opening sequence: (4,2)
552 !! input
553 ''''foo''
554 !! result
555 <p>''<i>foo</i>
556 </p>
557 !!end
560 !! test
561 Italics and bold: 4-quote opening sequence: (4,3)
562 !! input
563 ''''foo'''
564 !! result
565 <p>'<b>foo</b>
566 </p>
567 !!end
570 !! test
571 Italics and bold: 4-quote opening sequence: (4,4)
572 !! input
573 ''''foo''''
574 !! result
575 <p>'<b>foo'</b>
576 </p>
577 !!end
580 !! test
581 Italics and bold: 4-quote opening sequence: (4,5) (php)
582 !! options
584 !! input
585 ''''foo'''''
586 !! result
587 <p>'<b>foo</b>
588 </p>
589 !!end
590 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
591 !! test
592 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
593 !! options
594 parsoid
595 !! input
596 ''''foo'''''
597 !! result
598 <p>'<b>foo<i></i></b>
599 </p>
600 !!end
604 ### 5-quote opening sequence tests
607 !! test
608 Italics and bold: 5-quote opening sequence: (5,2) (php)
609 !! options
611 !! input
612 '''''foo''
613 !! result
614 <p><b><i>foo</i></b>
615 </p>
616 !!end
617 # Parsoid reverses the nesting order, compared to the PHP parser
618 !! test
619 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
620 !! options
621 parsoid
622 !! input
623 '''''foo''
624 !! result
625 <p><i><b>foo</b></i>
626 </p>
627 !!end
630 !! test
631 Italics and bold: 5-quote opening sequence: (5,3)
632 !! input
633 '''''foo'''
634 !! result
635 <p><i><b>foo</b></i>
636 </p>
637 !!end
640 !! test
641 Italics and bold: 5-quote opening sequence: (5,4)
642 !! input
643 '''''foo''''
644 !! result
645 <p><i><b>foo'</b></i>
646 </p>
647 !!end
650 !! test
651 Italics and bold: 5-quote opening sequence: (5,5)
652 !! input
653 '''''foo'''''
654 !! result
655 <p><i><b>foo</b></i>
656 </p>
657 !!end
660 ### multiple quote sequences in a line
662 !! test
663 Italics and bold: multiple quote sequences: (2,4,2)
664 !! input
665 ''foo''''bar''
666 !! result
667 <p><i>foo'<b>bar</b></i>
668 </p>
669 !!end
672 !! test
673 Italics and bold: multiple quote sequences: (2,4,3)
674 !! input
675 ''foo''''bar'''
676 !! result
677 <p><i>foo'<b>bar</b></i>
678 </p>
679 !!end
682 !! test
683 Italics and bold: multiple quote sequences: (2,4,4)
684 !! input
685 ''foo''''bar''''
686 !! result
687 <p><i>foo'<b>bar'</b></i>
688 </p>
689 !!end
692 !! test
693 Italics and bold: multiple quote sequences: (3,4,2) (php)
694 !! options
696 !! input
697 '''foo''''bar''
698 !! result
699 <p><b>foo'</b>bar
700 </p>
701 !!end
702 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
703 !! test
704 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
705 !! options
706 parsoid
707 !! input
708 '''foo''''bar''
709 !! result
710 <p><b>foo'</b>bar<i></i>
711 </p>
712 !!end
715 !! test
716 Italics and bold: multiple quote sequences: (3,4,3) (php)
717 !! options
719 !! input
720 '''foo''''bar'''
721 !! result
722 <p><b>foo'</b>bar
723 </p>
724 !!end
725 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
726 !! test
727 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
728 !! options
729 parsoid
730 !! input
731 '''foo''''bar'''
732 !! result
733 <p><b>foo'</b>bar<b></b>
734 </p>
735 !!end
738 ### other quote tests
740 !! test
741 Italics and bold: other quote tests: (2,3,5)
742 !! input
743 ''this is about '''foo's family'''''
744 !! result
745 <p><i>this is about <b>foo's family</b></i>
746 </p>
747 !!end
750 !! test
751 Italics and bold: other quote tests: (2,(3,3),2)
752 !! input
753 ''this is about '''foo's''' family''
754 !! result
755 <p><i>this is about <b>foo's</b> family</i>
756 </p>
757 !!end
760 !! test
761 Italics and bold: other quote tests: (3,2,3,2)
762 !! input
763 '''this is about ''foo'''s family''
764 !! result
765 <p><b>this is about <i>foo</i></b><i>s family</i>
766 </p>
767 !!end
770 # The Parsoid team believes the PHP parser's output on this test is wrong.
771 # It only checks for convert-to-bold-on-single-character-word when the word
772 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
773 # This means that the bold token in position 2 (0-indexed) gets converted by
774 # parsoid, but doesn't get changed by the PHP parser.
775 !! test
776 Italics and bold: other quote tests: (3,2,3,3) (php)
777 !! options
779 !! input
780 '''this is about ''foo'''s family'''
781 !! result
782 <p>'<i>this is about </i>foo<b>s family</b>
783 </p>
784 !!end
785 # This is the output the Parsoid team believes to be correct.
786 !! test
787 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
788 !! options
789 parsoid
790 !! input
791 '''this is about ''foo'''s family'''
792 !! result
793 <p><b>this is about <i>foo'</i>s family</b>
794 </p>
795 !!end
798 !! test
799 Italics and bold: other quote tests: (3,(2,2),3)
800 !! input
801 '''this is about ''foo's'' family'''
802 !! result
803 <p><b>this is about <i>foo's</i> family</b>
804 </p>
805 !!end
808 !! test
809 Italicized possessive
810 !! input
811 The ''[[Main Page]]'''s talk page.
812 !! result
813 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
814 </p>
815 !! end
817 !! test
818 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
819 (Requires tidy for PHP parser output to be fixed up)
820 !! options
821 parsoid=wt2html,wt2wt
822 !! input
824 !''a!!''b
825 |''a||''b
827 !! result
828 <table>
829 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
830 <td><i>a</i></td><td><i>b</i></td></tr>
831 </tbody></table>
832 !! end
835 ### Non-html5 tags
838 !! test
839 Non-html5 tags should be accepted
840 !! input
841 <center>''foo''</center>
842 <big>''foo''</big>
843 <font>''foo''</font>
844 <strike>''foo''</strike>
845 <tt>''foo''</tt>
846 !! result
847 <center><i>foo</i></center>
848 <p><big><i>foo</i></big>
849 <font><i>foo</i></font>
850 <strike><i>foo</i></strike>
851 <tt><i>foo</i></tt>
852 </p>
853 !! end
856 ### <nowiki> test cases
859 !! test
860 <nowiki> unordered list
861 !! input
862 <nowiki>* This is not an unordered list item.</nowiki>
863 !! result
864 <p>* This is not an unordered list item.
865 </p>
866 !! end
868 !! test
869 <nowiki> spacing
870 !! input
871 <nowiki>Lorem ipsum dolor
873 sed abit.
874   sed nullum.
876 :and a colon
877 </nowiki>
878 !! result
879 <p>Lorem ipsum dolor
881 sed abit.
882   sed nullum.
884 :and a colon
886 </p>
887 !! end
889 !! test
890 nowiki 3
891 !! input
892 :There is not nowiki.
893 :There is <nowiki>nowiki</nowiki>.
895 #There is not nowiki.
896 #There is <nowiki>nowiki</nowiki>.
898 *There is not nowiki.
899 *There is <nowiki>nowiki</nowiki>.
900 !! result
901 <dl><dd>There is not nowiki.
902 </dd><dd>There is nowiki.
903 </dd></dl>
904 <ol><li>There is not nowiki.
905 </li><li>There is nowiki.
906 </li></ol>
907 <ul><li>There is not nowiki.
908 </li><li>There is nowiki.
909 </li></ul>
911 !! end
913 !! test
914 Entities inside <nowiki>
915 !! input
916 <nowiki>&lt;</nowiki>
917 !! result
918 <p>&lt;
919 </p>
920 !! end
922 !! test
923 Entities inside template parameters
924 !! options
925 parsoid
926 !! input
927 {{echo|&ndash;}}
928 !! result
929 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}'>&ndash;</span>
930 </p>
931 !! end
934 ### Comments
936 !! test
937 Comments and Indent-Pre
938 !! input
939 <!-- comment 1 --> asdf
941 <!-- comment 1 --> asdf
942 <!-- comment 2 -->
944 <!-- comment 1 --> asdf
945 <!-- comment 2 -->xyz
947 <!-- comment 1 --> asdf
948 <!-- comment 2 --> xyz
949 !! result
950 <pre>asdf
951 </pre>
952 <pre>asdf
953 </pre>
954 <pre>asdf
955 </pre>
956 <p>xyz
957 </p>
958 <pre>asdf
960 </pre>
961 !! end
963 !! test
964 Comment test 2a
965 !! input
966 asdf
967 <!-- comment 1 -->
969 !! result
970 <p>asdf
972 </p>
973 !! end
975 !! test
976 Comment test 2b
977 !! input
978 asdf
979 <!-- comment 1 -->
982 !! result
983 <p>asdf
984 </p><p>jkl
985 </p>
986 !! end
988 !! test
989 Comment test 3
990 !! input
991 asdf
992 <!-- comment 1 -->
993 <!-- comment 2 -->
995 !! result
996 <p>asdf
998 </p>
999 !! end
1001 !! test
1002 Comment test 4
1003 !! input
1004 asdf<!-- comment 1 -->jkl
1005 !! result
1006 <p>asdfjkl
1007 </p>
1008 !! end
1010 !! test
1011 Comment spacing
1012 !! input
1014  <!-- foo --> b <!-- bar -->
1016 !! result
1017 <p>a
1018 </p>
1019 <pre> b 
1020 </pre>
1021 <p>c
1022 </p>
1023 !! end
1025 !! test
1026 Comment whitespace
1027 !! input
1028 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1029 !! result
1031 !! end
1033 !! test
1034 Comment semantics and delimiters
1035 !! input
1036 <!-- --><!----><!-----><!------>
1037 !! result
1039 !! end
1041 !! test
1042 Comment semantics and delimiters, redux
1043 !! input
1044 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1045 -- foo -- funky huh? ... -->
1046 !! result
1048 !! end
1050 !! test
1051 Comment semantics and delimiters: directors cut
1052 !! input
1053 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1054 everything starting with < followed by !-- until the first -- and > we see,
1055 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1056 -->-->
1057 !! result
1058 <p>--&gt;
1059 </p>
1060 !! end
1062 !! test
1063 Comment semantics: nesting
1064 !! input
1065 <!--<!-- no, we're not going to do anything fancy here -->-->
1066 !! result
1067 <p>--&gt;
1068 </p>
1069 !! end
1071 !! test
1072 Comment semantics: unclosed comment at end
1073 !! input
1074 <!--This comment will run out to the end of the document
1075 !! result
1077 !! end
1079 !! test
1080 Comment in template title
1081 !! input
1082 {{f<!---->oo}}
1083 !! result
1084 <p>FOO
1085 </p>
1086 !! end
1088 !! test
1089 Comment on its own line post-expand
1090 !! input
1092 {{blank}}<!---->
1094 !! result
1095 <p>a
1096 </p><p>b
1097 </p>
1098 !! end
1100 !! test
1101 Comment on its own line post-expand with non-significant whitespace
1102 !! input
1104  {{blank}} <!----> 
1106 !! result
1107 <p>a
1108 </p><p>b
1109 </p>
1110 !! end
1113 ### paragraph wrapping tests
1115 !! test
1116 No block tags
1117 !! input
1121 !! result
1122 <p>a
1123 </p><p>b
1124 </p>
1125 !! end
1126 !! test
1127 Block tag on one line
1128 !! input
1129 a <div>foo</div>
1132 !! result
1133 a <div>foo</div>
1134 <p>b
1135 </p>
1136 !! end
1138 !! test
1139 Block tag on both lines
1140 !! input
1141 a <div>foo</div>
1143 b <div>foo</div>
1144 !! result
1145 a <div>foo</div>
1146 b <div>foo</div>
1148 !! end
1150 !! test
1151 Multiple lines without block tags
1152 !! input
1153 <div>foo</div> a
1156 d<!--foo--> e
1157 x <div>foo</div> z
1158 !! result
1159 <div>foo</div> a
1160 <p>b
1162 d e
1163 </p>
1164 x <div>foo</div> z
1166 !! end
1168 !! test
1169 Empty lines between lines with block tags
1170 !! input
1171 <div></div>
1174 <div></div>a
1177 <div>a</div>b
1179 <div>b</div>d
1182 <div>e</div>
1183 !! result
1184 <div></div>
1185 <p><br />
1186 </p>
1187 <div></div>a
1188 <p>b
1189 </p>
1190 <div>a</div>b
1191 <div>b</div>d
1192 <p><br />
1193 </p>
1194 <div>e</div>
1196 !! end
1199 ### Preformatted text
1201 !! test
1202 Preformatted text
1203 !! input
1204  This is some
1205  Preformatted text
1206  With ''italic''
1207  And '''bold'''
1208  And a [[Main Page|link]]
1209 !! result
1210 <pre>This is some
1211 Preformatted text
1212 With <i>italic</i>
1213 And <b>bold</b>
1214 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1215 </pre>
1216 !! end
1218 !! test
1219 Ident preformatting with inline content
1220 !! input
1222  ''b''
1223 !! result
1224 <pre>a
1225 <i>b</i>
1226 </pre>
1227 !! end
1229 !! test
1230 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1231 !! input
1232 <pre><nowiki>
1234 <cite>
1235 <em>
1236 </nowiki></pre>
1237 !! result
1238 <pre>
1239 &lt;b&gt;
1240 &lt;cite&gt;
1241 &lt;em&gt;
1242 </pre>
1244 !! end
1246 !! test
1247 Regression with preformatted in <center>
1248 !! input
1249 <center>
1250  Blah
1251 </center>
1252 !! result
1253 <center>
1254 <pre>Blah
1255 </pre>
1256 </center>
1258 !! end
1260 # Expected output in the following test is not really expected (there should be
1261 # <pre> in the output) -- it's only testing for well-formedness.
1262 !! test
1263 Bug 6200: Preformatted in <blockquote>
1264 !! input
1265 <blockquote>
1266  Blah
1267 </blockquote>
1268 !! result
1269 <blockquote>
1270  Blah
1271 </blockquote>
1273 !! end
1275 !! test
1276 <pre> with attributes (bug 3202)
1277 !! input
1278 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1279 !! result
1280 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1282 !! end
1284 !! test
1285 <pre> with width attribute (bug 3202)
1286 !! input
1287 <pre width="8">Narrow screen goodies</pre>
1288 !! result
1289 <pre width="8">Narrow screen goodies</pre>
1291 !! end
1293 !! test
1294 <pre> with forbidden attribute (bug 3202)
1295 !! input
1296 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1297 !! result
1298 <pre width="8">Narrow screen goodies</pre>
1300 !! end
1302 !! test
1303 Entities inside <pre>
1304 !! input
1305 <pre>&lt;</pre>
1306 !! result
1307 <pre>&lt;</pre>
1309 !! end
1311 !! test
1312 <pre> with forbidden attribute values (bug 3202)
1313 !! input
1314 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1315 !! result
1316 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1318 !! end
1320 !! test
1321 <nowiki> inside <pre> (bug 13238)
1322 !! input
1323 <pre>
1324 <nowiki>
1325 </pre>
1326 <pre>
1327 <nowiki></nowiki>
1328 </pre>
1329 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1330 !! result
1331 <pre>
1332 &lt;nowiki&gt;
1333 </pre>
1334 <pre>
1336 </pre>
1337 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1339 !! end
1341 !! test
1342 <nowiki> and <pre> preference (first one wins)
1343 !! input
1344 <pre>
1345 <nowiki>
1346 </pre>
1347 </nowiki>
1348 </pre>
1350 <nowiki>
1351 <pre>
1352 <nowiki>
1353 </pre>
1354 </nowiki>
1355 </pre>
1357 !! result
1358 <pre>
1359 &lt;nowiki&gt;
1360 </pre>
1361 <p>&lt;/nowiki&gt;
1362 &lt;/pre&gt;
1363 </p><p>
1364 &lt;pre&gt;
1365 &lt;nowiki&gt;
1366 &lt;/pre&gt;
1368 &lt;/pre&gt;
1369 </p>
1370 !! end
1372 !! test
1373 </pre> inside nowiki
1374 !! input
1375 <nowiki></pre></nowiki>
1376 !! result
1377 <p>&lt;/pre&gt;
1378 </p>
1379 !! end
1381 !!test
1382 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1383 !!input
1384  {{echo|}}
1385 !!result
1387 !!end
1389 !!test
1390 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1391 !!input
1392  {{echo|
1393 foo}}
1394 !!result
1395 <p>foo
1396 </p>
1397 !!end
1399 !! test
1400 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1401 !! input
1402  {{echo|a
1404 !!result
1405 <pre>a
1406 </pre>
1407 <p>b
1408 </p>
1409 !!end
1411 !! test
1412 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1413 !! input
1414  {{echo|a
1420 !!result
1421 <pre>a
1422 </pre>
1423 <p>b
1425 </p>
1426 <pre>d
1427 </pre>
1428 <p>e
1429 </p>
1430 !!end
1432 !!test
1433 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1434 !!input
1435 {{echo| foo}}
1437 {{echo| foo}}{{echo| bar}}
1439 {{echo| foo}}
1440 {{echo| bar}}
1442 {{echo|<!--cmt--> foo}}
1444 <!--cmt-->{{echo| foo}}
1446 {{echo|{{echo| }}bar}}
1447 !!result
1448 <pre>foo
1449 </pre>
1450 <pre>foo bar
1451 </pre>
1452 <pre>foo
1454 </pre>
1455 <pre>foo
1456 </pre>
1457 <pre>foo
1458 </pre>
1459 <pre>bar
1460 </pre>
1461 !!end
1463 !! test
1464 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1465 !! input
1466 {{echo| }}a
1468 {{echo|
1469  }}a
1471 {{echo|
1472  b}}
1474 {{echo|a
1475  }}b
1477 {{echo|a
1478 }} b
1479 !!result
1480 <pre>a
1481 </pre>
1482 <p><br />
1483 </p>
1484 <pre>a
1485 </pre>
1486 <p><br />
1487 </p>
1488 <pre>b
1489 </pre>
1490 <p>a
1491 </p>
1492 <pre>b
1493 </pre>
1494 <p>a
1495 </p>
1496 <pre>b
1497 </pre>
1498 !!end
1500 !! test
1501 Templates: Single-line variant of parameter whitespace stripping test
1502 !! input
1503 {{echo| a}}
1505 {{echo|1= a}}
1507 {{echo|{{echo| a}}}}
1509 {{echo|1={{echo| a}}}}
1510 !! result
1511 <pre>a
1512 </pre>
1513 <p>a
1514 </p>
1515 <pre>a
1516 </pre>
1517 <p>a
1518 </p>
1519 !! end
1521 !! test
1522 Templates: Strip whitespace from named parameters, but not positional ones
1523 !! input
1524 {{echo|
1525  foo}}
1527 {{echo|
1528 * foo}}
1530 {{echo| 1 =
1531  foo}}
1533 {{echo| 1 =
1534 * foo}}
1535 !! result
1536 <pre>foo
1537 </pre>
1538 <p><br />
1539 </p>
1540 <ul><li> foo
1541 </li></ul>
1542 <p>foo
1543 </p>
1544 <ul><li> foo
1545 </li></ul>
1547 !! end
1549 !! test
1550 Templates: Dont strip whitespace from whitespace/comment-only arguments
1551 !! input
1552 {{echo| }}
1553 {{echo|<!--cmt-->}}
1554 {{echo| <!--cmt--> }}
1555 !! result
1556 <p><br />
1557 </p>
1558 !! end
1560 !! test
1561 Templates: Parsoid parameter escaping test 1
1562 !! options
1563 parsoid
1564 !! input
1565 {{echo|[foo]|{{echo|[bar]}}}}
1566 !! result
1567 <p about="#mwt1" typeof="mw:Transclusion"
1568 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>
1569 !! end
1571 !! test
1572 Parsoid: Pipes in external links in template parameter
1573 !! options
1574 parsoid
1575 !! input
1576 {{echo|[{{echo|http://example.com}} link]}}
1577 !! result
1578 <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>
1579 !! end
1581 !! test
1582 Parsoid: pipe in transclusion parameter
1583 !! options
1584 parsoid
1585 !! input
1586 {{echo|http://foo.com/a&#124;b}}
1587 !! result
1588 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1589 typeof="mw:Transclusion"
1590 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>
1591 !! end
1593 !! test
1594 Parsoid: Pipe in external link target and content in template parameter
1595 !! options
1596 parsoid=html2wt,wt2wt
1597 !! input
1598 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1599 !! result
1600 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1601 typeof="mw:Transclusion"
1602 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},
1603 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}'>a|b</a></p>
1604 !! end
1606 !! test
1607 Templates: Dont escape already nowiki-escaped text in template parameters
1608 !! options
1609 parsoid=html2wt,wt2wt
1610 !! input
1611 {{echo|foo<nowiki>|</nowiki>bar}}
1612 !! result
1613 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}'>foo<span typeof="mw:Nowiki" data-parsoid="{}">|</span>bar</p>
1614 !! end
1617 ### Parsoid-centric tests for testing RT edge cases for pre
1620 !!test
1621 1a. Indent-Pre and Comments
1622 !!input
1624 <!--a-->
1626 !!result
1627 <pre>a
1628 </pre>
1629 <p>c
1630 </p>
1631 !!end
1633 !!test
1634 1b. Indent-Pre and Comments
1635 !!input
1637  <!--a-->
1639 !!result
1640 <pre>a
1641 </pre>
1642 <p>c
1643 </p>
1644 !!end
1646 !!test
1647 1c. Indent-Pre and Comments
1648 !!input
1649 <!--a-->  a
1651  <!--a--> a
1652 !!result
1653 <pre> a
1654 </pre>
1655 <pre> a
1656 </pre>
1657 !!end
1659 !!test
1660 2a. Indent-Pre and tables
1661 !!input
1662  {|
1663  |-
1664  !h1!!h2
1665  |foo||bar
1666  |}
1667 !!result
1668 <table>
1670 <tr>
1671 <th>h1</th>
1672 <th>h2
1673 </th>
1674 <td>foo</td>
1675 <td>bar
1676 </td></tr></table>
1678 !!end
1680 !!test
1681 2b. Indent-Pre and tables
1682 !!input
1683   {|
1684  |-
1685 |foo
1687 !!result
1688 <table>
1690 <tr>
1691 <td>foo
1692 </td></tr></table>
1694 !!end
1696 !!test
1697 2c. Indent-Pre and tables (bug 42252)
1698 !!input
1700  |+ foo
1701  !  | bar
1703 !!result
1704 <table>
1705 <caption> foo
1706 </caption>
1707 <tr>
1708 <th> bar
1709 </th></tr></table>
1711 !!end
1713 !!test
1714 3a. Indent-Pre and block tags (single-line html)
1715 !!input
1716  <p> foo </p>
1717  <div> foo </div>
1718  <span> foo </span>
1719 !!result
1720  <p> foo </p>
1721  <div> foo </div>
1722 <pre><span> foo </span>
1723 </pre>
1724 !!end
1726 !!test
1727 3b. Indent-Pre and block tags (pre-content on separate line)
1728 !!input
1730  foo
1731 </p>
1733 <div>
1734  foo
1735 </div>
1737 <center>
1738  foo
1739 </center>
1741 <blockquote>
1742  foo
1743 </blockquote>
1745 <table><tr><td>
1746  foo
1747 </td></tr></table>
1749 <ul><li>
1750   foo
1751 </li></ul>
1753 !!result
1755  foo
1756 </p>
1757 <div>
1758 <pre>foo
1759 </pre>
1760 </div>
1761 <center>
1762 <pre>foo
1763 </pre>
1764 </center>
1765 <blockquote>
1766  foo
1767 </blockquote>
1768 <table><tr><td>
1769 <pre>foo
1770 </pre>
1771 </td></tr></table>
1772 <ul><li>
1773   foo
1774 </li></ul>
1776 !!end
1778 !!test
1779 4. Multiple spaces at start-of-line
1780 !!input
1781     <p> foo </p>
1782     foo
1783         {|
1784 |foo
1786 !!result
1787     <p> foo </p>
1788 <pre>   foo
1789 </pre>
1790 <table>
1791 <tr>
1792 <td>foo
1793 </td></tr></table>
1795 !!end
1797 !! test
1798 5. White-space in indent-pre
1799 NOTE: the white-space char on 2nd line is significant
1800 !! input
1801  a<br/>
1804 !! result
1805 <pre>a<br />
1808 </pre>
1809 !! end
1812 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1815 !!test
1816 HTML-pre: 1. embedded newlines
1817 !!input
1818 <pre>foo</pre>
1820 <pre>
1822 </pre>
1824 <pre>
1827 </pre>
1829 <pre>
1833 </pre>
1834 !!result
1835 <pre>foo</pre>
1836 <pre>
1838 </pre>
1839 <pre>
1842 </pre>
1843 <pre>
1847 </pre>
1849 !!end
1851 !!test
1852 HTML-pre: 2: indented text
1853 !!input
1854 <pre>
1855  foo
1856 </pre>
1857 !!result
1858 <pre>
1859  foo
1860 </pre>
1862 !!end
1864 !!test
1865 HTML-pre: 3: other wikitext
1866 !!input
1867 <pre>
1868 * foo
1869 # bar
1870 = no-h =
1871 '' no-italic ''
1872 [[ NoLink ]]
1873 </pre>
1874 !!result
1875 <pre>
1876 * foo
1877 # bar
1878 = no-h =
1879 '' no-italic ''
1880 [[ NoLink ]]
1881 </pre>
1883 !!end
1886 ### Definition lists
1888 !! test
1889 Simple definition
1890 !! input
1891 ; name : Definition
1892 !! result
1893 <dl><dt> name&#160;</dt><dd> Definition
1894 </dd></dl>
1896 !! end
1898 !! test
1899 Definition list for indentation only
1900 !! input
1901 : Indented text
1902 !! result
1903 <dl><dd> Indented text
1904 </dd></dl>
1906 !! end
1908 !! test
1909 Definition list with no space
1910 !! input
1911 ;name:Definition
1912 !! result
1913 <dl><dt>name</dt><dd>Definition
1914 </dd></dl>
1916 !!end
1918 !! test
1919 Definition list with URL link
1920 !! input
1921 ; http://example.com/ : definition
1922 !! result
1923 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1924 </dd></dl>
1926 !! end
1928 !! test
1929 Definition list with bracketed URL link
1930 !! input
1931 ;[http://www.example.com/ Example]:Something about it
1932 !! result
1933 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1934 </dd></dl>
1936 !! end
1938 !! test
1939 Definition list with wikilink containing colon
1940 !! input
1941 ; [[Help:FAQ]]: The least-read page on Wikipedia
1942 !! result
1943 <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
1944 </dd></dl>
1946 !! end
1948 # At Brion's and JeLuF's insistence... :)
1949 !! test
1950 Definition list with news link containing colon
1951 !! input
1952 ;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
1953 !! result
1954 <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!
1955 </dd></dl>
1957 !! end
1959 !! test
1960 Malformed definition list with colon
1961 !! input
1962 ;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1963 !! result
1964 <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
1965 </dt></dl>
1967 !! end
1969 !! test
1970 Definition lists: colon in external link text
1971 !! input
1972 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1973 !! result
1974 <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
1975 </dd></dl>
1977 !! end
1979 !! test
1980 Definition lists: colon in HTML attribute
1981 !! input
1982 ;<b style="display: inline">bold</b>
1983 !! result
1984 <dl><dt><b style="display: inline">bold</b>
1985 </dt></dl>
1987 !! end
1989 !! test
1990 Definition lists: self-closed tag
1991 !! input
1992 ;one<br/>two : two-line fun
1993 !! result
1994 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1995 </dd></dl>
1997 !! end
1999 !! test
2000 Bug 11748: Literal closing tags
2001 !! input
2002 <dl>
2003 <dt>test 1</dt>
2004 <dd>test test test test test</dd>
2005 <dt>test 2</dt>
2006 <dd>test test test test test</dd>
2007 </dl>
2008 !! result
2009 <dl>
2010 <dt>test 1</dt>
2011 <dd>test test test test test</dd>
2012 <dt>test 2</dt>
2013 <dd>test test test test test</dd>
2014 </dl>
2016 !! end
2018 !! test
2019 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2020 !! input
2021 <ul><li>
2022 ; term : description
2023 * unordered
2024 </li>
2025 </ul>
2026 !! result
2027 <ul><li>
2028 <dl><dt> term&#160;</dt><dd> description
2029 </dd></dl>
2030 <ul><li> unordered
2031 </li></ul>
2032 </li>
2033 </ul>
2035 !! end
2037 !! test
2039 Definition list with empty definition and following paragraph
2040 !! input
2041 ; term:
2042 Paragraph text
2043 !! result
2044 <dl><dt> term</dt><dd>
2045 </dd></dl>
2046 <p>Paragraph text
2047 </p>
2048 !! end
2050 !! test
2051 Nested definition lists using html syntax
2052 !! input
2053 <dl><dd>
2054 <dl>
2055 <dd>Foo</dd>
2056 </dl>
2057 </dd></dl>
2058 !! result
2059 <dl><dd>
2060 <dl>
2061 <dd>Foo</dd>
2062 </dl>
2063 </dd></dl>
2065 !! end
2067 !! test
2068 Definition Lists: No nesting: Multiple dd's
2069 !! input
2073 !! result
2074 <dl><dt>x
2075 </dt><dd>a
2076 </dd><dd>b
2077 </dd></dl>
2079 !! end
2081 !! test
2082 Definition Lists: Indentation: Regular
2083 !! input
2085 ::i2
2086 :::i3
2087 !! result
2088 <dl><dd>i1
2089 <dl><dd>i2
2090 <dl><dd>i3
2091 </dd></dl>
2092 </dd></dl>
2093 </dd></dl>
2095 !! end
2097 !! test
2098 Definition Lists: Indentation: Missing 1st level
2099 !! input
2100 ::i2
2101 :::i3
2102 !! result
2103 <dl><dd><dl><dd>i2
2104 <dl><dd>i3
2105 </dd></dl>
2106 </dd></dl>
2107 </dd></dl>
2109 !! end
2111 !! test
2112 Definition Lists: Indentation: Multi-level indent
2113 !! input
2114 :::i3
2115 !! result
2116 <dl><dd><dl><dd><dl><dd>i3
2117 </dd></dl>
2118 </dd></dl>
2119 </dd></dl>
2121 !! end
2123 !! test
2124 Definition Lists: Hacky use to indent tables
2125 !! input
2126 ::{|
2127 |foo
2128 |bar
2130 this text
2131 should be left alone
2132 !! result
2133 <dl><dd><dl><dd><table>
2134 <tr>
2135 <td>foo
2136 </td>
2137 <td>bar
2138 </td></tr></table></dd></dl></dd></dl>
2139 <p>this text
2140 should be left alone
2141 </p>
2142 !! end
2143 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2144 ## as an empty dt item.  It also ignores all but the last ";" when followed
2145 ## by ":" later on.  So, ";" are not ignored in ";;;t3" but are ignored  in
2146 ## ";;;t3 :d1".  So, PHP parser behavior is a little inconsistent wrt multiple
2147 ## ";"s.
2149 ## Ex: ";;t2 ::d2" is transformed into:
2151 ## <dl>
2152 ##   <dt>t2 </dt>
2153 ##   <dd>
2154 ##     <dl>
2155 ##       <dt></dt>
2156 ##       <dd>d2</dd>
2157 ##     </dl>
2158 ##   </dd>
2159 ## </dl>
2161 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2162 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2164 ## <dl>
2165 ##   <dt>
2166 ##     <dl>
2167 ##       <dt>t2 </dt>
2168 ##       <dd>:d2</dd>
2169 ##     </dl>
2170 ##    </dt>
2171 ## </dl>
2173 ## All Parsoid only definition list tests have this difference.
2175 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2176 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2178 !! test
2179 Table / list interaction: indented table with lists in table contents
2180 !! input
2183 | a
2184 * b
2186 | c
2187 * d
2189 !! result
2190 <dl><dd><table>
2192 <tr>
2193 <td> a
2194 <ul><li> b
2195 </li></ul>
2196 </td></tr>
2197 <tr>
2198 <td> c
2199 <ul><li> d
2200 </li></ul>
2201 </td></tr></table></dd></dl>
2203 !! end
2205 !!test
2206 Table / list interaction: lists nested in tables nested in indented lists
2207 !!input
2219 !!result
2220 <dl><dd><table>
2221 <tr>
2222 <td>
2223 <dl><dd>a
2224 </dd><dd>b
2225 </dd></dl>
2226 </td>
2227 <td>
2228 <ul><li>c
2229 </li><li>d
2230 </li></ul>
2231 </td></tr></table></dd></dl>
2232 <ul><li>e
2233 </li><li>f
2234 </li></ul>
2236 !!end
2238 !! test
2239 Definition Lists: Nesting: Multi-level (Parsoid only)
2240 !! options
2241 parsoid
2242 !! input
2243 ;t1 :d1
2244 ;;t2 ::d2
2245 ;;;t3 :::d3
2246 !! result
2247 <dl>
2248   <dt>t1 </dt>
2249   <dd>d1</dd>
2250   <dt>
2251     <dl>
2252       <dt>t2 </dt>
2253       <dd>:d2</dd>
2254       <dt>
2255         <dl>
2256           <dt>t3 </dt>
2257           <dd>::d3</dd>
2258         </dl>
2259       </dt>
2260     </dl>
2261   </dt>
2262 </dl>
2265 !! end
2268 !! test
2269 Definition Lists: Nesting: Test 2 (Parsoid only)
2270 !! options
2271 parsoid
2272 !! input
2274 ::d2
2275 !! result
2276 <dl>
2277   <dt>t1</dt>
2278   <dd>
2279     <dl>
2280       <dd>d2</dd>
2281     </dl>
2282   </dd>
2283 </dl>
2285 !! end
2288 !! test
2289 Definition Lists: Nesting: Test 3 (Parsoid only)
2290 !! options
2291 parsoid
2292 !! input
2293 :;t1
2294 ::::d2
2295 !! result
2296 <dl>
2297   <dd>
2298     <dl>
2299       <dt>t1</dt>
2300       <dd>
2301         <dl>
2302           <dd>
2303             <dl>
2304               <dd>d2</dd>
2305             </dl>
2306           </dd>
2307         </dl>
2308       </dd>
2309     </dl>
2310   </dd>
2311 </dl>
2313 !! end
2316 !! test
2317 Definition Lists: Nesting: Test 4
2318 !! input
2319 ::;t3
2320 :::d3
2321 !! result
2322 <dl><dd><dl><dd><dl><dt>t3
2323 </dt><dd>d3
2324 </dd></dl>
2325 </dd></dl>
2326 </dd></dl>
2328 !! end
2331 ## The Parsoid team believes the following three test exposes a
2332 ## bug in the PHP parser.  (Parsoid team thinks the PHP parser is
2333 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2334 !! test
2335 Definition Lists: Mixed Lists: Test 1 (php)
2336 !! options
2338 !! input
2339 :;* foo
2340 ::* bar
2341 :; baz
2342 !! result
2343 <dl><dd><dl><dt><ul><li> foo
2344 </li><li> bar
2345 </li></ul>
2346 </dt></dl>
2347 <dl><dt> baz
2348 </dt></dl>
2349 </dd></dl>
2351 !! end
2352 !! test
2353 Definition Lists: Mixed Lists: Test 1 (parsoid)
2354 !! options
2355 parsoid
2356 !! input
2357 :;* foo
2358 ::* bar
2359 :; baz
2360 !! result
2361 <dl><dd><dl><dt><ul><li> foo
2362 </li></ul></dt><dd><ul><li> bar
2363 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2364 !! end
2366 !! test
2367 Definition Lists: Mixed Lists: Test 2
2368 !! input
2369 *: d1
2370 *: d2
2371 !! result
2372 <ul><li><dl><dd> d1
2373 </dd><dd> d2
2374 </dd></dl>
2375 </li></ul>
2377 !! end
2380 !! test
2381 Definition Lists: Mixed Lists: Test 3
2382 !! input
2383 *::: d1
2384 *::: d2
2385 !! result
2386 <ul><li><dl><dd><dl><dd><dl><dd> d1
2387 </dd><dd> d2
2388 </dd></dl>
2389 </dd></dl>
2390 </dd></dl>
2391 </li></ul>
2393 !! end
2396 !! test
2397 Definition Lists: Mixed Lists: Test 4
2398 !! input
2399 *;d1 :d2
2400 *;d3 :d4
2401 !! result
2402 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2403 </dd><dt>d3&#160;</dt><dd>d4
2404 </dd></dl>
2405 </li></ul>
2407 !! end
2410 !! test
2411 Definition Lists: Mixed Lists: Test 5
2412 !! input
2413 *:d1
2414 *:: d2
2415 !! result
2416 <ul><li><dl><dd>d1
2417 <dl><dd> d2
2418 </dd></dl>
2419 </dd></dl>
2420 </li></ul>
2422 !! end
2425 !! test
2426 Definition Lists: Mixed Lists: Test 6
2427 !! input
2428 #*:d1
2429 #*::: d3
2430 !! result
2431 <ol><li><ul><li><dl><dd>d1
2432 <dl><dd><dl><dd> d3
2433 </dd></dl>
2434 </dd></dl>
2435 </dd></dl>
2436 </li></ul>
2437 </li></ol>
2439 !! end
2442 !! test
2443 Definition Lists: Mixed Lists: Test 7
2444 !! input
2445 :* d1
2446 :* d2
2447 !! result
2448 <dl><dd><ul><li> d1
2449 </li><li> d2
2450 </li></ul>
2451 </dd></dl>
2453 !! end
2456 !! test
2457 Definition Lists: Mixed Lists: Test 8
2458 !! input
2459 :* d1
2460 ::* d2
2461 !! result
2462 <dl><dd><ul><li> d1
2463 </li></ul>
2464 <dl><dd><ul><li> d2
2465 </li></ul>
2466 </dd></dl>
2467 </dd></dl>
2469 !! end
2472 !! test
2473 Definition Lists: Mixed Lists: Test 9
2474 !! input
2475 *;foo :bar
2476 !! result
2477 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2478 </dd></dl>
2479 </li></ul>
2481 !! end
2484 !! test
2485 Definition Lists: Mixed Lists: Test 10
2486 !! input
2487 *#;foo :bar
2488 !! result
2489 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2490 </dd></dl>
2491 </li></ol>
2492 </li></ul>
2494 !! end
2496 # The Parsoid team disagrees with the PHP parser's seemingly-random
2497 # rules regarding dd/dt on the next two tests.  Parsoid is more
2498 # consistent, and recognizes the shared nesting and keeps the
2499 # still-open tags around until the nesting is complete.
2501 !! test
2502 Definition Lists: Mixed Lists: Test 11 (php)
2503 !! options
2505 !! input
2506 *#*#;*;;foo :bar
2507 *#*#;boo :baz
2508 !! result
2509 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2510 </dt></dl>
2511 </dd></dl>
2512 </li></ul>
2513 </dd></dl>
2514 <dl><dt>boo&#160;</dt><dd>baz
2515 </dd></dl>
2516 </li></ol>
2517 </li></ul>
2518 </li></ol>
2519 </li></ul>
2521 !! end
2522 !! test
2523 Definition Lists: Mixed Lists: Test 11 (parsoid)
2524 !! options
2525 parsoid
2526 !! input
2527 *#*#;*;;foo :bar
2528 *#*#;boo :baz
2529 !! result
2530 <ul>
2531 <li>
2532 <ol>
2533 <li>
2534 <ul>
2535 <li>
2536 <ol>
2537 <li>
2538 <dl>
2539 <dt>
2540 <ul>
2541 <li>
2542 <dl>
2543 <dt>
2544 <dl>
2545 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2546 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2547 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2548 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2549 !! end
2552 !! test
2553 Definition Lists: Weird Ones: Test 1 (php)
2554 !! options
2556 !! input
2557 *#;*::;; foo : bar (who uses this?)
2558 !! result
2559 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2560 </dt></dl>
2561 </dd></dl>
2562 </dd></dl>
2563 </dd></dl>
2564 </li></ul>
2565 </dd></dl>
2566 </li></ol>
2567 </li></ul>
2569 !! end
2570 !! test
2571 Definition Lists: Weird Ones: Test 1 (parsoid)
2572 !! options
2573 parsoid
2574 !! input
2575 *#;*::;; foo : bar (who uses this?)
2576 !! result
2577 <ul>
2578 <li>
2579 <ol>
2580 <li>
2581 <dl>
2582 <dt>
2583 <ul>
2584 <li>
2585 <dl>
2586 <dd>
2587 <dl>
2588 <dd>
2589 <dl>
2590 <dt>
2591 <dl>
2592 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2593 <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>
2594 !! end
2597 ### External links
2599 !! test
2600 External links: non-bracketed
2601 !! input
2602 Non-bracketed: http://example.com
2603 !! result
2604 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2605 </p>
2606 !! end
2608 !! test
2609 External links: numbered
2610 !! input
2611 Numbered: [http://example.com]
2612 Numbered: [http://example.net]
2613 Numbered: [http://example.com]
2614 !! result
2615 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2616 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2617 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2618 </p>
2619 !!end
2621 !! test
2622 External links: specified text
2623 !! input
2624 Specified text: [http://example.com link]
2625 !! result
2626 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2627 </p>
2628 !!end
2630 !! test
2631 External links: trail
2632 !! input
2633 Linktrails should not work for external links: [http://example.com link]s
2634 !! result
2635 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2636 </p>
2637 !! end
2639 !! test
2640 External links: dollar sign in URL
2641 !! input
2642 http://example.com/1$2345
2643 !! result
2644 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2645 </p>
2646 !! end
2648 !! test
2649 External links: dollar sign in URL (named)
2650 !! input
2651 [http://example.com/1$2345]
2652 !! result
2653 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2654 </p>
2655 !!end
2657 !! test
2658 External links: open square bracket forbidden in URL (bug 4377)
2659 !! input
2660 http://example.com/1[2345
2661 !! result
2662 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2663 </p>
2664 !! end
2666 !! test
2667 External links: open square bracket forbidden in URL (named) (bug 4377)
2668 !! input
2669 [http://example.com/1[2345]
2670 !! result
2671 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2672 </p>
2673 !!end
2675 !! test
2676 External links: nowiki in URL link text (bug 6230)
2677 !!input
2678 [http://example.com/ <nowiki>''example site''</nowiki>]
2679 !! result
2680 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2681 </p>
2682 !! end
2684 !! test
2685 External links: newline forbidden in text (bug 6230 regression check)
2686 !! input
2687 [http://example.com/ first
2688 second]
2689 !! result
2690 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2691 second]
2692 </p>
2693 !!end
2695 !! test
2696 External links: Pipe char between url and text
2697 !! input
2698 [http://example.com | link]
2699 !! result
2700 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2701 </p>
2702 !!end
2704 !! test
2705 External links: protocol-relative URL in brackets
2706 !! input
2707 [//example.com/ Test]
2708 !! result
2709 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2710 </p>
2711 !! end
2713 !! test
2714 External links: protocol-relative URL in brackets without text
2715 !! input
2716 [//example.com]
2717 !! result
2718 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2719 </p>
2720 !! end
2722 !! test
2723 External links: protocol-relative URL in free text is left alone
2724 !! input
2725 //example.com/Foo
2726 !! result
2727 <p>//example.com/Foo
2728 </p>
2729 !!end
2731 !! test
2732 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2733 !! input
2734 foo//example.com/Foo
2735 !! result
2736 <p>foo//example.com/Foo
2737 </p>
2738 !! end
2740 !! test
2741 External image
2742 !! input
2743 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2744 !! result
2745 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2746 </p>
2747 !! end
2749 !! test
2750 External image from https
2751 !! input
2752 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2753 !! result
2754 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2755 </p>
2756 !! end
2758 !! test
2759 External image (when not allowed)
2760 !! options
2761 wgAllowExternalImages=0
2762 !! input
2763 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2764 !! result
2765 <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>
2766 </p>
2767 !! end
2769 !! test
2770 Link to non-http image, no img tag
2771 !! input
2772 Link to non-http image, no img tag: ftp://example.com/test.jpg
2773 !! result
2774 <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>
2775 </p>
2776 !! end
2778 !! test
2779 External links: terminating separator
2780 !! input
2781 Terminating separator: http://example.com/thing,
2782 !! result
2783 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2784 </p>
2785 !! end
2787 !! test
2788 External links: intervening separator
2789 !! input
2790 Intervening separator: http://example.com/1,2,3
2791 !! result
2792 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2793 </p>
2794 !! end
2796 !! test
2797 External links: old bug with URL in query
2798 !! input
2799 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2800 !! result
2801 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2802 </p>
2803 !! end
2805 !! test
2806 External links: old URL-in-URL bug, mixed protocols
2807 !! input
2808 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2809 !! result
2810 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2811 </p>
2812 !!end
2814 !! test
2815 External links: URL in text
2816 !! input
2817 URL in text: [http://example.com http://example.com]
2818 !! result
2819 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2820 </p>
2821 !! end
2823 !! test
2824 External links: Clickable images
2825 !! input
2826 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2827 !! result
2828 <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>
2829 </p>
2830 !!end
2832 !! test
2833 External links: raw ampersand
2834 !! input
2835 Old &amp; use: http://x&y
2836 !! result
2837 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2838 </p>
2839 !! end
2841 !! test
2842 External links: encoded ampersand
2843 !! input
2844 Old &amp; use: http://x&amp;y
2845 !! result
2846 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2847 </p>
2848 !! end
2850 !! test
2851 External links: encoded equals (bug 6102)
2852 !! input
2853 http://example.com/?foo&#61;bar
2854 !! result
2855 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2856 </p>
2857 !! end
2859 !! test
2860 External links: [raw ampersand]
2861 !! input
2862 Old &amp; use: [http://x&y]
2863 !! result
2864 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2865 </p>
2866 !! end
2868 !! test
2869 External links: [encoded ampersand]
2870 !! input
2871 Old &amp; use: [http://x&amp;y]
2872 !! result
2873 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2874 </p>
2875 !! end
2877 !! test
2878 External links: [encoded equals] (bug 6102)
2879 !! input
2880 [http://example.com/?foo&#61;bar]
2881 !! result
2882 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2883 </p>
2884 !! end
2886 !! test
2887 External links: [IDN ignored character reference in hostname; strip it right off]
2888 !! input
2889 [http://e&zwnj;xample.com/]
2890 !! result
2891 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2892 </p>
2893 !! end
2895 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2896 # Where an external link could easily circumvent the sanitization of the text of
2897 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2898 # test demands a higher standard. That's a bit strange.
2900 # Example:
2902 # http://e‌xample.com -> [http://example.com|http://example.com]
2903 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2905 # The first example is sanitized, but the second is not. Any security benefits
2906 # from this production are trivial to circumvent. Either remove this test and
2907 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2908 # the test accordingly.
2910 # All our love,
2911 # The Parsoid team.
2912 !! test
2913 External links: IDN ignored character reference in hostname; strip it right off
2914 !! input
2915 http://e&zwnj;xample.com/
2916 !! result
2917 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2918 </p>
2919 !! end
2921 !! test
2922 External links: www.jpeg.org (bug 554)
2923 !! input
2924 http://www.jpeg.org
2925 !!result
2926 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2927 </p>
2928 !! end
2930 !! test
2931 External links: URL within URL (original bug 2)
2932 !! input
2933 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2934 !! result
2935 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2936 </p>
2937 !! end
2939 !! test
2940 BUG 361: URL inside bracketed URL
2941 !! input
2942 [http://www.example.com/foo http://www.example.com/bar]
2943 !! result
2944 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2945 </p>
2946 !! end
2948 !! test
2949 BUG 361: URL within URL, not bracketed
2950 !! input
2951 http://www.example.com/foo?=http://www.example.com/bar
2952 !! result
2953 <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>
2954 </p>
2955 !! end
2957 !! test
2958 BUG 289: ">"-token in URL-tail
2959 !! input
2960 http://www.example.com/<hello>
2961 !! result
2962 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2963 </p>
2964 !!end
2966 !! test
2967 BUG 289: literal ">"-token in URL-tail
2968 !! input
2969 http://www.example.com/<b>html</b>
2970 !! result
2971 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2972 </p>
2973 !!end
2975 !! test
2976 BUG 289: ">"-token in bracketed URL
2977 !! input
2978 [http://www.example.com/<hello> stuff]
2979 !! result
2980 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2981 </p>
2982 !!end
2984 !! test
2985 BUG 289: literal ">"-token in bracketed URL
2986 !! input
2987 [http://www.example.com/<b>html</b> stuff]
2988 !! result
2989 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2990 </p>
2991 !!end
2993 !! test
2994 BUG 289: literal double quote at end of URL
2995 !! input
2996 http://www.example.com/"hello"
2997 !! result
2998 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2999 </p>
3000 !!end
3002 !! test
3003 BUG 289: literal double quote in bracketed URL
3004 !! input
3005 [http://www.example.com/"hello" stuff]
3006 !! result
3007 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3008 </p>
3009 !!end
3011 !! test
3012 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3013 !! input
3014 [http://www.example.com  test]
3015 !! result
3016 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3017 </p>
3018 !! end
3020 !! test
3021 External links: link text with spaces
3022 !! input
3023 [http://www.example.com a b c]
3024 [http://www.example.com ''a'' ''b'']
3025 !! result
3026 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3027 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3028 </p>
3029 !! end
3031 !! test
3032 External links: wiki links within external link (Bug 3695)
3033 !! input
3034 [http://example.com [[wikilink]] embedded in ext link]
3035 !! result
3036 <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>
3037 </p>
3038 !! end
3040 !! test
3041 BUG 787: Links with one slash after the url protocol are invalid
3042 !! input
3043 http:/example.com
3045 [http:/example.com title]
3046 !! result
3047 <p>http:/example.com
3048 </p><p>[http:/example.com title]
3049 </p>
3050 !! end
3052 !! test
3053 Bracketed external links with template-generated invalid target
3054 !! input
3055 [{{echo|http:/example.com}} title]
3056 !! result
3057 <p>[http:/example.com title]
3058 </p>
3059 !! end
3061 !! test
3062 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3063 !! input
3064 ''[http://example.com text'']
3065 [http://example.com '''text]'''
3066 ''Something [http://example.com in italic'']
3067 ''Something [http://example.com mixed''''', even bold]'''
3068 '''''Now [http://example.com both''''']
3069 !! result
3070 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3071 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3072 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3073 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3074 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3075 </p>
3076 !! end
3079 !! test
3080 Bug 4781: %26 in URL
3081 !! input
3082 http://www.example.com/?title=AT%26T
3083 !! result
3084 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3085 </p>
3086 !! end
3088 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3089 # % is actually legal in HTML5. Any change in output would need testing though.
3090 !! test
3091 Bug 4781, 5267: %25 in URL
3092 !! input
3093 http://www.example.com/?title=100%25_Bran
3094 !! result
3095 <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>
3096 </p>
3097 !! end
3099 !! test
3100 Bug 4781, 5267: %28, %29 in URL
3101 !! input
3102 http://www.example.com/?title=Ben-Hur_%281959_film%29
3103 !! result
3104 <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>
3105 </p>
3106 !! end
3109 !! test
3110 Bug 4781: %26 in autonumber URL
3111 !! input
3112 [http://www.example.com/?title=AT%26T]
3113 !! result
3114 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3115 </p>
3116 !! end
3118 !! test
3119 Bug 4781, 5267: %26 in autonumber URL
3120 !! input
3121 [http://www.example.com/?title=100%25_Bran]
3122 !! result
3123 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3124 </p>
3125 !! end
3127 !! test
3128 Bug 4781, 5267: %28, %29 in autonumber URL
3129 !! input
3130 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3131 !! result
3132 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3133 </p>
3134 !! end
3137 !! test
3138 Bug 4781: %26 in bracketed URL
3139 !! input
3140 [http://www.example.com/?title=AT%26T link]
3141 !! result
3142 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3143 </p>
3144 !! end
3146 !! test
3147 Bug 4781, 5267: %26 in bracketed URL
3148 !! input
3149 [http://www.example.com/?title=100%25_Bran link]
3150 !! result
3151 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3152 </p>
3153 !! end
3155 !! test
3156 Bug 4781, 5267: %28, %29 in bracketed URL
3157 !! input
3158 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3159 !! result
3160 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3161 </p>
3162 !! end
3164 !! test
3165 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3166 !! input
3167 Some [http://example.com/ pretty ''italics'' and stuff]!
3168 !! result
3169 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3170 </p>
3171 !! end
3173 !! test
3174 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3175 !! input
3176 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3177 !! result
3178 <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>
3179 </p>
3180 !! end
3182 !! test
3183 External link containing double-single-quotes with no space separating the url from text in italics
3184 !! input
3185 [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]].]
3186 !! result
3187 <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>
3188 </p>
3189 !! end
3191 !! test
3192 External link with comments in link text
3193 !! input
3194 [http://www.google.com Google <!-- comment -->]
3195 !! result
3196 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3197 </p>
3198 !! end
3200 !! test
3201 URL-encoding in URL functions (single parameter)
3202 !! input
3203 {{localurl:Some page|amp=&}}
3204 !! result
3205 <p>/index.php?title=Some_page&amp;amp=&amp;
3206 </p>
3207 !! end
3209 !! test
3210 URL-encoding in URL functions (multiple parameters)
3211 !! input
3212 {{localurl:Some page|q=?&amp=&}}
3213 !! result
3214 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3215 </p>
3216 !! end
3218 !! test
3219 Brackets in urls
3220 !! input
3221 http://example.com/index.php?foozoid%5B%5D=bar
3223 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3224 !! result
3225 <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>
3226 </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>
3227 </p>
3228 !! end
3230 !! test
3231 IPv6 urls (bug 21261)
3232 !! options
3233 disabled
3234 !! input
3235 http://[2404:130:0:1000::187:2]/index.php
3236 !! result
3237 <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>
3238 </p>
3239 !! end
3241 !! test
3242 Non-extlinks in brackets
3243 !! input
3244 [foo]
3245 [foo bar]
3246 [foo ''bar'']
3247 [fool's] errand
3248 [fool's errand]
3249 [{{echo|foo}}]
3250 [{{echo|foo}} bar]
3251 [{{echo|foo}} ''bar'']
3252 [{{echo|foo}}l's] errand
3253 [{{echo|foo}}l's errand]
3254 [url={{echo|foo}}]
3255 [url=http://example.com]
3256 !! result
3257 <p>[foo]
3258 [foo bar]
3259 [foo <i>bar</i>]
3260 [fool's] errand
3261 [fool's errand]
3262 [foo]
3263 [foo bar]
3264 [foo <i>bar</i>]
3265 [fool's] errand
3266 [fool's errand]
3267 [url=foo]
3268 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3269 </p>
3270 !! end
3272 !! test
3273 Parsoid: Percent encoding in external links
3274 !! options
3275 parsoid
3276 !! input
3277 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3278 !! result
3279 <p><a rel="mw:ExtLink"
3280 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3281 !! end
3283 !! test
3284 Parsoid: use url link syntax for links where the content is equal the link
3285 target
3286 !! options
3287 parsoid
3288 !! input
3289 http://example.com
3290 !! result
3291 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3292 !! end
3295 ### Quotes
3298 !! test
3299 Quotes
3300 !! input
3301 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3303 Normal text. '''''Bold italic text.''''' Normal text.
3304 !!result
3305 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3306 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3307 </p>
3308 !! end
3311 !! test
3312 Unclosed and unmatched quotes (php)
3313 !! options
3315 !! input
3316 '''''Bold italic text '''with bold deactivated''' in between.'''''
3318 '''''Bold italic text ''with italic deactivated'' in between.'''''
3320 '''Bold text..
3322 ..spanning two paragraphs (should not work).'''
3324 '''Bold tag left open
3326 ''Italic tag left open
3328 Normal text.
3330 <!-- Unmatching number of opening, closing tags: -->
3331 '''This year''''s election ''should'' beat '''last year''''s.
3333 ''Tom'''s car is bigger than ''Susan'''s.
3335 Plain ''italic'''s plain
3336 !! result
3337 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3338 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3339 </p><p><b>Bold text..</b>
3340 </p><p>..spanning two paragraphs (should not work).
3341 </p><p><b>Bold tag left open</b>
3342 </p><p><i>Italic tag left open</i>
3343 </p><p>Normal text.
3344 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3345 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3346 </p><p>Plain <i>italic'</i>s plain
3347 </p>
3348 !! end
3349 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3350 # parser strips. The wikitext contains just the first half of the bold
3351 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3352 # differently than the PHP parser.)
3353 !! test
3354 Unclosed and unmatched quotes (parsoid)
3355 !! options
3356 parsoid
3357 !! input
3358 '''''Bold italic text '''with bold deactivated''' in between.'''''
3360 '''''Bold italic text ''with italic deactivated'' in between.'''''
3362 '''Bold text..
3364 ..spanning two paragraphs (should not work).'''
3366 '''Bold tag left open
3368 ''Italic tag left open
3370 Normal text.
3372 <!-- Unmatching number of opening, closing tags: -->
3373 '''This year''''s election ''should'' beat '''last year''''s.
3375 ''Tom'''s car is bigger than ''Susan'''s.
3377 Plain ''italic'''s plain
3378 !! result
3379 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3380 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3381 </p><p><b>Bold text..</b>
3382 </p><p>..spanning two paragraphs (should not work).<b></b>
3383 </p><p><b>Bold tag left open</b>
3384 </p><p><i>Italic tag left open</i>
3385 </p><p>Normal text.
3386 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3387 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3388 </p><p>Plain <i>italic'</i>s plain
3389 </p>
3390 !! end
3393 ### Tables
3395 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3398 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3399 # is the bare minimum required by the spec, see:
3400 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3401 !! test
3402 A table with no data. (php)
3403 !! options
3405 !! input
3406 {||}
3407 !! result
3408 !! end
3409 # Parsoid team replies: empty table tags are legal in HTML5
3410 !! test
3411 A table with no data. (parsoid)
3412 !! options
3413 parsoid
3414 !! input
3415 {||}
3416 !! result
3417 <table></table>
3418 !! end
3420 # A table with nothing but a caption is invalid XHTML, we might want to render
3421 # this as <p>caption</p>
3422 !! test
3423 A table with nothing but a caption (php)
3424 !! options
3426 !! input
3428 |+ caption
3430 !! result
3431 <table>
3432 <caption> caption
3433 </caption><tr><td></td></tr></table>
3435 !! end
3436 # Parsoid team replies: table with only a caption is legal in HTML5
3437 !! test
3438 A table with nothing but a caption (parsoid)
3439 !! options
3440 parsoid
3441 !! input
3443 |+ caption
3445 !! result
3446 <table><caption> caption</caption></table>
3447 !! end
3449 !! test
3450 A table with caption with default-spaced attributes and a table row
3451 !! input
3453 |+ style="color: red;" | caption1
3455 | foo
3457 !! result
3458 <table>
3459 <caption style="color: red;"> caption1
3460 </caption>
3461 <tr>
3462 <td> foo
3463 </td></tr></table>
3465 !! end
3467 !! test
3468 A table with captions with non-default spaced attributes and a table row
3469 !! input
3471 |+style="color: red;"|caption2
3472 |+ style="color: red;"| caption3
3474 | foo
3476 !! result
3477 <table>
3478 <caption style="color: red;">caption2
3479 </caption>
3480 <caption style="color: red;"> caption3
3481 </caption>
3482 <tr>
3483 <td> foo
3484 </td></tr></table>
3486 !! end
3488 !! test
3489 Table td-cell syntax variations
3490 !! input
3492 | foo bar foo | baz
3493 | foo bar foo || baz
3494 | style='color:red;' | baz
3495 | style='color:red;' || baz
3497 !! result
3498 <table>
3499 <tr>
3500 <td> baz
3501 </td>
3502 <td> foo bar foo </td>
3503 <td> baz
3504 </td>
3505 <td style="color:red;"> baz
3506 </td>
3507 <td> style='color:red;' </td>
3508 <td> baz
3509 </td></tr></table>
3511 !! end
3513 !! test
3514 Simple table
3515 !! input
3517 | 1 || 2
3519 | 3 || 4
3521 !! result
3522 <table>
3523 <tr>
3524 <td> 1 </td>
3525 <td> 2
3526 </td></tr>
3527 <tr>
3528 <td> 3 </td>
3529 <td> 4
3530 </td></tr></table>
3532 !! end
3534 !! test
3535 Simple table but with multiple dashes for row wikitext
3536 !! input
3538 | foo
3539 |-----
3540 | bar
3542 !! result
3543 <table>
3544 <tr>
3545 <td> foo
3546 </td></tr>
3547 <tr>
3548 <td> bar
3549 </td></tr></table>
3551 !! end
3552 !! test
3553 Multiplication table
3554 !! input
3555 {| border="1" cellpadding="2"
3556 |+Multiplication table
3558 ! &times; !! 1 !! 2 !! 3
3560 ! 1
3561 | 1 || 2 || 3
3563 ! 2
3564 | 2 || 4 || 6
3566 ! 3
3567 | 3 || 6 || 9
3569 ! 4
3570 | 4 || 8 || 12
3572 ! 5
3573 | 5 || 10 || 15
3575 !! result
3576 <table border="1" cellpadding="2">
3577 <caption>Multiplication table
3578 </caption>
3579 <tr>
3580 <th> &#215; </th>
3581 <th> 1 </th>
3582 <th> 2 </th>
3583 <th> 3
3584 </th></tr>
3585 <tr>
3586 <th> 1
3587 </th>
3588 <td> 1 </td>
3589 <td> 2 </td>
3590 <td> 3
3591 </td></tr>
3592 <tr>
3593 <th> 2
3594 </th>
3595 <td> 2 </td>
3596 <td> 4 </td>
3597 <td> 6
3598 </td></tr>
3599 <tr>
3600 <th> 3
3601 </th>
3602 <td> 3 </td>
3603 <td> 6 </td>
3604 <td> 9
3605 </td></tr>
3606 <tr>
3607 <th> 4
3608 </th>
3609 <td> 4 </td>
3610 <td> 8 </td>
3611 <td> 12
3612 </td></tr>
3613 <tr>
3614 <th> 5
3615 </th>
3616 <td> 5 </td>
3617 <td> 10 </td>
3618 <td> 15
3619 </td></tr></table>
3621 !! end
3623 !! test
3624 Accept "||" in table headings
3625 !! input
3627 !h1 || h2
3629 !! result
3630 <table>
3631 <tr>
3632 <th>h1 </th>
3633 <th> h2
3634 </th></tr></table>
3636 !! end
3638 !! test
3639 Accept "||" in indented table headings
3640 !! input
3642 !h1 || h2
3644 !! result
3645 <dl><dd><table>
3646 <tr>
3647 <th>h1 </th>
3648 <th> h2
3649 </th></tr></table></dd></dl>
3651 !! end
3653 !! test
3654 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3655 !! input
3657 !| h1
3658 || a
3660 !! result
3661 <table>
3662 <tr>
3663 <th> h1
3664 </th>
3665 <td> a
3666 </td></tr></table>
3668 !! end
3670 !!test
3671 Accept "| !" at start of line in tables (ignore !-attribute)
3672 !!input
3675 | !style="color:red" | bar
3677 !!result
3678 <table>
3680 <tr>
3681 <td> bar
3682 </td></tr></table>
3684 !!end
3686 !!test
3687 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 +/- 
3688 !!input
3691 |style='color:red;'|+1
3692 |style='color:blue;'|-1
3694 | 1 || 2 || 3
3695 | 1 ||+2 ||-3
3697 | +1
3698 | -1
3700 !!result
3701 <table>
3703 <tr>
3704 <td style="color:red;">+1
3705 </td>
3706 <td style="color:blue;">-1
3707 </td></tr>
3708 <tr>
3709 <td> 1 </td>
3710 <td> 2 </td>
3711 <td> 3
3712 </td>
3713 <td> 1 </td>
3714 <td>+2 </td>
3715 <td>-3
3716 </td></tr>
3717 <tr>
3718 <td> +1
3719 </td>
3720 <td> -1
3721 </td></tr></table>
3723 !!end
3725 !! test
3726 Table rowspan
3727 !! input
3728 {| border=1
3729 | Cell 1, row 1
3730 |rowspan=2| Cell 2, row 1 (and 2)
3731 | Cell 3, row 1
3733 | Cell 1, row 2
3734 | Cell 3, row 2
3736 !! result
3737 <table border="1">
3738 <tr>
3739 <td> Cell 1, row 1
3740 </td>
3741 <td rowspan="2"> Cell 2, row 1 (and 2)
3742 </td>
3743 <td> Cell 3, row 1
3744 </td></tr>
3745 <tr>
3746 <td> Cell 1, row 2
3747 </td>
3748 <td> Cell 3, row 2
3749 </td></tr></table>
3751 !! end
3753 !! test
3754 Nested table
3755 !! input
3756 {| border=1
3757 | &alpha;
3759 {| bgcolor=#ABCDEF border=2
3760 |nested
3762 |table
3764 |the original table again
3766 !! result
3767 <table border="1">
3768 <tr>
3769 <td> &#945;
3770 </td>
3771 <td>
3772 <table bgcolor="#ABCDEF" border="2">
3773 <tr>
3774 <td>nested
3775 </td></tr>
3776 <tr>
3777 <td>table
3778 </td></tr></table>
3779 </td>
3780 <td>the original table again
3781 </td></tr></table>
3783 !! end
3785 !! test
3786 Invalid attributes in table cell (bug 1830)
3787 !! input
3789 |Cell:|broken
3791 !! result
3792 <table>
3793 <tr>
3794 <td>broken
3795 </td></tr></table>
3797 !! end
3800 !! test
3801 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3802 !! input
3804 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3805 !! result
3806 <table>
3807 <tr>
3808 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3809 <td>]" onmouseover="alert(document.cookie)"&gt;test
3810 </td>
3811 </tr>
3812 </table>
3814 !! end
3817 !! test
3818 Indented table markup mixed with indented pre content (proposed in bug 6200)
3819 !! input
3820  <table>
3821  <tr>
3822  <td>
3823  Text that should be rendered preformatted
3824  </td>
3825  </tr>
3826  </table>
3827 !! result
3828  <table>
3829  <tr>
3830  <td>
3831 <pre>Text that should be rendered preformatted
3832 </pre>
3833  </td>
3834  </tr>
3835  </table>
3837 !! end
3839 !! test
3840 Template-generated table cell attributes and cell content
3841 !! input
3843 |{{table_attribs}}
3845 !! result
3846 <table>
3847 <tr>
3848 <td style="color: red"> Foo
3849 </td></tr></table>
3851 !! end
3853 !! test
3854 Table with row followed by newlines and table heading
3855 !! input
3859 ! foo
3861 !! result
3862 <table>
3865 <tr>
3866 <th> foo
3867 </th></tr></table>
3869 !! end
3871 !! test
3872 Table with empty line following the start tag
3873 !! input
3877 | foo
3879 !! result
3880 <table>
3883 <tr>
3884 <td> foo
3885 </td></tr></table>
3887 !! end
3889 # FIXME: Preserve the attribute properly (with an empty string as value) in
3890 # the PHP parser. Parsoid implements the behavior below.
3891 !! test
3892 Table attributes with empty value
3893 !! options
3894 parsoid
3895 !! input
3897 | style=| hello
3899 !! result
3900 <table>
3901 <tbody>
3902 <tr>
3903 <td style=""> hello
3904 </td></tr></tbody></table>
3906 !! end
3908 !! test
3909 Wikitext table with a lot of comments
3910 !! input
3912 <!-- c0 -->
3913 | foo
3914 <!-- c1 -->
3915 |- <!-- c2 -->
3916 <!-- c3 -->
3917 |<!-- c4 -->
3918 <!-- c5 -->
3920 !! result
3921 <table>
3922 <tr>
3923 <td> foo
3924 </td></tr>
3925 <tr>
3926 <td>
3927 </td></tr></table>
3929 !! end
3931 !! test
3932 Wikitext table with double-line table cell
3933 !! input
3938 !! result
3939 <table>
3940 <tr>
3941 <td>a
3942 <p>b
3943 </p>
3944 </td></tr></table>
3946 !! end
3948 !! test
3949 Table cell with a single comment
3950 !! input
3952 | <!-- c1 -->
3953 | a
3955 !! result
3956 <table>
3957 <tr>
3958 <td>
3959 </td>
3960 <td> a
3961 </td></tr></table>
3963 !! end
3965 # The expected HTML structure in this test is debatable. The PHP parser does
3966 # not parse this kind of table at all. The main focus for Parsoid is on
3967 # round-tripping, so this output is ok for now. TODO: revisit!
3968 !! test
3969 Wikitext table with html-syntax row (Parsoid)
3970 !! options
3971 parsoid
3972 !! input
3975 <td>foo</td>
3977 !! result
3978 <table>
3979 <tbody>
3980 <tr>
3981 <td>foo</td></tr></tbody></table>
3982 !! end
3984 !! test
3985 Implicit <td> after a |-
3986 (PHP parser relies on Tidy to add the missing <td> tags)
3987 !! options
3988 parsoid=wt2html,wt2wt
3989 !! input
3994 !! result
3995 <table>
3996 <tr><td>a</td></tr>
3997 </table>
3998 !! end
4000 !! test
4001 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4002 (PHP parser relies on Tidy to add the missing <td> tags)
4003 !! options
4004 parsoid=wt2html,wt2wt
4005 !! input
4013 !! result
4014 <table>
4015 <tbody>
4016 <tr><td><pre>a</pre></td></tr>
4017 <tr><td> b</td></tr>
4018 </tbody>
4019 </table>
4020 !! end
4022 !! test
4023 Lists should be recognized in an implicit <td> context
4024 (PHP parser relies on Tidy to add the missing <td> tags)
4025 !! options
4026 parsoid=wt2html,wt2wt
4027 !! input
4032 !! result
4033 <table>
4034 <tr>
4035 <td><ul><li>a</li></ul></td>
4036 </tr>
4037 </table>
4038 !! end
4041 ### Internal links
4043 !! test
4044 Plain link, capitalized
4045 !! input
4046 [[Main Page]]
4047 !! result
4048 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4049 </p>
4050 !! end
4052 !! test
4053 Plain link, uncapitalized
4054 !! input
4055 [[main Page]]
4056 !! result
4057 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4058 </p>
4059 !! end
4061 !! test
4062 Piped link
4063 !! input
4064 [[Main Page|The Main Page]]
4065 !! result
4066 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4067 </p>
4068 !! end
4070 !! test
4071 Piped link with comment in link text
4072 !! input
4073 [[Main Page|The Main<!--front--> Page]]
4074 !! result
4075 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4076 </p>
4077 !! end
4079 !! test
4080 Broken link
4081 !! input
4082 [[Zigzagzogzagzig]]
4083 !! result
4084 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4085 </p>
4086 !! end
4088 !! test
4089 Broken link with fragment
4090 !! input
4091 [[Zigzagzogzagzig#zug]]
4092 !! result
4093 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4094 </p>
4095 !! end
4097 !! test
4098 Special page link with fragment
4099 !! input
4100 [[Special:Version#anchor]]
4101 !! result
4102 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4103 </p>
4104 !! end
4106 !! test
4107 Nonexistent special page link with fragment
4108 !! input
4109 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4110 !! result
4111 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4112 </p>
4113 !! end
4115 !! test
4116 Link with prefix
4117 !! input
4118 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4119 !! result
4120 <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>
4121 </p>
4122 !! end
4124 !! test
4125 Link with suffix
4126 !! input
4127 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4128 !! result
4129 <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>!!!
4130 </p>
4131 !! end
4133 !! article
4134 prefixed article
4135 !! text
4136 Some text
4137 !! endarticle
4139 !! test
4140 Bug 43661: Piped links with identical prefixes
4141 !! input
4142 [[prefixed article|prefixed articles with spaces]]
4144 [[prefixed article|prefixed articlesaoeu]]
4146 [[Main Page|Main Page test]]
4147 !! result
4148 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4149 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4150 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4151 </p>
4152 !! end
4155 !! test
4156 Link with HTML entity in suffix / tail
4157 !! input
4158 [[Main Page]]&quot;, [[Main Page]]&#97;
4159 !! result
4160 <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;
4161 </p>
4162 !! end
4164 !! test
4165 Link with 3 brackets
4166 !! input
4167 [[[main page]]]
4168 !! result
4169 <p>[[[main page]]]
4170 </p>
4171 !! end
4173 !! test
4174 Piped link with 3 brackets
4175 !! input
4176 [[[main page|the main page]]]
4177 !! result
4178 <p>[[[main page|the main page]]]
4179 </p>
4180 !! end
4182 !! test
4183 Link with multiple pipes
4184 !! input
4185 [[Main Page|The|Main|Page]]
4186 !! result
4187 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4188 </p>
4189 !! end
4191 !! test
4192 Link to namespaces
4193 !! input
4194 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4195 !! result
4196 <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>
4197 </p>
4198 !! end
4200 !! test
4201 Piped link to namespace
4202 !! input
4203 [[Meta:Disclaimers|The disclaimers]]
4204 !! result
4205 <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>
4206 </p>
4207 !! end
4209 !! test
4210 Link containing }
4211 !! input
4212 [[Usually caused by a typo (oops}]]
4213 !! result
4214 <p>[[Usually caused by a typo (oops}]]
4215 </p>
4216 !! end
4218 !! test
4219 Link containing % (not as a hex sequence)
4220 !! input
4221 [[7% Solution]]
4222 !! result
4223 <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>
4224 </p>
4225 !! end
4227 !! test
4228 Link containing % as a single hex sequence interpreted to char
4229 !! input
4230 [[7%25 Solution]]
4231 !! result
4232 <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>
4233 </p>
4234 !!end
4236 !! test
4237 Link containing % as a double hex sequence interpreted to hex sequence
4238 !! input
4239 [[7%2525 Solution]]
4240 !! result
4241 <p>[[7%2525 Solution]]
4242 </p>
4243 !!end
4245 !! test
4246 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4247 Example for such a section: == < ==
4248 !! input
4249 [[%23%3c]][[%23%3e]]
4250 !! result
4251 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4252 </p>
4253 !! end
4255 !! test
4256 Link containing "<#" and ">#" as a hex sequences
4257 !! input
4258 [[%3c%23]][[%3e%23]]
4259 !! result
4260 <p>[[%3c%23]][[%3e%23]]
4261 </p>
4262 !! end
4264 !! test
4265 Link containing an equals sign
4266 !! input
4267 [[Special:BookSources/isbn=4-00-026157-6]]
4268 !! result
4269 <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>
4270 </p>
4271 !! end
4273 !! article
4274 Foo~bar
4275 !! text
4276 Just a test of an article title containing a tilde.
4277 !! endarticle
4279 # note that links containing signatures, like [[Foo~~~~]], are
4280 # massaged by the pre-save transform (PST) and so the tildes are never
4281 # seen by the parser.
4282 !! test
4283 Link containing a tilde
4284 !! input
4285 [[Foo~bar]]
4286 !! result
4287 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4288 </p>
4289 !! end
4291 !! test
4292 Link containing double-single-quotes '' (bug 4598)
4293 !! input
4294 [[Lista d''e paise d''o munno]]
4295 !! result
4296 <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>
4297 </p>
4298 !! end
4300 !! test
4301 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4302 !! input
4303 Some [[Link|pretty ''italics'' and stuff]]!
4304 !! result
4305 <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>!
4306 </p>
4307 !! end
4309 !! test
4310 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4311 !! input
4312 ''Some [[Link|pretty ''italics'' and stuff]]!
4313 !! result
4314 <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>
4315 </p>
4316 !! end
4318 !! test
4319 Link with double quotes in title part (literal) and alternate part (interpreted)
4320 !! input
4321 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4323 [[''Pentecoste'']]
4325 [[''Pentecoste''|Pentecoste]]
4327 [[''Pentecoste''|''Pentecoste'']]
4328 !! result
4329 <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>
4330 </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>
4331 </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>
4332 </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>
4333 </p>
4334 !! end
4336 !! test
4337 Broken image links with HTML captions (bug 39700)
4338 !! input
4339 [[File:Nonexistent|<script></script>]]
4340 [[File:Nonexistent|100px|<script></script>]]
4341 [[File:Nonexistent|&lt;]]
4342 [[File:Nonexistent|a<i>b</i>c]]
4343 !! result
4344 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4345 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4346 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4347 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4348 </p>
4349 !! end
4351 !! test
4352 Plain link to URL
4353 !! input
4354 [[http://www.example.com]]
4355 !! result
4356 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4357 </p>
4358 !! end
4360 !! test
4361 Plain link to URL with link text
4362 !! input
4363 [[http://www.example.com Link text]]
4364 !! result
4365 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4366 </p>
4367 !! end
4369 !! test
4370 Plain link to protocol-relative URL
4371 !! input
4372 [[//www.example.com]]
4373 !! result
4374 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4375 </p>
4376 !! end
4378 !! test
4379 Plain link to protocol-relative URL with link text
4380 !! input
4381 [[//www.example.com Link text]]
4382 !! result
4383 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4384 </p>
4385 !! end
4387 !! test
4388 Plain link to page with question mark in title
4389 !! input
4390 [[A?b]]
4392 [[A?b|Baz]]
4393 !! result
4394 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4395 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4396 </p>
4397 !! end
4400 # I'm fairly sure the expected result here is wrong.
4401 # We want these to be URL links, not pseudo-pages with URLs for titles....
4402 # However the current output is also pretty screwy.
4404 # ----
4405 # I'm changing it to match the current output--it arguably makes more
4406 # sense in the light of the test above. Old expected result was:
4407 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4408 #</p>
4409 # But I think this test is bordering on "garbage in, garbage out" anyway.
4410 # -- wtm
4411 !! test
4412 Piped link to URL
4413 !! input
4414 Piped link to URL: [[http://www.example.com|an example URL]]
4415 !! result
4416 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4417 </p>
4418 !! end
4420 !! test
4421 BUG 2: [[page|http://url/]] should link to page, not http://url/
4422 !! input
4423 [[Main Page|http://url/]]
4424 !! result
4425 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4426 </p>
4427 !! end
4429 !! test
4430 BUG 337: Escaped self-links should be bold
4431 !! options
4432 title=[[Bug462]]
4433 !! input
4434 [[Bu&#103;462]] [[Bug462]]
4435 !! result
4436 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4437 </p>
4438 !! end
4440 !! test
4441 Self-link to section should not be bold
4442 !! options
4443 title=[[Main Page]]
4444 !! input
4445 [[Main Page#section]]
4446 !! result
4447 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4448 </p>
4449 !! end
4451 !! article
4453 !! text
4454 This is 00.
4455 !! endarticle
4457 !!test
4458 Self-link to numeric title
4459 !!options
4460 title=[[0]]
4461 !!input
4462 [[0]]
4463 !!result
4464 <p><strong class="selflink">0</strong>
4465 </p>
4466 !!end
4468 !!test
4469 Link to numeric-equivalent title
4470 !!options
4471 title=[[0]]
4472 !!input
4473 [[00]]
4474 !!result
4475 <p><a href="/wiki/00" title="00">00</a>
4476 </p>
4477 !!end
4479 !! test
4480 <nowiki> inside a link
4481 !! input
4482 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4483 !! result
4484 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4485 </p>
4486 !! end
4488 !! test
4489 Non-breaking spaces in title
4490 !! input
4491 [[&nbsp; Main &nbsp; Page &nbsp;]]
4492 !! result
4493 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4494 </p>
4495 !!end
4497 !! test
4498 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4499 !! options
4500 language=ca
4501 !! input
4502 '''[[Main Page]]'''
4503 !! result
4504 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4505 </p>
4506 !! end
4508 !! test
4509 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4510 !! options
4511 language=ca
4512 !! input
4513 ''[[Main Page]]''
4514 !! result
4515 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4516 </p>
4517 !! end
4519 !! test
4520 Internal link with en linktrail: no apostrophes (bug 27473)
4521 !! options
4522 language=en
4523 !! input
4524 [[Something]]'nice
4525 !! result
4526 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4527 </p>
4528 !! end
4530 !! test
4531 Internal link with ca linktrail with apostrophes (bug 27473)
4532 !! options
4533 language=ca
4534 !! input
4535 [[Something]]'nice
4536 !! result
4537 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4538 </p>
4539 !! end
4541 !! test
4542 Internal link with kaa linktrail with apostrophes (bug 27473)
4543 !! options
4544 language=kaa
4545 !! input
4546 [[Something]]'nice
4547 !! result
4548 <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>
4549 </p>
4550 !! end
4552 !! article
4553 Söfnuður
4554 !! text
4555 Test.
4556 !! endarticle
4558 !! test
4559 Internal link with is link prefix
4560 !! options
4561 language=is
4562 !! input
4563 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4564 !! result
4565 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4566 </p>
4567 !! end
4569 !! article
4570 Mótmælendatrú
4571 !! text
4572 Test.
4573 !! endarticle
4575 !! test
4576 Internal link with is link trail and link prefix
4577 !! options
4578 language=is
4579 !! input
4580 [[mótmælendatrú|xxx]]ar
4581 [[mótmælendatrú]]ar
4582 mótmælenda[[söfnuður]]
4583 mótmælenda[[söfnuður|söfnuðir]]
4584 mótmælenda[[söfnuður|söfnuðir]]xxx
4585 !! result
4586 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4587 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4588 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4589 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4590 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4591 </p>
4592 !! end
4594 !! test
4595 Parsoid link trail escaping
4596 !! options
4597 parsoid=html2wt,html2html
4598 !! input
4599 [[apple]]<nowiki/>s
4600 !! result
4601 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4602 !! end
4604 !! test
4605 Parsoid link prefix escaping
4606 !! options
4607 language=is
4608 parsoid=html2wt,html2html
4609 !! input
4610 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4611 !! result
4612 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4613 !! end
4615 !! test
4616 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4617 !! input
4618 [[Foo|  bar]]
4620 [[Foo|  ''bar'']]
4622 [http://wp.org   foo]
4624 [http://wp.org   ''foo'']
4625 !! result
4626 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">  bar</a>
4627 </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>
4628 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4629 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4630 </p>
4631 !! end
4634 ### Interwiki links (see maintenance/interwiki.sql)
4637 !! test
4638 Inline interwiki link
4639 !! input
4640 [[MeatBall:SoftSecurity]]
4641 !! result
4642 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4643 </p>
4644 !! end
4646 !! test
4647 Inline interwiki link with empty title (bug 2372)
4648 !! input
4649 [[MeatBall:]]
4650 !! result
4651 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4652 </p>
4653 !! end
4655 !! test
4656 Interwiki link encoding conversion (bug 1636)
4657 !! input
4658 *[[Wikipedia:ro:Olteni&#0355;a]]
4659 *[[Wikipedia:ro:Olteni&#355;a]]
4660 !! result
4661 <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>
4662 </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>
4663 </li></ul>
4665 !! end
4667 !! test
4668 Interwiki link with fragment (bug 2130)
4669 !! input
4670 [[MeatBall:SoftSecurity#foo]]
4671 !! result
4672 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4673 </p>
4674 !! end
4676 !! test
4677 Interlanguage link
4678 !! input
4679 Blah blah blah
4680 [[zh:Chinese]]
4681 !!result
4682 <p>Blah blah blah
4683 </p>
4684 !! end
4686 !! test
4687 Double interlanguage link
4688 !! input
4689 Blah blah blah
4690 [[es:Spanish]]
4691 [[zh:Chinese]]
4692 !!result
4693 <p>Blah blah blah
4694 </p>
4695 !! end
4697 !! test
4698 Interlanguage link, with prefix links
4699 !! options
4700 language=ln
4701 !! input
4702 Blah blah blah
4703 [[zh:Chinese]]
4704 !!result
4705 <p>Blah blah blah
4706 </p>
4707 !! end
4709 !! test
4710 Double interlanguage link, with prefix links (bug 8897)
4711 !! options
4712 language=ln
4713 !! input
4714 Blah blah blah
4715 [[es:Spanish]]
4716 [[zh:Chinese]]
4717 !!result
4718 <p>Blah blah blah
4719 </p>
4720 !! end
4722 !! test
4723 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4724 !! options
4725 language=ln
4726 !! input
4727 [[WW&nbsp;II]]
4728 !!result
4729 <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>
4730 </p>
4731 !! end
4733 !! test
4734 Parsoid: handle constructor well
4735 !! options
4736 parsoid
4737 !! input
4738 [[constructor]]
4740 [[constructor:foo]]
4741 !! result
4742 <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>
4745 <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>
4746 !! end
4749 ## Redirects, Parsoid-only
4751 !! test
4752 Simple redirect to page
4753 !! options
4754 parsoid
4755 !! input
4756 #REDIRECT [[Main Page]]
4757 !! result
4758 <link rel="mw:PageProp/redirect" href="./Main_Page">
4759 !! end
4761 !! test
4762 Redirect to category
4763 !! options
4764 parsoid=wt2html
4765 !! input
4766 #REDIRECT [[Category:Foo]]
4767 !! result
4768 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
4769 !! end
4771 !! test
4772 Redirect to category page
4773 !! options
4774 parsoid=wt2html,html2html
4775 !! input
4776 #REDIRECT [[:Category:Foo]]
4777 !! result
4778 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
4779 !! end
4781 !! test
4782 Redirect to image page
4783 !! options
4784 parsoid
4785 !! input
4786 #REDIRECT [[File:Wiki.png]]
4787 !! result
4788 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
4789 !! end
4791 !! test
4792 Redirect to language
4793 !! options
4794 parsoid
4795 !! input
4796 #REDIRECT [[en:File:Wiki.png]]
4797 !! result
4798 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4799 !! end
4801 !! test
4802 Redirect to interwiki
4803 !! options
4804 parsoid
4805 !! input
4806 #REDIRECT [[meatball:File:Wiki.png]]
4807 !! result
4808 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4809 !! end
4812 ## XHTML tidiness
4815 !! test
4816 <br> to <br />
4817 !! input
4818 1<br>2<br />3
4819 !! result
4820 <p>1<br />2<br />3
4821 </p>
4822 !! end
4824 !! test
4825 Broken br tag sanitization
4826 !! options
4828 !! input
4829 </br>
4830 !! result
4831 <p>&lt;/br&gt;
4832 </p>
4833 !! end
4835 # TODO: Fix html2html mode (bug 51055)!
4836 !! test
4837 Parsoid: Broken br tag recognition
4838 !! options
4839 parsoid=wt2html
4840 !! input
4841 </br>
4842 !! result
4843 <p><br></p>
4844 !! end
4846 !! test
4847 Incorrecly removing closing slashes from correctly formed XHTML
4848 !! input
4849 <br style="clear:both;" />
4850 !! result
4851 <p><br style="clear:both;" />
4852 </p>
4853 !! end
4855 !! test
4856 Failing to transform badly formed HTML into correct XHTML
4857 !! input
4858 <br style="clear: left;">
4859 <br style="clear: right;">
4860 <br style="clear: both;">
4861 !! result
4862 <p><br style="clear: left;" />
4863 <br style="clear: right;" />
4864 <br style="clear: both;" />
4865 </p>
4866 !!end
4868 !! test
4869 Handling html with a div self-closing tag
4870 !! input
4871 <div title />
4872 <div title/>
4873 <div title/ >
4874 <div title=bar />
4875 <div title=bar/>
4876 <div title=bar/ >
4877 !! result
4878 <p>&lt;div title /&gt;
4879 &lt;div title/&gt;
4880 </p>
4881 <div>
4882 <p>&lt;div title=bar /&gt;
4883 &lt;div title=bar/&gt;
4884 </p>
4885 <div title="bar/"></div>
4886 </div>
4888 !! end
4890 !! test
4891 Handling html with a br self-closing tag
4892 !! input
4893 <br title />
4894 <br title/>
4895 <br title/ >
4896 <br title=bar />
4897 <br title=bar/>
4898 <br title=bar/ >
4899 !! result
4900 <p><br title="title" />
4901 <br title="title" />
4902 <br />
4903 <br title="bar" />
4904 <br title="bar" />
4905 <br title="bar/" />
4906 </p>
4907 !! end
4909 !! test
4910 Horizontal ruler (should it add that extra space?)
4911 !! input
4912 <hr>
4913 <hr >
4914 foo <hr
4915 > bar
4916 !! result
4917 <hr />
4918 <hr />
4919 foo <hr /> bar
4921 !! end
4923 !! test
4924 Horizontal ruler -- 4+ dashes render hr
4925 !! input
4926 ----
4927 !! result
4928 <hr />
4930 !! end
4932 !! test
4933 Horizontal ruler -- eats additional dashes on the same line
4934 !! input
4935 ---------
4936 !! result
4937 <hr />
4939 !! end
4941 !! test
4942 Horizontal ruler -- does not collapse dashes on consecutive lines
4943 !! input
4944 ----
4945 ----
4946 !! result
4947 <hr />
4948 <hr />
4950 !! end
4952 !! test
4953 Horizontal ruler -- <4 dashes render as plain text
4954 !! input
4956 !! result
4957 <p>---
4958 </p>
4959 !! end
4961 !! test
4962 Horizontal ruler -- Supports content following dashes on same line
4963 !! input
4964 ---- Foo
4965 !! result
4966 <hr /> Foo
4968 !! end
4971 ### Block-level elements
4973 !! test
4974 Common list
4975 !! input
4976 *Common list
4977 * item 2
4978 *item 3
4979 !! result
4980 <ul><li>Common list
4981 </li><li> item 2
4982 </li><li>item 3
4983 </li></ul>
4985 !! end
4987 !! test
4988 Numbered list
4989 !! input
4990 #Numbered list
4991 #item 2
4992 # item 3
4993 !! result
4994 <ol><li>Numbered list
4995 </li><li>item 2
4996 </li><li> item 3
4997 </li></ol>
4999 !! end
5001 !! test
5002 Mixed list
5003 !! input
5004 *Mixed list
5005 *# with numbers
5006 ** and bullets
5007 *# and numbers
5008 *bullets again
5009 **bullet level 2
5010 ***bullet level 3
5011 ***#Number on level 4
5012 **bullet level 2
5013 **#Number on level 3
5014 **#Number on level 3
5015 *#number level 2
5016 *Level 1
5017 *** Level 3
5018 #** Level 3, but ordered
5019 !! result
5020 <ul><li>Mixed list
5021 <ol><li> with numbers
5022 </li></ol>
5023 <ul><li> and bullets
5024 </li></ul>
5025 <ol><li> and numbers
5026 </li></ol>
5027 </li><li>bullets again
5028 <ul><li>bullet level 2
5029 <ul><li>bullet level 3
5030 <ol><li>Number on level 4
5031 </li></ol>
5032 </li></ul>
5033 </li><li>bullet level 2
5034 <ol><li>Number on level 3
5035 </li><li>Number on level 3
5036 </li></ol>
5037 </li></ul>
5038 <ol><li>number level 2
5039 </li></ol>
5040 </li><li>Level 1
5041 <ul><li><ul><li> Level 3
5042 </li></ul>
5043 </li></ul>
5044 </li></ul>
5045 <ol><li><ul><li><ul><li> Level 3, but ordered
5046 </li></ul>
5047 </li></ul>
5048 </li></ol>
5050 !! end
5052 !! test
5053 Nested lists 1
5054 !! input
5055 *foo
5056 **bar
5057 !! result
5058 <ul><li>foo
5059 <ul><li>bar
5060 </li></ul>
5061 </li></ul>
5063 !! end
5065 !! test
5066 Nested lists 2
5067 !! input
5068 **foo
5069 *bar
5070 !! result
5071 <ul><li><ul><li>foo
5072 </li></ul>
5073 </li><li>bar
5074 </li></ul>
5076 !! end
5078 !! test
5079 Nested lists 3 (first element empty)
5080 !! input
5082 **bar
5083 !! result
5084 <ul><li>
5085 <ul><li>bar
5086 </li></ul>
5087 </li></ul>
5089 !! end
5091 !! test
5092 Nested lists 4 (first element empty)
5093 !! input
5095 *bar
5096 !! result
5097 <ul><li><ul><li>
5098 </li></ul>
5099 </li><li>bar
5100 </li></ul>
5102 !! end
5104 !! test
5105 Nested lists 5 (both elements empty)
5106 !! input
5109 !! result
5110 <ul><li><ul><li>
5111 </li></ul>
5112 </li><li>
5113 </li></ul>
5115 !! end
5117 !! test
5118 Nested lists 6 (both elements empty)
5119 !! input
5122 !! result
5123 <ul><li>
5124 <ul><li>
5125 </li></ul>
5126 </li></ul>
5128 !! end
5130 !! test
5131 Nested lists 7 (skip initial nesting levels)
5132 !! input
5133 *** foo
5134 !! result
5135 <ul><li><ul><li><ul><li> foo
5136 </li></ul>
5137 </li></ul>
5138 </li></ul>
5140 !! end
5142 !! test
5143 Nested lists 8 (multiple nesting transitions)
5144 !! input
5145 * foo
5146 *** bar
5147 ** baz
5148 * boo
5149 !! result
5150 <ul><li> foo
5151 <ul><li><ul><li> bar
5152 </li></ul>
5153 </li><li> baz
5154 </li></ul>
5155 </li><li> boo
5156 </li></ul>
5158 !! end
5160 !! test
5161 1. Lists with start-of-line-transparent tokens before bullets: Comments
5162 !! input
5163 *foo
5164 *<!--cmt-->bar
5165 <!--cmt-->*baz
5166 !! result
5167 <ul><li>foo
5168 </li><li>bar
5169 </li><li>baz
5170 </li></ul>
5172 !! end
5174 !! test
5175 2. Lists with start-of-line-transparent tokens before bullets: Template close
5176 !! input
5177 *foo {{echo|bar
5178 }}*baz
5179 !! result
5180 <ul><li>foo bar
5181 </li><li>baz
5182 </li></ul>
5184 !! end
5186 !! test
5187 Unbalanced closing block tags break a list
5188 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5189 !! options
5190 parsoid
5191 !! input
5192 <div>
5193 *a</div><div>
5194 *b</div>
5195 !! result
5196 <div>
5197 <ul><li>a
5198 </li></ul></div><div>
5199 <ul><li>b
5200 </li></ul></div>
5201 !! end
5203 !! test
5204 Unbalanced closing non-block tags don't break a list
5205 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5206 !! options
5207 parsoid
5208 !! input
5209 <span>
5210 *a</span><span>
5211 *b</span>
5212 !! result
5213 <p><span></span>
5214 </p>
5215 <ul><li>a<span></span>
5216 </li><li>b
5217 </li></ul>
5218 !! end
5220 !! test
5221 Unclosed formatting tags that straddle lists are closed and reopened
5222 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5223 !! options
5224 parsoid
5225 !! input
5226 # <s> a
5227 # b </s>
5228 !! result
5229 <ol><li> <s> a </s>
5230 </li><li> <s> b </s>
5231 </li></ol>
5232 !! end
5234 !!test
5235 List embedded in a non-block tag
5236 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5237 !! options
5238 parsoid
5239 !!input
5240 <small>
5241 * foo
5242 </small>
5243 !!result
5244 <p><small></small></p>
5245 <small>
5246 <ul>
5247 <li> foo</li>
5248 </ul>
5249 </small>
5250 <p><small></small></p>
5251 !!end
5253 !! test
5254 List items are not parsed correctly following a <pre> block (bug 785)
5255 !! input
5256 * <pre>foo</pre>
5257 * <pre>bar</pre>
5258 * zar
5259 !! result
5260 <ul><li> <pre>foo</pre>
5261 </li><li> <pre>bar</pre>
5262 </li><li> zar
5263 </li></ul>
5265 !! end
5267 !! test
5268 List items from template
5269 !! input
5271 {{inner list}}
5272 * item 2
5274 * item 0
5275 {{inner list}}
5276 * item 2
5278 * item 0
5279 * notSOL{{inner list}}
5280 * item 2
5281 !! result
5282 <ul><li> item 1
5283 </li><li> item 2
5284 </li></ul>
5285 <ul><li> item 0
5286 </li><li> item 1
5287 </li><li> item 2
5288 </li></ul>
5289 <ul><li> item 0
5290 </li><li> notSOL
5291 </li><li> item 1
5292 </li><li> item 2
5293 </li></ul>
5295 !! end
5297 !! test
5298 List interrupted by empty line or heading
5299 !! input
5300 * foo
5302 ** bar
5303 == A heading ==
5304 * Another list item
5305 !! result
5306 <ul><li> foo
5307 </li></ul>
5308 <ul><li><ul><li> bar
5309 </li></ul>
5310 </li></ul>
5311 <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>
5312 <ul><li> Another list item
5313 </li></ul>
5315 !!end
5317 !!test
5318 Multiple list tags generated by templates
5319 !!input
5320 {{echo|<li>}}a
5321 {{echo|<li>}}b
5322 {{echo|<li>}}c
5323 !!result
5324 <li>a
5325 <li>b
5326 <li>c</li>
5327 </li>
5328 </li>
5330 !!end
5332 !!test
5333 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
5334 !!input
5336 <!--This line will NOT split the list-->
5338  <!--This line will NOT split the list either-->
5340  <!--foo--> <!--This line with more than 1 comment will split the list-->
5342 !!result
5343 <ul><li>a
5344 </li><li>b
5345 </li><li>c
5346 </li></ul>
5347 <ul><li>d
5348 </li></ul>
5350 !!end
5352 !!test
5353 Test the li-hack
5354 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5355 !!options
5356 parsoid=wt2html,wt2wt
5357 !!input
5358 * foo
5359 * <li>li-hack
5360 * {{echo|<li>templated li-hack}}
5361 * <!--foo--> <li> unsupported li-hack with preceding comments
5363 <ul>
5364 <li><li>not a li-hack
5365 </li>
5366 </ul>
5367 !!result
5368 <ul><li> foo</li>
5369 <li>li-hack</li>
5370 <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>
5371 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5373 <ul>
5374 <li></li><li>not a li-hack
5375 </li>
5376 </ul>
5377 !!end
5379 !! test
5380 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5381 !! options
5382 parsoid
5383 !! input
5384 # foo
5385 ## bar
5386 * foo
5387 ** bar
5388 : foo
5389 :: bar
5390 !! result
5391 <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>
5392 !! end
5396 ### Magic Words
5399 !! test
5400 Magic Word: {{CURRENTDAY}}
5401 !! input
5402 {{CURRENTDAY}}
5403 !! result
5404 <p>1
5405 </p>
5406 !! end
5408 !! test
5409 Magic Word: {{CURRENTDAY2}}
5410 !! input
5411 {{CURRENTDAY2}}
5412 !! result
5413 <p>01
5414 </p>
5415 !! end
5417 !! test
5418 Magic Word: {{CURRENTDAYNAME}}
5419 !! input
5420 {{CURRENTDAYNAME}}
5421 !! result
5422 <p>Thursday
5423 </p>
5424 !! end
5426 !! test
5427 Magic Word: {{CURRENTDOW}}
5428 !! input
5429 {{CURRENTDOW}}
5430 !! result
5431 <p>4
5432 </p>
5433 !! end
5435 !! test
5436 Magic Word: {{CURRENTMONTH}}
5437 !! input
5438 {{CURRENTMONTH}}
5439 !! result
5440 <p>01
5441 </p>
5442 !! end
5444 !! test
5445 Magic Word: {{CURRENTMONTHABBREV}}
5446 !! input
5447 {{CURRENTMONTHABBREV}}
5448 !! result
5449 <p>Jan
5450 </p>
5451 !! end
5453 !! test
5454 Magic Word: {{CURRENTMONTHNAME}}
5455 !! input
5456 {{CURRENTMONTHNAME}}
5457 !! result
5458 <p>January
5459 </p>
5460 !! end
5462 !! test
5463 Magic Word: {{CURRENTMONTHNAMEGEN}}
5464 !! input
5465 {{CURRENTMONTHNAMEGEN}}
5466 !! result
5467 <p>January
5468 </p>
5469 !! end
5471 !! test
5472 Magic Word: {{CURRENTTIME}}
5473 !! input
5474 {{CURRENTTIME}}
5475 !! result
5476 <p>00:02
5477 </p>
5478 !! end
5480 !! test
5481 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5482 !! input
5483 {{CURRENTWEEK}}
5484 !! result
5485 <p>1
5486 </p>
5487 !! end
5489 !! test
5490 Magic Word: {{CURRENTYEAR}}
5491 !! input
5492 {{CURRENTYEAR}}
5493 !! result
5494 <p>1970
5495 </p>
5496 !! end
5498 !! test
5499 Magic Word: {{FULLPAGENAME}}
5500 !! options
5501 title=[[User:Ævar Arnfjörð Bjarmason]]
5502 !! input
5503 {{FULLPAGENAME}}
5504 !! result
5505 <p>User:Ævar Arnfjörð Bjarmason
5506 </p>
5507 !! end
5509 !! test
5510 Magic Word: {{FULLPAGENAMEE}}
5511 !! options
5512 title=[[User:Ævar Arnfjörð Bjarmason]]
5513 !! input
5514 {{FULLPAGENAMEE}}
5515 !! result
5516 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5517 </p>
5518 !! end
5520 !! test
5521 Magic Word: {{NAMESPACE}}
5522 !! options
5523 title=[[User:Ævar Arnfjörð Bjarmason]]
5524 !! input
5525 {{NAMESPACE}}
5526 !! result
5527 <p>User
5528 </p>
5529 !! end
5531 !! test
5532 Magic Word: {{NAMESPACEE}}
5533 !! options
5534 title=[[User:Ævar Arnfjörð Bjarmason]]
5535 !! input
5536 {{NAMESPACEE}}
5537 !! result
5538 <p>User
5539 </p>
5540 !! end
5542 !! test
5543 Magic Word: {{NAMESPACENUMBER}}
5544 !! options
5545 title=[[User:Ævar Arnfjörð Bjarmason]]
5546 !! input
5547 {{NAMESPACENUMBER}}
5548 !! result
5549 <p>2
5550 </p>
5551 !! end
5553 !! test
5554 Magic Word: {{NUMBEROFFILES}}
5555 !! input
5556 {{NUMBEROFFILES}}
5557 !! result
5558 <p>4
5559 </p>
5560 !! end
5562 !! test
5563 Magic Word: {{PAGENAME}}
5564 !! options
5565 title=[[User:Ævar Arnfjörð Bjarmason]]
5566 !! input
5567 {{PAGENAME}}
5568 !! result
5569 <p>Ævar Arnfjörð Bjarmason
5570 </p>
5571 !! end
5573 !! test
5574 Magic Word: {{PAGENAME}} with metacharacters
5575 !! options
5576 title=[['foo & bar = baz']]
5577 !! input
5578 ''{{PAGENAME}}''
5579 !! result
5580 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5581 </p>
5582 !! end
5584 !! test
5585 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5586 !! options
5587 title=[[*RFC 1234 http://example.com/]]
5588 !! input
5589 {{PAGENAME}}
5590 !! result
5591 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5592 </p>
5593 !! end
5595 !! test
5596 Magic Word: {{PAGENAMEE}}
5597 !! options
5598 title=[[User:Ævar Arnfjörð Bjarmason]]
5599 !! input
5600 {{PAGENAMEE}}
5601 !! result
5602 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5603 </p>
5604 !! end
5606 !! test
5607 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5608 !! options
5609 title=[[*RFC 1234 http://example.com/]]
5610 !! input
5611 {{PAGENAMEE}}
5612 !! result
5613 <p>&#42;RFC_1234_http&#58;//example.com/
5614 </p>
5615 !! end
5617 !! test
5618 Magic Word: {{REVISIONID}}
5619 !! input
5620 {{REVISIONID}}
5621 !! result
5622 <p>1337
5623 </p>
5624 !! end
5626 !! test
5627 Magic Word: {{SCRIPTPATH}}
5628 !! input
5629 {{SCRIPTPATH}}
5630 !! result
5631 <p>/
5632 </p>
5633 !! end
5635 !! test
5636 Magic Word: {{SERVER}}
5637 !! input
5638 {{SERVER}}
5639 !! result
5640 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5641 </p>
5642 !! end
5644 !! test
5645 Magic Word: {{SERVERNAME}}
5646 !! input
5647 {{SERVERNAME}}
5648 !! result
5649 <p>example.org
5650 </p>
5651 !! end
5653 !! test
5654 Magic Word: {{SITENAME}}
5655 !! input
5656 {{SITENAME}}
5657 !! result
5658 <p>MediaWiki
5659 </p>
5660 !! end
5662 !! test
5663 Case-sensitive magic words, when cased differently, should just be template transclusions
5664 !! input
5665 {{CurrentMonth}}
5666 {{currentday}}
5667 {{cURreNTweEK}}
5668 {{currentHour}}
5669 !! result
5670 <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>
5671 <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>
5672 <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>
5673 <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>
5674 </p>
5675 !! end
5677 !! test
5678 Case-insensitive magic words should still work with weird casing.
5679 !! input
5680 {{sErVeRNaMe}}
5681 {{LCFirst:AOEU}}
5682 {{ucFIRST:aoeu}}
5683 {{SERver}}
5684 !! result
5685 <p>example.org
5686 aOEU
5687 Aoeu
5688 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5689 </p>
5690 !! end
5692 !! test
5693 Namespace 1 {{ns:1}}
5694 !! input
5695 {{ns:1}}
5696 !! result
5697 <p>Talk
5698 </p>
5699 !! end
5701 !! test
5702 Namespace 1 {{ns:01}}
5703 !! input
5704 {{ns:01}}
5705 !! result
5706 <p>Talk
5707 </p>
5708 !! end
5710 !! test
5711 Namespace 0 {{ns:0}} (bug 4783)
5712 !! input
5713 {{ns:0}}
5714 !! result
5716 !! end
5718 !! test
5719 Namespace 0 {{ns:00}} (bug 4783)
5720 !! input
5721 {{ns:00}}
5722 !! result
5724 !! end
5726 !! test
5727 Namespace -1 {{ns:-1}}
5728 !! input
5729 {{ns:-1}}
5730 !! result
5731 <p>Special
5732 </p>
5733 !! end
5735 !! test
5736 Namespace User {{ns:User}}
5737 !! input
5738 {{ns:User}}
5739 !! result
5740 <p>User
5741 </p>
5742 !! end
5744 !! test
5745 Namespace User talk {{ns:User_talk}}
5746 !! input
5747 {{ns:User_talk}}
5748 !! result
5749 <p>User talk
5750 </p>
5751 !! end
5753 !! test
5754 Namespace User talk {{ns:uSeR tAlK}}
5755 !! input
5756 {{ns:uSeR tAlK}}
5757 !! result
5758 <p>User talk
5759 </p>
5760 !! end
5762 !! test
5763 Namespace File {{ns:File}}
5764 !! input
5765 {{ns:File}}
5766 !! result
5767 <p>File
5768 </p>
5769 !! end
5771 !! test
5772 Namespace File {{ns:Image}}
5773 !! input
5774 {{ns:Image}}
5775 !! result
5776 <p>File
5777 </p>
5778 !! end
5780 !! test
5781 Namespace (lang=de) Benutzer {{ns:User}}
5782 !! options
5783 language=de
5784 !! input
5785 {{ns:User}}
5786 !! result
5787 <p>Benutzer
5788 </p>
5789 !! end
5791 !! test
5792 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5793 !! options
5794 language=de
5795 !! input
5796 {{ns:3}}
5797 !! result
5798 <p>Benutzer Diskussion
5799 </p>
5800 !! end
5803 !! test
5804 Urlencode
5805 !! input
5806 {{urlencode:hi world?!}}
5807 {{urlencode:hi world?!|WIKI}}
5808 {{urlencode:hi world?!|PATH}}
5809 {{urlencode:hi world?!|QUERY}}
5810 !! result
5811 <p>hi+world%3F%21
5812 hi_world%3F!
5813 hi%20world%3F%21
5814 hi+world%3F%21
5815 </p>
5816 !! end
5819 ### Magic links
5821 !! test
5822 Magic links: internal link to RFC (bug 479)
5823 !! input
5824 [[RFC 123]]
5825 !! result
5826 <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>
5827 </p>
5828 !! end
5830 !! test
5831 Magic links: RFC (bug 479)
5832 !! input
5833 RFC 822
5834 !! result
5835 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5836 </p>
5837 !! end
5839 !! test
5840 Magic links: ISBN (bug 1937)
5841 !! input
5842 ISBN 0-306-40615-2
5843 !! result
5844 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5845 </p>
5846 !! end
5848 !! test
5849 Magic links: PMID incorrectly converts space to underscore
5850 !! input
5851 PMID 1234
5852 !! result
5853 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5854 </p>
5855 !! end
5858 ### Templates
5859 ####
5861 !! test
5862 Nonexistent template
5863 !! input
5864 {{thistemplatedoesnotexist}}
5865 !! result
5866 <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>
5867 </p>
5868 !! end
5870 !! test
5871 Template with invalid target containing tags
5872 !! input
5873 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5874 !! result
5875 <p>{{a<b>b</b>|foo|a=b|a = b}}
5876 </p>
5877 !! end
5879 !! test
5880 Template with invalid target containing unclosed tag
5881 !! input
5882 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5883 !! result
5884 <p>{{a<b>|foo|a=b|a = b}}</b>
5885 </p>
5886 !! end
5888 !! article
5889 Template:test
5890 !! text
5891 This is a test template
5892 !! endarticle
5894 !! test
5895 Simple template
5896 !! input
5897 {{test}}
5898 !! result
5899 <p>This is a test template
5900 </p>
5901 !! end
5903 !! test
5904 Template with explicit namespace
5905 !! input
5906 {{Template:test}}
5907 !! result
5908 <p>This is a test template
5909 </p>
5910 !! end
5913 !! article
5914 Template:paramtest
5915 !! text
5916 This is a test template with parameter {{{param}}}
5917 !! endarticle
5919 !! test
5920 Template parameter
5921 !! input
5922 {{paramtest|param=foo}}
5923 !! result
5924 <p>This is a test template with parameter foo
5925 </p>
5926 !! end
5928 !! article
5929 Template:paramtestnum
5930 !! text
5931 [[{{{1}}}|{{{2}}}]]
5932 !! endarticle
5934 !! test
5935 Template unnamed parameter
5936 !! input
5937 {{paramtestnum|Main Page|the main page}}
5938 !! result
5939 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5940 </p>
5941 !! end
5943 !! article
5944 Template:templatesimple
5945 !! text
5946 (test)
5947 !! endarticle
5949 !! article
5950 Template:templateredirect
5951 !! text
5952 #redirect [[Template:templatesimple]]
5953 !! endarticle
5955 !! article
5956 Template:templateasargtestnum
5957 !! text
5958 {{{{{1}}}}}
5959 !! endarticle
5961 !! article
5962 Template:templateasargtest
5963 !! text
5964 {{template{{{templ}}}}}
5965 !! endarticle
5967 !! article
5968 Template:templateasargtest2
5969 !! text
5970 {{{{{templ}}}}}
5971 !! endarticle
5973 !! test
5974 Template with template name as unnamed argument
5975 !! input
5976 {{templateasargtestnum|templatesimple}}
5977 !! result
5978 <p>(test)
5979 </p>
5980 !! end
5982 !! test
5983 Template with template name as argument
5984 !! input
5985 {{templateasargtest|templ=simple}}
5986 !! result
5987 <p>(test)
5988 </p>
5989 !! end
5991 !! test
5992 Template with template name as argument (2)
5993 !! input
5994 {{templateasargtest2|templ=templatesimple}}
5995 !! result
5996 <p>(test)
5997 </p>
5998 !! end
6000 !! article
6001 Template:templateasargtestdefault
6002 !! text
6003 {{{{{templ|templatesimple}}}}}
6004 !! endarticle
6006 !! article
6007 Template:templa
6008 !! text
6009 '''templ'''
6010 !! endarticle
6012 !! test
6013 Template with default value
6014 !! input
6015 {{templateasargtestdefault}}
6016 !! result
6017 <p>(test)
6018 </p>
6019 !! end
6021 !! test
6022 Template with default value (value set)
6023 !! input
6024 {{templateasargtestdefault|templ=templa}}
6025 !! result
6026 <p><b>templ</b>
6027 </p>
6028 !! end
6030 !! test
6031 Template redirect
6032 !! input
6033 {{templateredirect}}
6034 !! result
6035 <p>(test)
6036 </p>
6037 !! end
6039 !! test
6040 Template with argument in separate line
6041 !! input
6042 {{ templateasargtest  |
6043  templ = simple }}
6044 !! result
6045 <p>(test)
6046 </p>
6047 !! end
6049 !! test
6050 Template with complex template as argument
6051 !! input
6052 {{paramtest|
6053   param ={{ templateasargtest  |
6054  templ = simple }}}}
6055 !! result
6056 <p>This is a test template with parameter (test)
6057 </p>
6058 !! end
6060 !! test
6061 Template with thumb image (with link in description)
6062 !! input
6063 {{paramtest|
6064   param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6065 !! result
6066 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>
6068 !! end
6070 !! article
6071 Template:complextemplate
6072 !! text
6073 {{{1}}} {{paramtest|
6074   param ={{{param}}}}}
6075 !! endarticle
6077 !! test
6078 Template with complex arguments
6079 !! input
6080 {{complextemplate|
6081   param ={{ templateasargtest  |
6082  templ = simple }}|[[Template:complextemplate|link]]}}
6083 !! result
6084 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6085 </p>
6086 !! end
6088 !! test
6089 BUG 553: link with two variables in a piped link
6090 !! input
6092 |[[{{{1}}}|{{{2}}}]]
6094 !! result
6095 <table>
6096 <tr>
6097 <td>[[{{{1}}}|{{{2}}}]]
6098 </td></tr></table>
6100 !! end
6102 !! test
6103 Magic variable as template parameter
6104 !! input
6105 {{paramtest|param={{SITENAME}}}}
6106 !! result
6107 <p>This is a test template with parameter MediaWiki
6108 </p>
6109 !! end
6111 !! article
6112 Template:linktest
6113 !! text
6114 [[{{{param}}}|link]]
6115 !! endarticle
6117 !! test
6118 Template parameter as link source
6119 !! input
6120 {{linktest|param=Main Page}}
6121 !! result
6122 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
6123 </p>
6124 !! end
6126 !!test
6127 Template-generated attribute string (k='v')
6128 !!input
6129 <span {{attr_str|id|v1}}>bar</span>
6130 !!result
6131 <p><span id="v1">bar</span>
6132 </p>
6133 !!end
6135 !!article
6136 Template:paramtest2
6137 !! text
6138 including another template, {{paramtest|param={{{arg}}}}}
6139 !! endarticle
6141 !! test
6142 Template passing argument to another template
6143 !! input
6144 {{paramtest2|arg='hmm'}}
6145 !! result
6146 <p>including another template, This is a test template with parameter 'hmm'
6147 </p>
6148 !! end
6150 !! article
6151 Template:Linktest2
6152 !! text
6153 Main Page
6154 !! endarticle
6156 !! test
6157 Template as link source
6158 !! input
6159 [[{{linktest2}}]]
6161 [[{{linktest2}}|Main Page]]
6163 [[{{linktest2}}]]Page
6164 !! result
6165 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6166 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6167 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
6168 </p>
6169 !! end
6172 !! article
6173 Template:loop1
6174 !! text
6175 {{loop2}}
6176 !! endarticle
6178 !! article
6179 Template:loop2
6180 !! text
6181 {{loop1}}
6182 !! endarticle
6184 !! test
6185 Template infinite loop
6186 !! input
6187 {{loop1}}
6188 !! result
6189 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
6190 </p>
6191 !! end
6193 !! test
6194 Template from main namespace
6195 !! input
6196 {{:Main Page}}
6197 !! result
6198 <p>blah blah
6199 </p>
6200 !! end
6202 !! article
6203 Template:table
6204 !! text
6206 | 1 || 2
6208 | 3 || 4
6210 !! endarticle
6212 !! test
6213 BUG 529: Template with table, not included at beginning of line
6214 !! input
6215 foo {{table}}
6216 !! result
6217 <p>foo 
6218 </p>
6219 <table>
6220 <tr>
6221 <td> 1 </td>
6222 <td> 2
6223 </td></tr>
6224 <tr>
6225 <td> 3 </td>
6226 <td> 4
6227 </td></tr></table>
6229 !! end
6231 !! test
6232 BUG 523: Template shouldn't eat newline (or add an extra one before table)
6233 !! input
6235 {{table}}
6236 !! result
6237 <p>foo
6238 </p>
6239 <table>
6240 <tr>
6241 <td> 1 </td>
6242 <td> 2
6243 </td></tr>
6244 <tr>
6245 <td> 3 </td>
6246 <td> 4
6247 </td></tr></table>
6249 !! end
6251 !! test
6252 BUG 41: Template parameters shown as broken links
6253 !! input
6254 {{{parameter}}}
6255 !! result
6256 <p>{{{parameter}}}
6257 </p>
6258 !! end
6260 !! test
6261 Template with targets containing wikilinks
6262 !! input
6263 {{[[foo]]}}
6265 {{[[{{echo|foo}}]]}}
6267 {{{{echo|[[foo}}]]}}
6268 !! result
6269 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6270 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6271 </p><p>{{[[foo}}]]
6272 </p>
6273 !! end
6275 !! article
6276 Template:MSGNW test
6277 !! text
6278 ''None'' of '''this''' should be 
6279 * interpreted
6280  but rather passed unmodified
6281 {{test}}
6282 !! endarticle
6284 # hmm, fix this or just deprecate msgnw and document its behavior?
6285 !! test
6286 msgnw keyword
6287 !! options
6288 disabled
6289 !! input
6290 {{msgnw:MSGNW test}}
6291 !! result
6292 <p>''None'' of '''this''' should be 
6293 * interpreted
6294  but rather passed unmodified
6295 {{test}}
6296 </p>
6297 !! end
6299 !! test
6300 int keyword
6301 !! input
6302 {{int:youhavenewmessages|lots of money|not!}}
6303 !! result
6304 <p>You have lots of money (not!).
6305 </p>
6306 !! end
6308 !! article
6309 Template:Includes
6310 !! text
6311 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6312 !! endarticle
6314 !! test
6315 <includeonly> and <noinclude> being included
6316 !! input
6317 {{Includes}}
6318 !! result
6319 <p>Foobar
6320 </p>
6321 !! end
6323 !! article
6324 Template:Includes2
6325 !! text
6326 <onlyinclude>Foo</onlyinclude>bar
6327 !! endarticle
6329 !! test
6330 <onlyinclude> being included
6331 !! input
6332 {{Includes2}}
6333 !! result
6334 <p>Foo
6335 </p>
6336 !! end
6339 !! article
6340 Template:Includes3
6341 !! text
6342 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6343 !! endarticle
6345 !! test
6346 <onlyinclude> and <includeonly> being included
6347 !! input
6348 {{Includes3}}
6349 !! result
6350 <p>Foo
6351 </p>
6352 !! end
6354 !! test
6355 <includeonly> and <noinclude> on a page
6356 !! input
6357 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6358 !! result
6359 <p>Foozar
6360 </p>
6361 !! end
6363 !! test
6364 Un-closed <noinclude>
6365 !! input
6366 <noinclude>
6367 !! result
6368 !! end
6370 !! test
6371 <onlyinclude> on a page
6372 !! input
6373 <onlyinclude>Foo</onlyinclude>bar
6374 !! result
6375 <p>Foobar
6376 </p>
6377 !! end
6379 !! test
6380 Un-closed <onlyinclude>
6381 !! input
6382 <onlyinclude>
6383 !! result
6384 !! end
6386 !!test
6387 Self-closed noinclude, includeonly, onlyinclude tags
6388 !!input
6389 <noinclude />
6390 <includeonly />
6391 <onlyinclude />
6392 !!result
6393 <p><br />
6394 </p>
6395 !!end
6397 !!test
6398 Unbalanced includeonly and noinclude tags
6399 !!input
6401 |a</noinclude>
6402 |b</noinclude></noinclude>
6403 |c</noinclude></includeonly>
6404 |d</includeonly></includeonly>
6406 !!result
6407 <table>
6408 <tr>
6409 <td>a
6410 </td>
6411 <td>b
6412 </td>
6413 <td>c&lt;/includeonly&gt;
6414 </td>
6415 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6416 </td></tr></table>
6418 !!end
6420 !! article
6421 Template:Includeonly section
6422 !! text
6423 <includeonly>
6424 ==Includeonly section==
6425 </includeonly>
6426 ==Section T-1==
6427 !!endarticle
6429 !! test
6430 Bug 6563: Edit link generation for section shown by <includeonly>
6431 !! input
6432 {{includeonly section}}
6433 !! result
6434 <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>
6435 <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>
6437 !! end
6439 # Uses same input as the contents of [[Template:Includeonly section]]
6440 !! test
6441 Bug 6563: Section extraction for section shown by <includeonly>
6442 !! options
6443 section=T-2
6444 !! input
6445 <includeonly>
6446 ==Includeonly section==
6447 </includeonly>
6448 ==Section T-2==
6449 !! result
6450 ==Section T-2==
6451 !! end
6453 !! test
6454 Bug 6563: Edit link generation for section suppressed by <includeonly>
6455 !! input
6456 <includeonly>
6457 ==Includeonly section==
6458 </includeonly>
6459 ==Section 1==
6460 !! result
6461 <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>
6463 !! end
6465 !! test
6466 Bug 6563: Section extraction for section suppressed by <includeonly>
6467 !! options
6468 section=1
6469 !! input
6470 <includeonly>
6471 ==Includeonly section==
6472 </includeonly>
6473 ==Section 1==
6474 !! result
6475 ==Section 1==
6476 !! end
6478 !! test
6479 Un-closed <includeonly>
6480 !! input
6481 <includeonly>
6482 !! result
6483 !! end
6486 ### <includeonly> and <noinclude> in attributes
6488 !!test
6489 0. includeonly around the entire attribute
6490 !!input
6491 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6492 !!result
6493 <p><span id="v2">bar</span>
6494 </p>
6495 !!end
6497 !!test
6498 1. includeonly in html attr key
6499 !!input
6500 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6501 !!result
6502 <p><span id="foo">bar</span>
6503 </p>
6504 !!end
6506 !!test
6507 2. includeonly in html attr value
6508 !!input
6509 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6510 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6511 !!result
6512 <p><span id="v1">bar</span>
6513 <span id="v1">bar</span>
6514 </p>
6515 !!end
6517 !!test
6518 3. includeonly in part of an attr value
6519 !!input
6520 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6521 !!result
6522 <p><span style="color:red;">bar</span>
6523 </p>
6524 !!end
6527 ### Testing parsing of templates where a template arg
6528 ### has the same name as the template itself.
6531 !! article
6532 Template:quote
6533 !! text
6534 {{{quote|{{{1}}}}}}
6535 !! endarticle
6537 !!test
6538 Templates: Template Name/Arg clash: 1. Use of positional param
6539 !!input
6540 {{quote|foo}}
6541 !!result
6542 <p>foo
6543 </p>
6544 !!end
6546 !!test
6547 Templates: Template Name/Arg clash: 2. Use of named param
6548 !!input
6549 {{quote|quote=foo}}
6550 !!result
6551 <p>foo
6552 </p>
6553 !!end
6555 !!test
6556 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6557 !!input
6558 {{quote|quote}}
6559 !!result
6560 <p>quote
6561 </p>
6562 !!end
6565 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6568 !!test
6569 Templates: 1. Simple use
6570 !!input
6571 {{echo|Foo}}
6572 !!result
6573 <p>Foo
6574 </p>
6575 !!end
6577 !!test
6578 Templates: 2. Inside a block tag
6579 !!input
6580 <div>{{echo|Foo}}</div>
6581 !!result
6582 <div>Foo</div>
6584 !!end
6586 !!test
6587 Templates: P-wrapping: 1a. Templates on consecutive lines
6588 !!input
6589 {{echo|Foo}}
6590 {{echo|bar}}
6591 !!result
6592 <p>Foo
6594 </p>
6595 !!end
6597 !!test
6598 Templates: P-wrapping: 1b. Templates on consecutive lines
6599 !!input
6602 {{echo|bar}}
6603 {{echo|baz}}
6604 !!result
6605 <p>Foo
6606 </p><p>bar
6608 </p>
6609 !!end
6611 !!test
6612 Templates: P-wrapping: 1c. Templates on consecutive lines
6613 !!input
6614 {{echo|Foo}}
6615 {{echo|bar}} <div>baz</div>
6616 !!result
6617 <p>Foo
6618 </p>
6619 bar <div>baz</div>
6621 !!end
6623 !!test
6624 Templates: P-wrapping: 1d. Template preceded by comment-only line
6625 !!options
6626 parsoid=wt2html,wt2wt
6627 !!input
6628 <!-- foo -->
6629 {{echo|Bar}}
6630 !!result
6631 <!-- foo -->
6632 <p typeof="mw:Transclusion">Bar
6633 </p>
6634 !!end
6636 !!test
6637 Templates: Inline Text: 1. Multiple tmeplate uses
6638 !!input
6639 {{echo|Foo}}bar{{echo|baz}}
6640 !!result
6641 <p>Foobarbaz
6642 </p>
6643 !!end
6645 !!test
6646 Templates: Inline Text: 2. Back-to-back template uses
6647 !!input
6648 {{echo|Foo}}{{echo|bar}}
6649 !!result
6650 <p>Foobar
6651 </p>
6652 !!end
6654 !!test
6655 Templates: Block Tags: 1. Multiple template uses
6656 !!input
6657 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6658 !!result
6659 <div>Foo</div><div>bar</div><div>baz</div>
6661 !!end
6663 !!test
6664 Templates: Block Tags: 2. Back-to-back template uses
6665 !!input
6666 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6667 !!result
6668 <div>Foo</div><div>bar</div>
6670 !!end
6672 !!test
6673 Templates: Links: 1. Simple example
6674 !!input
6675 {{echo|[[Foo|bar]]}}
6676 !!result
6677 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6678 </p>
6679 !!end
6681 !!test
6682 Templates: Links: 2. Generation of link href
6683 !!input
6684 [[{{echo|Foo}}|bar]]
6685 !!result
6686 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6687 </p>
6688 !!end
6690 !!test
6691 Templates: Links: 3. Generation of part of a link href
6692 !!input
6693 [[Fo{{echo|o}}|bar]]
6695 [[Foo{{echo|bar}}]]
6697 [[Foo{{echo|bar}}baz]]
6699 [[Foo{{echo|bar}}|bar]]
6701 [[:Foo{{echo|bar}}]]
6703 [[:Foo{{echo|bar}}|bar]]
6704 !!result
6705 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6706 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6707 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6708 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6709 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6710 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6711 </p>
6712 !!end
6714 !!test
6715 Templates: Links: 4. Multiple templates generating link href
6716 !!input
6717 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6718 !!result
6719 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6720 </p>
6721 !!end
6723 !!test
6724 Templates: Links: 5. Generation of link text
6725 !!input
6726 [[Foo|{{echo|bar}}]]
6727 !!result
6728 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6729 </p>
6730 !!end
6732 !!test
6733 Templates: Links: 5. Nested templates (only outermost template should be marked)
6734 !!input
6735 {{echo|[[{{echo|Foo}}|bar]]}}
6736 !!result
6737 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6738 </p>
6739 !!end
6741 !!test
6742 Templates: HTML Tag: 1. Generation of HTML attr. key
6743 !!input
6744 <div {{echo|style}}="color:red;">foo</div>
6745 !!result
6746 <div style="color:red;">foo</div>
6748 !!end
6750 !!test
6751 Templates: HTML Tag: 2. Generation of HTML attr. value
6752 !!input
6753 <div style={{echo|'color:red;'}}>foo</div>
6754 !!result
6755 <div style="color:red;">foo</div>
6757 !!end
6759 !!test
6760 Templates: HTML Tag: 3. Generation of HTML attr key and value
6761 !!input
6762 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6763 !!result
6764 <div style="color:red;">foo</div>
6766 !!end
6768 !!test
6769 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6770 !!input
6771 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6772 !!result
6773 <div title="This is a long title with just one piece templated">foo</div>
6775 !!end
6777 !!test
6778 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6779 !!input
6780 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6781 !!result
6782 <div title="This is a long title with just one piece templated">foo</div>
6784 !!end
6786 !!test
6787 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6788 !!input
6789 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6790 !!result
6791 <div title="This is a long title with just one piece templated">foo</div>
6793 !!end
6795 !!test
6796 Templates: HTML Tag: 7. Generation of partial attribute key string
6797 !!input
6798 <div st{{echo|yle}}="color:red;">foo</div>
6799 !!result
6800 <div style="color:red;">foo</div>
6802 !!end
6804 !!test
6805 Templates: HTML Tables: 1. Generating start of a HTML table
6806 !!input
6807 {{echo|<table><tr><td>foo</td>}}</tr></table>
6808 !!result
6809 <table><tr><td>foo</td></tr></table>
6811 !!end
6813 !!test
6814 Templates: HTML Tables: 2a. Generating middle of a HTML table
6815 !!input
6816 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6817 !!result
6818 <table><tr><td>foo</td></tr></table>
6820 !!end
6822 !!test
6823 Templates: HTML Tables: 2b. Generating middle of a HTML table
6824 !!input
6825 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6826 !!result
6827 <table><tr><td>foo</td></tr></table>
6829 !!end
6831 !!test
6832 Templates: HTML Tables: 3. Generating end of a HTML table
6833 !!input
6834 <table><tr>{{echo|<td>foo</td></tr></table>}}
6835 !!result
6836 <table><tr><td>foo</td></tr></table>
6838 !!end
6840 !!test
6841 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6842 !!input
6843 {{echo|<table>}}<tr><td>foo</td></tr></table>
6844 !!result
6845 <table><tr><td>foo</td></tr></table>
6847 !!end
6849 !!test
6850 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6851 !!input
6852 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6853 !!result
6854 <table><tr><td>foo</td></tr></table>
6856 !!end
6858 !!test
6859 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6860 !!input
6861 <table><tr>{{echo|<td>}}foo</td></tr></table>
6862 !!result
6863 <table><tr><td>foo</td></tr></table>
6865 !!end
6867 !!test
6868 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6869 !!input
6870 <table><tr><td>foo{{echo|</td>}}</tr></table>
6871 !!result
6872 <table><tr><td>foo</td></tr></table>
6874 !!end
6876 !!test
6877 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6878 !!input
6879 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6880 !!result
6881 <table><tr><td>foo</td></tr></table>
6883 !!end
6885 !!test
6886 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6887 !!input
6888 <table><tr><td>foo</td></tr>{{echo|</table>}}
6889 !!result
6890 <table><tr><td>foo</td></tr></table>
6892 !!end
6894 !!test
6895 Templates: HTML Tables: 5. Proper fostering of categories from inside
6896 !!options
6897 parsoid=wt2html,wt2wt
6898 !!input
6899 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
6900 <!--Two categories (Bug 50330)-->
6901 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
6902 !!result
6903 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
6904 <!--Two categories (Bug 50330)-->
6905 <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>
6906 !!end
6908 !!test
6909 Templates: Wiki Tables: 1a. Fostering of entire template content
6910 !!input
6912 {{echo|a}}
6914 !!result
6915 <table>
6917 <tr><td></td></tr></table>
6919 !!end
6921 !!test
6922 Templates: Wiki Tables: 1b. Fostering of entire template content
6923 !!input
6925 {{echo|<div>}}
6927 {{echo|</div>}}
6929 !!result
6930 <table>
6931 <div>
6932 <p>foo
6933 </p>
6934 </div>
6935 <tr><td></td></tr></table>
6937 !!end
6939 !!test
6940 Templates: Wiki Tables: 2. Fostering of partial template content
6941 !!input
6943 {{echo|a
6944 <div>b</div>}}
6946 !!result
6947 <table>
6949 <div>b</div>
6950 <tr><td></td></tr></table>
6952 !!end
6954 !!test
6955 Templates: Wiki Tables: 3. td-content via multiple templates
6956 !!input
6958 {{echo|{{pipe}}a}}{{echo|b}}
6960 !!result
6961 <table>
6962 <tr>
6963 <td>ab
6964 </td></tr></table>
6966 !!end
6968 !!test
6969 Templates: Wiki Tables: 4. Templated tags, no content
6970 !!input
6971 {{tbl-start}}
6972 {{tbl-end}}
6973 !!result
6974 <table>
6975 <tr><td></td></tr></table>
6977 !!end
6979 !!test
6980 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6981 !!input
6982 {{tbl-start}}
6983 |foo
6984 {{tbl-end}}
6985 !!result
6986 <table>
6987 <tr>
6988 <td>foo
6989 </td></tr></table>
6991 !!end
6993 !!test
6994 Templates: Wiki Tables: 6. Templated tags, templated td-tags
6995 !!input
6996 {{tbl-start}}
6997 {{!}}foo
6998 {{tbl-end}}
6999 !!result
7000 <table>
7001 <tr>
7002 <td>foo
7003 </td></tr></table>
7005 !!end
7007 !!test
7008 Templates: Lists: Multi-line list-items via templates
7009 !!input
7010 *{{echo|a {{nonexistent|
7011 unused}}}}
7012 *{{echo|b {{nonexistent|
7013 unused}}}}
7014 !!result
7015 <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>
7016 </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>
7017 </li></ul>
7019 !!end
7021 !!test
7022 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
7023 !!input
7024 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
7025 !!result
7026 <p><i>ab</i>c<i>d</i>e
7027 </p>
7028 !!end
7030 !!test
7031 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7032 (PHP parser generates misnested html)
7033 !! options
7034 parsoid=wt2html,wt2wt
7035 !!input
7036 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
7037 !!result
7038 <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>
7039 !!end
7041 !!test
7042 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
7043 (PHP parser generates misnested html)
7044 !! options
7045 parsoid=wt2html,wt2wt
7046 !!input
7047 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
7048 !!result
7049 <div typeof="mw:Transclusion"><i>a</i></div>
7050 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
7051 <div typeof="mw:Transclusion">e</div>
7052 !!end
7054 !!test
7055 Templates: Ugly nesting: 4. Divs opened/closed across templates
7056 !!input
7057 a<div>b{{echo|c</div>d}}e
7058 !!result
7059 a<div>bc</div>de
7061 !!end
7063 !!test
7064 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
7065 (Parsoid-centric)
7066 !! options
7067 parsoid
7068 !!input
7070 |{{echo|foo</table>}}
7071 |bar
7073 !!result
7074 <table typeof="mw:Transclusion">
7075 <tbody>
7076 <tr>
7077 <td>foo</td></tr></tbody></table><span>bar</span>
7078 !!end
7080 !!test
7081 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
7082 (Parsoid-centric)
7083 !! options
7084 parsoid
7085 !!input
7086 <table>
7087   <tr>
7088     <td>
7089     <table>
7090       <tr>
7091         <td>1. {{echo|foo </table>}}</td>
7092         <td> bar </td>
7093         <td>2. {{echo|baz </table>}}</td>
7094       </tr>
7095       <tr>
7096         <td>abc</td>
7097       </tr>
7098     </table>
7099     </td>
7100   </tr>
7101   <tr>
7102     <td>xyz</td>
7103   </tr>
7104 </table>
7105 !!result
7106 <table  about="#mwt1" typeof="mw:Transclusion">
7107   <tbody><tr >
7108     <td >
7109     <table >
7110       <tbody><tr >
7111         <td >1. foo </td></tr></tbody></table></td>
7112         <td > bar </td>
7113         <td >2. baz </td></tr></tbody></table><span about="#mwt1">
7114       </span><span about="#mwt1">
7115       
7116         abc</span><span about="#mwt1">
7117       </span><span about="#mwt1">
7118     </span><span about="#mwt1">
7119     </span><span about="#mwt1">
7120   </span><span about="#mwt1">
7121   
7122     xyz</span><span about="#mwt1">
7123   </span><span about="#mwt1">
7124 </span>
7125 !!end
7127 !! test
7128 Templates: Ugly templates: 3. newline-only template parameter
7129 !! input
7130 foo {{echo|
7132 !! result
7133 <p>foo 
7134 </p>
7135 !! end
7137 # This looks like a bug: a single newline triggers p/br for some reason.
7138 !! test
7139 Templates: Ugly templates: 4. newline-only template parameter inconsistency
7140 !! input
7141 {{echo|
7143 !! result
7144 <p><br />
7145 </p>
7146 !! end
7149 !!test
7150 Parser Functions: 1. Simple example
7151 !!input
7152 {{uc:foo}}
7153 !!result
7154 <p>FOO
7155 </p>
7156 !!end
7158 !!test
7159 Parser Functions: 2. Nested use (only outermost should be marked up)
7160 !!input
7161 {{uc:{{lc:FOO}}}}
7162 !!result
7163 <p>FOO
7164 </p>
7165 !!end
7168 ### Pre-save transform tests
7170 !! test
7171 pre-save transform: subst:
7172 !! options
7174 !! input
7175 {{subst:test}}
7176 !! result
7177 This is a test template
7178 !! end
7180 !! test
7181 pre-save transform: normal template
7182 !! options
7184 !! input
7185 {{test}}
7186 !! result
7187 {{test}}
7188 !! end
7190 !! test
7191 pre-save transform: nonexistent template
7192 !! options
7194 !! input
7195 {{thistemplatedoesnotexist}}
7196 !! result
7197 {{thistemplatedoesnotexist}}
7198 !! end
7201 !! test
7202 pre-save transform: subst magic variables
7203 !! options
7205 !! input
7206 {{subst:SITENAME}}
7207 !! result
7208 MediaWiki
7209 !! end
7211 # This is bug 89, which I fixed. -- wtm
7212 !! test
7213 pre-save transform: subst: templates with parameters
7214 !! options
7216 !! input
7217 {{subst:paramtest|param="something else"}}
7218 !! result
7219 This is a test template with parameter "something else"
7220 !! end
7222 !! article
7223 Template:nowikitest
7224 !! text
7225 <nowiki>'''not wiki'''</nowiki>
7226 !! endarticle
7228 !! test
7229 pre-save transform: nowiki in subst (bug 1188)
7230 !! options
7232 !! input
7233 {{subst:nowikitest}}
7234 !! result
7235 <nowiki>'''not wiki'''</nowiki>
7236 !! end
7239 !! article
7240 Template:commenttest
7241 !! text
7242 This template has <!-- a comment --> in it.
7243 !! endarticle
7245 !! test
7246 pre-save transform: comment in subst (bug 1936)
7247 !! options
7249 !! input
7250 {{subst:commenttest}}
7251 !! result
7252 This template has <!-- a comment --> in it.
7253 !! end
7255 !! test
7256 pre-save transform: unclosed tag
7257 !! options
7258 pst noxml
7259 !! input
7260 <nowiki>'''not wiki'''
7261 !! result
7262 <nowiki>'''not wiki'''
7263 !! end
7265 !! test
7266 pre-save transform: mixed tag case
7267 !! options
7268 pst noxml
7269 !! input
7270 <NOwiki>'''not wiki'''</noWIKI>
7271 !! result
7272 <NOwiki>'''not wiki'''</noWIKI>
7273 !! end
7275 !! test
7276 pre-save transform: unclosed comment in <nowiki>
7277 !! options
7278 pst noxml
7279 !! input
7280 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7281 !! result
7282 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7283 !!end
7285 # Leading @ in this template definition works around a limitation
7286 # in parsoid's parserTests which otherwise strips the <span> from the
7287 # result (confusing it for a template wrapper)
7288 !! article
7289 Template:dangerous
7290 !!text
7291 @<span onmouseover="alert('crap')">Oh no</span>
7292 !!endarticle
7294 !!test
7295 (confirming safety of fix for subst bug 1936)
7296 !! input
7297 {{Template:dangerous}}
7298 !! result
7299 <p>@<span>Oh no</span>
7300 </p>
7301 !! end
7303 !! test
7304 pre-save transform: comment containing gallery (bug 5024)
7305 !! options
7307 !! input
7308 <!-- <gallery>data</gallery> -->
7309 !!result
7310 <!-- <gallery>data</gallery> -->
7311 !!end
7313 !! test
7314 pre-save transform: comment containing extension
7315 !! options
7317 !! input
7318 <!-- <tag>data</tag> -->
7319 !!result
7320 <!-- <tag>data</tag> -->
7321 !!end
7323 !! test
7324 pre-save transform: comment containing nowiki
7325 !! options
7327 !! input
7328 <!-- <nowiki>data</nowiki> -->
7329 !!result
7330 <!-- <nowiki>data</nowiki> -->
7331 !!end
7333 !! test
7334 pre-save transform: <noinclude> in subst (bug 3298)
7335 !! options
7337 !! input
7338 {{subst:Includes}}
7339 !! result
7340 Foobar
7341 !! end
7343 !! test
7344 pre-save transform: <onlyinclude> in subst (bug 3298)
7345 !! options
7347 !! input
7348 {{subst:Includes2}}
7349 !! result
7351 !! end
7353 !! article
7354 Template:SubstTest
7355 !!text
7356 {{<includeonly>subst:</includeonly>Includes}}
7357 !! endarticle
7359 !! article
7360 Template:SafeSubstTest
7361 !! text
7362 {{<includeonly>safesubst:</includeonly>Includes}}
7363 !! endarticle
7365 !! test
7366 bug 22297: safesubst: works during PST
7367 !! options
7369 !! input
7370 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
7371 !! result
7372 FoobarFoobar
7373 !! end
7375 !! test
7376 bug 22297: safesubst: works during normal parse
7377 !! input
7378 {{SafeSubstTest}}
7379 !! result
7380 <p>Foobar
7381 </p>
7382 !! end
7384 !! test:
7385 subst: does not work during normal parse
7386 !! input
7387 {{SubstTest}}
7388 !! result
7389 <p>{{subst:Includes}}
7390 </p>
7391 !! end
7393 !! test
7394 pre-save transform: context links ("pipe trick")
7395 !! options
7397 !! input
7398 [[Article (context)|]]
7399 [[Bar:Article|]]
7400 [[:Bar:Article|]]
7401 [[Bar:Article (context)|]]
7402 [[:Bar:Article (context)|]]
7403 [[|Article]]
7404 [[|Article (context)]]
7405 [[Bar:X (Y) Z|]]
7406 [[:Bar:X (Y) Z|]]
7407 !! result
7408 [[Article (context)|Article]]
7409 [[Bar:Article|Article]]
7410 [[:Bar:Article|Article]]
7411 [[Bar:Article (context)|Article]]
7412 [[:Bar:Article (context)|Article]]
7413 [[Article]]
7414 [[Article (context)]]
7415 [[Bar:X (Y) Z|X (Y) Z]]
7416 [[:Bar:X (Y) Z|X (Y) Z]]
7417 !! end
7419 !! test
7420 pre-save transform: context links ("pipe trick") with interwiki prefix
7421 !! options
7423 !! input
7424 [[interwiki:Article|]]
7425 [[:interwiki:Article|]]
7426 [[interwiki:Bar:Article|]]
7427 [[:interwiki:Bar:Article|]]
7428 !! result
7429 [[interwiki:Article|Article]]
7430 [[:interwiki:Article|Article]]
7431 [[interwiki:Bar:Article|Bar:Article]]
7432 [[:interwiki:Bar:Article|Bar:Article]]
7433 !! end
7435 !! test
7436 pre-save transform: context links ("pipe trick") with parens in title
7437 !! options
7438 pst title=[[Somearticle (context)]]
7439 !! input
7440 [[|Article]]
7441 !! result
7442 [[Article (context)|Article]]
7443 !! end
7445 !! test
7446 pre-save transform: context links ("pipe trick") with comma in title
7447 !! options
7448 pst title=[[Someplace, Somewhere]]
7449 !! input
7450 [[|Otherplace]]
7451 [[Otherplace, Elsewhere|]]
7452 [[Otherplace, Elsewhere, Anywhere|]]
7453 !! result
7454 [[Otherplace, Somewhere|Otherplace]]
7455 [[Otherplace, Elsewhere|Otherplace]]
7456 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
7457 !! end
7459 !! test
7460 pre-save transform: context links ("pipe trick") with parens and comma
7461 !! options
7462 pst title=[[Someplace (IGNORED), Somewhere]]
7463 !! input
7464 [[|Otherplace]]
7465 [[Otherplace (place), Elsewhere|]]
7466 !! result
7467 [[Otherplace, Somewhere|Otherplace]]
7468 [[Otherplace (place), Elsewhere|Otherplace]]
7469 !! end
7471 !! test
7472 pre-save transform: context links ("pipe trick") with comma and parens
7473 !! options
7474 pst title=[[Who, me? (context)]]
7475 !! input
7476 [[|Yes, you.]]
7477 [[Me, Myself, and I (1937 song)|]]
7478 !! result
7479 [[Yes, you. (context)|Yes, you.]]
7480 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7481 !! end
7483 !! test
7484 pre-save transform: context links ("pipe trick") with namespace
7485 !! options
7486 pst title=[[Ns:Somearticle]]
7487 !! input
7488 [[|Article]]
7489 !! result
7490 [[Ns:Article|Article]]
7491 !! end
7493 !! test
7494 pre-save transform: context links ("pipe trick") with namespace and parens
7495 !! options
7496 pst title=[[Ns:Somearticle (context)]]
7497 !! input
7498 [[|Article]]
7499 !! result
7500 [[Ns:Article (context)|Article]]
7501 !! end
7503 !! test
7504 pre-save transform: context links ("pipe trick") with namespace and comma
7505 !! options
7506 pst title=[[Ns:Somearticle, Context, Whatever]]
7507 !! input
7508 [[|Article]]
7509 !! result
7510 [[Ns:Article, Context, Whatever|Article]]
7511 !! end
7513 !! test
7514 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7515 !! options
7516 pst title=[[Ns:Somearticle, Context (context)]]
7517 !! input
7518 [[|Article]]
7519 !! result
7520 [[Ns:Article (context)|Article]]
7521 !! end
7523 !! test
7524 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7525 !! options
7526 pst title=[[Ns:Somearticle (IGNORED), Context]]
7527 !! input
7528 [[|Article]]
7529 !! result
7530 [[Ns:Article, Context|Article]]
7531 !! end
7533 !! test
7534 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7535 !! options
7537 !! input
7538 [[Article(context)|]]
7539 [[Bar:Article(context)|]]
7540 [[:Bar:Article(context)|]]
7541 [[|Article(context)]]
7542 [[Bar:X(Y)Z|]]
7543 [[:Bar:X(Y)Z|]]
7544 !! result
7545 [[Article(context)|Article]]
7546 [[Bar:Article(context)|Article]]
7547 [[:Bar:Article(context)|Article]]
7548 [[Article(context)]]
7549 [[Bar:X(Y)Z|X(Y)Z]]
7550 [[:Bar:X(Y)Z|X(Y)Z]]
7551 !! end
7553 !! test
7554 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7555 !! options
7557 !! input
7558 [[Article (context)|]]
7559 [[Bar:Article (context)|]]
7560 [[:Bar:Article (context)|]]
7561 [[|Article (context)]]
7562 [[Bar:X (Y) Z|]]
7563 [[:Bar:X (Y) Z|]]
7564 !! result
7565 [[Article (context)|Article]]
7566 [[Bar:Article (context)|Article]]
7567 [[:Bar:Article (context)|Article]]
7568 [[Article (context)]]
7569 [[Bar:X (Y) Z|X (Y) Z]]
7570 [[:Bar:X (Y) Z|X (Y) Z]]
7571 !! end
7573 !! test
7574 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7575 !! options
7577 !! input
7578 [[Article(context)|]]
7579 [[Bar:Article(context)|]]
7580 [[:Bar:Article(context)|]]
7581 [[|Article(context)]]
7582 [[Bar:X(Y)Z|]]
7583 [[:Bar:X(Y)Z|]]
7584 !! result
7585 [[Article(context)|Article]]
7586 [[Bar:Article(context)|Article]]
7587 [[:Bar:Article(context)|Article]]
7588 [[Article(context)]]
7589 [[Bar:X(Y)Z|X(Y)Z]]
7590 [[:Bar:X(Y)Z|X(Y)Z]]
7591 !! end
7593 !! test
7594 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7595 !! options
7597 !! input
7598 [[Article (context), context|]]
7599 [[Article (context),context|]]
7600 [[Bar:Article (context), context|]]
7601 [[Bar:Article (context),context|]]
7602 [[:Bar:Article (context), context|]]
7603 [[:Bar:Article (context),context|]]
7604 !! result
7605 [[Article (context), context|Article]]
7606 [[Article (context),context|Article]]
7607 [[Bar:Article (context), context|Article]]
7608 [[Bar:Article (context),context|Article]]
7609 [[:Bar:Article (context), context|Article]]
7610 [[:Bar:Article (context),context|Article]]
7611 !! end
7613 !! test
7614 pre-save transform: trim trailing empty lines
7615 !! options
7617 !! input
7618 Empty lines are trimmed
7623 !! result
7624 Empty lines are trimmed
7625 !! end
7627 !! test
7628 pre-save transform: Signature expansion
7629 !! options
7631 !! input
7632 * ~~~
7633 * <noinclude>~~~</noinclude>
7634 * <includeonly>~~~</includeonly>
7635 * <onlyinclude>~~~</onlyinclude>
7636 !! result
7637 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7638 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7639 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7640 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7641 !! end
7644 !! test
7645 pre-save transform: Signature expansion in nowiki tags (bug 93)
7646 !! options
7647 pst disabled
7648 !! input
7649 Shall not expand:
7651 <nowiki>~~~~</nowiki>
7653 <includeonly><nowiki>~~~~</nowiki></includeonly>
7655 <noinclude><nowiki>~~~~</nowiki></noinclude>
7657 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7659 {{subst:Foo}} shall be converted to FOO
7661 As well as inside noinclude/onlyinclude
7662 <noinclude>{{subst:Foo}}</noinclude>
7663 <onlyinclude>{{subst:Foo}}</onlyinclude>
7665 But not inside includeonly
7666 <includeonly>{{subst:Foo}}</includeonly>
7667 !! result
7668 Shall not expand:
7670 <nowiki>~~~~</nowiki>
7672 <includeonly><nowiki>~~~~</nowiki></includeonly>
7674 <noinclude><nowiki>~~~~</nowiki></noinclude>
7676 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7678 FOO shall be converted to FOO
7680 As well as inside noinclude/onlyinclude
7681 <noinclude>FOO</noinclude>
7682 <onlyinclude>FOO</onlyinclude>
7684 But not inside includeonly
7685 <includeonly>{{subst:Foo}}</includeonly>
7686 !! end
7689 ### Message transform tests
7691 !! test
7692 message transform: magic variables
7693 !! options
7695 !! input
7696 {{SITENAME}}
7697 !! result
7698 MediaWiki
7699 !! end
7701 !! test
7702 message transform: should not transform wiki markup
7703 !! options
7705 !! input
7706 ''test''
7707 !! result
7708 ''test''
7709 !! end
7711 !! test
7712 message transform: <noinclude> in transcluded template (bug 4926)
7713 !! options
7715 !! input
7716 {{Includes}}
7717 !! result
7718 Foobar
7719 !! end
7721 !! test
7722 message transform: <onlyinclude> in transcluded template (bug 4926)
7723 !! options
7725 !! input
7726 {{Includes2}}
7727 !! result
7729 !! end
7731 !! test
7732 {{#special:}} page name, known
7733 !! options
7735 !! input
7736 {{#special:Recentchanges}}
7737 !! result
7738 Special:RecentChanges
7739 !! end
7741 !! test
7742 {{#special:}} page name with subpage, known
7743 !! options
7745 !! input
7746 {{#special:Recentchanges/param}}
7747 !! result
7748 Special:RecentChanges/param
7749 !! end
7751 !! test
7752 {{#special:}} page name, unknown
7753 !! options
7755 !! input
7756 {{#special:foobar nonexistent}}
7757 !! result
7758 Special:Foobar nonexistent
7759 !! end
7761 !! test
7762 {{#speciale:}} page name, known
7763 !! options
7765 !! input
7766 {{#speciale:Recentchanges}}
7767 !! result
7768 Special:RecentChanges
7769 !! end
7771 !! test
7772 {{#speciale:}} page name with subpage, known
7773 !! options
7775 !! input
7776 {{#speciale:Recentchanges/param}}
7777 !! result
7778 Special:RecentChanges/param
7779 !! end
7781 !! test
7782 {{#speciale:}} page name, unknown
7783 !! options
7785 !! input
7786 {{#speciale:foobar nonexistent}}
7787 !! result
7788 Special:Foobar_nonexistent
7789 !! end
7792 ### Images
7794 !! test
7795 Simple image
7796 !! input
7797 [[Image:foobar.jpg]]
7798 !! result
7799 <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>
7800 </p>
7801 !! end
7803 !! test
7804 Right-aligned image
7805 !! input
7806 [[Image:foobar.jpg|right]]
7807 !! result
7808 <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>
7810 !! end
7812 !! test
7813 Simple image (using File: namespace, now canonical)
7814 !! input
7815 [[File:foobar.jpg]]
7816 !! result
7817 <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>
7818 </p>
7819 !! end
7821 !! test
7822 Image with caption
7823 !! input
7824 [[Image:foobar.jpg|right|Caption text]]
7825 !! result
7826 <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>
7828 !! end
7830 !! test
7831 Image with empty attribute
7832 !! input
7833 [[Image:foobar.jpg|right||Caption text]]
7834 !! result
7835 <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>
7837 !! end
7839 !! test
7840 Image with link tails
7841 !! input
7842 123[[Image:foobar.jpg]]456
7843 123[[Image:foobar.jpg|right]]456
7844 123[[Image:foobar.jpg|thumb]]456
7845 !! result
7846 <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
7847 </p>
7848 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
7849 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
7851 !! end
7853 !! test
7854 Image with multiple captions -- only last one is accepted
7855 !! input
7856 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7857 !! result
7858 <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>
7860 !! end
7862 !! test
7863 Image with width attribute at different positions
7864 !! input
7865 [[Image:foobar.jpg|200px|right|Caption]]
7866 [[Image:foobar.jpg|right|200px|Caption]]
7867 [[Image:foobar.jpg|right|Caption|200px]]
7868 !! result
7869 <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>
7870 <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>
7871 <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>
7873 !! end
7875 !! test
7876 Image with link parameter, wiki target
7877 !! input
7878 [[Image:foobar.jpg|link=Target page]]
7879 !! result
7880 <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>
7881 </p>
7882 !! end
7884 !! test
7885 Image with link parameter, URL target
7886 !! input
7887 [[Image:foobar.jpg|link=http://example.com/]]
7888 !! result
7889 <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>
7890 </p>
7891 !! end
7893 !! test
7894 Image with link parameter, wgExternalLinkTarget
7895 !! input
7896 [[Image:foobar.jpg|link=http://example.com/]]
7897 !! config
7898 wgExternalLinkTarget='foobar'
7899 !! result
7900 <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>
7901 </p>
7902 !! end
7904 !! test
7905 Image with link parameter, wgNoFollowLinks set to false
7906 !! input
7907 [[Image:foobar.jpg|link=http://example.com/]]
7908 !! config
7909 wgNoFollowLinks=false
7910 !! result
7911 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7912 </p>
7913 !! end
7915 !! test
7916 Image with link parameter, wgNoFollowDomainExceptions
7917 !! input
7918 [[Image:foobar.jpg|link=http://example.com/]]
7919 !! config
7920 wgNoFollowDomainExceptions='example.com'
7921 !! result
7922 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7923 </p>
7924 !! end
7926 !! test
7927 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7928 !! input
7929 [[Image:foobar.jpg|link=http://example.com/|Title]]
7930 !! config
7931 wgExternalLinkTarget='foobar'
7932 !! result
7933 <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>
7934 </p>
7935 !! end
7937 !! test
7938 Image with empty link parameter
7939 !! input
7940 [[Image:foobar.jpg|link=]]
7941 !! result
7942 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7943 </p>
7944 !! end
7946 !! test
7947 Image with link parameter (wiki target) and unnamed parameter
7948 !! input
7949 [[Image:foobar.jpg|link=Target page|Title]]
7950 !! result
7951 <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>
7952 </p>
7953 !! end
7955 !! test
7956 Image with link parameter (URL target) and unnamed parameter
7957 !! input
7958 [[Image:foobar.jpg|link=http://example.com/|Title]]
7959 !! result
7960 <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>
7961 </p>
7962 !! end
7964 !! test
7965 Thumbnail image with link parameter
7966 !! options
7968 !! input
7969 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
7970 !! result
7971 <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>
7973 !! end
7975 !! test
7976 Manually-specified thumbnail image
7977 !! options
7979 !! input
7980 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
7981 !! result
7982 <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>
7984 !! end
7986 !! test
7987 Manually-specified thumbnail image with explicit link to wiki page
7988 !! options
7990 !! input
7991 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
7992 !! result
7993 <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>
7995 !! end
7997 !! test
7998 Manually-specified thumbnail image with explicit link to url
7999 !! options
8001 !! input
8002 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
8003 !! result
8004 <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>
8006 !! end
8008 !! test
8009 Manually-specified thumbnail image with explicit no link
8010 !! options
8012 !! input
8013 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
8014 !! result
8015 <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>
8017 !! end
8019 !! test
8020 Manually-specified thumbnail image with explicit link and alt text
8021 !! options
8023 !! input
8024 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
8025 !! result
8026 <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>
8028 !! end
8030 !! test
8031 Image with frame and link
8032 !! input
8033 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
8034 !! result
8035 <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>
8037 !! end
8039 !! test
8040 Image with frame and link and explicit alt
8041 !! input
8042 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
8043 !! result
8044 <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>
8046 !! end
8048 !! test
8049 Image with wiki markup in implicit alt
8050 !! input
8051 [[Image:Foobar.jpg|testing '''bold''' in alt]]
8052 !! result
8053 <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>
8054 </p>
8055 !! end
8057 !! test
8058 Image with wiki markup in explicit alt
8059 !! input
8060 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
8061 !! result
8062 <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>
8063 </p>
8064 !! end
8066 !! test
8067 Link to image page- image page normally doesn't exists, hence edit link
8068 Add test with existing image page
8069 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
8070 !! input
8071 [[:Image:test]]
8072 !! result
8073 <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>
8074 </p>
8075 !! end
8077 !! test
8078 bug 18784  Link to non-existent image page with caption should use caption as link text
8079 !! input
8080 [[:Image:test|caption]]
8081 !! result
8082 <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>
8083 </p>
8084 !! end
8086 !! test
8087 Frameless image caption with a free URL
8088 !! input
8089 [[Image:foobar.jpg|http://example.com]]
8090 !! result
8091 <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>
8092 </p>
8093 !! end
8095 !! test
8096 Thumbnail image caption with a free URL
8097 !! input
8098 [[Image:foobar.jpg|thumb|http://example.com]]
8099 !! result
8100 <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>
8102 !! end
8104 !! test
8105 Thumbnail image caption with a free URL and explicit alt
8106 !! input
8107 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
8108 !! result
8109 <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>
8111 !! end
8113 !! test
8114 SVG thumbnails with no language set
8115 !! options
8116 !! input
8117 [[File:Foobar.svg|thumb|width=200]]
8118 !! result
8119 <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>
8121 !! end
8123 !! test
8124 SVG thumbnails with language de
8125 !! options
8126 !! input
8127 [[File:Foobar.svg|thumb|width=200|lang=de]]
8128 !! result
8129 <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>
8131 !! end
8133 !! test
8134 SVG thumbnails with invalid language code
8135 !! options
8136 !! input
8137 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
8138 !! result
8139 <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>
8141 !! end
8143 !! test
8144 BUG 1887: A ISBN with a thumbnail
8145 !! input
8146 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
8147 !! result
8148 <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>
8150 !! end
8152 !! test
8153 BUG 1887: A RFC with a thumbnail
8154 !! input
8155 [[Image:foobar.jpg|thumb|This is RFC 12354]]
8156 !! result
8157 <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>
8159 !! end
8161 !! test
8162 BUG 1887: A mailto link with a thumbnail
8163 !! input
8164 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
8165 !! result
8166 <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>
8168 !! end
8170 # Pending resolution to bug 368
8171 !! test
8172 BUG 648: Frameless image caption with a link
8173 !! input
8174 [[Image:foobar.jpg|text with a [[link]] in it]]
8175 !! result
8176 <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>
8177 </p>
8178 !! end
8180 !! test
8181 BUG 648: Frameless image caption with a link (suffix)
8182 !! input
8183 [[Image:foobar.jpg|text with a [[link]]foo in it]]
8184 !! result
8185 <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>
8186 </p>
8187 !! end
8189 !! test
8190 BUG 648: Frameless image caption with an interwiki link
8191 !! input
8192 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
8193 !! result
8194 <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>
8195 </p>
8196 !! end
8198 !! test
8199 BUG 648: Frameless image caption with a piped interwiki link
8200 !! input
8201 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
8202 !! result
8203 <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>
8204 </p>
8205 !! end
8207 !! test
8208 Escape HTML special chars in image alt text
8209 !! input
8210 [[Image:foobar.jpg|& < > "]]
8211 !! result
8212 <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>
8213 </p>
8214 !! end
8216 !! test
8217 BUG 499: Alt text should have &#1234;, not &amp;1234;
8218 !! input
8219 [[Image:foobar.jpg|&#9792;]]
8220 !! result
8221 <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>
8222 </p>
8223 !! end
8225 !! test
8226 Broken image caption with link
8227 !! input
8228 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
8229 !! result
8230 <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.
8231 </p>
8232 !! end
8234 !! test
8235 Image caption containing another image
8236 !! input
8237 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
8238 !! result
8239 <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>
8241 !! end
8243 !! test
8244 Image caption containing a newline
8245 !! input
8246 [[Image:Foobar.jpg|This
8247 *is some text]]
8248 !! result
8249 <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>
8250 </p>
8251 !!end
8253 !!test
8254 Parsoid: Image caption containing leading space
8255 (The leading space should not trigger nowiki escaping in wt2wt mode)
8256 !! input
8257 [[Image:Foobar.jpg|thumb| bar]]
8258 !! result
8259 <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>
8261 !!end
8263 !! test
8264 Bug 3090: External links other than http: in image captions
8265 !! input
8266 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
8267 !! result
8268 <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>
8270 !! end
8272 !! test
8273 Custom class
8274 !! input
8275 [[Image:foobar.jpg|a|class=b]]
8276 !! result
8277 <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>
8278 </p>
8279 !! end
8281 !! test
8282 Localized image handling (1).
8283 !! options
8284 language=es
8285 !! input
8286 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
8287 !! result
8288 <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>
8290 !! end
8292 !! test
8293 Localized image handling (2).
8294 !! options
8295 language=es
8296 !! input
8297 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
8298 !! result
8299 <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>
8301 !! end
8303 !! test
8304 "border", "frameless" and "class" attributes on an image.
8305 !! input
8306 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
8307 !! result
8308 <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>
8309 </p>
8310 !! end
8312 !! article
8313 File:Barfoo.jpg
8314 !! text
8315 #REDIRECT [[File:Barfoo.jpg]]
8316 !! endarticle
8318 !! test
8319 Redirected image
8320 !! input
8321 [[Image:Barfoo.jpg]]
8322 !! result
8323 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
8324 </p>
8325 !! end
8327 !! test
8328 Missing image with uploads disabled
8329 !! options
8330 wgEnableUploads=0
8331 !! input
8332 [[Image:Foobaz.jpg]]
8333 !! result
8334 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
8335 </p>
8336 !! end
8338 # Parsoid-specific testing for images
8339 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8340 # Currently imperfect due to a flaw in the Parsoid testrunner
8341 # Work in progress
8343 !! test
8344 Parsoid-specific image handling - simple image
8345 !! options
8346 parsoid
8347 !! input
8348 [[Image:Foobar.jpg]]
8349 !! result
8351 <span class="mw-default-size" typeof="mw:Image">
8352 <a href="File:Foobar.jpg">
8353 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8354 </a>
8355 </span>
8356 </p>
8357 !! end
8359 !! test
8360 Parsoid-specific image handling - simple image without link
8361 !! options
8362 parsoid
8363 !! input
8364 [[Image:Foobar.jpg|link=]]
8365 !! result
8367 <span class="mw-default-size" typeof="mw:Image">
8368 <span>
8369 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8370 </span>
8371 </span>
8372 </p>
8373 !! end
8375 !! test
8376 Parsoid-specific image handling - simple image with specific link
8377 !! options
8378 parsoid
8379 !! input
8380 [[Image:Foobar.jpg|link=Main Page]]
8381 !! result
8383 <span class="mw-default-size" typeof="mw:Image">
8384 <a href="Main_Page">
8385 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8386 </a>
8387 </span>
8388 </p>
8389 !! end
8391 !! test
8392 Parsoid-specific image handling - simple image with size and middle alignment
8393 !! options
8394 parsoid
8395 !! input
8396 [[Image:Foobar.jpg|50px|middle]]
8397 !! result
8399 <span class="mw-valign-middle" typeof="mw:Image">
8400 <a href="File:Foobar.jpg">
8401 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8402 </a>
8403 </span>
8404 </p>
8405 !! end
8407 !! test
8408 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
8409 !! options
8410 parsoid
8411 !! input
8412 [[Image:Foobar.jpg|500x10px|baseline|caption]]
8413 !! result
8415 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8416 <a href="File:Foobar.jpg">
8417 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
8418 </a>
8419 </span>
8420 </p>
8421 !! end
8423 !! test
8424 Parsoid-specific image handling - simple image with border and size spec
8425 !! options
8426 parsoid
8427 !! input
8428 [[Image:Foobar.jpg|50px|border|caption]]
8429 !! result
8431 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8432 <a href="File:Foobar.jpg">
8433 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8434 </a>
8435 </span>
8436 </p>
8437 !! end
8439 !! test
8440 Parsoid-specific image handling - thumbnail with halign, valign, and caption
8441 !! options
8442 parsoid
8443 !! input
8444 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
8445 !! result
8446 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
8447 <a href="File:Foobar.jpg">
8448 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
8449 </a>
8450 <figcaption>caption content</figcaption>
8451 </figure>
8452 !! end
8454 !! test
8455 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
8456 !! options
8457 parsoid
8458 !! input
8459 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
8460 !! result
8461 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
8462 <a href="File:Foobar.jpg">
8463 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
8464 </a>
8465 <figcaption>caption</figcaption>
8466 </figure>
8467 !! end
8469 !! test
8470 Parsoid-specific image handling - framed image with specific size and caption
8471 !! options
8472 parsoid
8473 !! input
8474 [[Image:Foobar.jpg|500x50px|frame|caption]]
8475 !! result
8476 <figure typeof="mw:Image/Frame">
8477 <a href="File:Foobar.jpg">
8478 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8479 </a>
8480 <figcaption>caption</figcaption>
8481 </figure>
8482 !! end
8484 !! test
8485 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
8486 !! options
8487 parsoid
8488 !! input
8489 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
8490 !! result
8491 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
8492 <a href="File:Foobar.jpg">
8493 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8494 </a>
8495 <figcaption>caption</figcaption>
8496 </figure>
8497 !! end
8499 !! test
8500 Parsoid-specific image handling - frameless image with specific size, border, and caption
8501 !! options
8502 parsoid
8503 !! input
8504 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
8505 !! result
8507 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8508 <a href="File:Foobar.jpg">
8509 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8510 </a>
8511 </p>
8512 !! end
8514 #!! test
8515 #Parsoid-specific image handling - simple image with a formatted caption
8516 #!! options
8517 #parsoid
8518 #!! input
8519 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
8520 #!! result
8521 #<p>
8522 #<span typeof="mw:Image">
8523 #<a class="mw-default-size" href="Image:Foobar.jpg">
8524 #<img alt="Foobar.jpg" class="mw-default-size" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8525 #</a>
8526 #<span>abc</span>
8527 #</span>
8528 #</p>
8532 ### Subpages
8534 !! article
8535 Subpage test/subpage
8536 !! text
8538 !! endarticle
8540 !! test
8541 Subpage link
8542 !! options
8543 subpage title=[[Subpage test]]
8544 !! input
8545 [[/subpage]]
8546 !! result
8547 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
8548 </p>
8549 !! end
8551 !! test
8552 Subpage noslash link
8553 !! options
8554 subpage title=[[Subpage test]]
8555 !!input
8556 [[/subpage/]]
8557 !! result
8558 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
8559 </p>
8560 !! end
8562 # TODO: make this PHP-parser compatible!
8563 !! test
8564 Relative subpage noslash link
8565 !! options
8566 parsoid=wt2wt,wt2html,html2html
8567 subpage title=[[Subpage test/1/2/3/4]]
8568 !!input
8569 [[../../subpage/]]
8571 [[../../subpage]]
8572 !! result
8573 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
8574 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
8575 !! end
8577 # TODO: make this PHP-parser compatible!
8578 !! test
8579 Parsoid: dot-slash prefixed wikilinks
8580 !! options
8581 parsoid=wt2wt,wt2html,html2html
8582 !!input
8583 [[./foo]]
8585 [[././bar]]
8587 [[././baz/]]
8588 !! result
8589 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
8590 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
8591 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
8592 !! end
8594 !! test
8595 Disabled subpages
8596 !! input
8597 [[/subpage]]
8598 !! result
8599 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
8600 </p>
8601 !! end
8603 !! test
8604 BUG 561: {{/Subpage}}
8605 !! options
8606 subpage title=[[Page]]
8607 !! input
8608 {{/Subpage}}
8609 !! result
8610 <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>
8611 </p>
8612 !! end
8615 ### Categories
8617 !! article
8618 Category:MediaWiki User's Guide
8619 !! text
8620 blah
8621 !! endarticle
8623 !! test
8624 Link to category
8625 !! input
8626 [[:Category:MediaWiki User's Guide]]
8627 !! result
8628 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
8629 </p>
8630 !! end
8632 !! test
8633 Simple category
8634 !! options
8636 !! input
8637 [[Category:MediaWiki User's Guide]]
8638 !! result
8639 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8640 !! end
8642 !! test
8643 PAGESINCATEGORY invalid title fatal (r33546 fix)
8644 !! input
8645 {{PAGESINCATEGORY:<bogus>}}
8646 !! result
8647 <p>0
8648 </p>
8649 !! end
8651 !! test
8652 Category with different sort key
8653 !! options
8655 !! input
8656 [[Category:MediaWiki User's Guide|Foo]]
8657 !! result
8658 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8659 !! end
8661 !! test
8662 Category with identical sort key
8663 !! options
8665 !! input
8666 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8667 !! result
8668 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8669 !! end
8671 !! test
8672 Category with empty sort key
8673 !! options
8676 !! input
8677 [[Category:MediaWiki User's Guide|]]
8678 !! result
8679 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8680 !! end
8682 !! test
8683 Category with empty sort key and parentheses
8684 !! options
8687 !! input
8688 [[Category:Foo (bar)|]]
8689 !! result
8690 [[Category:Foo (bar)|Foo]]
8691 !! end
8693 !! test
8694 Category with link tail
8695 !! options
8698 !! input
8699 123[[Category:Foo]]456
8700 !! result
8701 123[[Category:Foo]]456
8702 !! end
8704 !! test
8705 Category with template
8706 !! options
8709 !! input
8710 [[Category:{{echo|Foo}}]]
8711 !! result
8712 [[Category:{{echo|Foo}}]]
8713 !! end
8715 !! test
8716 Category with template in sort key
8717 !! options
8720 !! input
8721 [[Category:Foo|{{echo|Bar}}]]
8722 !! result
8723 [[Category:Foo|{{echo|Bar}}]]
8724 !! end
8726 !! test
8727 Category with template in sort key and title
8728 !! options
8731 !! input
8732 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8733 !! result
8734 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8735 !! end
8737 !! test
8738 Category / paragraph interactions
8739 !! input
8740 Foo [[Category:Baz]] Bar
8742 Foo [[Category:Baz]]
8746 [[Category:Baz]]
8750 [[Category:Baz]] Bar
8753 [[Category:Baz]]
8754  [[Category:Baz]]
8755 [[Category:Baz]]
8758 [[Category:Baz]]
8759  [[Category:Baz]]
8760 [[Category:Baz]]
8762 [[Category:Baz]]
8763  {{echo|[[Category:Baz]]}}
8764 [[Category:Baz]]
8765 !! result
8766 <p>Foo Bar
8767 </p><p>Foo
8769 </p><p>Foo
8771 </p><p>Foo Bar
8772 </p><p>Foo
8774 </p>
8775 !! end
8777 !! test
8778 Parsoid: Serialize link to category page with colon escape
8779 !! options
8780 parsoid
8781 !! input
8783 [[:Category:Foo]]
8784 [[:Category:Foo|Bar]]
8785 !! result
8787 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
8788 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
8789 </p>
8790 !! end
8792 !! test
8793 Parsoid: Serialize link to file page with colon escape
8794 !! options
8795 parsoid
8796 !! input
8798 [[:File:Foo.png]]
8799 [[:File:Foo.png|Bar]]
8800 !! result
8802 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
8803 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
8804 </p>
8805 !! end
8807 !! test
8808 Parsoid: Serialize a genuine category link without colon escape
8809 !! options
8810 parsoid
8811 !! input
8812 [[Category:Foo]]
8813 [[Category:Foo|Bar]]
8814 !! result
8815 <link rel="mw:WikiLink/Category" href="Category:Foo">
8816 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
8817 !! end
8820 ### Inter-language links
8822 !! test
8823 Inter-language links
8824 !! options
8826 !! input
8827 [[es:Alimento]]
8828 [[fr:Nourriture]]
8829 [[zh:&#39135;&#21697;]]
8830 !! result
8831 es:Alimento fr:Nourriture zh:食品
8832 !! end
8834 !! test
8835 Duplicate interlanguage links (bug 24502)
8836 !! options
8838 !! input
8839 [[es:1]]
8840 [[es:2]]
8841 [[fr:1]]
8842 [[fr:2]]
8843 !! result
8844 es:1 fr:1
8845 !! end
8848 ### Sections
8850 !! test
8851 Basic section headings
8852 !! input
8853 == Headline 1 ==
8854 Some text
8856 ==Headline 2==
8857 More
8858 ===Smaller headline===
8859 Blah blah
8860 !! result
8861 <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>
8862 <p>Some text
8863 </p>
8864 <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>
8865 <p>More
8866 </p>
8867 <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>
8868 <p>Blah blah
8869 </p>
8870 !! end
8872 !! test
8873 Section headings with TOC
8874 !! input
8875 == Headline 1 ==
8876 === Subheadline 1 ===
8877 ===== Skipping a level =====
8878 ====== Skipping a level ======
8880 == Headline 2 ==
8881 Some text
8882 ===Another headline===
8883 !! result
8884 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8885 <ul>
8886 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
8887 <ul>
8888 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
8889 <ul>
8890 <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>
8891 <ul>
8892 <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>
8893 </ul>
8894 </li>
8895 </ul>
8896 </li>
8897 </ul>
8898 </li>
8899 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
8900 <ul>
8901 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
8902 </ul>
8903 </li>
8904 </ul>
8905 </div>
8906 <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>
8907 <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>
8908 <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>
8909 <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>
8910 <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>
8911 <p>Some text
8912 </p>
8913 <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>
8915 !! end
8917 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
8918 !! test
8919 Handling of sections up to level 6 and beyond
8920 !! input
8921 = Level 1 Heading=
8922 == Level 2 Heading==
8923 === Level 3 Heading===
8924 ==== Level 4 Heading====
8925 ===== Level 5 Heading=====
8926 ====== Level 6 Heading======
8927 ======= Level 7 Heading=======
8928 ======== Level 8 Heading========
8929 ========= Level 9 Heading=========
8930 ========== Level 10 Heading==========
8931 !! result
8932 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8933 <ul>
8934 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
8935 <ul>
8936 <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>
8937 <ul>
8938 <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>
8939 <ul>
8940 <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>
8941 <ul>
8942 <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>
8943 <ul>
8944 <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>
8945 <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>
8946 <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>
8947 <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>
8948 <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>
8949 </ul>
8950 </li>
8951 </ul>
8952 </li>
8953 </ul>
8954 </li>
8955 </ul>
8956 </li>
8957 </ul>
8958 </li>
8959 </ul>
8960 </div>
8961 <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>
8962 <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>
8963 <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>
8964 <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>
8965 <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>
8966 <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>
8967 <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>
8968 <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>
8969 <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>
8970 <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>
8972 !! end
8974 !! test
8975 TOC regression (bug 9764)
8976 !! input
8977 == title 1 ==
8978 === title 1.1 ===
8979 ==== title 1.1.1 ====
8980 === title 1.2 ===
8981 == title 2 ==
8982 === title 2.1 ===
8983 !! result
8984 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8985 <ul>
8986 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8987 <ul>
8988 <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>
8989 <ul>
8990 <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>
8991 </ul>
8992 </li>
8993 <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>
8994 </ul>
8995 </li>
8996 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8997 <ul>
8998 <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>
8999 </ul>
9000 </li>
9001 </ul>
9002 </div>
9003 <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>
9004 <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>
9005 <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>
9006 <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>
9007 <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>
9008 <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>
9010 !! end
9012 !! test
9013 TOC with wgMaxTocLevel=3 (bug 6204)
9014 !! options
9015 wgMaxTocLevel=3
9016 !! input
9017 == title 1 ==
9018 === title 1.1 ===
9019 ==== title 1.1.1 ====
9020 === title 1.2 ===
9021 == title 2 ==
9022 === title 2.1 ===
9023 !! result
9024 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9025 <ul>
9026 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9027 <ul>
9028 <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>
9029 <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>
9030 </ul>
9031 </li>
9032 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9033 <ul>
9034 <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>
9035 </ul>
9036 </li>
9037 </ul>
9038 </div>
9039 <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>
9040 <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>
9041 <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>
9042 <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>
9043 <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>
9044 <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>
9046 !! end
9048 !! test
9049 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
9050 !! options
9051 wgMaxTocLevel=3
9052 !! input
9053 ==Section 1==
9054 ===Section 1.1===
9055 ====Section 1.1.1====
9056 ====Section 1.1.1.1====
9057 ==Section 2==
9058 !! result
9059 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9060 <ul>
9061 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
9062 <ul>
9063 <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>
9064 </ul>
9065 </li>
9066 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
9067 </ul>
9068 </div>
9069 <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>
9070 <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>
9071 <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>
9072 <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>
9073 <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>
9075 !! end
9078 !! test
9079 Resolving duplicate section names
9080 !! input
9081 == Foo bar ==
9082 == Foo bar ==
9083 !! result
9084 <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>
9085 <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>
9087 !! end
9089 !! test
9090 Resolving duplicate section names with differing case (bug 10721)
9091 !! input
9092 == Foo bar ==
9093 == Foo Bar ==
9094 !! result
9095 <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>
9096 <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>
9098 !! end
9100 !! article
9101 Template:sections
9102 !! text
9103 ===Section 1===
9104 ==Section 2==
9105 !! endarticle
9107 !! test
9108 Template with sections, __NOTOC__
9109 !! input
9110 __NOTOC__
9111 ==Section 0==
9112 {{sections}}
9113 ==Section 4==
9114 !! result
9115 <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>
9116 <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>
9117 <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>
9118 <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>
9120 !! end
9122 !! test
9123 __NOEDITSECTION__ keyword
9124 !! input
9125 __NOEDITSECTION__
9126 ==Section 1==
9127 ==Section 2==
9128 !! result
9129 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
9130 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
9132 !! end
9134 !! test
9135 Link inside a section heading
9136 !! input
9137 ==Section with a [[Main Page|link]] in it==
9138 !! result
9139 <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>
9141 !! end
9143 !! test
9144 TOC regression (bug 12077)
9145 !! input
9146 __TOC__
9147 == title 1 ==
9148 === title 1.1 ===
9149 == title 2 ==
9150 !! result
9151 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9152 <ul>
9153 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9154 <ul>
9155 <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>
9156 </ul>
9157 </li>
9158 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
9159 </ul>
9160 </div>
9161 <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>
9162 <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>
9163 <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>
9165 !! end
9167 !! test
9168 BUG 1219 URL next to image (good)
9169 !! input
9170 http://example.com [[Image:foobar.jpg]]
9171 !! result
9172 <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>
9173 </p>
9174 !!end
9176 !! test
9177 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
9178 !! input
9179 === 
9180 The line above must have a trailing space!
9181 === <!--
9182 --> <!-- -->
9183 But just in case it doesn't...
9184 !! result
9185 <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>
9186 <p>The line above must have a trailing space!
9187 </p>
9188 <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>
9189 <p>But just in case it doesn't...
9190 </p>
9191 !! end
9193 !! test
9194 Header with special characters (bug 25462)
9195 !! input
9196 The tooltips shall not show entities to the user (ie. be double escaped)
9198 == text > text ==
9199 section 1
9201 == text < text ==
9202 section 2
9204 == text & text ==
9205 section 3
9207 == text ' text ==
9208 section 4
9210 == text " text ==
9211 section 5
9212 !! result
9213 <p>The tooltips shall not show entities to the user (ie. be double escaped)
9214 </p>
9215 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9216 <ul>
9217 <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>
9218 <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>
9219 <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>
9220 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
9221 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
9222 </ul>
9223 </div>
9224 <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>
9225 <p>section 1
9226 </p>
9227 <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>
9228 <p>section 2
9229 </p>
9230 <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>
9231 <p>section 3
9232 </p>
9233 <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>
9234 <p>section 4
9235 </p>
9236 <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>
9237 <p>section 5
9238 </p>
9239 !! end
9241 !! test
9242 Headers with excess '=' characters
9243 (Are similar tests necessary beyond the 1st level?)
9244 !! input
9245 =foo==
9246 ==foo=
9247 =''italic'' heading==
9248 ==''italic'' heading=
9249 !! result
9250 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9251 <ul>
9252 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
9253 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
9254 <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>
9255 <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>
9256 </ul>
9257 </div>
9258 <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>
9259 <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>
9260 <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>
9261 <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>
9263 !! end
9265 !! test
9266 HTML headers vs TOC (bug 23393)
9267 (__NOEDITSECTION__ for clearer output, doesn't matter here)
9268 !! input
9269 <h1>Header 1</h1>
9270 == Header 1.1 ==
9271 == Header 1.2 ==
9273 <h1>Header 2
9274 </h1>
9275 == Header 2.1 ==
9276 == Header 2.2 ==
9277 __NOEDITSECTION__
9278 !! result
9279 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9280 <ul>
9281 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
9282 <ul>
9283 <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>
9284 <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>
9285 </ul>
9286 </li>
9287 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
9288 <ul>
9289 <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>
9290 <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>
9291 </ul>
9292 </li>
9293 </ul>
9294 </div>
9295 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
9296 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
9297 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
9298 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
9299 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
9300 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
9302 !! end
9304 !! test
9305 BUG 1219 URL next to image (broken)
9306 !! input
9307 http://example.com[[Image:foobar.jpg]]
9308 !! result
9309 <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>
9310 </p>
9311 !!end
9313 !! test
9314 Bug 1186 news: in the middle of text
9315 !! input
9316 http://en.wikinews.org/wiki/Wikinews:Workplace
9317 !! result
9318 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
9319 </p>
9320 !!end
9323 !! test
9324 Namespaced link must have a title
9325 !! input
9326 [[Project:]]
9327 !! result
9328 <p>[[Project:]]
9329 </p>
9330 !!end
9332 !! test
9333 Namespaced link must have a title (bad fragment version)
9334 !! input
9335 [[Project:#fragment]]
9336 !! result
9337 <p>[[Project:#fragment]]
9338 </p>
9339 !!end
9343 ### HTML tags and HTML attributes
9346 !! test
9347 div with no attributes
9348 !! input
9349 <div>HTML rocks</div>
9350 !! result
9351 <div>HTML rocks</div>
9353 !! end
9355 !! test
9356 div with double-quoted attribute
9357 !! input
9358 <div id="rock">HTML rocks</div>
9359 !! result
9360 <div id="rock">HTML rocks</div>
9362 !! end
9364 !! test
9365 div with single-quoted attribute
9366 !! input
9367 <div id='rock'>HTML rocks</div>
9368 !! result
9369 <div id="rock">HTML rocks</div>
9371 !! end
9373 !! test
9374 div with unquoted attribute
9375 !! input
9376 <div id=rock>HTML rocks</div>
9377 !! result
9378 <div id="rock">HTML rocks</div>
9380 !! end
9382 !! test
9383 div with illegal double attributes
9384 !! input
9385 <div id="a" id="b">HTML rocks</div>
9386 !! result
9387 <div id="b">HTML rocks</div>
9389 !!end
9391 # FIXME: produce empty string instead of "class" in the PHP parser, following
9392 # the HTML5 spec.
9393 !! test
9394 div with empty attribute value, space before equals
9395 !! options
9396 parsoid
9397 !! input
9398 <div class =>HTML rocks</div>
9399 !! result
9400 <div class="">HTML rocks</div>
9402 !! end
9404 # The PHP parser escapes the opening brace to &#123; for some reason, so
9405 # disabled this test for it.
9406 !! test
9407 div with braces in attribute value
9408 !! options
9409 parsoid
9410 !! input
9411 <div title="{}">Foo</div>
9412 !! result
9413 <div title="{}">Foo</div>
9414 !! end
9416 # This it very inconsistent in the PHP parser: it returns 
9417 # class="class" if there is a space between the name and the equal sign (see
9418 # 'div with empty attribute value, space before equals'), but strips the
9419 # attribute completely if the space is missing. We hope that not much content
9420 # depends on this, so are implementing the behavior below in Parsoid for
9421 # consistencies' sake. Disabled for the PHP parser. 
9422 # FIXME: fix this behavior in the PHP parser?
9423 !! test
9424 div with empty attribute value, no space before equals
9425 !! options
9426 parsoid
9427 !! input
9428 <div class=>HTML rocks</div>
9429 !! result
9430 <div class="">HTML rocks</div>
9432 !! end
9434 !! test
9435 HTML multiple attributes correction
9436 !! input
9437 <p class="error" class="awesome">Awesome!</p>
9438 !! result
9439 <p class="awesome">Awesome!</p>
9441 !!end
9443 !! test
9444 Table multiple attributes correction
9445 !! input
9447 !+ class="error" class="awesome"| status
9449 !! result
9450 <table>
9451 <tr>
9452 <th class="awesome"> status
9453 </th></tr></table>
9455 !!end
9457 !! test
9458 DIV IN UPPERCASE
9459 !! input
9460 <DIV ID="x">HTML ROCKS</DIV>
9461 !! result
9462 <div id="x">HTML ROCKS</div>
9464 !!end
9466 !! test
9467 Non-ASCII pseudo-tags are rendered as text
9468 !! input
9469 <khyô>
9470 !! result
9471 <p>&lt;khyô&gt;
9472 </p>
9473 !! end
9475 !! test
9476 Pseudo-tag with URL 'name' renders as url link
9477 !! input
9478 <http://example.com/>
9479 !! result
9480 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
9481 </p>
9482 !! end
9484 !! test
9485 text with amp in the middle of nowhere
9486 !! input
9487 Remember AT&T?
9488 !!result
9489 <p>Remember AT&amp;T?
9490 </p>
9491 !! end
9493 !! test
9494 text with character entity: eacute
9495 !! input
9496 I always thought &eacute; was a cute letter.
9497 !! result
9498 <p>I always thought &#233; was a cute letter.
9499 </p>
9500 !! end
9502 !! test
9503 text with entity-escaped character entity-like string: eacute
9504 !! input
9505 I always thought &amp;eacute; was a cute letter.
9506 !! result
9507 <p>I always thought &amp;eacute; was a cute letter.
9508 </p>
9509 !! end
9511 !! test
9512 text with undefined character entity: xacute
9513 !! input
9514 I always thought &xacute; was a cute letter.
9515 !! result
9516 <p>I always thought &amp;xacute; was a cute letter.
9517 </p>
9518 !! end
9522 ### Nesting tests (see bug 41545, 50604, 51081)
9525 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
9526 # Note that html2wt is considerably more difficult if we use <b> in
9527 # the test case, instead of <big>
9528 !! test
9529 Ensure that HTML adoption agency algorithm is properly implemented.
9530 !! input
9531 <big>X<big>Y</big>Z</big>
9532 !! result
9533 <p><big>X<big>Y</big>Z</big>
9534 </p>
9535 !! end
9537 # This was bug 41545 in the PHP parser.
9538 !! test
9539 Nesting of <kbd>
9540 !! input
9541 <kbd>X<kbd>Y</kbd>Z</kbd>
9542 !! result
9543 <p><kbd>X<kbd>Y</kbd>Z</kbd>
9544 </p>
9545 !! end
9547 # The following cases were bug 51081 in the PHP parser.
9548 # Note that there are some other nestable tags (b, i, etc) which are
9549 # not covered; see bug 51081 for discussion.
9550 !! test
9551 Nesting of <em>
9552 !! input
9553 <em>X<em>Y</em>Z</em>
9554 !! result
9555 <p><em>X<em>Y</em>Z</em>
9556 </p>
9557 !! end
9559 !! test
9560 Nesting of <strong>
9561 !! input
9562 <strong>X<strong>Y</strong>Z</strong>
9563 !! result
9564 <p><strong>X<strong>Y</strong>Z</strong>
9565 </p>
9566 !! end
9568 !! test
9569 Nesting of <q>
9570 !! input
9571 <q>X<q>Y</q>Z</q>
9572 !! result
9573 <p><q>X<q>Y</q>Z</q>
9574 </p>
9575 !! end
9577 !! test
9578 Nesting of <ruby>
9579 !! input
9580 <ruby>X<ruby>Y</ruby>Z</ruby>
9581 !! result
9582 <p><ruby>X<ruby>Y</ruby>Z</ruby>
9583 </p>
9584 !! end
9586 !! test
9587 Nesting of <bdo>
9588 !! input
9589 <bdo>X<bdo>Y</bdo>Z</bdo>
9590 !! result
9591 <p><bdo>X<bdo>Y</bdo>Z</bdo>
9592 </p>
9593 !! end
9597 ### Media links
9600 !! test
9601 Media link
9602 !! input
9603 [[Media:Foobar.jpg]]
9604 !! result
9605 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
9606 </p>
9607 !! end
9609 !! test
9610 Media link with text
9611 !! input
9612 [[Media:Foobar.jpg|A neat file to look at]]
9613 !! result
9614 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
9615 </p>
9616 !! end
9618 # FIXME: this is still bad HTML tag nesting
9619 !! test
9620 Media link with nasty text
9621 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
9622 !! input
9623 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
9624 !! result
9625 <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>
9627 !! end
9629 !! test
9630 Media link to nonexistent file (bug 1702)
9631 !! input
9632 [[Media:No such.jpg]]
9633 !! result
9634 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
9635 </p>
9636 !! end
9638 !! test
9639 Image link to nonexistent file (bug 1850 - good)
9640 !! input
9641 [[Image:No such.jpg]]
9642 !! result
9643 <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>
9644 </p>
9645 !! end
9647 !! test
9648 :Image link to nonexistent file (bug 1850 - bad)
9649 !! input
9650 [[:Image:No such.jpg]]
9651 !! result
9652 <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>
9653 </p>
9654 !! end
9658 !! test
9659 Character reference normalization in link text (bug 1938)
9660 !! input
9661 [[Main Page|this&that]]
9662 !! result
9663 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
9664 </p>
9665 !!end
9667 !! article
9668 אַ
9669 !! text
9670 Test for unicode normalization
9672 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
9673 !! endarticle
9675 !! test
9676 (bug 19451) Links should refer to the normalized form.
9677 !! input
9678 [[&#xFB2E;]]
9679 [[&#x5d0;&#x5b7;]]
9680 [[&#x5d0;ַ]]
9681 [[א&#x5b7;]]
9682 [[אַ]]
9683 !! result
9684 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
9685 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
9686 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
9687 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
9688 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
9689 </p>
9690 !! end
9692 !! test
9693 Empty attribute crash test (bug 2067)
9694 !! input
9695 <font color="">foo</font>
9696 !! result
9697 <p><font color="">foo</font>
9698 </p>
9699 !! end
9701 !! test
9702 Empty attribute crash test single-quotes (bug 2067)
9703 !! input
9704 <font color=''>foo</font>
9705 !! result
9706 <p><font color="">foo</font>
9707 </p>
9708 !! end
9710 !! test
9711 Attribute test: equals, then nothing
9712 !! input
9713 <font color=>foo</font>
9714 !! result
9715 <p><font>foo</font>
9716 </p>
9717 !! end
9719 !! test
9720 Attribute test: unquoted value
9721 !! input
9722 <font color=x>foo</font>
9723 !! result
9724 <p><font color="x">foo</font>
9725 </p>
9726 !! end
9728 !! test
9729 Attribute test: unquoted but illegal value (hash)
9730 !! input
9731 <font color=#x>foo</font>
9732 !! result
9733 <p><font color="#x">foo</font>
9734 </p>
9735 !! end
9737 !! test
9738 Attribute test: no value
9739 !! input
9740 <font color>foo</font>
9741 !! result
9742 <p><font color="color">foo</font>
9743 </p>
9744 !! end
9746 !! test
9747 Bug 2095: link with three closing brackets
9748 !! input
9749 [[Main Page]]]
9750 !! result
9751 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
9752 </p>
9753 !! end
9755 !! test
9756 Bug 2095: link with pipe and three closing brackets
9757 !! input
9758 [[Main Page|link]]]
9759 !! result
9760 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
9761 </p>
9762 !! end
9764 !! test
9765 Bug 2095: link with pipe and three closing brackets, version 2
9766 !! input
9767 [[Main Page|[http://example.com/]]]
9768 !! result
9769 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
9770 </p>
9771 !! end
9775 ### Safety
9778 !! article
9779 Template:Dangerous attribute
9780 !! text
9781 " onmouseover="alert(document.cookie)
9782 !! endarticle
9784 !! article
9785 Template:Dangerous style attribute
9786 !! text
9787 border-size: expression(alert(document.cookie))
9788 !! endarticle
9790 !! article
9791 Template:Div style
9792 !! text
9793 <div style="float: right; {{{1}}}">Magic div</div>
9794 !! endarticle
9796 !! test
9797 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
9798 !! input
9799 <div title="{{test}}"></div>
9800 !! result
9801 <div title="This is a test template"></div>
9803 !! end
9805 !! test
9806 Bug 2304: HTML attribute safety (dangerous template; 2309)
9807 !! input
9808 <div title="{{dangerous attribute}}"></div>
9809 !! result
9810 <div title=""></div>
9812 !! end
9814 !! test
9815 Bug 2304: HTML attribute safety (dangerous style template; 2309)
9816 !! input
9817 <div style="{{dangerous style attribute}}"></div>
9818 !! result
9819 <div style="/* insecure input */"></div>
9821 !! end
9823 !! test
9824 Bug 2304: HTML attribute safety (safe parameter; 2309)
9825 !! input
9826 {{div style|width: 200px}}
9827 !! result
9828 <div style="float: right; width: 200px">Magic div</div>
9830 !! end
9832 !! test
9833 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
9834 !! input
9835 {{div style|width: expression(alert(document.cookie))}}
9836 !! result
9837 <div style="/* insecure input */">Magic div</div>
9839 !! end
9841 !! test
9842 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
9843 !! input
9844 {{div style|"><script>alert(document.cookie)</script>}}
9845 !! result
9846 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9848 !! end
9850 !! test
9851 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
9852 !! input
9853 {{div style|" ><script>alert(document.cookie)</script>}}
9854 !! result
9855 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9857 !! end
9859 !! test
9860 Bug 2304: HTML attribute safety (link)
9861 !! input
9862 <div title="[[Main Page]]"></div>
9863 !! result
9864 <div title="&#91;&#91;Main Page]]"></div>
9866 !! end
9868 !! test
9869 Bug 2304: HTML attribute safety (italics)
9870 !! input
9871 <div title="''foobar''"></div>
9872 !! result
9873 <div title="&#39;&#39;foobar&#39;&#39;"></div>
9875 !! end
9877 !! test
9878 Bug 2304: HTML attribute safety (bold)
9879 !! input
9880 <div title="'''foobar'''"></div>
9881 !! result
9882 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
9884 !! end
9887 !! test
9888 Bug 2304: HTML attribute safety (ISBN)
9889 !! input
9890 <div title="ISBN 1234567890"></div>
9891 !! result
9892 <div title="&#73;SBN 1234567890"></div>
9894 !! end
9896 !! test
9897 Bug 2304: HTML attribute safety (RFC)
9898 !! input
9899 <div title="RFC 1234"></div>
9900 !! result
9901 <div title="&#82;FC 1234"></div>
9903 !! end
9905 !! test
9906 Bug 2304: HTML attribute safety (PMID)
9907 !! input
9908 <div title="PMID 1234567890"></div>
9909 !! result
9910 <div title="&#80;MID 1234567890"></div>
9912 !! end
9914 !! test
9915 Bug 2304: HTML attribute safety (web link)
9916 !! input
9917 <div title="http://example.com/"></div>
9918 !! result
9919 <div title="http&#58;//example.com/"></div>
9921 !! end
9923 !! test
9924 Bug 2304: HTML attribute safety (named web link)
9925 !! input
9926 <div title="[http://example.com/ link]"></div>
9927 !! result
9928 <div title="&#91;http&#58;//example.com/ link]"></div>
9930 !! end
9932 !! test
9933 Bug 3244: HTML attribute safety (extension; safe)
9934 !! input
9935 <div style="<nowiki>background:blue</nowiki>"></div>
9936 !! result
9937 <div style="background:blue"></div>
9939 !! end
9941 !! test
9942 Bug 3244: HTML attribute safety (extension; unsafe)
9943 !! input
9944 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
9945 !! result
9946 <div style="/* insecure input */"></div>
9948 !! end
9950 # More MSIE fun discovered by Tom Gilder
9952 !! test
9953 MSIE CSS safety test: spurious slash
9954 !! input
9955 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
9956 !! result
9957 <div style="/* insecure input */">evil</div>
9959 !! end
9961 !! test
9962 MSIE CSS safety test: hex code
9963 !! input
9964 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
9965 !! result
9966 <div style="/* insecure input */">evil</div>
9968 !! end
9970 !! test
9971 MSIE CSS safety test: comment in url
9972 !! input
9973 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
9974 !! result
9975 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
9977 !! end
9979 !! test
9980 MSIE CSS safety test: comment in expression
9981 !! input
9982 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
9983 !! result
9984 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
9986 !! end
9989 !! test
9990 Table attribute legitimate extension
9991 !! input
9993 !+ style="<nowiki>color:blue</nowiki>"| status
9995 !! result
9996 <table>
9997 <tr>
9998 <th style="color:blue"> status
9999 </th></tr></table>
10001 !!end
10003 !! test
10004 Table attribute safety
10005 !! input
10007 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
10009 !! result
10010 <table>
10011 <tr>
10012 <th style="/* insecure input */"> status
10013 </th></tr></table>
10015 !! end
10017 !! test
10018 CSS line continuation 1
10019 !! input
10020 <div style="background-image: u\&#10;rl(test.jpg);"></div>
10021 !! result
10022 <div style="/* insecure input */"></div>
10024 !! end
10026 !! test
10027 CSS line continuation 2
10028 !! input
10029 <div style="background-image: u\&#13;rl(test.jpg); "></div>
10030 !! result
10031 <div style="/* insecure input */"></div>
10033 !! end
10035 !! article
10036 Template:Identity
10037 !! text
10038 {{{1}}}
10039 !! endarticle
10041 !! test
10042 Expansion of multi-line templates in attribute values (bug 6255)
10043 !! input
10044 <div style="background: {{identity|#00FF00}}">-</div>
10045 !! result
10046 <div style="background: #00FF00">-</div>
10048 !! end
10051 !! test
10052 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
10053 !! input
10054 <div style="background: 
10055 #00FF00">-</div>
10056 !! result
10057 <div style="background: #00FF00">-</div>
10059 !! end
10061 !! test
10062 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
10063 !! input
10064 <div style="background: &#10;#00FF00">-</div>
10065 !! result
10066 <div style="background: &#10;#00FF00">-</div>
10068 !! end
10071 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
10073 !! test
10074 Parser hook: empty input
10075 !! input
10076 <tag></tag>
10077 !! result
10078 <pre>
10080 array (
10082 </pre>
10084 !! end
10086 !! test
10087 Parser hook: empty input using terminated empty elements
10088 !! input
10089 <tag/>
10090 !! result
10091 <pre>
10092 NULL
10093 array (
10095 </pre>
10097 !! end
10099 !! test
10100 Parser hook: empty input using terminated empty elements (space before)
10101 !! input
10102 <tag />
10103 !! result
10104 <pre>
10105 NULL
10106 array (
10108 </pre>
10110 !! end
10112 !! test
10113 Parser hook: basic input
10114 !! input
10115 <tag>input</tag>
10116 !! result
10117 <pre>
10118 'input'
10119 array (
10121 </pre>
10123 !! end
10126 !! test
10127 Parser hook: case insensitive
10128 !! input
10129 <TAG>input</TAG>
10130 !! result
10131 <pre>
10132 'input'
10133 array (
10135 </pre>
10137 !! end
10140 !! test
10141 Parser hook: case insensitive, redux
10142 !! input
10143 <TaG>input</TAg>
10144 !! result
10145 <pre>
10146 'input'
10147 array (
10149 </pre>
10151 !! end
10153 !! test
10154 Parser hook: nested tags
10155 !! options
10156 noxml
10157 !! input
10158 <tag><tag></tag></tag>
10159 !! result
10160 <pre>
10161 '<tag>'
10162 array (
10164 </pre>&lt;/tag&gt;
10166 !! end
10168 !! test
10169 Parser hook: basic arguments
10170 !! input
10171 <tag width=200 height = "100" depth = '50' square></tag>
10172 !! result
10173 <pre>
10175 array (
10176   'width' => '200',
10177   'height' => '100',
10178   'depth' => '50',
10179   'square' => 'square',
10181 </pre>
10183 !! end
10185 !! test
10186 Parser hook: argument containing a forward slash (bug 5344)
10187 !! input
10188 <tag filename='/tmp/bla'></tag>
10189 !! result
10190 <pre>
10192 array (
10193   'filename' => '/tmp/bla',
10195 </pre>
10197 !! end
10199 !! test
10200 Parser hook: empty input using terminated empty elements (bug 2374)
10201 !! input
10202 <tag foo=bar/>text
10203 !! result
10204 <pre>
10205 NULL
10206 array (
10207   'foo' => 'bar',
10209 </pre>text
10211 !! end
10213 # </tag> should be output literally since there is no matching tag that begins it
10214 !! test
10215 Parser hook: basic arguments using terminated empty elements (bug 2374)
10216 !! input
10217 <tag width=200 height = "100" depth = '50' square/>
10218 other stuff
10219 </tag>
10220 !! result
10221 <pre>
10222 NULL
10223 array (
10224   'width' => '200',
10225   'height' => '100',
10226   'depth' => '50',
10227   'square' => 'square',
10229 </pre>
10230 <p>other stuff
10231 &lt;/tag&gt;
10232 </p>
10233 !! end
10236 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
10239 !! test
10240 Parser hook: static parser hook not inside a comment
10241 !! input
10242 <statictag>hello, world</statictag>
10243 <statictag action=flush/>
10244 !! result
10245 <p>hello, world
10246 </p>
10247 !! end
10250 !! test
10251 Parser hook: static parser hook inside a comment
10252 !! input
10253 <!-- <statictag>hello, world</statictag> -->
10254 <statictag action=flush/>
10255 !! result
10256 <p><br />
10257 </p>
10258 !! end
10260 # Nested template calls; this case was broken by Parser.php rev 1.506,
10261 # since reverted.
10263 !! article
10264 Template:One-parameter
10265 !! text
10266 (My parameter is: {{{1}}})
10267 !! endarticle
10269 !! article
10270 Template:Map-one-parameter
10271 !! text
10272 {{{{{1}}}|{{{2}}}}}
10273 !! endarticle
10275 !! test
10276 Nested template calls
10277 !! input
10278 {{Map-one-parameter|One-parameter|param}}
10279 !! result
10280 <p>(My parameter is: param)
10281 </p>
10282 !! end
10286 ### Sanitizer
10288 !! test
10289 Sanitizer: Closing of open tags
10290 !! input
10291 <s></s><table></table>
10292 !! result
10293 <s></s><table></table>
10295 !! end
10297 !! test
10298 Sanitizer: Closing of open but not closed tags
10299 !! input
10300 <s>foo
10301 !! result
10302 <p><s>foo</s>
10303 </p>
10304 !! end
10306 !! test
10307 Sanitizer: Closing of closed but not open tags
10308 !! input
10309 </s>
10310 !! result
10311 <p>&lt;/s&gt;
10312 </p>
10313 !! end
10315 !! test
10316 Sanitizer: Closing of closed but not open table tags
10317 !! input
10318 Table not started</td></tr></table>
10319 !! result
10320 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
10321 </p>
10322 !! end
10324 !! test
10325 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
10326 !! input
10327 <span id="æ: v">byte</span>[[#æ: v|backlink]]
10328 !! result
10329 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
10330 </p>
10331 !! end
10333 !! test
10334 Sanitizer: Validating the contents of the id attribute (bug 4515)
10335 !! options
10336 disabled
10337 !! input
10338 <br id=9 />
10339 !! result
10340 Something, but definitely not <br id="9" />...
10341 !! end
10343 !! test
10344 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
10345 !! options
10346 disabled
10347 !! input
10348 <br id="foo" /><br id="foo" />
10349 !! result
10350 Something need to be done. foo-2 ? 
10351 !! end
10353 !! test
10354 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
10355 !! input
10356 <div itemscope>
10357         <meta itemprop="hello" content="world">
10358         <meta http-equiv="refresh" content="5">
10359         <meta itemprop="hello" http-equiv="refresh" content="5">
10360         <link itemprop="hello" href="{{SERVER}}">
10361         <link rel="stylesheet" href="{{SERVER}}">
10362         <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
10363 </div>
10364 !! result
10365 <div itemscope="itemscope">
10366 <p>     <meta itemprop="hello" content="world" />
10367         &lt;meta http-equiv="refresh" content="5"&gt;
10368         <meta itemprop="hello" content="5" />
10369 </p>
10370         <link itemprop="hello" href="http&#58;//example.org" />
10371         &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
10372         <link itemprop="hello" href="http&#58;//example.org" />
10373 </div>
10375 !! end
10377 !! test
10378 Language converter: output gets cut off unexpectedly (bug 5757)
10379 !! options
10380 language=zh
10381 !! input
10382 this bit is safe: }-
10384 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
10386 then we get cut off here: }-
10388 all additional text is vanished
10389 !! result
10390 <p>this bit is safe: }-
10391 </p><p>but if we add a conversion instance: xxx
10392 </p><p>then we get cut off here: }-
10393 </p><p>all additional text is vanished
10394 </p>
10395 !! end
10397 !! test
10398 Self closed html pairs (bug 5487)
10399 !! options
10400 !! input
10401 <center><font id="bug" />Centered text</center>
10402 <div><font id="bug2" />In div text</div>
10403 !! result
10404 <center>&lt;font id="bug" /&gt;Centered text</center>
10405 <div>&lt;font id="bug2" /&gt;In div text</div>
10407 !! end
10413 !! test
10414 Punctuation: nbsp before exclamation
10415 !! input
10416 C'est grave !
10417 !! result
10418 <p>C'est grave&#160;!
10419 </p>
10420 !! end
10422 !! test
10423 Punctuation: CSS !important (bug 11874)
10424 !! input
10425 <div style="width:50% !important">important</div>
10426 !! result
10427 <div style="width:50% !important">important</div>
10429 !!end
10431 !! test
10432 Punctuation: CSS ! important (bug 11874; with space after)
10433 !! input
10434 <div style="width:50% ! important">important</div>
10435 !! result
10436 <div style="width:50% ! important">important</div>
10438 !!end
10441 !! test
10442 HTML bullet list, closed tags (bug 5497)
10443 !! input
10444 <ul>
10445 <li>One</li>
10446 <li>Two</li>
10447 </ul>
10448 !! result
10449 <ul>
10450 <li>One</li>
10451 <li>Two</li>
10452 </ul>
10454 !! end
10456 !! test
10457 HTML bullet list, unclosed tags (bug 5497)
10458 !! options
10459 disabled
10460 !! input
10461 <ul>
10462 <li>One
10463 <li>Two
10464 </ul>
10465 !! result
10466 <ul>
10467 <li>One
10468 </li><li>Two
10469 </li></ul>
10471 !! end
10473 !! test
10474 HTML ordered list, closed tags (bug 5497)
10475 !! input
10476 <ol>
10477 <li>One</li>
10478 <li>Two</li>
10479 </ol>
10480 !! result
10481 <ol>
10482 <li>One</li>
10483 <li>Two</li>
10484 </ol>
10486 !! end
10488 !! test
10489 HTML ordered list, unclosed tags (bug 5497)
10490 !! options
10491 disabled
10492 !! input
10493 <ol>
10494 <li>One
10495 <li>Two
10496 </ol>
10497 !! result
10498 <ol>
10499 <li>One
10500 </li><li>Two
10501 </li></ol>
10503 !! end
10505 !! test
10506 HTML nested bullet list, closed tags (bug 5497)
10507 !! input
10508 <ul>
10509 <li>One</li>
10510 <li>Two:
10511 <ul>
10512 <li>Sub-one</li>
10513 <li>Sub-two</li>
10514 </ul>
10515 </li>
10516 </ul>
10517 !! result
10518 <ul>
10519 <li>One</li>
10520 <li>Two:
10521 <ul>
10522 <li>Sub-one</li>
10523 <li>Sub-two</li>
10524 </ul>
10525 </li>
10526 </ul>
10528 !! end
10530 !! test
10531 HTML nested bullet list, open tags (bug 5497)
10532 !! options
10533 disabled
10534 !! input
10535 <ul>
10536 <li>One
10537 <li>Two:
10538 <ul>
10539 <li>Sub-one
10540 <li>Sub-two
10541 </ul>
10542 </ul>
10543 !! result
10544 <ul>
10545 <li>One
10546 </li><li>Two:
10547 <ul>
10548 <li>Sub-one
10549 </li><li>Sub-two
10550 </li></ul>
10551 </li></ul>
10553 !! end
10555 !! test
10556 HTML nested ordered list, closed tags (bug 5497)
10557 !! input
10558 <ol>
10559 <li>One</li>
10560 <li>Two:
10561 <ol>
10562 <li>Sub-one</li>
10563 <li>Sub-two</li>
10564 </ol>
10565 </li>
10566 </ol>
10567 !! result
10568 <ol>
10569 <li>One</li>
10570 <li>Two:
10571 <ol>
10572 <li>Sub-one</li>
10573 <li>Sub-two</li>
10574 </ol>
10575 </li>
10576 </ol>
10578 !! end
10580 !! test
10581 HTML nested ordered list, open tags (bug 5497)
10582 !! options
10583 disabled
10584 !! input
10585 <ol>
10586 <li>One
10587 <li>Two:
10588 <ol>
10589 <li>Sub-one
10590 <li>Sub-two
10591 </ol>
10592 </ol>
10593 !! result
10594 <ol>
10595 <li>One
10596 </li><li>Two:
10597 <ol>
10598 <li>Sub-one
10599 </li><li>Sub-two
10600 </li></ol>
10601 </li></ol>
10603 !! end
10605 !! test
10606 HTML ordered list item with parameters oddity
10607 !! input
10608 <ol><li id="fragment">One</li></ol>
10609 !! result
10610 <ol><li id="fragment">One</li></ol>
10612 !! end
10614 !!test
10615 bug 5918: autonumbering
10616 !! input
10617 [http://first/] [http://second] [ftp://ftp]
10619 ftp://inlineftp
10621 [mailto:enclosed@mail.tld With target]
10623 [mailto:enclosed@mail.tld]
10625 mailto:inline@mail.tld
10626 !! result
10627 <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>
10628 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
10629 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
10630 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
10631 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
10632 </p>
10633 !! end
10637 # Security and HTML correctness
10638 # From Nick Jenkins' fuzz testing
10641 !! test
10642 Fuzz testing: Parser13
10643 !! input
10644 {| 
10645 | http://a|
10646 !! result
10647 <table>
10648 <tr>
10649 <td>
10650 </td>
10651 </tr>
10652 </table>
10654 !! end
10656 !! test
10657 Fuzz testing: Parser14
10658 !! input
10659 == onmouseover= ==
10660 http://__TOC__
10661 !! result
10662 <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>
10663 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10664 <ul>
10665 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
10666 </ul>
10667 </div>
10669 !! end
10671 !! test
10672 Fuzz testing: Parser14-table
10673 !! input
10674 ==a==
10675 {| STYLE=__TOC__
10676 !! result
10677 <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>
10678 <table style="&#95;_TOC&#95;_">
10679 <tr><td></td></tr>
10680 </table>
10682 !! end
10684 # Known to produce bogus xml (extra </td>)
10685 !! test
10686 Fuzz testing: Parser16
10687 !! options
10688 noxml
10689 !! input
10691 !https://||||||
10692 !! result
10693 <table>
10694 <tr>
10695 <th>https://</th>
10696 <th></th>
10697 <th></th>
10698 <th>
10699 </td>
10700 </tr>
10701 </table>
10703 !! end
10705 !! test
10706 Fuzz testing: Parser21
10707 !! input
10709 ! irc://{{ftp://a" onmouseover="alert('hello world');"
10711 !! result
10712 <table>
10713 <tr>
10714 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
10715 </th>
10716 <td>
10717 </td>
10718 </tr>
10719 </table>
10721 !! end
10723 !! test
10724 Fuzz testing: Parser22
10725 !! input
10726 http://===r:::https://b
10729 !!result
10730 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
10731 </p>
10732 <table>
10733 <tr><td></td></tr>
10734 </table>
10736 !! end
10738 # Known to produce bad XML for now
10739 !! test
10740 Fuzz testing: Parser24
10741 !! options
10742 noxml
10743 !! input
10745 {{{|
10746 <u CLASS=
10747 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
10748 <br style="onmouseover='alert(document.cookie);' " />
10750 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10752 !! result
10753 <table>
10754 {{{|
10755 <u class="&#124;">}}}} &gt;
10756 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
10758 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10759 <tr>
10760 <td></u>
10761 </td>
10762 </tr>
10763 </table>
10765 !! end
10767 # Note: the current result listed for this is not what the original one was,
10768 # but the original bug was JavaScript injection, which is fixed in any case.
10769 # It's not clear that the original result listed was any more correct than the
10770 # current one.  Original result:
10771 # <p>{{{| 
10772 # </p>
10773 # <li class="&#124;&#124;">
10774 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10775 !!test
10776 Fuzz testing: Parser25 (bug 6055)
10777 !! input
10780 <LI CLASS=||
10782 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
10783 !! result
10784 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10785 </p>
10786 !! end
10788 !!test
10789 Fuzz testing: URL adjacent extension (with space, clean)
10790 !! options
10791 !! input
10792 http://example.com <nowiki>junk</nowiki>
10793 !! result
10794 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
10795 </p>
10796 !!end
10798 !!test
10799 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
10800 !! options
10801 !! input
10802 http://example.com<nowiki>junk</nowiki>
10803 !! result
10804 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
10805 </p>
10806 !!end
10808 !!test
10809 Fuzz testing: URL adjacent extension (no space, dirty; pre)
10810 !! options
10811 !! input
10812 http://example.com<pre>junk</pre>
10813 !! result
10814 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
10816 !!end
10818 !!test
10819 Fuzz testing: image with bogus manual thumbnail
10820 !!input
10821 [[Image:foobar.jpg|thumbnail= ]]
10822 !!result
10823 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail:   <div class="thumbcaption"></div></div></div>
10825 !!end
10827 !! test
10828 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
10829 !! input
10830 <pre dir="&#10;"></pre>
10831 !! result
10832 <pre dir="&#10;"></pre>
10834 !! end
10836 !! test
10837 Parsing optional HTML elements (Bug 6171)
10838 !! options
10839 !! input
10840 <table>
10841   <tr>
10842     <td> Some tabular data</td>
10843     <td> More tabular data ...
10844     <td> And yet som tabular data</td>
10845   </tr>
10846 </table>
10847 !! result
10848 <table>
10849   <tr>
10850     <td> Some tabular data</td>
10851     <td> More tabular data ...
10852     </td><td> And yet som tabular data</td>
10853   </tr>
10854 </table>
10856 !! end
10858 !! test
10859 Correct handling of <td>, <tr> (Bug 6171)
10860 !! options
10861 !! input
10862 <table>
10863   <tr>
10864     <td> Some tabular data</td>
10865     <td> More tabular data ...</td>
10866     <td> And yet som tabular data</td>
10867   </tr>
10868 </table>
10869 !! result
10870 <table>
10871   <tr>
10872     <td> Some tabular data</td>
10873     <td> More tabular data ...</td>
10874     <td> And yet som tabular data</td>
10875   </tr>
10876 </table>
10878 !! end
10881 !! test
10882 Parsing crashing regression (fr:JavaScript)
10883 !! input
10884 </body></x>
10885 !! result
10886 <p>&lt;/body&gt;&lt;/x&gt;
10887 </p>
10888 !! end
10890 !! test
10891 Inline wiki vs wiki block nesting
10892 !! input
10893 '''Bold paragraph
10895 New wiki paragraph
10896 !! result
10897 <p><b>Bold paragraph</b>
10898 </p><p>New wiki paragraph
10899 </p>
10900 !! end
10902 !! test
10903 Inline HTML vs wiki block nesting
10904 !! options
10905 disabled
10906 !! input
10907 <b>Bold paragraph
10909 New wiki paragraph
10910 !! result
10911 <p><b>Bold paragraph</b>
10912 </p><p>New wiki paragraph
10913 </p>
10914 !! end
10916 # Original result was this:
10917 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10918 # </p>
10919 # While that might be marginally more intuitive, maybe, the six-apostrophe
10920 # construct is clearly pathological and the result stated here (which is what
10921 # the parser actually does) is about as reasonable as anything.
10922 !!test
10923 Mixing markup for italics and bold
10924 !! options
10925 !! input
10926 '''bold''''''bold''bolditalics'''''
10927 !! result
10928 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
10929 </p>
10930 !! end
10933 !! article
10934 Xyzzyx
10935 !! text
10936 Article for special page transclusion test
10937 !! endarticle
10939 !! test
10940 Special page transclusion
10941 !! options
10942 !! input
10943 {{Special:Prefixindex/Xyzzyx}}
10944 !! result
10945 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10947 !! end
10949 !! test
10950 Special page transclusion twice (bug 5021)
10951 !! options
10952 !! input
10953 {{Special:Prefixindex/Xyzzyx}}
10954 {{Special:Prefixindex/Xyzzyx}}
10955 !! result
10956 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10957 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10959 !! end
10961 !! test
10962 Transclusion of default MediaWiki message
10963 !! input
10964 {{MediaWiki:Mainpage}}
10965 !!result
10966 <p>Main Page
10967 </p>
10968 !! end
10970 !! test
10971 Transclusion of nonexistent MediaWiki message
10972 !! input
10973 {{MediaWiki:Mainpagexxx}}
10974 !!result
10975 <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>
10976 </p>
10977 !! end
10979 !! test
10980 Transclusion of MediaWiki message with underscore
10981 !! input
10982 {{MediaWiki:history_short}}
10983 !! result
10984 <p>History
10985 </p>
10986 !! end
10988 !! test
10989 Transclusion of MediaWiki message with space
10990 !! input
10991 {{MediaWiki:history short}}
10992 !! result
10993 <p>History
10994 </p>
10995 !! end
10997 !! test
10998 Invalid header with following text
10999 !! input
11000 = x = y
11001 !! result
11002 <p>= x = y
11003 </p>
11004 !! end
11007 !! test
11008 Section extraction test (section 0)
11009 !! options
11010 section=0
11011 !! input
11012 start
11013 ==a==
11014 ===aa===
11015 ====aaa====
11016 ==b==
11017 ===ba===
11018 ===bb===
11019 ====bba====
11020 ===bc===
11021 ==c==
11022 ===ca===
11023 !! result
11024 start
11025 !! end
11027 !! test
11028 Section extraction test (section 1)
11029 !! options
11030 section=1
11031 !! input
11032 start
11033 ==a==
11034 ===aa===
11035 ====aaa====
11036 ==b==
11037 ===ba===
11038 ===bb===
11039 ====bba====
11040 ===bc===
11041 ==c==
11042 ===ca===
11043 !! result
11044 ==a==
11045 ===aa===
11046 ====aaa====
11047 !! end
11049 !! test
11050 Section extraction test (section 2)
11051 !! options
11052 section=2
11053 !! input
11054 start
11055 ==a==
11056 ===aa===
11057 ====aaa====
11058 ==b==
11059 ===ba===
11060 ===bb===
11061 ====bba====
11062 ===bc===
11063 ==c==
11064 ===ca===
11065 !! result
11066 ===aa===
11067 ====aaa====
11068 !! end
11070 !! test
11071 Section extraction test (section 3)
11072 !! options
11073 section=3
11074 !! input
11075 start
11076 ==a==
11077 ===aa===
11078 ====aaa====
11079 ==b==
11080 ===ba===
11081 ===bb===
11082 ====bba====
11083 ===bc===
11084 ==c==
11085 ===ca===
11086 !! result
11087 ====aaa====
11088 !! end
11090 !! test
11091 Section extraction test (section 4)
11092 !! options
11093 section=4
11094 !! input
11095 start
11096 ==a==
11097 ===aa===
11098 ====aaa====
11099 ==b==
11100 ===ba===
11101 ===bb===
11102 ====bba====
11103 ===bc===
11104 ==c==
11105 ===ca===
11106 !! result
11107 ==b==
11108 ===ba===
11109 ===bb===
11110 ====bba====
11111 ===bc===
11112 !! end
11114 !! test
11115 Section extraction test (section 5)
11116 !! options
11117 section=5
11118 !! input
11119 start
11120 ==a==
11121 ===aa===
11122 ====aaa====
11123 ==b==
11124 ===ba===
11125 ===bb===
11126 ====bba====
11127 ===bc===
11128 ==c==
11129 ===ca===
11130 !! result
11131 ===ba===
11132 !! end
11134 !! test
11135 Section extraction test (section 6)
11136 !! options
11137 section=6
11138 !! input
11139 start
11140 ==a==
11141 ===aa===
11142 ====aaa====
11143 ==b==
11144 ===ba===
11145 ===bb===
11146 ====bba====
11147 ===bc===
11148 ==c==
11149 ===ca===
11150 !! result
11151 ===bb===
11152 ====bba====
11153 !! end
11155 !! test
11156 Section extraction test (section 7)
11157 !! options
11158 section=7
11159 !! input
11160 start
11161 ==a==
11162 ===aa===
11163 ====aaa====
11164 ==b==
11165 ===ba===
11166 ===bb===
11167 ====bba====
11168 ===bc===
11169 ==c==
11170 ===ca===
11171 !! result
11172 ====bba====
11173 !! end
11175 !! test
11176 Section extraction test (section 8)
11177 !! options
11178 section=8
11179 !! input
11180 start
11181 ==a==
11182 ===aa===
11183 ====aaa====
11184 ==b==
11185 ===ba===
11186 ===bb===
11187 ====bba====
11188 ===bc===
11189 ==c==
11190 ===ca===
11191 !! result
11192 ===bc===
11193 !! end
11195 !! test
11196 Section extraction test (section 9)
11197 !! options
11198 section=9
11199 !! input
11200 start
11201 ==a==
11202 ===aa===
11203 ====aaa====
11204 ==b==
11205 ===ba===
11206 ===bb===
11207 ====bba====
11208 ===bc===
11209 ==c==
11210 ===ca===
11211 !! result
11212 ==c==
11213 ===ca===
11214 !! end
11216 !! test
11217 Section extraction test (section 10)
11218 !! options
11219 section=10
11220 !! input
11221 start
11222 ==a==
11223 ===aa===
11224 ====aaa====
11225 ==b==
11226 ===ba===
11227 ===bb===
11228 ====bba====
11229 ===bc===
11230 ==c==
11231 ===ca===
11232 !! result
11233 ===ca===
11234 !! end
11236 !! test
11237 Section extraction test (nonexistent section 11)
11238 !! options
11239 section=11
11240 !! input
11241 start
11242 ==a==
11243 ===aa===
11244 ====aaa====
11245 ==b==
11246 ===ba===
11247 ===bb===
11248 ====bba====
11249 ===bc===
11250 ==c==
11251 ===ca===
11252 !! result
11253 !! end
11255 !! test
11256 Section extraction test with bogus heading (section 1)
11257 !! options
11258 section=1
11259 !! input
11260 ==a==
11261 ==bogus== not a legal section
11262 ==b==
11263 !! result
11264 ==a==
11265 ==bogus== not a legal section
11266 !! end
11268 !! test
11269 Section extraction test with bogus heading (section 2)
11270 !! options
11271 section=2
11272 !! input
11273 ==a==
11274 ==bogus== not a legal section
11275 ==b==
11276 !! result
11277 ==b==
11278 !! end
11280 !! test
11281 Section extraction test with comment after heading (section 1)
11282 !! options
11283 section=1
11284 !! input
11285 ==a==
11286 ==b== <!-- -->
11287 ==c==
11288 !! result
11289 ==a==
11290 !! end
11292 !! test
11293 Section extraction test with comment after heading (section 2)
11294 !! options
11295 section=2
11296 !! input
11297 ==a==
11298 ==b== <!-- -->
11299 ==c==
11300 !! result
11301 ==b== <!-- -->
11302 !! end
11304 !! test
11305 Section extraction test with bogus <nowiki> heading (section 1)
11306 !! options
11307 section=1
11308 !! input
11309 ==a==
11310 ==bogus== <nowiki>not a legal section</nowiki>
11311 ==b==
11312 !! result
11313 ==a==
11314 ==bogus== <nowiki>not a legal section</nowiki>
11315 !! end
11317 !! test
11318 Section extraction test with bogus <nowiki> heading (section 2)
11319 !! options
11320 section=2
11321 !! input
11322 ==a==
11323 ==bogus== <nowiki>not a legal section</nowiki>
11324 ==b==
11325 !! result
11326 ==b==
11327 !! end
11330 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
11331 # instead of respecting commented sections
11332 !! test
11333 Section extraction prefixed by comment (section 1)
11334 !! options
11335 section=1
11336 !! input
11337 <!-- -->==sec1==
11338 ==sec2==
11339 !!result
11340 ==sec2==
11341 !!end
11343 !! test
11344 Section extraction prefixed by comment (section 2)
11345 !! options
11346 section=2
11347 !! input
11348 <!-- -->==sec1==
11349 ==sec2==
11350 !!result
11352 !!end
11355 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
11356 # instead of respecting HTML-style headings
11357 !! test
11358 Section extraction, mixed wiki and html (section 1)
11359 !! options
11360 section=1
11361 !! input
11362 <h2>unmarked</h2>
11363 unmarked
11364 ==1==
11366 ==2==
11368 !! result
11369 ==1==
11371 !! end
11373 !! test
11374 Section extraction, mixed wiki and html (section 2)
11375 !! options
11376 section=2
11377 !! input
11378 <h2>unmarked</h2>
11379 unmarked
11380 ==1==
11382 ==2==
11384 !! result
11385 ==2==
11387 !! end
11390 # Formerly testing for bug 3342
11391 !! test
11392 Section extraction, heading surrounded by <noinclude>
11393 !! options
11394 section=1
11395 !! input
11396 <noinclude>==unmarked==</noinclude>
11397 ==marked==
11398 !! result
11399 ==marked==
11400 !!end
11402 # Test behavior of bug 19910
11403 !! test
11404 Sectiion with all-equals
11405 !! options
11406 section=2
11407 !! input
11408 === 
11409 The line above must have a trailing space
11410 === <!--
11411 --> <!-- -->
11412 But just in case it doesn't...
11413 !! result
11414 === <!--
11415 --> <!-- -->
11416 But just in case it doesn't...
11417 !! end
11419 !! test
11420 Section replacement test (section 0)
11421 !! options
11422 replace=0,"xxx"
11423 !! input
11424 start
11425 ==a==
11426 ===aa===
11427 ====aaa====
11428 ==b==
11429 ===ba===
11430 ===bb===
11431 ====bba====
11432 ===bc===
11433 ==c==
11434 ===ca===
11435 !! result
11438 ==a==
11439 ===aa===
11440 ====aaa====
11441 ==b==
11442 ===ba===
11443 ===bb===
11444 ====bba====
11445 ===bc===
11446 ==c==
11447 ===ca===
11448 !! end
11450 !! test
11451 Section replacement test (section 1)
11452 !! options
11453 replace=1,"xxx"
11454 !! input
11455 start
11456 ==a==
11457 ===aa===
11458 ====aaa====
11459 ==b==
11460 ===ba===
11461 ===bb===
11462 ====bba====
11463 ===bc===
11464 ==c==
11465 ===ca===
11466 !! result
11467 start
11470 ==b==
11471 ===ba===
11472 ===bb===
11473 ====bba====
11474 ===bc===
11475 ==c==
11476 ===ca===
11477 !! end
11479 !! test
11480 Section replacement test (section 2)
11481 !! options
11482 replace=2,"xxx"
11483 !! input
11484 start
11485 ==a==
11486 ===aa===
11487 ====aaa====
11488 ==b==
11489 ===ba===
11490 ===bb===
11491 ====bba====
11492 ===bc===
11493 ==c==
11494 ===ca===
11495 !! result
11496 start
11497 ==a==
11500 ==b==
11501 ===ba===
11502 ===bb===
11503 ====bba====
11504 ===bc===
11505 ==c==
11506 ===ca===
11507 !! end
11509 !! test
11510 Section replacement test (section 3)
11511 !! options
11512 replace=3,"xxx"
11513 !! input
11514 start
11515 ==a==
11516 ===aa===
11517 ====aaa====
11518 ==b==
11519 ===ba===
11520 ===bb===
11521 ====bba====
11522 ===bc===
11523 ==c==
11524 ===ca===
11525 !! result
11526 start
11527 ==a==
11528 ===aa===
11531 ==b==
11532 ===ba===
11533 ===bb===
11534 ====bba====
11535 ===bc===
11536 ==c==
11537 ===ca===
11538 !! end
11540 !! test
11541 Section replacement test (section 4)
11542 !! options
11543 replace=4,"xxx"
11544 !! input
11545 start
11546 ==a==
11547 ===aa===
11548 ====aaa====
11549 ==b==
11550 ===ba===
11551 ===bb===
11552 ====bba====
11553 ===bc===
11554 ==c==
11555 ===ca===
11556 !! result
11557 start
11558 ==a==
11559 ===aa===
11560 ====aaa====
11563 ==c==
11564 ===ca===
11565 !! end
11567 !! test
11568 Section replacement test (section 5)
11569 !! options
11570 replace=5,"xxx"
11571 !! input
11572 start
11573 ==a==
11574 ===aa===
11575 ====aaa====
11576 ==b==
11577 ===ba===
11578 ===bb===
11579 ====bba====
11580 ===bc===
11581 ==c==
11582 ===ca===
11583 !! result
11584 start
11585 ==a==
11586 ===aa===
11587 ====aaa====
11588 ==b==
11591 ===bb===
11592 ====bba====
11593 ===bc===
11594 ==c==
11595 ===ca===
11596 !! end
11598 !! test
11599 Section replacement test (section 6)
11600 !! options
11601 replace=6,"xxx"
11602 !! input
11603 start
11604 ==a==
11605 ===aa===
11606 ====aaa====
11607 ==b==
11608 ===ba===
11609 ===bb===
11610 ====bba====
11611 ===bc===
11612 ==c==
11613 ===ca===
11614 !! result
11615 start
11616 ==a==
11617 ===aa===
11618 ====aaa====
11619 ==b==
11620 ===ba===
11623 ===bc===
11624 ==c==
11625 ===ca===
11626 !! end
11628 !! test
11629 Section replacement test (section 7)
11630 !! options
11631 replace=7,"xxx"
11632 !! input
11633 start
11634 ==a==
11635 ===aa===
11636 ====aaa====
11637 ==b==
11638 ===ba===
11639 ===bb===
11640 ====bba====
11641 ===bc===
11642 ==c==
11643 ===ca===
11644 !! result
11645 start
11646 ==a==
11647 ===aa===
11648 ====aaa====
11649 ==b==
11650 ===ba===
11651 ===bb===
11654 ===bc===
11655 ==c==
11656 ===ca===
11657 !! end
11659 !! test
11660 Section replacement test (section 8)
11661 !! options
11662 replace=8,"xxx"
11663 !! input
11664 start
11665 ==a==
11666 ===aa===
11667 ====aaa====
11668 ==b==
11669 ===ba===
11670 ===bb===
11671 ====bba====
11672 ===bc===
11673 ==c==
11674 ===ca===
11675 !! result
11676 start
11677 ==a==
11678 ===aa===
11679 ====aaa====
11680 ==b==
11681 ===ba===
11682 ===bb===
11683 ====bba====
11686 ==c==
11687 ===ca===
11688 !!end
11690 !! test
11691 Section replacement test (section 9)
11692 !! options
11693 replace=9,"xxx"
11694 !! input
11695 start
11696 ==a==
11697 ===aa===
11698 ====aaa====
11699 ==b==
11700 ===ba===
11701 ===bb===
11702 ====bba====
11703 ===bc===
11704 ==c==
11705 ===ca===
11706 !! result
11707 start
11708 ==a==
11709 ===aa===
11710 ====aaa====
11711 ==b==
11712 ===ba===
11713 ===bb===
11714 ====bba====
11715 ===bc===
11717 !! end
11719 !! test
11720 Section replacement test (section 10)
11721 !! options
11722 replace=10,"xxx"
11723 !! input
11724 start
11725 ==a==
11726 ===aa===
11727 ====aaa====
11728 ==b==
11729 ===ba===
11730 ===bb===
11731 ====bba====
11732 ===bc===
11733 ==c==
11734 ===ca===
11735 !! result
11736 start
11737 ==a==
11738 ===aa===
11739 ====aaa====
11740 ==b==
11741 ===ba===
11742 ===bb===
11743 ====bba====
11744 ===bc===
11745 ==c==
11747 !! end
11749 !! test
11750 Section replacement test with initial whitespace (bug 13728)
11751 !! options
11752 replace=2,"xxx"
11753 !! input
11754  Preformatted initial line
11755 ==a==
11756 ===a===
11757 !! result
11758  Preformatted initial line
11759 ==a==
11761 !! end
11764 !! test
11765 Section extraction, heading followed by pre with 20 spaces (bug 6398)
11766 !! options
11767 section=1
11768 !! input
11769 ==a==
11770                     a
11771 !! result
11772 ==a==
11773                     a
11774 !! end
11776 !! test
11777 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
11778 !! options
11779 section=1
11780 !! input
11781 ==a==
11782                    a
11783 !! result
11784 ==a==
11785                    a
11786 !! end
11789 !! test
11790 Section extraction, <pre> around bogus header (bug 10309)
11791 !! options
11792 noxml section=2
11793 !! input
11794 == Section One ==
11795 <pre>
11796 =======
11797 </pre>
11799 == Section Two ==
11800 stuff
11801 !! result
11802 == Section Two ==
11803 stuff
11804 !! end
11806 !! test
11807 Section replacement, <pre> around bogus header (bug 10309)
11808 !! options
11809 noxml replace=2,"xxx"
11810 !! input
11811 == Section One ==
11812 <pre>
11813 =======
11814 </pre>
11816 == Section Two ==
11817 stuff
11818 !! result
11819 == Section One ==
11820 <pre>
11821 =======
11822 </pre>
11825 !! end
11829 !! test
11830 Handling of &#x0A; in URLs
11831 !! input
11832 **irc://&#x0A;a
11833 !! result
11834 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
11835 </li></ul>
11836 </li></ul>
11838 !!end
11840 !! test
11841 5 quotes, code coverage +1 line (php)
11842 !! options
11844 !! input
11845 '''''
11846 !! result
11847 !! end
11848 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
11849 !! test
11850 5 quotes, code coverage +1 line (parsoid)
11851 !! options
11852 parsoid
11853 !! input
11854 '''''
11855 !! result
11856 <p><i><b></b></i></p>
11857 !! end
11859 !! test
11860 Special:Search page linking.
11861 !! input
11862 {{Special:search}}
11863 !! result
11864 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
11865 </p>
11866 !! end
11868 !! test
11869 Say the magic word
11870 !! input
11871 * {{PAGENAME}}
11872 * {{BASEPAGENAME}}
11873 * {{SUBPAGENAME}}
11874 * {{SUBPAGENAMEE}}
11875 * {{ROOTPAGENAME}}
11876 * {{ROOTPAGENAMEE}}
11877 * {{BASEPAGENAME}}
11878 * {{BASEPAGENAMEE}}
11879 * {{TALKPAGENAME}}
11880 * {{TALKPAGENAMEE}}
11881 * {{SUBJECTPAGENAME}}
11882 * {{SUBJECTPAGENAMEE}}
11883 * {{NAMESPACEE}}
11884 * {{NAMESPACE}}
11885 * {{TALKSPACE}}
11886 * {{TALKSPACEE}}
11887 * {{SUBJECTSPACE}}
11888 * {{SUBJECTSPACEE}}
11889 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
11890 !! result
11891 <ul><li> Parser test
11892 </li><li> Parser test
11893 </li><li> Parser test
11894 </li><li> Parser_test
11895 </li><li> Parser test
11896 </li><li> Parser_test
11897 </li><li> Parser test
11898 </li><li> Parser_test
11899 </li><li> Talk:Parser test
11900 </li><li> Talk:Parser_test
11901 </li><li> Parser test
11902 </li><li> Parser_test
11903 </li><li> 
11904 </li><li> 
11905 </li><li> Talk
11906 </li><li> Talk
11907 </li><li> 
11908 </li><li> 
11909 </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>
11910 </li></ul>
11912 !! end
11913 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
11915 !! test
11916 Gallery
11917 !! input
11918 <gallery>
11919 image1.png |
11920 image2.gif|||||
11922 image3|
11923 image4    |300px| centre
11924  image5.svg| http://///////
11925 [[x|xx]]]]
11926 * image6
11927 </gallery>
11928 !! result
11929 <ul class="gallery">
11930                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11931                         <div style="height: 150px;">Image1.png</div>
11932                         <div class="gallerytext">
11933                         </div>
11934                 </div></li>
11935                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11936                         <div style="height: 150px;">Image2.gif</div>
11937                         <div class="gallerytext">
11938 <p>||||
11939 </p>
11940                         </div>
11941                 </div></li>
11942                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11943                         <div style="height: 150px;">Image3</div>
11944                         <div class="gallerytext">
11945                         </div>
11946                 </div></li>
11947                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11948                         <div style="height: 150px;">Image4</div>
11949                         <div class="gallerytext">
11950 <p>300px| centre
11951 </p>
11952                         </div>
11953                 </div></li>
11954                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11955                         <div style="height: 150px;">Image5.svg</div>
11956                         <div class="gallerytext">
11957 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
11958 </p>
11959                         </div>
11960                 </div></li>
11961                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11962                         <div style="height: 150px;">* image6</div>
11963                         <div class="gallerytext">
11964                         </div>
11965                 </div></li>
11966 </ul>
11968 !! end
11970 !! test
11971 Gallery (with options)
11972 !! input
11973 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
11974 File:Nonexistant.jpg|caption
11975 File:Nonexistant.jpg
11976 image:foobar.jpg|some '''caption''' [[Main Page]]
11977 image:foobar.jpg
11978 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
11979 </gallery>
11980 !! result
11981 <ul class="gallery" style="max-width: 226px;_width: 226px;">
11982         <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
11983                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11984                         <div style="height: 70px;">Nonexistant.jpg</div>
11985                         <div class="gallerytext">
11986 <p>caption
11987 </p>
11988                         </div>
11989                 </div></li>
11990                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11991                         <div style="height: 70px;">Nonexistant.jpg</div>
11992                         <div class="gallerytext">
11993                         </div>
11994                 </div></li>
11995                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11996                         <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>
11997                         <div class="gallerytext">
11998 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11999 </p>
12000                         </div>
12001                 </div></li>
12002                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12003                         <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>
12004                         <div class="gallerytext">
12005                         </div>
12006                 </div></li>
12007                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12008                         <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>
12009                         <div class="gallerytext">
12010 <p>Blabla|blabla.
12011 </p>
12012                         </div>
12013                 </div></li>
12014 </ul>
12016 !! end
12018 !! test
12019 Gallery with wikitext inside caption
12020 !! input
12021 <gallery>
12022 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
12023 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
12024 </gallery>
12025 !! result
12026 <ul class="gallery">
12027                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12028                         <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>
12029                         <div class="gallerytext">
12030 <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>
12031 </p>
12032                         </div>
12033                 </div></li>
12034                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12035                         <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>
12036                         <div class="gallerytext">
12037 <p>This is a test template
12038 </p>
12039                         </div>
12040                 </div></li>
12041 </ul>
12043 !! end
12045 !! test
12046 gallery (with showfilename option)
12047 !! input
12048 <gallery showfilename>
12049 File:Nonexistant.jpg|caption
12050 File:Nonexistant.jpg
12051 image:foobar.jpg|some '''caption''' [[Main Page]]
12052 File:Foobar.jpg
12053 </gallery>
12054 !! result
12055 <ul class="gallery">
12056                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12057                         <div style="height: 150px;">Nonexistant.jpg</div>
12058                         <div class="gallerytext">
12059 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12060 caption
12061 </p>
12062                         </div>
12063                 </div></li>
12064                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12065                         <div style="height: 150px;">Nonexistant.jpg</div>
12066                         <div class="gallerytext">
12067 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12068 </p>
12069                         </div>
12070                 </div></li>
12071                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12072                         <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>
12073                         <div class="gallerytext">
12074 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12075 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12076 </p>
12077                         </div>
12078                 </div></li>
12079                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12080                         <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>
12081                         <div class="gallerytext">
12082 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12083 </p>
12084                         </div>
12085                 </div></li>
12086 </ul>
12088 !! end
12090 !! test
12091 Gallery (with namespace-less filenames)
12092 !! input
12093 <gallery>
12094 File:Nonexistant.jpg
12095 Nonexistant.jpg
12096 image:foobar.jpg
12097 foobar.jpg
12098 </gallery>
12099 !! result
12100 <ul class="gallery">
12101                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12102                         <div style="height: 150px;">Nonexistant.jpg</div>
12103                         <div class="gallerytext">
12104                         </div>
12105                 </div></li>
12106                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12107                         <div style="height: 150px;">Nonexistant.jpg</div>
12108                         <div class="gallerytext">
12109                         </div>
12110                 </div></li>
12111                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12112                         <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>
12113                         <div class="gallerytext">
12114                         </div>
12115                 </div></li>
12116                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12117                         <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>
12118                         <div class="gallerytext">
12119                         </div>
12120                 </div></li>
12121 </ul>
12123 !! end
12125 !! test
12126 HTML Hex character encoding (spells the word "JavaScript")
12127 !! input
12128 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
12129 !! result
12130 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
12131 </p>
12132 !! end
12134 !! test
12135 HTML Hex character encoding bogus encoding (bug 26437 regression check)
12136 !! input
12137 &#xsee;&#XSEE;
12138 !! result
12139 <p>&amp;#xsee;&amp;#XSEE;
12140 </p>
12141 !! end
12143 !! test
12144 HTML Hex character encoding mixed case
12145 !! input
12146 &#xEE;&#Xee;
12147 !! result
12148 <p>&#xee;&#xee;
12149 </p>
12150 !! end
12152 !! test
12153 __FORCETOC__ override
12154 !! input
12155 __NEWSECTIONLINK__
12156 __FORCETOC__
12157 !! result
12158 <p><br />
12159 </p>
12160 !! end
12162 !! test
12163 ISBN code coverage
12164 !! input
12165 ISBN  978-0-1234-56&#x20;789
12166 !! result
12167 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
12168 </p>
12169 !! end
12171 !! test
12172 ISBN followed by 5 spaces
12173 !! input
12174 ISBN    
12175 !! result
12176 <p>ISBN    
12177 </p>
12178 !! end
12180 !! test
12181 Double ISBN
12182 !! input
12183 ISBN ISBN 1234567890
12184 !! result
12185 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12186 </p>
12187 !! end
12189 !! test
12190 Bug 22905: <abbr> followed by ISBN followed by </a>
12191 !! input
12192 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
12193 !! result
12194 <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>
12195 </p>
12196 !! end
12198 !! test
12199 Double RFC
12200 !! input
12201 RFC RFC 1234
12202 !! result
12203 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
12204 </p>
12205 !! end
12207 !! test
12208 Double RFC with a wiki link
12209 !! input
12210 RFC [[RFC 1234]]
12211 !! result
12212 <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>
12213 </p>
12214 !! end
12216 !! test
12217 RFC code coverage
12218 !! input
12219 RFC   983&#x20;987
12220 !! result
12221 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
12222 </p>
12223 !! end
12225 !! test
12226 Centre-aligned image
12227 !! input
12228 [[Image:foobar.jpg|centre]]
12229 !! result
12230 <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>
12232 !!end
12234 !! test
12235 None-aligned image
12236 !! input
12237 [[Image:foobar.jpg|none]]
12238 !! result
12239 <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>
12241 !!end
12243 !! test
12244 Width + Height sized image (using px) (height is ignored)
12245 !! input
12246 [[Image:foobar.jpg|640x480px]]
12247 !! result
12248 <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>
12249 </p>
12250 !!end
12252 !! test
12253 Width-sized image (using px, no following whitespace)
12254 !! input
12255 [[Image:foobar.jpg|640px]]
12256 !! result
12257 <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>
12258 </p>
12259 !!end
12261 !! test
12262 Width-sized image (using px, with following whitespace - test regression from r39467)
12263 !! input
12264 [[Image:foobar.jpg|640px ]]
12265 !! result
12266 <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>
12267 </p>
12268 !!end
12270 !! test
12271 Width-sized image (using px, with preceding whitespace - test regression from r39467)
12272 !! input
12273 [[Image:foobar.jpg| 640px]]
12274 !! result
12275 <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>
12276 </p>
12277 !!end
12279 !! test
12280 Another italics / bold test
12281 !! input
12282  ''' ''x'
12283 !! result
12284 <pre>'<i> </i>x'
12285 </pre>
12286 !!end
12288 # Note the results may be incorrect, as parserTest output included this:
12289 # XML error: Mismatched tag at byte 6120:
12290 # ...<dd> </dt></dl> </dd...
12291 !! test
12292 dt/dd/dl test
12293 !! options
12294 disabled
12295 !! input
12296 :;;;::
12297 !! result
12298 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
12299 </dd></dl>
12300 </dd></dl>
12301 </dt></dl>
12302 </dt></dl>
12303 </dt></dl>
12304 </dd></dl>
12306 !!end
12309 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
12310 !! test
12311 Images with the "|" character in the comment
12312 !! input
12313 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
12314 !! result
12315 <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>
12317 !!end
12319 !! test
12320 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
12321 !! input
12322 <html><script>alert(1);</script></html>
12323 !! result
12324 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
12325 </p>
12326 !! end
12328 !! test
12329 HTML with raw HTML ($wgRawHtml==true)
12330 !! options
12331 wgRawHtml=1
12332 !! input
12333 <html><script>alert(1);</script></html>
12334 !! result
12335 <p><script>alert(1);</script>
12336 </p>
12337 !! end
12339 !! test
12340 Parents of subpages, one level up
12341 !! options
12342 subpage title=[[Subpage test/L1/L2/L3]]
12343 !! input
12344 [[../|L2]]
12345 !! result
12346 <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>
12347 </p>
12348 !! end
12351 !! test
12352 Parents of subpages, one level up, not named
12353 !! options
12354 subpage title=[[Subpage test/L1/L2/L3]]
12355 !! input
12356 [[../]]
12357 !! result
12358 <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>
12359 </p>
12360 !! end
12364 !! test
12365 Parents of subpages, two levels up
12366 !! options
12367 subpage title=[[Subpage test/L1/L2/L3]]
12368 !! input
12369 [[../../|L1]]2
12371 [[../../|L1]]l
12372 !! result
12373 <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
12374 </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>
12375 </p>
12376 !! end
12378 !! test
12379 Parents of subpages, two levels up, without trailing slash or name.
12380 !! options
12381 subpage title=[[Subpage test/L1/L2/L3]]
12382 !! input
12383 [[../..]]
12384 !! result
12385 <p>[[../..]]
12386 </p>
12387 !! end
12389 !! test
12390 Parents of subpages, two levels up, with lots of extra trailing slashes.
12391 !! options
12392 subpage title=[[Subpage test/L1/L2/L3]]
12393 !! input
12394 [[../../////]]
12395 !! result
12396 <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>
12397 </p>
12398 !! end
12400 !! article
12401 Subpage test/L1/L2/L3Sibling
12402 !! text
12403 Sibling article
12404 !! endarticle
12406 !! test
12407 Transclusion of a sibling page (one level up)
12408 !! options
12409 subpage title=[[Subpage test/L1/L2/L3]]
12410 !! input
12411 {{../L3Sibling}}
12412 !! result
12413 <p>Sibling article
12414 </p>
12415 !! end
12417 !! test
12418 Transclusion of a child page
12419 !! options
12420 subpage title=[[Subpage test/L1/L2]]
12421 !! input
12422 {{/L3Sibling}}
12423 !! result
12424 <p>Sibling article
12425 </p>
12426 !! end
12428 !! test
12429 Non-transclusion because of too many up levels
12430 !! options
12431 subpage title=[[Subpage test/L1/L2/L3]]
12432 !! input
12433 {{../../../../More than parent}}
12434 !! result
12435 <p>{{../../../../More than parent}}
12436 </p>
12437 !! end
12439 !! test
12440 Definition list code coverage
12441 !! input
12442 ; title   : def
12443 ; title : def
12444 ;title: def
12445 !! result
12446 <dl><dt> title  &#160;</dt><dd> def
12447 </dd><dt> title&#160;</dt><dd> def
12448 </dd><dt>title</dt><dd> def
12449 </dd></dl>
12451 !! end
12453 !! test
12454 Don't fall for the self-closing div
12455 !! input
12456 <div>hello world</div/>
12457 !! result
12458 <div>hello world</div>
12460 !! end
12462 !! test
12463 MSGNW magic word
12464 !! input
12465 {{MSGNW:msg}}
12466 !! result
12467 <p>&#91;&#91;:Template:Msg&#93;&#93;
12468 </p>
12469 !! end
12471 !! test
12472 RAW magic word
12473 !! input
12474 {{RAW:QUERTY}}
12475 !! result
12476 <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>
12477 </p>
12478 !! end
12480 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
12481 !! test
12482 Always escape literal '>' in output, not just after '<'
12483 !! input
12485 !! result
12486 <p>&gt;&lt;&gt;
12487 </p>
12488 !! end
12490 !! test
12491 Template caching
12492 !! input
12493 {{Test}}
12494 {{Test}}
12495 !! result
12496 <p>This is a test template
12497 This is a test template
12498 </p>
12499 !! end
12502 !! article
12503 MediaWiki:Fake
12504 !! text
12505 ==header==
12506 !! endarticle
12508 !! test
12509 Inclusion of !userCanEdit() content
12510 !! input
12511 {{MediaWiki:Fake}}
12512 !! result
12513 <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>
12515 !! end
12518 !! test
12519 Out-of-order TOC heading levels
12520 !! input
12521 ==2==
12522 ======6======
12523 ===3===
12525 =====5=====
12526 ==2==
12527 !! result
12528 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12529 <ul>
12530 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
12531 <ul>
12532 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
12533 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
12534 </ul>
12535 </li>
12536 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
12537 <ul>
12538 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
12539 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
12540 </ul>
12541 </li>
12542 </ul>
12543 </div>
12544 <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>
12545 <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>
12546 <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>
12547 <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>
12548 <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>
12549 <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>
12551 !! end
12554 !! test
12555 ISBN with a dummy number
12556 !! input
12557 ISBN ---
12558 !! result
12559 <p>ISBN ---
12560 </p>
12561 !! end
12564 !! test
12565 ISBN with space-delimited number
12566 !! input
12567 ISBN 92 9017 032 8
12568 !! result
12569 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
12570 </p>
12571 !! end
12574 !! test
12575 ISBN with multiple spaces, no number
12576 !! input
12577 ISBN  foo
12578 !! result
12579 <p>ISBN  foo
12580 </p>
12581 !! end
12584 !! test
12585 ISBN length
12586 !! input
12587 ISBN 123456789
12589 ISBN 1234567890
12591 ISBN 12345678901
12592 !! result
12593 <p>ISBN 123456789
12594 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12595 </p><p>ISBN 12345678901
12596 </p>
12597 !! end
12600 !! test
12601 ISBN with trailing year (bug 8110)
12602 !! input
12603 ISBN 1-234-56789-0 - 2006
12605 ISBN 1 234 56789 0 - 2006
12606 !! result
12607 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
12608 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
12609 </p>
12610 !! end
12613 !! test
12614 anchorencode
12615 !! input
12616 {{anchorencode:foo bar©#%n}}
12617 !! result
12618 <p>foo_bar.C2.A9.23.25n
12619 </p>
12620 !! end
12622 !! test
12623 anchorencode trims spaces
12624 !! input
12625 {{anchorencode: __pretty__please__}}
12626 !! result
12627 <p>pretty_please
12628 </p>
12629 !! end
12631 !! test
12632 anchorencode deals with links
12633 !! input
12634 {{anchorencode: [[hello|world]] [[hi]]}}
12635 !! result
12636 <p>world_hi
12637 </p>
12638 !! end
12640 !! test
12641 anchorencode deals with templates
12642 !! input
12643 {{anchorencode: {{Foo}} }}
12644 !! result
12645 <p>FOO
12646 </p>
12647 !! end
12649 !! test
12650 anchorencode encodes like the TOC generator: (bug 18431)
12651 !! input
12652 === _ +:.3A%3A&&amp;]] ===
12653 {{anchorencode: _ +:.3A%3A&&amp;]] }}
12654 __NOEDITSECTION__
12655 !! result
12656 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
12657 <p>.2B:.3A.253A.26.26.5D.5D
12658 </p>
12659 !! end
12661 # Expected output in the following test is not necessarily expected (there
12662 # should probably be <p> tags inside the <blockquote> in the output) -- it's
12663 # only testing for well-formedness.
12664 !! test
12665 Bug 6200: blockquotes and paragraph formatting
12666 !! input
12667 <blockquote>
12669 </blockquote>
12673  baz
12674 !! result
12675 <blockquote>
12677 </blockquote>
12678 <p>bar
12679 </p>
12680 <pre>baz
12681 </pre>
12682 !! end
12684 !! test
12685 Bug 8293: Use of center tag ruins paragraph formatting
12686 !! input
12687 <center>
12689 </center>
12693  baz
12694 !! result
12695 <center>
12696 <p>foo
12697 </p>
12698 </center>
12699 <p>bar
12700 </p>
12701 <pre>baz
12702 </pre>
12703 !! end
12705 !!test
12706 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
12707 !!options
12709 !!input
12710 <span><s>x</span></s>
12711 !!result
12712 <p><span><s>x&lt;/span&gt;</s></span>
12713 </p>
12714 !!end
12716 !!test
12717 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
12718 !!options
12719 parsoid
12720 !!input
12721 <span><s>x</span></s>
12722 !!result
12723 <p><span><s>x</s></span><s></s>
12724 </p>
12725 !!end
12728 ### Language variants related tests
12730 !! test
12731 Self-link in language variants
12732 !! options
12733 title=[[Dunav]] language=sr
12734 !! input
12735 Both [[Dunav]] and [[Дунав]] are names for this river.
12736 !! result
12737 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
12738 </p>
12739 !!end
12741 !! article
12742 Дуна
12743 !! text
12744 content
12745 !! endarticle
12747 !! test
12748 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
12749 !! options
12750 title=[[Duna]] language=sr
12751 !! input
12752 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
12753 !! result
12754 <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.
12755 </p>
12756 !! end
12758 !! test
12759 Link to pages in language variants
12760 !! options
12761 language=sr
12762 !! input
12763 Main Page can be written as [[Маин Паге]]
12764 !! result
12765 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
12766 </p>
12767 !!end
12770 !! test
12771 Multiple links to pages in language variants
12772 !! options
12773 language=sr
12774 !! input
12775 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
12776 !! result
12777 <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>.
12778 </p>
12779 !!end
12782 !! test
12783 Simple template in language variants
12784 !! options
12785 language=sr
12786 !! input
12787 {{тест}}
12788 !! result
12789 <p>This is a test template
12790 </p>
12791 !! end
12794 !! test
12795 Template with explicit namespace in language variants
12796 !! options
12797 language=sr
12798 !! input
12799 {{Template:тест}}
12800 !! result
12801 <p>This is a test template
12802 </p>
12803 !! end
12806 !! test
12807 Basic test for template parameter in language variants
12808 !! options
12809 language=sr
12810 !! input
12811 {{парамтест|param=foo}}
12812 !! result
12813 <p>This is a test template with parameter foo
12814 </p>
12815 !! end
12818 !! test
12819 Simple category in language variants
12820 !! options
12821 language=sr cat
12822 !! input
12823 [[Category:МедиаWики Усер'с Гуиде]]
12824 !! result
12825 <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>
12826 !! end
12829 !! article
12830 Category:分类
12831 !! text
12832 blah
12833 !! endarticle
12835 !! article
12836 Category:分類
12837 !! text
12838 blah
12839 !! endarticle
12841 !! test
12842 Don't convert blue categorylinks to another variant (bug 33210)
12843 !! options
12844 language=zh cat
12845 !! input
12846 [[A]][[Category:分类]]
12847 !! result
12848 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
12849 !! end
12852 !! test
12853 Stripping -{}- tags (language variants)
12854 !! options
12855 language=sr
12856 !! input
12857 Latin proverb: -{Ne nuntium necare}-
12858 !! result
12859 <p>Latin proverb: Ne nuntium necare
12860 </p>
12861 !! end
12864 !! test
12865 Prevent conversion with -{}- tags (language variants)
12866 !! options
12867 language=sr variant=sr-ec
12868 !! input
12869 Latinski: -{Ne nuntium necare}-
12870 !! result
12871 <p>Латински: Ne nuntium necare
12872 </p>
12873 !! end
12876 !! test
12877 Prevent conversion of text with -{}- tags (language variants)
12878 !! options
12879 language=sr variant=sr-ec
12880 !! input
12881 Latinski: -{Ne nuntium necare}-
12882 !! result
12883 <p>Латински: Ne nuntium necare
12884 </p>
12885 !! end
12888 !! test
12889 Prevent conversion of links with -{}- tags (language variants)
12890 !! options
12891 language=sr variant=sr-ec
12892 !! input
12893 -{[[Main Page]]}-
12894 !! result
12895 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12896 </p>
12897 !! end
12900 !! test
12901 -{}- tags within headlines (within html for parserConvert())
12902 !! options
12903 language=sr variant=sr-ec
12904 !! input
12905 == -{Naslov}- ==
12906 !! result
12907 <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>
12909 !! end
12912 !! test
12913 Explicit definition of language variant alternatives
12914 !! options
12915 language=zh variant=zh-tw
12916 !! input
12917 -{zh:China;zh-tw:Taiwan}-, not China
12918 !! result
12919 <p>Taiwan, not China
12920 </p>
12921 !! end
12924 !! test
12925 Conversion around HTML tags
12926 !! options
12927 language=sr variant=sr-ec
12928 !! input
12929 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
12930 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
12931 !! result
12933 <span title="ЛаCтин">ски</span>
12934 </p>
12935 !! end
12938 !! test
12939 Explicit session-wise language variant mapping (A flag and - flag)
12940 !! options
12941 language=zh variant=zh-tw
12942 !! input
12943 Taiwan is not China.
12944 But -{A|zh:China;zh-tw:Taiwan}- is China,
12945 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
12946 and -{China}- is China.
12947 !! result
12948 <p>Taiwan is not China.
12949 But Taiwan is Taiwan,
12950 (This should be stripped!)
12951 and China is China.
12952 </p>
12953 !! end
12955 !! test
12956 Explicit session-wise language variant mapping (H flag for hide)
12957 !! options
12958 language=zh variant=zh-tw
12959 !! input
12960 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
12961 Taiwan is China.
12962 !! result
12963 <p>(This should be stripped!)
12964 Taiwan is Taiwan.
12965 </p>
12966 !! end
12968 !! test
12969 Adding explicit conversion rule for title (T flag)
12970 !! options
12971 language=zh variant=zh-tw showtitle
12972 !! input
12973 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12974 !! result
12975 Taiwan
12976 <p>Should be stripped!
12977 </p>
12978 !! end
12980 !! test
12981 Testing that changing the language variant here in the tests actually works
12982 !! options
12983 language=zh variant=zh showtitle
12984 !! input
12985 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12986 !! result
12987 China
12988 <p>Should be stripped!
12989 </p>
12990 !! end
12992 !! test
12993 Recursive conversion of alt and title attrs shouldn't clear converter state
12994 !! options
12995 language=zh variant=zh-cn showtitle
12996 !! input
12997 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
12998 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
12999 !! result
13000 China
13002 Should be stripped<span title="Exclamation">!</span>
13003 </p>
13004 !! end
13006 !! test
13007 Bug 24072: more test on conversion rule for title
13008 !! options
13009 language=zh variant=zh-tw showtitle
13010 !! input
13011 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13012 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
13013 !! result
13014 Taiwan
13015 <p>This should be stripped!
13016 This won't take interferes with the title rule.
13017 </p>
13018 !! end
13020 !! test
13021 Partly disable title conversion if variant == main language code
13022 !! options
13023 language=zh variant=zh title=[[ZH]] showtitle
13024 !! input
13025 -{T|zh-cn:CN;zh-tw:TW}-
13026 !! result
13029 </p>
13030 !! end
13032 !! test
13033 Partly disable title conversion if variant == main language code, more
13034 !! options
13035 language=zh variant=zh title=[[ZH]] showtitle
13036 !! input
13037 -{T|TW}-
13038 !! result
13041 </p>
13042 !! end
13044 !! test
13045 Raw output of variant escape tags (R flag)
13046 !! options
13047 language=zh variant=zh-tw
13048 !! input
13049 Raw: -{R|zh:China;zh-tw:Taiwan}-
13050 !! result
13051 <p>Raw: zh:China;zh-tw:Taiwan
13052 </p>
13053 !! end
13055 !! test
13056 Nested using of manual convert syntax
13057 !! options
13058 language=zh variant=zh-hk
13059 !! input
13060 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
13061 !! result
13062 <p>Nested: Hello Hong Kong!
13063 </p>
13064 !! end
13066 !! test
13067 Proper conversion of text in external links
13068 !! options
13069 language=sr variant=sr-ec
13070 !! input
13071 http://www.google.com
13072 gopher://www.google.com
13073 [http://www.google.com http://www.google.com]
13074 [gopher://www.google.com gopher://www.google.com]
13075 [https://www.google.com irc://www.google.com]
13076 [ftp://www.google.com www.google.com/ftp://dir]
13077 [//www.google.com www.google.com]
13078 !! result
13079 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13080 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13081 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13082 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13083 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
13084 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
13085 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
13086 </p>
13087 !! end
13089 !! test
13090 Do not convert roman numbers to language variants
13091 !! options
13092 language=sr variant=sr-ec
13093 !! input
13094 Fridrih IV je car.
13095 !! result
13096 <p>Фридрих IV је цар.
13097 </p>
13098 !! end
13100 !! test
13101 Unclosed language converter markup "-{"
13102 !! options
13103 language=sr
13104 !! input
13105 -{T|hello
13106 !! result
13107 <p>-{T|hello
13108 </p>
13109 !! end
13111 !! test
13112 Don't convert raw rule "-{R|=&gt;}-" to "=>"
13113 !! options
13114 language=sr
13115 !! input
13116 -{R|=&gt;}-
13117 !! result
13118 <p>=&gt;
13119 </p>
13120 !!end
13122 !!article
13123 Template:Bullet
13124 !!text
13125 * Bar
13126 !!endarticle
13128 !! test
13129 Bug 529: Uncovered bullet
13130 !! input
13131 * Foo {{bullet}}
13132 !! result
13133 <ul><li> Foo 
13134 </li><li> Bar
13135 </li></ul>
13137 !! end
13139 # Plain MediaWiki does not remove empty lists, but tidy actually does.
13140 # Templates in Wikipedia rely on this behavior, as tidy has always been
13141 # enabled there. These tests are normally run *without* tidy, so specify the
13142 # full output here. 
13143 # To test realistic parsing behavior, apply a tidy-like transformation to both
13144 # the expected output and your parser's output.
13145 !! test
13146 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
13147 !! input
13148 ******* Foo {{bullet}}
13149 !! result
13150 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo 
13151 </li></ul>
13152 </li></ul>
13153 </li></ul>
13154 </li></ul>
13155 </li></ul>
13156 </li></ul>
13157 </li><li> Bar
13158 </li></ul>
13160 !! end
13162 !! test
13163 Bug 529: Uncovered table already at line-start
13164 !! input
13167 {{table}}
13169 !! result
13170 <p>x
13171 </p>
13172 <table>
13173 <tr>
13174 <td> 1 </td>
13175 <td> 2
13176 </td></tr>
13177 <tr>
13178 <td> 3 </td>
13179 <td> 4
13180 </td></tr></table>
13181 <p>y
13182 </p>
13183 !! end
13185 !! test
13186 Bug 529: Uncovered bullet in parser function result
13187 !! input
13188 * Foo {{lc:{{bullet}} }}
13189 !! result
13190 <ul><li> Foo 
13191 </li><li> bar
13192 </li></ul>
13194 !! end
13196 !! test
13197 Bug 5678: Double-parsed template argument
13198 !! input
13199 {{lc:{{{1}}}|hello}}
13200 !! result
13201 <p>{{{1}}}
13202 </p>
13203 !! end
13205 !! test
13206 Bug 5678: Double-parsed template invocation
13207 !! input
13208 {{lc:{{paramtest {{!}} param = hello }} }}
13209 !! result
13210 <p>{{paramtest | param = hello }}
13211 </p>
13212 !! end
13214 !! test
13215 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
13216 !! options
13217 language=cs
13218 title=[[Main Page]]
13219 !! input
13220 {{PRVNÍVELKÉ:ěščř}}
13221 {{prvnívelké:ěščř}}
13222 {{PRVNÍMALÉ:ěščř}}
13223 {{prvnímalé:ěščř}}
13224 {{MALÁ:ěščř}}
13225 {{malá:ěščř}}
13226 {{VELKÁ:ěščř}}
13227 {{velká:ěščř}}
13228 !! result
13229 <p>Ěščř
13230 Ěščř
13231 ěščř
13232 ěščř
13233 ěščř
13234 ěščř
13235 ĚŠČŘ
13236 ĚŠČŘ
13237 </p>
13238 !! end
13240 !! test
13241 Morwen/13: Unclosed link followed by heading
13242 !! input
13243 [[link
13244 ==heading==
13245 !! result
13246 <p>[[link
13247 </p>
13248 <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>
13250 !! end
13252 !! test
13253 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
13254 !! input
13255 {{foo|
13256 =heading=
13257 !! result
13258 <p>{{foo|
13259 </p>
13260 <h1><span class="mw-headline" id="heading">heading</span></h1>
13262 !! end
13264 !! test
13265 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
13266 !! input
13267 {{foo|
13268 ==heading==
13269 !! result
13270 <p>{{foo|
13271 </p>
13272 <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>
13274 !! end
13276 !! test
13277 Tildes in comments
13278 !! options
13280 !! input
13281 <!-- ~~~~ -->
13282 !! result
13283 <!-- ~~~~ -->
13284 !! end
13286 !! test
13287 Paragraphs inside divs (no extra line breaks)
13288 !! input
13289 <div>Line one
13291 Line two</div>
13292 !! result
13293 <div>Line one
13294 Line two</div>
13296 !! end
13298 !! test
13299 Paragraphs inside divs (extra line break on open)
13300 !! input
13301 <div>
13302 Line one
13304 Line two</div>
13305 !! result
13306 <div>
13307 <p>Line one
13308 </p>
13309 Line two</div>
13311 !! end
13313 !! test
13314 Paragraphs inside divs (extra line break on close)
13315 !! input
13316 <div>Line one
13318 Line two
13319 </div>
13320 !! result
13321 <div>Line one
13322 <p>Line two
13323 </p>
13324 </div>
13326 !! end
13328 !! test
13329 Paragraphs inside divs (extra line break on open and close)
13330 !! input
13331 <div>
13332 Line one
13334 Line two
13335 </div>
13336 !! result
13337 <div>
13338 <p>Line one
13339 </p><p>Line two
13340 </p>
13341 </div>
13343 !! end
13345 !! test
13346 Nesting tags, paragraphs on lines which begin with <div>
13347 !! options
13348 disabled
13349 !! input
13350 <div></div><strong>A
13351 B</strong>
13352 !! result
13353 <div></div>
13354 <p><strong>A
13355 B</strong>
13356 </p>
13357 !! end
13359 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
13360 !! test
13361 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
13362 !! options
13363 disabled
13364 !! input
13365 <blockquote>Line one
13367 Line two</blockquote>
13368 !! result
13369 <blockquote>Line one
13370 Line two</blockquote>
13372 !! end
13374 !! test
13375 Bug 6200: paragraphs inside blockquotes (extra line break on open)
13376 !! options
13377 disabled
13378 !! input
13379 <blockquote>
13380 Line one
13382 Line two</blockquote>
13383 !! result
13384 <blockquote>
13385 <p>Line one
13386 </p>
13387 Line two</blockquote>
13389 !! end
13391 !! test
13392 Bug 6200: paragraphs inside blockquotes (extra line break on close)
13393 !! options
13394 disabled
13395 !! input
13396 <blockquote>Line one
13398 Line two
13399 </blockquote>
13400 !! result
13401 <blockquote>Line one
13402 <p>Line two
13403 </p>
13404 </blockquote>
13406 !! end
13408 !! test
13409 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
13410 !! options
13411 disabled
13412 !! input
13413 <blockquote>
13414 Line one
13416 Line two
13417 </blockquote>
13418 !! result
13419 <blockquote>
13420 <p>Line one
13421 </p><p>Line two
13422 </p>
13423 </blockquote>
13425 !! end
13427 !! test
13428 Paragraphs inside blockquotes/divs (no extra line breaks)
13429 !! input
13430 <blockquote><div>Line one
13432 Line two</div></blockquote>
13433 !! result
13434 <blockquote><div>Line one
13435 Line two</div></blockquote>
13437 !! end
13439 !! test
13440 Paragraphs inside blockquotes/divs (extra line break on open)
13441 !! input
13442 <blockquote><div>
13443 Line one
13445 Line two</div></blockquote>
13446 !! result
13447 <blockquote><div>
13448 <p>Line one
13449 </p>
13450 Line two</div></blockquote>
13452 !! end
13454 !! test
13455 Paragraphs inside blockquotes/divs (extra line break on close)
13456 !! input
13457 <blockquote><div>Line one
13459 Line two
13460 </div></blockquote>
13461 !! result
13462 <blockquote><div>Line one
13463 <p>Line two
13464 </p>
13465 </div></blockquote>
13467 !! end
13469 !! test
13470 Paragraphs inside blockquotes/divs (extra line break on open and close)
13471 !! input
13472 <blockquote><div>
13473 Line one
13475 Line two
13476 </div></blockquote>
13477 !! result
13478 <blockquote><div>
13479 <p>Line one
13480 </p><p>Line two
13481 </p>
13482 </div></blockquote>
13484 !! end
13486 !! test
13487 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
13488 !! options
13489 wgLinkHolderBatchSize=0
13490 !! input
13491 [[meatball:1]]
13492 [[meatball:2]]
13493 [[meatball:3]]
13494 !! result
13495 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
13496 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
13497 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
13498 </p>
13499 !! end
13501 !! test
13502 Free external link invading image caption
13503 !! input
13504 [[Image:Foobar.jpg|thumb|http://x|hello]]
13505 !! result
13506 <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>
13508 !! end
13510 !! test
13511 Bug 15196: localised external link numbers
13512 !! options
13513 language=fa
13514 !! input
13515 [http://en.wikipedia.org/]
13516 !! result
13517 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
13518 </p>
13519 !! end
13521 !! test
13522 Multibyte character in padleft
13523 !! input
13524 {{padleft:-Hello|7|Æ}}
13525 !! result
13526 <p>Æ-Hello
13527 </p>
13528 !! end
13530 !! test
13531 Multibyte character in padright
13532 !! input
13533 {{padright:Hello-|7|Æ}}
13534 !! result
13535 <p>Hello-Æ
13536 </p>
13537 !! end
13539 !!test
13540 formatdate parser function
13541 !!input
13542 {{#formatdate:2009-03-24}}
13543 !! result
13544 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
13545 </p>
13546 !! end
13548 !!test
13549 formatdate parser function, with default format
13550 !!input
13551 {{#formatdate:2009-03-24|mdy}}
13552 !! result
13553 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
13554 </p>
13555 !! end
13557 !! test
13558 Spacing of numbers in formatted dates
13559 !! input
13560 {{#formatdate:January 15}}
13561 !! result
13562 <p><span class="mw-formatted-date" title="01-15">January 15</span>
13563 </p>
13564 !! end
13566 !! test
13567 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
13568 !! options
13569 language=nl title=[[MediaWiki:Common.css]]
13570 !! input
13571 {{#formatdate:2009-03-24|dmy}}
13572 !! result
13573 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
13574 </p>
13575 !! end
13582 # Edit comments
13585 !! test
13586 Edit comment with link
13587 !! options
13588 comment
13589 !! input
13590 I like the [[Main Page]] a lot
13591 !! result
13592 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
13593 !!end
13595 !! test
13596 Edit comment with link and link text
13597 !! options
13598 comment
13599 !! input
13600 I like the [[Main Page|best pages]] a lot
13601 !! result
13602 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13603 !!end
13605 !! test
13606 Edit comment with link and link text with suffix
13607 !! options
13608 comment
13609 !! input
13610 I like the [[Main Page|best page]]s a lot
13611 !! result
13612 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13613 !!end
13615 !! test
13616 Edit comment with section link (non-local, eg in history list)
13617 !! options
13618 comment title=[[Main Page]]
13619 !! input
13620 /* External links */ removed bogus entries
13621 !! result
13622 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13623 !!end
13625 !! test
13626 Edit comment with section link and text before it (non-local, eg in history list)
13627 !! options
13628 comment title=[[Main Page]]
13629 !! input
13630 pre-comment text /* External links */ removed bogus entries
13631 !! result
13632 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>
13633 !!end
13635 !! test
13636 Edit comment with section link (local, eg in diff view)
13637 !! options
13638 comment local title=[[Main Page]]
13639 !! input
13640 /* External links */ removed bogus entries
13641 !! result
13642 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13643 !!end
13645 !! test
13646 Edit comment with subpage link (bug 14080)
13647 !! options
13648 comment
13649 subpage
13650 title=[[Subpage test]]
13651 !! input
13652 Poked at a [[/subpage]] here...
13653 !! result
13654 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
13655 !!end
13657 !! test
13658 Edit comment with subpage link and link text (bug 14080)
13659 !! options
13660 comment
13661 subpage
13662 title=[[Subpage test]]
13663 !! input
13664 Poked at a [[/subpage|neat little page]] here...
13665 !! result
13666 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
13667 !!end
13669 !! test
13670 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
13671 !! options
13672 comment
13673 title=[[Subpage test]]
13674 !! input
13675 Poked at a [[/subpage]] here...
13676 !! result
13677 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...
13678 !!end
13680 !! test
13681 Edit comment with bare anchor link (local, as on diff)
13682 !! options
13683 comment
13684 local
13685 title=[[Main Page]]
13686 !!input
13687 [[#section]]
13688 !! result
13689 <a href="#section">#section</a>
13690 !! end
13692 !! test
13693 Edit comment with bare anchor link (non-local, as on history)
13694 !! options
13695 comment
13696 title=[[Main Page]]
13697 !!input
13698 [[#section]]
13699 !! result
13700 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
13701 !! end
13703 !! test
13704 Anchor starting with underscore
13705 !!input
13706 [[#_ref|One]]
13707 !! result
13708 <p><a href="#_ref">One</a>
13709 </p>
13710 !! end
13712 !! test
13713 Id starting with underscore
13714 !!input
13715 <div id="_ref"></div>
13716 !! result
13717 <div id="_ref"></div>
13719 !! end
13721 !! test
13722 Space normalisation on autocomment (bug 22784)
13723 !! options
13724 comment
13725 title=[[Main Page]]
13726 !!input
13727 /* __hello__world__ */
13728 !! result
13729 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
13730 !! end
13732 !! test
13733 percent-encoding and + signs in comments (Bug 26410)
13734 !! options
13735 comment
13736 !!input
13737 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
13738 !! result
13739 <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>
13740 !! end
13742 !! test
13743 Bad images - basic functionality
13744 !! options
13745 disabled
13746 !! input
13747 [[File:Bad.jpg]]
13748 !! result
13749 !! end
13751 !! test
13752 Bad images - bug 16039: text after bad image disappears
13753 !! options
13754 disabled
13755 !! input
13756 Foo bar
13757 [[File:Bad.jpg]]
13758 Bar foo
13759 !! result
13760 <p>Foo bar
13761 </p><p>Bar foo
13762 </p>
13763 !! end
13765 !! test
13766 Verify that displaytitle works (bug #22501) no displaytitle
13767 !! options
13768 showtitle
13769 !! config
13770 wgAllowDisplayTitle=true
13771 wgRestrictDisplayTitle=false
13772 !! input
13773 this is not the the title
13774 !! result
13775 Parser test
13776 <p>this is not the the title
13777 </p>
13778 !! end
13780 !! test
13781 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
13782 !! options
13783 showtitle
13784 title=[[Screen]]
13785 !! config
13786 wgAllowDisplayTitle=true
13787 wgRestrictDisplayTitle=false
13788 !! input
13789 this is not the the title
13790 {{DISPLAYTITLE:whatever}}
13791 !! result
13792 whatever
13793 <p>this is not the the title
13794 </p>
13795 !! end
13797 !! test
13798 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
13799 !! options
13800 showtitle
13801 title=[[Screen]]
13802 !! config
13803 wgAllowDisplayTitle=true
13804 wgRestrictDisplayTitle=true
13805 !! input
13806 this is not the the title
13807 {{DISPLAYTITLE:whatever}}
13808 !! result
13809 Screen
13810 <p>this is not the the title
13811 </p>
13812 !! end
13814 !! test
13815 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
13816 !! options
13817 showtitle
13818 title=[[Screen]]
13819 !! config
13820 wgAllowDisplayTitle=true
13821 wgRestrictDisplayTitle=true
13822 !! input
13823 this is not the the title
13824 {{DISPLAYTITLE:screen}}
13825 !! result
13826 screen
13827 <p>this is not the the title
13828 </p>
13829 !! end
13831 !! test
13832 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
13833 !! options
13834 showtitle
13835 title=[[Screen]]
13836 !! config
13837 wgAllowDisplayTitle=false
13838 !! input
13839 this is not the the title
13840 {{DISPLAYTITLE:screen}}
13841 !! result
13842 Screen
13843 <p>this is not the the title
13844 <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>
13845 </p>
13846 !! end
13848 !! test
13849 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
13850 !! options
13851 showtitle
13852 title=[[Screen]]
13853 !! config
13854 wgAllowDisplayTitle=false
13855 !! input
13856 this is not the the title
13857 !! result
13858 Screen
13859 <p>this is not the the title
13860 </p>
13861 !! end
13863 !! test
13864 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
13865 !! options
13866 showtitle
13867 title=[[Screen]]
13868 !! config
13869 wgAllowDisplayTitle=true
13870 wgRestrictDisplayTitle=true
13871 !! input
13872 this is not the the title
13873 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
13874 !! result
13875 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
13876 <p>this is not the the title
13877 </p>
13878 !! end
13880 !! test
13881 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
13882 !! options
13883 showtitle
13884 title=[[Screen]]
13885 !! config
13886 wgAllowDisplayTitle=true
13887 wgRestrictDisplayTitle=true
13888 !! input
13889 this is not the the title
13890 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
13891 !! result
13892 <span style="color: red;">s</span>creen
13893 <p>this is not the the title
13894 </p>
13895 !! end
13897 !! test
13898 preload: check <noinclude> and <includeonly>
13899 !! options
13900 preload
13901 !! input
13902 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
13903 !! result
13904 Hello kind world.
13905 !! end
13907 !! test
13908 preload: check <onlyinclude>
13909 !! options
13910 preload
13911 !! input
13912 Goodbye <onlyinclude>Hello world</onlyinclude>
13913 !! result
13914 Hello world
13915 !! end
13917 !! test
13918 preload: can pass tags through if we want to
13919 !! options
13920 preload
13921 !! input
13922 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
13923 !! result
13924 <includeonly>Hello world</includeonly>
13925 !! end
13927 !! test
13928 preload: check that it doesn't try to do tricks
13929 !! options
13930 preload
13931 !! input
13932 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13933 !! result
13934 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13935 !! end
13937 !! test
13938 Play a bit with r67090 and bug 3158
13939 !! options
13940 disabled
13941 !! input
13942 <div style="width:50% !important">&nbsp;</div>
13943 <div style="width:50%&nbsp;!important">&nbsp;</div>
13944 <div style="width:50%&#160;!important">&nbsp;</div>
13945 <div style="border : solid;">&nbsp;</div>
13946 !! result
13947 <div style="width:50% !important">&nbsp;</div>
13948 <div style="width:50% !important">&nbsp;</div>
13949 <div style="width:50% !important">&nbsp;</div>
13950 <div style="border&#160;: solid;">&nbsp;</div>
13952 !! end
13954 !! test
13955 HTML5 data attributes
13956 !! input
13957 <span data-foo="bar">Baz</span>
13958 <p data-abc-def_hij="">Quuz</p>
13959 !! result
13960 <p><span data-foo="bar">Baz</span>
13961 </p>
13962 <p data-abc-def_hij="">Quuz</p>
13964 !! end
13966 !! test
13967 percent-encoding and + signs in internal links (Bug 26410)
13968 !! input
13969 [[User:+%]] [[Page+title%]]
13970 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
13971 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
13972 [[%33%45]] [[%33%45+]]
13973 !! result
13974 <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>
13975 <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>
13976 <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>
13977 <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>
13978 </p>
13979 !! end
13981 !! test
13982 Special characters in embedded file links (bug 27679)
13983 !! input
13984 [[File:Contains & ampersand.jpg]]
13985 [[File:Does not exist.jpg|Title with & ampersand]]
13986 !! result
13987 <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>
13988 <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>
13989 </p>
13990 !! end
13993 !! test
13994 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
13995 !! input
13996 Text&apos;s been normalized?
13997 !! result
13998 <p>Text&#39;s been normalized?
13999 </p>
14000 !! end
14002 !! test
14003 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
14004 !! input
14005 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
14006 !! result
14007 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
14008 </p>
14009 !! end
14011 !! test
14012 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
14013 !! input
14014 [http://www.example.org/ ideograms]
14015 !! result
14016 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
14017 </p>
14018 !! end
14020 !! test
14021 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
14022 !! input
14023 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
14024 !! result
14025 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
14026 </p>
14027 !! end
14029 !! article
14030 Mediawiki:loop1
14031 !! text
14032 {{Identical|A}}
14033 !! endarticle
14035 !! article
14036 Mediawiki:loop2
14037 !! text
14038 {{Identical|B}}
14039 !! endarticle
14041 !! article
14042 Template:Identical
14043 !! text
14044 {{int:loop1}}
14045 {{int:loop2}}
14046 !! endarticle
14048 !! test
14049 Bug 31098 Template which includes system messages which includes the template
14050 !! input
14051 {{Identical}}
14052 !! result
14053 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14054 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14055 </p>
14056 !! end
14058 !! test
14059 Bug31490 Turkish: ucfirst 'blah'
14060 !! options
14061 language=tr
14062 !! input
14063 {{ucfirst:blah}}
14064 !! result
14065 <p>Blah
14066 </p>
14067 !! end
14069 !! test
14070 Bug31490 Turkish: ucfirst 'ix'
14071 !! options
14072 language=tr
14073 !! input
14074 {{ucfirst:ix}}
14075 !! result
14076 <p>İx
14077 </p>
14078 !! end
14080 !! test
14081 Bug31490 Turkish: lcfirst 'BLAH'
14082 !! options
14083 language=tr
14084 !! input
14085 {{lcfirst:BLAH}}
14086 !! result
14087 <p>bLAH
14088 </p>
14089 !! end
14091 !! test
14092 Bug31490 Turkish: ucfırst (with a dotless i)
14093 !! options
14094 language=tr
14095 !! input
14096 {{ucfırst:blah}}
14097 !! result
14098 <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>
14099 </p>
14100 !! end
14102 !! test
14103 Bug31490 ucfırst (with a dotless i) with English language
14104 !! options
14105 language=en
14106 !! input
14107 {{ucfırst:blah}}
14108 !! result
14109 <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>
14110 </p>
14111 !! end
14113 !! test
14114 Bug 26375: TOC with italics
14115 !! options
14116 title=[[Main Page]]
14117 !! input
14118 __TOC__
14119 == ''Lost'' episodes ==
14120 !! result
14121 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14122 <ul>
14123 <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>
14124 </ul>
14125 </div>
14126 <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>
14128 !! end
14130 !! test
14131 Bug 26375: TOC with bold
14132 !! options
14133 title=[[Main Page]]
14134 !! input
14135 __TOC__
14136 == '''should be bold''' then normal text ==
14137 !! result
14138 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14139 <ul>
14140 <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>
14141 </ul>
14142 </div>
14143 <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>
14145 !! end
14147 !! test
14148 Bug 33845: Headings become cursive in TOC when they contain an image
14149 !! options
14150 title=[[Main Page]]
14151 !! input
14152 __TOC__
14153 == Image [[Image:foobar.jpg]] ==
14154 !! result
14155 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14156 <ul>
14157 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
14158 </ul>
14159 </div>
14160 <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>
14162 !! end
14164 !! test
14165 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
14166 !! options
14167 title=[[Main Page]]
14168 !! input
14169 __TOC__
14170 == <blockquote>Quote</blockquote> ==
14171 !! result
14172 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14173 <ul>
14174 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
14175 </ul>
14176 </div>
14177 <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>
14179 !! end
14181 !! test
14182 Unclosed tags in TOC
14183 !! options
14184 title=[[Main Page]]
14185 !! input
14186 __TOC__
14187 == Proof: 2 < 3 ==
14188 <small>Hanc marginis exiguitas non caperet.</small>
14190 !! result
14191 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14192 <ul>
14193 <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>
14194 </ul>
14195 </div>
14196 <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>
14197 <p><small>Hanc marginis exiguitas non caperet.</small>
14199 </p>
14200 !! end
14202 !! test
14203 Multiple tags in TOC
14204 !! input
14205 __TOC__
14206 == <i>Foo</i> <b>Bar</b> ==
14208 == <i>Foo</i> <blockquote>Bar</blockquote> ==
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="#Foo_Bar"><span class="tocnumber">1</span> <span class="toctext"><i>Foo</i> <b>Bar</b></span></a></li>
14213 <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>
14214 </ul>
14215 </div>
14216 <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>
14217 <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>
14219 !! end
14221 !! test
14222 Tags with parameters in TOC
14223 !! input
14224 __TOC__
14225 == <sup class="in-h2">Hello</sup> ==
14227 == <sup class="a > b">Evilbye</sup> ==
14228 !! result
14229 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14230 <ul>
14231 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
14232 <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>
14233 </ul>
14234 </div>
14235 <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>
14236 <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>
14238 !! end
14240 !! test
14241 span tags with directionality in TOC
14242 !! input
14243 __TOC__
14244 == <span dir="ltr">C++</span> ==
14246 == <span dir="rtl">זבנג!</span> ==
14248 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
14250 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
14252 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
14253 !! result
14254 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14255 <ul>
14256 <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>
14257 <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>
14258 <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>
14259 <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>
14260 <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>
14261 </ul>
14262 </div>
14263 <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>
14264 <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>
14265 <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>
14266 <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>
14267 <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>
14269 !! end
14271 !! article
14272 MediaWiki:Bug32057
14273 !! text
14274 == {{int:headline_sample}} ==
14275 !! endarticle
14277 !! test
14278 Bug 32057: Title needed when expanding <h> nodes.
14279 !! options
14280 title=[[Main Page]]
14281 !! input
14282 {{int:Bug32057}}
14283 !! result
14284 <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>
14286 !! end
14288 !! test
14289 Strip marker in urlencode
14290 !! input
14291 {{urlencode:x<nowiki/>y}}
14292 {{urlencode:x<nowiki/>y|wiki}}
14293 {{urlencode:x<nowiki/>y|path}}
14294 !! result
14295 <p>xy
14298 </p>
14299 !! end
14301 !! test
14302 Strip marker in lc
14303 !! input
14304 {{lc:x<nowiki/>y}}
14305 !! result
14306 <p>xy
14307 </p>
14308 !! end
14310 !! test
14311 Strip marker in uc
14312 !! input
14313 {{uc:x<nowiki/>y}}
14314 !! result
14315 <p>XY
14316 </p>
14317 !! end
14319 !! test
14320 Strip marker in formatNum
14321 !! input
14322 {{formatnum:1<nowiki/>2}}
14323 {{formatnum:1<nowiki/>2|R}}
14324 !! result
14325 <p>12
14327 </p>
14328 !! end
14330 !! test
14331 Check noCommafy in formatNum
14332 !! options
14333 language=be-tarask
14334 !! input
14335 {{formatnum:123456.78}}
14336 {{formatnum:123456.78|NOSEP}}
14337 !! result
14338 <p>123 456,78
14339 123456.78
14340 </p>
14341 !! end
14343 !! test
14344 Strip marker in grammar
14345 !! options
14346 language=fi
14347 !! input
14348 {{grammar:elative|foo<nowiki/>bar}}
14349 !! result
14350 <p>foobarista
14351 </p>
14352 !! end
14354 !! test
14355 Strip marker in padleft
14356 !! input
14357 {{padleft:|2|x<nowiki/>y}}
14358 !! result
14359 <p>xy
14360 </p>
14361 !! end
14363 !! test
14364 Strip marker in padright
14365 !! input
14366 {{padright:|2|x<nowiki/>y}}
14367 !! result
14368 <p>xy
14369 </p>
14370 !! end
14372 !! test
14373 Strip marker in anchorencode
14374 !! input
14375 {{anchorencode:x<nowiki/>y}}
14376 !! result
14377 <p>xy
14378 </p>
14379 !! end
14381 !! test
14382 nowiki inside link inside heading (bug 18295)
14383 !! input
14384 ==[[foo|x<nowiki>y</nowiki>z]]==
14385 !! result
14386 <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>
14388 !! end
14390 !! test
14391 new support for bdi element (bug 31817)
14392 !! input
14393 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14394 !! result
14395 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14397 !!end
14399 !! test
14400 Ignore pipe between table row attributes
14401 !! input
14403 | quux
14404 |- id=foo | style='color: red'
14405 | bar
14407 !! result
14408 <table>
14409 <tr>
14410 <td> quux
14411 </td></tr>
14412 <tr id="foo" style="color: red">
14413 <td> bar
14414 </td></tr></table>
14416 !! end
14418 !!test
14419 Gallery override link with WikiLink (bug 34852)
14420 !! input
14421 <gallery>
14422 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
14423 </gallery>
14424 !! result
14425 <ul class="gallery">
14426                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14427                         <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>
14428                         <div class="gallerytext">
14429 <p>caption
14430 </p>
14431                         </div>
14432                 </div></li>
14433 </ul>
14435 !! end
14437 !!test
14438 Gallery override link with absolute external link (bug 34852)
14439 !! input
14440 <gallery>
14441 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
14442 </gallery>
14443 !! result
14444 <ul class="gallery">
14445                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14446                         <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>
14447                         <div class="gallerytext">
14448 <p>caption
14449 </p>
14450                         </div>
14451                 </div></li>
14452 </ul>
14454 !! end
14456 !!test
14457 Gallery override link with malicious javascript (bug 34852)
14458 !! input
14459 <gallery>
14460 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
14461 </gallery>
14462 !! result
14463 <ul class="gallery">
14464                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14465                         <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>
14466                         <div class="gallerytext">
14467 <p>caption
14468 </p>
14469                         </div>
14470                 </div></li>
14471 </ul>
14473 !! end
14475 !!test
14476 Gallery with invalid title as link (bug 43964)
14477 !! input
14478 <gallery>
14479 File:foobar.jpg|link=<
14480 </gallery>
14481 !! result
14482 <ul class="gallery">
14483                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14484                         <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>
14485                         <div class="gallerytext">
14486                         </div>
14487                 </div></li>
14488 </ul>
14490 !! end
14492 !!test
14493 Language parser function
14494 !! input
14495 {{#language:ar}}
14496 !! result
14497 <p>العربية
14498 </p>
14499 !! end
14501 !!test
14502 Padleft and padright as substr
14503 !! input
14504 {{padleft:|3|abcde}}
14505 {{padright:|3|abcde}}
14506 !! result
14507 <p>abc
14509 </p>
14510 !! end
14512 !!test
14513 Special parser function
14514 !! input
14515 {{#special:RandomPage}}
14516 {{#special:BaDtItLe}}
14517 {{#special:Foobar}}
14518 !! result
14519 <p>Special:Random
14520 Special:Badtitle
14521 Special:Foobar
14522 </p>
14523 !! end
14525 !!test
14526 Bug 34939 - Case insensitive link parsing ([HttP://])
14527 !! input
14528 [HttP://MediaWiki.Org/]
14529 !! result
14530 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
14531 </p>
14532 !! end
14534 !!test
14535 Bug 34939 - Case insensitive link parsing ([HttP:// title])
14536 !! input
14537 [HttP://MediaWiki.Org/ MediaWiki]
14538 !! result
14539 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
14540 </p>
14541 !! end
14543 !!test
14544 Bug 34939 - Case insensitive link parsing (HttP://)
14545 !! input
14546 HttP://MediaWiki.Org/
14547 !! result
14548 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
14549 </p>
14550 !! end
14554 ### Parsoids-specific tests
14555 ### Parsoid-PHP parser incompatibilities
14557 !!test
14558 1. SOL-sensitive wikitext tokens as template-args
14559 !!options
14560 parsoid=wt2html,wt2wt
14561 !!input
14562 {{echo|*a}}
14563 {{echo|#a}}
14564 {{echo|:a}}
14565 !!result
14566 <span about="#mwt1" typeof="mw:Transclusion">
14567 </span><ul about="#mwt1"><li>a</li></ul>
14568 <span about="#mwt2" typeof="mw:Transclusion">
14569 </span><ol about="#mwt2"><li>a</li></ol>
14570 <span about="#mwt3" typeof="mw:Transclusion">
14571 </span><dl about="#mwt3"><dd>a</dd></dl>
14572 !!end
14574 #### ----------------------------------------------------------------
14575 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
14576 #### tags. Parsoid's output for these tags differs from that of the
14577 #### PHP parser.
14578 #### ----------------------------------------------------------------
14580 !!test
14581 Ref: 1. ref-location should be replaced with an index span
14582 !!options
14583 parsoid
14584 !!input
14585 A <ref>foo</ref>
14586 B <ref name="x">foo</ref>
14587 C <ref name="y" />
14588 !!result
14589 <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>
14590 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>
14591 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>
14592 !!end
14594 !!test
14595 Ref: 2. ref-tags with identical names should all get the same index
14596 !!options
14597 parsoid
14598 !!input
14599 A <ref name="x">foo</ref>
14600 B <ref name="x" />
14601 !!result
14602 <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>
14603 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>
14604 !!end
14606 !!test
14607 Ref: 3. spaces in ref-names should be ignored
14608 !!options
14609 parsoid
14610 !!input
14611 A <ref name="x">foo</ref>
14612 B <ref name=" x " />
14613 C <ref name= x  />
14614 !!result
14615 <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>
14616 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>
14617 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>
14618 !!end
14620 !!test
14621 Ref: 4. 'constructor' should be accepted as a valid ref-name
14622 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
14623 !!options
14624 parsoid
14625 !!input
14626 A <ref name="constructor">foo</ref>
14627 !!result
14628 <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>
14629 !!end
14631 !!test
14632 Ref: 5. body should accept generic wikitext
14633 !!options
14634 parsoid
14635 !!input
14636 A <ref>
14637  This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
14638 </ref>
14640 <references />
14641 !!result
14642 <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>
14644 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14645 <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>
14646 </li></ol>
14647 !!end
14649 !!test
14650 Ref: 6. indent-pres should not be output in ref-body
14651 !!options
14652 parsoid
14653 !!input
14654 A <ref>
14655  foo
14656  bar
14657  baz
14658 </ref>
14660 <references />
14661 !!result
14662 <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>
14664 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14665 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14666  bar
14667  baz
14668 </li></ol>
14669 !!end
14671 !!test
14672 Ref: 6. No p-wrapping in ref-body
14673 !!options
14674 parsoid
14675 !!input
14676 A <ref>
14686 booz
14687 </ref>
14689 <references />
14690 !!result
14691 <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>
14693 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14694 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14703 booz
14704 </li></ol>
14705 !!end
14707 !!test
14708 Ref: 8. transclusion wikitext has lower precedence
14709 !!options
14710 parsoid
14711 !!input
14712 A <ref> foo {{echo|</ref> B C}}
14714 <references />
14715 !!result
14716 <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>
14718 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14719 <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>
14720 !!end
14722 !!test
14723 Ref: 9. unclosed comments should not leak out of ref-body
14724 !!options
14725 parsoid
14726 !!input
14727 A <ref> foo <!--</ref> B C
14729 <references />
14730 !!result
14731 <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>
14733 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14734 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
14735 !!end
14737 !!test
14738 Ref: 10. Unclosed HTML tags should not leak out of ref-body
14739 !!options
14740 parsoid
14741 !!input
14742 A <ref> <b> foo </ref> B C
14744 <references />
14745 !!result
14746 <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>
14748 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14749 <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>
14750 !!end
14752 !!test
14753 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
14754 !!options
14755 parsoid
14756 !!input
14757 A <ref>foo</ref> B
14758 C <ref>bar</ref> D
14759 !!result
14760 <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
14761 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>
14762 !!end
14764 !!test
14765 Ref: 12. ref-tags act as trailing newline migration barrier
14766 !!options
14767 parsoid
14768 !!input
14769 <!--the newline at the end of this line moves out of the p-tag-->a
14771 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
14772 <ref />
14775 !!result
14776 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
14779 <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>
14780 <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>
14783 <p>c</p>
14784 !!end
14786 !!test
14787 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
14788 !!options
14789 parsoid
14790 !!input
14791 <ref>foo</ref> A
14792 <ref>bar
14793 </ref> B
14794 !!result
14795 <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
14796 <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>
14797 !!end
14799 !!test
14800 Ref: 14. A nested ref-tag should be emitted as plain text
14801 !!options
14802 parsoid
14803 !!input
14804 <ref>foo <ref>bar</ref> baz</ref>
14806 <references />
14807 !!result
14808 <p><span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo &amp;lt;ref&amp;gt;bar"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> baz&lt;/ref&gt;</p>
14810 <ol about="#mwt2" 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 &lt;ref&gt;bar</li></ol>
14811 !!end
14813 !!test
14814 Ref: 15. ref-tags with identical names should get identical indexes
14815 !!options
14816 parsoid
14817 !!input
14818 A1 <ref name="a">foo</ref> A2 <ref name="a" />
14819 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
14821 <references />
14822 !!result
14823 <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>
14824 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>
14826 <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>
14827 !!end
14829 !!test
14830 References: 1. references tag without any refs should be handled properly
14831 !!options
14832 parsoid
14833 !!input
14834 <references />
14835 !!result
14836 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
14837 !!end
14839 !!test
14840 References: 2. references tag with group only outputs references from that group
14841 !!options
14842 parsoid
14843 !!input
14844 A <ref group="a">foo</ref>
14845 B <ref group="b">bar</ref>
14847 <references group='a' />
14848 !!result
14849 <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>
14850 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>
14852 <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>
14853 !!end
14855 !!test
14856 References: 3. ref list should be cleared after processing references
14857 !!options
14858 parsoid
14859 !!input
14860 A <ref>foo</ref>
14862 <references />
14864 B <ref>bar</ref>
14866 <references />
14867 !!result
14868 <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>
14870 <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>
14872 <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>
14874 <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>
14875 !!end
14877 !!test
14878 References: 4. only referenced group should be cleared after processing references
14879 !!options
14880 parsoid
14881 !!input
14882 A <ref group="a">afoo</ref>
14883 B <ref>bfoo</ref>
14885 <references group="a"/>
14887 C <ref>cfoo</ref>
14889 <references />
14890 !!result
14891 <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>
14892 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>
14894 <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>
14896 <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>
14898 <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>
14899 !!end
14901 !!test
14902 References: 5. ref tags in references should be processed while ignoring all other content
14903 !!options
14904 parsoid
14905 !!input
14906 A <ref name="a" />
14907 B <ref name="b">bar</ref>
14909 <references>
14910 <ref name="a">foo</ref>
14911 This should just get lost.
14912 </references>
14913 !!result
14914 <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>
14915 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>
14917 <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>
14918 !!end
14920 !!test
14921 References: 6. <references /> from a transclusion
14922 !!options
14923 parsoid
14924 !!input
14925 {{echo|<references />}}
14926 !!result
14927 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}'></ol>
14928 !!end
14930 #### ----------------------------------------------------------------
14931 #### The following section of tests are primarily to test
14932 #### wikitext escaping capabilities of Parsoid.  Given that
14933 #### escaping can be done any number of ways, the wikitext (input)
14934 #### is always adjusted to reflect how Parsoid adds nowiki
14935 #### escape tags.
14936 ####
14937 #### We are marking several tests as parsoid-only since the
14938 #### HTML in the result section is different from what the
14939 #### PHP parser generates for it.
14940 #### ----------------------------------------------------------------
14943 #### --------------- Headings ---------------
14944 #### 0. Unnested
14945 #### 1. Nested inside html <h1>=foo=</h1>
14946 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
14947 #### 3. Nested inside html with wikitext split by html tags
14948 #### 4. No escape needed
14949 #### 5. Empty headings <h1></h1>
14950 #### 6. Heading chars in SOL context
14951 #### ----------------------------------------
14952 !! test
14953 Headings: 0. Unnested
14954 !! options
14955 parsoid
14956 !! input
14957 <nowiki>=foo=</nowiki>
14959 <nowiki> =foo= </nowiki>
14960 <!--cmt-->
14961 <nowiki>=foo=</nowiki>
14963 =foo''a''<nowiki>=</nowiki>
14964 !! result
14965 <p><span typeof="mw:Nowiki">=foo=</span></p>
14967 <p><span typeof="mw:Nowiki"> =foo= </span>
14968 <!--cmt-->
14969 <span typeof="mw:Nowiki">=foo=</span></p>
14971 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
14972 !!end
14974 !! test
14975 Headings: 1. Nested inside html
14976 !! options
14977 parsoid
14978 !! input
14979 =<nowiki>=foo=</nowiki>=
14981 ==<nowiki>=foo=</nowiki>==
14983 ===<nowiki>=foo=</nowiki>===
14985 ====<nowiki>=foo=</nowiki>====
14987 =====<nowiki>=foo=</nowiki>=====
14989 ======<nowiki>=foo=</nowiki>======
14990 !! result
14991 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
14992 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
14993 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
14994 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
14995 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
14996 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
14997 !!end
14999 !! test
15000 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
15001 !! options
15002 parsoid
15003 !! input
15004 =foo=
15005 <nowiki>*bar</nowiki>
15007 =foo=
15008 =bar
15010 =foo=
15011 <nowiki>=bar=</nowiki>
15012 !! result
15013 <h1>foo</h1>*bar
15014 <h1>foo</h1>=bar
15015 <h1>foo</h1>=bar=
15016 !!end
15018 !! test
15019 Headings: 3. Nested inside html with wikitext split by html tags
15020 !! options
15021 parsoid
15022 !! input
15023 =='''bold'''<nowiki>foo=</nowiki>=
15024 !! result
15025 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
15026 !!end
15028 !! test
15029 Headings: 4a. No escaping needed (testing just h1 and h2)
15030 !! options
15031 parsoid
15032 !! input
15033 ==foo=
15035 =foo==
15037 = =foo= =
15039 ==foo= bar=
15041 ===foo==
15043 ==foo===
15045 =''=''foo==
15047 =<nowiki>=</nowiki>=
15048 !! result
15049 <h1>=foo</h1>
15050 <h1>foo=</h1>
15051 <h1> =foo= </h1>
15052 <h1>=foo= bar</h1>
15053 <h2>=foo</h2>
15054 <h2>foo=</h2>
15055 <h1><i>=</i>foo=</h1>
15056 <h1><span typeof="mw:Nowiki">=</span></h1>
15057 !!end
15059 !! test
15060 Headings: 4b. No escaping needed (inside p-tags)
15061 !! options
15062 parsoid
15063 !! input
15065 =foo= x
15066 =foo= <s></s>
15067 !! result
15068 <p>===
15069 =foo= x
15070 =foo= <s></s>
15071 </p>
15072 !!end
15074 !! test
15075 Headings: 5. Empty headings
15076 !! options
15077 parsoid
15078 !! input
15079 =<nowiki/>=
15081 ==<nowiki/>==
15083 ===<nowiki/>===
15085 ====<nowiki/>====
15087 =====<nowiki/>=====
15089 ======<nowiki/>======
15090 !! result
15091 <h1></h1>
15092 <h2></h2>
15093 <h3></h3>
15094 <h4></h4>
15095 <h5></h5>
15096 <h6></h6>
15097 !!end
15099 !! test
15100 Headings: 6a. Heading chars in SOL context (with trailing spaces)
15101 !! options
15102 parsoid
15103 !! input
15104 <nowiki>=a=</nowiki>
15106 <nowiki>=a= </nowiki>
15108 <nowiki>=a=     </nowiki>
15110 <nowiki>=a=     </nowiki>
15111 !! result
15112 <p>=a=</p>
15113 <p>=a= </p>
15114 <p>=a=  </p>
15115 <p>=a=  </p>
15116 !!end
15118 !! test
15119 Headings: 6b. Heading chars in SOL context (with trailing newlines)
15120 !! options
15121 parsoid
15122 !! input
15123 <nowiki>=a=
15124 b</nowiki>
15126 <nowiki>=a= 
15127 b</nowiki>
15129 <nowiki>=a=     
15130 b</nowiki>
15132 <nowiki>=a=      
15133 b</nowiki>
15134 !! result
15135 <p>=a=
15136 b</p>
15137 <p>=a= 
15138 b</p>
15139 <p>=a=  
15140 b</p>
15141 <p>=a=   
15142 b</p>
15143 </p>
15144 !!end
15146 !! test
15147 Headings: 6c. Heading chars in SOL context (leading newline break)
15148 !! options
15149 parsoid
15150 !! input
15151 <nowiki>a
15152 =b=</nowiki>
15153 !! result
15154 <p>a
15155 =b=</p>
15156 !!end
15158 !! test
15159 Headings: 6d. Heading chars in SOL context (with interspersed comments)
15160 !! options
15161 parsoid
15162 !! input
15163 <!--c0--><nowiki>=a=</nowiki>
15164 <!--c1-->
15165 <nowiki>=a= </nowiki><!--c2-->   <!--c3-->
15166 !! result
15167 <p><!--c0-->=a=</p>
15168 <p><!--c1-->=a= <!--c2-->        <!--c3--></p>
15169 !!end
15171 !! test
15172 Headings: 6d. Heading chars in SOL context (No escaping needed)
15173 !! options
15174 parsoid=html2wt
15175 !! input
15176 =a=<div>b</div>
15177 !! result
15178 =a=<div>b</div>
15179 !!end
15181 #### --------------- Lists ---------------
15182 #### 0. Outside nests (*foo, etc.)
15183 #### 1. Nested inside html <ul><li>*foo</li></ul>
15184 #### 2. Inside definition lists
15185 #### 3. Only bullets at start should be escaped
15186 #### 4. No escapes needed
15187 #### 5. No unnecessary escapes
15188 #### 6. Escape bullets in SOL position
15189 #### 7. Escape bullets in a multi-line context
15190 #### ----------------------------------------
15192 !! test
15193 Lists: 0. Outside nests
15194 !! input
15195 <nowiki>*foo</nowiki>
15197 <nowiki>#foo</nowiki>
15198 !! result
15199 <p>*foo
15200 </p><p>#foo
15201 </p>
15202 !!end
15204 !! test
15205 Lists: 1. Nested inside html
15206 !! input
15207 *<nowiki>*foo</nowiki>
15209 *<nowiki>#foo</nowiki>
15211 *<nowiki>:foo</nowiki>
15213 *<nowiki>;foo</nowiki>
15215 #<nowiki>*foo</nowiki>
15217 #<nowiki>#foo</nowiki>
15219 #<nowiki>:foo</nowiki>
15221 #<nowiki>;foo</nowiki>
15222 !! result
15223 <ul><li>*foo
15224 </li></ul>
15225 <ul><li>#foo
15226 </li></ul>
15227 <ul><li>:foo
15228 </li></ul>
15229 <ul><li>;foo
15230 </li></ul>
15231 <ol><li>*foo
15232 </li></ol>
15233 <ol><li>#foo
15234 </li></ol>
15235 <ol><li>:foo
15236 </li></ol>
15237 <ol><li>;foo
15238 </li></ol>
15240 !!end
15242 !! test
15243 Lists: 2. Inside definition lists
15244 !! input
15245 ;<nowiki>;foo</nowiki>
15247 ;<nowiki>:foo</nowiki>
15249 ;<nowiki>:foo</nowiki>
15250 :bar
15252 :<nowiki>:foo</nowiki>
15253 !! result
15254 <dl><dt>;foo
15255 </dt></dl>
15256 <dl><dt>:foo
15257 </dt></dl>
15258 <dl><dt>:foo
15259 </dt><dd>bar
15260 </dd></dl>
15261 <dl><dd>:foo
15262 </dd></dl>
15264 !!end
15266 !! test
15267 Lists: 3. Only bullets at start of text should be escaped
15268 !! input
15269 *<nowiki>*foo*bar</nowiki>
15271 *<nowiki>*foo</nowiki>''it''*bar
15272 !! result
15273 <ul><li>*foo*bar
15274 </li></ul>
15275 <ul><li>*foo<i>it</i>*bar
15276 </li></ul>
15278 !!end
15280 !! test
15281 Lists: 4. No escapes needed
15282 !! options
15283 parsoid
15284 !! input
15285 *foo*bar
15287 *''foo''*bar
15289 *[[Foo]]: bar
15290 !! result
15291 <ul><li>foo*bar
15292 </li></ul>
15293 <ul><li><i>foo</i>*bar
15294 </li></ul>
15295 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
15296 </li></ul>
15297 !!end
15299 !! test
15300 Lists: 5. No unnecessary escapes
15301 !! input
15302 * bar <span><nowiki>[[foo]]</nowiki></span>
15304 *=bar <span><nowiki>[[foo]]</nowiki></span>
15306 *[[bar <span><nowiki>[[foo]]</nowiki></span>
15308 *]]bar <span><nowiki>[[foo]]</nowiki></span>
15310 *=bar <span>foo]]</span>=
15312 * <s></s>: a
15313 !! result
15314 <ul><li> bar <span>[[foo]]</span>
15315 </li></ul>
15316 <ul><li>=bar <span>[[foo]]</span>
15317 </li></ul>
15318 <ul><li>[[bar <span>[[foo]]</span>
15319 </li></ul>
15320 <ul><li>]]bar <span>[[foo]]</span>
15321 </li></ul>
15322 <ul><li>=bar <span>foo]]</span>=
15323 </li></ul>
15324 <ul><li> <s></s>: a
15325 </li></ul>
15327 !!end
15329 !! test
15330 Lists: 6. Escape bullets in SOL position
15331 !! options
15332 parsoid
15333 !! input
15334 <!--cmt--><nowiki>*foo</nowiki>
15335 !! result
15336 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
15337 !!end
15339 !! test
15340 Lists: 7. Escape bullets in a multi-line context
15341 !! input
15342 <nowiki>a
15343 *b</nowiki>
15344 !! result
15345 <p>a
15347 </p>
15348 !!end
15350 #### --------------- HRs ---------------
15351 #### 1. Single line
15352 #### -----------------------------------
15354 !! test
15355 HRs: 1. Single line
15356 !! options
15357 parsoid
15358 !! input
15359 ----<nowiki>----</nowiki>
15360 ----=foo=
15361 ----*foo
15362 !! result
15363 <hr><span typeof="mw:Nowiki">----</span>
15364 <hr>=foo=
15365 <hr>*foo
15366 !! end
15368 #### --------------- Tables ---------------
15369 #### 1a. Simple example
15370 #### 1b. No escaping needed (!foo)
15371 #### 1c. No escaping needed (|foo)
15372 #### 1d. No escaping needed (|}foo)
15373 ####
15374 #### 2a. Nested in td (<td>foo|bar</td>)
15375 #### 2b. Nested in td (<td>foo||bar</td>)
15376 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
15377 ####
15378 #### 3a. Nested in th (<th>foo!bar</th>)
15379 #### 3b. Nested in th (<th>foo!!bar</th>)
15380 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
15381 ####
15382 #### 4a. Escape -
15383 #### 4b. Escape +
15384 #### 4c. No escaping needed
15385 #### --------------------------------------
15387 !! test
15388 Tables: 1a. Simple example
15389 !! input
15390 <nowiki>{|
15391 |}</nowiki>
15392 !! result
15393 <p>{|
15395 </p>
15396 !! end
15398 !! test
15399 Tables: 1b. No escaping needed
15400 !! input
15401 !foo
15402 !! result
15403 <p>!foo
15404 </p>
15405 !! end
15407 !! test
15408 Tables: 1c. No escaping needed
15409 !! input
15410 |foo
15411 !! result
15412 <p>|foo
15413 </p>
15414 !! end
15416 !! test
15417 Tables: 1d. No escaping needed
15418 !! input
15419 |}foo
15420 !! result
15421 <p>|}foo
15422 </p>
15423 !! end
15425 !! test
15426 Tables: 2a. Nested in td
15427 !! options
15428 parsoid
15429 !! input
15431 |<nowiki>foo|bar</nowiki>
15433 !! result
15434 <table><tbody><tr>
15435 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
15436 !! end
15438 !! test
15439 Tables: 2b. Nested in td
15440 !! options
15441 parsoid
15442 !! input
15444 |<nowiki>foo||bar</nowiki>
15445 |''it''<nowiki>foo||bar</nowiki>
15447 !! result
15448 <table><tbody><tr>
15449 <td><span typeof="mw:Nowiki">foo||bar</span></td>
15450 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
15451 !! end
15453 !! test
15454 Tables: 2c. Nested in td -- no escaping needed
15455 !! options
15456 parsoid
15457 !! input
15459 |foo!!bar
15461 !! result
15462 <table><tbody><tr><td>foo!!bar
15463 </td></tr></tbody></table>
15465 !! end
15467 !! test
15468 Tables: 3a. Nested in th
15469 !! options
15470 parsoid
15471 !! input
15473 !foo!bar
15475 !! result
15476 <table><tbody><tr><th>foo!bar
15477 </th></tr></tbody></table>
15479 !! end
15481 !! test
15482 Tables: 3b. Nested in th
15483 !! options
15484 parsoid
15485 !! input
15487 !<nowiki>foo!!bar</nowiki>
15489 !! result
15490 <table>
15491 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
15492 </tbody></table>
15493 !! end
15495 !! test
15496 Tables: 3c. Nested in th -- no escaping needed
15497 !! options
15498 parsoid
15499 !! input
15501 !<nowiki>foo||bar</nowiki>
15503 !! result
15504 <table><tbody><tr>
15505 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
15506 !! end
15508 !! test
15509 Tables: 4a. Escape -
15510 !! options
15511 parsoid
15512 !! input
15515 !-bar
15517 |<nowiki>-bar</nowiki>
15519 !! result
15520 <table><tbody>
15521 <tr><th>-bar</th></tr>
15522 <tr>
15523 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
15524 !! end
15526 !! test
15527 Tables: 4b. Escape +
15528 !! options
15529 parsoid
15530 !! input
15533 !+bar
15535 |<nowiki>+bar</nowiki>
15537 !! result
15538 <table><tbody>
15539 <tr><th>+bar</th></tr>
15540 <tr>
15541 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
15542 !! end
15544 !! test
15545 Tables: 4c. No escaping needed
15546 !! options
15547 parsoid
15548 !! input
15551 |foo-bar
15552 |foo+bar
15554 |''foo''-bar
15555 |''foo''+bar
15557 !! result
15558 <table><tbody>
15559 <tr><td>foo-bar</td><td>foo+bar</td></tr>
15560 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
15561 </tbody></table>
15562 !! end
15564 ### SSS FIXME: Disabled right now because accurate html2wt
15565 ### on this snippet requires data-parsoid flags that we've
15566 ### stripped out of these tests.  We should scheme how we
15567 ### we want to handle these kind of tests that require
15568 ### data-parsoid flags for accurate html2wt serialization
15570 !! test
15571 Tables: 4d. No escaping needed
15572 !! options
15573 disabled
15574 !! input
15576 ||+1
15577 ||-2
15579 !! result
15580 <table>
15581 <tr>
15582 <td>+1
15583 </td>
15584 <td>-2
15585 </td></tr></table>
15587 !! end
15589 #### --------------- Links ----------------
15590 #### 1. Quote marks in link text
15591 #### 2. Wikilinks: Escapes needed
15592 #### 3. Wikilinks: No escapes needed
15593 #### 4. Extlinks: Escapes needed
15594 #### 5. Extlinks: No escapes needed
15595 #### --------------------------------------
15596 !! test
15597 Links 1. Quote marks in link text
15598 !! options
15599 parsoid
15600 !! input
15601 [[Foo|<nowiki>Foo''boo''</nowiki>]]
15602 !! result
15603 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
15604 !! end
15606 !! test
15607 Links 2. WikiLinks: Escapes needed
15608 !! options
15609 parsoid
15610 !! input
15611 [[Foo|<nowiki>[Foobar]</nowiki>]]
15612 [[Foo|<nowiki>Foobar]</nowiki>]]
15613 [[Foo|x [Foobar] x]]
15614 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
15615 [[Foo|<nowiki>[[Bar]]</nowiki>]]
15616 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
15617 [[Foo|<nowiki>|Bar</nowiki>]]
15618 [[Foo|<nowiki>]]bar</nowiki>]]
15619 [[Foo|<nowiki>[[bar</nowiki>]]
15620 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
15621 !! result
15622 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
15623 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
15624 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
15625 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
15626 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
15627 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
15628 <a href="Foo" rel="mw:WikiLink">|Bar</a>
15629 <a href="Foo" rel="mw:WikiLink">]]bar</a>
15630 <a href="Foo" rel="mw:WikiLink">[[bar</a>
15631 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
15632 !! end
15634 !! test
15635 Links 3. WikiLinks: No escapes needed
15636 !! options
15637 parsoid
15638 !! input
15639 [[Foo|[Foobar]]
15640 [[Foo|foo|bar]]
15641 !! result
15642 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
15643 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
15644 !! end
15646 !! test
15647 Links 4. ExtLinks: Escapes needed
15648 !! options
15649 parsoid
15650 !! input
15651 [http://google.com <nowiki>[google]</nowiki>]
15652 [http://google.com <nowiki>google]</nowiki>]
15653 !! result
15654 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
15655 <a href="http://google.com" rel="mw:ExtLink">google]</a>
15656 !! end
15658 !! test
15659 Links 5. ExtLinks: No escapes needed
15660 !! options
15661 parsoid
15662 !! input
15663 [http://google.com [google]
15664 !! result
15665 <a href="http://google.com" rel="mw:ExtLink">[google</a>
15666 !! end
15668 #### --------------- Quotes ---------------
15669 #### 1. Quotes inside <b> and <i>
15670 #### 2. Link fragments separated by <i> and <b> tags
15671 #### 3. Link fragments inside <i> and <b>
15672 #### --------------------------------------
15673 !! test
15674 1. Quotes inside <b> and <i>
15675 !! input
15676 ''<nowiki>'foo'</nowiki>''
15677 ''<nowiki>''foo''</nowiki>''
15678 ''<nowiki>'''foo'''</nowiki>''
15679 ''foo''<nowiki>'s</nowiki>
15680 '''<nowiki>'foo'</nowiki>'''
15681 '''<nowiki>''foo''</nowiki>'''
15682 '''<nowiki>'''foo'''</nowiki>'''
15683 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
15684 '''foo'''<nowiki>'s</nowiki>
15685 !! result
15686 <p><i>'foo'</i>
15687 <i>''foo''</i>
15688 <i>'''foo'''</i>
15689 <i>foo</i>'s
15690 <b>'foo'</b>
15691 <b>''foo''</b>
15692 <b>'''foo'''</b>
15693 <b>foo'<i>bar'</i>baz</b>
15694 <b>foo</b>'s
15695 </p>
15696 !! end
15698 !! test
15699 2. Link fragments separated by <i> and <b> tags
15700 !! input
15701 [[''foo''<nowiki>hello]]</nowiki>
15703 [['''foo'''<nowiki>hello]]</nowiki>
15704 !! result
15705 <p>[[<i>foo</i>hello]]
15706 </p><p>[[<b>foo</b>hello]]
15707 </p>
15708 !! end
15710 !! test
15711 2. Link fragments inside <i> and <b>
15712 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
15713  this is one of the shortcomings of this format)
15714 !! input
15715 ''[[foo''<nowiki>]]</nowiki>
15717 '''[[foo'''<nowiki>]]</nowiki>
15718 !! result
15719 <p><i>[[foo</i>]]
15720 </p><p><b>[[foo</b>]]
15721 </p>
15722 !! end
15724 #### ----------- Paragraphs ---------------
15725 #### 1. No unnecessary escapes
15726 #### --------------------------------------
15728 !! test
15729 1. No unnecessary escapes
15730 !! input
15731 bar <span><nowiki>[[foo]]</nowiki></span>
15733 =bar <span><nowiki>[[foo]]</nowiki></span>
15735 [[bar <span><nowiki>[[foo]]</nowiki></span>
15737 ]]bar <span><nowiki>[[foo]]</nowiki></span>
15739 =bar <span>foo]]</span><nowiki>=</nowiki>
15740 !! result
15741 <p>bar <span>[[foo]]</span>
15742 </p><p>=bar <span>[[foo]]</span>
15743 </p><p>[[bar <span>[[foo]]</span>
15744 </p><p>]]bar <span>[[foo]]</span>
15745 </p><p>=bar <span>foo]]</span>=
15746 </p>
15747 !!end
15749 #### ----------------------- PRE --------------------------
15750 #### 1. Leading whitespace in SOL context should be escaped
15751 #### ------------------------------------------------------
15752 !! test
15753 1. Leading whitespace in SOL context should be escaped
15754 !! options
15755 parsoid
15756 !! input
15757 <nowiki> a</nowiki>
15759 <nowiki>  a</nowiki>
15761 <nowiki>        a(tab)</nowiki>
15763 <nowiki>        a</nowiki>
15764 <!--cmt-->
15765 <nowiki>  a</nowiki>
15767 <nowiki>a
15768  b</nowiki>
15770 <nowiki>a
15771         b</nowiki>
15773 <nowiki>a
15774          b</nowiki>
15775 !! result
15776 <p> a</p>
15777 <p>  a</p>
15778 <p>     a(tab)</p>
15779 <p>     a</p>
15780 <p><!--cmt-->  a</p>
15781 <p>a
15782  b</p>
15783 <p>a
15784         b</p>
15785 <p>a
15786          b</p>
15787 !! end
15789 #### --------------- HTML tags ---------------
15790 #### 1. a tags
15791 #### 2. other tags
15792 #### 3. multi-line html tag
15793 #### -----------------------------------------
15794 !! test
15795 1. a tags
15796 !! options
15797 parsoid
15798 !! input
15799 <a href="http://google.com">google</a>
15800 !! result
15801 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
15802 !! end
15804 !! test
15805 2. other tags
15806 !! input
15807 <nowiki><div>foo</div>
15808 <div style="color:red">foo</div></nowiki>
15809 !! result
15810 <p>&lt;div&gt;foo&lt;/div&gt;
15811 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
15812 </p>
15813 !! end
15815 !! test
15816 3. multi-line html tag
15817 !! input
15818 <nowiki><div
15819 >foo</div
15820 ></nowiki>
15821 !! result
15822 <p>&lt;div
15823 &gt;foo&lt;/div
15824 &gt;
15825 </p>
15826 !! end
15828 !! test
15829 4. extension tags
15830 !! input
15831 <nowiki><ref>foo</ref></nowiki>
15832 !! result
15833 <p>&lt;ref&gt;foo&lt;/ref&gt;
15834 </p>
15835 !! end
15837 #### --------------- Others ---------------
15838 !! test
15839 Escaping nowikis
15840 !! input
15841 &lt;nowiki&gt;foo&lt;/nowiki&gt;
15842 !! result
15843 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
15844 </p>
15845 !! end
15846 !! test
15848 Tag-like HTML structures are passed through as text
15849 !! input
15850 <x y>
15852 <x.y>
15854 <x-y>
15862 1<d e>f
15863 !! result
15864 <p>&lt;x y&gt;
15865 </p><p>&lt;x.y&gt;
15866 </p><p>&lt;x-y&gt;
15867 </p><p>1&gt;2
15868 </p><p>x&lt;y
15869 </p><p>a&gt;b
15870 </p><p>1&lt;d e&gt;f
15871 </p>
15872 !! end
15875 # This fails in the PHP parser (see bug 40670,
15876 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
15877 !! test
15878 Tag names followed by punctuation should not be recognized as tags
15879 !! options
15880 parsoid
15881 !! input
15882 <s.ome> text
15883 !! result
15884 <p>&lt;s.ome&gt; text
15885 </p>
15886 !! end
15888 !! test
15889 HTML tag with necessary entities in attributes
15890 !! input
15891 <span title="&amp;amp;">foo</span>
15892 !! result
15893 <p><span title="&amp;amp;">foo</span>
15894 </p>
15895 !! end
15897 !! test
15898 HTML tag with 'unnecessary' entity encoding in attributes
15899 !! input
15900 <span title="&amp;">foo</span>
15901 !! result
15902 <p><span title="&amp;">foo</span>
15903 </p>
15904 !! end
15906 !! test
15907 HTML tag with broken attribute value quoting
15908 !! input
15909 <span title="Hello world>Foo</span>
15910 !! result
15911 <p><span>Foo</span>
15912 </p>
15913 !! end
15915 !! test
15916 Parsoid-only: HTML tag with broken attribute value quoting
15917 !! options
15918 parsoid
15919 !! input
15920 <span title="Hello world>Foo</span>
15921 !! result
15922 <p><span title="Hello world">Foo</span>
15923 </p>
15924 !! end
15926 !! test
15927 Table with broken attribute value quoting
15928 !! input
15930 | title="Hello world|Foo
15932 !! result
15933 <table>
15934 <tr>
15935 <td>Foo
15936 </td></tr></table>
15938 !! end
15940 !! test
15941 Table with broken attribute value quoting on consecutive lines
15942 !! input
15944 | title="Hello world|Foo
15945 | style="color:red|Bar
15947 !! result
15948 <table>
15949 <tr>
15950 <td>Foo
15951 </td>
15952 <td>Bar
15953 </td></tr></table>
15955 !! end
15957 !! test
15958 Parsoid-only: Table with broken attribute value quoting on consecutive lines
15959 !! options
15960 parsoid
15961 !! input
15963 | title="Hello world|Foo
15964 | style="color:red|Bar
15966 !! result
15967 <table><tbody>
15968 <tr>
15969 <td title="Hello world">Foo
15970 </td><td style="color: red">Bar
15971 </td></tr></tbody></table>
15973 !! end
15975 !! test
15976 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
15977 !! options
15978 parsoid
15979 !! input
15980 {{}}
15981 !! result
15982 {{}}
15983 !! end
15985 !! test
15986 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
15987 !! options
15988 parsoid
15989 !! input
15990 }}{{
15991 !! result
15992 }}{{
15993 !! end
15995 !!test
15996 Accept empty td cell attribute
15997 !!input
15999 | align="center" | foo ||  |
16001 !!result
16002 <table>
16003 <tr>
16004 <td align="center"> foo </td>
16005 <td>
16006 </td></tr></table>
16008 !!end
16010 !!test
16011 Non-empty attributes in th-cells
16012 !!input
16014 ! Foo !! style="color: red" | Bar
16016 !!result
16017 <table>
16018 <tr>
16019 <th> Foo </th>
16020 <th style="color: red"> Bar
16021 </th></tr></table>
16023 !!end
16025 !!test
16026 Accept empty attributes in th-cells
16027 !!input
16029 !| foo !!| bar
16031 !!result
16032 <table>
16033 <tr>
16034 <th> foo </th>
16035 <th> bar
16036 </th></tr></table>
16038 !!end
16040 !!test
16041 Empty table rows go away
16042 !!input
16044 | Hello
16045 | there
16046 |- class="foo"
16049 !! result
16050 <table>
16051 <tr>
16052 <td> Hello
16053 </td>
16054 <td> there
16055 </td></tr>
16057 </table>
16059 !! end
16062 ### Parsoid-centric tests for testing RTing of inter-element separators
16063 ### Edge cases not tested by existing parser tests and specific to
16064 ### Parsoid-specific serialization strategies.
16067 !!test
16068 RT-ed inter-element separators should be valid separators
16069 !!input
16071 |- [[foo]]
16073 !!result
16074 <table>
16076 </table>
16078 !!end
16080 !!test
16081 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
16082 (Parsoid-only since PHP parser relies on Tidy for correct output)
16083 !!options
16084 parsoid
16085 !!input
16087 |<small>foo
16092 |<small>foo<small>
16094 !!result
16095 !!end
16097 !!test
16098 Empty TD followed by TD with tpl-generated attribute
16099 !!input
16103 |{{echo|style='color:red'}}|foo
16105 !!result
16106 <table>
16108 <tr>
16109 <td>
16110 </td>
16111 <td>foo
16112 </td></tr></table>
16114 !!end
16116 !!test
16117 Indented table with an empty td
16118 !!input
16119  {|
16120  |-
16122  |foo
16123  |}
16124 !!result
16125 <table>
16127 <tr>
16128 <td>
16129 </td>
16130 <td>foo
16131 </td></tr></table>
16133 !!end
16135 !!test
16136 Empty TR followed by a template-generated TR
16137 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
16138 !!options
16139 parsoid=wt2html,wt2wt
16140 !!input
16143 {{echo|<tr><td>foo</td></tr>}}
16145 !!result
16146 <table>
16147 <tbody>
16148 <tr></tr>
16149 <tr typeof="mw:Transclusion">
16150 <td>foo</td></tr></tbody></table>
16151 !!end
16153 ## PHP and parsoid output differ for this, and since this is primarily
16154 ## for testing Parsoid's serializer, marking this Parsoid only
16155 !!test
16156 Empty TR followed by mixed-ws-comment line should RT correctly
16157 !!options
16158 parsoid
16159 !!input
16162  <!--c-->
16164 <!--c--> <!--d-->
16166 !!result
16167 <table>
16168 <tbody>
16169 <tr>
16170 <td> <!--c--></td></tr>
16171 <tr>
16172 <td><!--c--> <!--d--></td></tr>
16173 </tbody></table>
16175 !!end
16177 !!test
16178 Multi-line image caption generated by templates with/without trailing newlines
16179 !!options
16180 parsoid
16181 !!input
16182 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
16183 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
16184 !!result
16185 <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>
16186 <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>
16188 !!end
16190 ## PHP emits broken html for this, and since this is primarily
16191 ## a Parsoid serializer test, marking this Parsoid only
16192 !!test
16193 Improperly nested inline or quotes tags with whitespace in between
16194 !!options
16195 parsoid
16196 !!input
16197 <span> <s>x</span> </s>
16198 ''' ''x''' ''
16199 !!result
16200 <p><span> <s>x</s></span><s> </s>
16201 <b> <i>x</i></b><i> </i>
16202 </p>
16203 !!end
16205 # -----------------------------------------------------------------
16206 # The following section of tests are primarily to spec requirements
16207 # around serialization of new/edited content.
16209 # All these tests are marked Parsoid html2wt and html2html only
16210 # ----------------------------------------------------------------
16212 !! test
16213 Image: Modifying size of an image
16214 !! options
16215 parsoid=html2wt
16216 !! input
16217 [[Image:Wiki.png|230x230px]]
16218 !! result
16219 <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>
16220 !!end
16222 !! test
16223 Image: New block level image should have \n before and after
16224 !! options
16225 parsoid=html2wt
16226 !! input
16228 [[File:Wiki.png|right|thumb|150x150px]]
16230 !! result
16231 <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>
16232 !!end
16234 !! test
16235 Lists: Add space after bullets
16236 !! options
16237 parsoid=html2wt
16238 !! input
16240 * foo
16241 * bar
16242 * <span> baz</span>
16243 !! result
16244 <ul>
16245 <li>foo</li>
16246 <li> bar</li>
16247 <li><span> baz</span></li>
16248 </ul>
16249 !! end
16252 TODO:
16253 more images
16254 more tables
16255 character entities
16256 and much more
16257 Try for 100% code coverage