1d331dff507a2d8ee4ac93f62041b8d027f7e636
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well-formedness
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-specific options (not run by PHP parser unless
25 # the test includes an html/php section)
26 # php php-only test (not run by the parsoid parser unless
27 # the test includes an html/parsoid section)
28 # showtitle make the first line the title
29 # showindicators make the first lines the page status indicators
30 # comment run through Linker::formatComment() instead of main parser
31 # local format section links in edit comment text as local links
32 # notoc disable table of contents
33 # thumbsize=NNN set the default thumb size to NNNpx for this test
34 #
35 # You can also set the following parser properties via test options:
36 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
37 # wgLinkHolderBatchSize, wgRawHtml
38 #
39 # For testing purposes, temporary articles can created:
40 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
41 # where '/' denotes a newline.
42
43 # This is the standard article assumed to exist.
44 !! article
45 Main Page
46 !! text
47 blah blah
48 !! endarticle
49
50 !!article
51 Foo
52 !!text
53 FOO
54 !!endarticle
55
56 !!article
57 Template:Foo
58 !!text
59 FOO
60 !!endarticle
61
62 !! article
63 Template:Blank
64 !! text
65 !! endarticle
66
67 !! article
68 Template:pipe
69 !! text
70 |
71 !! endarticle
72
73 !! article
74 Template:=
75 !! text
76 <nowiki>=</nowiki>
77 !! endarticle
78
79 !!article
80 MediaWiki:bad image list
81 !!text
82 * [[File:Bad.jpg]] except [[Nasty page]]
83 !!endarticle
84
85 !! article
86 Template:inner list
87 !! text
88 * item 1
89 !! endarticle
90
91 !! article
92 Template:tbl-start
93 !! text
94 {|
95 !! endarticle
96
97 !! article
98 Template:tbl-end
99 !! text
100 |}
101 !! endarticle
102
103 !! article
104 Template:echo
105 !! text
106 {{{1}}}
107 !! endarticle
108
109 !! article
110 Template:echo_with_span
111 !! text
112 <span>{{{1}}}</span>
113 !! endarticle
114
115 !! article
116 Template:echo_with_div
117 !! text
118 <div>{{{1}}}</div>
119 !! endarticle
120
121 !! article
122 Template:blank_param
123 !! text
124 {{{1}}}
125 {{{}}}
126 !! endarticle
127
128 !! article
129 Template:table_attribs
130 !! text
131 <noinclude>
132 |</noinclude>style="color:red;"|Foo
133 !! endarticle
134
135 !! article
136 Template:table_attribs_2
137 !! text
138 <noinclude>
139 |</noinclude>style="color:red;"|Foo
140 |Bar||Baz
141 !! endarticle
142
143 !! article
144 Template:table_attribs_3
145 !! text
146 <noinclude>
147 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
148 !! endarticle
149
150 !! article
151 Template:table_attribs_4
152 !! text
153 | style="background-color:#DC241f;" width="10px" |
154 !! endarticle
155
156 !! article
157 Template:table_attribs_5
158 !! text
159 <noinclude>
160 |</noinclude>style="color:red;"||Bar
161 !! endarticle
162
163 !! article
164 Template:table_attribs_6
165 !! text
166 style="background: <nowiki>
167
168
169 red;</nowiki>" |
170 !! endarticle
171
172 !! article
173 Template:table_attribs_7
174 !! text
175 <noinclude>
176 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
177 !! endarticle
178
179 !! article
180 Template:table_header_cells
181 !! text
182 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
183 !! endarticle
184
185 !! article
186 Template:table_cells
187 !! text
188 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
189 !! endarticle
190
191 !! article
192 Template:PartialTable
193 !! text
194 {|
195 |-
196 !! endarticle
197
198 !! article
199 Template:image_attribs
200 !! text
201 <noinclude>
202 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
203 !! endarticle
204
205 ## See T48811 for details
206 !! article
207 Template:mixed_attr_content_template
208 !! text
209 style="color:red;" title="T48811"
210 |-
211 |foo
212 !! endarticle
213
214 !! article
215 Template:definition_list
216 !! text
217 one
218 ::two
219 !! endarticle
220
221 !! article
222 A?b
223 !! text
224 Weirdo titles!
225 !! endarticle
226
227 !!article
228 Template:Bullet
229 !!text
230 * Bar
231 !!endarticle
232
233 !!article
234 Template:OpenTable
235 !!text
236 {|
237 !!endarticle
238
239 !!article
240 Template:EmptyLITest
241 !!text
242 *a
243 *
244 *
245 *b
246 !!endarticle
247
248 !!article
249 Template:EmptyTRTest
250 !!text
251 {|
252 |-
253 |-
254 |foo
255 |-
256 |-
257 |bar
258 |}
259 !!endarticle
260
261 !!article
262 Template:EmptyTRWithHTMLAttrTest
263 !!text
264 <table>
265 <tr align="center"></tr>
266 <tr><td>foo</td></tr>
267 <tr align="center"></tr>
268 <tr><td>bar</td></tr>
269 </table>
270 !!endarticle
271
272 ###
273 ### Basic tests
274 ###
275 !! test
276 Blank input
277 !! wikitext
278 !! html
279 !! end
280
281
282 !! test
283 Simple paragraph
284 !! wikitext
285 This is a simple paragraph.
286 !! html
287 <p>This is a simple paragraph.
288 </p>
289 !! end
290
291 !! test
292 Paragraphs with extra newline spacing
293 !! wikitext
294 foo
295
296 bar
297
298
299 baz
300
301
302
303 booz
304 !! html
305 <p>foo
306 </p><p>bar
307 </p><p><br />
308 baz
309 </p><p><br />
310 </p><p>booz
311 </p>
312 !! end
313
314 !! test
315 Paragraphs with newline spacing with comment lines in between
316 !! wikitext
317 ----
318 a
319 <!--foo-->
320 b
321 ----
322 a
323 <!--foo--><!--More than 1 comment, still stripped-->
324 b
325 ----
326 a
327 <!--foo--> <!----> <!-- bar -->
328 b
329 ----
330 a
331 <!--foo-->
332
333 b
334 ----
335 a
336
337 <!--foo-->
338 b
339 ----
340 a
341 <!--foo-->
342
343
344 b
345 ----
346 a
347
348
349 <!--foo-->
350 b
351 ----
352 !! html
353 <hr />
354 <p>a
355 b
356 </p>
357 <hr />
358 <p>a
359 b
360 </p>
361 <hr />
362 <p>a
363 b
364 </p>
365 <hr />
366 <p>a
367 </p><p>b
368 </p>
369 <hr />
370 <p>a
371 </p><p>b
372 </p>
373 <hr />
374 <p>a
375 </p><p><br />
376 b
377 </p>
378 <hr />
379 <p>a
380 </p><p><br />
381 b
382 </p>
383 <hr />
384
385 !! end
386
387 !! test
388 Paragraphs with newline spacing with non-empty white-space lines in between
389 !! wikitext
390 ----
391 a
392
393 b
394 ----
395 a
396
397
398 b
399 ----
400 !! html
401 <hr />
402 <p>a
403 </p><p>b
404 </p>
405 <hr />
406 <p>a
407 </p><p><br />
408 b
409 </p>
410 <hr />
411
412 !! end
413
414 !! test
415 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
416 !! wikitext
417 ----
418 a
419 <!--foo-->
420 b
421 ----
422 a
423 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
424 b
425 ----
426 a
427
428 <!--foo-->
429 <!--bar-->
430 b
431 ----
432 a
433
434 <!--foo-->
435 <!--bar-->
436
437 b
438 ----
439 !! html
440 <hr />
441 <p>a
442 b
443 </p>
444 <hr />
445 <p>a
446 b
447 </p>
448 <hr />
449 <p>a
450 </p><p>b
451 </p>
452 <hr />
453 <p>a
454 </p><p><br />
455 b
456 </p>
457 <hr />
458
459 !! end
460
461 !! test
462 Extra newlines: More paragraphs with indented comment
463 !! wikitext
464 a
465
466 <!--boo-->
467
468 b
469 !! html
470 <p>a
471 </p><p><br />
472 b
473 </p>
474 !!end
475
476 !! test
477 Extra newlines followed by heading
478 !! wikitext
479 a
480
481
482
483 =b=
484 [[a]]
485
486
487 =b=
488 !! html
489 <p>a
490 </p><p><br />
491 </p>
492 <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>
493 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
494 </p><p><br />
495 </p>
496 <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>
497
498 !! end
499
500 !! test
501 Extra newlines between heading and content are swallowed
502 !! wikitext
503 =b=
504
505
506
507 [[a]]
508 !! html
509 <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>
510 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
511 </p>
512 !! end
513
514 !! test
515 Parsing an URL
516 !! wikitext
517 http://fr.wikipedia.org/wiki/🍺
518 <!-- EasterEgg we love beer, better be able be able to link to it -->
519 !! html
520 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
521 </p>
522 !! end
523
524 # Note that the html+tidy output removes the spaces after the <li>,
525 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
526 # This is an issue for all tests with lists. We intentionally do
527 # *not* add html+tidy clauses for these, as we don't want to
528 # document/test the broken behavior. (Parsoid matches the non-tidy
529 # output in these cases.)
530
531 !! test
532 Simple list
533 !! wikitext
534 * Item 1
535 * Item 2
536 !! html
537 <ul><li> Item 1</li>
538 <li> Item 2</li></ul>
539
540 !! end
541
542 !! test
543 Italics and bold
544 !! wikitext
545 * plain
546 * plain''italic''plain
547 * plain''italic''plain''italic''plain
548 * plain'''bold'''plain
549 * plain'''bold'''plain'''bold'''plain
550 * plain''italic''plain'''bold'''plain
551 * plain'''bold'''plain''italic''plain
552 * plain''italic'''bold-italic'''italic''plain
553 * plain'''bold''bold-italic''bold'''plain
554 * plain'''''bold-italic'''italic''plain
555 * plain'''''bold-italic''bold'''plain
556 * plain''italic'''bold-italic'''''plain
557 * plain'''bold''bold-italic'''''plain
558 * plain l'''italic''plain
559 * plain l''''bold''' plain
560 !! html
561 <ul><li> plain</li>
562 <li> plain<i>italic</i>plain</li>
563 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
564 <li> plain<b>bold</b>plain</li>
565 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
566 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
567 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
568 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
569 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
570 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
571 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
572 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
573 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
574 <li> plain l'<i>italic</i>plain</li>
575 <li> plain l'<b>bold</b> plain</li></ul>
576
577 !! end
578
579 # this example taken from the [[simple:Moon]] article (bug 47326)
580 !! test
581 Italics and possessives (1)
582 !! wikitext
583 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
584 !! html
585 <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
586 </p>
587 !! end
588
589 # this example taken from [[en:Flaming Pie]] (bug 49926)
590 !! test
591 Italics and possessives (2)
592 !! wikitext
593 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
594 !! html
595 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
596 </p>
597 !! end
598
599 # this example taken from [[en:Dictionary]] (bug 49926)
600 !! test
601 Italics and possessives (3)
602 !! wikitext
603 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
604 !! html
605 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
606 </p>
607 !! end
608
609
610 ###
611 ### 2-quote opening sequence tests
612 ###
613 !! test
614 Italics and bold: 2-quote opening sequence: (2,2)
615 !! wikitext
616 ''foo''
617 !! html
618 <p><i>foo</i>
619 </p>
620 !!end
621
622 !! test
623 Italics and bold: 2-quote opening sequence: (2,3)
624 !! wikitext
625 ''foo'''
626 !! html/*
627 <p><i>foo'</i>
628 </p>
629 !!end
630
631 !! test
632 Italics and bold: 2-quote opening sequence: (2,4)
633 !! options
634 parsoid=wt2html
635 !! wikitext
636 ''foo''''
637 !! html/*
638 <p><i>foo''</i>
639 </p>
640 !!end
641
642 # same html as previous, but wikitext adjusted to match parsoid html2wt
643 !! test
644 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
645 !! wikitext
646 ''foo<nowiki>''</nowiki>''
647 !! html
648 <p><i>foo''</i>
649 </p>
650 !! end
651
652 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
653 !! test
654 Italics and bold: 2-quote opening sequence: (2,5)
655 !! options
656 parsoid=wt2html
657 !! wikitext
658 ''foo'''''
659 !! html/php
660 <p><i>foo</i>
661 </p>
662 !! html/parsoid
663 <p><i>foo</i><b></b>
664 </p>
665 !!end
666
667 # same html as previous, but wikitext adjusted to match parsoid html2wt
668 !! test
669 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
670 !! wikitext
671 ''foo'''''<nowiki/>'''
672 !! html/php
673 <p><i>foo</i>
674 </p>
675 !! html/parsoid
676 <p><i>foo</i><b></b>
677 </p>
678 !! end
679
680
681 ###
682 ### 3-quote opening sequence tests
683 ###
684
685 !! test
686 Italics and bold: 3-quote opening sequence: (3,2)
687 !! wikitext
688 '''foo''
689 !! html/*
690 <p>'<i>foo</i>
691 </p>
692 !!end
693
694 !! test
695 Italics and bold: 3-quote opening sequence: (3,3)
696 !! wikitext
697 '''foo'''
698 !! html
699 <p><b>foo</b>
700 </p>
701 !!end
702
703 !! test
704 Italics and bold: 3-quote opening sequence: (3,4)
705 !! wikitext
706 '''foo''''
707 !! html/*
708 <p><b>foo'</b>
709 </p>
710 !!end
711
712 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
713 !! test
714 Italics and bold: 3-quote opening sequence: (3,5)
715 !! options
716 parsoid=wt2html
717 !! wikitext
718 '''foo'''''
719 !! html/php
720 <p><b>foo</b>
721 </p>
722 !! html/parsoid
723 <p><b>foo</b><i></i>
724 </p>
725 !!end
726
727 # same html as previous, but wikitext adjusted to match parsoid html2wt
728 !! test
729 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
730 !! wikitext
731 '''foo'''''<nowiki/>''
732 !! html/php
733 <p><b>foo</b>
734 </p>
735 !! html/parsoid
736 <p><b>foo</b><i></i>
737 </p>
738 !! end
739
740
741 ###
742 ### 4-quote opening sequence tests
743 ###
744
745 !! test
746 Italics and bold: 4-quote opening sequence: (4,2)
747 !! options
748 parsoid=wt2html
749 !! wikitext
750 ''''foo''
751 !! html/*
752 <p>''<i>foo</i>
753 </p>
754 !!end
755
756 # same html as previous, but wikitext adjusted to match parsoid html2wt
757 !! test
758 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
759 !! wikitext
760 <nowiki>''</nowiki>''foo''
761 !! html
762 <p>''<i>foo</i>
763 </p>
764 !! end
765
766 !! test
767 Italics and bold: 4-quote opening sequence: (4,3)
768 !! wikitext
769 ''''foo'''
770 !! html/*
771 <p>'<b>foo</b>
772 </p>
773 !!end
774
775 !! test
776 Italics and bold: 4-quote opening sequence: (4,4)
777 !! options
778 parsoid=wt2html
779 !! wikitext
780 ''''foo''''
781 !! html/*
782 <p>'<b>foo'</b>
783 </p>
784 !!end
785
786 # same html as previous, but wikitext adjusted to match parsoid html2wt
787 !! test
788 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
789 !! wikitext
790 '<nowiki/>'''foo''''
791 !! html
792 <p>'<b>foo'</b>
793 </p>
794 !! end
795
796 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
797 !! test
798 Italics and bold: 4-quote opening sequence: (4,5)
799 !! options
800 parsoid=wt2html
801 !! wikitext
802 ''''foo'''''
803 !! html/php
804 <p>'<b>foo</b>
805 </p>
806 !! html/parsoid
807 <p>'<b>foo</b><i></i>
808 </p>
809 !!end
810
811 # same html as previous, but wikitext adjusted to match parsoid html2wt
812 !! test
813 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
814 !! wikitext
815 '<nowiki/>'''foo'''''<nowiki/>''
816 !! html/php
817 <p>'<b>foo</b>
818 </p>
819 !! html/parsoid
820 <p>'<b>foo</b><i></i>
821 </p>
822 !! end
823
824
825 ###
826 ### 5-quote opening sequence tests
827 ###
828
829 !! test
830 Italics and bold: 5-quote opening sequence: (5,2)
831 !! options
832 parsoid=wt2html
833 !! wikitext
834 '''''foo''
835 !! html/*
836 <p><b><i>foo</i></b>
837 </p>
838 !!end
839
840 # same html as previous, but wikitext adjusted to match parsoid html2wt
841 # skipping wt2html and html2html because it wants to put <i> before <b>
842 !! test
843 Italics and bold: 5-quote opening sequence: (5,2+3)
844 !! options
845 parsoid=wt2wt,html2wt
846 !! wikitext
847 '''''foo'''''
848 !! html
849 <p><b><i>foo</i></b>
850 </p>
851 !! end
852
853 !! test
854 Italics and bold: 5-quote opening sequence: (5,3)
855 !! options
856 parsoid=wt2html
857 !! wikitext
858 '''''foo'''
859 !! html/*
860 <p><i><b>foo</b></i>
861 </p>
862 !!end
863
864 # same html as previous, but wikitext adjusted to match parsoid html2wt
865 !! test
866 Italics and bold: 5-quote opening sequence: (5,3+2)
867 !! wikitext
868 '''''foo'''''
869 !! html
870 <p><i><b>foo</b></i>
871 </p>
872 !! end
873
874 !! test
875 Italics and bold: 5-quote opening sequence: (5,4)
876 !! options
877 parsoid=wt2html
878 !! wikitext
879 '''''foo''''
880 !! html/*
881 <p><i><b>foo'</b></i>
882 </p>
883 !!end
884
885 !! test
886 Italics and bold: 5-quote opening sequence: (5,5)
887 !! wikitext
888 '''''foo'''''
889 !! html
890 <p><i><b>foo</b></i>
891 </p>
892 !!end
893
894 !! test
895 Italics and bold: 5-quote opening sequence: (5,6)
896 !! wikitext
897 '''''foo''''''
898 !! html/*
899 <p><i><b>foo'</b></i>
900 </p>
901 !! end
902
903 ###
904 ### multiple quote sequences in a line
905 ###
906 !! test
907 Italics and bold: multiple quote sequences: (2,4,2)
908 !! options
909 parsoid=wt2html
910 !! wikitext
911 ''foo''''bar''
912 !! html/*
913 <p><i>foo'<b>bar</b></i>
914 </p>
915 !!end
916
917
918 # same html as previous, but wikitext adjusted to match parsoid html2wt
919 !! test
920 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
921 !! wikitext
922 ''foo'<nowiki/>'''bar'''''
923 !! html
924 <p><i>foo'<b>bar</b></i>
925 </p>
926 !! end
927
928
929 !! test
930 Italics and bold: multiple quote sequences: (2,4,3)
931 !! options
932 parsoid=wt2html
933 !! wikitext
934 ''foo''''bar'''
935 !! html/*
936 <p><i>foo'<b>bar</b></i>
937 </p>
938 !!end
939
940
941 # same html as previous, but wikitext adjusted to match parsoid html2wt
942 !! test
943 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
944 !! wikitext
945 ''foo'<nowiki/>'''bar'''''
946 !! html
947 <p><i>foo'<b>bar</b></i>
948 </p>
949 !! end
950
951
952 !! test
953 Italics and bold: multiple quote sequences: (2,4,4)
954 !! options
955 parsoid=wt2html
956 !! wikitext
957 ''foo''''bar''''
958 !! html/*
959 <p><i>foo'<b>bar'</b></i>
960 </p>
961 !!end
962
963
964 # same html as previous, but wikitext adjusted to match parsoid html2wt
965 !! test
966 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
967 !! wikitext
968 ''foo'<nowiki/>'''bar'<nowiki/>'''''
969 !! html
970 <p><i>foo'<b>bar'</b></i>
971 </p>
972 !! end
973
974
975 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
976 !! test
977 Italics and bold: multiple quote sequences: (3,4,2)
978 !! options
979 parsoid=wt2html
980 !! wikitext
981 '''foo''''bar''
982 !! html/php
983 <p><b>foo'</b>bar
984 </p>
985 !! html/parsoid
986 <p><b>foo'</b>bar<i></i>
987 </p>
988 !!end
989
990 # same html as previous, but wikitext adjusted to match parsoid html2wt
991 !! test
992 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
993 !! options
994 parsoid
995 !! wikitext
996 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
997 !! html/php
998 <p><b>foo'</b>bar
999 </p>
1000 !! html/parsoid
1001 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
1002 </p>
1003 !! end
1004
1005
1006 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1007 !! test
1008 Italics and bold: multiple quote sequences: (3,4,3)
1009 !! options
1010 parsoid=wt2html
1011 !! wikitext
1012 '''foo''''bar'''
1013 !! html/php
1014 <p><b>foo'</b>bar
1015 </p>
1016 !! html/parsoid
1017 <p><b>foo'</b>bar<b></b>
1018 </p>
1019 !!end
1020
1021 # same html as previous, but wikitext adjusted to match parsoid html2wt
1022 !! test
1023 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1024 !! wikitext
1025 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1026 !! html/php
1027 <p><b>foo'</b>bar
1028 </p>
1029 !! html/parsoid
1030 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1031 </p>
1032 !! end
1033
1034 ###
1035 ### other quote tests
1036 ###
1037 !! test
1038 Italics and bold: other quote tests: (2,3,5)
1039 !! wikitext
1040 ''this is about '''foo's family'''''
1041 !! html
1042 <p><i>this is about <b>foo's family</b></i>
1043 </p>
1044 !!end
1045
1046
1047 !! test
1048 Italics and bold: other quote tests: (2,(3,3),2)
1049 !! wikitext
1050 ''this is about '''foo's''' family''
1051 !! html
1052 <p><i>this is about <b>foo's</b> family</i>
1053 </p>
1054 !!end
1055
1056
1057 !! test
1058 Italics and bold: other quote tests: (3,2,3,2)
1059 !! options
1060 parsoid=wt2html
1061 !! wikitext
1062 '''this is about ''foo'''s family''
1063 !! html/*
1064 <p><b>this is about <i>foo</i></b><i>s family</i>
1065 </p>
1066 !!end
1067
1068
1069 # same html as previous, but wikitext adjusted to match parsoid html2wt
1070 !! test
1071 Italics and bold: other quote tests: (3,2,3+2+2,2)
1072 !! wikitext
1073 '''this is about ''foo'''''<nowiki/>''s family''
1074 !! html
1075 <p><b>this is about <i>foo</i></b><i>s family</i>
1076 </p>
1077 !! end
1078
1079
1080 !! test
1081 Italics and bold: other quote tests: (3,2,3,3)
1082 !! wikitext
1083 '''this is about ''foo'''s family'''
1084 !! html/*
1085 <p>'<i>this is about </i>foo<b>s family</b>
1086 </p>
1087 !!end
1088
1089
1090 !! test
1091 Italics and bold: other quote tests: (3,(2,2),3)
1092 !! wikitext
1093 '''this is about ''foo's'' family'''
1094 !! html
1095 <p><b>this is about <i>foo's</i> family</b>
1096 </p>
1097 !!end
1098
1099
1100 !! test
1101 Italicized possessive
1102 !! wikitext
1103 The ''[[Main Page]]'''s talk page.
1104 !! html/php
1105 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1106 </p>
1107 !! html/parsoid
1108 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1109 !! end
1110
1111 !! test
1112 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1113 (Requires tidy for PHP parser output to be fixed up)
1114 !! options
1115 parsoid=wt2html,wt2wt
1116 !! wikitext
1117 {|
1118 !''a!!''b
1119 |''a||''b
1120 |}
1121 !! html/php+tidy
1122 <table>
1123 <tr>
1124 <th><i>a</i></th>
1125 <th><i>b</i></th>
1126 <td><i>a</i></td>
1127 <td><i>b</i></td>
1128 </tr>
1129 </table>
1130 !! html/parsoid
1131 <table>
1132 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1133 <td><i>a</i></td><td><i>b</i></td></tr>
1134 </tbody></table>
1135 !! end
1136
1137 ###
1138 ### Non-html5 tags
1139 ###
1140
1141 !! test
1142 Non-html5 tags should be accepted
1143 !! wikitext
1144 <center>''foo''</center>
1145 <big>''foo''</big>
1146 <font>''foo''</font>
1147 <strike>''foo''</strike>
1148 <tt>''foo''</tt>
1149 !! html
1150 <center><i>foo</i></center>
1151 <p><big><i>foo</i></big>
1152 <font><i>foo</i></font>
1153 <strike><i>foo</i></strike>
1154 <tt><i>foo</i></tt>
1155 </p>
1156 !! end
1157
1158 !! test
1159 <wbr> is valid wikitext (bug 52468)
1160 !! wikitext
1161 <wbr>
1162 !! html
1163 <p><wbr />
1164 </p>
1165 !! end
1166
1167 # <strike> is HTML4, <s> is HTML4/5.
1168 !! test
1169 <s> or <strike> for strikethrough
1170 !! wikitext
1171 <strike>strike</strike>
1172
1173 <s>s</s>
1174 !! html
1175 <p><strike>strike</strike>
1176 </p><p><s>s</s>
1177 </p>
1178 !! end
1179
1180 ## a not permitted
1181 ## i,b,br omitted
1182 !! test
1183 Text-level semantic html elements in wikitext
1184 !! wikitext
1185 <em>text</em>
1186 <strong>text</strong>
1187 <small>text</small>
1188 <s>text</s>
1189 <cite>text</cite>
1190 <q>text</q>
1191 <dfn>text</dfn>
1192 <abbr>text</abbr>
1193 <data>text</data>
1194 <time>text</time>
1195 <code>text</code>
1196 <var>text</var>
1197 <samp>text</samp>
1198 <kbd>text</kbd>
1199 <sub>text</sub>
1200 <u>text</u>
1201 <mark>text</mark>
1202 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1203 <bdi>text</bdi>
1204 <bdo>text</bdo>
1205 <span>text</span>
1206 <wbr />
1207 !! html
1208 <p><em>text</em>
1209 <strong>text</strong>
1210 <small>text</small>
1211 <s>text</s>
1212 <cite>text</cite>
1213 <q>text</q>
1214 <dfn>text</dfn>
1215 <abbr>text</abbr>
1216 <data>text</data>
1217 <time>text</time>
1218 <code>text</code>
1219 <var>text</var>
1220 <samp>text</samp>
1221 <kbd>text</kbd>
1222 <sub>text</sub>
1223 <u>text</u>
1224 <mark>text</mark>
1225 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1226 <bdi>text</bdi>
1227 <bdo>text</bdo>
1228 <span>text</span>
1229 <wbr />
1230 </p>
1231 !! end
1232
1233 # test cases taken from
1234 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1235 !! test
1236 Ruby markup (W3C-style)
1237 !! wikitext
1238 ; Mono-ruby for individual base characters
1239 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1240 ; Group ruby
1241 : <ruby>今日<rt>きょう</rt></ruby>
1242 ; Jukugo ruby
1243 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1244 ; Inline ruby
1245 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1246 ; Double-sided ruby
1247 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1248 <ruby>
1249 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1250 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1251 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1252 </ruby>
1253 !! html
1254 <dl><dt> Mono-ruby for individual base characters</dt>
1255 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1256 <dt> Group ruby</dt>
1257 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1258 <dt> Jukugo ruby</dt>
1259 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1260 <dt> Inline ruby</dt>
1261 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1262 <dt> Double-sided ruby</dt>
1263 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1264 <p><ruby>
1265 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1266 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1267 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1268 </ruby>
1269 </p>
1270 !! end
1271
1272 # The next two test different paths in the sanitizer.
1273 !! test
1274 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1275 !! wikitext
1276 <blockquote|>a</blockquote>
1277
1278 <b→> doesn't terminate </b→>
1279
1280 <bä> doesn't terminate </bä>
1281
1282 <boo> doesn't terminate </boo>
1283
1284 <s.foo> doesn't terminate </s.foo>
1285
1286 <sub-ID#1>
1287 !! html
1288 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1289 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1290 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1291 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1292 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1293 </p><p>&lt;sub-ID#1&gt;
1294 </p>
1295 !! end
1296
1297 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1298 # If the non-word-character tag made it through the sanitizer, tidy
1299 # would munge it up.
1300 !! test
1301 Non-word characters don't terminate tag names + tidy
1302 !! wikitext
1303 <blockquote|>a</blockquote>
1304
1305 <b→> doesn't terminate </b→>
1306
1307 <bä> doesn't terminate </bä>
1308
1309 <boo> doesn't terminate </boo>
1310
1311 <s.foo> doesn't terminate </s.foo>
1312
1313 <sub-ID#1>
1314 !! html+tidy
1315 <p>&lt;blockquote|&gt;a</p>
1316 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1317 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1318 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1319 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1320 <p>&lt;sub-ID#1&gt;</p>
1321 !! end
1322
1323 ###
1324 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1325 ### This checks that HTML5 tags (with non-word characters in the tag
1326 ### name) make it safely through the parser -- the Sanitizer will
1327 ### munge them later, as it should.
1328 ###
1329 !! test
1330 Non-word characters are valid in extension tags (T19663)
1331 !! wikitext
1332 <tåg>tåg</tåg>
1333 !! html/php
1334 <pre>
1335 'tåg'
1336 array (
1337 )
1338 </pre>
1339
1340 !! end
1341
1342 !! test
1343 Isolated close tags should be treated as literal text (bug 52760)
1344 !! options
1345 parsoid=wt2html
1346 !! wikitext
1347 </b>
1348
1349 <s.foo>s</s>
1350 !! html/php+tidy
1351 <p>&lt;s.foo&gt;s</p>
1352 !! html/parsoid
1353 <p>&lt;s.foo&gt;s</p>
1354 !! end
1355
1356 ###
1357 ### Special characters
1358 ###
1359
1360 !! test
1361 Bare pipe character (bug 52363)
1362 !! wikitext
1363 |
1364 !! html
1365 <p>|
1366 </p>
1367 !! end
1368
1369 !! test
1370 Bare pipe character from a template (bug 52363)
1371 !! wikitext
1372 {{pipe}}
1373 !! html
1374 <p>|
1375 </p>
1376 !! end
1377
1378 ###
1379 ### <nowiki> test cases
1380 ###
1381
1382 !! test
1383 <nowiki> unordered list
1384 !! wikitext
1385 <nowiki>* This is not an unordered list item.</nowiki>
1386 !! html/php
1387 <p>* This is not an unordered list item.
1388 </p>
1389 !! html/parsoid
1390 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1391 !! end
1392
1393 !! test
1394 <nowiki> spacing
1395 !! wikitext
1396 <nowiki>Lorem ipsum dolor
1397
1398 sed abit.
1399 sed nullum.
1400
1401 :and a colon
1402 </nowiki>
1403 !! html/php
1404 <p>Lorem ipsum dolor
1405
1406 sed abit.
1407 sed nullum.
1408
1409 :and a colon
1410
1411 </p>
1412 !! html/parsoid
1413 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1414
1415 sed abit.
1416 sed nullum.
1417
1418 :and a colon
1419 </span></p>
1420 !! end
1421
1422 !! test
1423 nowiki 3
1424 !! wikitext
1425 :There is not nowiki.
1426 :There is <nowiki>nowiki</nowiki>.
1427
1428 #There is not nowiki.
1429 #There is <nowiki>nowiki</nowiki>.
1430
1431 *There is not nowiki.
1432 *There is <nowiki>nowiki</nowiki>.
1433 !! html/php
1434 <dl><dd>There is not nowiki.</dd>
1435 <dd>There is nowiki.</dd></dl>
1436 <ol><li>There is not nowiki.</li>
1437 <li>There is nowiki.</li></ol>
1438 <ul><li>There is not nowiki.</li>
1439 <li>There is nowiki.</li></ul>
1440
1441 !! html/parsoid
1442 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1443 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1444
1445 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1446 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1447
1448 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1449 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1450 !! end
1451
1452 !! test
1453 Entities inside <nowiki>
1454 !! wikitext
1455 <nowiki>&lt;</nowiki>
1456 !! html
1457 <p>&lt;
1458 </p>
1459 !! end
1460
1461 !! test
1462 Entities inside template parameters
1463 !! options
1464 parsoid
1465 !! wikitext
1466 {{echo|&ndash;}}
1467 !! html
1468 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1469 !! end
1470
1471 !! test
1472 Properly escape nowiki when combined with other wiki markup
1473 !! options
1474 parsoid=html2wt
1475 !! html
1476 <p>* &lt;/nowiki&gt; tag</p>
1477 !! wikitext
1478 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1479 !! end
1480
1481 !! test
1482 T93824: Put escaped HTML tags inside nowiki
1483 !! options
1484 parsoid=html2wt
1485 !! html
1486 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1487 !! wikitext
1488 <nowiki><h2>foo</h2></nowiki>
1489 !! end
1490
1491 !! test
1492 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1493 !! options
1494 parsoid=html2wt
1495 !! html
1496 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1497 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1498 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1499 !! wikitext
1500 This text: L'[[Foo]]
1501 This text: L<nowiki>''</nowiki>[[Foo]]
1502 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1503 !! end
1504
1505 # This test fails because wikitext whitespace is not normalized before comparing.
1506 !! test
1507 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1508 !! options
1509 parsoid=html2wt
1510 !! html
1511 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1512 </p>
1513 !! wikitext
1514 This text : L<nowiki>''</nowiki>[[Foo]]
1515 !! end
1516
1517 # This test and the next one are html2wt only as they test that incorrect wikitext
1518 # passed in template arguments gets escaped or wrapped in nowikis where required.
1519 !! test
1520 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1521 !! options
1522 parsoid=html2wt
1523 !! html/parsoid
1524 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&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|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1525 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&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|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1526 !! wikitext
1527 {{echo|foo{{!}}bar}}
1528 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1529 !! end
1530
1531 !! test
1532 T53961: Output correct nowikis in template arguments
1533 !! options
1534 parsoid=html2wt
1535 !! html/parsoid
1536 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&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;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1537 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&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;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1538 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&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;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1539 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&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;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1540 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&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;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1541 !! wikitext
1542 {{echo|a [ b}}
1543 {{echo|a <nowiki>}}</nowiki> b}}
1544 {{echo|<nowiki>a [[ b</nowiki>}}
1545 {{echo|a {{!}} <nowiki>{{ ]]</nowiki>}}
1546 {{echo|a <nowiki>}</nowiki>}}
1547 !! end
1548
1549 !! test
1550 Cases where "!!" needs nowiki protection
1551 !! options
1552 parsoid=html2wt
1553 !! html
1554 <table>
1555 <tr><th>this needs protection !! here</th></tr>
1556 </table>
1557
1558 <table>
1559 <tr><th>this does not need
1560 protection !! here</th></tr>
1561 </table>
1562 !! wikitext
1563 {|
1564 !<nowiki>this needs protection !! here</nowiki>
1565 |}
1566
1567 {|
1568 !this does not need
1569 protection !! here
1570 |}
1571 !! end
1572
1573 ###
1574 ### Comments
1575 ###
1576 !! test
1577 Comments and Indent-Pre
1578 !! wikitext
1579 <!-- comment 1 --> asdf
1580
1581 <!-- comment 1 --> asdf
1582 <!-- comment 2 -->
1583
1584 <!-- comment 1 --> asdf
1585 <!-- comment 2 -->xyz
1586
1587 <!-- comment 1 --> asdf
1588 <!-- comment 2 --> xyz
1589 !! html
1590 <pre>asdf
1591 </pre>
1592 <pre>asdf
1593 </pre>
1594 <pre>asdf
1595 </pre>
1596 <p>xyz
1597 </p>
1598 <pre>asdf
1599 xyz
1600 </pre>
1601 !! end
1602
1603 !! test
1604 Comment test 2a
1605 !! wikitext
1606 asdf
1607 <!-- comment 1 -->
1608 jkl
1609 !! html
1610 <p>asdf
1611 jkl
1612 </p>
1613 !! end
1614
1615 !! test
1616 Comment test 2b
1617 !! wikitext
1618 asdf
1619 <!-- comment 1 -->
1620
1621 jkl
1622 !! html
1623 <p>asdf
1624 </p><p>jkl
1625 </p>
1626 !! end
1627
1628 !! test
1629 Comment test 3
1630 !! wikitext
1631 asdf
1632 <!-- comment 1 -->
1633 <!-- comment 2 -->
1634 jkl
1635 !! html
1636 <p>asdf
1637 jkl
1638 </p>
1639 !! end
1640
1641 !! test
1642 Comment test 4
1643 !! wikitext
1644 asdf<!-- comment 1 -->jkl
1645 !! html
1646 <p>asdfjkl
1647 </p>
1648 !! end
1649
1650 !! test
1651 Comment spacing
1652 !! wikitext
1653 a
1654 <!-- foo --> b <!-- bar -->
1655 c
1656 !! html
1657 <p>a
1658 </p>
1659 <pre> b
1660 </pre>
1661 <p>c
1662 </p>
1663 !! end
1664
1665 !! test
1666 Comment whitespace
1667 !! wikitext
1668 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1669 !! html
1670
1671 !! end
1672
1673 !! test
1674 Comment semantics and delimiters
1675 !! wikitext
1676 <!-- --><!----><!-----><!------>
1677 !! html/php
1678
1679 !! html/parsoid
1680 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1681 !! end
1682
1683 !! test
1684 Comment semantics and delimiters, redux
1685 !! wikitext
1686 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1687 -- foo -- funky huh? ... -->
1688 !! html/php
1689
1690 !! html/parsoid
1691 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1692 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1693 !! end
1694
1695 !! test
1696 Comment semantics and delimiters: directors cut
1697 !! wikitext
1698 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1699 everything starting with < followed by !-- until the first -- and > we see,
1700 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1701 -->-->
1702 !! html/php
1703 <p>--&gt;
1704 </p>
1705 !! html/parsoid
1706 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1707 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1708 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1709 --><p>--></p>
1710 !! end
1711
1712 !! test
1713 Comment semantics: nesting
1714 !! wikitext
1715 <!--<!-- no, we're not going to do anything fancy here -->-->
1716 !! html/php
1717 <p>--&gt;
1718 </p>
1719 !! html/parsoid
1720 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1721 !! end
1722
1723 # Parsoid closes the unclosed comment, even if it means a slight
1724 # round-trip diff.
1725 !! test
1726 Comment semantics: unclosed comment at end
1727 !! options
1728 parsoid=wt2html,html2html
1729 !! wikitext
1730 <!--This comment will run out to the end of the document
1731 !! html/php
1732
1733 !! html/parsoid
1734 <!--This comment will run out to the end of the document-->
1735 !! end
1736
1737 !! test
1738 Comment semantics: normalize comments to play nice with XML and browsers
1739 !! wikitext
1740 <!-- Browsers --!> think this is closed -->
1741 <!--> This would normally be text -->
1742 <!---> As would this -->
1743 <!-- XML doesn't like trailing dashes -------->
1744 <!-- Nor doubled hyphens -- anywhere in the data -->
1745 But this is not a comment.
1746 !! html/php
1747 <p>But this is not a comment.
1748 </p>
1749 !! html/parsoid
1750 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1751 <!--&#x3E; This would normally be text -->
1752 <!--&#x2D;&#x3E; As would this -->
1753 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1754 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1755 <p>But this is not a comment.</p>
1756 !! end
1757
1758 !! test
1759 Comment semantics: round-trip even text which contains encoded -->
1760 !! wikitext
1761 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1762 !! html/parsoid
1763 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1764 !! end
1765
1766 !! test
1767 Comment in template title
1768 !! wikitext
1769 {{f<!---->oo}}
1770 !! html
1771 <p>FOO
1772 </p>
1773 !! end
1774
1775 !! test
1776 Comment on its own line post-expand
1777 !! wikitext
1778 a
1779 {{blank}}<!---->
1780 b
1781 !! html
1782 <p>a
1783 </p><p>b
1784 </p>
1785 !! end
1786
1787 !! test
1788 Comment on its own line post-expand with non-significant whitespace
1789 !! wikitext
1790 a
1791 {{blank}} <!---->
1792 b
1793 !! html
1794 <p>a
1795 </p><p>b
1796 </p>
1797 !! end
1798
1799 !! test
1800 Multiple comments should still parse as SOL-transparent
1801 !! options
1802 parsoid=wt2html,wt2wt
1803 !! wikitext
1804 <!--c1-->*a
1805 <!--c2--><!--c3--><!--c4-->*b
1806 !! html
1807 <!--c1--><ul>
1808 <li>a
1809 </li>
1810 <!--c2--><!--c3--><!--c4-->
1811 <li>b
1812 </li>
1813 </ul>
1814 !! end
1815
1816 ###
1817 ### paragraph wrapping tests
1818 ###
1819 !! test
1820 No block tags
1821 !! wikitext
1822 a
1823
1824 b
1825 !! html
1826 <p>a
1827 </p><p>b
1828 </p>
1829 !! end
1830
1831 !! test
1832 Block tag on one line (<div>)
1833 !! wikitext
1834 a <div>foo</div>
1835
1836 b
1837 !! html
1838 a <div>foo</div>
1839 <p>b
1840 </p>
1841 !! html+tidy
1842 <p>a</p>
1843 <div>foo</div>
1844 <p>b</p>
1845 !! end
1846
1847 !! test
1848 Block tag on one line (<blockquote>)
1849 !! wikitext
1850 a <blockquote>foo</blockquote>
1851
1852 b
1853 !! html
1854 a <blockquote>foo</blockquote>
1855 <p>b
1856 </p>
1857 !! html+tidy
1858 <p>a</p>
1859 <blockquote>
1860 <p>foo</p>
1861 </blockquote>
1862 <p>b</p>
1863 !! end
1864
1865 !! test
1866 Block tag on both lines (<div>)
1867 !! wikitext
1868 a <div>foo</div>
1869
1870 b <div>foo</div>
1871 !! html
1872 a <div>foo</div>
1873 b <div>foo</div>
1874
1875 !! html+tidy
1876 <p>a</p>
1877 <div>foo</div>
1878 <p>b</p>
1879 <div>foo</div>
1880 !! end
1881
1882 !! test
1883 Block tag on both lines (<blockquote>)
1884 !! wikitext
1885 a <blockquote>foo</blockquote>
1886
1887 b <blockquote>foo</blockquote>
1888 !! html
1889 a <blockquote>foo</blockquote>
1890 b <blockquote>foo</blockquote>
1891
1892 !! html+tidy
1893 <p>a</p>
1894 <blockquote>
1895 <p>foo</p>
1896 </blockquote>
1897 <p>b</p>
1898 <blockquote>
1899 <p>foo</p>
1900 </blockquote>
1901 !! end
1902
1903 !! test
1904 Multiple lines without block tags
1905 !! wikitext
1906 <div>foo</div> a
1907 b
1908 c
1909 d<!--foo--> e
1910 x <div>foo</div> z
1911 !! html
1912 <div>foo</div> a
1913 <p>b
1914 c
1915 d e
1916 </p>
1917 x <div>foo</div> z
1918
1919 !! html+tidy
1920 <div>foo</div>
1921 <p>a</p>
1922 <p>b c d e</p>
1923 <p>x</p>
1924 <div>foo</div>
1925 <p>z</p>
1926 !! end
1927
1928 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1929 # So, we have a separate section for Parsoid. We don't want
1930 # to mimic this stripping behavior in Parsoid. It affects
1931 # editing experience and also requires us to maintain additional
1932 # info for RT-ing.
1933 !! test
1934 Empty lines between lines with block tags
1935 !! wikitext
1936 <div></div>
1937
1938
1939 <div></div>a
1940
1941 b
1942 <div>a</div>b
1943
1944 <div>b</div>d
1945
1946
1947 <div>e</div>
1948 !! html
1949 <div></div>
1950 <p><br />
1951 </p>
1952 <div></div>a
1953 <p>b
1954 </p>
1955 <div>a</div>b
1956 <div>b</div>d
1957 <p><br />
1958 </p>
1959 <div>e</div>
1960
1961 !! html+tidy
1962 <p><br /></p>
1963 <p>a</p>
1964 <p>b</p>
1965 <div>a</div>
1966 <p>b</p>
1967 <div>b</div>
1968 <p>d</p>
1969 <p><br /></p>
1970 <div>e</div>
1971 !! html/parsoid
1972 <div data-parsoid='{"stx":"html"}'></div>
1973
1974 <p><br /></p>
1975 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1976
1977 <p>b</p>
1978 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1979
1980 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1981
1982 <p><br /></p>
1983 <div data-parsoid='{"stx":"html"}'>e</div>
1984 !! end
1985
1986 ## PHP parser emits output which is broken
1987 !! test
1988 Unclosed HTML p-tags should be handled properly
1989 !! wikitext
1990 <div><p>foo</div>
1991 a
1992
1993 b
1994 !! html/php+tidy
1995 <div>
1996 <p>foo</p>
1997 </div>
1998 <p>a</p>
1999 <p>b</p>
2000 !! html/parsoid
2001 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2002 <p>a</p>
2003 <p>b</p>
2004 !! end
2005
2006 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2007 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2008 ## them for now.
2009 !! test
2010 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2011 !! options
2012 parsoid=wt2html
2013 !! wikitext
2014 a [[Category:A1]] [[Category:A2]]
2015 [[Category:A3]]
2016 [[Category:A4]]
2017 !! html/parsoid
2018 <p>a</p>
2019 <link rel="mw:PageProp/Category" href="Category:A1"/> <link rel="mw:PageProp/Category" href="Category:A2"/> <link rel="mw:PageProp/Category" href="Category:A3"/> <link rel="mw:PageProp/Category" href="Category:A4"/>
2020 !! end
2021
2022 !! test
2023 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2024 !! options
2025 parsoid=wt2html
2026 !! wikitext
2027 [[Category:A1]]a
2028 !! html/parsoid
2029 <link rel="mw:PageProp/Category" href="Category:A1"/><p>a</p>
2030 !! end
2031
2032 ###
2033 ### Preformatted text
2034 ###
2035 !! test
2036 Preformatted text
2037 !! wikitext
2038 This is some
2039 Preformatted text
2040 With ''italic''
2041 And '''bold'''
2042 And a [[Main Page|link]]
2043 !! html
2044 <pre>This is some
2045 Preformatted text
2046 With <i>italic</i>
2047 And <b>bold</b>
2048 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2049 </pre>
2050 !! end
2051
2052 !! test
2053 Tabs don't trigger preformatted text
2054 !! wikitext
2055 This is not
2056 preformatted text.
2057 This is preformatted text.
2058 So is this.
2059 !! html
2060 <p> This is not
2061 preformatted text.
2062 </p>
2063 <pre>This is preformatted text.
2064 So is this.
2065 </pre>
2066 !! end
2067
2068 !! test
2069 Ident preformatting with inline content
2070 !! wikitext
2071 a
2072 ''b''
2073 !! html
2074 <pre>a
2075 <i>b</i>
2076 </pre>
2077 !! end
2078
2079 !! test
2080 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2081 !! wikitext
2082 <pre><nowiki>
2083 <b>
2084 <cite>
2085 <em>
2086 </nowiki></pre>
2087 !! html
2088 <pre>
2089 &lt;b&gt;
2090 &lt;cite&gt;
2091 &lt;em&gt;
2092 </pre>
2093
2094 !! end
2095
2096 !! test
2097 Regression with preformatted in <center>
2098 !! wikitext
2099 <center>
2100 Blah
2101 </center>
2102 !! html
2103 <center>
2104 <pre>Blah
2105 </pre>
2106 </center>
2107
2108 !! end
2109
2110 !! test
2111 Bug 52763: Preformatted in <blockquote>
2112 !! wikitext
2113 <blockquote>
2114 Blah
2115 {|
2116 |
2117 indented cell (no pre-wrapping!)
2118 |}
2119 </blockquote>
2120 !! html
2121 <blockquote>
2122 <p> Blah
2123 </p>
2124 <table>
2125 <tr>
2126 <td>
2127 <p> indented cell (no pre-wrapping!)
2128 </p>
2129 </td></tr></table>
2130 </blockquote>
2131
2132 !! end
2133
2134 !! test
2135 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2136 !! wikitext
2137 <blockquote>
2138 Foo
2139
2140 Bar
2141 </blockquote>
2142 !! html
2143 <blockquote>
2144 <p>Foo
2145 </p><p>Bar
2146 </p>
2147 </blockquote>
2148
2149 !! end
2150
2151 !! test
2152 Bug 15491: <ins>/<del> in blockquote
2153 !! wikitext
2154 <blockquote>
2155 Foo <del>bar</del> <ins>baz</ins> quux
2156 </blockquote>
2157 !! html
2158 <blockquote>
2159 <p>Foo <del>bar</del> <ins>baz</ins> quux
2160 </p>
2161 </blockquote>
2162
2163 !! end
2164
2165 # Note that the p-wrapping is newline sensitive, which could be
2166 # considered a bug: tidy will wrap only the 'Foo' in the example
2167 # below in a <p> tag. (see comment 23-25 of bug #6200)
2168 !! test
2169 Bug 15491: <ins>/<del> in blockquote (2)
2170 !! wikitext
2171 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2172 </blockquote>
2173 !! html
2174 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2175 </blockquote>
2176
2177 !! html+tidy
2178 <blockquote>
2179 <p>Foo</p>
2180 <del>bar</del> <ins>baz</ins> quux</blockquote>
2181 !! end
2182
2183 !! test
2184 <pre> with attributes (bug 3202)
2185 !! wikitext
2186 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2187 !! html
2188 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2189
2190 !! end
2191
2192 !! test
2193 <pre> with width attribute (bug 3202)
2194 !! wikitext
2195 <pre width="8">Narrow screen goodies</pre>
2196 !! html
2197 <pre width="8">Narrow screen goodies</pre>
2198
2199 !! end
2200
2201 !! test
2202 <pre> with forbidden attribute (bug 3202)
2203 !! wikitext
2204 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2205 !! html
2206 <pre width="8">Narrow screen goodies</pre>
2207
2208 !! end
2209
2210 !! test
2211 Entities inside <pre>
2212 !! wikitext
2213 <pre>&lt;</pre>
2214 !! html
2215 <pre>&lt;</pre>
2216
2217 !! end
2218
2219 !! test
2220 <pre> with forbidden attribute values (bug 3202)
2221 !! wikitext
2222 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2223 !! html
2224 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2225
2226 !! end
2227
2228 !! test
2229 <nowiki> inside <pre> (bug 13238)
2230 !! wikitext
2231 <pre>
2232 <nowiki>
2233 </pre>
2234 <pre>
2235 <nowiki></nowiki>
2236 </pre>
2237 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2238 !! html
2239 <pre>
2240 &lt;nowiki&gt;
2241 </pre>
2242 <pre>
2243
2244 </pre>
2245 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2246
2247 !! end
2248
2249 !! test
2250 <nowiki> and <pre> preference (first one wins)
2251 !! wikitext
2252 <pre>
2253 <nowiki>
2254 </pre>
2255 </nowiki>
2256 </pre>
2257
2258 <nowiki>
2259 <pre>
2260 <nowiki>
2261 </pre>
2262 </nowiki>
2263 </pre>
2264
2265 !! html/php
2266 <pre>
2267 &lt;nowiki&gt;
2268 </pre>
2269 <p>&lt;/nowiki&gt;
2270 &lt;/pre&gt;
2271 </p><p>
2272 &lt;pre&gt;
2273 &lt;nowiki&gt;
2274 &lt;/pre&gt;
2275
2276 &lt;/pre&gt;
2277 </p>
2278 !! html/parsoid
2279 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2280 </pre>
2281 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2282 &lt;/pre></p>
2283
2284 <p><span typeof="mw:Nowiki">
2285 &lt;pre>
2286 &lt;nowiki>
2287 &lt;/pre>
2288 </span>
2289 &lt;/pre></p>
2290 !! end
2291
2292 !! test
2293 </pre> inside nowiki
2294 !! wikitext
2295 <nowiki></pre></nowiki>
2296 !! html
2297 <p>&lt;/pre&gt;
2298 </p>
2299 !! end
2300
2301 # Parsoid doesn't strip empty tags, like Tidy does.
2302 !! test
2303 Empty pre; pre inside other HTML tags (bug 54946)
2304 !! options
2305 parsoid=wt2html,wt2wt
2306 !! wikitext
2307 a
2308
2309 <div><pre>
2310 foo
2311 </pre></div>
2312 <pre></pre>
2313 !! html/php
2314 <p>a
2315 </p>
2316 <div><pre>
2317 foo
2318 </pre></div>
2319 <pre></pre>
2320
2321 !! html/php+tidy
2322 <p>a</p>
2323 <div>
2324 <pre>
2325 foo
2326 </pre></div>
2327 !! html/parsoid
2328 <p>a</p>
2329
2330 <div><pre>foo
2331 </pre></div>
2332 <pre></pre>
2333 !! end
2334
2335 !! test
2336 HTML pre followed by indent-pre
2337 !! wikitext
2338 <pre>foo</pre>
2339 bar
2340 !! html
2341 <pre>foo</pre>
2342 <pre>bar
2343 </pre>
2344 !! end
2345
2346 !!test
2347 Block tag pre
2348 !!options
2349 parsoid
2350 !! wikitext
2351 <p><pre>foo</pre></p>
2352 !! html
2353 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2354 !!end
2355
2356 !!test
2357 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2358 !! wikitext
2359 {{echo|}}
2360 !! html
2361
2362 !!end
2363
2364 !!test
2365 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2366 !! wikitext
2367 {{echo|
2368 foo}}
2369 !! html
2370 <p>foo
2371 </p>
2372 !!end
2373
2374 !! test
2375 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2376 !! wikitext
2377 {{echo|a
2378 b}}
2379 !! html
2380 <pre>a
2381 </pre>
2382 <p>b
2383 </p>
2384 !!end
2385
2386 !! test
2387 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2388 !! wikitext
2389 {{echo|a
2390 b
2391 c
2392 d
2393 e
2394 }}
2395 !! html
2396 <pre>a
2397 </pre>
2398 <p>b
2399 c
2400 </p>
2401 <pre>d
2402 </pre>
2403 <p>e
2404 </p>
2405 !!end
2406
2407 !!test
2408 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2409 !! wikitext
2410 {{echo| foo}}
2411
2412 {{echo| foo}}{{echo| bar}}
2413
2414 {{echo| foo}}
2415 {{echo| bar}}
2416
2417 {{echo|<!--cmt--> foo}}
2418
2419 <!--cmt-->{{echo| foo}}
2420
2421 {{echo|{{echo| }}bar}}
2422 !! html
2423 <pre>foo
2424 </pre>
2425 <pre>foo bar
2426 </pre>
2427 <pre>foo
2428 bar
2429 </pre>
2430 <pre>foo
2431 </pre>
2432 <pre>foo
2433 </pre>
2434 <pre>bar
2435 </pre>
2436 !!end
2437
2438 !! test
2439 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2440 !! wikitext
2441 {{echo| }}a
2442
2443 {{echo|
2444 }}a
2445
2446 {{echo|
2447 b}}
2448
2449 {{echo|a
2450 }}b
2451
2452 {{echo|a
2453 }} b
2454 !! html
2455 <pre>a
2456 </pre>
2457 <p><br />
2458 </p>
2459 <pre>a
2460 </pre>
2461 <p><br />
2462 </p>
2463 <pre>b
2464 </pre>
2465 <p>a
2466 </p>
2467 <pre>b
2468 </pre>
2469 <p>a
2470 </p>
2471 <pre>b
2472 </pre>
2473 !!end
2474
2475 !! test
2476 Things that look like <pre> tags aren't treated as such
2477 !! wikitext
2478 Barack Obama <President> of the United States
2479 <President></President>
2480 !! html
2481 <p>Barack Obama &lt;President&gt; of the United States
2482 &lt;President&gt;&lt;/President&gt;
2483 </p>
2484 !! end
2485
2486 ## PHP parser discards the "<pre " string
2487 !! test
2488 Handle broken pre-like tags (bug 64025)
2489 !! options
2490 parsoid=wt2html
2491 !! wikitext
2492 {{echo|<pre <pre>x</pre>}}
2493
2494 <table><pre </table>
2495 !! html/php
2496 <pre>x</pre>
2497 <table><pre></pre></table>
2498
2499 !! html/parsoid
2500 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2501
2502
2503 <p>&lt;pre </p>
2504
2505 <table></table>
2506 !! end
2507
2508 !! test
2509 Parsoid: handle pre with space after attribute
2510 !! options
2511 parsoid=wt2html
2512 !! wikitext
2513 <pre style="width:50%;" >{{echo|foo}}</pre>
2514 !! html
2515 <pre style="width:50%;">{{echo|foo}}</pre>
2516 !! end
2517
2518 # TODO / maybe: fix wt2wt for this
2519 !! test
2520 Parsoid: Don't paragraph-wrap fosterable content
2521 !! options
2522 parsoid=wt2html
2523 !! wikitext
2524 {|
2525 <td></td>
2526 <td></td>
2527
2528
2529
2530 |}
2531 !! html
2532 <table>
2533
2534 <tbody>
2535 <tr>
2536 <td></td>
2537
2538 <td></td></tr>
2539
2540
2541
2542 </tbody></table>
2543 !! end
2544
2545 !! test
2546 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2547 !! options
2548 parsoid=wt2html
2549 !! wikitext
2550 {|
2551 <td>
2552 <td>
2553 </td>
2554
2555
2556
2557 |}
2558 !! html
2559 <table>
2560
2561 <tbody>
2562 <tr>
2563 <td></td>
2564
2565 <td>
2566 </td></tr>
2567
2568
2569
2570 </tbody></table>
2571 !! end
2572
2573
2574 #--------------------------------------------------------------------
2575 # Transclusion parameter whitespace stripping tests
2576 # Behavior is different for positional and named parameters
2577 #--------------------------------------------------------------------
2578 !! test
2579 Templates: Strip leading and trailing whitespace from named-param values
2580 !! wikitext
2581 {{echo|1= a }}
2582
2583 {{echo|1= {{echo|b}} }}
2584
2585 {{echo| 1 =
2586 c }}
2587
2588 {{echo| 1 =
2589 * d
2590 }}
2591 !! html
2592 <p>a
2593 </p><p>b
2594 </p><p>c
2595 </p>
2596 <ul><li> d</li></ul>
2597
2598 !! end
2599
2600 !! test
2601 Templates: Don't strip whitespace from positional-param values
2602 !! wikitext
2603 {{echo|a }}
2604
2605 {{echo|{{echo|b}} }}
2606
2607 {{echo| c
2608 }}
2609
2610 {{echo| {{echo|d}}
2611 }}
2612
2613 {{echo|
2614 e}}
2615
2616 {{echo|
2617 * f}}
2618
2619 {{echo|
2620 }}g
2621 !! html
2622 <p>a
2623 </p><p>b
2624 </p>
2625 <pre>c
2626 </pre>
2627 <p><br />
2628 </p>
2629 <pre>d
2630 </pre>
2631 <p><br />
2632 </p>
2633 <pre>e
2634 </pre>
2635 <p><br />
2636 </p>
2637 <ul><li> f</li></ul>
2638 <p><br />
2639 </p>
2640 <pre>g
2641 </pre>
2642 !! end
2643
2644 !! test
2645 Templates: Handle empty comment-and-ws-only lines correctly
2646 !! wikitext
2647 {{echo|foo
2648 <!--should be ignored-->
2649 <!--should be ignored as well-->
2650 bar}}
2651 !! html
2652 <p>foo
2653 bar
2654 </p>
2655 !! end
2656
2657 !! test
2658 Templates: Handle comments in the target
2659 !! wikitext
2660 {{echo
2661 <!-- should be ignored -->
2662 |foo}}
2663
2664 {{echo<!-- should be ignored -->
2665 |foo}}
2666
2667 {{echo<!-- should be ignored -->|foo}}
2668
2669 {{<!-- should be ignored -->echo|foo}}
2670 !!html/parsoid
2671 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2672
2673 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2674
2675 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2676
2677 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2678 !!end
2679
2680 !! test
2681 Templates: Handle comments in parameter names (bug 67657)
2682 !! wikitext
2683 {{echo|1
2684 <!-- should be ignored -->
2685 =foo}}
2686
2687 {{echo|
2688 <!-- should be ignored -->
2689 1 = foo}}
2690
2691 {{echo|1<!-- should be ignored --> = foo}}
2692
2693 {{echo|<!-- should be ignored -->1 = foo}}
2694 !!html/parsoid
2695 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2696
2697 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2698
2699 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2700
2701 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2702 !!end
2703
2704 !! test
2705 Templates: Other wikitext in parameter names (bug 67657)
2706 !! wikitext
2707 {{echo|''1''=foo}}
2708 !!html/parsoid
2709 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2710 !!html/php
2711 <p>{{{1}}}
2712 </p>
2713 !!end
2714
2715 #--------------------------------------------------------------------
2716 # Transclusion parameter escaping tests
2717 #--------------------------------------------------------------------
2718 !! test
2719 Templates: Parsoid parameter escaping test 1
2720 !! options
2721 parsoid
2722 !! wikitext
2723 {{echo|[foo]|{{echo|[bar]}}}}
2724 !! html
2725 <p about="#mwt1" typeof="mw:Transclusion"
2726 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2727 !! end
2728
2729 !! test
2730 Parsoid: Pipes in external links in template parameter
2731 !! options
2732 parsoid
2733 !! wikitext
2734 {{echo|[{{echo|http://example.com}} link]}}
2735 !! html
2736 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2737 !! end
2738
2739 !! test
2740 Parsoid: pipe in transclusion parameter
2741 !! options
2742 parsoid
2743 !! wikitext
2744 {{echo|http://foo.com/a&#124;b}}
2745 !! html
2746 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2747 typeof="mw:Transclusion"
2748 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
2749 !! end
2750
2751 !! test
2752 Parsoid: Pipe in external link target and content in template parameter
2753 !! options
2754 parsoid=html2wt,wt2wt
2755 !! wikitext
2756 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2757 !! html
2758 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2759 typeof="mw:Transclusion"
2760 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2761 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2762 !! end
2763
2764 !! test
2765 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2766 !! options
2767 parsoid
2768 !! wikitext
2769 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2770 !! html
2771 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
2772 !! end
2773
2774 !! test
2775 Templates: Don't escape already nowiki-escaped text in template parameters
2776 !! options
2777 parsoid=html2wt,wt2wt
2778 !! wikitext
2779 {{echo|foo<nowiki>|</nowiki>bar}}
2780 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2781 {{echo|<nowiki></nowiki>}}
2782 !! html
2783 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2784 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2785 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2786 </p>
2787 !! end
2788
2789 ## Bug 52824
2790 !! test
2791 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2792 !! options
2793 parsoid=html2wt,wt2wt
2794 !! wikitext
2795 {{echo|{{echo|1=bar}}}}
2796 !! html
2797 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2798 !! end
2799
2800 ## Bug 56733
2801 !! test
2802 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2803 !! options
2804 parsoid
2805 !! wikitext
2806 {{echo|a : b}}
2807 !! html
2808 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2809 !! end
2810
2811 ## Bug T73412
2812 !! test
2813 Templates: Preserve blank parameter names
2814 !! wikitext
2815 {{echo|=foo}}
2816 !! html/php
2817 <p>{{{1}}}
2818 </p>
2819 !! html/parsoid
2820 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2821 !! end
2822
2823 !! test
2824 Templates: Preserve blank parameter names in other positions
2825 !! wikitext
2826 {{blank_param|bar|=foo}}
2827 !! html/php
2828 <p>bar
2829 foo
2830 </p>
2831 !! html/parsoid
2832 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]},{"k":"","named":true,"spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2833 foo</p>
2834 !! end
2835
2836 ###
2837 ### Parsoid-centric tests for testing RT edge cases for pre
2838 ###
2839
2840 !!test
2841 1a. Indent-Pre and Comments
2842 !! wikitext
2843 a
2844 <!--a-->
2845 c
2846 !! html
2847 <pre>a
2848 </pre>
2849 <p>c
2850 </p>
2851 !!end
2852
2853 !!test
2854 1b. Indent-Pre and Comments
2855 !! wikitext
2856 a
2857 <!--a-->
2858 c
2859 !! html
2860 <pre>a
2861 </pre>
2862 <p>c
2863 </p>
2864 !!end
2865
2866 !!test
2867 1c. Indent-Pre and Comments
2868 !! wikitext
2869 <!--a--> a
2870
2871 <!--a--> a
2872 !! html
2873 <pre> a
2874 </pre>
2875 <pre> a
2876 </pre>
2877 !!end
2878
2879 !!test
2880 1d. Indent-Pre and Comments
2881 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2882 !! wikitext
2883 <!--a--> a
2884
2885 <!--b-->b
2886 !! html
2887 <pre>a
2888 </pre>
2889 <pre>b
2890 </pre>
2891 !!end
2892
2893 !!test
2894 2a. Indent-Pre and tables
2895 !! wikitext
2896 {|
2897 |-
2898 !h1!!h2
2899 |foo||bar
2900 |}
2901 !! html
2902 <table>
2903
2904 <tr>
2905 <th>h1</th>
2906 <th>h2
2907 </th>
2908 <td>foo</td>
2909 <td>bar
2910 </td></tr></table>
2911
2912 !!end
2913
2914 !!test
2915 2b. Indent-Pre and tables
2916 !! wikitext
2917 {|
2918 |-
2919 |foo
2920 |}
2921 !! html
2922 <table>
2923
2924 <tr>
2925 <td>foo
2926 </td></tr></table>
2927
2928 !!end
2929
2930 !!test
2931 2c. Indent-Pre and tables (bug 42252)
2932 !! wikitext
2933 {|
2934 |+ foo
2935 ! | bar
2936 |}
2937 !! html
2938 <table>
2939 <caption> foo
2940 </caption>
2941 <tr>
2942 <th> bar
2943 </th></tr></table>
2944
2945 !!end
2946
2947 !!test
2948 2d. Indent-Pre and tables
2949 !! wikitext
2950 a
2951 {|
2952 | b
2953 |}
2954 !! html/php
2955 <pre>a
2956 </pre>
2957 <table>
2958 <tr>
2959 <td> b
2960 </td></tr></table>
2961
2962 !! html/parsoid
2963 <pre>a</pre>
2964 <table>
2965 <tbody><tr><td> b</td></tr>
2966 </tbody></table>
2967 !!end
2968
2969 !!test
2970 2e. Indent-Pre and table-line syntax
2971 !! wikitext
2972 a
2973 | b
2974 | c
2975 !! html/php
2976 <pre>a
2977 | b
2978 | c
2979 </pre>
2980 !!end
2981
2982 !!test
2983 2f. Indent-pre started by table-line syntax
2984 !! wikitext
2985 a
2986 | b
2987 | c
2988 !! html/php
2989 <p>a
2990 </p>
2991 <pre>| b
2992 | c
2993 </pre>
2994 !! html/parsoid
2995 <p>a</p>
2996 <pre>
2997 | b
2998 | c</pre>
2999 !!end
3000
3001 !!test
3002 3a. Indent-Pre and block tags (single-line html)
3003 !! wikitext
3004 a <p> foo </p>
3005 b <div> foo </div>
3006 c <blockquote> foo </blockquote>
3007 <span> foo </span>
3008 !! html
3009 a <p> foo </p>
3010 b <div> foo </div>
3011 c <blockquote> foo </blockquote>
3012 <pre><span> foo </span>
3013 </pre>
3014 !! html/parsoid
3015 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3016 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3017 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3018 <pre><span> foo </span>
3019 </pre>
3020 !! html+tidy
3021 <p>a</p>
3022 <p>foo</p>
3023 <p>b</p>
3024 <div>foo</div>
3025 <p>c</p>
3026 <blockquote>
3027 <p>foo</p>
3028 </blockquote>
3029 <pre>
3030 <span> foo </span>
3031 </pre>
3032 !! end
3033
3034 !!test
3035 3b. Indent-Pre and block tags (multi-line html)
3036 !! wikitext
3037 a <span>foo</span>
3038 b <div> foo </div>
3039 !! html
3040 <pre>a <span>foo</span>
3041 </pre>
3042 b <div> foo </div>
3043
3044 !! html/parsoid
3045 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3046 b <div data-parsoid='{"stx":"html"}'> foo </div>
3047 !! html+tidy
3048 <pre>
3049 a <span>foo</span>
3050 </pre>
3051 <p>b</p>
3052 <div>foo</div>
3053 !!end
3054
3055 !!test
3056 3c. Indent-Pre and block tags (pre-content on separate line)
3057 !! wikitext
3058 <p>
3059 foo
3060 </p>
3061
3062 <div>
3063 foo
3064 </div>
3065
3066 <center>
3067 foo
3068 </center>
3069
3070 <blockquote>
3071 foo
3072 </blockquote>
3073
3074 <blockquote>
3075 <pre>
3076 foo
3077 </pre>
3078 </blockquote>
3079
3080 <table><tr><td>
3081 foo
3082 </td></tr></table>
3083
3084 <ul><li>
3085 foo
3086 </li></ul>
3087
3088 !! html
3089 <p>
3090 foo
3091 </p>
3092 <div>
3093 <pre>foo
3094 </pre>
3095 </div>
3096 <center>
3097 <pre>foo
3098 </pre>
3099 </center>
3100 <blockquote>
3101 <p> foo
3102 </p>
3103 </blockquote>
3104 <blockquote>
3105 <pre>
3106 foo
3107 </pre>
3108 </blockquote>
3109 <table><tr><td>
3110 <pre>foo
3111 </pre>
3112 </td></tr></table>
3113 <ul><li>
3114 foo
3115 </li></ul>
3116
3117 !!end
3118
3119 !!test
3120 4. Indent-Pre and extension tags
3121 !! wikitext
3122 a <gallery>
3123 File:foobar.jpg
3124 </gallery>
3125 !! html
3126 a <ul class="gallery mw-gallery-traditional">
3127 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3128 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
3129 <div class="gallerytext">
3130 </div>
3131 </div></li>
3132 </ul>
3133
3134 !! html+tidy
3135 <p>a</p>
3136 <ul class="gallery mw-gallery-traditional">
3137 <li class="gallerybox" style="width: 155px">
3138 <div style="width: 155px">
3139 <div class="thumb" style="width: 150px;">
3140 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div>
3141 </div>
3142 <div class="gallerytext"></div>
3143 </div>
3144 </li>
3145 </ul>
3146 !!end
3147
3148 !! test
3149 Table wikitext syntax outside wiki-tables
3150 !! wikitext
3151 a
3152 ! not a table heading
3153 |- not a table row
3154 | not a table cell
3155 | class="foo bar" | baz
3156 b
3157 |}
3158 |-
3159 c
3160 !! html
3161 <p>a
3162 ! not a table heading
3163 |- not a table row
3164 | not a table cell
3165 | class="foo bar" | baz
3166 b
3167 |}
3168 |-
3169 c
3170 </p>
3171 !! end
3172
3173 !!test
3174 Render paragraphs when indent-pre is suppressed in blocklevels
3175 !! wikitext
3176 <blockquote>
3177 foo
3178
3179 bar
3180 </blockquote>
3181 !! html
3182 <blockquote>
3183 <p> foo
3184 </p><p> bar
3185 </p>
3186 </blockquote>
3187
3188 !!end
3189
3190 !!test
3191 4. Multiple spaces at start-of-line
3192 !! wikitext
3193 <p> foo </p>
3194 foo
3195 {|
3196 |foo
3197 |}
3198 !! html
3199 <p> foo </p>
3200 <pre> foo
3201 </pre>
3202 <table>
3203 <tr>
3204 <td>foo
3205 </td></tr></table>
3206
3207 !!end
3208
3209 ## NOTE: the leading white-space chars on empty line are significant
3210 !! test
3211 5a. White-space in indent-pre
3212 !! wikitext
3213 a<br />
3214
3215 b
3216 !! html
3217 <pre>a<br />
3218
3219 b
3220 </pre>
3221 !! end
3222
3223 ## NOTE: the leading white-space chars on empty line are significant
3224 !! test
3225 5b. White-space in indent-pre
3226 !! wikitext
3227 a
3228
3229 b
3230
3231
3232 c
3233 !! html
3234 <pre>a
3235
3236 b
3237
3238
3239 c
3240 </pre>
3241 !! end
3242
3243 !! test
3244 5c. White-space in indent-pre
3245 !! wikitext
3246 ''a''
3247 ''b''
3248 ''c''
3249 !! html
3250 <pre><i>a</i>
3251 <i>b</i>
3252 <i>c</i>
3253 </pre>
3254 !! end
3255
3256 !! test
3257 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3258 !! wikitext
3259 a
3260
3261 <!-- continue -->
3262 b
3263
3264 c
3265
3266 d
3267 !! html
3268 <pre>a
3269
3270 b
3271 </pre>
3272 <pre>c
3273
3274 </pre>
3275 <p>d
3276 </p>
3277 !! end
3278
3279 !! test
3280 7a. Indent-pre and category links
3281 !! options
3282 parsoid=wt2html,wt2wt
3283 !! wikitext
3284 [[Category:foo]] <!-- No pre-wrapping -->
3285 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3286 !! html/parsoid
3287 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3288 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3289 !! end
3290
3291 !! test
3292 7b. Indent-pre and category links
3293 !! options
3294 parsoid=wt2html,wt2wt
3295 !! wikitext
3296 [[Category:foo]] a
3297 [[Category:foo]] {{echo|b}}
3298 !! html
3299 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3300 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3301 !! end
3302
3303 !! test
3304 Indent-Pre: Newlines in comments shouldn't affect sol state
3305 !! wikitext
3306 a <!--
3307 foo
3308 --> b
3309 !! html/parsoid
3310 <p>a <!--
3311 foo
3312 --> b</p>
3313 !! end
3314
3315 ###
3316 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3317 ###
3318
3319 !!test
3320 HTML-pre: 1. embedded newlines
3321 !! wikitext
3322 <pre>foo</pre>
3323
3324 <pre>
3325 foo
3326 </pre>
3327
3328 <pre>
3329
3330 foo
3331 </pre>
3332
3333 <pre>
3334
3335
3336 foo
3337 </pre>
3338 !! html
3339 <pre>foo</pre>
3340 <pre>
3341 foo
3342 </pre>
3343 <pre>
3344
3345 foo
3346 </pre>
3347 <pre>
3348
3349
3350 foo
3351 </pre>
3352
3353 !! html/parsoid
3354 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3355
3356 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3357 foo
3358 </pre>
3359
3360 <pre data-parsoid='{"stx":"html"}'>
3361
3362 foo
3363 </pre>
3364
3365 <pre data-parsoid='{"stx":"html"}'>
3366
3367
3368 foo
3369 </pre>
3370 !!end
3371
3372 !! test
3373 HTML-pre: big spaces
3374 !! wikitext
3375 <pre>
3376
3377
3378
3379
3380 haha
3381
3382
3383
3384
3385 haha
3386
3387
3388
3389
3390 </pre>
3391 !! html
3392 <pre>
3393
3394
3395
3396
3397 haha
3398
3399
3400
3401
3402 haha
3403
3404
3405
3406
3407 </pre>
3408
3409 !! html/parsoid
3410 <pre data-parsoid='{"stx":"html"}'>
3411
3412
3413
3414
3415 haha
3416
3417
3418
3419
3420 haha
3421
3422
3423
3424
3425 </pre>
3426 !! end
3427
3428 !!test
3429 HTML-pre: 2: indented text
3430 !! wikitext
3431 <pre>
3432 foo
3433 </pre>
3434 !! html
3435 <pre>
3436 foo
3437 </pre>
3438
3439 !!end
3440
3441 !!test
3442 HTML-pre: 3: other wikitext
3443 !! wikitext
3444 <pre>
3445 * foo
3446 # bar
3447 = no-h =
3448 '' no-italic ''
3449 [[ NoLink ]]
3450 </pre>
3451 !! html/php
3452 <pre>
3453 * foo
3454 # bar
3455 = no-h =
3456 '' no-italic ''
3457 [[ NoLink ]]
3458 </pre>
3459
3460 !! html/parsoid
3461 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3462 # bar
3463 = no-h =
3464 '' no-italic ''
3465 [[ NoLink ]]
3466 </pre>
3467 !!end
3468
3469 ###
3470 ### Definition lists
3471 ###
3472 !! test
3473 Simple definition
3474 !! wikitext
3475 ; name : Definition
3476 !! html
3477 <dl><dt> name&#160;</dt>
3478 <dd> Definition</dd></dl>
3479
3480 !! end
3481
3482 !! test
3483 Definition list for indentation only
3484 !! wikitext
3485 : Indented text
3486 !! html
3487 <dl><dd> Indented text</dd></dl>
3488
3489 !! end
3490
3491 !! test
3492 Definition list with no space
3493 !! wikitext
3494 ;name:Definition
3495 !! html
3496 <dl><dt>name</dt>
3497 <dd>Definition</dd></dl>
3498
3499 !!end
3500
3501 !! test
3502 Definition list with URL link
3503 !! wikitext
3504 ; http://example.com/ : definition
3505 !! html
3506 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3507 <dd> definition</dd></dl>
3508
3509 !! end
3510
3511 !! test
3512 Definition list with bracketed URL link
3513 !! wikitext
3514 ;[http://www.example.com/ Example]:Something about it
3515 !! html
3516 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3517 <dd>Something about it</dd></dl>
3518
3519 !! end
3520
3521 !! test
3522 Definition list with wikilink containing colon
3523 !! wikitext
3524 ; [[Help:FAQ]]: The least-read page on Wikipedia
3525 !! html
3526 <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>
3527 <dd> The least-read page on Wikipedia</dd></dl>
3528
3529 !! end
3530
3531 # At Brion's and JeLuF's insistence... :)
3532 !! test
3533 Definition list with news link containing colon
3534 !! wikitext
3535 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3536 !! html/php
3537 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3538 <dd> This isn't even a real newsgroup!</dd></dl>
3539
3540 !! html/parsoid
3541 <dl><dt> <a rel="mw:ExtLink" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl>
3542 !! end
3543
3544 !! test
3545 Malformed definition list with colon
3546 !! wikitext
3547 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3548 !! html
3549 <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</dt></dl>
3550
3551 !! end
3552
3553 !! test
3554 Definition lists: colon in external link text
3555 !! wikitext
3556 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3557 !! html
3558 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3559 <dd> OK, I made that up</dd></dl>
3560
3561 !! end
3562
3563 !! test
3564 Definition lists: colon in HTML attribute
3565 !! wikitext
3566 ;<b style="display: inline">bold</b>
3567 !! html
3568 <dl><dt><b style="display: inline">bold</b></dt></dl>
3569
3570 !! end
3571
3572 !! test
3573 Definition lists: self-closed tag
3574 !! wikitext
3575 ;one<br/>two : two-line fun
3576 !! html
3577 <dl><dt>one<br />two&#160;</dt>
3578 <dd> two-line fun</dd></dl>
3579
3580 !! end
3581
3582 !! test
3583 Bug 11748: Literal closing tags
3584 !! wikitext
3585 <dl>
3586 <dt>test 1</dt>
3587 <dd>test test test test test</dd>
3588 <dt>test 2</dt>
3589 <dd>test test test test test</dd>
3590 </dl>
3591 !! html
3592 <dl>
3593 <dt>test 1</dt>
3594 <dd>test test test test test</dd>
3595 <dt>test 2</dt>
3596 <dd>test test test test test</dd>
3597 </dl>
3598
3599 !! end
3600
3601 !! test
3602 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3603 !! wikitext
3604 <ul><li>
3605 ; term : description
3606 * unordered
3607 </li></ul>
3608 !! html
3609 <ul><li>
3610 <dl><dt> term&#160;</dt>
3611 <dd> description</dd></dl>
3612 <ul><li> unordered</li></ul>
3613 </li></ul>
3614
3615 !! end
3616
3617 !! test
3618
3619 Definition list with empty definition and following paragraph
3620 !! wikitext
3621 ; term:
3622 Paragraph text
3623 !! html
3624 <dl><dt> term</dt>
3625 <dd></dd></dl>
3626 <p>Paragraph text
3627 </p>
3628 !! end
3629
3630 !! test
3631 Nested definition lists using html syntax
3632 !! wikitext
3633 <dl><dt>x</dt>
3634 <dd>a</dd>
3635 <dd>b</dd></dl>
3636
3637 !! end
3638
3639 !! test
3640 Definition Lists: No nesting: Multiple dd's
3641 !! wikitext
3642 ;x
3643 :a
3644 :b
3645 !! html
3646 <dl><dt>x</dt>
3647 <dd>a</dd>
3648 <dd>b</dd></dl>
3649
3650 !! end
3651
3652 !! test
3653 Definition Lists: Indentation: Regular
3654 !! wikitext
3655 :i1
3656 ::i2
3657 :::i3
3658 !! html
3659 <dl><dd>i1
3660 <dl><dd>i2
3661 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3662
3663 !! end
3664
3665 !! test
3666 Definition Lists: Indentation: Missing 1st level
3667 !! wikitext
3668 ::i2
3669 :::i3
3670 !! html
3671 <dl><dd><dl><dd>i2
3672 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3673
3674 !! end
3675
3676 !! test
3677 Definition Lists: Indentation: Multi-level indent
3678 !! wikitext
3679 :::i3
3680 !! html
3681 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3682
3683 !! end
3684
3685 !! test
3686 Definition Lists: Hacky use to indent tables
3687 !! wikitext
3688 ::{|
3689 |foo
3690 |bar
3691 |}
3692 this text
3693 should be left alone
3694 !! html
3695 <dl><dd><dl><dd><table>
3696 <tr>
3697 <td>foo
3698 </td>
3699 <td>bar
3700 </td></tr></table></dd></dl></dd></dl>
3701 <p>this text
3702 should be left alone
3703 </p>
3704 !! end
3705
3706 !! test
3707 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3708 !! wikitext
3709 <!-- foo -->
3710 ::{|
3711 |foo
3712 |bar
3713 |}<!-- bar -->
3714 this text
3715 should be left alone
3716 !! html/parsoid
3717 <!-- foo -->
3718 <dl><dd><dl><dd><table><tr>
3719 <td>foo</td>
3720 <td>bar</td>
3721 </tr></table><!-- bar --></dd></dl></dd></dl>
3722 <p>this text
3723 should be left alone</p>
3724 !! end
3725
3726 !! test
3727 Definition Lists: Hacky use to indent tables, with comment before table
3728 !! wikitext
3729 ::<!-- foo -->{|
3730 |foo
3731 |}
3732 !! html/parsoid
3733 <dl><dd><dl><dd><!-- foo --><table><tr>
3734 <td>foo</td>
3735 </tr></table></dd></dl></dd></dl>
3736 !! end
3737
3738 # The trailing whitespace in this test is to catch a regression in
3739 # Parsoid after T54473.
3740 !! test
3741 Definition Lists: Hacky use to indent tables (WS-insensitive)
3742 !! wikitext
3743 : {|
3744 |a
3745 |}
3746 !! html/php
3747 <dl><dd><table>
3748 <tr>
3749 <td>a
3750 </td></tr></table></dd></dl>
3751
3752 !! html/parsoid
3753 <dl><dd> <table>
3754 <tbody><tr><td>a</td></tr>
3755 </tbody></table> </dd></dl>
3756 !! end
3757
3758 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3759 ## as an empty dt item. It also ignores all but the last ";" when followed
3760 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3761 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3762 ## ";"s.
3763 ##
3764 ## Ex: ";;t2 ::d2" is transformed into:
3765 ##
3766 ## <dl>
3767 ## <dt>t2 </dt>
3768 ## <dd>
3769 ## <dl>
3770 ## <dt></dt>
3771 ## <dd>d2</dd>
3772 ## </dl>
3773 ## </dd>
3774 ## </dl>
3775 ##
3776 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3777 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3778 ##
3779 ## <dl>
3780 ## <dt>
3781 ## <dl>
3782 ## <dt>t2 </dt>
3783 ## <dd>:d2</dd>
3784 ## </dl>
3785 ## </dt>
3786 ## </dl>
3787 ##
3788 ## All Parsoid only definition list tests have this difference.
3789 ##
3790 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3791 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3792
3793 !! test
3794 Table / list interaction: indented table with lists in table contents
3795 !! wikitext
3796 :{|
3797 |-
3798 | a
3799 * b
3800 |-
3801 | c
3802 * d
3803 |}
3804 !! html
3805 <dl><dd><table>
3806
3807 <tr>
3808 <td> a
3809 <ul><li> b</li></ul>
3810 </td></tr>
3811 <tr>
3812 <td> c
3813 <ul><li> d</li></ul>
3814 </td></tr></table></dd></dl>
3815
3816 !! end
3817
3818 !!test
3819 Table / list interaction: lists nested in tables nested in indented lists
3820 !! wikitext
3821 :{|
3822 |
3823 :a
3824 :b
3825 |
3826 *c
3827 *d
3828 |}
3829
3830 *e
3831 *f
3832 !! html
3833 <dl><dd><table>
3834 <tr>
3835 <td>
3836 <dl><dd>a</dd>
3837 <dd>b</dd></dl>
3838 </td>
3839 <td>
3840 <ul><li>c</li>
3841 <li>d</li></ul>
3842 </td></tr></table></dd></dl>
3843 <ul><li>e</li>
3844 <li>f</li></ul>
3845
3846 !!end
3847
3848 !! test
3849 Definition Lists: Nesting: Multi-level (Parsoid only)
3850 !! options
3851 parsoid
3852 !! wikitext
3853 ;t1 :d1
3854 ;;t2 ::d2
3855 ;;;t3 :::d3
3856 !! html
3857 <dl>
3858 <dt>t1 </dt>
3859 <dd>d1</dd>
3860 <dt>
3861 <dl>
3862 <dt>t2 </dt>
3863 <dd>:d2</dd>
3864 <dt>
3865 <dl>
3866 <dt>t3 </dt>
3867 <dd>::d3</dd>
3868 </dl>
3869 </dt>
3870 </dl>
3871 </dt>
3872 </dl>
3873
3874
3875 !! end
3876
3877
3878 !! test
3879 Definition Lists: Nesting: Test 2 (Parsoid only)
3880 !! options
3881 parsoid
3882 !! wikitext
3883 ;t1
3884 ::d2
3885 !! html
3886 <dl>
3887 <dt>t1</dt>
3888 <dd>
3889 <dl>
3890 <dd>d2</dd>
3891 </dl>
3892 </dd>
3893 </dl>
3894
3895 !! end
3896
3897
3898 !! test
3899 Definition Lists: Nesting: Test 3 (Parsoid only)
3900 !! options
3901 parsoid
3902 !! wikitext
3903 :;t1
3904 ::::d2
3905 !! html
3906 <dl>
3907 <dd>
3908 <dl>
3909 <dt>t1</dt>
3910 <dd>
3911 <dl>
3912 <dd>
3913 <dl>
3914 <dd>d2</dd>
3915 </dl>
3916 </dd>
3917 </dl>
3918 </dd>
3919 </dl>
3920 </dd>
3921 </dl>
3922
3923 !! end
3924
3925
3926 !! test
3927 Definition Lists: Nesting: Test 4
3928 !! wikitext
3929 ::;t3
3930 :::d3
3931 !! html
3932 <dl><dd><dl><dd><dl><dt>t3</dt>
3933 <dd>d3</dd></dl></dd></dl></dd></dl>
3934
3935 !! end
3936
3937
3938 ## The Parsoid team believes the following three test exposes a
3939 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3940 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3941 ## It also exposes a "misfeature" in tidy, which doesn't like
3942 ## <dl> tags with a single <dt> child; it converts the <dt> into
3943 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3944 !! test
3945 Definition Lists: Mixed Lists: Test 1
3946 !! wikitext
3947 :;* foo
3948 ::* bar
3949 :; baz
3950 !! html/php
3951 <dl><dd><dl><dt><ul><li> foo</li>
3952 <li> bar</li></ul></dt></dl>
3953 <dl><dt> baz</dt></dl></dd></dl>
3954
3955 !! html/php+tidy
3956 <dl>
3957 <dd>
3958 <dl>
3959 <dd>
3960 <ul>
3961 <li>foo</li>
3962 <li>bar</li>
3963 </ul>
3964 </dd>
3965 </dl>
3966 <dl>
3967 <dt>baz</dt>
3968 </dl>
3969 </dd>
3970 </dl>
3971 !! html/parsoid
3972 <dl>
3973 <dd><dl>
3974 <dt><ul>
3975 <li> foo
3976 </li>
3977 </ul></dt>
3978 <dd><ul>
3979 <li> bar
3980 </li>
3981 </ul></dd>
3982 <dt> baz</dt>
3983 </dl></dd>
3984 </dl>
3985 !! end
3986
3987 !! test
3988 Definition Lists: Mixed Lists: Test 2
3989 !! wikitext
3990 *: d1
3991 *: d2
3992 !! html
3993 <ul><li><dl><dd> d1</dd>
3994 <dd> d2</dd></dl></li></ul>
3995
3996 !! end
3997
3998
3999 !! test
4000 Definition Lists: Mixed Lists: Test 3
4001 !! wikitext
4002 *::: d1
4003 *::: d2
4004 !! html
4005 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4006 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4007
4008 !! end
4009
4010
4011 !! test
4012 Definition Lists: Mixed Lists: Test 4
4013 !! wikitext
4014 *;d1 :d2
4015 *;d3 :d4
4016 !! html
4017 <ul><li><dl><dt>d1&#160;</dt>
4018 <dd>d2</dd>
4019 <dt>d3&#160;</dt>
4020 <dd>d4</dd></dl></li></ul>
4021
4022 !! end
4023
4024
4025 !! test
4026 Definition Lists: Mixed Lists: Test 5
4027 !! wikitext
4028 *:d1
4029 *:: d2
4030 !! html
4031 <ul><li><dl><dd>d1
4032 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4033
4034 !! end
4035
4036
4037 !! test
4038 Definition Lists: Mixed Lists: Test 6
4039 !! wikitext
4040 #*:d1
4041 #*::: d3
4042 !! html
4043 <ol><li><ul><li><dl><dd>d1
4044 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4045
4046 !! end
4047
4048
4049 !! test
4050 Definition Lists: Mixed Lists: Test 7
4051 !! wikitext
4052 :* d1
4053 :* d2
4054 !! html
4055 <dl><dd><ul><li> d1</li>
4056 <li> d2</li></ul></dd></dl>
4057
4058 !! end
4059
4060
4061 !! test
4062 Definition Lists: Mixed Lists: Test 8
4063 !! wikitext
4064 :* d1
4065 ::* d2
4066 !! html
4067 <dl><dd><ul><li> d1</li></ul>
4068 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4069
4070 !! end
4071
4072
4073 !! test
4074 Definition Lists: Mixed Lists: Test 9
4075 !! wikitext
4076 *;foo :bar
4077 !! html
4078 <ul><li><dl><dt>foo&#160;</dt>
4079 <dd>bar</dd></dl></li></ul>
4080
4081 !! end
4082
4083
4084 !! test
4085 Definition Lists: Mixed Lists: Test 10
4086 !! wikitext
4087 *#;foo :bar
4088 !! html
4089 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4090 <dd>bar</dd></dl></li></ol></li></ul>
4091
4092 !! end
4093
4094 # The Parsoid team disagrees with the PHP parser's seemingly-random
4095 # rules regarding dd/dt on the next two tests. Parsoid is more
4096 # consistent, and recognizes the shared nesting and keeps the
4097 # still-open tags around until the nesting is complete.
4098 # (And tidy again converts <dt> to <dd> before 'bar'.)
4099
4100 !! test
4101 Definition Lists: Mixed Lists: Test 11
4102 !! wikitext
4103 *#*#;*;;foo :bar
4104 *#*#;boo :baz
4105 !! html/php
4106 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4107 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4108 <dl><dt>boo&#160;</dt>
4109 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4110
4111 !! html/php+tidy
4112 <ul>
4113 <li>
4114 <ol>
4115 <li>
4116 <ul>
4117 <li>
4118 <ol>
4119 <li>
4120 <dl>
4121 <dt>foo&#160;</dt>
4122 <dd>
4123 <ul>
4124 <li>
4125 <dl>
4126 <dd>
4127 <dl>
4128 <dt>bar</dt>
4129 </dl>
4130 </dd>
4131 </dl>
4132 </li>
4133 </ul>
4134 </dd>
4135 </dl>
4136 <dl>
4137 <dt>boo&#160;</dt>
4138 <dd>baz</dd>
4139 </dl>
4140 </li>
4141 </ol>
4142 </li>
4143 </ul>
4144 </li>
4145 </ol>
4146 </li>
4147 </ul>
4148 !! html/parsoid
4149 <ul>
4150 <li>
4151 <ol>
4152 <li>
4153 <ul>
4154 <li>
4155 <ol>
4156 <li>
4157 <dl>
4158 <dt>
4159 <ul>
4160 <li>
4161 <dl>
4162 <dt>
4163 <dl>
4164 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4165 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4166 </dl></dt>
4167 </dl></li>
4168 </ul></dt>
4169 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4170 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4171 </dl></li>
4172 </ol></li>
4173 </ul></li>
4174 </ol></li>
4175 </ul>
4176 !! end
4177
4178
4179 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4180 # From whitelist:
4181 # * The test is wrong, there are two colons where there should be :;
4182 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4183 !! test
4184 Definition Lists: Weird Ones: Test 1
4185 !! wikitext
4186 *#;*::;; foo : bar (who uses this?)
4187 !! html/php
4188 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4189 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4190
4191 !! html/php+tidy
4192 <ul>
4193 <li>
4194 <ol>
4195 <li>
4196 <dl>
4197 <dt>foo&#160;</dt>
4198 <dd>
4199 <ul>
4200 <li>
4201 <dl>
4202 <dd>
4203 <dl>
4204 <dd>
4205 <dl>
4206 <dd>
4207 <dl>
4208 <dt>bar (who uses this?)</dt>
4209 </dl>
4210 </dd>
4211 </dl>
4212 </dd>
4213 </dl>
4214 </dd>
4215 </dl>
4216 </li>
4217 </ul>
4218 </dd>
4219 </dl>
4220 </li>
4221 </ol>
4222 </li>
4223 </ul>
4224 !! html/parsoid
4225 <ul>
4226 <li>
4227 <ol>
4228 <li>
4229 <dl>
4230 <dt>
4231 <ul>
4232 <li>
4233 <dl>
4234 <dd>
4235 <dl>
4236 <dd>
4237 <dl>
4238 <dt>
4239 <dl>
4240 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4241 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4242 </dl></dt>
4243 </dl></dd>
4244 </dl></dd>
4245 </dl></li>
4246 </ul></dt>
4247 </dl></li>
4248 </ol></li>
4249 </ul>
4250 !! end
4251
4252 !! test
4253 Definition Lists: colons occurring in tags
4254 !! wikitext
4255 ;a:b
4256 ;'''a:b'''
4257 ;<i>a:b</i>
4258 ;<span>a:b</span>
4259 ;<div>a:b</div>
4260 ;<div>a
4261 :b</div>
4262 ;{{echo|a:b}}
4263 ;{{echo|''a:b''}}
4264 ;;;''a:b''
4265 !! html+tidy
4266 <dl>
4267 <dt>a</dt>
4268 <dd>b</dd>
4269 <dt><b>a:b</b></dt>
4270 <dt><i>a:b</i></dt>
4271 <dt><span>a:b</span></dt>
4272 <dd>
4273 <div>a:b</div>
4274 </dd>
4275 <dd>
4276 <div>a
4277 <dl>
4278 <dd>b</dd>
4279 </dl>
4280 </div>
4281 </dd>
4282 <dt>a</dt>
4283 <dd>b</dd>
4284 <dt><i>a:b</i></dt>
4285 </dl>
4286 <dl>
4287 <dd>
4288 <dl>
4289 <dd>
4290 <dl>
4291 <dt><i>a:b</i></dt>
4292 </dl>
4293 </dd>
4294 </dl>
4295 </dd>
4296 </dl>
4297 !! html/parsoid
4298 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4299 <dt><b>a:b</b></dt>
4300 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4301 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4302 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4303 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4304 <dd>b</dd>
4305 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4306 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4307 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4308 !! end
4309
4310 !! test
4311 Definition Lists: colons and tables 1
4312 !! wikitext
4313 :{|
4314 | x
4315 |}
4316 :{|
4317 | y
4318 |}
4319 !! html
4320 <dl><dd><table>
4321 <tr>
4322 <td> x
4323 </td></tr></table></dd></dl>
4324 <dl><dd><table>
4325 <tr>
4326 <td> y
4327 </td></tr></table></dd></dl>
4328
4329 !! end
4330
4331 # Parsoid's output (as documented below) differs from php's in this case.
4332 # This is probably a bug. If we fixup parsoid to match php's output, the
4333 # above test should pass and the below test case can be removed. It is
4334 # unclear which output is more desirable.
4335
4336 !! test
4337 Definition Lists: colons and tables 2
4338 !! wikitext
4339 :{|
4340 | x
4341 |}
4342 :{|
4343 | y
4344 |}
4345 !! html/parsoid
4346 <dl><dd><table>
4347 <tr>
4348 <td> x
4349 </td></tr></table></dd>
4350 <dd><table>
4351 <tr>
4352 <td> y
4353 </td></tr></table></dd></dl>
4354 !! end
4355
4356 !! test
4357 Definition Lists: template interaction
4358 !! wikitext
4359 ::{{definition_list}}
4360
4361 :one
4362 ::{{definition_list}}
4363 :::two
4364 :::three
4365 ::four
4366 !! html/parsoid
4367 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4368 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4369
4370 <dl><dd data-parsoid='{}'>one
4371 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4372 </span><dd about="#mwt2">two
4373 <dl><dd>two</dd>
4374 <dd>three</dd></dl></dd>
4375 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4376 !! end
4377
4378
4379 ###
4380 ### External links
4381 ###
4382 !! test
4383 External links: non-bracketed
4384 !! wikitext
4385 Non-bracketed: http://example.com
4386 !! html
4387 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4388 </p>
4389 !! end
4390
4391 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4392 !! test
4393 External links: numbered
4394 !! wikitext
4395 Numbered: [http://example.com]
4396 Numbered: [http://example.net]
4397 Numbered: [http://example.com]
4398 !! html/php
4399 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4400 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4401 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4402 </p>
4403 !! html/parsoid
4404 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4405 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4406 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4407 !!end
4408
4409 !! test
4410 External links: specified text
4411 !! wikitext
4412 Specified text: [http://example.com link]
4413 !! html
4414 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4415 </p>
4416 !!end
4417
4418 !! test
4419 External links: trail
4420 !! wikitext
4421 Linktrails should not work for external links: [http://example.com link]s
4422 !! html
4423 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4424 </p>
4425 !! end
4426
4427 !! test
4428 External links: dollar sign in URL
4429 !! wikitext
4430 http://example.com/1$2345
4431 !! html
4432 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4433 </p>
4434 !! end
4435
4436 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4437 !! test
4438 External links: dollar sign in URL (autonumber)
4439 !! wikitext
4440 [http://example.com/1$2345]
4441 !! html/php
4442 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4443 </p>
4444 !! html/parsoid
4445 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4446 !!end
4447
4448 !! test
4449 External links: open square bracket forbidden in URL (bug 4377)
4450 !! options
4451 parsoid=wt2html,wt2wt,html2html
4452 !! wikitext
4453 http://example.com/1[2345
4454 !! html/php
4455 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4456 </p>
4457 !! html/parsoid
4458 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4459 !! end
4460
4461 !! test
4462 External links: open square bracket forbidden in URL (named) (bug 4377)
4463 !! options
4464 parsoid=wt2html,html2html
4465 !! wikitext
4466 [http://example.com/1[2345]
4467 !! html/php
4468 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4469 </p>
4470 !! html/parsoid
4471 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4472 !!end
4473
4474 # parsoid adds a space before the link name
4475 !! test
4476 External links: open square bracket forbidden in URL (named) (bug 4377)
4477 Parsoid variant.
4478 !! wikitext
4479 [http://example.com/1 [2345]
4480 !! html
4481 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4482 </p>
4483 !!end
4484
4485 !! test
4486 External links: nowiki in URL link text (bug 6230)
4487 !! wikitext
4488 [http://example.com/ <nowiki>''example site''</nowiki>]
4489 !! html
4490 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4491 </p>
4492 !! end
4493
4494 !! test
4495 External links: newline forbidden in text (bug 6230 regression check)
4496 !! wikitext
4497 [http://example.com/ first
4498 second]
4499 !! html
4500 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4501 second]
4502 </p>
4503 !!end
4504
4505 !! test
4506 External links: Pipe char between url and text
4507 !! wikitext
4508 [http://example.com | link]
4509 !! html
4510 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4511 </p>
4512 !!end
4513
4514 !! test
4515 External links: protocol-relative URL in brackets
4516 !! wikitext
4517 [//example.com/ Test]
4518 !! html
4519 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4520 </p>
4521 !! end
4522
4523 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4524 !! test
4525 External links: protocol-relative URL in brackets without text
4526 !! wikitext
4527 [//example.com]
4528 !! html/php
4529 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4530 </p>
4531 !! html/parsoid
4532 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4533 !! end
4534
4535 !! test
4536 External links: protocol-relative URL in free text is left alone
4537 !! wikitext
4538 //example.com/Foo
4539 !! html
4540 <p>//example.com/Foo
4541 </p>
4542 !!end
4543
4544 !! test
4545 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4546 !! wikitext
4547 foo//example.com/Foo
4548 !! html
4549 <p>foo//example.com/Foo
4550 </p>
4551 !! end
4552
4553 !! test
4554 External links: with no contents
4555 !! wikitext
4556 [http://en.wikipedia.org/wiki/Foo]
4557
4558 [[wikipedia:Foo|Bar]]
4559
4560 [[wikipedia:Foo|<span>Bar</span>]]
4561 !! html/php
4562 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4563 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4564 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4565 </p>
4566 !! html/parsoid
4567 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4568 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4569 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4570 !! end
4571
4572 !! test
4573 External links: Free with trailing punctuation
4574 !! wikitext
4575 http://example.com,
4576 http://example.com;
4577 http://example.com\
4578 http://example.com.
4579 http://example.com:
4580 http://example.com!
4581 http://example.com?
4582 http://example.com)
4583 http://example.com/url_with_(brackets)
4584 (http://example.com/url_without_brackets)
4585 http://example.com/url_with_entity&nbsp;
4586 http://example.com/url_with_entity&#xA0;
4587 http://example.com/url_with_entity&#160;
4588 http://example.com/url_with_entity&lt;
4589 http://example.com/url_with_entity&#x3C;
4590 http://example.com/url_with_entity&#60;
4591 !! html/php
4592 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4593 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4594 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4595 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4596 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4597 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4598 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4599 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4600 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4601 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4602 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4603 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4604 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4605 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4606 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4607 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4608 </p>
4609 !! html/parsoid
4610 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4611 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4612 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4613 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4614 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4615 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4616 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4617 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4618 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4619 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4620 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4621 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4622 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4623 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4624 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4625 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4626 !! end
4627
4628 !! test
4629 External links: Lone protocols are never linked (T105697)
4630 !! wikitext
4631 http://
4632 http://;
4633 (http://)
4634 bitcoin:
4635 bitcoin:;
4636 (bitcoin:)
4637 !! html
4638 <p>http://
4639 http://;
4640 (http://)
4641 bitcoin:
4642 bitcoin:;
4643 (bitcoin:)
4644 </p>
4645 !! end
4646
4647 !! test
4648 External links: No preceding word characters allowed (bug 65278)
4649 !! wikitext
4650 NOPEhttp://example.com
4651 N0http://example.com
4652 ok:http://example.com
4653 ok-http://example.com
4654 !! html
4655 <p>NOPEhttp://example.com
4656 N0http://example.com
4657 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4658 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4659 </p>
4660 !! end
4661
4662 !! test
4663 External image
4664 !! wikitext
4665 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4666 !! html
4667 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4668 </p>
4669 !! end
4670
4671 !! test
4672 External image from https
4673 !! wikitext
4674 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4675 !! html
4676 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4677 </p>
4678 !! end
4679
4680 !! test
4681 External image (when not allowed)
4682 !! options
4683 wgAllowExternalImages=0
4684 !! wikitext
4685 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4686 !! html
4687 <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>
4688 </p>
4689 !! end
4690
4691 !! test
4692 Link to non-http image, no img tag
4693 !! wikitext
4694 Link to non-http image, no img tag: ftp://example.com/test.jpg
4695 !! html
4696 <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>
4697 </p>
4698 !! end
4699
4700 !! test
4701 External links: terminating separator
4702 !! wikitext
4703 Terminating separator: http://example.com/thing,
4704 !! html
4705 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4706 </p>
4707 !! end
4708
4709 !! test
4710 External links: intervening separator
4711 !! wikitext
4712 Intervening separator: http://example.com/1,2,3
4713 !! html
4714 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4715 </p>
4716 !! end
4717
4718 !! test
4719 External links: old bug with URL in query
4720 !! wikitext
4721 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4722 !! html
4723 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4724 </p>
4725 !! end
4726
4727 !! test
4728 External links: old URL-in-URL bug, mixed protocols
4729 !! wikitext
4730 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4731 !! html
4732 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4733 </p>
4734 !!end
4735
4736 !! test
4737 External links: URL in text
4738 !! wikitext
4739 URL in text: [http://example.com http://example.com]
4740 !! html
4741 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4742 </p>
4743 !! end
4744
4745 !! test
4746 External links: Clickable images
4747 !! wikitext
4748 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4749 !! html/php
4750 <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>
4751 </p>
4752 !! html/parsoid
4753 <p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
4754 !! end
4755
4756 !! test
4757 External links: raw ampersand
4758 !! wikitext
4759 Old &amp; use: http://x&y
4760 !! html
4761 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4762 </p>
4763 !! end
4764
4765 !! test
4766 External links: encoded ampersand
4767 !! wikitext
4768 Old &amp; use: http://x&amp;y
4769 !! html/php
4770 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4771 </p>
4772 !! html/parsoid
4773 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4774 !! end
4775
4776 !! test
4777 External links: encoded equals (bug 6102)
4778 !! wikitext
4779 http://example.com/?foo&#61;bar
4780 !! html/php
4781 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4782 </p>
4783 !! html/parsoid
4784 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4785 !! end
4786
4787 ##
4788 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4789 ## does it number them. As discussed in bug 53505, we can identify
4790 ## autonumbered links via CSS.
4791 ##
4792
4793 !! test
4794 External links: [raw ampersand]
4795 !! wikitext
4796 Old &amp; use: [http://x&y]
4797 !! html/php
4798 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4799 </p>
4800 !! html/parsoid
4801 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4802 !! end
4803
4804 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4805 # mode will return the [raw ampersand] wikitext
4806 !! test
4807 External links: [encoded ampersand]
4808 !! options
4809 parsoid=wt2html,wt2wt,html2html
4810 !! wikitext
4811 Old &amp; use: [http://x&amp;y]
4812 !! html/php
4813 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4814 </p>
4815 !! html/parsoid
4816 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4817 !! end
4818
4819 !! test
4820 External links: [raw equals]
4821 !! wikitext
4822 [http://example.com/?foo=bar]
4823 !! html/php
4824 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4825 </p>
4826 !! html/parsoid
4827 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4828 !! end
4829
4830 # note that parsoid html is identical to [raw equals] case; so html2wt
4831 # mode will return the [raw equals] wikitext
4832 !! test
4833 External links: [encoded equals] (bug 6102)
4834 !! options
4835 parsoid=wt2html,wt2wt,html2html
4836 !! wikitext
4837 [http://example.com/?foo&#61;bar]
4838 !! html/php
4839 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4840 </p>
4841 !! html/parsoid
4842 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4843 !! end
4844
4845 # xxx parsoid strips the IDN character, so the round-trip tests will
4846 # obviously fail and are disabled. --cscott
4847 !! test
4848 External links: [IDN ignored character reference in hostname; strip it right off]
4849 !! options
4850 parsoid=wt2html,wt2wt,html2html
4851 !! wikitext
4852 [http://e&zwnj;xample.com/]
4853 !! html/php
4854 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4855 </p>
4856 !! html/parsoid
4857 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4858 !! end
4859
4860 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4861 # Where an external link could easily circumvent the sanitization of the text of
4862 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4863 # test demands a higher standard. That's a bit strange.
4864 #
4865 # Example:
4866 #
4867 # http://e‌xample.com -> [http://example.com|http://example.com]
4868 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4869 #
4870 # The first example is sanitized, but the second is not. Any security benefits
4871 # from this production are trivial to circumvent. Either remove this test and
4872 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4873 # the test accordingly.
4874 #
4875 # All our love,
4876 # The Parsoid team.
4877 # xxx parsoid strips the IDN character, so the round-trip tests will
4878 # obviously fail and are disabled. --cscott
4879 !! test
4880 External links: IDN ignored character reference in hostname; strip it right off
4881 !! options
4882 parsoid=wt2html,html2html
4883 !! wikitext
4884 http://e&zwnj;xample.com/
4885 !! html/php
4886 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4887 </p>
4888 !! html/parsoid
4889 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4890 !! end
4891
4892 !! test
4893 External links: www.jpeg.org (bug 554)
4894 !! wikitext
4895 http://www.jpeg.org
4896 !! html
4897 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4898 </p>
4899 !! end
4900
4901 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4902 !! test
4903 External links: URL within URL (original bug 2)
4904 !! wikitext
4905 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4906 !! html/php
4907 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4908 </p>
4909 !! html/parsoid
4910 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4911 !! end
4912
4913 !! test
4914 BUG 361: URL inside bracketed URL
4915 !! wikitext
4916 [http://www.example.com/foo http://www.example.com/bar]
4917 !! html
4918 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4919 </p>
4920 !! end
4921
4922 !! test
4923 BUG 361: URL within URL, not bracketed
4924 !! wikitext
4925 http://www.example.com/foo?=http://www.example.com/bar
4926 !! html
4927 <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>
4928 </p>
4929 !! end
4930
4931 !! test
4932 BUG 289: ">"-token in URL-tail
4933 !! wikitext
4934 http://www.example.com/<hello>
4935 !! html
4936 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4937 </p>
4938 !!end
4939
4940 !! test
4941 BUG 289: literal ">"-token in URL-tail
4942 !! wikitext
4943 http://www.example.com/<b>html</b>
4944 !! html/php
4945 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4946 </p>
4947 !! html/parsoid
4948 <p><a rel="mw:ExtLink" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
4949 !! end
4950
4951 !! test
4952 BUG 289: ">"-token in bracketed URL
4953 !! wikitext
4954 [http://www.example.com/<hello> stuff]
4955 !! html
4956 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4957 </p>
4958 !!end
4959
4960 !! test
4961 BUG 289: literal ">"-token in bracketed URL
4962 !! wikitext
4963 [http://www.example.com/<b>html</b> stuff]
4964 !! html
4965 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4966 </p>
4967 !!end
4968
4969 !! test
4970 BUG 289: literal double quote at end of URL
4971 !! wikitext
4972 http://www.example.com/"hello"
4973 !! html
4974 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4975 </p>
4976 !!end
4977
4978 !! test
4979 BUG 289: literal double quote in bracketed URL
4980 !! wikitext
4981 [http://www.example.com/"hello" stuff]
4982 !! html
4983 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4984 </p>
4985 !!end
4986
4987 !! test
4988 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4989 !! wikitext
4990 [http://www.example.com test]
4991 !! html
4992 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4993 </p>
4994 !! end
4995
4996 !! test
4997 External links: link text with spaces
4998 !! wikitext
4999 [http://www.example.com a b c]
5000 [http://www.example.com ''a'' ''b'']
5001 !! html
5002 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5003 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5004 </p>
5005 !! end
5006
5007 !! test
5008 External links: wiki links within external link (Bug 3695)
5009 !! wikitext
5010 [http://example.com [[wikilink]] embedded in ext link]
5011 !! html/php
5012 <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>
5013 </p>
5014 !! html/parsoid
5015 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5016 !! end
5017
5018 !! test
5019 BUG 787: Links with one slash after the url protocol are invalid
5020 !! wikitext
5021 http:/example.com
5022
5023 [http:/example.com title]
5024 !! html
5025 <p>http:/example.com
5026 </p><p>[http:/example.com title]
5027 </p>
5028 !! end
5029
5030 !! test
5031 Bracketed external links with template-generated invalid target
5032 !! wikitext
5033 [{{echo|http:/example.com}} title]
5034 !! html
5035 <p>[http:/example.com title]
5036 </p>
5037 !! end
5038
5039 !! test
5040 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5041 !! wikitext
5042 ''[http://example.com text'']
5043 [http://example.com '''text]'''
5044 ''Something [http://example.com in italic'']
5045 ''Something [http://example.com mixed''''', even bold]'''
5046 '''''Now [http://example.com both''''']
5047 !! html
5048 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5049 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5050 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5051 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5052 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5053 </p>
5054 !! end
5055
5056
5057 !! test
5058 Bug 4781: %26 in URL
5059 !! wikitext
5060 http://www.example.com/?title=AT%26T
5061 !! html/php
5062 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5063 </p>
5064 !! html/parsoid
5065 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5066 !! end
5067
5068 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5069 # % is actually legal in HTML5. Any change in output would need testing though.
5070 !! test
5071 Bug 4781, 5267: %25 in URL
5072 !! wikitext
5073 http://www.example.com/?title=100%25_Bran
5074 !! html/php
5075 <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>
5076 </p>
5077 !! html/parsoid
5078 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5079 !! end
5080
5081 !! test
5082 Bug 4781, 5267: %28, %29 in URL
5083 !! wikitext
5084 http://www.example.com/?title=Ben-Hur_%281959_film%29
5085 !! html/php
5086 <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>
5087 </p>
5088 !! html/parsoid
5089 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
5090 !! end
5091
5092
5093 !! test
5094 Bug 4781: %26 in autonumber URL
5095 !! wikitext
5096 [http://www.example.com/?title=AT%26T]
5097 !! html/php
5098 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5099 </p>
5100 !! html/parsoid
5101 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5102 !! end
5103
5104 !! test
5105 Bug 4781, 5267: %26 in autonumber URL
5106 !! wikitext
5107 [http://www.example.com/?title=100%25_Bran]
5108 !! html/php
5109 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5110 </p>
5111 !! html/parsoid
5112 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5113 !! end
5114
5115 !! test
5116 Bug 4781, 5267: %28, %29 in autonumber URL
5117 !! wikitext
5118 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5119 !! html/php
5120 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5121 </p>
5122 !! html/parsoid
5123 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5124 !! end
5125
5126
5127 !! test
5128 Bug 4781: %26 in bracketed URL
5129 !! wikitext
5130 [http://www.example.com/?title=AT%26T link]
5131 !! html/php
5132 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5133 </p>
5134 !! html/parsoid
5135 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5136 !! end
5137
5138 !! test
5139 Bug 4781, 5267: %25 in bracketed URL
5140 !! wikitext
5141 [http://www.example.com/?title=100%25_Bran link]
5142 !! html
5143 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5144 </p>
5145 !! end
5146
5147 !! test
5148 Bug 4781, 5267: %28, %29 in bracketed URL
5149 !! wikitext
5150 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5151 !! html/php
5152 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5153 </p>
5154 !! html/parsoid
5155 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5156 !! end
5157
5158 !! test
5159 External link containing a period in the anchor. (bug 63947)
5160 !! wikitext
5161 [//foo.org/bar#baz. bang]
5162
5163 [//foo.org/bar. bang]
5164 !! html/php
5165 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5166 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5167 </p>
5168 !! html/parsoid
5169 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5170 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5171 !! end
5172
5173 !! test
5174 External link containing a single quote. (bug 63947)
5175 !! wikitext
5176 [//foo.org/bar'baz]
5177
5178 [//foo.org/bar'baz bang]
5179 !! html/php
5180 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5181 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5182 </p>
5183 !! html/parsoid
5184 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5185 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5186 !! end
5187
5188
5189 !! test
5190 External link containing a period in the anchor. (bug 63947)
5191 !! wikitext
5192 [//foo.org/bar#baz. bang]
5193
5194 [//foo.org/bar. bang]
5195 !! html/php
5196 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5197 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5198 </p>
5199 !! html/parsoid
5200 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5201 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5202 !! end
5203
5204 !! test
5205 External link containing a single quote. (bug 63947)
5206 !! wikitext
5207 [//foo.org/bar'baz]
5208
5209 [//foo.org/bar'baz bang]
5210 !! html/php
5211 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5212 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5213 </p>
5214 !! html/parsoid
5215 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5216 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5217 !! end
5218
5219
5220 !! test
5221 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5222 !! wikitext
5223 Some [http://example.com/ pretty ''italics'' and stuff]!
5224 !! html
5225 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5226 </p>
5227 !! end
5228
5229 !! test
5230 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5231 !! wikitext
5232 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5233 !! html
5234 <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>
5235 </p>
5236 !! end
5237
5238 !! test
5239 External link containing double-single-quotes with no space separating the url from text in italics
5240 !! wikitext
5241 [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]].]
5242 !! html/php
5243 <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>
5244 </p>
5245 !! html/php+tidy
5246 <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> <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>.</p>
5247 !! html/parsoid
5248 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5249 !! end
5250
5251 !! test
5252 External link with comments in link text
5253 !! wikitext
5254 [http://www.google.com Google <!-- comment -->]
5255 !! html
5256 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5257 </p>
5258 !! end
5259
5260 !! test
5261 URL-encoding in URL functions (single parameter)
5262 !! wikitext
5263 {{localurl:Some page|amp=&}}
5264 !! html
5265 <p>/index.php?title=Some_page&amp;amp=&amp;
5266 </p>
5267 !! end
5268
5269 !! test
5270 URL-encoding in URL functions (multiple parameters)
5271 !! wikitext
5272 {{localurl:Some page|q=?&amp=&}}
5273 !! html
5274 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5275 </p>
5276 !! end
5277
5278 !! test
5279 Brackets in urls
5280 !! wikitext
5281 http://example.com/index.php?foozoid%5B%5D=bar
5282
5283 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5284 !! html/php
5285 <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>
5286 </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>
5287 </p>
5288 !! html/parsoid
5289 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5290
5291 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5292 !! end
5293
5294 !! test
5295 IPv6 urls (bug 21261)
5296 !! options
5297 disabled
5298 !! wikitext
5299 http://[2404:130:0:1000::187:2]/index.php
5300 !! html
5301 <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>
5302 </p>
5303 !! end
5304
5305 !! test
5306 Non-extlinks in brackets
5307 !! wikitext
5308 [foo]
5309 [foo bar]
5310 [foo ''bar'']
5311 [fool's] errand
5312 [fool's errand]
5313 [{{echo|foo}}]
5314 [{{echo|foo}} bar]
5315 [{{echo|foo}} ''bar'']
5316 [{{echo|foo}}l's] errand
5317 [{{echo|foo}}l's errand]
5318 [url={{echo|foo}}]
5319 [url=http://example.com]
5320 !! html
5321 <p>[foo]
5322 [foo bar]
5323 [foo <i>bar</i>]
5324 [fool's] errand
5325 [fool's errand]
5326 [foo]
5327 [foo bar]
5328 [foo <i>bar</i>]
5329 [fool's] errand
5330 [fool's errand]
5331 [url=foo]
5332 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5333 </p>
5334 !! end
5335
5336 !! test
5337 Percent encoding in external links
5338 !! wikitext
5339 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5340 !! html/php
5341 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5342 </p>
5343 !! html/parsoid
5344 <p><a rel="mw:ExtLink"
5345 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5346 !! end
5347
5348 !! test
5349 Use url link syntax for links where the content is equal the link target
5350 !! wikitext
5351 http://example.com
5352 !! html/php
5353 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5354 </p>
5355 !! html/parsoid
5356 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5357 !! end
5358
5359 !! test
5360 Parenthesis in external links, especially URL links
5361 !! wikitext
5362 http://example.com)
5363
5364 http://example.com/test)
5365
5366 http://example.com/(test)
5367
5368 http://example.com/((test)
5369
5370 (http://example.com/(test))
5371
5372 (http://example.com/(test)))))
5373
5374 http://example.com/a)b
5375
5376 [http://example.com) foo]
5377 !! html/php
5378 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5379 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5380 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5381 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5382 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5383 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5384 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5385 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5386 </p>
5387 !! html/parsoid
5388 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5389 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5390 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5391 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5392 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5393 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5394 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5395 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5396 !! end
5397
5398 !! test
5399 Parenthesis in external links, w/ transclusion or comment
5400 !! wikitext
5401 (http://example.com/{{echo|hi}})
5402
5403 (http://example.com<!-- hi -->)
5404 !! html/php
5405 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5406 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5407 </p>
5408 !! html/parsoid
5409 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&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;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5410
5411 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
5412 !! end
5413
5414 !! test
5415 Serialize <a> tags with invalid link targets as plain text
5416 !! options
5417 parsoid=html2wt
5418 !! html
5419 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5420 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5421 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5422 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5423 !! wikitext
5424 text
5425 <nowiki>*</nowiki>text
5426 <nowiki>[[foo]]</nowiki>
5427 <nowiki>*a [[foo]]</nowiki>
5428 !! end
5429
5430 !! test
5431 mw:ExtLink -vs- mw:WikiLink (T94723)
5432 !! options
5433 parsoid=html2wt
5434 !! html/parsoid
5435 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"},"dsr":[0,11,6,2]}'>Bar</a>
5436 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5437 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5438 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5439 <p>
5440 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5441 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5442 </p>
5443 !! wikitext
5444 [[Foo|Bar]]
5445 [[Foo|Bar]]
5446 [[wikipedia:Foo|Bar]]
5447 [[wikipedia:Foo|Bar]]
5448
5449 [[wikipedia:European_Robin|European Robin]]
5450 [[wikipedia:European_Robin|European Robin]]
5451 !! end
5452
5453 !! test
5454 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5455 !! options
5456 parsoid=wt2wt
5457 !! wikitext
5458 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5459 !! html/parsoid
5460 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5461 !! end
5462
5463
5464 ###
5465 ### Quotes
5466 ###
5467
5468 !! test
5469 Quotes
5470 !! wikitext
5471 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5472
5473 Normal text. '''''Bold italic text.''''' Normal text.
5474 !! html
5475 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5476 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5477 </p>
5478 !! end
5479
5480
5481 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5482 # parser strips. The wikitext contains just the first half of the bold
5483 # quote pair.
5484 !! test
5485 Unclosed and unmatched quotes
5486 !! wikitext
5487 '''''Bold italic text '''with bold deactivated''' in between.'''''
5488
5489 '''''Bold italic text ''with italic deactivated'' in between.'''''
5490
5491 '''Bold text..
5492
5493 ..spanning two paragraphs (should not work).'''
5494
5495 '''Bold tag left open
5496
5497 ''Italic tag left open
5498
5499 Normal text.
5500
5501 <!-- Unmatching number of opening, closing tags: -->
5502 '''This year''''s election ''should'' beat '''last year''''s.
5503
5504 ''Tom'''s car is bigger than ''Susan'''s.
5505
5506 Plain ''italic'''s plain
5507 !! html/php
5508 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5509 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5510 </p><p><b>Bold text..</b>
5511 </p><p>..spanning two paragraphs (should not work).
5512 </p><p><b>Bold tag left open</b>
5513 </p><p><i>Italic tag left open</i>
5514 </p><p>Normal text.
5515 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5516 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5517 </p><p>Plain <i>italic'</i>s plain
5518 </p>
5519 !! html/parsoid
5520 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5521 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5522 </p><p><b>Bold text..</b>
5523 </p><p>..spanning two paragraphs (should not work).<b></b>
5524 </p><p><b>Bold tag left open</b>
5525 </p><p><i>Italic tag left open</i>
5526 </p><p>Normal text.
5527 </p>
5528 <!-- Unmatching number of opening, closing tags: -->
5529 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5530 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5531 </p><p>Plain <i>italic'</i>s plain
5532 </p>
5533 !! end
5534
5535 ###
5536 ### Tables
5537 ###
5538 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5539 ###
5540
5541 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5542 # is the bare minimum required by the spec, see:
5543 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5544 # Parsoid team replies: empty table tags are legal in HTML5
5545 !! test
5546 A table with no data.
5547 !! options
5548 parsoid=wt2html
5549 !! wikitext
5550 {||}
5551 !! html/php
5552
5553 !! html/parsoid
5554 <table></table>
5555
5556 !! end
5557
5558 !! test
5559 A table with stray table end tags on start tag line (wt2html)
5560 !! options
5561 parsoid=wt2html
5562 !! wikitext
5563 {|style="color: red;"|}
5564
5565 {|style="color: red;" |}
5566 |foo
5567 |}
5568
5569 {|style="color: red;"|} id="foo"
5570 |foo
5571 |}
5572
5573 {|style="color: red;" |} id="foo"
5574 |foo
5575 |}
5576 !! html
5577 <table style="color: red;"></table>
5578
5579 <table style="color: red;">
5580 <tbody><tr>
5581 <td>foo</td>
5582 </tr></tbody>
5583 </table>
5584
5585 <table style="color: red;" id="foo">
5586 <tbody><tr>
5587 <td>foo</td>
5588 </tr></tbody>
5589 </table>
5590
5591 <table style="color: red;" id="foo">
5592 <tbody><tr>
5593 <td>foo</td>
5594 </tr></tbody>
5595 </table>
5596
5597 !! end
5598
5599 !! test
5600 A table with no data (take 2)
5601 !! wikitext
5602 {|
5603 |}
5604 !! html/parsoid
5605 <table></table>
5606 !! end
5607
5608 # A table with nothing but a caption is invalid XHTML, we might want to render
5609 # this as <p>caption</p>
5610 # Parsoid team replies: table with only a caption is legal in HTML5
5611 !! test
5612 A table with nothing but a caption
5613 !! wikitext
5614 {|
5615 |+ caption
5616 |}
5617 !! html/php
5618 <table>
5619 <caption> caption
5620 </caption><tr><td></td></tr></table>
5621
5622 !! html/parsoid
5623 <table><caption> caption</caption></table>
5624 !! end
5625
5626 !! test
5627 A table with caption with default-spaced attributes and a table row
5628 !! wikitext
5629 {|
5630 |+ style="color: red;" | caption1
5631 |-
5632 | foo
5633 |}
5634 !! html
5635 <table>
5636 <caption style="color: red;"> caption1
5637 </caption>
5638 <tr>
5639 <td> foo
5640 </td></tr></table>
5641
5642 !! end
5643
5644 !! test
5645 A table with captions with non-default spaced attributes and a table row
5646 !! wikitext
5647 {|
5648 |+style="color: red;"|caption2
5649 |+ style="color: red;"| caption3
5650 |-
5651 | foo
5652 |}
5653 !! html
5654 <table>
5655 <caption style="color: red;">caption2
5656 </caption>
5657 <caption style="color: red;"> caption3
5658 </caption>
5659 <tr>
5660 <td> foo
5661 </td></tr></table>
5662
5663 !! end
5664
5665 !! test
5666 Table td-cell syntax variations
5667 !! wikitext
5668 {|
5669 | foo bar foo | baz
5670 | foo bar foo || baz
5671 | style='color:red;' | baz
5672 | style='color:red;' || baz
5673 |}
5674 !! html
5675 <table>
5676 <tr>
5677 <td> baz
5678 </td>
5679 <td> foo bar foo </td>
5680 <td> baz
5681 </td>
5682 <td style="color:red;"> baz
5683 </td>
5684 <td> style='color:red;' </td>
5685 <td> baz
5686 </td></tr></table>
5687
5688 !! end
5689
5690 !! test
5691 Simple table
5692 !! wikitext
5693 {|
5694 | 1 || 2
5695 |-
5696 | 3 || 4
5697 |}
5698 !! html
5699 <table>
5700 <tr>
5701 <td> 1 </td>
5702 <td> 2
5703 </td></tr>
5704 <tr>
5705 <td> 3 </td>
5706 <td> 4
5707 </td></tr></table>
5708
5709 !! end
5710
5711 !! test
5712 Simple table but with multiple dashes for row wikitext
5713 !! wikitext
5714 {|
5715 | foo
5716 |-----
5717 | bar
5718 |}
5719 !! html
5720 <table>
5721 <tr>
5722 <td> foo
5723 </td></tr>
5724 <tr>
5725 <td> bar
5726 </td></tr></table>
5727
5728 !! end
5729
5730 !! test
5731 Multiplication table
5732 !! wikitext
5733 {| border="1" cellpadding="2"
5734 |+Multiplication table
5735 |-
5736 ! &times; !! 1 !! 2 !! 3
5737 |-
5738 ! 1
5739 | 1 || 2 || 3
5740 |-
5741 ! 2
5742 | 2 || 4 || 6
5743 |-
5744 ! 3
5745 | 3 || 6 || 9
5746 |-
5747 ! 4
5748 | 4 || 8 || 12
5749 |-
5750 ! 5
5751 | 5 || 10 || 15
5752 |}
5753 !! html
5754 <table border="1" cellpadding="2">
5755 <caption>Multiplication table
5756 </caption>
5757 <tr>
5758 <th> &#215; </th>
5759 <th> 1 </th>
5760 <th> 2 </th>
5761 <th> 3
5762 </th></tr>
5763 <tr>
5764 <th> 1
5765 </th>
5766 <td> 1 </td>
5767 <td> 2 </td>
5768 <td> 3
5769 </td></tr>
5770 <tr>
5771 <th> 2
5772 </th>
5773 <td> 2 </td>
5774 <td> 4 </td>
5775 <td> 6
5776 </td></tr>
5777 <tr>
5778 <th> 3
5779 </th>
5780 <td> 3 </td>
5781 <td> 6 </td>
5782 <td> 9
5783 </td></tr>
5784 <tr>
5785 <th> 4
5786 </th>
5787 <td> 4 </td>
5788 <td> 8 </td>
5789 <td> 12
5790 </td></tr>
5791 <tr>
5792 <th> 5
5793 </th>
5794 <td> 5 </td>
5795 <td> 10 </td>
5796 <td> 15
5797 </td></tr></table>
5798
5799 !! end
5800
5801 !! test
5802 Accept "||" in table headings
5803 !! wikitext
5804 {|
5805 !h1 || h2
5806 |}
5807 !! html
5808 <table>
5809 <tr>
5810 <th>h1 </th>
5811 <th> h2
5812 </th></tr></table>
5813
5814 !! end
5815
5816 !! test
5817 Accept "!!" in table data
5818 !! wikitext
5819 {|
5820 | Foo!! ||
5821 |}
5822 !! html
5823 <table>
5824 <tr>
5825 <td> Foo!! </td>
5826 <td>
5827 </td></tr></table>
5828
5829 !! html/parsoid
5830 <table>
5831 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
5832 </tbody></table>
5833 !! end
5834
5835 !! test
5836 Accept "||" in indented table headings
5837 !! wikitext
5838 :{|
5839 !h1 || h2
5840 |}
5841 !! html
5842 <dl><dd><table>
5843 <tr>
5844 <th>h1 </th>
5845 <th> h2
5846 </th></tr></table></dd></dl>
5847
5848 !! end
5849
5850 !! test
5851 Accept "!!" in templates
5852 !! wikitext
5853 {|
5854 !a {{echo|b!!c}}
5855 |}
5856 !! html/php
5857 <table>
5858 <tr>
5859 <th>a b</th>
5860 <th>c
5861 </th></tr></table>
5862
5863 !! html/parsoid
5864 <table>
5865 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
5866 !! end
5867
5868 !! test
5869 Accept "!!" in table headings after newline
5870 !! wikitext
5871 {|
5872 !a
5873 b!!c
5874 |}
5875 !! html/php
5876 <table>
5877 <tr>
5878 <th>a
5879 <p>b!!c
5880 </p>
5881 </th></tr></table>
5882
5883 !! html/parsoid
5884 <table>
5885 <tbody><tr><th>a
5886 <p>b!!c</p></th></tr>
5887 </tbody></table>
5888 !! end
5889
5890 !! test
5891 Accept "!!" in table data of mixed wikitext / html syntax
5892 !! wikitext
5893 {|
5894 !a
5895 <tr><td>b!!c</td></tr>
5896 |}
5897 !! html+tidy
5898 <table>
5899 <tr>
5900 <th>a</th>
5901 </tr>
5902 <tr>
5903 <td>b!!c</td>
5904 </tr>
5905 </table>
5906 !! html/parsoid
5907 <table>
5908 <tbody><tr><th>a</th></tr>
5909 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
5910 </tbody></table>
5911 !! end
5912
5913 !! test
5914 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5915 !! wikitext
5916 {|
5917 !| h1
5918 || a
5919 |}
5920 !! html
5921 <table>
5922 <tr>
5923 <th> h1
5924 </th>
5925 <td> a
5926 </td></tr></table>
5927
5928 !! end
5929
5930 !!test
5931 Accept "| !" at start of line in tables (ignore !-attribute)
5932 !! wikitext
5933 {|
5934 |-
5935 | !style="color:red" | bar
5936 |}
5937 !! html
5938 <table>
5939
5940 <tr>
5941 <td> bar
5942 </td></tr></table>
5943
5944 !!end
5945
5946 !!test
5947 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 +/-
5948 !! wikitext
5949 {|
5950 |-
5951 |style='color:red;'|+1
5952 |style='color:blue;'|-1
5953 |-
5954 | 1 || 2 || 3
5955 | 1 ||+2 ||-3
5956 |-
5957 | +1
5958 | -1
5959 |}
5960 !! html
5961 <table>
5962
5963 <tr>
5964 <td style="color:red;">+1
5965 </td>
5966 <td style="color:blue;">-1
5967 </td></tr>
5968 <tr>
5969 <td> 1 </td>
5970 <td> 2 </td>
5971 <td> 3
5972 </td>
5973 <td> 1 </td>
5974 <td>+2 </td>
5975 <td>-3
5976 </td></tr>
5977 <tr>
5978 <td> +1
5979 </td>
5980 <td> -1
5981 </td></tr></table>
5982
5983 !!end
5984
5985 !! test
5986 Table rowspan
5987 !! wikitext
5988 {| border=1
5989 | Cell 1, row 1
5990 |rowspan=2| Cell 2, row 1 (and 2)
5991 | Cell 3, row 1
5992 |-
5993 | Cell 1, row 2
5994 | Cell 3, row 2
5995 |}
5996 !! html
5997 <table border="1">
5998 <tr>
5999 <td> Cell 1, row 1
6000 </td>
6001 <td rowspan="2"> Cell 2, row 1 (and 2)
6002 </td>
6003 <td> Cell 3, row 1
6004 </td></tr>
6005 <tr>
6006 <td> Cell 1, row 2
6007 </td>
6008 <td> Cell 3, row 2
6009 </td></tr></table>
6010
6011 !! end
6012
6013 !! test
6014 Nested table
6015 !! wikitext
6016 {| border=1
6017 | &alpha;
6018 |
6019 {| bgcolor=#ABCDEF border=2
6020 |nested
6021 |-
6022 |table
6023 |}
6024 |the original table again
6025 |}
6026 !! html
6027 <table border="1">
6028 <tr>
6029 <td> &#945;
6030 </td>
6031 <td>
6032 <table bgcolor="#ABCDEF" border="2">
6033 <tr>
6034 <td>nested
6035 </td></tr>
6036 <tr>
6037 <td>table
6038 </td></tr></table>
6039 </td>
6040 <td>the original table again
6041 </td></tr></table>
6042
6043 !! end
6044
6045 !! test
6046 Invalid attributes in table cell (bug 1830)
6047 !! wikitext
6048 {|
6049 |Cell:|broken
6050 |}
6051 !! html
6052 <table>
6053 <tr>
6054 <td>broken
6055 </td></tr></table>
6056
6057 !! end
6058
6059 !! test
6060 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6061 !! wikitext
6062 {|
6063 | title="foo" |bar
6064 | title="foo<nowiki>|</nowiki>" |bar
6065 | title="foo<nowiki>|</nowiki>" bar
6066 |}
6067 !! html
6068 <table>
6069 <tr>
6070 <td title="foo">bar
6071 </td>
6072 <td title="foo&#124;">bar
6073 </td>
6074 <td> title="foo|" bar
6075 </td></tr></table>
6076
6077 !! end
6078
6079 # The "|}" to close the table is missing from the input, so parsoid's
6080 # *2wt modes will fail.
6081 !! test
6082 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
6083 !! options
6084 parsoid=wt2html,html2html
6085 !! wikitext
6086 {|
6087 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6088 !! html/php
6089 <table>
6090 <tr>
6091 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6092 <td>]" onmouseover="alert(document.cookie)"&gt;test
6093 </td>
6094 </tr>
6095 </table>
6096
6097 !! html/parsoid
6098 <table><tbody>
6099 <tr>
6100 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6101 !! end
6102
6103 # FIXME: The php output is broken.
6104 !! test
6105 ! and || in td attributes should not be parsed as <th>/<td>
6106 !! wikitext
6107 {|
6108 | style="color: red !important;" data-contrived="put this here ||" | foo
6109 |}
6110 !! html/php
6111 <table>
6112 <tr>
6113 <td> style="color: red !important;" data-contrived="put this here </td>
6114 <td> foo
6115 </td></tr></table>
6116
6117 !! html/parsoid
6118 <table>
6119 <tbody><tr><td style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"autoInsertedEnd":true}'> foo</td></tr>
6120 </tbody></table>
6121 !! end
6122
6123 !! test
6124 Indented table markup mixed with indented pre content (proposed in bug 6200)
6125 !! wikitext
6126 <table>
6127 <tr>
6128 <td>
6129 Text that should be rendered preformatted
6130 </td>
6131 </tr>
6132 </table>
6133 !! html
6134 <table>
6135 <tr>
6136 <td>
6137 <pre>Text that should be rendered preformatted
6138 </pre>
6139 </td>
6140 </tr>
6141 </table>
6142
6143 !! end
6144
6145 !! test
6146 1. Template-generated table cell attributes and cell content
6147 !! wikitext
6148 {|
6149 |{{table_attribs}}
6150 | {{table_attribs}}
6151 || {{table_attribs_5}}
6152 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6153 |align=center {{table_attribs}}
6154 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6155 |}
6156 !! html
6157 <table>
6158 <tr>
6159 <td style="color:red;">Foo
6160 </td>
6161 <td style="color:red;">Foo
6162 </td>
6163 <td> style="color:red;"</td>
6164 <td>Bar
6165 </td>
6166 <td style="color:red;">Foo
6167 </td>
6168 <td align="center" style="color:red;">Foo
6169 </td>
6170 <td align="center" style="color:red;">Foo
6171 </td></tr></table>
6172
6173 !! end
6174
6175 !! test
6176 2. Template-generated table cell attributes and cell content
6177 !! wikitext
6178 {|
6179 |{{table_attribs_2}}
6180 |}
6181 !! html/php
6182 <table>
6183 <tr>
6184 <td style="color:red;">Foo
6185 </td>
6186 <td>Bar</td>
6187 <td>Baz
6188 </td></tr></table>
6189
6190 !! html/parsoid
6191 <table>
6192 <tbody><tr><td about="#mwt1" typeof="mw:Transclusion" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td>
6193 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6194 </tbody></table>
6195 !! end
6196
6197 !! test
6198 3. Template-generated table cell attributes and cell content
6199 !! wikitext
6200 {|
6201 !align=center {{table_header_cells}}
6202 |-
6203 |align=center {{table_cells}}
6204 |}
6205 !! html/php
6206 <table>
6207 <tr>
6208 <th align="center" style="color:red;">Foo</th>
6209 <th style="color:red;"><i>Bar</i></th>
6210 <th style="color:brown;"><i>Foo</i> and Baz
6211 </th></tr>
6212 <tr>
6213 <td align="center" style="color:red;">Foo</td>
6214 <td style="color:red;"><i>Bar</i></td>
6215 <td style="color:brown;"><i>Foo</i> and Baz
6216 </td></tr></table>
6217
6218 !! html/parsoid
6219 <table>
6220 <tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr>
6221 <td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr>
6222 </tbody></table>
6223 !! end
6224
6225 !! test
6226 4. Template-generated table cell attributes and cell content inside a templated table
6227 !! wikitext
6228 {{tbl-start}}
6229 !align=center {{table_header_cells}}
6230 |-
6231 |align=center {{table_cells}}
6232 {{tbl-end}}
6233 !! html/php
6234 <table>
6235 <tr>
6236 <th align="center" style="color:red;">Foo</th>
6237 <th style="color:red;"><i>Bar</i></th>
6238 <th style="color:brown;"><i>Foo</i> and Baz
6239 </th></tr>
6240 <tr>
6241 <td align="center" style="color:red;">Foo</td>
6242 <td style="color:red;"><i>Bar</i></td>
6243 <td style="color:brown;"><i>Foo</i> and Baz
6244 </td></tr></table>
6245
6246 !! html/parsoid
6247 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":1}},"\n|-\n|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'>
6248 <tbody><tr><th align="center" style="color:red;">Foo</th><th style="color:red;"><i>Bar</i></th><th style="color:brown;"><i>Foo</i> and Baz</th></tr>
6249 <tr>
6250 <td align="center" style="color:red;">Foo</td><td style="color:red;"><i>Bar</i></td><td style="color:brown;"><i>Foo</i> and Baz</td></tr>
6251 </tbody></table>
6252 !! end
6253
6254 ## Edge case fix to prevent future regressions
6255 !! test
6256 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6257 !! wikitext
6258 {|
6259 |{{table_attribs_7}}
6260 |}
6261 <references />
6262 !! html/parsoid
6263 <table>
6264 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<span class="mw-ref" id="cite_ref-1" rel="dc:references" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></td></tr>
6265 </tbody></table>
6266 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
6267 !! end
6268
6269 !! test
6270 Table with row followed by newlines and table heading
6271 !! wikitext
6272 {|
6273 |-
6274
6275 ! foo
6276 |}
6277 !! html
6278 <table>
6279
6280
6281 <tr>
6282 <th> foo
6283 </th></tr></table>
6284
6285 !! end
6286
6287 !! test
6288 Table with empty line following the start tag
6289 !! wikitext
6290 {|
6291
6292 |-
6293 | foo
6294 |}
6295 !! html
6296 <table>
6297
6298
6299 <tr>
6300 <td> foo
6301 </td></tr></table>
6302
6303 !! end
6304
6305 # FIXME: Preserve the attribute properly (with an empty string as value) in
6306 # the PHP parser. Parsoid implements the behavior below.
6307 !! test
6308 Table attributes with empty value
6309 !! wikitext
6310 {|
6311 | style=| hello
6312 |}
6313 !! html/parsoid
6314 <table>
6315 <tbody>
6316 <tr>
6317 <td style=""> hello
6318 </td></tr></tbody></table>
6319
6320 !! end
6321
6322 !! test
6323 Wikitext table with a lot of comments
6324 !! wikitext
6325 {|
6326 <!-- c0 -->
6327 | foo
6328 <!-- c1 -->
6329 |-<!-- c2 -->
6330 <!-- c3 -->
6331 |<!-- c4 -->
6332 <!-- c5 -->
6333 |}
6334 !! html
6335 <table>
6336 <tr>
6337 <td> foo
6338 </td></tr>
6339 <tr>
6340 <td>
6341 </td></tr></table>
6342
6343 !! end
6344
6345 !! test
6346 Wikitext table comments represented in parsoid dom
6347 !! wikitext
6348 {|<!--c1--><!--c2-->
6349 |-<!--c3-->
6350 | x
6351 |}
6352 !! html/php+tidy
6353 <table>
6354 <tr>
6355 <td>x</td>
6356 </tr>
6357 </table>
6358 !! html/parsoid
6359 <table><!--c1--><!--c2-->
6360 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6361 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6362 </tbody></table>
6363 !! end
6364
6365 !! test
6366 Wikitext table with double-line table cell
6367 !! wikitext
6368 {|
6369 |a
6370 b
6371 |}
6372 !! html
6373 <table>
6374 <tr>
6375 <td>a
6376 <p>b
6377 </p>
6378 </td></tr></table>
6379
6380 !! end
6381
6382 !! test
6383 Table cell with a single comment
6384 !! wikitext
6385 {|
6386 | <!-- c1 -->
6387 | a
6388 |}
6389 !! html
6390 <table>
6391 <tr>
6392 <td>
6393 </td>
6394 <td> a
6395 </td></tr></table>
6396
6397 !! end
6398
6399 !! test
6400 Table-cell after a comment-only-empty-line
6401 !! wikitext
6402 {|
6403 |a
6404 <!--c1-->
6405 <!--c2-->| b
6406 |}
6407 !! html
6408 <table>
6409 <tr>
6410 <td>a
6411 </td>
6412 <td> b
6413 </td></tr></table>
6414
6415 !! html/parsoid
6416 <table>
6417 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6418 <!--c1-->
6419 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6420 </tbody></table>
6421
6422 !! end
6423
6424 !! test
6425 Build table with {{!}}
6426 !! wikitext
6427 {{{!}} class="wikitable"
6428 ! header
6429 ! second header
6430 {{!}}- style="color:red;"
6431 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6432 {{!}}}
6433 !! html
6434 <table class="wikitable">
6435 <tr>
6436 <th> header
6437 </th>
6438 <th> second header
6439 </th></tr>
6440 <tr style="color:red;">
6441 <td> data </td>
6442 <td style="color:red;"> second data
6443 </td></tr></table>
6444
6445 !! end
6446
6447 !! test
6448 Build table with pipe as data
6449 !! wikitext
6450 {| class="wikitable"
6451 ! header
6452 ! second header
6453 |- style="color:red;"
6454 | data || style="color:red;" | second data
6455 |-
6456 | style="color:red;" | data with | || style="color:red;" | second data with |
6457 |-
6458 || data with | ||| second data with |
6459 |}
6460 !! html
6461 <table class="wikitable">
6462 <tr>
6463 <th> header
6464 </th>
6465 <th> second header
6466 </th></tr>
6467 <tr style="color:red;">
6468 <td> data </td>
6469 <td style="color:red;"> second data
6470 </td></tr>
6471 <tr>
6472 <td style="color:red;"> data with | </td>
6473 <td style="color:red;"> second data with |
6474 </td></tr>
6475 <tr>
6476 <td> data with | </td>
6477 <td> second data with |
6478 </td></tr></table>
6479
6480 !! end
6481
6482 !! test
6483 Build table with wikilink
6484 !! wikitext
6485 {| class="wikitable"
6486 ! header || second header
6487 |- style="color:red;"
6488 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6489 |-
6490 | data || second data [[Main Page|link|text with pipe]]
6491 |}
6492 !! html
6493 <table class="wikitable">
6494 <tr>
6495 <th> header </th>
6496 <th> second header
6497 </th></tr>
6498 <tr style="color:red;">
6499 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6500 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6501 </td></tr>
6502 <tr>
6503 <td> data </td>
6504 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6505 </td></tr></table>
6506
6507 !! end
6508
6509 # The expected HTML structure in this test is debatable. The PHP parser does
6510 # not parse this kind of table at all. The main focus for Parsoid is on
6511 # round-tripping, so this output is ok for now. TODO: revisit!
6512 !! test
6513 Wikitext table with html-syntax row
6514 !! wikitext
6515 {|
6516 |-
6517 <td>foo</td>
6518 |}
6519 !! html/parsoid
6520 <table>
6521 <tbody>
6522 <tr>
6523 <td>foo</td></tr></tbody></table>
6524 !! end
6525
6526 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6527 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6528 ## PHP parser, which tidy then compounds by fostering the content
6529 ## entirely out of the table. Parsoid recognizes the table context
6530 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6531 ## depends on PHP's treatment of broken table markup!
6532 !! test
6533 Implicit <td> after a |-
6534 !! options
6535 parsoid=wt2html,html2html
6536 !! wikitext
6537 {|
6538 |-
6539 a
6540 |}
6541 !! html/php
6542 <table>
6543
6544 a
6545 </table>
6546
6547 !! html/php+tidy
6548 <p>a</p>
6549 !! html/parsoid
6550 <table>
6551 <tr><td>a</td></tr>
6552 </table>
6553 !! end
6554
6555 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6556 !! test
6557 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6558 !! options
6559 parsoid=wt2html,html2html
6560 !! wikitext
6561 {|
6562 |-
6563 |
6564 a
6565 |-
6566 b
6567 |}
6568 !! html/php
6569 <table>
6570
6571 <tr>
6572 <td>
6573 <pre>a
6574 </pre>
6575 </td></tr>
6576 b
6577 </table>
6578
6579 !! html/php+tidy
6580 <p>b</p>
6581 <table>
6582 <tr>
6583 <td>
6584 <pre>
6585 a
6586 </pre></td>
6587 </tr>
6588 </table>
6589 !! html/parsoid
6590 <table>
6591 <tbody>
6592 <tr><td><pre>a</pre></td></tr>
6593 <tr><td> b</td></tr>
6594 </tbody>
6595 </table>
6596 !! end
6597
6598 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6599 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6600 !! test
6601 Lists should be recognized in an implicit <td> context
6602 !! options
6603 parsoid=wt2html,html2html
6604 !! wikitext
6605 {|
6606 |-
6607 *a
6608 |}
6609 !! html/php
6610 <table>
6611
6612 <ul><li>a</li></ul>
6613 </table>
6614
6615 !! html/php+tidy
6616 <ul>
6617 <li>a</li>
6618 </ul>
6619 !! html/parsoid
6620 <table>
6621 <tr>
6622 <td><ul>
6623 <li>a</li>
6624 </ul></td>
6625 </tr>
6626 </table>
6627 !! end
6628
6629 !! test
6630 Table cells not properly parsed in an implicit-td context
6631 !! wikitext
6632 {|
6633 |-
6634 {{table_attribs_4}} || a || b
6635 |}
6636 !! html/php+tidy
6637 <table>
6638 <tr>
6639 <td style="background-color:#DC241f;" width="10px"></td>
6640 <td>a</td>
6641 <td>b</td>
6642 </tr>
6643 </table>
6644 !! html/parsoid
6645 <table>
6646 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6647 <td style="background-color:#DC241f;" width="10px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["",{"template":{"target":{"wt":"table_attribs_4","href":"./Template:Table_attribs_4"},"params":{},"i":0}}," "]}'> </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> a </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> b</td></tr>
6648 </tbody></table>
6649 !! end
6650
6651 !! test
6652 Parsoid: Round-trip tables directly followed by content (bug 51219)
6653 !! options
6654 parsoid=wt2html,wt2wt
6655 !! wikitext
6656 {|
6657 |foo
6658 |} bar
6659
6660 {|
6661 |baz
6662 |}<b>quux</b>
6663 !! html+tidy
6664 <table>
6665 <tr>
6666 <td>foo</td>
6667 </tr>
6668 </table>
6669 <p>bar</p>
6670 <table>
6671 <tr>
6672 <td>baz</td>
6673 </tr>
6674 </table>
6675 <p><b>quux</b></p>
6676 !! end
6677
6678 !! test
6679 Parsoid: Default to a newline after tables in new content (bug 51219)
6680 !! options
6681 parsoid=html2wt
6682 !! html
6683 <table><tbody>
6684 <tr><td>foo</td></tr></tbody></table> bar
6685 <table><tbody>
6686 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6687 !! wikitext
6688 {|
6689 |foo
6690 |}
6691 <nowiki> </nowiki>bar
6692 {|
6693 |baz
6694 |}
6695 '''quux'''
6696 !! end
6697
6698 !! test
6699 Parsoid: newline inducing block nodes don't suppress <nowiki>
6700 !! options
6701 parsoid=html2wt
6702 !! html
6703 a<h1>foo</h1>
6704 !! wikitext
6705 <nowiki> </nowiki>a
6706
6707 = foo =
6708 !! end
6709
6710 !! test
6711 Parsoid: Row-syntax table headings followed by comment & table cells
6712 !! options
6713 parsoid=wt2html,wt2wt
6714 !! wikitext
6715 {|
6716 ! foo || bar
6717 <!-- foo --> || baz || quux
6718 |}
6719 !! html/php
6720 <table>
6721 <tr>
6722 <th> foo </th>
6723 <th> bar
6724 </th>
6725 <td> baz </td>
6726 <td> quux
6727 </td></tr></table>
6728
6729 !! html/parsoid
6730 <table>
6731 <tbody><tr><th> foo </th><th> bar
6732 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6733 </tbody></table>
6734 !! end
6735
6736
6737 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6738 # preserves it.
6739 !!test
6740 Parsoid: Recover better from broken table attributes
6741 !!options
6742 parsoid=wt2html
6743 !!wikitext
6744 {| class="foo
6745 | class="bar" |
6746 foo
6747 |}
6748 !!html/php+tidy
6749 <table>
6750 <tr>
6751 <td class="bar">
6752 <p>foo</p>
6753 </td>
6754 </tr>
6755 </table>
6756 !!html/parsoid
6757 <table class="foo">
6758 <tr>
6759 <td class="bar">
6760 <p>foo</p></td></tr>
6761 </tbody></table>
6762 !!end
6763
6764 !! test
6765 Strip unsupported table tags
6766 !! options
6767 parsoid=html2wt
6768 !! html
6769 <table>
6770 <thead>
6771 <tr>
6772 <th>Month</th>
6773 <th>Savings</th>
6774 </tr>
6775 </thead>
6776 <tbody>
6777 <tr>
6778 <td>January</td>
6779 <td>$100</td>
6780 </tr>
6781 <tr>
6782 <td>February</td>
6783 <td>$80</td>
6784 </tr>
6785 </tbody>
6786 <tfoot>
6787 <tr>
6788 <td>Sum</td>
6789 <td>$180</td>
6790 </tr>
6791 </tfoot>
6792 </table>
6793 !! wikitext
6794 {|
6795
6796 !Month
6797 !Savings
6798
6799 |January
6800 |$100
6801
6802 |-
6803 |February
6804 |$80
6805
6806 |Sum
6807 |$180
6808
6809 |}
6810 !! end
6811
6812 !!test
6813 Testing serialization after deletion of table cells
6814 !!options
6815 parsoid={
6816 "modes": ["wt2wt", "selser"],
6817 "changes": [
6818 ["#x", "remove"]
6819 ]
6820 }
6821 !!wikitext
6822 {|
6823 !h1 !!h2 !!h3
6824 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
6825 |}
6826 !! wikitext/edited
6827 {|
6828 !h1 !!h2 !!h3
6829 |c2 |||c3
6830 |}
6831 !!end
6832
6833 ###
6834 ### Internal links
6835 ###
6836 !! test
6837 Plain link, capitalized
6838 !! wikitext
6839 [[Main Page]]
6840 !! html
6841 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6842 </p>
6843 !! end
6844
6845 !! test
6846 Plain link, uncapitalized
6847 !! wikitext
6848 [[main Page]]
6849 !! html
6850 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6851 </p>
6852 !! end
6853
6854 !! test
6855 Piped link
6856 !! wikitext
6857 [[Main Page|The Main Page]]
6858 !! html
6859 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6860 </p>
6861 !! end
6862
6863 !! test
6864 Piped link with comment in link text
6865 !! wikitext
6866 [[Main Page|The Main<!--front--> Page]]
6867 !! html
6868 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6869 </p>
6870 !! end
6871
6872 !! test
6873 Piped link with multiple pipe characters in link text
6874 !! wikitext
6875 [[Main Page||The|Main|Page|]]
6876 !! html/php
6877 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
6878 </p>
6879 !! html/parsoid
6880 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
6881 !! end
6882
6883 !! test
6884 Broken link
6885 !! wikitext
6886 [[Zigzagzogzagzig]]
6887 !! html
6888 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6889 </p>
6890 !! end
6891
6892 !! test
6893 Broken link with fragment
6894 !! wikitext
6895 [[Zigzagzogzagzig#zug]]
6896 !! html
6897 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6898 </p>
6899 !! end
6900
6901 !! test
6902 Special page link with fragment
6903 !! wikitext
6904 [[Special:Version#anchor]]
6905 !! html
6906 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6907 </p>
6908 !! end
6909
6910 !! test
6911 Nonexistent special page link with fragment
6912 !! wikitext
6913 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6914 !! html
6915 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6916 </p>
6917 !! end
6918
6919 !! test
6920 Link with prefix
6921 !! wikitext
6922 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6923 !! html
6924 <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>
6925 </p>
6926 !! end
6927
6928 !! test
6929 Link with suffix
6930 !! wikitext
6931 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6932 !! html
6933 <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>!!!
6934 </p>
6935 !! end
6936
6937 !! article
6938 prefixed article
6939 !! text
6940 Some text
6941 !! endarticle
6942
6943 !! test
6944 Bug 43661: Piped links with identical prefixes
6945 !! wikitext
6946 [[prefixed article|prefixed articles with spaces]]
6947
6948 [[prefixed article|prefixed articlesaoeu]]
6949
6950 [[Main Page|Main Page test]]
6951 !! html
6952 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6953 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6954 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6955 </p>
6956 !! end
6957
6958
6959 !! test
6960 Link with HTML entity in suffix / tail
6961 !! wikitext
6962 [[Main Page]]&quot;, [[Main Page]]&#97;
6963 !! html/php
6964 <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;
6965 </p>
6966 !! html/parsoid
6967 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;quot;","srcContent":"\""}'>"</span>, <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#97;","srcContent":"a"}'>a</span></p>
6968 !! end
6969
6970 !! test
6971 Link with 3 brackets
6972 !! wikitext
6973 [[[Main Page]]]
6974 !! html
6975 <p>[[[Main Page]]]
6976 </p>
6977 !! end
6978
6979 !! test
6980 Link with 4 brackets
6981 !! wikitext
6982 [[[[Main Page]]]]
6983 !! html
6984 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6985 </p>
6986 !! end
6987
6988 !! test
6989 Piped link with 3 brackets
6990 !! wikitext
6991 [[[main page|the main page]]]
6992 !! html
6993 <p>[[[main page|the main page]]]
6994 </p>
6995 !! end
6996
6997 !! test
6998 Piped link with extlink-like text
6999 !! wikitext
7000 [[Main Page|[bar]]]
7001 [[Main Page|This is a [bar]]]
7002 !! html/php
7003 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7004 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7005 </p>
7006 !! html/parsoid
7007 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7008 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7009 !! end
7010
7011 !! test
7012 Link with multiple pipes
7013 !! wikitext
7014 [[Main Page|The|Main|Page]]
7015 !! html
7016 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7017 </p>
7018 !! end
7019
7020 # Note that parsoid does not munge anchor text; all non-space
7021 # characters are valid in HTML5 ids.
7022 !! test
7023 Anchor containing a #. (bug 63430)
7024 !! wikitext
7025 [[Main Page#And#Link]]
7026 !! html/php
7027 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7028 </p>
7029 !! html/parsoid
7030 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7031 !! end
7032
7033 !! test
7034 Link to namespaces
7035 !! wikitext
7036 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7037 !! html
7038 <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>
7039 </p>
7040 !! end
7041
7042 !! test
7043 Link with space in namespace
7044 !! wikitext
7045 [[User talk:Foo bar]]
7046 !! html
7047 <p><a href="/index.php?title=User_talk:Foo_bar&amp;action=edit&amp;redlink=1" class="new" title="User talk:Foo bar (page does not exist)">User talk:Foo bar</a>
7048 </p>
7049 !! end
7050
7051 !! article
7052 MemoryAlpha:AlphaTest
7053 !! text
7054 This is an article in the MemoryAlpha namespace
7055 (which shadows the memoryalpha interwiki link).
7056 !! endarticle
7057
7058 !! test
7059 Namespace takes precedence over interwiki link (bug 51680)
7060 !! wikitext
7061 [[MemoryAlpha:AlphaTest]]
7062 !! html
7063 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7064 </p>
7065 !! end
7066
7067 # The previous test doesn't work correctly in html2*, due to not recognizing the
7068 # link as an internal one. This one checks for the correct behavior.
7069 !! test
7070 Link to namespace preferred over interwiki with correct rel attribute
7071 !! options
7072 parsoid=html2wt,html2html
7073 !! html
7074 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7075 !! wikitext
7076 [[MemoryAlpha:AlphaTest]]
7077 !! end
7078
7079 !! test
7080 Piped link to namespace
7081 !! wikitext
7082 [[Meta:Disclaimers|The disclaimers]]
7083 !! html
7084 <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>
7085 </p>
7086 !! end
7087
7088 !! test
7089 Link containing }
7090 !! wikitext
7091 [[Usually caused by a typo (oops}]]
7092 !! html
7093 <p>[[Usually caused by a typo (oops}]]
7094 </p>
7095 !! end
7096
7097 !! article
7098 7% Solution
7099 !! text
7100 Just a test of an article title containing a percent.
7101 !! endarticle
7102
7103 !! test
7104 Link containing % (not as a hex sequence)
7105 !! wikitext
7106 [[7% Solution]]
7107 !! html/php
7108 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7109 </p>
7110 !! html/parsoid
7111 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7112 !! end
7113
7114 # note that the parsoid HTML is identical to the previous test output,
7115 # so the previous test ensures that the html2wt mode will generate the
7116 # "not as a hex sequence" wikitext.
7117 !! test
7118 Link containing % as a single hex sequence interpreted to char
7119 !! options
7120 parsoid=wt2wt,wt2html,html2html
7121 !! wikitext
7122 [[7%25 Solution]]
7123 !! html/php
7124 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7125 </p>
7126 !! html/parsoid
7127 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7128 !!end
7129
7130 !! test
7131 Link containing % as a double hex sequence interpreted to hex sequence
7132 !! wikitext
7133 [[7%2525 Solution]]
7134 !! html
7135 <p>[[7%2525 Solution]]
7136 </p>
7137 !!end
7138
7139 # note that parsoid does not munge anchor text; all non-space
7140 # characters are valid in HTML5 anchors.
7141 !! test
7142 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7143 Example for such a section: == < ==
7144 !! wikitext
7145 [[%23%3c]][[%23%3e]]
7146 !! html/php
7147 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7148 </p>
7149 !! html/parsoid
7150 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C" title="Main Page">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E" title="Main Page">#></a></p>
7151 !! end
7152
7153 !! test
7154 Link containing "<#" and ">#" as a hex sequences
7155 !! wikitext
7156 [[%3c%23]][[%3e%23]]
7157 !! html
7158 <p>[[%3c%23]][[%3e%23]]
7159 </p>
7160 !! end
7161
7162 !! test
7163 Link containing an equals sign
7164 !! wikitext
7165 [[Special:BookSources/isbn=4-00-026157-6]]
7166 !! html/php
7167 <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>
7168 </p>
7169 !! html/parsoid
7170 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
7171 !! end
7172
7173 !! article
7174 Foo~bar
7175 !! text
7176 Just a test of an article title containing a tilde.
7177 !! endarticle
7178
7179 # note that links containing signatures, like [[Foo~~~~]], are
7180 # massaged by the pre-save transform (PST) and so the tildes are never
7181 # seen by the parser.
7182 !! test
7183 Link containing a tilde
7184 !! wikitext
7185 [[Foo~bar]]
7186 !! html/php
7187 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7188 </p>
7189 !! html/parsoid
7190 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7191 !! end
7192
7193 !! test
7194 Link containing double-single-quotes '' (bug 4598)
7195 !! wikitext
7196 [[Lista d''e paise d''o munno]]
7197 !! html/php
7198 <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>
7199 </p>
7200 !! html/parsoid
7201 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a></p>
7202 !! end
7203
7204 !! test
7205 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7206 !! wikitext
7207 Some [[Link|pretty ''italics'' and stuff]]!
7208 !! html/php
7209 <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>!
7210 </p>
7211 !! html/parsoid
7212 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7213 !! end
7214
7215 !! test
7216 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7217 !! wikitext
7218 ''Some [[Link|pretty ''italics'' and stuff]]!''
7219 !! html
7220 <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>
7221 </p>
7222 !! end
7223
7224 !! test
7225 Link with double quotes in title part (literal) and alternate part (interpreted)
7226 !! wikitext
7227 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7228
7229 [[''Pentecoste'']]
7230
7231 [[''Pentecoste''|Pentecoste]]
7232
7233 [[''Pentecoste''|''Pentecoste'']]
7234 !! html/php
7235 <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>
7236 </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>
7237 </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>
7238 </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>
7239 </p>
7240 !! html/parsoid
7241 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></span></p>
7242 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7243 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7244 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7245 !! end
7246
7247 !! test
7248 Broken image links with HTML captions (bug 39700)
7249 !! wikitext
7250 [[File:Nonexistent|<script></script>]]
7251 [[File:Nonexistent|100x100px|<script></script>]]
7252 [[File:Nonexistent|&lt;]]
7253 [[File:Nonexistent|a<i>b</i>c]]
7254 !! html/php
7255 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7256 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7257 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7258 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7259 </p>
7260 !! html/parsoid
7261 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;script>&lt;/script>"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7262 <span typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;script>&lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100"/></a></span>
7263 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7264 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i>b&lt;/i>c"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span></p>
7265 !! end
7266
7267 !! test
7268 Plain link to URL
7269 !! wikitext
7270 [[http://www.example.com]]
7271 !! html/php
7272 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7273 </p>
7274 !! html/parsoid
7275 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7276 !! end
7277
7278 !! test
7279 Plain link to URL with link text
7280 !! wikitext
7281 [[http://www.example.com Link text]]
7282 !! html
7283 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7284 </p>
7285 !! end
7286
7287 !! test
7288 Plain link to protocol-relative URL
7289 !! wikitext
7290 [[//www.example.com]]
7291 !! html/php
7292 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7293 </p>
7294 !! html/parsoid
7295 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7296 !! end
7297
7298 !! test
7299 Plain link to protocol-relative URL with link text
7300 !! wikitext
7301 [[//www.example.com Link text]]
7302 !! html
7303 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7304 </p>
7305 !! end
7306
7307 !! test
7308 Plain link to page with question mark in title
7309 !! wikitext
7310 [[A?b]]
7311
7312 [[A?b|Baz]]
7313 !! html
7314 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7315 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7316 </p>
7317 !! end
7318
7319
7320 # I'm fairly sure the expected result here is wrong.
7321 # We want these to be URL links, not pseudo-pages with URLs for titles....
7322 # However the current output is also pretty screwy.
7323 #
7324 # ----
7325 # I'm changing it to match the current output--it arguably makes more
7326 # sense in the light of the test above. Old expected result was:
7327 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7328 #</p>
7329 # But I think this test is bordering on "garbage in, garbage out" anyway.
7330 # -- wtm
7331 !! test
7332 Piped link to URL
7333 !! wikitext
7334 Piped link to URL: [[http://www.example.com|an example URL]]
7335 !! html/php
7336 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7337 </p>
7338 !! html/parsoid
7339 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7340 !! end
7341
7342 !! test
7343 BUG 2: [[page|http://url/]] should link to page, not http://url/
7344 !! wikitext
7345 [[Main Page|http://url/]]
7346 !! html/php
7347 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7348 </p>
7349 !! html/parsoid
7350 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7351 !! end
7352
7353 # Parsoid does not mark self-links, by design.
7354 !! test
7355 BUG 337: Escaped self-links should be bold
7356 !! options
7357 title=[[Bug462]]
7358 !! wikitext
7359 [[Bu&#103;462]] [[Bug462]]
7360 !! html/php
7361 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7362 </p>
7363 !! html/php+tidy
7364 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7365 !! html/parsoid
7366 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7367 !! end
7368
7369 !! test
7370 Self-link to section should not be bold
7371 !! options
7372 title=[[Main Page]]
7373 !! wikitext
7374 [[Main Page#section]]
7375 !! html
7376 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7377 </p>
7378 !! end
7379
7380 !! article
7381 00
7382 !! text
7383 This is 00.
7384 !! endarticle
7385
7386 !!test
7387 Self-link to numeric title
7388 !!options
7389 title=[[0]]
7390 !! wikitext
7391 [[0]]
7392 !! html
7393 <p><strong class="selflink">0</strong>
7394 </p>
7395 !!end
7396
7397 !!test
7398 Link to numeric-equivalent title
7399 !!options
7400 title=[[0]]
7401 !! wikitext
7402 [[00]]
7403 !! html
7404 <p><a href="/wiki/00" title="00">00</a>
7405 </p>
7406 !!end
7407
7408 !! test
7409 <nowiki> inside a link
7410 !! wikitext
7411 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7412 !! html
7413 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7414 </p>
7415 !! end
7416
7417 !! test
7418 Non-breaking spaces in title
7419 !! wikitext
7420 [[&nbsp; Main &nbsp; Page &nbsp;]]
7421 !! html
7422 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7423 </p>
7424 !!end
7425
7426 !! test
7427 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7428 !! options
7429 language=ca
7430 !! wikitext
7431 '''[[Main Page]]'''
7432 !! html
7433 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7434 </p>
7435 !! end
7436
7437 !! test
7438 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7439 !! options
7440 language=ca
7441 !! wikitext
7442 ''[[Main Page]]''
7443 !! html
7444 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7445 </p>
7446 !! end
7447
7448 !! test
7449 Internal link with en linktrail: no apostrophes (bug 27473)
7450 !! options
7451 language=en
7452 !! wikitext
7453 [[Something]]'nice
7454 !! html
7455 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7456 </p>
7457 !! end
7458
7459 !! test
7460 Internal link with ca linktrail with apostrophes (bug 27473)
7461 !! options
7462 language=ca
7463 !! wikitext
7464 [[Something]]'nice
7465 !! html
7466 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7467 </p>
7468 !! end
7469
7470 !! test
7471 Internal link with kaa linktrail with apostrophes (bug 27473)
7472 !! options
7473 language=kaa
7474 !! wikitext
7475 [[Something]]'nice
7476 !! html
7477 <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>
7478 </p>
7479 !! end
7480
7481 !! test
7482 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7483 !! wikitext
7484 [[User:Foo/Test/63636:Bar|Test]]
7485 !! html/php
7486 <p><a href="/index.php?title=User:Foo/Test/63636:Bar&amp;action=edit&amp;redlink=1" class="new" title="User:Foo/Test/63636:Bar (page does not exist)">Test</a>
7487 </p>
7488 !! html/parsoid
7489 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7490 !! end
7491
7492 !! test
7493 Purely hash wikilink
7494 !! options
7495 title=[[User:test/123]]
7496 !! wikitext
7497 [[#a|b]]
7498 !! html/php
7499 <p><a href="#a">b</a>
7500 </p>
7501 !! html/parsoid
7502 <p><a rel="mw:WikiLink" href="./User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"./User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
7503 !! end
7504
7505 !! test
7506 1. Interaction of linktrail and template encapsulation
7507 !! options
7508 parsoid
7509 !! wikitext
7510 {{echo|[[Foo]]}}l
7511 !! html
7512 <p><a rel="mw:WikiLink" href="Foo" title="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
7513 !! end
7514
7515 !! test
7516 2. Interaction of linktrail and template encapsulation
7517 !! options
7518 parsoid
7519 !! wikitext
7520 {{echo|Some [[Fool]]}}s
7521 !! html
7522 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
7523 !! end
7524
7525 !! test
7526 3. Interaction of linktrail and template encapsulation
7527 !! options
7528 parsoid
7529 !! wikitext
7530 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7531 !! html
7532 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some <a rel="mw:WikiLink" href="./Fool" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b>bold and foolish</b></p>
7533 !! end
7534
7535 !! article
7536 Söfnuður
7537 !! text
7538 Test.
7539 !! endarticle
7540
7541 !! test
7542 Internal link with is link prefix
7543 !! options
7544 language=is
7545 !! wikitext
7546 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7547 !! html
7548 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7549 </p>
7550 !! end
7551
7552 !! article
7553 Mótmælendatrú
7554 !! text
7555 Test.
7556 !! endarticle
7557
7558 !! test
7559 Internal link with is link trail and link prefix
7560 !! options
7561 language=is
7562 !! wikitext
7563 [[mótmælendatrú|xxx]]ar
7564 [[mótmælendatrú]]ar
7565 mótmælenda[[söfnuður]]
7566 mótmælenda[[söfnuður|söfnuðir]]
7567 mótmælenda[[söfnuður|söfnuðir]]xxx
7568 !! html
7569 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7570 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7571 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7572 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7573 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7574 </p>
7575 !! end
7576
7577 !! test
7578 Parsoid link trail escaping
7579 !! options
7580 parsoid=html2wt,html2html
7581 !! html
7582 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7583 !! wikitext
7584 [[apple]]<nowiki/>s
7585 !! end
7586
7587 !! test
7588 Parsoid link prefix escaping
7589 !! options
7590 language=is
7591 parsoid=html2wt,html2html
7592 !! html
7593 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7594 !! wikitext
7595 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7596 !! end
7597
7598 !! test
7599 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7600 !! wikitext
7601 [[Foo| bar]]
7602
7603 [[Foo| ''bar'']]
7604
7605 [http://wp.org foo]
7606
7607 [http://wp.org ''foo'']
7608 !! html
7609 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7610 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7611 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7612 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7613 </p>
7614 !! end
7615
7616 !! test
7617 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7618 !! options
7619 parsoid
7620 !! wikitext
7621 [[Foo|{{echo|a}} b {{echo|c}}]]
7622 !! html
7623 <p><a rel="mw:WikiLink" href="Foo" title="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
7624 !! end
7625
7626 !! test
7627 Link with angle bracket after anchor
7628 !! wikitext
7629 [[Foo#<bar>]]
7630 !! html/php
7631 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7632 </p>
7633 !! html/parsoid
7634 <p><a rel="mw:WikiLink" href="./Foo#%3Cbar%3E" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#%3Cbar%3E"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
7635 !! end
7636
7637 ###
7638 ### Interwiki links (see maintenance/interwiki.sql)
7639 ###
7640
7641 !! test
7642 Inline interwiki link
7643 !! options
7644 parsoid=wt2html,wt2wt,html2html
7645 !! wikitext
7646 [[MeatBall:SoftSecurity]]
7647 !! html/php
7648 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7649 </p>
7650 !! html/parsoid
7651 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7652 !! end
7653
7654 !! test
7655 Inline interwiki link with empty title (bug 2372)
7656 !! options
7657 parsoid=wt2html,wt2wt,html2html
7658 !! wikitext
7659 [[MeatBall:]]
7660 !! html/php
7661 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7662 </p>
7663 !! html/parsoid
7664 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7665 !! end
7666
7667 !! test
7668 Interwiki link encoding conversion (bug 1636)
7669 !! wikitext
7670 *[[Wikipedia:ro:Olteni&#0355;a]]
7671 *[[Wikipedia:ro:Olteni&#355;a]]
7672 !! html
7673 <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></li>
7674 <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></li></ul>
7675
7676 !! html+tidy
7677 <ul>
7678 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
7679 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
7680 </ul>
7681 !! end
7682
7683 !! test
7684 Interwiki link with fragment (bug 2130)
7685 !! wikitext
7686 [[MeatBall:SoftSecurity#foo]]
7687 !! html
7688 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7689 </p>
7690 !! end
7691
7692 # Ideally the wikipedia: prefix here should be proto-relative too
7693 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7694 # define the 'en' prefix, and originally the test used 'wikipedia',
7695 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7696 # article.
7697 !! test
7698 Different interwiki prefixes mapping to the same URL
7699 !! wikitext
7700 [[:en:Foo]]
7701
7702 [[:en:Foo|Foo]]
7703
7704 [[wikipedia:Foo]]
7705
7706 [[:wikipedia:Foo|Foo]]
7707
7708 [[wikipedia:en:Foo]]
7709
7710 [[:wikipedia:en:Foo]]
7711
7712 [[ wikiPEdia :Foo]]
7713 !! html/parsoid
7714 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">en:Foo</a></p>
7715
7716 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">Foo</a></p>
7717
7718 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">wikipedia:Foo</a></p>
7719
7720 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":":wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">Foo</a></p>
7721
7722 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":"wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
7723
7724 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":":wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
7725
7726 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":" wikiPEdia :Foo"},"isIW":true}' title="wikipedia:Foo"> wikiPEdia :Foo</a></p>
7727 !! end
7728
7729 !! test
7730 Interwiki links that cannot be represented in wiki syntax
7731 !! wikitext
7732 [[meatball:ok]]
7733 [[meatball:ok#foo|ok with fragment]]
7734 [[meatball:ok_as_well?|ok ending with ? mark]]
7735 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7736 [http://de.wikipedia.org/wiki/#foo is just fragment]
7737
7738 !! html/php
7739 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7740 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7741 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" class="extiw" title="meatball:ok as well?">ok ending with ? mark</a>
7742 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7743 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7744 </p>
7745 !! html/parsoid
7746 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7747 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7748 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?" title="meatball:ok as well?">ok ending with ? mark</a>
7749 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7750 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7751 !! end
7752
7753 !! test
7754 Interwiki links: trail
7755 !! wikitext
7756 [[wikipedia:Foo|Ba]]r
7757 !! html/php
7758 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7759 </p>
7760 !! html/parsoid
7761 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}' title="wikipedia:Foo">Bar</a></p>
7762 !! end
7763
7764 !! test
7765 Local interwiki link
7766 !! options
7767 parsoid=wt2html,wt2wt,html2html
7768 !! wikitext
7769 [[local:Template:Foo]]
7770 !! html/php
7771 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7772 </p>
7773 !! html/parsoid
7774 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7775 !! end
7776
7777 # Parsoid does not mark self-links, by design.
7778 !! test
7779 Local interwiki link: self-link to current page
7780 !! options
7781 title=[[Main Page]]
7782 parsoid=wt2html,wt2wt,html2html
7783 !! wikitext
7784 [[local:Main Page]]
7785 !! html/php
7786 <p><strong class="selflink">local:Main Page</strong>
7787 </p>
7788 !! html/parsoid
7789 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7790 !! end
7791
7792 !! test
7793 Local interwiki link: prefix only (bug 64167)
7794 !! options
7795 parsoid=wt2html,wt2wt,html2html
7796 !! wikitext
7797 [[local:]]
7798 !! html/php
7799 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7800 </p>
7801 !! html/parsoid
7802 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7803 !! end
7804
7805 !! test
7806 Local interwiki link: with additional interwiki prefix (bug 61357)
7807 !! options
7808 parsoid=wt2html,wt2wt,html2html
7809 !! wikitext
7810 [[local:meatball:Hello]]
7811 !! html/php
7812 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7813 </p>
7814 !! html/parsoid
7815 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7816 !! end
7817
7818 !! test
7819 Multiple local interwiki link prefixes
7820 !! wikitext
7821 [[local:local:local:local:mi:local:Foo]]
7822 !! options
7823 parsoid=wt2html,wt2wt,html2html
7824 !! html/php
7825 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7826 </p>
7827 !! html/parsoid
7828 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7829 !! end
7830
7831 ###
7832 ### Interlanguage links
7833 ### Language links (so that searching for '### language' matches..)
7834 ###
7835
7836 !! test
7837 Interlanguage link
7838 !! options
7839 parsoid=wt2html,wt2wt,html2html
7840 !! wikitext
7841 Blah blah blah
7842 [[zh:Chinese]]
7843 !! html/php
7844 <p>Blah blah blah
7845 </p>
7846 !! html/parsoid
7847 <p>Blah blah blah</p>
7848 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7849 !! end
7850
7851 !! test
7852 Interlanguage link with spacing
7853 !! options
7854 parsoid=wt2html,wt2wt,html2html
7855 !! wikitext
7856 Blah blah blah
7857 [[ zh : Chinese ]]
7858 !! html/php
7859 <p>Blah blah blah
7860 </p>
7861 !! html/parsoid
7862 <p>Blah blah blah</p>
7863 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7864 !! end
7865
7866 !! test
7867 Double interlanguage link
7868 !! options
7869 parsoid=wt2html,wt2wt,html2html
7870 !! wikitext
7871 Blah blah blah
7872 [[es:Spanish]]
7873 [[zh:Chinese]]
7874 !! html/php
7875 <p>Blah blah blah
7876 </p>
7877 !! html/parsoid
7878 <p>Blah blah blah</p>
7879 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7880 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7881 !! end
7882
7883 !! test
7884 Interlanguage link variations
7885 !! options
7886 parsoid=wt2html,wt2wt,html2html
7887 !! wikitext
7888 Blah blah blah
7889 [[ es :Spanish]]
7890 [[ ZH :Chinese]]
7891 [[es:Foo_bar]]
7892 !! html/php
7893 <p>Blah blah blah
7894 </p>
7895 !! html/parsoid
7896 <p>Blah blah blah</p>
7897 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
7898 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
7899 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7900 !! end
7901
7902 !! test
7903 Space and question mark encoding in interlanguage links (T95473)
7904 !! options
7905 parsoid=wt2html,wt2wt,html2html
7906 !! wikitext
7907 Blah blah blah
7908 [[es:Foo bar?]]
7909 !! html/php
7910 <p>Blah blah blah
7911 </p>
7912 !! html/parsoid
7913 <p>Blah blah blah</p>
7914 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
7915 !! end
7916
7917 !! test
7918 Interlanguage link, with prefix links
7919 !! options
7920 language=ln
7921 !! wikitext
7922 Blah blah blah
7923 [[zh:Chinese]]
7924 !! html/php
7925 <p>Blah blah blah
7926 </p>
7927 !! html/parsoid
7928 <p>Blah blah blah</p>
7929 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7930 !! end
7931
7932 !! test
7933 Double interlanguage link, with prefix links (bug 8897)
7934 !! options
7935 language=ln
7936 !! wikitext
7937 Blah blah blah
7938 [[es:Spanish]]
7939 [[zh:Chinese]]
7940 !! html/php
7941 <p>Blah blah blah
7942 </p>
7943 !! html/parsoid
7944 <p>Blah blah blah</p>
7945 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7946 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7947 !! end
7948
7949 !! test
7950 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7951 !! wikitext
7952 Blah blah blah
7953 [[mul:Article]]
7954 !! html/php
7955 <p>Blah blah blah
7956 </p>
7957 !! html/parsoid
7958 <p>Blah blah blah</p>
7959 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7960 !! end
7961
7962 !! test
7963 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7964 !! options
7965 language=ln
7966 !! wikitext
7967 [[WW&nbsp;II]]
7968 !! html
7969 <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>
7970 </p>
7971 !! end
7972
7973 !! test
7974 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7975 !! options
7976 parsoid=html2wt
7977 !! html
7978 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7979 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7980 !! wikitext
7981 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7982
7983 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7984 !! end
7985
7986 !! test
7987 Parsoid: handle constructor well
7988 !! wikitext
7989 [[constructor]]
7990
7991 [[constructor:foo]]
7992 !! html/php
7993 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7994 </p><p><a href="/index.php?title=Constructor:foo&amp;action=edit&amp;redlink=1" class="new" title="Constructor:foo (page does not exist)">constructor:foo</a>
7995 </p>
7996 !! html/parsoid
7997 <p><a rel="mw:WikiLink" href="./Constructor" title="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;}}">constructor</a></p>
7998
7999 <p><a rel="mw:WikiLink" href="./Foo" title="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;}}">constructor:foo</a></p>
8000 !! end
8001
8002 !! article
8003 ko:
8004 !! text
8005 Test.
8006 !! endarticle
8007
8008 # Note that `ko` isn't a known interlanguage prefix
8009 !! test
8010 Parsoid: recognize interlanguage links without a target page
8011 !! options
8012 ill
8013 !! wikitext
8014 [[es:]]
8015
8016 [[ko:]]
8017 !! html/php
8018 es:
8019 !! html/parsoid
8020 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8021
8022 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8023 !! end
8024
8025 # Note that `ko` isn't a known interwiki prefix
8026 !! test
8027 Parsoid: recognize interwiki links without a target page
8028 !! options
8029 parsoid=wt2html,wt2wt,html2html
8030 !! wikitext
8031 [[:es:]]
8032
8033 [[:ko:]]
8034 !! html/php
8035 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8036 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8037 </p>
8038 !! html/parsoid
8039 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8040 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8041 !! end
8042
8043 !! test
8044 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8045 !! wikitext
8046 [[mi:Foo]]
8047 !! html/php
8048 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8049 </p>
8050 !! html/parsoid
8051 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8052 !! end
8053
8054 !! test
8055 Interlanguage link with preceding local interwiki link (bug 68085)
8056 !! options
8057 parsoid=wt2html,wt2wt,html2html
8058 !! wikitext
8059 Blah blah blah
8060 [[local:es:Spanish]]
8061 !! html/php
8062 <p>Blah blah blah
8063 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8064 </p>
8065 !! html/parsoid
8066 <p>Blah blah blah
8067 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8068 !! end
8069
8070 !! test
8071 Looks like an interlanguage link, but is actually a local interwiki
8072 !! options
8073 parsoid=wt2html,wt2wt,html2html
8074 !! wikitext
8075 Blah blah blah
8076 [[mi:Template:Foo]]
8077 !! html/php
8078 <p>Blah blah blah
8079 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8080 </p>
8081 !! html/parsoid
8082 <p>Blah blah blah
8083 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8084 !! end
8085
8086 ###
8087 ### Redirects, Parsoid-only
8088 ###
8089
8090 !! test
8091 1. Simple redirect to page
8092 !! wikitext
8093 #REDIRECT [[Main Page]]
8094 !! html/parsoid
8095 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8096 !! end
8097
8098 !! test
8099 2. Other redirect variants
8100 !! wikitext
8101 #REDIRECT [[Main_Page]]
8102 !! html/parsoid
8103 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8104 !! end
8105
8106 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8107 # This tests the Parsoid bail-out code.
8108 !! test
8109 3. Other redirect variants
8110 !! wikitext
8111 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8112 !! html/parsoid
8113 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8114 !! end
8115
8116 !! test
8117 4. Redirect to a templated destination
8118 !! wikitext
8119 #REDIRECT [[{{echo|Foo}}bar]]
8120 !! html/parsoid
8121 <link typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[12,24,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&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;Foo&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">Foo&lt;/span>bar"}]]}'/>
8122 !! end
8123
8124 !! test
8125 Empty redirect
8126 !! options
8127 parsoid=wt2html,wt2wt
8128 !! wikitext
8129 #REDIRECT [[]]
8130 !! html/parsoid
8131 <ol>
8132 <li>REDIRECT [[]]</li></ol>
8133 !! end
8134
8135 !! test
8136 Optional colon in #REDIRECT
8137 !! options
8138 # the colon is archaic syntax. we support it for wt2html, but we
8139 # don't care that it roundtrips back to the modern syntax.
8140 parsoid=wt2html,html2html
8141 !! wikitext
8142 #REDIRECT:[[Main Page]]
8143 !! html/parsoid
8144 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8145 !! end
8146
8147 !! test
8148 Whitespace in #REDIRECT with optional colon
8149 !! options
8150 # the colon and gratuitous whitespace is archaic syntax. we support
8151 # it for wt2html, but we don't care that it roundtrips back to the
8152 # modern syntax (without extra whitespace)
8153 parsoid=wt2html,html2html
8154 !! wikitext
8155
8156 #REDIRECT
8157 :
8158 [[Main Page]]
8159 !! html/parsoid
8160 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8161 !! end
8162
8163 !! test
8164 Piped link in #REDIRECT
8165 !! options
8166 # content after piped link is ignored. we support this syntax,
8167 # but don't care that the piped link is lost when we roundtrip this.
8168 parsoid=wt2html
8169 !! wikitext
8170 #REDIRECT [[Main Page|bar]]
8171 !! html/parsoid
8172 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8173 !! end
8174
8175 !! test
8176 Redirect to category (T104502)
8177 !! options
8178 parsoid=wt2html,wt2wt
8179 !! wikitext
8180 #REDIRECT [[Category:Foo]]
8181 !! html/parsoid
8182 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8183 !! end
8184
8185 !! test
8186 Redirect to category with URL encoding (T104502)
8187 !! options
8188 parsoid=wt2html
8189 !! wikitext
8190 #REDIRECT [[Category%3AFoo]]
8191 !! html/parsoid
8192 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8193 !! end
8194
8195 !! test
8196 Redirect to category page
8197 !! wikitext
8198 #REDIRECT [[:Category:Foo]]
8199 !! html/parsoid
8200 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8201 !! end
8202
8203 !! test
8204 Redirect to image page (1)
8205 !! wikitext
8206 #REDIRECT [[File:Wiki.png]]
8207 !! html/parsoid
8208 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8209 !! end
8210
8211 !! test
8212 Redirect to image page (2)
8213 !! wikitext
8214 #REDIRECT [[Image:Wiki.png]]
8215 !! html/parsoid
8216 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8217 !! end
8218
8219 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8220 # Next test confirms this.
8221 !! test
8222 Redirect to language (1) (T104918)
8223 !! options
8224 parsoid=wt2html,wt2wt,html2html
8225 !! wikitext
8226 #REDIRECT [[en:File:Wiki.png]]
8227 !! html/parsoid
8228 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8229 !! end
8230
8231 !! test
8232 Redirect to language (2) (T104918)
8233 !! wikitext
8234 #REDIRECT [[:en:File:Wiki.png]]
8235 !! html/parsoid
8236 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8237 !! end
8238
8239 !! test
8240 Redirect to interwiki (T104918)
8241 !! wikitext
8242 #REDIRECT [[meatball:File:Wiki.png]]
8243 !! html/parsoid
8244 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8245 !! end
8246
8247 !! test
8248 Non-English #REDIRECT
8249 !! options
8250 language=is
8251 !! wikitext
8252 #TILVÍSUN [[Main Page]]
8253 !! html/parsoid
8254 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8255 !! end
8256
8257 !! test
8258 Redirect syntax under text isn't considered a redirect
8259 !! wikitext
8260 some text
8261 #redirect [[Main Page]]
8262 !! html/parsoid
8263 <p>some text</p>
8264 <ol data-parsoid='{}'><li data-parsoid='{}'>redirect <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'>Main Page</a></li></ol>
8265 !! end
8266
8267 # FIXME: Should hoist the redirect to the top of the page and ensure there
8268 # is only one.
8269 !! test
8270 New redirect
8271 !! options
8272 parsoid=html2wt
8273 !! html/parsoid
8274 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8275 !! wikitext
8276 Foo
8277 #REDIRECT [[Foo]]
8278 !! end
8279
8280 ##
8281 ## XHTML tidiness
8282 ###
8283
8284 !! test
8285 <br> to <br />
8286 !! wikitext
8287 1<br>2<br />3
8288 !! html
8289 <p>1<br />2<br />3
8290 </p>
8291 !! end
8292
8293 !! test
8294 Broken br tag sanitization
8295 !! wikitext
8296 </br>
8297 !! html/php
8298 <p>&lt;/br&gt;
8299 </p>
8300 !! end
8301
8302 # TODO: Fix html2html mode (bug 51055)!
8303 !! test
8304 Parsoid: Broken br tag recognition
8305 !! options
8306 parsoid=wt2html
8307 !! wikitext
8308 </br>
8309
8310 <br/ >
8311 !! html+tidy
8312 <p><br /></p>
8313 <p><br /></p>
8314 !! end
8315
8316 !! test
8317 Incorrecly removing closing slashes from correctly formed XHTML
8318 !! wikitext
8319 <br style="clear:both;" />
8320 !! html
8321 <p><br style="clear:both;" />
8322 </p>
8323 !! end
8324
8325 !! test
8326 Failing to transform badly formed HTML into correct XHTML
8327 !! wikitext
8328 <br style="clear: left;">
8329 <br style="clear: right;">
8330 <br style="clear: both;">
8331 !! html
8332 <p><br style="clear: left;" />
8333 <br style="clear: right;" />
8334 <br style="clear: both;" />
8335 </p>
8336 !!end
8337
8338 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8339 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8340 !! test
8341 Handling html with a div self-closing tag
8342 !! wikitext
8343 <div title />
8344 <div title/>
8345 <div title/ >
8346 <div title=bar />
8347 <div title=bar/>
8348 <div title=bar/ >
8349 !! html/php
8350 <p>&lt;div title /&gt;
8351 &lt;div title/&gt;
8352 </p>
8353 <div>
8354 <p>&lt;div title=bar /&gt;
8355 &lt;div title=bar/&gt;
8356 </p>
8357 <div title="bar/"></div>
8358 </div>
8359
8360 !! html/parsoid
8361 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8362 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8363 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8364 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8365 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8366 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8367 !! end
8368
8369 !! test
8370 Handling html with a br self-closing tag
8371 !! wikitext
8372 <br title />
8373 <br title/>
8374 <br title/ >
8375 <br title=bar />
8376 <br title=bar/>
8377 <br title=bar/ >
8378 !! html/php
8379 <p><br title="" />
8380 <br title="" />
8381 <br />
8382 <br title="bar" />
8383 <br title="bar" />
8384 <br title="bar/" />
8385 </p>
8386 !! html/parsoid
8387 <p><br title="" />
8388 <br title="" />
8389 <br title="" />
8390 <br title="bar" />
8391 <br title="bar" />
8392 <br title="bar/" />
8393 </p>
8394 !! end
8395
8396 !! test
8397 Horizontal ruler (should it add that extra space?)
8398 !! wikitext
8399 <hr>
8400 <hr >
8401 foo <hr
8402 > bar
8403 !! html+tidy
8404 <hr />
8405 <hr />
8406 <p>foo</p>
8407 <hr />
8408 <p>bar</p>
8409 !! end
8410
8411 !! test
8412 Horizontal ruler -- 4+ dashes render hr
8413 !! wikitext
8414 ----
8415 !! html
8416 <hr />
8417
8418 !! end
8419
8420 !! test
8421 Horizontal ruler -- eats additional dashes on the same line
8422 !! wikitext
8423 ---------
8424 !! html
8425 <hr />
8426
8427 !! end
8428
8429 !! test
8430 Horizontal ruler -- does not collapse dashes on consecutive lines
8431 !! wikitext
8432 ----
8433 ----
8434 !! html
8435 <hr />
8436 <hr />
8437
8438 !! end
8439
8440 !! test
8441 Horizontal ruler -- <4 dashes render as plain text
8442 !! wikitext
8443 ---
8444 !! html
8445 <p>---
8446 </p>
8447 !! end
8448
8449 !! test
8450 Horizontal ruler -- Supports content following dashes on same line
8451 !! wikitext
8452 ---- Foo
8453 !! html
8454 <hr /> Foo
8455
8456 !! html+tidy
8457 <hr />
8458 <p>Foo</p>
8459 !! end
8460
8461 ###
8462 ### Block-level elements
8463 ###
8464 !! test
8465 Common list
8466 !! wikitext
8467 *Common list
8468 * item 2
8469 *item 3
8470 !! html
8471 <ul><li>Common list</li>
8472 <li> item 2</li>
8473 <li>item 3</li></ul>
8474
8475 !! end
8476
8477 !! test
8478 Numbered list
8479 !! wikitext
8480 #Numbered list
8481 #item 2
8482 # item 3
8483 !! html
8484 <ol><li>Numbered list</li>
8485 <li>item 2</li>
8486 <li> item 3</li></ol>
8487
8488 !! end
8489
8490 !! test
8491 Mixed list
8492 !! wikitext
8493 *Mixed list
8494 *# with numbers
8495 ** and bullets
8496 *# and numbers
8497 *bullets again
8498 **bullet level 2
8499 ***bullet level 3
8500 ***#Number on level 4
8501 **bullet level 2
8502 **#Number on level 3
8503 **#Number on level 3
8504 *#number level 2
8505 *Level 1
8506 *** Level 3
8507 #** Level 3, but ordered
8508 !! html
8509 <ul><li>Mixed list
8510 <ol><li> with numbers</li></ol>
8511 <ul><li> and bullets</li></ul>
8512 <ol><li> and numbers</li></ol></li>
8513 <li>bullets again
8514 <ul><li>bullet level 2
8515 <ul><li>bullet level 3
8516 <ol><li>Number on level 4</li></ol></li></ul></li>
8517 <li>bullet level 2
8518 <ol><li>Number on level 3</li>
8519 <li>Number on level 3</li></ol></li></ul>
8520 <ol><li>number level 2</li></ol></li>
8521 <li>Level 1
8522 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8523 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8524
8525 !! end
8526
8527 !! test
8528 Nested lists 1
8529 !! wikitext
8530 *foo
8531 **bar
8532 !! html
8533 <ul><li>foo
8534 <ul><li>bar</li></ul></li></ul>
8535
8536 !! end
8537
8538 !! test
8539 Nested lists 2
8540 !! wikitext
8541 **foo
8542 *bar
8543 !! html
8544 <ul><li><ul><li>foo</li></ul></li>
8545 <li>bar</li></ul>
8546
8547 !! end
8548
8549 !! test
8550 Nested lists 3 (first element empty)
8551 !! wikitext
8552 *
8553 **bar
8554 !! html
8555 <ul><li>
8556 <ul><li>bar</li></ul></li></ul>
8557
8558 !! end
8559
8560 !! test
8561 Nested lists 4 (first element empty)
8562 !! wikitext
8563 **
8564 *bar
8565 !! html
8566 <ul><li><ul><li></li></ul></li>
8567 <li>bar</li></ul>
8568
8569 !! end
8570
8571 !! test
8572 Nested lists 5 (both elements empty)
8573 !! wikitext
8574 **
8575 *
8576 !! html
8577 <ul><li><ul><li></li></ul></li>
8578 <li></li></ul>
8579
8580 !! end
8581
8582 !! test
8583 Nested lists 6 (both elements empty)
8584 !! wikitext
8585 *
8586 **
8587 !! html
8588 <ul><li>
8589 <ul><li></li></ul></li></ul>
8590
8591 !! end
8592
8593 !! test
8594 Nested lists 7 (skip initial nesting levels)
8595 !! wikitext
8596 *** foo
8597 !! html
8598 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8599
8600 !! end
8601
8602 !! test
8603 Nested lists 8 (multiple nesting transitions)
8604 !! wikitext
8605 * foo
8606 *** bar
8607 ** baz
8608 * boo
8609 !! html
8610 <ul><li> foo
8611 <ul><li><ul><li> bar</li></ul></li>
8612 <li> baz</li></ul></li>
8613 <li> boo</li></ul>
8614
8615 !! end
8616
8617 !! test
8618 Nested lists 9 (extension interaction)
8619 !! options
8620 parsoid
8621 !! wikitext
8622 *<references />
8623 !! html/parsoid
8624 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8625 !! end
8626
8627 !! test
8628 1. Lists with start-of-line-transparent tokens before bullets: Comments
8629 !! wikitext
8630 *foo
8631 *<!--cmt-->bar
8632 <!--cmt-->*baz
8633 !! html
8634 <ul><li>foo</li>
8635 <li>bar</li>
8636 <li>baz</li></ul>
8637
8638 !! end
8639
8640 !! test
8641 2. Lists with start-of-line-transparent tokens before bullets: Template close
8642 !! wikitext
8643 *foo {{echo|bar
8644 }}*baz
8645 !! html
8646 <ul><li>foo bar</li>
8647 <li>baz</li></ul>
8648
8649 !! end
8650
8651 !! test
8652 List items are not parsed correctly following a <pre> block (bug 785)
8653 !! wikitext
8654 * <pre>foo</pre>
8655 * <pre>bar</pre>
8656 * zar
8657 !! html/php
8658 <ul><li> <pre>foo</pre></li>
8659 <li> <pre>bar</pre></li>
8660 <li> zar</li></ul>
8661
8662 !! html/parsoid
8663 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8664 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8665 <li> zar</li></ul>
8666 !! end
8667
8668 !! test
8669 List items from template
8670 !! wikitext
8671
8672 {{inner list}}
8673 * item 2
8674
8675 * item 0
8676 {{inner list}}
8677 * item 2
8678
8679 * item 0
8680 * notSOL{{inner list}}
8681 * item 2
8682 !! html
8683 <ul><li> item 1</li>
8684 <li> item 2</li></ul>
8685 <ul><li> item 0</li>
8686 <li> item 1</li>
8687 <li> item 2</li></ul>
8688 <ul><li> item 0</li>
8689 <li> notSOL</li>
8690 <li> item 1</li>
8691 <li> item 2</li></ul>
8692
8693 !! end
8694
8695 !! test
8696 List interrupted by empty line or heading
8697 !! wikitext
8698 * foo
8699
8700 ** bar
8701 == A heading ==
8702 * Another list item
8703 !! html
8704 <ul><li> foo</li></ul>
8705 <ul><li><ul><li> bar</li></ul></li></ul>
8706 <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>
8707 <ul><li> Another list item</li></ul>
8708
8709 !!end
8710
8711 !!test
8712 Multiple list tags generated by templates
8713 !! wikitext
8714 {{echo|<li>}}a
8715 {{echo|<li>}}b
8716 {{echo|<li>}}c
8717 !! html
8718 <li>a
8719 <li>b
8720 <li>c</li>
8721 </li>
8722 </li>
8723
8724 !! html+tidy
8725 <ul>
8726 <li>a</li>
8727 <li>b</li>
8728 <li>c</li>
8729 </ul>
8730 !!end
8731
8732 !!test
8733 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8734 !! wikitext
8735 *a
8736 <!--This line will NOT split the list-->
8737 *b
8738 <!--This line will NOT split the list either-->
8739 *c
8740 <!--foo--> <!----> <!--This line NOT split the list either-->
8741 *d
8742 !! html
8743 <ul><li>a</li>
8744 <li>b</li>
8745 <li>c</li>
8746 <li>d</li></ul>
8747
8748 !!end
8749
8750 !!test
8751 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8752 !! wikitext
8753 *a
8754 <!--This line will NOT split the list-->
8755 *b
8756 <!--This line will NOT split the list either-->
8757 *c
8758 <!--foo--> <!----> <!--This line NOT split the list
8759 either-->
8760 *d
8761 !! html
8762 <ul><li>a</li>
8763 <li>b</li>
8764 <li>c</li>
8765 <li>d</li></ul>
8766
8767 !!end
8768
8769 !!test
8770 Test the li-hack
8771 (The PHP parser relies on Tidy for the hack)
8772 !!options
8773 parsoid=wt2html,wt2wt
8774 !! wikitext
8775 * foo
8776 * <li>li-hack
8777 * {{echo|<li>templated li-hack}}
8778 * <!--foo--> <li> unsupported li-hack with preceding comments
8779
8780 <ul>
8781 <li><li>not a li-hack
8782 </li>
8783 </ul>
8784 !! html+tidy
8785 <ul>
8786 <li>foo</li>
8787 <li>li-hack</li>
8788 <li>templated li-hack</li>
8789 <li>unsupported li-hack with preceding comments</li>
8790 </ul>
8791 <ul>
8792 <li>not a li-hack</li>
8793 </ul>
8794 !!end
8795
8796 !! test
8797 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8798 !! options
8799 parsoid
8800 !! wikitext
8801 # foo
8802 ## bar
8803 * foo
8804 ** bar
8805 : foo
8806 :: bar
8807 !! html
8808 <ol>
8809 <li> foo<ol>
8810 <li> bar</li>
8811 </ol></li>
8812 </ol><ul>
8813 <li> foo<ul>
8814 <li> bar</li>
8815 </ul></li>
8816 </ul><dl>
8817 <dd> foo<dl>
8818 <dd> bar</dd>
8819 </dl></dd>
8820 </dl>
8821 !! end
8822
8823 !! test
8824 Parsoid: Test of whitespace serialization with Templated bullets
8825 !! options
8826 parsoid
8827 !! wikitext
8828 * {{bullet}}
8829 !! html
8830 <ul>
8831 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8832 </ul>
8833 !! end
8834
8835 # ------------------------------------------------------------------------
8836 # The next set of tests are about Parsoid's ability to handle badly nested
8837 # tags (parse, minimize scope of fixup, and roundtrip back)
8838 # ------------------------------------------------------------------------
8839
8840 !! test
8841 Unbalanced closing block tags break a list
8842 (php parser relies on Tidy to fix up)
8843 !! wikitext
8844 <div>
8845 *a</div><div>
8846 *b</div>
8847 !! html+tidy
8848 <div>
8849 <ul>
8850 <li>a</li>
8851 </ul>
8852 </div>
8853 <div>
8854 <ul>
8855 <li>b</li>
8856 </ul>
8857 </div>
8858 !! end
8859
8860 # Parsoid fails this test, but it might be tricky to support properly.
8861 # See bug 68395.
8862 !! test
8863 Unbalanced closing non-block tags don't break a list
8864 (php parser relies on Tidy to fix up)
8865 !! wikitext
8866 <span>
8867 *a</span><span>
8868 *b</span>
8869 !! html/php+tidy
8870 <ul>
8871 <li><span>a</span></li>
8872 <li><span>b</span></li>
8873 </ul>
8874 !! html/parsoid
8875 <span>
8876 <ul>
8877 <li>a<span></span>
8878 </li>
8879 <li>b
8880 </li>
8881 </ul>
8882 </span>
8883 !! end
8884
8885 !! test
8886 Unclosed formatting tags that straddle lists are closed and reopened
8887 (php parser relies on Tidy to fix up)
8888 !! options
8889 parsoid=wt2html,wt2wt,html2html
8890 !! wikitext
8891 # <s> a
8892 # b </s>
8893 !! html/php+tidy
8894 <ol>
8895 <li><s>a</s></li>
8896 <li><s>b</s></li>
8897 </ol>
8898 !! html/parsoid
8899 <ol><li> <s> a</s></li>
8900 <li><s> b </s></li></ol>
8901 !! end
8902
8903 # See bug 68395.
8904 !!test
8905 1. List embedded in a formatting tag
8906 !! wikitext
8907 <small>
8908 * foo
8909 </small>
8910 !! html/php+tidy
8911 <ul>
8912 <li><small>foo</small></li>
8913 </ul>
8914 !! html/parsoid
8915 <small>
8916 <ul>
8917 <li> foo</li>
8918 </ul>
8919 </small>
8920 !!end
8921
8922 ## Ugly Parsoid output here
8923 ## Not sure what the right output is.
8924 !!test
8925 2. List embedded in a formatting tag
8926 !! wikitext
8927 <small>
8928 *a
8929 *b</small>
8930 !! html/php+tidy
8931 <ul>
8932 <li><small>a</small></li>
8933 <li><small>b</small></li>
8934 </ul>
8935 !! html/parsoid
8936 <small></small>
8937 <ul><small>
8938 <li>a</li>
8939 </small>
8940 <li><small>b</small></li>
8941 </ul>
8942 !!end
8943
8944 # Ugly Parsoid and PHP parser output here
8945 # Not sure if we want to make this a test!
8946 #
8947 ## !!test
8948 ## 3. Unclosed formatting tags in list elements
8949 ## !! wikitext
8950 ## *<small>a
8951 ## *<small>b
8952 ## !! html/php+tidy
8953 ## <ul>
8954 ## <li><small>a</small></li>
8955 ## <li><small><small>b</small></small></li>
8956 ## </ul>
8957 ## !! html/parsoid
8958 ## <ul>
8959 ## <li><small>a</small></li>
8960 ## <small>
8961 ## <li><small>b</small></li>
8962 ## </small></ul>
8963 ## !!end
8964
8965 # This is a bug in the PHP parser + tidy combination.
8966 # (The </tr> tag gets parsed as text and html-escaped by PHP,
8967 # and then fostered out of the table by tidy.)
8968 # We believe the Parsoid output to be correct.
8969 !! test
8970 Table with missing opening <tr> tag
8971 !! options
8972 parsoid=wt2html,wt2wt
8973 !! wikitext
8974 <table>
8975 <td>foo</td>
8976 </tr>
8977 </table>
8978 !! html+tidy
8979 <table>
8980 <tr>
8981 <td>foo</td>
8982 </tr>
8983 </table>
8984 !! end
8985
8986 ###
8987 ### Magic Words
8988 ###
8989
8990 # Note that the current date is hard-coded as
8991 # 1970-01-01T00:02:03Z (a Thursday)
8992 # when running parser tests. The timezone is also fixed to GMT, so
8993 # local date will be identical to current date.
8994
8995 !! test
8996 Magic Word: {{CURRENTDAY}}
8997 !! wikitext
8998 {{CURRENTDAY}}
8999 !! html
9000 <p>1
9001 </p>
9002 !! end
9003
9004 !! test
9005 Magic Word: {{CURRENTDAY2}}
9006 !! wikitext
9007 {{CURRENTDAY2}}
9008 !! html
9009 <p>01
9010 </p>
9011 !! end
9012
9013 !! test
9014 Magic Word: {{CURRENTDAYNAME}}
9015 !! wikitext
9016 {{CURRENTDAYNAME}}
9017 !! html
9018 <p>Thursday
9019 </p>
9020 !! end
9021
9022 !! test
9023 Magic Word: {{CURRENTDOW}}
9024 !! wikitext
9025 {{CURRENTDOW}}
9026 !! html
9027 <p>4
9028 </p>
9029 !! end
9030
9031 !! test
9032 Magic Word: {{CURRENTMONTH}}
9033 !! wikitext
9034 {{CURRENTMONTH}}
9035 !! html
9036 <p>01
9037 </p>
9038 !! end
9039
9040 !! test
9041 Magic Word: {{CURRENTMONTH1}}
9042 !! wikitext
9043 {{CURRENTMONTH1}}
9044 !! html
9045 <p>1
9046 </p>
9047 !! end
9048
9049 !! test
9050 Magic Word: {{CURRENTMONTHABBREV}}
9051 !! wikitext
9052 {{CURRENTMONTHABBREV}}
9053 !! html
9054 <p>Jan
9055 </p>
9056 !! end
9057
9058 !! test
9059 Magic Word: {{CURRENTMONTHNAME}}
9060 !! wikitext
9061 {{CURRENTMONTHNAME}}
9062 !! html
9063 <p>January
9064 </p>
9065 !! end
9066
9067 !! test
9068 Magic Word: {{CURRENTMONTHNAMEGEN}}
9069 !! wikitext
9070 {{CURRENTMONTHNAMEGEN}}
9071 !! html
9072 <p>January
9073 </p>
9074 !! end
9075
9076 !! test
9077 Magic Word: {{CURRENTTIME}}
9078 !! wikitext
9079 {{CURRENTTIME}}
9080 !! html
9081 <p>00:02
9082 </p>
9083 !! end
9084
9085 !! test
9086 Magic Word: {{CURRENTHOUR}}
9087 !! wikitext
9088 {{CURRENTHOUR}}
9089 !! html
9090 <p>00
9091 </p>
9092 !! end
9093
9094 !! test
9095 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9096 !! wikitext
9097 {{CURRENTWEEK}}
9098 !! html
9099 <p>1
9100 </p>
9101 !! end
9102
9103 !! test
9104 Magic Word: {{CURRENTYEAR}}
9105 !! wikitext
9106 {{CURRENTYEAR}}
9107 !! html
9108 <p>1970
9109 </p>
9110 !! end
9111
9112 !! test
9113 Magic Word: {{CURRENTTIMESTAMP}}
9114 !! wikitext
9115 {{CURRENTTIMESTAMP}}
9116 !! html
9117 <p>19700101000203
9118 </p>
9119 !! end
9120
9121 !! test
9122 Magic Words LOCAL (UTC)
9123 !! wikitext
9124 * {{LOCALMONTH}}
9125 * {{LOCALMONTH1}}
9126 * {{LOCALMONTHNAME}}
9127 * {{LOCALMONTHNAMEGEN}}
9128 * {{LOCALMONTHABBREV}}
9129 * {{LOCALDAY}}
9130 * {{LOCALDAY2}}
9131 * {{LOCALDAYNAME}}
9132 * {{LOCALYEAR}}
9133 * {{LOCALTIME}}
9134 * {{LOCALHOUR}}
9135 * {{LOCALWEEK}}
9136 * {{LOCALDOW}}
9137 * {{LOCALTIMESTAMP}}
9138 !! html
9139 <ul><li> 01</li>
9140 <li> 1</li>
9141 <li> January</li>
9142 <li> January</li>
9143 <li> Jan</li>
9144 <li> 1</li>
9145 <li> 01</li>
9146 <li> Thursday</li>
9147 <li> 1970</li>
9148 <li> 00:02</li>
9149 <li> 00</li>
9150 <li> 1</li>
9151 <li> 4</li>
9152 <li> 19700101000203</li></ul>
9153
9154 !! end
9155
9156 !! test
9157 Magic Word: {{FULLPAGENAME}}
9158 !! options
9159 title=[[User:Ævar Arnfjörð Bjarmason]]
9160 !! wikitext
9161 {{FULLPAGENAME}}
9162 !! html
9163 <p>User:Ævar Arnfjörð Bjarmason
9164 </p>
9165 !! end
9166
9167 !! test
9168 Magic Word: {{FULLPAGENAMEE}}
9169 !! options
9170 title=[[User:Ævar Arnfjörð Bjarmason]]
9171 !! wikitext
9172 {{FULLPAGENAMEE}}
9173 !! html
9174 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9175 </p>
9176 !! end
9177
9178 !! test
9179 Magic Word: {{TALKSPACE}}
9180 !! options
9181 title=[[User:Ævar Arnfjörð Bjarmason]]
9182 !! wikitext
9183 {{TALKSPACE}}
9184 !! html
9185 <p>User talk
9186 </p>
9187 !! end
9188
9189 !! test
9190 Magic Word: {{TALKSPACE}}, same namespace
9191 !! options
9192 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9193 !! wikitext
9194 {{TALKSPACE}}
9195 !! html
9196 <p>User talk
9197 </p>
9198 !! end
9199
9200 !! test
9201 Magic Word: {{TALKSPACE}}, main namespace
9202 !! options
9203 title=[[Parser Test]]
9204 !! wikitext
9205 {{TALKSPACE}}
9206 !! html
9207 <p>Talk
9208 </p>
9209 !! end
9210
9211 !! test
9212 Magic Word: {{TALKSPACEE}}
9213 !! options
9214 title=[[User:Ævar Arnfjörð Bjarmason]]
9215 !! wikitext
9216 {{TALKSPACEE}}
9217 !! html
9218 <p>User_talk
9219 </p>
9220 !! end
9221
9222 !! test
9223 Magic Word: {{SUBJECTSPACE}}
9224 !! options
9225 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9226 !! wikitext
9227 {{SUBJECTSPACE}}
9228 !! html
9229 <p>User
9230 </p>
9231 !! end
9232
9233 !! test
9234 Magic Word: {{SUBJECTSPACE}}, same namespace
9235 !! options
9236 title=[[User:Ævar Arnfjörð Bjarmason]]
9237 !! wikitext
9238 {{SUBJECTSPACE}}
9239 !! html
9240 <p>User
9241 </p>
9242 !! end
9243
9244 !! test
9245 Magic Word: {{SUBJECTSPACE}}, main namespace
9246 !! options
9247 title=[[Parser Test]]
9248 !! wikitext
9249 {{SUBJECTSPACE}}
9250 !! html
9251
9252 !! end
9253
9254 !! test
9255 Magic Word: {{SUBJECTSPACEE}}
9256 !! options
9257 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9258 !! wikitext
9259 {{SUBJECTSPACEE}}
9260 !! html
9261 <p>User
9262 </p>
9263 !! end
9264
9265 !! test
9266 Magic Word: {{NAMESPACE}}
9267 !! options
9268 title=[[User:Ævar Arnfjörð Bjarmason]]
9269 !! wikitext
9270 {{NAMESPACE}}
9271 !! html
9272 <p>User
9273 </p>
9274 !! end
9275
9276 !! test
9277 Magic Word: {{NAMESPACEE}}
9278 !! options
9279 title=[[User:Ævar Arnfjörð Bjarmason]]
9280 !! wikitext
9281 {{NAMESPACEE}}
9282 !! html
9283 <p>User
9284 </p>
9285 !! end
9286
9287 !! test
9288 Magic Word: {{NAMESPACENUMBER}}
9289 !! options
9290 title=[[User:Ævar Arnfjörð Bjarmason]]
9291 !! wikitext
9292 {{NAMESPACENUMBER}}
9293 !! html
9294 <p>2
9295 </p>
9296 !! end
9297
9298 !! test
9299 Magic Word: {{SUBPAGENAME}}
9300 !! options
9301 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9302 !! wikitext
9303 {{SUBPAGENAME}}
9304 !! html
9305 <p>sub ö
9306 </p>
9307 !! end
9308
9309 !! test
9310 Magic Word: {{SUBPAGENAMEE}}
9311 !! options
9312 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9313 !! wikitext
9314 {{SUBPAGENAMEE}}
9315 !! html
9316 <p>sub_%C3%B6
9317 </p>
9318 !! end
9319
9320 !! test
9321 Magic Word: {{ROOTPAGENAME}}
9322 !! options
9323 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9324 !! wikitext
9325 {{ROOTPAGENAME}}
9326 !! html
9327 <p>Ævar Arnfjörð Bjarmason
9328 </p>
9329 !! end
9330
9331 !! test
9332 Magic Word: {{ROOTPAGENAMEE}}
9333 !! options
9334 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9335 !! wikitext
9336 {{ROOTPAGENAMEE}}
9337 !! html
9338 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9339 </p>
9340 !! end
9341
9342 !! test
9343 Magic Word: {{BASEPAGENAME}}
9344 !! options
9345 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9346 !! wikitext
9347 {{BASEPAGENAME}}
9348 !! html
9349 <p>Ævar Arnfjörð Bjarmason
9350 </p>
9351 !! end
9352
9353 !! test
9354 Magic Word: {{BASEPAGENAMEE}}
9355 !! options
9356 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9357 !! wikitext
9358 {{BASEPAGENAMEE}}
9359 !! html
9360 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9361 </p>
9362 !! end
9363
9364 !! test
9365 Magic Word: {{TALKPAGENAME}}
9366 !! options
9367 title=[[User:Ævar Arnfjörð Bjarmason]]
9368 !! wikitext
9369 {{TALKPAGENAME}}
9370 !! html
9371 <p>User talk:Ævar Arnfjörð Bjarmason
9372 </p>
9373 !! end
9374
9375 !! test
9376 Magic Word: {{TALKPAGENAMEE}}
9377 !! options
9378 title=[[User:Ævar Arnfjörð Bjarmason]]
9379 !! wikitext
9380 {{TALKPAGENAMEE}}
9381 !! html
9382 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9383 </p>
9384 !! end
9385
9386 !! test
9387 Magic Word: {{SUBJECTPAGENAME}}
9388 !! options
9389 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9390 !! wikitext
9391 {{SUBJECTPAGENAME}}
9392 !! html
9393 <p>User:Ævar Arnfjörð Bjarmason
9394 </p>
9395 !! end
9396
9397 !! test
9398 Magic Word: {{SUBJECTPAGENAMEE}}
9399 !! options
9400 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9401 !! wikitext
9402 {{SUBJECTPAGENAMEE}}
9403 !! html
9404 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9405 </p>
9406 !! end
9407
9408 !! test
9409 Magic Word: {{NUMBEROFFILES}}
9410 !! wikitext
9411 {{NUMBEROFFILES}}
9412 !! html
9413 <p>5
9414 </p>
9415 !! end
9416
9417 !! test
9418 Magic Word: {{PAGENAME}}
9419 !! options
9420 title=[[User:Ævar Arnfjörð Bjarmason]]
9421 !! wikitext
9422 {{PAGENAME}}
9423 !! html
9424 <p>Ævar Arnfjörð Bjarmason
9425 </p>
9426 !! end
9427
9428 !! test
9429 Magic Word: {{PAGENAME}} with metacharacters
9430 !! options
9431 title=[['foo & bar = baz']]
9432 !! wikitext
9433 ''{{PAGENAME}}''
9434 !! html/php
9435 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9436 </p>
9437 !! html+tidy
9438 <p><i>'foo &amp; bar = baz'</i></p>
9439 !! end
9440
9441 !! test
9442 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9443 !! options
9444 title=[[*RFC 1234 http://example.com/]]
9445 !! wikitext
9446 {{PAGENAME}}
9447 !! html/php
9448 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9449 </p>
9450 !! html+tidy
9451 <p>*RFC 1234 http://example.com/</p>
9452 !! end
9453
9454 !! test
9455 Magic Word: {{PAGENAMEE}}
9456 !! options
9457 title=[[User:Ævar Arnfjörð Bjarmason]]
9458 !! wikitext
9459 {{PAGENAMEE}}
9460 !! html
9461 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9462 </p>
9463 !! end
9464
9465 !! test
9466 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9467 !! options
9468 title=[[*RFC 1234 http://example.com/]]
9469 !! wikitext
9470 {{PAGENAMEE}}
9471 !! html/php
9472 <p>&#42;RFC_1234_http&#58;//example.com/
9473 </p>
9474 !! html+tidy
9475 <p>*RFC_1234_http://example.com/</p>
9476 !! end
9477
9478 !! test
9479 Magic Word: {{REVISIONID}}
9480 !! wikitext
9481 {{REVISIONID}}
9482 !! html
9483 <p>1337
9484 </p>
9485 !! end
9486
9487 !! test
9488 Magic Word: {{SCRIPTPATH}}
9489 !! wikitext
9490 {{SCRIPTPATH}}
9491 !! html
9492 <p>/
9493 </p>
9494 !! end
9495
9496 !! test
9497 Magic Word: {{STYLEPATH}}
9498 !! wikitext
9499 {{STYLEPATH}}
9500 !! html
9501 <p>/skins
9502 </p>
9503 !! end
9504
9505 !! test
9506 Magic Word: {{SERVER}}
9507 !! wikitext
9508 {{SERVER}}
9509 !! html
9510 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9511 </p>
9512 !! end
9513
9514 !! test
9515 Magic Word: {{SERVERNAME}}
9516 !! wikitext
9517 {{SERVERNAME}}
9518 !! html
9519 <p>example.org
9520 </p>
9521 !! end
9522
9523 !! test
9524 Magic Word: {{SITENAME}}
9525 !! wikitext
9526 {{SITENAME}}
9527 !! html
9528 <p>MediaWiki
9529 </p>
9530 !! end
9531
9532 !! test
9533 Case-sensitive magic words, when cased differently, should just be template transclusions
9534 !! wikitext
9535 {{CurrentMonth}}
9536 {{currentday}}
9537 {{cURreNTweEK}}
9538 {{currentHour}}
9539 !! html
9540 <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>
9541 <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>
9542 <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>
9543 <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>
9544 </p>
9545 !! end
9546
9547 !! test
9548 Case-insensitive magic words should still work with weird casing.
9549 !! wikitext
9550 {{sErVeRNaMe}}
9551 {{LCFirst:AOEU}}
9552 {{ucFIRST:aoeu}}
9553 {{SERver}}
9554 !! html
9555 <p>example.org
9556 aOEU
9557 Aoeu
9558 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9559 </p>
9560 !! end
9561
9562 # From plwiki:PLOS_ONE
9563 !! test
9564 Parsoid: Page property magic word with magic word contents
9565 !! wikitext
9566 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9567 !! html/parsoid
9568 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=\"{&amp;quot;dsr&amp;quot;:[15,31,2,2]}\">&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[17,29,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;PAGENAME&amp;quot;,&amp;quot;function&amp;quot;:&amp;quot;pagename&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">Main Page&lt;/span>&lt;/i>"}]]}'/>
9569 !! end
9570
9571 !! test
9572 Parsoid: Template-generated DISPLAYTITLE
9573 !! wikitext
9574 {{{{echo|DISPLAYTITLE}}:Foo}}
9575 !! html/parsoid
9576 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,29,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/>
9577 !! end
9578
9579 !! test
9580 Namespace 1 {{ns:1}}
9581 !! wikitext
9582 {{ns:1}}
9583 !! html
9584 <p>Talk
9585 </p>
9586 !! end
9587
9588 !! test
9589 Namespace 1 {{ns:01}}
9590 !! wikitext
9591 {{ns:01}}
9592 !! html
9593 <p>Talk
9594 </p>
9595 !! end
9596
9597 !! test
9598 Namespace 0 {{ns:0}} (bug 4783)
9599 !! wikitext
9600 {{ns:0}}
9601 !! html
9602
9603 !! end
9604
9605 !! test
9606 Namespace 0 {{ns:00}} (bug 4783)
9607 !! wikitext
9608 {{ns:00}}
9609 !! html
9610
9611 !! end
9612
9613 !! test
9614 Namespace -1 {{ns:-1}}
9615 !! wikitext
9616 {{ns:-1}}
9617 !! html
9618 <p>Special
9619 </p>
9620 !! end
9621
9622 !! test
9623 Namespace User {{ns:User}}
9624 !! wikitext
9625 {{ns:User}}
9626 !! html
9627 <p>User
9628 </p>
9629 !! end
9630
9631 !! test
9632 Namespace User talk {{ns:User_talk}}
9633 !! wikitext
9634 {{ns:User_talk}}
9635 !! html
9636 <p>User talk
9637 </p>
9638 !! end
9639
9640 !! test
9641 Namespace User talk {{ns:uSeR tAlK}}
9642 !! wikitext
9643 {{ns:uSeR tAlK}}
9644 !! html
9645 <p>User talk
9646 </p>
9647 !! end
9648
9649 !! test
9650 Namespace File {{ns:File}}
9651 !! wikitext
9652 {{ns:File}}
9653 !! html
9654 <p>File
9655 </p>
9656 !! end
9657
9658 !! test
9659 Namespace File {{ns:Image}}
9660 !! wikitext
9661 {{ns:Image}}
9662 !! html
9663 <p>File
9664 </p>
9665 !! end
9666
9667 !! test
9668 Namespace (lang=de) Benutzer {{ns:User}}
9669 !! options
9670 language=de
9671 !! wikitext
9672 {{ns:User}}
9673 !! html
9674 <p>Benutzer
9675 </p>
9676 !! end
9677
9678 !! test
9679 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9680 !! options
9681 language=de
9682 !! wikitext
9683 {{ns:3}}
9684 !! html
9685 <p>Benutzer Diskussion
9686 </p>
9687 !! end
9688
9689
9690 !! test
9691 Urlencode
9692 !! wikitext
9693 {{urlencode:hi world?!}}
9694 {{urlencode:hi world?!|WIKI}}
9695 {{urlencode:hi world?!|PATH}}
9696 {{urlencode:hi world?!|QUERY}}
9697 !! html
9698 <p>hi+world%3F%21
9699 hi_world%3F!
9700 hi%20world%3F%21
9701 hi+world%3F%21
9702 </p>
9703 !! end
9704
9705 !! test
9706 Magic Word: prioritize type info over data-parsoid
9707 !! options
9708 parsoid=html2wt
9709 !! html/parsoid
9710 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9711 !! wikitext
9712 __FORCETOC__
9713 !! end
9714
9715 !! test
9716 Magic Word: serialize on separate line (parsoid)
9717 !! options
9718 parsoid=wt2wt,html2wt
9719 !! wikitext
9720 foo
9721 __NOTOC__
9722 bar
9723 !! html
9724 foo<meta property="mw:PageProp/notoc"/>bar
9725 !! end
9726
9727 !! test
9728 Magic Word: rt non-english wikis
9729 !! options
9730 parsoid=wt2wt
9731 language=de
9732 !! wikitext
9733 __NOEDITSECTION__
9734 !! html
9735 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9736 !! end
9737
9738 !!test
9739 __proto__ is treated as normal wikitext (T105997)
9740 !!wikitext
9741 __proto__
9742 !!html
9743 <p>__proto__
9744 </p>
9745 !!end
9746
9747 ###
9748 ### Magic links
9749 ###
9750 !! test
9751 Magic links: internal link to RFC (bug 479)
9752 !! wikitext
9753 [[RFC 123]]
9754 !! html
9755 <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>
9756 </p>
9757 !! end
9758
9759 !! test
9760 Magic links: RFC (bug 479)
9761 !! wikitext
9762 RFC 822
9763 !! html
9764 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9765 </p>
9766 !! end
9767
9768 !! test
9769 Magic links: RFC (bug 65278)
9770 !! wikitext
9771 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9772 !! html
9773 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
9774 </p>
9775 !! end
9776
9777 !! test
9778 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9779 !! wikitext
9780 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9781 RFC
9782 822
9783 !! html
9784 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9785 RFC
9786 822
9787 </p>
9788 !! end
9789
9790 !! test
9791 Magic links: ISBN (bug 1937)
9792 !! wikitext
9793 ISBN 0-306-40615-2
9794 !! html
9795 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
9796 </p>
9797 !! end
9798
9799 !! test
9800 Magic links: ISBN (bug 65278)
9801 !! wikitext
9802 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9803 !! html/php
9804 <p>This is <a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9805 </p>
9806 !! html/parsoid
9807 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:ExtLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
9808 !! end
9809
9810 !! test
9811 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
9812 !! wikitext
9813 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
9814 ISBN
9815 9780316098113
9816 ISBN 978
9817 0316098113
9818 !! html
9819 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
9820 ISBN
9821 9780316098113
9822 ISBN 978
9823 0316098113
9824 </p>
9825 !! end
9826
9827 !! test
9828 Magic links: PMID incorrectly converts space to underscore
9829 !! wikitext
9830 PMID 1234
9831 !! html
9832 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9833 </p>
9834 !! end
9835
9836 !! test
9837 Magic links: PMID (bug 65278)
9838 !! wikitext
9839 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
9840 !! html
9841 <p>This is <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.
9842 </p>
9843 !! end
9844
9845 !! test
9846 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
9847 !! wikitext
9848 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
9849 PMID
9850 1234
9851 !! html
9852 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9853 PMID
9854 1234
9855 </p>
9856 !! end
9857
9858 ###
9859 ### Templates
9860 ####
9861
9862 !! test
9863 Nonexistent template
9864 !! wikitext
9865 {{thistemplatedoesnotexist}}
9866 !! html
9867 <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>
9868 </p>
9869 !! end
9870
9871 !! test
9872 Template with invalid target containing tags
9873 !! wikitext
9874 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9875 !! html
9876 <p>{{a<b>b</b>|foo|a=b|a = b}}
9877 </p>
9878 !! end
9879
9880 !! test
9881 Template with invalid target containing unclosed tag
9882 !! wikitext
9883 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9884 !! html
9885 <p>{{a<b>|foo|a=b|a = b}}</b>
9886 </p>
9887 !! end
9888
9889 !! test
9890 Template with invalid target containing wikilink
9891 !! wikitext
9892 {{[[Main Page]]}}
9893 !! html/php
9894 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
9895 </p>
9896 !! html/parsoid
9897 <p><span typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"[[Main Page]]"},"params":{},"i":0}}]}'>{{</span><a rel="mw:WikiLink" href="./Main_Page" about="#mwt1">Main Page</a><span about="#mwt1">}}</span></p>
9898 !! end
9899
9900 !! test
9901 Template with just whitespace in it, bug #68421
9902 !! wikitext
9903 {{echo|{{ }}}}
9904 !! html/parsoid
9905 <p><span typeof="mw:Transclusion mw:Nowiki" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</span></p>
9906 !! end
9907
9908 !! article
9909 Template:test
9910 !! text
9911 This is a test template
9912 !! endarticle
9913
9914 !! test
9915 Simple template
9916 !! wikitext
9917 {{test}}
9918 !! html
9919 <p>This is a test template
9920 </p>
9921 !! end
9922
9923 !! test
9924 Template with explicit namespace
9925 !! wikitext
9926 {{Template:test}}
9927 !! html
9928 <p>This is a test template
9929 </p>
9930 !! end
9931
9932
9933 !! article
9934 Template:paramtest
9935 !! text
9936 This is a test template with parameter {{{param}}}
9937 !! endarticle
9938
9939 !! test
9940 Template parameter
9941 !! wikitext
9942 {{paramtest|param=foo}}
9943 !! html
9944 <p>This is a test template with parameter foo
9945 </p>
9946 !! end
9947
9948 !! article
9949 Template:paramtestnum
9950 !! text
9951 [[{{{1}}}|{{{2}}}]]
9952 !! endarticle
9953
9954 !! test
9955 Template unnamed parameter
9956 !! wikitext
9957 {{paramtestnum|Main Page|the main page}}
9958 !! html
9959 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
9960 </p>
9961 !! end
9962
9963 !! article
9964 Template:templatesimple
9965 !! text
9966 (test)
9967 !! endarticle
9968
9969 !! article
9970 Template:templateredirect
9971 !! text
9972 #redirect [[Template:templatesimple]]
9973 !! endarticle
9974
9975 !! article
9976 Template:templateasargtestnum
9977 !! text
9978 {{{{{1}}}}}
9979 !! endarticle
9980
9981 !! article
9982 Template:templateasargtest
9983 !! text
9984 {{template{{{templ}}}}}
9985 !! endarticle
9986
9987 !! article
9988 Template:templateasargtest2
9989 !! text
9990 {{{{{templ}}}}}
9991 !! endarticle
9992
9993 !! test
9994 Template with template name as unnamed argument
9995 !! wikitext
9996 {{templateasargtestnum|templatesimple}}
9997 !! html
9998 <p>(test)
9999 </p>
10000 !! end
10001
10002 !! test
10003 Template with template name as argument
10004 !! wikitext
10005 {{templateasargtest|templ=simple}}
10006 !! html
10007 <p>(test)
10008 </p>
10009 !! end
10010
10011 !! test
10012 Template with template name as argument (2)
10013 !! wikitext
10014 {{templateasargtest2|templ=templatesimple}}
10015 !! html
10016 <p>(test)
10017 </p>
10018 !! end
10019
10020 !! article
10021 Template:templateasargtestdefault
10022 !! text
10023 {{{{{templ|templatesimple}}}}}
10024 !! endarticle
10025
10026 !! article
10027 Template:templa
10028 !! text
10029 '''templ'''
10030 !! endarticle
10031
10032 !! test
10033 Template with default value
10034 !! wikitext
10035 {{templateasargtestdefault}}
10036 !! html
10037 <p>(test)
10038 </p>
10039 !! end
10040
10041 !! test
10042 Template with default value (value set)
10043 !! wikitext
10044 {{templateasargtestdefault|templ=templa}}
10045 !! html
10046 <p><b>templ</b>
10047 </p>
10048 !! end
10049
10050 !! test
10051 Template redirect
10052 !! wikitext
10053 {{templateredirect}}
10054 !! html/php
10055 <p>(test)
10056 </p>
10057 !! html/parsoid
10058 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10059 !! end
10060
10061 !! test
10062 Template with argument in separate line
10063 !! wikitext
10064 {{ templateasargtest |
10065 templ = simple }}
10066 !! html
10067 <p>(test)
10068 </p>
10069 !! end
10070
10071 !! test
10072 Template with complex template as argument
10073 !! wikitext
10074 {{paramtest|
10075 param ={{ templateasargtest |
10076 templ = simple }}}}
10077 !! html
10078 <p>This is a test template with parameter (test)
10079 </p>
10080 !! end
10081
10082 !! test
10083 Template with thumb image (with link in description)
10084 !! wikitext
10085 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10086 !! html/php
10087 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>
10088
10089 !! html+tidy
10090 <p>This is a test template with parameter</p>
10091 <div class="thumb tright">
10092 <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>
10093 <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>
10094 </div>
10095 </div>
10096 !! html/parsoid
10097 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
10098 !! end
10099
10100 !! article
10101 Template:complextemplate
10102 !! text
10103 {{{1}}} {{paramtest|
10104 param ={{{param}}}}}
10105 !! endarticle
10106
10107 !! test
10108 Template with complex arguments
10109 !! wikitext
10110 {{complextemplate|
10111 param ={{ templateasargtest |
10112 templ = simple }}|[[Template:complextemplate|link]]}}
10113 !! html
10114 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10115 </p>
10116 !! end
10117
10118 !! test
10119 BUG 553: link with two variables in a piped link
10120 !! wikitext
10121 {|
10122 |[[{{{1}}}|{{{2}}}]]
10123 |}
10124 !! html
10125 <table>
10126 <tr>
10127 <td>[[{{{1}}}|{{{2}}}]]
10128 </td></tr></table>
10129
10130 !! end
10131
10132 !! test
10133 Magic variable as template parameter
10134 !! wikitext
10135 {{paramtest|param={{SITENAME}}}}
10136 !! html
10137 <p>This is a test template with parameter MediaWiki
10138 </p>
10139 !! end
10140
10141 !! article
10142 Template:linktest
10143 !! text
10144 [[{{{param}}}|link]]
10145 !! endarticle
10146
10147 !! test
10148 Template parameter as link source
10149 !! wikitext
10150 {{linktest|param=Main Page}}
10151 !! html
10152 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10153 </p>
10154 !! end
10155
10156 !!article
10157 Template:paramtest2
10158 !! text
10159 including another template, {{paramtest|param={{{arg}}}}}
10160 !! endarticle
10161
10162 !! test
10163 Template passing argument to another template
10164 !! wikitext
10165 {{paramtest2|arg='hmm'}}
10166 !! html
10167 <p>including another template, This is a test template with parameter 'hmm'
10168 </p>
10169 !! end
10170
10171 !! article
10172 Template:Linktest2
10173 !! text
10174 Main Page
10175 !! endarticle
10176
10177 !! test
10178 Template as link source
10179 !! wikitext
10180 [[{{linktest2}}]]
10181
10182 [[{{linktest2}}|Main Page]]
10183
10184 [[{{linktest2}}]]Page
10185 !! html
10186 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10187 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10188 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10189 </p>
10190 !! end
10191
10192
10193 !! article
10194 Template:loop1
10195 !! text
10196 {{loop2}}
10197 !! endarticle
10198
10199 !! article
10200 Template:loop2
10201 !! text
10202 {{loop1}}
10203 !! endarticle
10204
10205 !! test
10206 Template infinite loop
10207 !! wikitext
10208 {{loop1}}
10209 !! html
10210 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10211 </p>
10212 !! end
10213
10214 !! test
10215 Template from main namespace
10216 !! wikitext
10217 {{:Main Page}}
10218 !! html
10219 <p>blah blah
10220 </p>
10221 !! end
10222
10223 !! article
10224 Template:table
10225 !! text
10226 {|
10227 | 1 || 2
10228 |-
10229 | 3 || 4
10230 |}
10231 !! endarticle
10232
10233 !! test
10234 BUG 529: Template with table, not included at beginning of line
10235 !! wikitext
10236 foo {{table}}
10237 !! html
10238 <p>foo
10239 </p>
10240 <table>
10241 <tr>
10242 <td> 1 </td>
10243 <td> 2
10244 </td></tr>
10245 <tr>
10246 <td> 3 </td>
10247 <td> 4
10248 </td></tr></table>
10249
10250 !! end
10251
10252 !! test
10253 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10254 !! wikitext
10255 foo
10256 {{table}}
10257 !! html
10258 <p>foo
10259 </p>
10260 <table>
10261 <tr>
10262 <td> 1 </td>
10263 <td> 2
10264 </td></tr>
10265 <tr>
10266 <td> 3 </td>
10267 <td> 4
10268 </td></tr></table>
10269
10270 !! end
10271
10272 !! test
10273 BUG 41: Template parameters shown as broken links
10274 !! wikitext
10275 {{{parameter}}}
10276 !! html
10277 <p>{{{parameter}}}
10278 </p>
10279 !! end
10280
10281 !! test
10282 Template with targets containing wikilinks
10283 !! wikitext
10284 {{[[foo]]}}
10285
10286 {{[[{{echo|foo}}]]}}
10287
10288 {{{{echo|[[foo}}]]}}
10289 !! html
10290 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10291 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10292 </p><p>{{[[foo}}]]
10293 </p>
10294 !! end
10295
10296 !! article
10297 Template:''
10298 !! text
10299 bar
10300 !! endarticle
10301
10302 !! test
10303 Templates: Double quotes as template target
10304 !! wikitext
10305 foo {{''}} baz
10306 !! html/php
10307 <p>foo bar baz
10308 </p>
10309 !! html/parsoid
10310 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10311 </p>
10312 !! end
10313
10314 !! article
10315 Template:MSGNW test
10316 !! text
10317 ''None'' of '''this''' should be
10318 * interpreted
10319 but rather passed unmodified
10320 {{test}}
10321 <gallery>
10322 File:Foobar.jpg
10323 </gallery>
10324 <!-- comment -->
10325 !! endarticle
10326
10327 # hmm, fix this or just deprecate msgnw and document its behavior?
10328 !! test
10329 msgnw keyword
10330 !! wikitext
10331 {{msgnw:MSGNW test}}
10332 !! html/php
10333 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10334 &#42; interpreted
10335 &#32;but rather passed unmodified
10336 &#123;&#123;test&#125;&#125;
10337 &#60;gallery&#62;
10338 File:Foobar.jpg
10339 &#60;/gallery&#62;
10340 &#60;!-- comment --&#62;
10341 </p>
10342 !! end
10343
10344 !! test
10345 int keyword
10346 !! wikitext
10347 {{int:youhavenewmessages|lots of money|not!}}
10348 !! html
10349 <p>You have lots of money (not!).
10350 </p>
10351 !! end
10352
10353 !! article
10354 Template:Includes
10355 !! text
10356 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10357 !! endarticle
10358
10359 !! test
10360 <includeonly> and <noinclude> being included
10361 !! wikitext
10362 {{Includes}}
10363 !! html
10364 <p>Foobar
10365 </p>
10366 !! end
10367
10368 !! article
10369 Template:Includes2
10370 !! text
10371 <onlyinclude>Foo</onlyinclude>bar
10372 !! endarticle
10373
10374 !! test
10375 <onlyinclude> being included
10376 !! wikitext
10377 {{Includes2}}
10378 !! html
10379 <p>Foo
10380 </p>
10381 !! end
10382
10383
10384 !! article
10385 Template:Includes3
10386 !! text
10387 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10388 !! endarticle
10389
10390 !! test
10391 <onlyinclude> and <includeonly> being included
10392 !! wikitext
10393 {{Includes3}}
10394 !! html
10395 <p>Foo
10396 </p>
10397 !! end
10398
10399 !! test
10400 <includeonly> and <noinclude> on a page
10401 !! wikitext
10402 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10403 !! html
10404 <p>Foozar
10405 </p>
10406 !! end
10407
10408 !! test
10409 Un-closed <noinclude>
10410 !! wikitext
10411 <noinclude>
10412 !! html
10413 !! end
10414
10415 !! test
10416 <onlyinclude> on a page
10417 !! wikitext
10418 <onlyinclude>Foo</onlyinclude>bar
10419 !! html
10420 <p>Foobar
10421 </p>
10422 !! end
10423
10424 !! test
10425 Un-closed <onlyinclude>
10426 !! wikitext
10427 <onlyinclude>
10428 !! html
10429 !! end
10430
10431 !!test
10432 Self-closed noinclude, includeonly, onlyinclude tags
10433 !! wikitext
10434 <noinclude />
10435 <includeonly />
10436 <onlyinclude />
10437 !! html
10438 <p><br />
10439 </p>
10440 !!end
10441
10442 !!test
10443 Unbalanced includeonly and noinclude tags
10444 !! wikitext
10445 {|
10446 |a</noinclude>
10447 |b</noinclude></noinclude>
10448 |c</noinclude></includeonly>
10449 |d</includeonly></includeonly>
10450 |}
10451 !! html
10452 <table>
10453 <tr>
10454 <td>a
10455 </td>
10456 <td>b
10457 </td>
10458 <td>c&lt;/includeonly&gt;
10459 </td>
10460 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10461 </td></tr></table>
10462
10463 !!end
10464
10465 !! article
10466 Template:Includeonly section
10467 !! text
10468 <includeonly>
10469 ==Includeonly section==
10470 </includeonly>
10471 ==Section T-1==
10472 !!endarticle
10473
10474 !! test
10475 Bug 6563: Edit link generation for section shown by <includeonly>
10476 !! wikitext
10477 {{includeonly section}}
10478 !! html
10479 <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>
10480 <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>
10481
10482 !! end
10483
10484 # Uses same input as the contents of [[Template:Includeonly section]]
10485 !! test
10486 Bug 6563: Section extraction for section shown by <includeonly>
10487 !! options
10488 section=T-2
10489 !! wikitext
10490 <includeonly>
10491 ==Includeonly section==
10492 </includeonly>
10493 ==Section T-2==
10494 !! html
10495 ==Section T-2==
10496 !! end
10497
10498 !! test
10499 Bug 6563: Edit link generation for section suppressed by <includeonly>
10500 !! wikitext
10501 <includeonly>
10502 ==Includeonly section==
10503 </includeonly>
10504 ==Section 1==
10505 !! html
10506 <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>
10507
10508 !! end
10509
10510 !! test
10511 Bug 6563: Section extraction for section suppressed by <includeonly>
10512 !! options
10513 section=1
10514 !! wikitext
10515 <includeonly>
10516 ==Includeonly section==
10517 </includeonly>
10518 ==Section 1==
10519 !! html
10520 ==Section 1==
10521 !! end
10522
10523 !! test
10524 Un-closed <includeonly>
10525 !! wikitext
10526 <includeonly>
10527 !! html
10528 !! end
10529
10530 !! test
10531 Includes and comments at SOL
10532 !! wikitext
10533 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10534
10535 <noinclude>
10536 some
10537 </noinclude>* stuff
10538 * here
10539
10540 <includeonly>can have stuff</includeonly>=== here ===
10541
10542 !! html/php
10543 <h2><span class="mw-headline" id="hu">hu</span></h2>
10544 <p>some
10545 </p>
10546 <ul><li> stuff</li>
10547 <li> here</li></ul>
10548 <h3><span class="mw-headline" id="here">here</span></h3>
10549
10550 !! html/parsoid
10551 <!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><!-- comment --><h2> hu </h2>
10552
10553 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10554 <p>some</p>
10555 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10556 <li> here</li></ul>
10557
10558 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h3> here </h3>
10559
10560 !! end
10561
10562 # TODO: test with DOM fragment reuse!
10563 !! test
10564 Parsoid: DOM fragment reuse
10565 !! options
10566 parsoid=wt2wt,wt2html
10567 !! wikitext
10568 a{{echo|b<table></table>c}}d
10569
10570 a{{echo|b
10571 <table></table>
10572 c}}d
10573
10574 {{echo|a
10575
10576 <table></table>
10577
10578 b}}
10579 !! html
10580 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b&lt;table>&lt;/table>c"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
10581
10582 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n&lt;table>&lt;/table>\nc"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>ab</p><span about="#mwt2">
10583 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10584 </span><p about="#mwt2">cd</p>
10585
10586 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n&lt;table>&lt;/table>\n\nb"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>a</p><span about="#mwt3">
10587
10588 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10589
10590 </span><p about="#mwt3">b</p>
10591 !! end
10592
10593 !! test
10594 Parsoid: Merge double tds (bug 50603)
10595 !! options
10596 parsoid
10597 !! wikitext
10598 {|
10599 |{{echo|{{!}} foo}}
10600 |}
10601 !! html
10602 <table><tbody>
10603 <tr><td about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":0}}]}'> foo</td></tr>
10604 </tbody></table>
10605 !! end
10606
10607 !! test
10608 Parsoid: Merge double tds in nested transclusion content (bug 50603)
10609 !! options
10610 parsoid
10611 !! wikitext
10612 {{echo|<div>}}
10613 {|
10614 |{{echo|{{!}} foo}}
10615 |}
10616 {{echo|</div>}}
10617 !! html
10618 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<div>"}},"i":0}},"\n{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":1}},"\n|}\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"</div>"}},"i":2}}]}'>
10619 <table><tbody>
10620 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10621 </tbody></table>
10622 </div>
10623 !! end
10624
10625 ###
10626 ### <includeonly> and <noinclude> in attributes
10627 ###
10628 !!test
10629 0. includeonly around the entire attribute
10630 !! wikitext
10631 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10632 !! html
10633 <p><span id="v2">bar</span>
10634 </p>
10635 !!end
10636
10637 !!test
10638 1. includeonly in html attr key
10639 !! wikitext
10640 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10641 !! html
10642 <p><span id="foo">bar</span>
10643 </p>
10644 !!end
10645
10646 !!test
10647 2. includeonly in html attr value
10648 !! wikitext
10649 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
10650 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
10651 !! html
10652 <p><span id="v1">bar</span>
10653 <span id="v1">bar</span>
10654 </p>
10655 !!end
10656
10657 !!test
10658 3. includeonly in part of an attr value
10659 !! wikitext
10660 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
10661 !! html
10662 <p><span style="color:red;">bar</span>
10663 </p>
10664 !!end
10665
10666 !!test
10667 4. includeonly in table attributes
10668 !! wikitext
10669 {|
10670 |- <noinclude>
10671 |-
10672 |a
10673 </noinclude>
10674 |- <includeonly>
10675 |-
10676 |b
10677 </includeonly>
10678 |}
10679 !! html
10680 <table>
10681
10682
10683 <tr>
10684 <td>a
10685 </td></tr>
10686 </table>
10687
10688 !!end
10689
10690 ###
10691 ### Token Stream Patcher tests
10692 ###
10693 ### These tests won't always pass wt2wt and other modes because
10694 ### on serialization, the table will be output on a new line.
10695 ### For now, we are blacklisting them, and using this to test selser.
10696 ###
10697
10698 !!test
10699 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
10700 !!options
10701 parsoid=wt2html,wt2wt
10702 !!wikitext
10703 {{echo|}}{| width = '100%'
10704 |foo
10705 |}
10706 !!html/parsoid
10707 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10708 <tbody><tr><td>foo</td></tr>
10709 </tbody></table>
10710 !!end
10711
10712 !!test
10713 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10714 !!options
10715 parsoid=wt2html,wt2wt
10716 !!wikitext
10717 <includeonly>a</includeonly>{| {{{b}}}
10718 |c
10719 |}
10720 !!html/parsoid
10721 <meta typeof="mw:Includes/IncludeOnly"/><meta typeof="mw:Includes/IncludeOnly/End"/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[31,38,null,null],&amp;quot;src&amp;quot;:&amp;quot;{{{b}}}&amp;quot;}\">{{{b}}}&lt;/span>"},{"html":""}]]}' data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}'>
10722 <tbody><tr><td>c</td></tr>
10723 </tbody></table>
10724
10725 !!end
10726
10727 ###
10728 ### Testing parsing of templates where a template arg
10729 ### has the same name as the template itself.
10730 ###
10731
10732 !! article
10733 Template:quote
10734 !! text
10735 {{{quote|{{{1}}}}}}
10736 !! endarticle
10737
10738 !!test
10739 Templates: Template Name/Arg clash: 1. Use of positional param
10740 !! wikitext
10741 {{quote|foo}}
10742 !! html
10743 <p>foo
10744 </p>
10745 !!end
10746
10747 !!test
10748 Templates: Template Name/Arg clash: 2. Use of named param
10749 !! wikitext
10750 {{quote|quote=foo}}
10751 !! html
10752 <p>foo
10753 </p>
10754 !!end
10755
10756 !!test
10757 Templates: Template Name/Arg clash: 3. Use of named param with empty input
10758 !! wikitext
10759 {{quote|quote}}
10760 !! html
10761 <p>quote
10762 </p>
10763 !!end
10764
10765 ###
10766 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
10767 ###
10768
10769 !!test
10770 Templates: 1. Simple use
10771 !! wikitext
10772 {{echo|Foo}}
10773 !! html
10774 <p>Foo
10775 </p>
10776 !!end
10777
10778 !!test
10779 Templates: 2. Inside a block tag
10780 !! wikitext
10781 <div>{{echo|Foo}}</div>
10782 <blockquote>{{echo|Foo}}</blockquote>
10783 !! html
10784 <div>Foo</div>
10785 <blockquote>Foo</blockquote>
10786
10787 !! html+tidy
10788 <div>Foo</div>
10789 <blockquote>
10790 <p>Foo</p>
10791 </blockquote>
10792 !!end
10793
10794 !!test
10795 Templates: P-wrapping: 1a. Templates on consecutive lines
10796 !! wikitext
10797 {{echo|Foo}}
10798 {{echo|bar}}
10799 !! html
10800 <p>Foo
10801 bar
10802 </p>
10803 !!end
10804
10805 !!test
10806 Templates: P-wrapping: 1b. Templates on consecutive lines
10807 !! wikitext
10808 Foo
10809
10810 {{echo|bar}}
10811 {{echo|baz}}
10812 !! html
10813 <p>Foo
10814 </p><p>bar
10815 baz
10816 </p>
10817 !!end
10818
10819 !!test
10820 Templates: P-wrapping: 1c. Templates on consecutive lines
10821 !! wikitext
10822 {{echo|Foo}}
10823 {{echo|bar}} <div>baz</div>
10824 !! html
10825 <p>Foo
10826 </p>
10827 bar <div>baz</div>
10828
10829 !! html+tidy
10830 <p>Foo</p>
10831 <p>bar</p>
10832 <div>baz</div>
10833 !! end
10834
10835 !!test
10836 Templates: P-wrapping: 1d. Template preceded by comment-only line
10837 !!options
10838 parsoid
10839 !! wikitext
10840 <!-- foo -->
10841 {{echo|Bar}}
10842 !! html
10843 <!-- foo -->
10844
10845 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
10846 !!end
10847
10848 !!test
10849 Templates: Inline Text: 1. Multiple template uses
10850 !! wikitext
10851 {{echo|Foo}}bar{{echo|baz}}
10852 !! html
10853 <p>Foobarbaz
10854 </p>
10855 !!end
10856
10857 !!test
10858 Templates: Inline Text: 2. Back-to-back template uses
10859 !! wikitext
10860 {{echo|Foo}}{{echo|bar}}
10861 !! html
10862 <p>Foobar
10863 </p>
10864 !!end
10865
10866 !!test
10867 Templates: Block Tags: 1. Multiple template uses
10868 !! wikitext
10869 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
10870 !! html
10871 <div>Foo</div><div>bar</div><div>baz</div>
10872
10873 !!end
10874
10875 !!test
10876 Templates: Block Tags: 2. Back-to-back template uses
10877 !! wikitext
10878 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
10879 !! html
10880 <div>Foo</div><div>bar</div>
10881
10882 !!end
10883
10884 # This is an edge case relating to paragraph wrapping.
10885 !!test
10886 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
10887 !! wikitext
10888 {{echo|a
10889 b</p>}}
10890 !! html/parsoid
10891 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\nb&lt;/p>"}},"i":0}}]}'>a
10892 b</p>
10893 !!end
10894
10895 !!test
10896 Templates: Links: 1. Simple example
10897 !! wikitext
10898 {{echo|[[Foo|bar]]}}
10899 !! html
10900 <p><a href="/wiki/Foo" title="Foo">bar</a>
10901 </p>
10902 !!end
10903
10904 !!test
10905 Templates: Links: 2. Generation of link href
10906 !! wikitext
10907 [[{{echo|Foo}}|bar]]
10908 !! html
10909 <p><a href="/wiki/Foo" title="Foo">bar</a>
10910 </p>
10911 !!end
10912
10913 !!test
10914 Templates: Links: 3. Generation of part of a link href
10915 !! wikitext
10916 [[Fo{{echo|o}}|bar]]
10917
10918 [[Foo{{echo|bar}}]]
10919
10920 [[Foo{{echo|bar}}baz]]
10921
10922 [[Foo{{echo|bar}}|bar]]
10923
10924 [[:Foo{{echo|bar}}]]
10925
10926 [[:Foo{{echo|bar}}|bar]]
10927 !! html
10928 <p><a href="/wiki/Foo" title="Foo">bar</a>
10929 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10930 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
10931 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10932 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10933 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10934 </p>
10935 !!end
10936
10937 !!test
10938 Templates: Links: 4. Multiple templates generating link href
10939 !! wikitext
10940 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
10941 !! html
10942 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10943 </p>
10944 !!end
10945
10946 !!test
10947 Templates: Links: 5. Generation of link text
10948 !! wikitext
10949 [[Foo|{{echo|bar}}]]
10950 !! html
10951 <p><a href="/wiki/Foo" title="Foo">bar</a>
10952 </p>
10953 !!end
10954
10955 !!test
10956 Templates: Links: 5. Nested templates (only outermost template should be marked)
10957 !! wikitext
10958 {{echo|[[{{echo|Foo}}|bar]]}}
10959 !! html
10960 <p><a href="/wiki/Foo" title="Foo">bar</a>
10961 </p>
10962 !!end
10963
10964 !!test
10965 Templates: HTML Tag: 1. Generation of HTML attr. key
10966 !! wikitext
10967 <div {{echo|style}}="color:red;">foo</div>
10968 !! html
10969 <div style="color:red;">foo</div>
10970
10971 !!end
10972
10973 !!test
10974 Templates: HTML Tag: 2. Generation of HTML attr. value
10975 !! wikitext
10976 <div style={{echo|'color:red;'}}>foo</div>
10977 !! html
10978 <div style="color:red;">foo</div>
10979
10980 !!end
10981
10982 !!test
10983 Templates: HTML Tag: 3. Generation of HTML attr key and value
10984 !! wikitext
10985 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
10986 !! html
10987 <div style="color:red;">foo</div>
10988
10989 !!end
10990
10991 !!test
10992 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
10993 !! wikitext
10994 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
10995 !! html
10996 <div title="This is a long title with just one piece templated">foo</div>
10997
10998 !!end
10999
11000 !!test
11001 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11002 !! wikitext
11003 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11004 !! html
11005 <div title="This is a long title with just one piece templated">foo</div>
11006
11007 !!end
11008
11009 !!test
11010 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11011 !! wikitext
11012 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11013 !! html
11014 <div title="This is a long title with just one piece templated">foo</div>
11015
11016 !!end
11017
11018 # SSS FIXME: While it is great we added support for all this,
11019 # do we want to make this part of the spec? Maybe we want to
11020 # deprecate this kind of usage in the future?
11021 !!test
11022 Templates: HTML Tag: 7. Generation of partial attribute key string
11023 !! wikitext
11024 <div st{{echo|yle}}="color:red;">foo</div>
11025 !! html
11026 <div style="color:red;">foo</div>
11027
11028 !!end
11029
11030 !! test
11031 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11032 !! wikitext
11033 <div {{echo|1=id="v1"}}>bar</div>
11034 !! html
11035 <div id="v1">bar</div>
11036
11037 !!end
11038
11039 !! test
11040 Templates: HTML Tag: 9. Multiple template-generated attributes
11041 !! wikitext
11042 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11043 !! html
11044 <div id="v1" title="foo">bar</div>
11045
11046 !!end
11047
11048 !! test
11049 Templates: Support for templates generating attributes and content
11050 !! wikitext
11051 {| {{mixed_attr_content_template}}
11052 |-
11053 |bar
11054 |}
11055 !! html/php
11056 <table style="color:red;" title="T48811">
11057
11058 <tr>
11059 <td>foo
11060 </td></tr>
11061 <tr>
11062 <td>bar
11063 </td></tr></table>
11064
11065 !! html/parsoid
11066 <table style="color:red;" title="T48811" about="#mwt1" typeof="mw:Transclusion mw:ExpandedAttrs" data-mw='{"parts":["{| ",{"template":{"target":{"wt":"mixed_attr_content_template","href":"./Template:Mixed_attr_content_template"},"params":{},"i":0}},"\n|-\n|bar\n|}"]}'>
11067 <tbody><tr>
11068 <td>foo</td></tr>
11069 <tr>
11070 <td>bar</td></tr>
11071 </tbody></table>
11072 !!end
11073
11074 !! test
11075 1. Entities and nowikis inside templated attributes should be handled correctly
11076 !! wikitext
11077 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11078 !! html/php
11079 <div style="background:#f9f9f9;">foo</div>
11080
11081 !! html/parsoid
11082 <div style="background:#f9f9f9;" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html"}' data-mw='{"attribs":[[{"txt":"style","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[5,49,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&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;style{{=}}\\&amp;quot;background:&amp;amp;#35;f9f9f9;\\&amp;quot;&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">style&lt;/span>&lt;span typeof=\"mw:Nowiki\" about=\"#mwt1\" data-parsoid=\"{}\">=&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">\"background:&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;#35;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;#&amp;quot;}\">#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
11083 !! end
11084
11085 !! test
11086 2. Entities and nowikis inside templated attributes should be handled correctly
11087 !! wikitext
11088 {|
11089 |{{table_attribs_3}}
11090 |}
11091 !! html/php
11092 <table>
11093 <tr>
11094 <td style="background:#f9f9f9;">Foo
11095 </td></tr></table>
11096
11097 !! html/parsoid
11098 <table>
11099 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":0}}]}'>Foo</td></tr>
11100 </tbody></table>
11101 !! end
11102
11103 !! test
11104 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11105 !! wikitext
11106 {{tbl-start}}
11107 |{{table_attribs_3}}
11108 {{tbl-end}}
11109 !! html/php
11110 <table>
11111 <tr>
11112 <td style="background:#f9f9f9;">Foo
11113 </td></tr></table>
11114
11115 !! html/parsoid
11116 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":1}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":2}}]}'>
11117 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11118 </tbody></table>
11119 !! end
11120
11121 # T107622
11122 !! test
11123 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11124 !! wikitext
11125 {|
11126 | {{table_attribs_6}} hi
11127 |}
11128 !! html/php
11129 <table>
11130 <tr>
11131 <td style="background: red;"> hi
11132 </td></tr></table>
11133
11134 !! html/parsoid
11135 <table>
11136 <tbody><tr><td style="background: red;" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["| ",{"template":{"target":{"wt":"table_attribs_6","href":"./Template:Table_attribs_6"},"params":{},"i":0}}," hi"]}'> hi</td></tr>
11137 </tbody></table>
11138 !! end
11139
11140 !!test
11141 Templates: HTML Tables: 1. Generating start of a HTML table
11142 !! wikitext
11143 {{echo|<table><tr><td>foo</td>}}</tr></table>
11144 !! html
11145 <table><tr><td>foo</td></tr></table>
11146
11147 !!end
11148
11149 !!test
11150 Templates: HTML Tables: 2a. Generating middle of a HTML table
11151 !! wikitext
11152 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11153 !! html
11154 <table><tr><td>foo</td></tr></table>
11155
11156 !!end
11157
11158 !!test
11159 Templates: HTML Tables: 2b. Generating middle of a HTML table
11160 !! wikitext
11161 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11162 !! html
11163 <table><tr><td>foo</td></tr></table>
11164
11165 !!end
11166
11167 !!test
11168 Templates: HTML Tables: 3. Generating end of a HTML table
11169 !! wikitext
11170 <table><tr>{{echo|<td>foo</td></tr></table>}}
11171 !! html
11172 <table><tr><td>foo</td></tr></table>
11173
11174 !!end
11175
11176 !!test
11177 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11178 !! wikitext
11179 {{echo|<table>}}<tr><td>foo</td></tr></table>
11180 !! html
11181 <table><tr><td>foo</td></tr></table>
11182
11183 !!end
11184
11185 !!test
11186 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11187 !! wikitext
11188 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11189 !! html
11190 <table><tr><td>foo</td></tr></table>
11191
11192 !!end
11193
11194 !!test
11195 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11196 !! wikitext
11197 <table><tr>{{echo|<td>}}foo</td></tr></table>
11198 !! html
11199 <table><tr><td>foo</td></tr></table>
11200
11201 !!end
11202
11203 !!test
11204 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11205 !! wikitext
11206 <table><tr><td>foo{{echo|</td>}}</tr></table>
11207 !! html
11208 <table><tr><td>foo</td></tr></table>
11209
11210 !!end
11211
11212 !!test
11213 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11214 !! wikitext
11215 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11216 !! html
11217 <table><tr><td>foo</td></tr></table>
11218
11219 !!end
11220
11221 !!test
11222 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11223 !! wikitext
11224 <table><tr><td>foo</td></tr>{{echo|</table>}}
11225 !! html
11226 <table><tr><td>foo</td></tr></table>
11227
11228 !!end
11229
11230 !!test
11231 Templates: HTML Tables: 5. Proper fostering of categories from inside
11232 !!options
11233 parsoid=wt2html,wt2wt
11234 !! wikitext
11235 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11236 <!--Two categories (Bug 50330)-->
11237 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11238 !! html
11239 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11240 <!--Two categories (Bug 50330)-->
11241 <link rel="mw:PageProp/Category" href="./Category:Bar1"><link rel="mw:PageProp/Category" href="./Category:Bar2"><table><tbody><tr><td>foo</td></tr></tbody></table>
11242 !!end
11243
11244 !!test
11245 Templates: Wiki Tables: 1a. Fostering of entire template content
11246 !! wikitext
11247 {|
11248 {{echo|a}}
11249 |}
11250 !! html
11251 <table>
11252 a
11253 <tr><td></td></tr></table>
11254
11255 !! html+tidy
11256 <p>a</p>
11257 <table>
11258 <tr>
11259 <td></td>
11260 </tr>
11261 </table>
11262 !! end
11263
11264 !!test
11265 Templates: Wiki Tables: 1b. Fostering of entire template content
11266 !! wikitext
11267 {|
11268 {{echo|<div>}}
11269 foo
11270 {{echo|</div>}}
11271 |}
11272 !! html
11273 <table>
11274 <div>
11275 <p>foo
11276 </p>
11277 </div>
11278 <tr><td></td></tr></table>
11279
11280 !! html+tidy
11281 <div>
11282 <p>foo</p>
11283 </div>
11284 <table>
11285 <tr>
11286 <td></td>
11287 </tr>
11288 </table>
11289 !! end
11290
11291 !!test
11292 Templates: Wiki Tables: 2. Fostering of partial template content
11293 !! wikitext
11294 {|
11295 {{echo|a
11296 <div>b</div>}}
11297 |}
11298 !! html
11299 <table>
11300 a
11301 <div>b</div>
11302 <tr><td></td></tr></table>
11303
11304 !! html+tidy
11305 <p>a</p>
11306 <div>b</div>
11307 <table>
11308 <tr>
11309 <td></td>
11310 </tr>
11311 </table>
11312 !! end
11313
11314 !!test
11315 Templates: Wiki Tables: 3. td-content via multiple templates
11316 !! wikitext
11317 {|
11318 {{echo|{{pipe}}a}}{{echo|b}}
11319 |}
11320 !! html
11321 <table>
11322 <tr>
11323 <td>ab
11324 </td></tr></table>
11325
11326 !!end
11327
11328 !!test
11329 Templates: Wiki Tables: 4. Templated tags, no content
11330 !! wikitext
11331 {{tbl-start}}
11332 {{tbl-end}}
11333 !! html
11334 <table>
11335 <tr><td></td></tr></table>
11336
11337 !!end
11338
11339 !!test
11340 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11341 !! wikitext
11342 {{tbl-start}}
11343 |foo
11344 {{tbl-end}}
11345 !! html
11346 <table>
11347 <tr>
11348 <td>foo
11349 </td></tr></table>
11350
11351 !!end
11352
11353 !!test
11354 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11355 !! wikitext
11356 {{tbl-start}}
11357 {{!}}foo
11358 {{tbl-end}}
11359 !! html
11360 <table>
11361 <tr>
11362 <td>foo
11363 </td></tr></table>
11364
11365 !!end
11366
11367 ## This test case is very specific to Parsoid's internals
11368 ## and is hence only tested for Parsoid's code. Parsoid uses
11369 ## a <meta> marker tag for <ref> tags and they are expanded
11370 ## much later. We are verifying that this <meta> tag usage
11371 ## doesn't prevent foster parenting.
11372 !!test
11373 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11374 !!wikitext
11375 {{PartialTable}}<ref>foo</ref>
11376 |}
11377
11378 <references />
11379 !!html/parsoid
11380 <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"PartialTable","href":"./Template:PartialTable"},"params":{},"i":0}},"&lt;ref>foo&lt;/ref>\n|}"]}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span><table about="#mwt2">
11381 <tbody>
11382 </tbody></table>
11383
11384 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
11385 !!end
11386
11387 !! test
11388 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11389 !! wikitext
11390 {{echo|
11391 {{{!}}
11392 {{!}}-}}
11393 <onlyinclude>
11394 |foo
11395 </onlyinclude>
11396 {{!}}}
11397 !! html/parsoid
11398 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n{{{!}}\n{{!}}-"}},"i":0}},"\n&lt;onlyinclude>\n|foo\n&lt;/onlyinclude>\n{{!}}}"]}'>
11399 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11400 <tbody><tr>
11401
11402 <td>foo
11403 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11404 </tbody></table>
11405 !! end
11406
11407 !!test
11408 Templates: Lists: Multi-line list-items via templates
11409 !! wikitext
11410 *{{echo|a {{nonexistent|
11411 unused}}}}
11412 *{{echo|b {{nonexistent|
11413 unused}}}}
11414 !! html
11415 <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></li>
11416 <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></li></ul>
11417
11418 !!end
11419
11420 !!test
11421 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11422 !! wikitext
11423 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11424 !! html
11425 <p><i>ab</i>c<i>d</i>e
11426 </p>
11427 !!end
11428
11429 !!test
11430 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11431 (PHP parser generates misnested html)
11432 !! wikitext
11433 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11434 !! html/parsoid
11435 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></span><i about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}},{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:1}}]}"><span>b</span></i><span about="#mwt2">c</span><i about="#mwt2">d<span></span></i><span about="#mwt2">e</span></p>
11436 !!end
11437
11438 !!test
11439 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11440 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11441 !! options
11442 parsoid=wt2html,wt2wt
11443 !! wikitext
11444 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11445 !! html
11446 <div about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></div>
11447 <div about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}}]}"><i>b</i>c<i>d</i></div>
11448 <div about="#mwt3" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:0}}]}">e</div>
11449 !!end
11450
11451 !!test
11452 Templates: Ugly nesting: 4. Divs opened/closed across templates
11453 !! wikitext
11454 a<div>b{{echo|c</div>d}}e
11455 !! html
11456 a<div>bc</div>de
11457
11458 !! html+tidy
11459 <p>a</p>
11460 <div>bc</div>
11461 <p>de</p>
11462 !! end
11463
11464 !!test
11465 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11466 (Parsoid-centric)
11467 !! options
11468 parsoid
11469 !! wikitext
11470 {|
11471 |{{echo|foo</table>}}
11472 |bar
11473 |}
11474 !! html
11475 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo</table>"}},"i":0}},"\n|bar\n|}"]}'>
11476
11477 <tbody>
11478 <tr>
11479 <td>foo</td></tr></tbody></table><span about="#mwt1">
11480 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11481 |}</span>
11482 !!end
11483
11484 !!test
11485 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11486 (Parsoid-centric)
11487 !! options
11488 parsoid
11489 !! wikitext
11490 <table>
11491 <tr>
11492 <td>
11493 <table>
11494 <tr>
11495 <td>1. {{echo|foo </table>}}</td>
11496 <td> bar </td>
11497 <td>2. {{echo|baz </table>}}</td>
11498 </tr>
11499 <tr>
11500 <td>abc</td>
11501 </tr>
11502 </table>
11503 </td>
11504 </tr>
11505 <tr>
11506 <td>xyz</td>
11507 </tr>
11508 </table>
11509 !! html
11510 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["<table>\n <tr>\n <td>\n <table>\n <tr>\n <td>1. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo </table>"}},"i":0}},"</td>\n <td> bar </td>\n <td>2. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"baz </table>"}},"i":1}},"</td>\n </tr>\n <tr>\n <td>abc</td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td>xyz</td>\n </tr>\n</table>"]}'>
11511 <tbody><tr>
11512 <td>
11513 <table>
11514 <tbody><tr>
11515 <td>1. foo </td></tr></tbody></table></td>
11516 <td> bar </td>
11517 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11518 </span><span about="#mwt2">
11519 </span><span about="#mwt2">
11520 </span><span about="#mwt2">abc</span><span about="#mwt2">
11521 </span><span about="#mwt2">
11522 </span><span about="#mwt2">
11523 </span><span about="#mwt2">
11524 </span><span about="#mwt2">
11525 </span><span about="#mwt2">
11526 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11527 </span><span about="#mwt2">
11528 </span>
11529 !!end
11530
11531 !! test
11532 Templates: Ugly templates: 3. newline-only template parameter
11533 !! wikitext
11534 foo {{echo|
11535 }}
11536 !! html
11537 <p>foo
11538 </p>
11539 !! end
11540
11541 # This looks like a bug: a single newline triggers p/br for some reason.
11542 !! test
11543 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11544 !! wikitext
11545 {{echo|
11546 }}
11547 !! html
11548 <p><br />
11549 </p>
11550 !! end
11551
11552 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11553 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11554 !! test
11555 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11556 !! wikitext
11557 {{echo|<table>}}
11558 {{echo|<div>foo}}
11559 {{echo|</table>}}
11560 !! html/parsoid
11561 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>foo"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/table>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}]]}'>foo
11562 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11563 </table>
11564 !! end
11565
11566 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
11567 # that are "identical" and generate nesting cycles in the algorithm
11568 !! test
11569 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11570 !! wikitext
11571 {{echo|<table><tr><td><table>}}
11572 {{echo|<div>}}
11573 {{echo|</div>}}
11574 !! html/parsoid
11575 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>&lt;tr>&lt;td>&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/div>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}]]}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>
11576 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11577 </table></td></tr></tbody></table>
11578 !! end
11579
11580 !!test
11581 Parser Functions: 1. Simple example
11582 !! wikitext
11583 {{uc:foo}}
11584 !! html
11585 <p>FOO
11586 </p>
11587 !!end
11588
11589 !!test
11590 Parser Functions: 2. Nested use (only outermost should be marked up)
11591 !! wikitext
11592 {{uc:{{lc:FOO}}}}
11593 !! html
11594 <p>FOO
11595 </p>
11596 !!end
11597
11598 ###
11599 ### Pre-save transform tests
11600 ###
11601 !! test
11602 pre-save transform: subst:
11603 !! options
11604 pst
11605 !! wikitext
11606 {{subst:test}}
11607 !! html/php
11608 This is a test template
11609 !! end
11610
11611 !! test
11612 pre-save transform: normal template
11613 !! options
11614 pst
11615 !! wikitext
11616 {{test}}
11617 !! html/php
11618 {{test}}
11619 !! end
11620
11621 !! test
11622 pre-save transform: nonexistent template
11623 !! options
11624 pst
11625 !! wikitext
11626 {{thistemplatedoesnotexist}}
11627 !! html/php
11628 {{thistemplatedoesnotexist}}
11629 !! end
11630
11631 !! test
11632 pre-save transform: subst magic variables
11633 !! options
11634 pst
11635 !! wikitext
11636 {{subst:SITENAME}}
11637 !! html/php
11638 MediaWiki
11639 !! end
11640
11641 # This is bug 89, which I fixed. -- wtm
11642 !! test
11643 pre-save transform: subst: templates with parameters
11644 !! options
11645 pst
11646 !! wikitext
11647 {{subst:paramtest|param="something else"}}
11648 !! html/php
11649 This is a test template with parameter "something else"
11650 !! end
11651
11652 !! article
11653 Template:nowikitest
11654 !! text
11655 <nowiki>'''not wiki'''</nowiki>
11656 !! endarticle
11657
11658 !! test
11659 pre-save transform: nowiki in subst (bug 1188)
11660 !! options
11661 pst
11662 !! wikitext
11663 {{subst:nowikitest}}
11664 !! html/php
11665 <nowiki>'''not wiki'''</nowiki>
11666 !! end
11667
11668 !! article
11669 Template:commenttest
11670 !! text
11671 This template has <!-- a comment --> in it.
11672 !! endarticle
11673
11674 !! test
11675 pre-save transform: comment in subst (bug 1936)
11676 !! options
11677 pst
11678 !! wikitext
11679 {{subst:commenttest}}
11680 !! html/php
11681 This template has <!-- a comment --> in it.
11682 !! end
11683
11684 !! test
11685 pre-save transform: unclosed tag
11686 !! options
11687 pst noxml
11688 !! wikitext
11689 <nowiki>'''not wiki'''
11690 !! html/php
11691 <nowiki>'''not wiki'''
11692 !! end
11693
11694 !! test
11695 pre-save transform: mixed tag case
11696 !! options
11697 pst noxml
11698 !! wikitext
11699 <NOwiki>'''not wiki'''</noWIKI>
11700 !! html/php
11701 <NOwiki>'''not wiki'''</noWIKI>
11702 !! end
11703
11704 !! test
11705 pre-save transform: unclosed comment in <nowiki>
11706 !! options
11707 pst noxml
11708 !! wikitext
11709 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11710 !! html/php
11711 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11712 !!end
11713
11714 # Leading @ in this template definition works around a limitation
11715 # in parsoid's parserTests which otherwise strips the <span> from the
11716 # result (confusing it for a template wrapper)
11717 !! article
11718 Template:dangerous
11719 !!text
11720 @<span onmouseover="alert('crap')">Oh no</span>
11721 !!endarticle
11722
11723 !!test
11724 (confirming safety of fix for subst bug 1936)
11725 !! wikitext
11726 {{Template:dangerous}}
11727 !! html
11728 <p>@<span>Oh no</span>
11729 </p>
11730 !! end
11731
11732 !! test
11733 pre-save transform: comment containing gallery (bug 5024)
11734 !! options
11735 pst
11736 !! wikitext
11737 <!-- <gallery>data</gallery> -->
11738 !! html/php
11739 <!-- <gallery>data</gallery> -->
11740 !!end
11741
11742 !! test
11743 pre-save transform: comment containing extension
11744 !! options
11745 pst
11746 !! wikitext
11747 <!-- <tag>data</tag> -->
11748 !! html/php
11749 <!-- <tag>data</tag> -->
11750 !!end
11751
11752 !! test
11753 pre-save transform: comment containing nowiki
11754 !! options
11755 pst
11756 !! wikitext
11757 <!-- <nowiki>data</nowiki> -->
11758 !! html/php
11759 <!-- <nowiki>data</nowiki> -->
11760 !!end
11761
11762 !! test
11763 pre-save transform: <noinclude> in subst (bug 3298)
11764 !! options
11765 pst
11766 !! wikitext
11767 {{subst:Includes}}
11768 !! html/php
11769 Foobar
11770 !! end
11771
11772 !! test
11773 pre-save transform: <onlyinclude> in subst (bug 3298)
11774 !! options
11775 pst
11776 !! wikitext
11777 {{subst:Includes2}}
11778 !! html/php
11779 Foo
11780 !! end
11781
11782 !! article
11783 Template:SubstTest
11784 !!text
11785 {{<includeonly>subst:</includeonly>Includes}}
11786 !! endarticle
11787
11788 !! article
11789 Template:SafeSubstTest
11790 !! text
11791 {{<includeonly>safesubst:</includeonly>Includes}}
11792 !! endarticle
11793
11794 !! test
11795 bug 22297: safesubst: works during PST
11796 !! options
11797 pst
11798 !! wikitext
11799 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
11800 !! html/php
11801 FoobarFoobar
11802 !! end
11803
11804 !! test
11805 bug 22297: safesubst: works during normal parse
11806 !! wikitext
11807 {{SafeSubstTest}}
11808 !! html
11809 <p>Foobar
11810 </p>
11811 !! end
11812
11813 !! test
11814 subst: does not work during normal parse
11815 !! wikitext
11816 {{SubstTest}}
11817 !! html
11818 <p>{{subst:Includes}}
11819 </p>
11820 !! end
11821
11822 !! test
11823 pre-save transform: context links ("pipe trick")
11824 !! options
11825 pst
11826 !! wikitext
11827 [[Article (context)|]]
11828 [[Bar:Article|]]
11829 [[:Bar:Article|]]
11830 [[Bar:Article (context)|]]
11831 [[:Bar:Article (context)|]]
11832 [[|Article]]
11833 [[|Article (context)]]
11834 [[Bar:X (Y) Z|]]
11835 [[:Bar:X (Y) Z|]]
11836 !! html/php
11837 [[Article (context)|Article]]
11838 [[Bar:Article|Article]]
11839 [[:Bar:Article|Article]]
11840 [[Bar:Article (context)|Article]]
11841 [[:Bar:Article (context)|Article]]
11842 [[Article]]
11843 [[Article (context)]]
11844 [[Bar:X (Y) Z|X (Y) Z]]
11845 [[:Bar:X (Y) Z|X (Y) Z]]
11846 !! end
11847
11848 !! test
11849 pre-save transform: context links ("pipe trick") with interwiki prefix
11850 !! options
11851 pst
11852 !! wikitext
11853 [[interwiki:Article|]]
11854 [[:interwiki:Article|]]
11855 [[interwiki:Bar:Article|]]
11856 [[:interwiki:Bar:Article|]]
11857 !! html/php
11858 [[interwiki:Article|Article]]
11859 [[:interwiki:Article|Article]]
11860 [[interwiki:Bar:Article|Bar:Article]]
11861 [[:interwiki:Bar:Article|Bar:Article]]
11862 !! end
11863
11864 !! test
11865 pre-save transform: context links ("pipe trick") with parens in title
11866 !! options
11867 pst title=[[Somearticle (context)]]
11868 !! wikitext
11869 [[|Article]]
11870 !! html/php
11871 [[Article (context)|Article]]
11872 !! end
11873
11874 !! test
11875 pre-save transform: context links ("pipe trick") with comma in title
11876 !! options
11877 pst title=[[Someplace, Somewhere]]
11878 !! wikitext
11879 [[|Otherplace]]
11880 [[Otherplace, Elsewhere|]]
11881 [[Otherplace, Elsewhere, Anywhere|]]
11882 !! html/php
11883 [[Otherplace, Somewhere|Otherplace]]
11884 [[Otherplace, Elsewhere|Otherplace]]
11885 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
11886 !! end
11887
11888 !! test
11889 pre-save transform: context links ("pipe trick") with parens and comma
11890 !! options
11891 pst title=[[Someplace (IGNORED), Somewhere]]
11892 !! wikitext
11893 [[|Otherplace]]
11894 [[Otherplace (place), Elsewhere|]]
11895 !! html/php
11896 [[Otherplace, Somewhere|Otherplace]]
11897 [[Otherplace (place), Elsewhere|Otherplace]]
11898 !! end
11899
11900 !! test
11901 pre-save transform: context links ("pipe trick") with comma and parens
11902 !! options
11903 pst title=[[Who, me? (context)]]
11904 !! wikitext
11905 [[|Yes, you.]]
11906 [[Me, Myself, and I (1937 song)|]]
11907 !! html/php
11908 [[Yes, you. (context)|Yes, you.]]
11909 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
11910 !! end
11911
11912 !! test
11913 pre-save transform: context links ("pipe trick") with namespace
11914 !! options
11915 pst title=[[Ns:Somearticle]]
11916 !! wikitext
11917 [[|Article]]
11918 !! html/php
11919 [[Ns:Article|Article]]
11920 !! end
11921
11922 !! test
11923 pre-save transform: context links ("pipe trick") with namespace and parens
11924 !! options
11925 pst title=[[Ns:Somearticle (context)]]
11926 !! wikitext
11927 [[|Article]]
11928 !! html/php
11929 [[Ns:Article (context)|Article]]
11930 !! end
11931
11932 !! test
11933 pre-save transform: context links ("pipe trick") with namespace and comma
11934 !! options
11935 pst title=[[Ns:Somearticle, Context, Whatever]]
11936 !! wikitext
11937 [[|Article]]
11938 !! html/php
11939 [[Ns:Article, Context, Whatever|Article]]
11940 !! end
11941
11942 !! test
11943 pre-save transform: context links ("pipe trick") with namespace, comma and parens
11944 !! options
11945 pst title=[[Ns:Somearticle, Context (context)]]
11946 !! wikitext
11947 [[|Article]]
11948 !! html/php
11949 [[Ns:Article (context)|Article]]
11950 !! end
11951
11952 !! test
11953 pre-save transform: context links ("pipe trick") with namespace, parens and comma
11954 !! options
11955 pst title=[[Ns:Somearticle (IGNORED), Context]]
11956 !! wikitext
11957 [[|Article]]
11958 !! html/php
11959 [[Ns:Article, Context|Article]]
11960 !! end
11961
11962 !! test
11963 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
11964 !! options
11965 pst
11966 !! wikitext
11967 [[Article(context)|]]
11968 [[Bar:Article(context)|]]
11969 [[:Bar:Article(context)|]]
11970 [[|Article(context)]]
11971 [[Bar:X(Y)Z|]]
11972 [[:Bar:X(Y)Z|]]
11973 !! html/php
11974 [[Article(context)|Article]]
11975 [[Bar:Article(context)|Article]]
11976 [[:Bar:Article(context)|Article]]
11977 [[Article(context)]]
11978 [[Bar:X(Y)Z|X(Y)Z]]
11979 [[:Bar:X(Y)Z|X(Y)Z]]
11980 !! end
11981
11982 !! test
11983 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
11984 !! options
11985 pst
11986 !! wikitext
11987 [[Article (context)|]]
11988 [[Bar:Article (context)|]]
11989 [[:Bar:Article (context)|]]
11990 [[|Article (context)]]
11991 [[Bar:X (Y) Z|]]
11992 [[:Bar:X (Y) Z|]]
11993 !! html/php
11994 [[Article (context)|Article]]
11995 [[Bar:Article (context)|Article]]
11996 [[:Bar:Article (context)|Article]]
11997 [[Article (context)]]
11998 [[Bar:X (Y) Z|X (Y) Z]]
11999 [[:Bar:X (Y) Z|X (Y) Z]]
12000 !! end
12001
12002 !! test
12003 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12004 !! options
12005 pst
12006 !! wikitext
12007 [[Article(context)|]]
12008 [[Bar:Article(context)|]]
12009 [[:Bar:Article(context)|]]
12010 [[|Article(context)]]
12011 [[Bar:X(Y)Z|]]
12012 [[:Bar:X(Y)Z|]]
12013 !! html/php
12014 [[Article(context)|Article]]
12015 [[Bar:Article(context)|Article]]
12016 [[:Bar:Article(context)|Article]]
12017 [[Article(context)]]
12018 [[Bar:X(Y)Z|X(Y)Z]]
12019 [[:Bar:X(Y)Z|X(Y)Z]]
12020 !! end
12021
12022 !! test
12023 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12024 !! options
12025 pst
12026 !! wikitext
12027 [[Article (context), context|]]
12028 [[Article (context),context|]]
12029 [[Bar:Article (context), context|]]
12030 [[Bar:Article (context),context|]]
12031 [[:Bar:Article (context), context|]]
12032 [[:Bar:Article (context),context|]]
12033 !! html/php
12034 [[Article (context), context|Article]]
12035 [[Article (context),context|Article]]
12036 [[Bar:Article (context), context|Article]]
12037 [[Bar:Article (context),context|Article]]
12038 [[:Bar:Article (context), context|Article]]
12039 [[:Bar:Article (context),context|Article]]
12040 !! end
12041
12042 !! test
12043 pre-save transform: trim trailing empty lines
12044 !! options
12045 pst
12046 !! wikitext
12047 Empty lines are trimmed
12048
12049
12050
12051
12052 !! html/php
12053 Empty lines are trimmed
12054 !! end
12055
12056 !! test
12057 pre-save transform: Signature expansion
12058 !! options
12059 pst
12060 !! wikitext
12061 * ~~~
12062 * <noinclude>~~~</noinclude>
12063 * <includeonly>~~~</includeonly>
12064 * <onlyinclude>~~~</onlyinclude>
12065 !! html/php
12066 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12067 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12068 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12069 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12070 !! end
12071
12072
12073 !! test
12074 pre-save transform: Signature expansion in nowiki tags (bug 93)
12075 !! options
12076 pst disabled
12077 !! wikitext
12078 Shall not expand:
12079
12080 <nowiki>~~~~</nowiki>
12081
12082 <includeonly><nowiki>~~~~</nowiki></includeonly>
12083
12084 <noinclude><nowiki>~~~~</nowiki></noinclude>
12085
12086 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12087
12088 {{subst:Foo}} shall be converted to FOO
12089
12090 As well as inside noinclude/onlyinclude
12091 <noinclude>{{subst:Foo}}</noinclude>
12092 <onlyinclude>{{subst:Foo}}</onlyinclude>
12093
12094 But not inside includeonly
12095 <includeonly>{{subst:Foo}}</includeonly>
12096 !! html/php
12097 Shall not expand:
12098
12099 <nowiki>~~~~</nowiki>
12100
12101 <includeonly><nowiki>~~~~</nowiki></includeonly>
12102
12103 <noinclude><nowiki>~~~~</nowiki></noinclude>
12104
12105 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12106
12107 FOO shall be converted to FOO
12108
12109 As well as inside noinclude/onlyinclude
12110 <noinclude>FOO</noinclude>
12111 <onlyinclude>FOO</onlyinclude>
12112
12113 But not inside includeonly
12114 <includeonly>{{subst:Foo}}</includeonly>
12115 !! end
12116
12117 !! test
12118 Parsoid: Recognize nowiki with trailing space in tags
12119 !! options
12120 parsoid=wt2html
12121 !! wikitext
12122 <nowiki ><div>[[foo]]</nowiki >
12123
12124 a<nowiki / >b
12125
12126 c<nowiki />d
12127
12128 e<nowiki/ >f
12129 !! html
12130 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12131 <p>ab</p>
12132 <p>cd</p>
12133 <p>ef</p>
12134 !! end
12135
12136 !! test
12137 Parsoid: Recognize nowiki with odd capitalization
12138 !! options
12139 parsoid=wt2html
12140 !! wikitext
12141 <noWikI ><div>[[foo]]</Nowiki >
12142 !! html
12143 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12144 !! end
12145
12146
12147 !! test
12148 Parsoid: Escape nowiki with trailing space in tags
12149 !! options
12150 parsoid=html2wt
12151 !! html
12152 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12153 <p>a&lt;nowiki /&gt;b</p>
12154 <p>c&lt;nowiki/ &gt;d</p>
12155 !! wikitext
12156 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12157
12158 a&lt;nowiki /&gt;b
12159
12160 c&lt;nowiki/ &gt;d
12161 !! end
12162
12163 !! test
12164 Parsoid: Escape weird noWikI capitalizations
12165 !! options
12166 parsoid=html2wt
12167 !! html
12168 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12169 !! wikitext
12170 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12171 !! end
12172
12173 ###
12174 ### Message transform tests
12175 ###
12176 !! test
12177 message transform: magic variables
12178 !! options
12179 msg
12180 !! wikitext
12181 {{SITENAME}}
12182 !! html
12183 MediaWiki
12184 !! end
12185
12186 !! test
12187 message transform: should not transform wiki markup
12188 !! options
12189 msg
12190 !! wikitext
12191 ''test''
12192 !! html
12193 ''test''
12194 !! end
12195
12196 !! test
12197 message transform: <noinclude> in transcluded template (bug 4926)
12198 !! options
12199 msg
12200 !! wikitext
12201 {{Includes}}
12202 !! html
12203 Foobar
12204 !! end
12205
12206 !! test
12207 message transform: <onlyinclude> in transcluded template (bug 4926)
12208 !! options
12209 msg
12210 !! wikitext
12211 {{Includes2}}
12212 !! html
12213 Foo
12214 !! end
12215
12216 !! test
12217 {{#special:}} page name, known
12218 !! options
12219 msg
12220 !! wikitext
12221 {{#special:Recentchanges}}
12222 !! html
12223 Special:RecentChanges
12224 !! end
12225
12226 !! test
12227 {{#special:}} page name with subpage, known
12228 !! options
12229 msg
12230 !! wikitext
12231 {{#special:Recentchanges/param}}
12232 !! html
12233 Special:RecentChanges/param
12234 !! end
12235
12236 !! test
12237 {{#special:}} page name, unknown
12238 !! options
12239 msg
12240 !! wikitext
12241 {{#special:foobar nonexistent}}
12242 !! html
12243 Special:Foobar nonexistent
12244 !! end
12245
12246 !! test
12247 {{#speciale:}} page name, known
12248 !! options
12249 msg
12250 !! wikitext
12251 {{#speciale:Recentchanges}}
12252 !! html
12253 Special:RecentChanges
12254 !! end
12255
12256 !! test
12257 {{#speciale:}} page name with subpage, known
12258 !! options
12259 msg
12260 !! wikitext
12261 {{#speciale:Recentchanges/param}}
12262 !! html
12263 Special:RecentChanges/param
12264 !! end
12265
12266 !! test
12267 {{#speciale:}} page name, unknown
12268 !! options
12269 msg
12270 !! wikitext
12271 {{#speciale:foobar nonexistent}}
12272 !! html
12273 Special:Foobar_nonexistent
12274 !! end
12275
12276 ###
12277 ### Images
12278 ###
12279 ### For Parsoid-specific tests, see
12280 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12281
12282 !! test
12283 Simple image
12284 !! options
12285 parsoid=wt2html,wt2wt,html2html
12286 !! wikitext
12287 [[Image:foobar.jpg]]
12288 !! html/php
12289 <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>
12290 </p>
12291 !! html/parsoid
12292 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12293 !! end
12294
12295 !! test
12296 Simple image (using File: namespace, now canonical)
12297 !! wikitext
12298 [[File:Foobar.jpg]]
12299 !! html/php
12300 <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>
12301 </p>
12302 !! html/parsoid
12303 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12304 !! end
12305
12306 !! test
12307 Right-aligned image
12308 !! wikitext
12309 [[File:Foobar.jpg|right]]
12310 !! html/php
12311 <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>
12312
12313 !! html/parsoid
12314 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
12315 !! end
12316
12317 !! test
12318 Image with caption
12319 !! wikitext
12320 [[File:Foobar.jpg|right|Caption text]]
12321 !! html/php
12322 <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>
12323
12324 !! html/parsoid
12325 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
12326 !! end
12327
12328 !! test
12329 Image with caption, bug 53312 #1
12330 !! wikitext
12331 [[File:Foobar.jpg|right|Caption page stuff]]
12332 !! html/php
12333 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page stuff"><img alt="Caption page stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
12334
12335 !! html/parsoid
12336 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page stuff</figcaption></figure>
12337 !! end
12338
12339 !! test
12340 Image with caption, bug 53312 #2
12341 !! wikitext
12342 [[File:Foobar.jpg|right|Caption page=]]
12343 !! html/php
12344 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page="><img alt="Caption page=" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
12345
12346 !! html/parsoid
12347 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=</figcaption></figure>
12348 !! end
12349
12350 !! test
12351 Image with caption, bug 53312 #3
12352 !! wikitext
12353 [[File:Foobar.jpg|right|Caption page=stuff]]
12354 !! html/php
12355 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page=stuff"><img alt="Caption page=stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
12356
12357 !! html/parsoid
12358 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=stuff</figcaption></figure>
12359 !! end
12360
12361 !! test
12362 Allow empty links in image captions (Bug 60753)
12363 !! options
12364 thumbsize=220
12365 !! wikitext
12366 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12367 [[]]
12368 [[Link2]]
12369 ]]
12370 !! html/php
12371 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Caption <a href="/index.php?title=Link1&amp;action=edit&amp;redlink=1" class="new" title="Link1 (page does not exist)">Link1</a> [[]] <a href="/index.php?title=Link2&amp;action=edit&amp;redlink=1" class="new" title="Link2 (page does not exist)">Link2</a></div></div></div>
12372
12373 !! html/parsoid
12374 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption [[Link1]]\n[[]]\n[[Link2]]\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption <a rel="mw:WikiLink" href="./Link1" title="Link1" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"}}'>Link1</a>
12375 [[]]
12376 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12377 </figcaption></figure>
12378 !! end
12379
12380 !! test
12381 Titles in unlinked images (T23454)
12382 !! wikitext
12383 [[File:Foobar.jpg|link=|stuff]]
12384 !! html/php
12385 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12386 </p>
12387 !! end
12388
12389 !! test
12390 Link with empty target
12391 !! wikitext
12392 [[]]
12393 !! html
12394 <p>[[]]
12395 </p>
12396 !! end
12397
12398 !! test
12399 Image with link trail
12400 !! wikitext
12401 Linktrails should not work for images: [[File:Foobar.jpg]]s
12402 !! html/php
12403 <p>Linktrails should not work for images: <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>s
12404 </p>
12405 !! html/parsoid
12406 <p>Linktrails should not work for images: <span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span>s</p>
12407 !! end
12408
12409 !! test
12410 Image with empty attribute
12411 !! options
12412 parsoid=wt2html,wt2wt,html2html
12413 !! wikitext
12414 [[File:Foobar.jpg|right||Caption text]]
12415 !! html/php
12416 <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>
12417
12418 !! html/parsoid
12419 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
12420 !! end
12421
12422 !! test
12423 1. Block image with individual attributes from templates
12424 !! wikitext
12425 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12426 !! html/php
12427 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
12428
12429 !! html/parsoid
12430 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[24,38,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&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;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
12431 !! end
12432
12433 !! test
12434 2. Block Image with individual attributes from templates
12435 !! wikitext
12436 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12437 !! html/php
12438 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
12439
12440 !! html/parsoid
12441 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,32,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&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;thumb&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[33,47,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&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;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
12442 !! end
12443
12444 !! test
12445 3. Inline image with individual attributes from templates
12446 !! wikitext
12447 [[File:Foobar.jpg|{{echo|50px}}]]
12448 !! html/php
12449 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a>
12450 </p>
12451 !! html/parsoid
12452 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}' data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&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;50px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">50px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
12453 !! end
12454
12455 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12456 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12457 !! test
12458 Image with multiple attributes from the same template
12459 !! wikitext
12460 [[File:Foobar.jpg|{{image_attribs}}]]
12461 !! html/php
12462 <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>
12463
12464 !! html/parsoid
12465 <figure class="mw-default-size mw-halign-right" typeof="mw:Image mw:Placeholder"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
12466 !! end
12467
12468 !! test
12469 Image with link tails
12470 !! options
12471 thumbsize=220
12472 !! wikitext
12473 123[[File:Foobar.jpg]]456
12474 123[[File:Foobar.jpg|right]]456
12475 123[[File:Foobar.jpg|thumb]]456
12476 !! html/php
12477 <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
12478 </p>
12479 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
12480 123<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>456
12481
12482 !! html/php+tidy
12483 <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</p>
12484 <p>123</p>
12485 <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>
12486 <p>456 123</p>
12487 <div class="thumb tright">
12488 <div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>
12489 <div class="thumbcaption">
12490 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12491 </div>
12492 </div>
12493 </div>
12494 <p>456</p>
12495 !! html/parsoid
12496 <p>123<span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span>456</p>
12497 <p>123</p><figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure><p>456</p>
12498 <p>123</p><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure><p>456</p>
12499 !! end
12500
12501 !! test
12502 Image with multiple captions -- only last one is accepted
12503 !! wikitext
12504 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12505 !! html/php
12506 <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>
12507
12508 !! html/parsoid
12509 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption3 - accepted</figcaption></figure>
12510 !! end
12511
12512 !! test
12513 Image with multiple widths -- use last
12514 !! wikitext
12515 [[File:Foobar.jpg|200px|300px|caption]]
12516 !! html/php
12517 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" width="300" height="34" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/450px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/600px-Foobar.jpg 2x" /></a>
12518 </p>
12519 !! html/parsoid
12520 <p><span typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></span></p>
12521 !! end
12522
12523 !! test
12524 Image with multiple alignments -- use first (bug 48664)
12525 !! options
12526 thumbsize=220
12527 !! wikitext
12528 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12529
12530 [[File:Foobar.jpg|middle|text-top|caption]]
12531 !! html/php
12532 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
12533 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" style="vertical-align: middle" /></a>
12534 </p>
12535 !! html/parsoid
12536 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12537 <p><span class="mw-default-size mw-valign-middle" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12538 !! end
12539
12540 !! test
12541 Image with width attribute at different positions
12542 !! wikitext
12543 [[File:Foobar.jpg|200px|right|Caption]]
12544 [[File:Foobar.jpg|right|200px|Caption]]
12545 [[File:Foobar.jpg|right|Caption|200px]]
12546 !! html/php
12547 <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>
12548 <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>
12549 <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>
12550
12551 !! html/parsoid
12552 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
12553 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
12554 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
12555 !! end
12556
12557 # a sad bit of backward-compatibility
12558 !! test
12559 Image with size specified with pxpx (bug 13500, 51628)
12560 !! options
12561 parsoid=wt2html,wt2wt,html2html
12562 !! wikitext
12563 [[File:Foobar.jpg|20pxpx]]
12564 [[File:Foobar.jpg|200x20pxpx]]
12565 !! html/php
12566 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" 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>
12567 <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" width="177" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/265px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/353px-Foobar.jpg 2x" /></a>
12568 </p>
12569 !! html/parsoid
12570 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="2" width="20"/></a></span> <span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="20" width="177"/></a></span></p>
12571 !! end
12572
12573 !! test
12574 Image with link parameter, wiki target
12575 !! wikitext
12576 [[File:Foobar.jpg|link=Main Page]]
12577 !! html/php
12578 <p><a href="/wiki/Main_Page" title="Main Page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12579 </p>
12580 !! html/parsoid
12581 <p><span class="mw-default-size" typeof="mw:Image"><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12582 !! end
12583
12584 # parsoid bug 49293 (part 1)
12585 !! test
12586 Image with link parameter, URL target
12587 !! wikitext
12588 [[File:Foobar.jpg|link=http://example.com/]]
12589 !! html/php
12590 <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>
12591 </p>
12592 !! html/parsoid
12593 <p><span class="mw-default-size" typeof="mw:Image"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12594 !! end
12595
12596 # parsoid bug 49293 (part 2)
12597 !! test
12598 Image with link parameter, protocol-less URL target
12599 !! wikitext
12600 [[File:Foobar.jpg|link=//example.com/]]
12601 !! html/php
12602 <p><a href="//example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12603 </p>
12604 !! html/parsoid
12605 <p><span class="mw-default-size" typeof="mw:Image"><a href="//example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12606 !! end
12607
12608 !! test
12609 Image with link parameter, wgExternalLinkTarget
12610 !! wikitext
12611 [[Image:foobar.jpg|link=http://example.com/]]
12612 !! config
12613 wgExternalLinkTarget='foobar'
12614 !! html
12615 <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>
12616 </p>
12617 !! end
12618
12619 !! test
12620 Image with link parameter, wgNoFollowLinks set to false
12621 !! wikitext
12622 [[Image:foobar.jpg|link=http://example.com/]]
12623 !! config
12624 wgNoFollowLinks=false
12625 !! html
12626 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12627 </p>
12628 !! end
12629
12630 !! test
12631 Image with link parameter, wgNoFollowDomainExceptions
12632 !! wikitext
12633 [[Image:foobar.jpg|link=http://example.com/]]
12634 !! config
12635 wgNoFollowDomainExceptions='example.com'
12636 !! html
12637 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12638 </p>
12639 !! end
12640
12641 !! test
12642 Image with link parameter, wgExternalLinkTarget, unnamed parameter
12643 !! wikitext
12644 [[Image:foobar.jpg|link=http://example.com/|Title]]
12645 !! config
12646 wgExternalLinkTarget='foobar'
12647 !! html
12648 <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>
12649 </p>
12650 !! end
12651
12652 !! test
12653 Image with empty link parameter
12654 !! wikitext
12655 [[File:Foobar.jpg|link=]]
12656 !! html/php
12657 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
12658 </p>
12659 !! html/parsoid
12660 <p><span class="mw-default-size" typeof="mw:Image"><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></span></span></p>
12661 !! end
12662
12663 !! test
12664 Image with link parameter (wiki target) and unnamed parameter
12665 !! wikitext
12666 [[File:Foobar.jpg|link=Main_Page|Title]]
12667 !! html/php
12668 <p><a href="/wiki/Main_Page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12669 </p>
12670 !! html/parsoid
12671 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12672 !! end
12673
12674 !! test
12675 Image with link parameter (URL target) and unnamed parameter
12676 !! wikitext
12677 [[File:Foobar.jpg|link=http://example.com/|Title]]
12678 !! html/php
12679 <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>
12680 </p>
12681 !! html/parsoid
12682 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12683 !! end
12684
12685 !! test
12686 Thumbnail image with link parameter
12687 !! options
12688 thumbsize=220
12689 parsoid=wt2html,wt2wt,html2html
12690 !! wikitext
12691 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
12692 !! html/php
12693 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
12694
12695 !! html/parsoid
12696 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Title</figcaption></figure>
12697 !! end
12698
12699 !! test
12700 Manually-specified thumbnail image
12701 !! options
12702 thumbsize=220
12703 !! wikitext
12704 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
12705 !! html/php
12706 <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"></a></div>Title</div></div></div>
12707
12708 !! html/parsoid
12709 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
12710 !! end
12711
12712 !! test
12713 Manually-specified thumbnail image with explicit link to wiki page
12714 !! options
12715 thumbsize=220
12716 parsoid=wt2html,wt2wt,html2html
12717 !! wikitext
12718 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
12719 !! html/php
12720 <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"></a></div>Title</div></div></div>
12721
12722 !! html/parsoid
12723 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
12724 !! end
12725
12726 !! test
12727 Manually-specified thumbnail image with explicit link to url
12728 !! options
12729 thumbsize=220
12730 parsoid=wt2html,wt2wt,html2html
12731 !! wikitext
12732 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
12733 !! html/php
12734 <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"></a></div>Title</div></div></div>
12735
12736 !! html/parsoid
12737 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="http://example.com"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
12738 !! end
12739
12740 !! test
12741 Manually-specified thumbnail image with explicit no link
12742 !! options
12743 thumbsize=220
12744 parsoid=wt2html,wt2wt,html2html
12745 !! wikitext
12746 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
12747 !! html/php
12748 <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"></a></div>Title</div></div></div>
12749
12750 !! html/parsoid
12751 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><span><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></span><figcaption>Title</figcaption></figure>
12752 !! end
12753
12754 !! test
12755 Manually-specified thumbnail image with explicit link and alt text
12756 !! options
12757 thumbsize=220
12758 parsoid=wt2html,wt2wt,html2html
12759 !! wikitext
12760 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
12761 !! html/php
12762 <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"></a></div>Title</div></div></div>
12763
12764 !! html/parsoid
12765 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="Main_Page"><img alt="alttext" resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
12766 !! end
12767
12768 !! test
12769 Image with frame and link
12770 !! options
12771 parsoid=wt2html,wt2wt,html2html
12772 !! wikitext
12773 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
12774 !! html/php
12775 <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>
12776
12777 !! html/parsoid
12778 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a></figcaption></figure>
12779 !! end
12780
12781 !! test
12782 Image with frame and link and explicit alt
12783 !! options
12784 parsoid=wt2html,wt2wt,html2html
12785 !! wikitext
12786 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
12787 !! html/php
12788 <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>
12789
12790 !! html/parsoid
12791 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img alt="Altitude" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a></figcaption></figure>
12792 !! end
12793
12794 !! test
12795 Image with wiki markup in implicit alt
12796 !! options
12797 parsoid=wt2html,wt2wt,html2html
12798 !! wikitext
12799 [[Image:Foobar.jpg|testing '''bold''' in alt]]
12800
12801 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
12802 !! html/php
12803 <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>
12804 </p><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>
12805 </p>
12806 !! html/parsoid
12807 <p><span class="mw-default-size" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;testing '''bold''' in alt&quot;}"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12808 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="testing bold in alt" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12809 !! end
12810
12811 !! test
12812 Alt image option should handle most kinds of wikitext without barfing
12813 !! wikitext
12814 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
12815 !! html/php
12816 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a link and a bold template." 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"></a></div>This is the image caption</div></div></div>
12817
12818 !! html/parsoid
12819 <figure class="mw-default-size" typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"This is the image caption"},{"ck":"alt","ak":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;link&amp;quot;},&amp;quot;dsr&amp;quot;:[65,73,2,2]}\">link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[80,106,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&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;&#39;&#39;bold template&#39;&#39;&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">bold template&lt;/i>."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"This is a link and a bold template.","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
12820 !! end
12821
12822 ###################
12823 # Conflicting image format options.
12824 # First option specified should 'win'.
12825 # All three cases in each test should be identical.
12826
12827 !! test
12828 Image with 'frameless' first.
12829 !! options
12830 parsoid=wt2html,wt2wt,html2html
12831 !! wikitext
12832 [[File:Foobar.jpg|frameless|caption]]
12833
12834 [[File:Foobar.jpg|frameless|frame|caption]]
12835
12836 [[File:Foobar.jpg|frameless|thumb|caption]]
12837 !! html/php
12838 <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" 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>
12839 </p><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" 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>
12840 </p><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" 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>
12841 </p>
12842 !! html/parsoid
12843 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
12844 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
12845 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
12846 !! end
12847
12848 !! test
12849 Image with 'frame' first.
12850 !! options
12851 parsoid=wt2html,wt2wt,html2html
12852 !! wikitext
12853 [[File:Foobar.jpg|frame|caption]]
12854 [[File:Foobar.jpg|frame|frameless|caption]]
12855 [[File:Foobar.jpg|frame|thumb|caption]]
12856 !! html/php
12857 <div class="thumb tright"><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">caption</div></div></div>
12858 <div class="thumb tright"><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">caption</div></div></div>
12859 <div class="thumb tright"><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">caption</div></div></div>
12860
12861 !! html/parsoid
12862 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
12863 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
12864 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
12865 !! end
12866
12867 !! test
12868 Image with 'thumb' first.
12869 !! options
12870 parsoid=wt2html,wt2wt,html2html
12871 !! wikitext
12872 [[File:Foobar.jpg|thumb|caption]]
12873 [[File:Foobar.jpg|thumb|frameless|caption]]
12874 [[File:Foobar.jpg|thumb|frame|caption]]
12875 !! html/php
12876 <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"></a></div>caption</div></div></div>
12877 <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"></a></div>caption</div></div></div>
12878 <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"></a></div>caption</div></div></div>
12879
12880 !! html/parsoid
12881 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12882 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12883 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12884 !! end
12885
12886 ###################
12887 # Image sizing.
12888 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
12889 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
12890 # Foobar has actual size of 1941x220
12891 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
12892 # a scalable format.
12893 # 2. Framed images always ignore size options; always render at default size.
12894 # 3. "Unspecified format" and border are the only types which can be
12895 # enlarged.
12896
12897 !! test
12898 Image: "unspecified format" and border enlarge
12899 !! options
12900 parsoid=wt2html,wt2wt,html2html
12901 !! wikitext
12902 [[File:Foobar.jpg|2000px]]
12903
12904 [[File:Foobar.jpg|border|2000px]]
12905 !! html/php
12906 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="2000" height="227" /></a>
12907 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="2000" height="227" class="thumbborder" /></a>
12908 </p>
12909 !! html/parsoid
12910 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></span></p>
12911 <p><span class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></span></p>
12912 !! end
12913
12914 !! test
12915 Image: "unspecified format" and border reduce
12916 !! options
12917 parsoid=wt2html,wt2wt,html2html
12918 !! wikitext
12919 [[File:Foobar.jpg|1000px]]
12920
12921 [[File:Foobar.jpg|border|1000px]]
12922 !! html/php
12923 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" width="1000" height="113" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/1500px-Foobar.jpg 1.5x, http://example.com/images/3/3a/Foobar.jpg 2x" /></a>
12924 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" width="1000" height="113" class="thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/1500px-Foobar.jpg 1.5x, http://example.com/images/3/3a/Foobar.jpg 2x" /></a>
12925 </p>
12926 !! html/parsoid
12927 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></span></p>
12928 <p><span class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></span></p>
12929 !! end
12930
12931 !! test
12932 Image: thumbs reduce
12933 !! options
12934 parsoid=wt2html,wt2wt,html2html
12935 !! wikitext
12936 [[File:Foobar.jpg|thumb|50px]]
12937 !! html/php
12938 <div class="thumb tright"><div class="thumbinner" style="width:52px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
12939
12940 !! html/parsoid
12941 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure>
12942 !! end
12943
12944 !! test
12945 Image: bitmap thumbs can't be enlarged past original size, but vector can.
12946 !! options
12947 parsoid=wt2html,wt2wt,html2html
12948 !! wikitext
12949 [[File:Foobar.jpg|thumb|2000px]]
12950
12951 [[File:Foobar.svg|thumb|2000px]]
12952 !! html/php
12953 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><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" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
12954 <div class="thumb tright"><div class="thumbinner" style="width:2002px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div></div></div></div>
12955
12956 !! html/parsoid
12957 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
12958 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/240px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></figure>
12959 !! end
12960
12961 !! test
12962 Image: frameless can reduce in size
12963 !! options
12964 parsoid=wt2html,wt2wt,html2html
12965 !! wikitext
12966 [[File:Foobar.jpg|frameless|50px]]
12967 !! html/php
12968 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a>
12969 </p>
12970 !! html/parsoid
12971 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
12972 !! end
12973
12974 !! test
12975 Image: bitmap frameless can't be enlarged past original size, but vector can
12976 !! options
12977 parsoid=wt2html,wt2wt,html2html
12978 !! wikitext
12979 [[File:Foobar.jpg|frameless|2000px]]
12980
12981 [[File:Foobar.svg|frameless|2000px]]
12982 !! html/php
12983 <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>
12984 </p><p><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a>
12985 </p>
12986 !! html/parsoid
12987 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12988 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/240px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></span></p>
12989 !! end
12990
12991 !! test
12992 Image: framed images are always unscaled.
12993 !! options
12994 parsoid=wt2html,wt2wt,html2html
12995 !! wikitext
12996 [[File:Foobar.jpg|frame]]
12997
12998 [[File:Foobar.jpg|frame|50px]]
12999
13000 [[File:Foobar.jpg|frame|50x50px]]
13001
13002 [[File:Foobar.jpg|frame|2000px]]
13003 !! html/php
13004 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><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" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
13005 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><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" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
13006 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><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" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
13007 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><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" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
13008
13009 !! html/parsoid
13010 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13011 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13012 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13013 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13014 !! end
13015
13016 ###################
13017
13018 !! test
13019 Link to image page- image page normally doesn't exists, hence edit link
13020 Add test with existing image page
13021 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13022 !! wikitext
13023 [[:Image:test]]
13024 !! html
13025 <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>
13026 </p>
13027 !! end
13028
13029 !! test
13030 bug 18784 Link to non-existent image page with caption should use caption as link text
13031 !! wikitext
13032 [[:Image:test|caption]]
13033 !! html
13034 <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>
13035 </p>
13036 !! end
13037
13038 !! test
13039 Frameless image caption with a free URL
13040 !! wikitext
13041 [[File:Foobar.jpg|http://example.com]]
13042 !! html/php
13043 <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>
13044 </p>
13045 !! html/parsoid
13046 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"http://example.com"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13047 !! end
13048
13049 !! test
13050 Thumbnail image caption with a free URL
13051 !! options
13052 thumbsize=220
13053 !! wikitext
13054 [[File:Foobar.jpg|thumb|http://example.com]]
13055 !! html/php
13056 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
13057
13058 !! html/parsoid
13059 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
13060 !! end
13061
13062 !! test
13063 Thumbnail image caption with a free URL and explicit alt
13064 !! options
13065 thumbsize=220
13066 parsoid=wt2html,wt2wt,html2html
13067 !! wikitext
13068 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13069 !! html/php
13070 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
13071
13072 !! html/parsoid
13073 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img alt="Alteration" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
13074 !! end
13075
13076 !! test
13077 SVG thumbnails with no language set
13078 !! options
13079 !! wikitext
13080 [[File:Foobar.svg|thumb|caption]]
13081 !! html/php
13082 <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="135" 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"></a></div>caption</div></div></div>
13083
13084 !! html/parsoid
13085 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
13086 !! end
13087
13088 !! test
13089 SVG thumbnails with language de
13090 !! options
13091 parsoid=wt2html,wt2wt,html2html
13092 !! wikitext
13093 [[File:Foobar.svg|thumb|caption|lang=de]]
13094 !! html/php
13095 <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="135" 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"></a></div>caption</div></div></div>
13096
13097 !! html/parsoid
13098 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
13099 !! end
13100
13101 !! test
13102 SVG thumbnails with invalid language code
13103 !! options
13104 parsoid=wt2html,wt2wt,html2html
13105 !! wikitext
13106 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13107 !! html/php
13108 <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="135" 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"></a></div>lang=invalid.language.code</div></div></div>
13109
13110 !! html/parsoid
13111 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>lang=invalid.language.code</figcaption></figure>
13112 !! end
13113
13114 !! test
13115 BUG 1887: A ISBN with a thumbnail
13116 !! wikitext
13117 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13118 !! html/php
13119 <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"></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
13120
13121 !! html/parsoid
13122 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="Special:BookSources/1235467890" rel="mw:ExtLink">ISBN 1235467890</a></figcaption></figure>
13123 !! end
13124
13125 !! test
13126 BUG 1887: A RFC with a thumbnail
13127 !! wikitext
13128 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13129 !! html/php
13130 <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"></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
13131
13132 !! html/parsoid
13133 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is <a href="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
13134 !! end
13135
13136 !! test
13137 BUG 1887: A mailto link with a thumbnail
13138 !! wikitext
13139 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13140 !! html/php
13141 <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"></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
13142
13143 !! html/parsoid
13144 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Please <a rel="mw:ExtLink" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure>
13145 !! end
13146
13147 # Pending resolution to bug 368
13148 !! test
13149 BUG 648: Frameless image caption with a link
13150 !! wikitext
13151 [[File:Foobar.jpg|text with a [[link]] in it]]
13152 !! html/php
13153 <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>
13154 </p>
13155 !! html/parsoid
13156 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[link]] in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13157 !! end
13158
13159 !! test
13160 BUG 648: Frameless image caption with a link (suffix)
13161 !! wikitext
13162 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13163 !! html/php
13164 <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>
13165 </p>
13166 !! html/parsoid
13167 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[link]]foo in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13168 !! end
13169
13170 !! test
13171 BUG 648: Frameless image caption with an interwiki link
13172 !! wikitext
13173 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13174 !! html/php
13175 <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>
13176 </p>
13177 !! html/parsoid
13178 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[MeatBall:Link]] in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13179 !! end
13180
13181 !! test
13182 BUG 648: Frameless image caption with a piped interwiki link
13183 !! wikitext
13184 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13185 !! html/php
13186 <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>
13187 </p>
13188 !! html/parsoid
13189 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[MeatBall:Link|link]] in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13190 !! end
13191
13192 !! test
13193 Escape HTML special chars in image alt text
13194 !! wikitext
13195 [[File:Foobar.jpg|& < > "]]
13196 !! html/php
13197 <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>
13198 </p>
13199 !! html/parsoid
13200 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&amp; &lt; > \""}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13201 !! end
13202
13203 !! test
13204 BUG 499: Alt text should have &#1234;, not &amp;1234;
13205 !! wikitext
13206 [[File:Foobar.jpg|&#9792;]]
13207 !! html/php
13208 <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>
13209 </p>
13210 !! html/parsoid
13211 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&amp;#9792;"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13212 !! end
13213
13214 !! test
13215 Broken image caption with link
13216 !! options
13217 parsoid=wt2html,wt2wt,html2html
13218 !! wikitext
13219 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13220 !! html/php
13221 <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.
13222 </p>
13223 !! html/parsoid
13224 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a rel="mw:WikiLink" href="Main_Page" title="Main Page">this</a> is just an ordinary link.</p>
13225 !! end
13226
13227 !! test
13228 Image caption containing another image
13229 !! wikitext
13230 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13231 !! html/php
13232 <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"></a></div>This is a caption with another <a href="/wiki/File:Thumb.png" class="image" title="image"><img alt="image" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" /></a> inside it!</div></div></div>
13233
13234 !! html/parsoid
13235 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is a caption with another <span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"image"}'><a href="./File:Thumb.png"><img resource="./File:Thumb.png" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a></span> inside it!</figcaption></figure>
13236 !! end
13237
13238 !! test
13239 Image: caption containing a newline
13240 !! wikitext
13241 [[File:Foobar.jpg|This
13242 *is some text]]
13243 !! html/php
13244 <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>
13245 </p>
13246 !! html/parsoid
13247 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"This\n*is some text"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13248 !!end
13249
13250 !!test
13251 Image: caption containing leading space
13252 (The leading space should not trigger nowiki escaping in wt2wt mode)
13253 !! wikitext
13254 [[File:Foobar.jpg|thumb| bar]]
13255 !! html/php
13256 <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"></a></div>bar</div></div></div>
13257
13258 !! html/parsoid
13259 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> bar</figcaption></figure>
13260 !!end
13261
13262 !! test
13263 Image: caption containing a table
13264 !! options
13265 parsoid=wt2html,wt2wt,html2html
13266 !! wikitext
13267 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13268 {|
13269 ! Foo !! Bar
13270 |-
13271 | Foo1 || Bar1
13272 |}
13273 and some more text.]]
13274 !! html/php
13275 <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"></a></div>This is an example image thumbnail caption with a table <table> <tr> <th> Foo </th> <th> Bar </th></tr> <tr> <td> Foo1 </td> <td> Bar1 </td></tr></table> and some more text.</div></div></div>
13276
13277 !! html/parsoid
13278 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This is an example image thumbnail caption with a table
13279 <table>
13280 <tbody>
13281 <tr><th>Foo </th><th>Bar</th></tr>
13282 <tr>
13283 <td>Foo1 </td>
13284 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13285 !! end
13286
13287 !! test
13288 Bug 3090: External links other than http: in image captions
13289 !! wikitext
13290 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13291 !! html/php
13292 <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"></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>
13293
13294 !! html/parsoid
13295 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This caption has <a rel="mw:ExtLink" href="irc://example.net">irc</a> and <a rel="mw:ExtLink" href="https://example.com">Secure</a> ext links in it.</figcaption></figure>
13296 !! end
13297
13298 !! test
13299 Custom class
13300 !! options
13301 parsoid=wt2html,wt2wt,html2html
13302 !! wikitext
13303 [[Image:foobar.jpg|a|class=b]]
13304 !! html/php
13305 <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>
13306 </p>
13307 !! html/parsoid
13308 <p><span class="mw-default-size b" typeof="mw:Image" data-mw='{"caption":"a"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13309 !! end
13310
13311 !! test
13312 Localized image handling (1).
13313 !! options
13314 parsoid=wt2html,wt2wt,html2html
13315 language=es
13316 !! wikitext
13317 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13318 !! html/php
13319 <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>
13320
13321 !! html/parsoid
13322 <figure class="mw-default-size mw-halign-left" typeof="mw:Image"><a href="./Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13323 !! end
13324
13325 !! test
13326 Localized image handling (2).
13327 !! options
13328 thumbsize=220
13329 parsoid=wt2html,wt2wt,html2html
13330 language=es
13331 !! wikitext
13332 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13333 !! html/php
13334 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"></a></div>caption</div></div></div>
13335
13336 !! html/parsoid
13337 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13338 !! end
13339
13340 !! test
13341 "border", "frameless" and "class" attributes on an image.
13342 !! options
13343 thumbsize=220
13344 parsoid=wt2html,wt2wt,html2html
13345 !! wikitext
13346 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13347 !! html/php
13348 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>
13349 </p>
13350 !! html/parsoid
13351 <p><span class="mw-default-size mw-image-border extra" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
13352 !! end
13353
13354 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13355 !! test
13356 Invalid image attributes (bug 62500)
13357 !! options
13358 thumbsize=220
13359 parsoid=wt2html,wt2wt,html2html
13360 !! wikitext
13361 [[File:Foobar.jpg|thumb|float|left|caption]]
13362
13363 [[File:Foobar.jpg|thumb|righ|caption]]
13364
13365 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13366 !! html/php
13367 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13368 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13369 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13370
13371 !! html/parsoid
13372 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13373 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13374 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13375 !! end
13376
13377 !! article
13378 File:Barfoo.jpg
13379 !! text
13380 #REDIRECT [[File:Barfoo.jpg]]
13381 !! endarticle
13382
13383 # FIXME: Parsoid should run this test -- but we'd need to teach the
13384 # mockAPI about the redirected Barfoo.jpg image.
13385 !! test
13386 Redirected image
13387 !! wikitext
13388 [[Image:Barfoo.jpg]]
13389 !! html/php
13390 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13391 </p>
13392 !! end
13393
13394 !! test
13395 Missing image with uploads disabled
13396 !! options
13397 wgEnableUploads=0
13398 !! wikitext
13399 [[File:Foobaz.jpg]]
13400 !! html/php
13401 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13402 </p>
13403 !! html/parsoid
13404 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Foobaz.jpg"><img resource="./File:Foobaz.jpg" src="./Special:FilePath/Foobaz.jpg" height="220" width="220"/></a></span></p>
13405 !! end
13406
13407 # Parsoid-specific testing for images
13408 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13409 # Currently imperfect due to a flaw in the Parsoid testrunner
13410 # Work in progress
13411 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13412 # image tests.
13413
13414 !! test
13415 Parsoid-specific image handling - simple image with size and middle alignment
13416 !! wikitext
13417 [[File:Foobar.jpg|middle|50px]]
13418 !! html/parsoid
13419 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
13420 !! end
13421
13422 !! test
13423 Parsoid-specific image handling - simple image with size, middle alignment,
13424 non-standard namespace alias
13425 !! options
13426 parsoid=wt2wt,wt2html,html2html
13427 !! wikitext
13428 [[Image:Foobar.jpg|middle|50px]]
13429 !! html/parsoid
13430 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
13431 !! end
13432
13433 !! test
13434 Parsoid-specific image handling - simple image with size and middle alignment
13435 (existing content)
13436 !! wikitext
13437 [[File:Foobar.jpg|50px|middle]]
13438 !! html/parsoid
13439 <p><span class="mw-valign-middle" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"middle","ak":"middle"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13440 !! end
13441
13442 !! test
13443 Parsoid-specific image handling - simple image with size and middle alignment
13444 and non-standard namespace name
13445 !! options
13446 parsoid=wt2html,wt2wt,html2html
13447 !! wikitext
13448 [[Image:Foobar.jpg|50px|middle]]
13449 !! html/parsoid
13450 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
13451 !! end
13452
13453 !! test
13454 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13455 !! wikitext
13456 [[File:Foobar.jpg|500x10px|baseline|caption]]
13457 !! html/parsoid
13458 <p><span class="mw-valign-baseline" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"500x10px"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption"}],"size":"500x10"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="10" width="89" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"10","width":"89"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13459 !! end
13460
13461 !! test
13462 Parsoid-specific image handling - simple image with border and size spec
13463 !! wikitext
13464 [[File:Foobar.jpg|50px|border|caption]]
13465 !! html/parsoid
13466 <p><span class="mw-image-border" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13467 !! end
13468
13469 !! test
13470 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13471 !! wikitext
13472 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13473 !! html/parsoid
13474 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption content</figcaption></figure>
13475 !! end
13476
13477 !! test
13478 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13479 (existing content)
13480 !! wikitext
13481 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13482 !! html/parsoid
13483 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"left","ak":"left"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption content"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption content</figcaption></figure>
13484 !! end
13485
13486 !! test
13487 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13488 !! wikitext
13489 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13490 !! html/parsoid
13491 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a><figcaption>caption</figcaption></figure>
13492 !! end
13493
13494 !! test
13495 Parsoid-specific image handling - thumbnail with specific size, halign,
13496 valign, and caption (existing content)
13497 !! wikitext
13498 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13499 !! html/parsoid
13500 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"50x50px"},{"ck":"right","ak":"right"},{"ck":"middle","ak":"middle"},{"ck":"caption","ak":"caption"}],"size":"50x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption</figcaption></figure>
13501 !! end
13502
13503 !! test
13504 Parsoid-specific image handling - framed image with specific size and caption
13505 (size is ignored)
13506 !! options
13507 parsoid=wt2html,wt2wt,html2html
13508 !! wikitext
13509 [[File:Foobar.jpg|frame|500x50px|caption]]
13510 !! html/parsoid
13511 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13512 !! end
13513
13514 !! test
13515 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13516 (size is ignored)
13517 !! options
13518 parsoid=wt2html,wt2wt,html2html
13519 !! wikitext
13520 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13521 !! html/parsoid
13522 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13523 !! end
13524
13525 !! test
13526 Parsoid-specific image handling - frameless image with specific size, border, and caption
13527 !! wikitext
13528 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
13529 !! html/parsoid
13530 <p><span class="mw-image-border" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"frameless","ak":"frameless"},{"ck":"width","ak":"442x50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}],"size":"442x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="50" width="442" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"50","width":"442"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13531 !! end
13532
13533 !! test
13534 Parsoid-specific image handling - simple image with a formatted caption
13535 !! wikitext
13536 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
13537 !! html/parsoid
13538 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;table>&lt;tr>&lt;td>a&lt;/td>&lt;td>b&lt;/td>&lt;/tr>&lt;tr>&lt;td>c&lt;/td>&lt;/tr>&lt;/table>"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13539 !! end
13540
13541 !! test
13542 Parsoid-specific image handling - caption with a template in it
13543 !! wikitext
13544 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
13545 !! html/parsoid
13546 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"></a><figcaption>This caption has a <span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&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;transclusion&quot;}},&quot;i&quot;:0}}]}">transclusion</span> in it.</figcaption></figure>
13547 !! end
13548
13549 !! test
13550 Parsoid-specific image handling - caption with unbalanced tags in it
13551 !! options
13552 parsoid=wt2html,wt2wt,html2html
13553 !! wikitext
13554 foo
13555 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
13556 bar
13557 !! html/parsoid
13558 <p>foo</p>
13559 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This caption has a <center>unbalanced tag in it.</center></figcaption></figure>
13560 <p>bar</p>
13561 !! end
13562
13563 !! test
13564 Parsoid-specific image handling - empty caption (1)
13565 !! options
13566 parsoid=wt2html,wt2wt
13567 !! wikitext
13568 [[File:Foobar.jpg|thumb|]]
13569 !! html/parsoid
13570 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption></figcaption></figure>
13571 !! end
13572
13573 # empty captions don't get serialized unless we're in the "round trip" case
13574 !! test
13575 Parsoid-specific image handling - empty caption (2)
13576 !! options
13577 parsoid=html2wt
13578 !! html/parsoid
13579 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13580 <a href="./File:Foobar.jpg">
13581 <img resource="./File:Foobar.jpg"
13582 src="//example.com/images/3/3a/Foobar.jpg"
13583 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
13584 height="25" width="220"/>
13585 </a>
13586 <figcaption></figcaption>
13587 </figure>
13588 !! wikitext
13589 [[File:Foobar.jpg|thumb]]
13590 !! end
13591
13592 !! test
13593 Parsoid-specific image handling - whitespace caption
13594 !! wikitext
13595 [[File:Foobar.jpg|thumb| ]]
13596 !! html/parsoid
13597 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> </figcaption></figure>
13598 !! end
13599
13600 !! test
13601 Parsoid-specific image handling - lang option
13602 !! wikitext
13603 foo
13604 [[File:Foobar.svg|lang=de|caption]]
13605 bar
13606 !! html/parsoid
13607 <p>foo
13608 <span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="180" width="240"/></a></span>
13609 bar</p>
13610 !! end
13611
13612
13613 ###
13614 ### Subpages
13615 ###
13616 !! article
13617 Subpage test/subpage
13618 !! text
13619 foo
13620 !! endarticle
13621
13622 !! test
13623 Subpage link
13624 !! options
13625 subpage title=[[Subpage test]]
13626 !! wikitext
13627 [[/subpage]]
13628 !! html
13629 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
13630 </p>
13631 !! end
13632
13633 !! test
13634 Subpage noslash link
13635 !! options
13636 subpage title=[[Subpage test]]
13637 !! wikitext
13638 [[/subpage/]]
13639 !! html
13640 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
13641 </p>
13642 !! end
13643
13644 !! article
13645 Subpage test/1/2/subpage
13646 !! text
13647 blah
13648 !! endarticle
13649
13650 !! test
13651 Relative subpage noslash link
13652 !! options
13653 parsoid=wt2wt,wt2html,html2html
13654 subpage title=[[Subpage test/1/2/3/4]]
13655 !! wikitext
13656 [[../../subpage/]]
13657
13658 [[../../subpage]]
13659 !! html/php
13660 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
13661 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
13662 </p>
13663 !! html/parsoid
13664 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
13665 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
13666 !! end
13667
13668 !! test
13669 Parsoid: dot-slash prefixed wikilinks
13670 !! wikitext
13671 [[./foo]]
13672
13673 [[././bar]]
13674
13675 [[././baz/]]
13676 !! html/php
13677 <p>[[./foo]]
13678 </p><p>[[././bar]]
13679 </p><p>[[././baz/]]
13680 </p>
13681 !! html/parsoid
13682 <p>[[./foo]]
13683 </p><p>[[././bar]]
13684 </p><p>[[././baz/]]
13685 </p>
13686 !! end
13687
13688 !! test
13689 Render invalid page names as plain text (bug 51090)
13690 !! wikitext
13691 [[./../foo|bar]]
13692 [[foo�|bar]]
13693 [[foo/.|bar]]
13694 [[foo/..|bar]]
13695 [[foo~~~bar]]
13696 [[foo>bar]]
13697 [[foo[bar]]
13698 [[.]]
13699 [[..]]
13700 [[foo././bar]]
13701
13702 [[{{echo|./../foo}}|bar]]
13703 [[{{echo|foo/.}}|bar]]
13704 [[{{echo|foo/..}}|bar]]
13705 [[{{echo|foo~~~~bar}}]]
13706 [[{{echo|foo>bar}}]]
13707 [[{{echo|foo././bar}}]]
13708 [[{{echo|foo{bar}}]]
13709 [[{{echo|foo}bar}}]]
13710 [[{{echo|foo[bar}}]]
13711 [[{{echo|foo]bar}}]]
13712 [[{{echo|foo<bar}}]]
13713 !!html/php
13714 <p>[[./../foo|bar]]
13715 [[foo�|bar]]
13716 [[foo/.|bar]]
13717 [[foo/..|bar]]
13718 [[foo~~~bar]]
13719 [[foo&gt;bar]]
13720 [[foo[bar]]
13721 [[.]]
13722 [[..]]
13723 [[foo././bar]]
13724 </p><p>[[./../foo|bar]]
13725 [[foo/.|bar]]
13726 [[foo/..|bar]]
13727 [[foo~~~~bar]]
13728 [[foo&gt;bar]]
13729 [[foo././bar]]
13730 [[foo{bar]]
13731 [[foo}bar]]
13732 [[foo[bar]]
13733 [[foo]bar]]
13734 [[foo&lt;bar]]
13735 </p>
13736 !!html/parsoid
13737 <p>[[./../foo|bar]]
13738 [[foo�|bar]]
13739 [[foo/.|bar]]
13740 [[foo/..|bar]]
13741 [[foo~~~bar]]
13742 [[foo>bar]]
13743 [[foo[bar]]
13744 [[.]]
13745 [[..]]
13746 [[foo././bar]]</p>
13747
13748 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
13749 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
13750 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
13751 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
13752 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
13753 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
13754 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
13755 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
13756 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
13757 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
13758 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;bar"}},"i":0}}]}'>foo&lt;bar</span>]]</p>
13759 !!end
13760
13761 !! test
13762 Disabled subpages
13763 !! wikitext
13764 [[/subpage]]
13765 !! html
13766 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
13767 </p>
13768 !! end
13769
13770 !! test
13771 BUG 561: {{/Subpage}}
13772 !! options
13773 subpage title=[[Page]]
13774 !! wikitext
13775 {{/Subpage}}
13776 !! html
13777 <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>
13778 </p>
13779 !! end
13780
13781 ###
13782 ### Categories
13783 ###
13784 !! article
13785 Category:MediaWiki User's Guide
13786 !! text
13787 blah
13788 !! endarticle
13789
13790 !! test
13791 Link to category
13792 !! wikitext
13793 [[:Category:MediaWiki User's Guide]]
13794 !! html
13795 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
13796 </p>
13797 !! end
13798
13799 !! test
13800 Simple category
13801 !! options
13802 cat
13803 !! wikitext
13804 [[Category:MediaWiki User's Guide]]
13805 !! html
13806 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13807 !! end
13808
13809 !! test
13810 PAGESINCATEGORY invalid title fatal (r33546 fix)
13811 !! wikitext
13812 {{PAGESINCATEGORY:<bogus>}}
13813 !! html
13814 <p>0
13815 </p>
13816 !! end
13817
13818 !! test
13819 Category with different sort key
13820 !! options
13821 cat
13822 !! wikitext
13823 [[Category:MediaWiki User's Guide|Foo]]
13824 !! html
13825 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13826 !! end
13827
13828 !! test
13829 Category with identical sort key
13830 !! options
13831 cat
13832 !! wikitext
13833 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13834 !! html
13835 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13836 !! end
13837
13838 !! test
13839 Category with empty sort key
13840 !! options
13841 cat
13842 pst
13843 !! wikitext
13844 [[Category:MediaWiki User's Guide|]]
13845 !! html
13846 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13847 !! end
13848
13849 !! test
13850 Category with empty sort key and parentheses
13851 !! options
13852 cat
13853 pst
13854 !! wikitext
13855 [[Category:Foo (bar)|]]
13856 !! html
13857 [[Category:Foo (bar)|Foo]]
13858 !! end
13859
13860 !! test
13861 Category with link tail
13862 !! options
13863 cat
13864 pst
13865 !! wikitext
13866 123[[Category:Foo]]456
13867 !! html
13868 123[[Category:Foo]]456
13869 !! end
13870
13871 !! test
13872 Category with template
13873 !! options
13874 cat
13875 pst
13876 !! wikitext
13877 [[Category:{{echo|Foo}}]]
13878 !! html
13879 [[Category:{{echo|Foo}}]]
13880 !! end
13881
13882 !! test
13883 Category with template in sort key
13884 !! options
13885 cat
13886 pst
13887 !! wikitext
13888 [[Category:Foo|{{echo|Bar}}]]
13889 !! html
13890 [[Category:Foo|{{echo|Bar}}]]
13891 !! end
13892
13893 !! test
13894 Category with template in sort key and title
13895 !! options
13896 cat
13897 pst
13898 !! wikitext
13899 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13900 !! html
13901 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13902 !! end
13903
13904 !! test
13905 Category / paragraph interactions
13906 !! wikitext
13907 Foo [[Category:Baz]] Bar
13908
13909 Foo [[Category:Baz]]
13910 Bar
13911
13912 Foo
13913 [[Category:Baz]]
13914 Bar
13915
13916 Foo
13917 [[Category:Baz]] Bar
13918
13919 Foo
13920 [[Category:Baz]]
13921 [[Category:Baz]]
13922 [[Category:Baz]]
13923 Bar
13924
13925 [[Category:Baz]]
13926 [[Category:Baz]]
13927 [[Category:Baz]]
13928
13929 [[Category:Baz]]
13930 {{echo|[[Category:Baz]]}}
13931 [[Category:Baz]]
13932 !! html
13933 <p>Foo Bar
13934 </p><p>Foo
13935 Bar
13936 </p><p>Foo
13937 Bar
13938 </p><p>Foo Bar
13939 </p><p>Foo
13940 Bar
13941 </p>
13942 !! end
13943
13944 ## The whitespace on the empty line is part of the test. Please do not delete
13945 !! test
13946 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
13947 !! options
13948 parsoid=wt2html,wt2wt
13949 !! wikitext
13950 This
13951
13952 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
13953
13954 {{echo|[[Category:Foo]] and so should this!}}
13955 !! html
13956 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
13957 </p>
13958 !! html/parsoid
13959 <p>This
13960
13961 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
13962
13963 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]] and so should this!"}},"i":0}}]}'/><span about="#mwt1"> and so should this!</span></p>
13964 !! end
13965
13966 ## Parsoid will not try to wt2wt this while preserving newlines because
13967 ## it suppresses excess newlines within list items -- and we don't want to
13968 ## introduce a special case just for categories, which is, in reality somewhat
13969 ## odd behavior -- categories are unlikely to be used in list items like this
13970 ## in top-level pages and are only likely to show up in template-generated
13971 ## list items where this RT-ing is a non-issue.
13972 ##
13973 ## The whitespace on the empty line is part of the test. Please do not delete
13974 !! test
13975 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
13976 !! options
13977 parsoid=wt2html
13978 !! wikitext
13979 * This
13980
13981 [[Category:Foo]] and this should be part of the same list item
13982 * So should this
13983
13984 {{echo|[[Category:Foo]] and this should be part of the same list item}}
13985 !! html
13986 <ul><li>This and this should be part of the same list item</li>
13987 <li>So should this and this should be part of the same list item</li></ul>
13988 !! html/parsoid
13989 <ul>
13990 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
13991 <li>So should this <link rel="mw:PageProp/Category" href="Category:Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]] and this should be part of the same list item"}},"i":0}}]}'/><span> and this should be part of the same list item</span></li>
13992 </ul>
13993 !! end
13994
13995 ## Newlines and categories that follow the last item of a list
13996 ## are treated differently because this (list followed by categories)
13997 ## is an extremely common pattern on wikis.
13998 !! test
13999 3. Categories and newlines: newline suppression for last list item should RT properly
14000 !! wikitext
14001 * a
14002 * b
14003
14004 [[Category:Foo]]
14005
14006 [[Category:Bar]]
14007 [[Category:Baz]]
14008 !! html/parsoid
14009 <ul><li> a</li>
14010 <li> b</li></ul>
14011
14012 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14013
14014 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14015 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14016 !! end
14017
14018 !! test
14019 4. Categories and newlines: newline suppression for last list item should RT properly
14020 !! wikitext
14021 * a
14022 **** b
14023
14024 [[Category:Foo]]
14025 !! html/parsoid
14026 <ul><li> a
14027 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14028
14029 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14030 !! end
14031
14032 ## only wt2html for this to make sure the algo only applies to the rightmost path
14033 !! test
14034 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14035 !! options
14036 parsoid=wt2html
14037 !! wikitext
14038 * a
14039 ** b
14040 [[Category:Foo]]
14041 * c
14042 ** d
14043 [[Category:Foo]]
14044 !! html/parsoid
14045 <ul><li> a
14046 <ul><li> b
14047 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14048 <li> c
14049 <ul><li> d</li></ul></li></ul>
14050 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14051 !! end
14052
14053 !! test
14054 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14055 !! wikitext
14056 * a [[Category:Foo]]
14057 !! html/parsoid
14058 <ul><li>a <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul>
14059 !! end
14060
14061 # This test also demonstrates because of newline+category tunneling
14062 # through the list hander, template wrapping doesn't expand to the
14063 # containing list when the list item swallows the category.
14064 !! test
14065 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14066 !! wikitext
14067 * {{echo|a
14068 [[Category:Foo]]}}
14069 !! html/parsoid
14070 <ul><li> <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n[[Category:Foo]]"}},"i":0}}]}'>a</span><span about="#mwt1">
14071 </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul>
14072 !! end
14073
14074 !! test
14075 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14076 !! wikitext
14077 * a
14078
14079 {{echo|[[Category:Foo]]
14080 [[Category:Bar]]}}
14081 [[Category:Baz]]
14082 !! html/parsoid
14083 <ul><li> a</li></ul>
14084
14085 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"},"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]\n[[Category:Bar]]"}},"i":0}}]}'/><span about="#mwt1">
14086 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14087 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14088 !! end
14089
14090 !! test
14091 Parsoid: Serialize link to category page with colon escape
14092 !! options
14093 parsoid
14094 !! wikitext
14095
14096 [[:Category:Foo]]
14097 [[:Category:Foo|Bar]]
14098 !! html
14099 <p>
14100 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
14101 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
14102 </p>
14103 !! end
14104
14105 # html2wt localizes the "Category" namespace.
14106 # XXX the <link> element needs an empty data-parsoid attribute, or
14107 # else the html2html test fails because spaces are inserted.
14108 !! test
14109 Link prefix/suffixes aren't applied to category links
14110 !! options
14111 parsoid=wt2html,wt2wt,html2html
14112 language=is
14113 !! wikitext
14114 x[[Category:Foo]]y
14115 !! html/php
14116 <p>xy
14117 </p>
14118 !! html/parsoid
14119 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14120 !! end
14121
14122 !! test
14123 Parsoid: Serialize link to file page with colon escape
14124 !! options
14125 parsoid
14126 !! wikitext
14127
14128 [[:File:Foo.png]]
14129 [[:File:Foo.png|Bar]]
14130 !! html
14131 <p>
14132 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14133 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14134 </p>
14135 !! end
14136
14137 !! test
14138 Parsoid: Serialize a genuine category link without colon escape
14139 !! options
14140 parsoid
14141 !! wikitext
14142 [[Category:Foo]]
14143 [[Category:Foo|Bar]]
14144 !! html
14145 <link rel="mw:PageProp/Category" href="Category:Foo">
14146 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
14147 !! end
14148
14149 !! test
14150 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14151 !! options
14152 parsoid=html2wt
14153 !! html
14154 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14155 !! wikitext
14156 [[Category:Toxine bactérienne]]
14157 !! end
14158
14159 !! test
14160 Parsoid: Defaultsort
14161 !! wikitext
14162 {{DEFAULTSORT:Foo}}
14163 !! html/parsoid
14164 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14165 !! end
14166
14167 !! test
14168 Parsoid: Defaultsort (template-generated)
14169 !! wikitext
14170 {{{{echo|DEFAULTSORT}}:Foo}}
14171 !! html/parsoid
14172 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,28,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DEFAULTSORT}}:Foo"},"params":{},"i":0}}]}'/>
14173 !! end
14174
14175 ###
14176 ### Inter-language links
14177 ###
14178 !! test
14179 Interlanguage links
14180 !! options
14181 ill
14182 !! wikitext
14183 [[es:Alimento]]
14184 [[fr:Nourriture]]
14185 [[zh:食品]]
14186 !! html/php
14187 es:Alimento fr:Nourriture zh:食品
14188 !! html/parsoid
14189 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14190 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14191 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14192 !! end
14193
14194 !! test
14195 Duplicate interlanguage links (bug 24502)
14196 !! options
14197 ill
14198 !! wikitext
14199 [[es:1]]
14200 [[es:2]]
14201 [[fr:1]]
14202 [[fr:2]]
14203 !! html/php
14204 es:1 fr:1
14205 !! html/parsoid
14206 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14207 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14208 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14209 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14210 !! end
14211
14212 ###
14213 ### Sections
14214 ###
14215 !! test
14216 Basic section headings
14217 !! wikitext
14218 == Headline 1 ==
14219 Some text
14220
14221 ==Headline 2==
14222 More
14223 ===Smaller headline===
14224 Blah blah
14225 !! html
14226 <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>
14227 <p>Some text
14228 </p>
14229 <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>
14230 <p>More
14231 </p>
14232 <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>
14233 <p>Blah blah
14234 </p>
14235 !! end
14236
14237 !! test
14238 Section headings with TOC
14239 !! wikitext
14240 == Headline 1 ==
14241 === Subheadline 1 ===
14242 ===== Skipping a level =====
14243 ====== Skipping a level ======
14244
14245 == Headline 2 ==
14246 Some text
14247 ===Another headline===
14248 !! html
14249 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14250 <ul>
14251 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14252 <ul>
14253 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14254 <ul>
14255 <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>
14256 <ul>
14257 <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>
14258 </ul>
14259 </li>
14260 </ul>
14261 </li>
14262 </ul>
14263 </li>
14264 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14265 <ul>
14266 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14267 </ul>
14268 </li>
14269 </ul>
14270 </div>
14271
14272 <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>
14273 <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>
14274 <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>
14275 <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>
14276 <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>
14277 <p>Some text
14278 </p>
14279 <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>
14280
14281 !! end
14282
14283 !! test
14284 TOC anchors don't collide
14285 !! wikitext
14286 __FORCETOC__
14287 == Headline 2 ==
14288 == Headline ==
14289 == Headline 2 ==
14290 == Headline ==
14291 !! html/php
14292 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14293 <ul>
14294 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14295 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14296 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14297 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14298 </ul>
14299 </div>
14300
14301 <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=1" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14302 <h2><span class="mw-headline" id="Headline">Headline</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">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14303 <h2><span class="mw-headline" id="Headline_2_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=3" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14304 <h2><span class="mw-headline" id="Headline_3">Headline</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: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14305
14306 !! end
14307
14308 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14309 !! test
14310 Handling of sections up to level 6 and beyond
14311 !! wikitext
14312 = Level 1 Heading=
14313 == Level 2 Heading==
14314 === Level 3 Heading===
14315 ==== Level 4 Heading====
14316 ===== Level 5 Heading=====
14317 ====== Level 6 Heading======
14318 ======= Level 7 Heading=======
14319 ======== Level 8 Heading========
14320 ========= Level 9 Heading=========
14321 ========== Level 10 Heading==========
14322 !! html
14323 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14324 <ul>
14325 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14326 <ul>
14327 <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>
14328 <ul>
14329 <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>
14330 <ul>
14331 <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>
14332 <ul>
14333 <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>
14334 <ul>
14335 <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>
14336 <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>
14337 <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>
14338 <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>
14339 <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>
14340 </ul>
14341 </li>
14342 </ul>
14343 </li>
14344 </ul>
14345 </li>
14346 </ul>
14347 </li>
14348 </ul>
14349 </li>
14350 </ul>
14351 </div>
14352
14353 <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>
14354 <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>
14355 <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>
14356 <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>
14357 <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>
14358 <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>
14359 <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>
14360 <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>
14361 <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>
14362 <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>
14363
14364 !! end
14365
14366 !! test
14367 TOC regression (T11764)
14368 !! wikitext
14369 == title 1 ==
14370 === title 1.1 ===
14371 ==== title 1.1.1 ====
14372 === title 1.2 ===
14373 == title 2 ==
14374 === title 2.1 ===
14375 !! html
14376 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14377 <ul>
14378 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14379 <ul>
14380 <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>
14381 <ul>
14382 <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>
14383 </ul>
14384 </li>
14385 <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>
14386 </ul>
14387 </li>
14388 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14389 <ul>
14390 <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>
14391 </ul>
14392 </li>
14393 </ul>
14394 </div>
14395
14396 <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>
14397 <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>
14398 <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>
14399 <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>
14400 <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>
14401 <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>
14402
14403 !! end
14404
14405 !! test
14406 TOC for heading containing <span id="..."></span> (T96153)
14407 !! wikitext
14408 __FORCETOC__
14409 ==<span id="old-anchor"></span>New title==
14410 !! html/php
14411 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14412 <ul>
14413 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14414 </ul>
14415 </div>
14416
14417 <h2><span class="mw-headline" id="New_title"><span id="old-anchor"></span>New title</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: New title">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14418
14419 !! end
14420
14421 !! test
14422 TOC with wgMaxTocLevel=3 (bug 6204)
14423 !! options
14424 wgMaxTocLevel=3
14425 !! wikitext
14426 == title 1 ==
14427 === title 1.1 ===
14428 ==== title 1.1.1 ====
14429 === title 1.2 ===
14430 == title 2 ==
14431 === title 2.1 ===
14432 !! html
14433 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14434 <ul>
14435 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14436 <ul>
14437 <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>
14438 <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>
14439 </ul>
14440 </li>
14441 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14442 <ul>
14443 <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>
14444 </ul>
14445 </li>
14446 </ul>
14447 </div>
14448
14449 <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>
14450 <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>
14451 <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>
14452 <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>
14453 <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>
14454 <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>
14455
14456 !! end
14457
14458 !! test
14459 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
14460 !! options
14461 wgMaxTocLevel=3
14462 !! wikitext
14463 ==Section 1==
14464 ===Section 1.1===
14465 ====Section 1.1.1====
14466 ====Section 1.1.1.1====
14467 ==Section 2==
14468 !! html
14469 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14470 <ul>
14471 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
14472 <ul>
14473 <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>
14474 </ul>
14475 </li>
14476 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
14477 </ul>
14478 </div>
14479
14480 <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>
14481 <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>
14482 <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>
14483 <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>
14484 <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>
14485
14486 !! end
14487
14488
14489 !! test
14490 Resolving duplicate section names
14491 !! wikitext
14492 == Foo bar ==
14493 == Foo bar ==
14494 !! html
14495 <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>
14496 <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>
14497
14498 !! end
14499
14500 !! test
14501 Resolving duplicate section names with differing case (bug 10721)
14502 !! wikitext
14503 == Foo bar ==
14504 == Foo Bar ==
14505 !! html
14506 <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>
14507 <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>
14508
14509 !! end
14510
14511 !! article
14512 Template:sections
14513 !! text
14514 ===Section 1===
14515 ==Section 2==
14516 !! endarticle
14517
14518 !! test
14519 Template with sections, __NOTOC__
14520 !! wikitext
14521 __NOTOC__
14522 ==Section 0==
14523 {{sections}}
14524 ==Section 4==
14525 !! html
14526 <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>
14527 <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>
14528 <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>
14529 <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>
14530
14531 !! end
14532
14533 !! test
14534 __NOEDITSECTION__ keyword
14535 !! wikitext
14536 __NOEDITSECTION__
14537 ==Section 1==
14538 ==Section 2==
14539 !! html
14540 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
14541 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
14542
14543 !! end
14544
14545 !! test
14546 Link inside a section heading
14547 !! wikitext
14548 ==Section with a [[Main Page|link]] in it==
14549 !! html
14550 <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>
14551
14552 !! end
14553
14554 !! test
14555 TOC regression (T14077)
14556 !! wikitext
14557 __TOC__
14558 == title 1 ==
14559 === title 1.1 ===
14560 == title 2 ==
14561 !! html
14562 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14563 <ul>
14564 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14565 <ul>
14566 <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>
14567 </ul>
14568 </li>
14569 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
14570 </ul>
14571 </div>
14572
14573 <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>
14574 <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>
14575 <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>
14576
14577 !! end
14578
14579 !! test
14580 BUG 1219 URL next to image (good)
14581 !! wikitext
14582 http://example.com [[File:Foobar.jpg]]
14583 !! html/php
14584 <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>
14585 </p>
14586 !! html/parsoid
14587 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> <span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14588 !!end
14589
14590 !! test
14591 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
14592 !! wikitext
14593 ===
14594 The line above must have a trailing space!
14595 === <!--
14596 --> <!-- -->
14597 But just in case it doesn't...
14598 !! html
14599 <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>
14600 <p>The line above must have a trailing space!
14601 </p>
14602 <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>
14603 <p>But just in case it doesn't...
14604 </p>
14605 !! end
14606
14607 !! test
14608 Header with special characters (bug 25462)
14609 !! wikitext
14610 The tooltips shall not show entities to the user (ie. be double escaped)
14611
14612 == text > text ==
14613 section 1
14614
14615 == text < text ==
14616 section 2
14617
14618 == text & text ==
14619 section 3
14620
14621 == text ' text ==
14622 section 4
14623
14624 == text " text ==
14625 section 5
14626 !! html
14627 <p>The tooltips shall not show entities to the user (ie. be double escaped)
14628 </p>
14629 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14630 <ul>
14631 <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>
14632 <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>
14633 <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>
14634 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
14635 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
14636 </ul>
14637 </div>
14638
14639 <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 &gt; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14640 <p>section 1
14641 </p>
14642 <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>
14643 <p>section 2
14644 </p>
14645 <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>
14646 <p>section 3
14647 </p>
14648 <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>
14649 <p>section 4
14650 </p>
14651 <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>
14652 <p>section 5
14653 </p>
14654 !! end
14655
14656 !! test
14657 Header with space, plus and underscore as entity
14658 !! wikitext
14659 Id should not contain + for spaces
14660
14661 == Space between Text ==
14662 section 1
14663
14664 == Space-Entity&#32;between&#32;Text ==
14665 section 2
14666
14667 == Plus+between+Text ==
14668 section 3
14669
14670 == Plus-Entity&#43;between&#43;Text ==
14671 section 4
14672
14673 == Underscore_between_Text ==
14674 section 5
14675
14676 == Underscore-Entity&#95;between&#95;Text ==
14677 section 6
14678
14679 [[#Space between Text]]
14680 [[#Space-Entity&#32;between&#32;Text]]
14681 [[#Plus+between+Text]]
14682 [[#Plus-Entity&#43;between&#43;Text]]
14683 [[#Underscore_between_Text]]
14684 [[#Underscore-Entity&#95;between&#95;Text]]
14685 !! html
14686 <p>Id should not contain + for spaces
14687 </p>
14688 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14689 <ul>
14690 <li class="toclevel-1 tocsection-1"><a href="#Space_between_Text"><span class="tocnumber">1</span> <span class="toctext">Space between Text</span></a></li>
14691 <li class="toclevel-1 tocsection-2"><a href="#Space-Entity_between_Text"><span class="tocnumber">2</span> <span class="toctext">Space-Entity&#32;between&#32;Text</span></a></li>
14692 <li class="toclevel-1 tocsection-3"><a href="#Plus.2Bbetween.2BText"><span class="tocnumber">3</span> <span class="toctext">Plus+between+Text</span></a></li>
14693 <li class="toclevel-1 tocsection-4"><a href="#Plus-Entity.2Bbetween.2BText"><span class="tocnumber">4</span> <span class="toctext">Plus-Entity&#43;between&#43;Text</span></a></li>
14694 <li class="toclevel-1 tocsection-5"><a href="#Underscore_between_Text"><span class="tocnumber">5</span> <span class="toctext">Underscore_between_Text</span></a></li>
14695 <li class="toclevel-1 tocsection-6"><a href="#Underscore-Entity_between_Text"><span class="tocnumber">6</span> <span class="toctext">Underscore-Entity&#95;between&#95;Text</span></a></li>
14696 </ul>
14697 </div>
14698
14699 <h2><span class="mw-headline" id="Space_between_Text">Space between 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: Space between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14700 <p>section 1
14701 </p>
14702 <h2><span class="mw-headline" id="Space-Entity_between_Text">Space-Entity&#32;between&#32;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: Space-Entity between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14703 <p>section 2
14704 </p>
14705 <h2><span class="mw-headline" id="Plus.2Bbetween.2BText">Plus+between+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: Plus+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14706 <p>section 3
14707 </p>
14708 <h2><span class="mw-headline" id="Plus-Entity.2Bbetween.2BText">Plus-Entity&#43;between&#43;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: Plus-Entity+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14709 <p>section 4
14710 </p>
14711 <h2><span class="mw-headline" id="Underscore_between_Text">Underscore_between_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: Underscore between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14712 <p>section 5
14713 </p>
14714 <h2><span class="mw-headline" id="Underscore-Entity_between_Text">Underscore-Entity&#95;between&#95;Text</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: Underscore-Entity_between_Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14715 <p>section 6
14716 </p><p><a href="#Space_between_Text">#Space between Text</a>
14717 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
14718 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
14719 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
14720 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
14721 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
14722 </p>
14723 !! end
14724
14725 !! test
14726 Headers with excess '=' characters
14727 (Are similar tests necessary beyond the 1st level?)
14728 !! wikitext
14729 =foo==
14730 ==foo=
14731 =''italic'' heading==
14732 ==''italic'' heading=
14733 !! html
14734 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14735 <ul>
14736 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
14737 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
14738 <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>
14739 <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>
14740 </ul>
14741 </div>
14742
14743 <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>
14744 <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>
14745 <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>
14746 <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>
14747
14748 !! end
14749
14750 !! test
14751 HTML headers vs TOC (bug 23393)
14752 (__NOEDITSECTION__ for clearer output, doesn't matter here)
14753 !! wikitext
14754 <h1>Header 1</h1>
14755 == Header 1.1 ==
14756 == Header 1.2 ==
14757
14758 <h1>Header 2
14759 </h1>
14760 == Header 2.1 ==
14761 == Header 2.2 ==
14762 __NOEDITSECTION__
14763 !! html
14764 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14765 <ul>
14766 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
14767 <ul>
14768 <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>
14769 <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>
14770 </ul>
14771 </li>
14772 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
14773 <ul>
14774 <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>
14775 <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>
14776 </ul>
14777 </li>
14778 </ul>
14779 </div>
14780
14781 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
14782 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
14783 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
14784 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
14785 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
14786 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
14787
14788 !! end
14789
14790 !! test
14791 Single-line or multiline-comments can follow headings
14792 !! options
14793 parsoid=wt2html,wt2wt
14794 !! wikitext
14795 ==foo==<!---->
14796 ==bar==<!--c1-->
14797 ==baz==<!--
14798 c2
14799 c3-->
14800 !! html
14801 <h2><span class="mw-headline" id="foo">foo</span></h2>
14802 <h2><span class="mw-headline" id="bar">bar</span></h2>
14803 <h2><span class="mw-headline" id="baz">baz</span></h2>
14804
14805 !! end
14806
14807 !! test
14808 BUG 1219 URL next to image (broken)
14809 !! wikitext
14810 http://example.com[[File:Foobar.jpg]]
14811 !! html/php
14812 <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>
14813 </p>
14814 !! html/parsoid
14815 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14816 !!end
14817
14818 !! test
14819 Bug 1186 news: in the middle of text
14820 !! wikitext
14821 http://en.wikinews.org/wiki/Wikinews:Workplace
14822 !! html
14823 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
14824 </p>
14825 !!end
14826
14827
14828 !! test
14829 Namespaced link must have a title
14830 !! wikitext
14831 [[Project:]]
14832 !! html
14833 <p>[[Project:]]
14834 </p>
14835 !!end
14836
14837 !! test
14838 Namespaced link must have a title (bad fragment version)
14839 !! wikitext
14840 [[Project:#fragment]]
14841 !! html
14842 <p>[[Project:#fragment]]
14843 </p>
14844 !!end
14845
14846
14847 ###
14848 ### HTML tags and HTML attributes
14849 ###
14850
14851 !! test
14852 div with no attributes
14853 !! wikitext
14854 <div>HTML rocks</div>
14855 !! html
14856 <div>HTML rocks</div>
14857
14858 !! end
14859
14860 !! test
14861 div with double-quoted attribute
14862 !! wikitext
14863 <div id="rock">HTML rocks</div>
14864 !! html
14865 <div id="rock">HTML rocks</div>
14866
14867 !! end
14868
14869 !! test
14870 div with single-quoted attribute
14871 !! wikitext
14872 <div id='rock'>HTML rocks</div>
14873 !! html
14874 <div id="rock">HTML rocks</div>
14875
14876 !! end
14877
14878 !! test
14879 div with unquoted attribute
14880 !! wikitext
14881 <div id=rock>HTML rocks</div>
14882 !! html
14883 <div id="rock">HTML rocks</div>
14884
14885 !! end
14886
14887 !! test
14888 div with illegal double attributes
14889 !! wikitext
14890 <div id="a" id="b">HTML rocks</div>
14891 !! html
14892 <div id="b">HTML rocks</div>
14893
14894 !!end
14895
14896 # FIXME: produce empty string instead of "class" in the PHP parser, following
14897 # the HTML5 spec.
14898 !! test
14899 div with empty attribute value, space before equals
14900 !! options
14901 parsoid
14902 !! wikitext
14903 <div class =>HTML rocks</div>
14904 !! html
14905 <div class="">HTML rocks</div>
14906
14907 !! end
14908
14909 !! test
14910 div with multiple empty attribute values
14911 !! options
14912 parsoid
14913 !! wikitext
14914 <div id= title=>HTML rocks</div>
14915 !! html
14916 <div id="" title="">HTML rocks</div>
14917
14918 !! end
14919
14920 !! test
14921 table with multiple empty attribute values
14922 !! options
14923 parsoid
14924 !! wikitext
14925 {| title= id=
14926 | hi
14927 |}
14928 !! html
14929 <table title="" id="">
14930 <tbody><tr><td> hi</td></tr>
14931 </tbody></table>
14932 !! end
14933
14934 !! test
14935 div with braces in attribute value
14936 !! wikitext
14937 <div title="{}">Foo</div>
14938 !! html/php
14939 <div title="&#123;}">Foo</div>
14940
14941 !! html/parsoid
14942 <div title="{}">Foo</div>
14943 !! end
14944
14945 # This it very inconsistent in the PHP parser: it returns
14946 # class="class" if there is a space between the name and the equal sign (see
14947 # 'div with empty attribute value, space before equals'), but strips the
14948 # attribute completely if the space is missing. We hope that not much content
14949 # depends on this, so are implementing the behavior below in Parsoid for
14950 # consistencies' sake.
14951 # FIXME: fix this behavior in the PHP parser?
14952 !! test
14953 div with empty attribute value, no space before equals
14954 !! options
14955 parsoid=wt2html,html2html
14956 !! wikitext
14957 <div class=>HTML rocks</div>
14958 !! html/php
14959 <div>HTML rocks</div>
14960
14961 !! html/parsoid
14962 <div class="">HTML rocks</div>
14963 !! end
14964
14965 !! test
14966 HTML multiple attributes correction
14967 !! wikitext
14968 <p class="error" class="awesome">Awesome!</p>
14969 !! html
14970 <p class="awesome">Awesome!</p>
14971
14972 !!end
14973
14974 !! test
14975 Table multiple attributes correction
14976 !! wikitext
14977 {|
14978 !+ class="error" class="awesome"| status
14979 |}
14980 !! html
14981 <table>
14982 <tr>
14983 <th class="awesome"> status
14984 </th></tr></table>
14985
14986 !!end
14987
14988 !! test
14989 DIV IN UPPERCASE
14990 !! wikitext
14991 <DIV ID="x">HTML ROCKS</DIV>
14992 !! html
14993 <div id="x">HTML ROCKS</div>
14994
14995 !!end
14996
14997 !! test
14998 Non-ASCII pseudo-tags are rendered as text
14999 !! wikitext
15000 <khyô>
15001 !! html
15002 <p>&lt;khyô&gt;
15003 </p>
15004 !! end
15005
15006 !! test
15007 Pseudo-tag with URL 'name' renders as url link
15008 !! wikitext
15009 <http://example.com/>
15010 !! html
15011 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15012 </p>
15013 !! end
15014
15015 !! test
15016 text with amp in the middle of nowhere
15017 !! wikitext
15018 Remember AT&T?
15019 !! html
15020 <p>Remember AT&amp;T?
15021 </p>
15022 !! end
15023
15024 !! test
15025 text with character entity: eacute
15026 !! wikitext
15027 I always thought &eacute; was a cute letter.
15028 !! html
15029 <p>I always thought &#233; was a cute letter.
15030 </p>
15031 !! html+tidy
15032 <p>I always thought é was a cute letter.</p>
15033 !! end
15034
15035 !! test
15036 text with entity-escaped character entity-like string: eacute
15037 !! wikitext
15038 I always thought &amp;eacute; was a cute letter.
15039 !! html
15040 <p>I always thought &amp;eacute; was a cute letter.
15041 </p>
15042 !! end
15043
15044 !! test
15045 text with undefined character entity: xacute
15046 !! wikitext
15047 I always thought &xacute; was a cute letter.
15048 !! html
15049 <p>I always thought &amp;xacute; was a cute letter.
15050 </p>
15051 !! end
15052
15053 # TODO: generalize to PHP parser?
15054 !! test
15055 HTML5 tags
15056 !! options
15057 parsoid
15058 !! wikitext
15059 <data value="5">five</data>
15060 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15061 <mark>This highlighted text</mark>
15062 !! html
15063 <p><data value="5">five</data>
15064 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15065 <mark>This highlighted text</mark></p>
15066 !! end
15067
15068 !! test
15069 HTML tag with leading space is parsed as text
15070 !! wikitext
15071 < div>foo< /div>
15072 !! html
15073 <p>&lt; div&gt;foo&lt; /div&gt;
15074 </p>
15075 !! end
15076
15077 ###
15078 ### Nesting tests (see bug 41545, 50604, 51081)
15079 ###
15080
15081 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15082 # Note that html2wt is considerably more difficult if we use <b> in
15083 # the test case, instead of <big>
15084 !! test
15085 Ensure that HTML adoption agency algorithm is properly implemented.
15086 !! wikitext
15087 <big>X<big>Y</big>Z</big>
15088 !! html
15089 <p><big>X<big>Y</big>Z</big>
15090 </p>
15091 !! end
15092
15093 # This was bug 41545 in the PHP parser.
15094 # Note that tidy doesn't handle this correctly.
15095 !! test
15096 Nesting of <kbd>
15097 !! wikitext
15098 <kbd>X<kbd>Y</kbd>Z</kbd>
15099 !! html
15100 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15101 </p>
15102 !! end
15103
15104 # The following cases were bug 51081 in the PHP parser.
15105 # Note that there are some other nestable tags (b, i, etc) which are
15106 # not covered; see bug 51081 for discussion.
15107
15108 # Note that tidy doesn't handle this correctly.
15109 !! test
15110 Nesting of <em>
15111 !! wikitext
15112 <em>X<em>Y</em>Z</em>
15113 !! html
15114 <p><em>X<em>Y</em>Z</em>
15115 </p>
15116 !! end
15117
15118 # Note that tidy doesn't handle this correctly.
15119 !! test
15120 Nesting of <strong>
15121 !! wikitext
15122 <strong>X<strong>Y</strong>Z</strong>
15123 !! html
15124 <p><strong>X<strong>Y</strong>Z</strong>
15125 </p>
15126 !! end
15127
15128 !! test
15129 Nesting of <q>
15130 !! wikitext
15131 <q>X<q>Y</q>Z</q>
15132 !! html+tidy
15133 <p><q>X<q>Y</q>Z</q></p>
15134 !! end
15135
15136 # Note that tidy doesn't handle this correctly.
15137 !! test
15138 Nesting of <ruby>
15139 !! wikitext
15140 <ruby>X<ruby>Y</ruby>Z</ruby>
15141 !! html
15142 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15143 </p>
15144 !! end
15145
15146 # Note that tidy doesn't handle this correctly.
15147 !! test
15148 Nesting of <bdo>
15149 !! wikitext
15150 <bdo>X<bdo>Y</bdo>Z</bdo>
15151 !! html
15152 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15153 </p>
15154 !! end
15155
15156
15157 ###
15158 ### Media links
15159 ###
15160
15161 !! test
15162 Media link
15163 !! wikitext
15164 [[Media:Foobar.jpg]]
15165 !! html
15166 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15167 </p>
15168 !! end
15169
15170 !! test
15171 Media link with text
15172 !! wikitext
15173 [[Media:Foobar.jpg|A neat file to look at]]
15174 !! html
15175 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15176 </p>
15177 !! end
15178
15179 # FIXME: this is still bad HTML tag nesting
15180 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15181 !! test
15182 Media link with nasty text
15183 !! wikitext
15184 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15185 !! html
15186 <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>
15187
15188 !! html+tidy
15189 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15190 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15191 !! end
15192
15193 !! test
15194 Media link to nonexistent file (bug 1702)
15195 !! wikitext
15196 [[Media:No such.jpg]]
15197 !! html
15198 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15199 </p>
15200 !! end
15201
15202 !! test
15203 Image link to nonexistent file (bug 1850 - good)
15204 !! wikitext
15205 [[File:No_such.jpg]]
15206 !! html/php
15207 <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>
15208 </p>
15209 !! html/parsoid
15210 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:No_such.jpg"><img resource="./File:No_such.jpg" src="./Special:FilePath/No_such.jpg" height="220" width="220"/></a></span></p>
15211 !! end
15212
15213 !! test
15214 :Image link to nonexistent file (bug 1850 - bad)
15215 !! wikitext
15216 [[:Image:No such.jpg]]
15217 !! html/php
15218 <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>
15219 </p>
15220 !! html/parsoid
15221 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15222 !! end
15223
15224
15225
15226 !! test
15227 Character reference normalization in link text (bug 1938)
15228 !! wikitext
15229 [[Main Page|this&that]]
15230 !! html
15231 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15232 </p>
15233 !!end
15234
15235 !! article
15236 אַ
15237 !! text
15238 Test for unicode normalization
15239
15240 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15241 !! endarticle
15242
15243 !! test
15244 (bug 19451) Links should refer to the normalized form.
15245 !! wikitext
15246 [[&#xFB2E;]]
15247 [[&#x5d0;&#x5b7;]]
15248 [[&#x5d0;ַ]]
15249 [[א&#x5b7;]]
15250 [[אַ]]
15251 !! html
15252 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15253 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15254 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15255 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15256 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15257 </p>
15258 !! end
15259
15260 !! test
15261 Empty attribute crash test (bug 2067)
15262 !! wikitext
15263 <font color="">foo</font>
15264 !! html
15265 <p><font color="">foo</font>
15266 </p>
15267 !! end
15268
15269 !! test
15270 Empty attribute crash test single-quotes (bug 2067)
15271 !! wikitext
15272 <font color=''>foo</font>
15273 !! html
15274 <p><font color="">foo</font>
15275 </p>
15276 !! end
15277
15278 !! test
15279 Attribute test: equals, then nothing
15280 !! wikitext
15281 <font color=>foo</font>
15282 !! html
15283 <p><font>foo</font>
15284 </p>
15285 !! end
15286
15287 !! test
15288 Attribute test: unquoted value
15289 !! wikitext
15290 <font color=x>foo</font>
15291 !! html
15292 <p><font color="x">foo</font>
15293 </p>
15294 !! end
15295
15296 !! test
15297 Attribute test: unquoted but illegal value (hash)
15298 !! wikitext
15299 <font color=#x>foo</font>
15300 !! html
15301 <p><font color="#x">foo</font>
15302 </p>
15303 !! end
15304
15305 # Parsoid does not serialize to empty attribute syntax,
15306 # so wt2wt and html2wt cases are skipped
15307 !! test
15308 Attribute test: no value (T54330)
15309 !! options
15310 parsoid=wt2html,html2html
15311 !! wikitext
15312 <font color>foo</font>
15313 !! html/php
15314 <p><font color="">foo</font>
15315 </p>
15316 !! html/parsoid
15317 <p><font color="">foo</font></p>
15318 !! end
15319
15320 !! test
15321 Bug 2095: link with three closing brackets
15322 !! wikitext
15323 [[Main Page]]]
15324 !! html/php
15325 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15326 </p>
15327 !! html/parsoid
15328 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15329 !! end
15330
15331 !! test
15332 Bug 2095: link with pipe and three closing brackets
15333 !! wikitext
15334 [[Main Page|link]]]
15335 !! html/php
15336 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15337 </p>
15338 !! html/parsoid
15339 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15340 !! end
15341
15342 !! test
15343 Bug 2095: link with pipe and three closing brackets, version 2
15344 !! wikitext
15345 [[Main Page|[http://example.com/]]]
15346 !! html/php
15347 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15348 </p>
15349 !! html/parsoid
15350 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15351 !! end
15352
15353
15354 ###
15355 ### Safety
15356 ###
15357
15358 !! article
15359 Template:Dangerous attribute
15360 !! text
15361 " onmouseover="alert(document.cookie)
15362 !! endarticle
15363
15364 !! article
15365 Template:Dangerous style attribute
15366 !! text
15367 border-size: expression(alert(document.cookie))
15368 !! endarticle
15369
15370 !! article
15371 Template:Div style
15372 !! text
15373 <div style="float: right; {{{1}}}">Magic div</div>
15374 !! endarticle
15375
15376 !! test
15377 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15378 !! wikitext
15379 <div title="{{test}}"></div>
15380 !! html
15381 <div title="This is a test template"></div>
15382
15383 !! end
15384
15385 # Parsoid has enough context to handle this case
15386 !! test
15387 Bug 2304: HTML attribute safety (dangerous template; 2309)
15388 !! wikitext
15389 <div title="{{dangerous attribute}}"></div>
15390 !! html/php
15391 <div title=""></div>
15392
15393 !! html/parsoid
15394 <div title='" onmouseover="alert(document.cookie)' about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"\" onmouseover=\"alert(document.cookie)"},"sa":{"title":"{{dangerous attribute}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[12,35,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;dangerous attribute&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Dangerous_attribute&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
15395 !! end
15396
15397 !! test
15398 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15399 !! wikitext
15400 <div style="{{dangerous style attribute}}"></div>
15401 !! html
15402 <div style="/* insecure input */"></div>
15403
15404 !! end
15405
15406 !! test
15407 Bug 2304: HTML attribute safety (safe parameter; 2309)
15408 !! wikitext
15409 {{div style|width: 200px}}
15410 !! html
15411 <div style="float: right; width: 200px">Magic div</div>
15412
15413 !! end
15414
15415 !! test
15416 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15417 !! wikitext
15418 {{div style|width: expression(alert(document.cookie))}}
15419 !! html
15420 <div style="/* insecure input */">Magic div</div>
15421
15422 !! end
15423
15424 !! test
15425 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15426 !! wikitext
15427 {{div style|"><script>alert(document.cookie)</script>}}
15428 !! html
15429 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15430
15431 !! end
15432
15433 !! test
15434 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15435 !! wikitext
15436 {{div style|" ><script>alert(document.cookie)</script>}}
15437 !! html
15438 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15439
15440 !! end
15441
15442 !! test
15443 Bug 2304: HTML attribute safety (link)
15444 !! wikitext
15445 <div title="[[Main Page]]"></div>
15446 !! html
15447 <div title="&#91;&#91;Main Page]]"></div>
15448
15449 !! end
15450
15451 !! test
15452 Bug 2304: HTML attribute safety (italics)
15453 !! wikitext
15454 <div title="''foobar''"></div>
15455 !! html
15456 <div title="&#39;&#39;foobar&#39;&#39;"></div>
15457
15458 !! end
15459
15460 !! test
15461 Bug 2304: HTML attribute safety (bold)
15462 !! wikitext
15463 <div title="'''foobar'''"></div>
15464 !! html
15465 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
15466
15467 !! end
15468
15469
15470 !! test
15471 Bug 2304: HTML attribute safety (ISBN)
15472 !! wikitext
15473 <div title="ISBN 1234567890"></div>
15474 !! html
15475 <div title="&#73;SBN 1234567890"></div>
15476
15477 !! end
15478
15479 !! test
15480 Bug 2304: HTML attribute safety (RFC)
15481 !! wikitext
15482 <div title="RFC 1234"></div>
15483 !! html
15484 <div title="&#82;FC 1234"></div>
15485
15486 !! end
15487
15488 !! test
15489 Bug 2304: HTML attribute safety (PMID)
15490 !! wikitext
15491 <div title="PMID 1234567890"></div>
15492 !! html
15493 <div title="&#80;MID 1234567890"></div>
15494
15495 !! end
15496
15497 !! test
15498 Bug 2304: HTML attribute safety (web link)
15499 !! wikitext
15500 <div title="http://example.com/"></div>
15501 !! html
15502 <div title="http&#58;//example.com/"></div>
15503
15504 !! end
15505
15506 !! test
15507 Bug 2304: HTML attribute safety (named web link)
15508 !! wikitext
15509 <div title="[http://example.com/ link]"></div>
15510 !! html
15511 <div title="&#91;http&#58;//example.com/ link]"></div>
15512
15513 !! end
15514
15515 !! test
15516 Bug 3244: HTML attribute safety (extension; safe)
15517 !! wikitext
15518 <div style="<nowiki>background:blue</nowiki>"></div>
15519 !! html
15520 <div style="background:blue"></div>
15521
15522 !! end
15523
15524 !! test
15525 Bug 3244: HTML attribute safety (extension; unsafe)
15526 !! wikitext
15527 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
15528 !! html
15529 <div style="/* insecure input */"></div>
15530
15531 !! end
15532
15533 # More MSIE fun discovered by Tom Gilder
15534
15535 !! test
15536 MSIE CSS safety test: spurious slash
15537 !! wikitext
15538 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
15539 !! html
15540 <div style="/* insecure input */">evil</div>
15541
15542 !! end
15543
15544 !! test
15545 MSIE CSS safety test: hex code
15546 !! wikitext
15547 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
15548 !! html
15549 <div style="/* insecure input */">evil</div>
15550
15551 !! end
15552
15553 !! test
15554 MSIE CSS safety test: comment in url
15555 !! wikitext
15556 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
15557 !! html
15558 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
15559
15560 !! end
15561
15562 !! test
15563 MSIE CSS safety test: comment in expression
15564 !! wikitext
15565 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
15566 !! html
15567 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
15568
15569 !! end
15570
15571 !! test
15572 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
15573 !! wikitext
15574 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
15575 !! html
15576 <p style="/* invalid control char */">A</p>
15577
15578 !! end
15579
15580 !! test
15581 MSIE 6 CSS safety test: Fullwidth (bug 55332)
15582 !! wikitext
15583 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
15584 <div style="top:EXPRESSION(alert())">B</div>
15585 !! html
15586 <p style="/* insecure input */">A</p>
15587 <div style="/* insecure input */">B</div>
15588
15589 !! end
15590
15591 !! test
15592 MSIE 6 CSS safety test: IPA extensions (bug 55332)
15593 !! wikitext
15594 <div style="background-image:uʀʟ(javascript:alert())">A</div>
15595 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
15596 !! html
15597 <div style="/* insecure input */">A</div>
15598 <p style="/* insecure input */">B</p>
15599
15600 !! end
15601
15602 !! test
15603 MSIE 6 CSS safety test: sup/sub script (bug 55332)
15604 !! wikitext
15605 <div style="background-image:url⁽javascript:alert())">A</div>
15606 <div style="background-image:url₍javascript:alert())">B</div>
15607 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
15608 !! html
15609 <div style="/* insecure input */">A</div>
15610 <div style="/* insecure input */">B</div>
15611 <p style="/* insecure input */">C</p>
15612
15613 !! end
15614
15615 !! test
15616 Opera -o-link CSS
15617 !! wikitext
15618 <div
15619 title="&#100;&#97;&#116;&#97;&#58;&#116;&#101;&#120;&#116;&#47;&#104;&#116;&#109;&#108;&#44;&#60;&#105;&#109;&#103;&#32;&#115;&#114;&#99;&#61;&#49;&#32;&#111;&#110;&#101;&#114;&#114;&#111;&#114;&#61;&#97;&#108;&#101;&#114;&#116;&#40;&#49;&#41;&#62;"
15620 style="-o-link:attr(title);-o-link-source:current">X</div>
15621 !! html
15622 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
15623
15624 !! end
15625
15626 !! test
15627 MSIE 6 CSS safety test: Repetition markers (bug 55332)
15628 !! wikitext
15629 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
15630 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
15631 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
15632 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
15633 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
15634 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
15635 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
15636 !! html
15637 <p style="/* insecure input */">A</p>
15638 <p style="/* insecure input */">B</p>
15639 <p style="/* insecure input */">C</p>
15640 <p style="/* insecure input */">D</p>
15641 <p style="/* insecure input */">E</p>
15642 <p style="/* insecure input */">F</p>
15643 <p style="/* insecure input */">G</p>
15644
15645 !! end
15646
15647 !! test
15648 Table attribute legitimate extension
15649 !! wikitext
15650 {|
15651 !+ style="<nowiki>color:blue</nowiki>"| status
15652 |}
15653 !! html
15654 <table>
15655 <tr>
15656 <th style="color:blue"> status
15657 </th></tr></table>
15658
15659 !!end
15660
15661 !! test
15662 Table attribute safety
15663 !! wikitext
15664 {|
15665 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
15666 |}
15667 !! html
15668 <table>
15669 <tr>
15670 <th style="/* insecure input */"> status
15671 </th></tr></table>
15672
15673 !! end
15674
15675 !! test
15676 CSS line continuation 1
15677 !! wikitext
15678 <div style="background-image: u\&#10;rl(test.jpg);"></div>
15679 !! html
15680 <div style="/* insecure input */"></div>
15681
15682 !! end
15683
15684 !! test
15685 CSS line continuation 2
15686 !! wikitext
15687 <div style="background-image: u\&#13;rl(test.jpg); "></div>
15688 !! html
15689 <div style="/* insecure input */"></div>
15690
15691 !! end
15692
15693 !! article
15694 Template:Identity
15695 !! text
15696 {{{1}}}
15697 !! endarticle
15698
15699 !! test
15700 Expansion of multi-line templates in attribute values (bug 6255)
15701 !! wikitext
15702 <div style="background: {{identity|#00FF00}}">-</div>
15703 !! html
15704 <div style="background: #00FF00">-</div>
15705
15706 !! end
15707
15708
15709 !! test
15710 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
15711 !! wikitext
15712 <div style="background:
15713 #00FF00">-</div>
15714 !! html/php
15715 <div style="background: #00FF00">-</div>
15716
15717 !! html/parsoid
15718 <div style="background:
15719 #00FF00">-</div>
15720 !! end
15721
15722 !! test
15723 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
15724 !! wikitext
15725 <div style="background: &#10;#00FF00">-</div>
15726 !! html
15727 <div style="background: &#10;#00FF00">-</div>
15728
15729 !! end
15730
15731 !! test
15732 evil <math>-wiki-tags without Extension:Math enabled
15733 !! wikitext
15734 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
15735 !! html+tidy
15736 <p>&lt;math&gt;&lt;img src="some evil external link"&gt;&lt;script&gt;some_evil_javascript();&lt;/script&gt;&lt;/math&gt;</p>
15737 !! end
15738
15739 ###
15740 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
15741 ###
15742 !! test
15743 Parser hook: empty input
15744 !! wikitext
15745 <tag></tag>
15746 !! html/php
15747 <pre>
15748 ''
15749 array (
15750 )
15751 </pre>
15752
15753 !! end
15754
15755 !! test
15756 Parser hook: empty input using terminated empty elements
15757 !! wikitext
15758 <tag/>
15759 !! html/php
15760 <pre>
15761 NULL
15762 array (
15763 )
15764 </pre>
15765
15766 !! end
15767
15768 !! test
15769 Parser hook: empty input using terminated empty elements (space before)
15770 !! wikitext
15771 <tag />
15772 !! html/php
15773 <pre>
15774 NULL
15775 array (
15776 )
15777 </pre>
15778
15779 !! end
15780
15781 !! test
15782 Parser hook: basic input
15783 !! wikitext
15784 <tag>input</tag>
15785 !! html/php
15786 <pre>
15787 'input'
15788 array (
15789 )
15790 </pre>
15791
15792 !! end
15793
15794
15795 !! test
15796 Parser hook: case insensitive
15797 !! wikitext
15798 <TAG>input</TAG>
15799 !! html/php
15800 <pre>
15801 'input'
15802 array (
15803 )
15804 </pre>
15805
15806 !! end
15807
15808
15809 !! test
15810 Parser hook: case insensitive, redux
15811 !! wikitext
15812 <TaG>input</TAg>
15813 !! html/php
15814 <pre>
15815 'input'
15816 array (
15817 )
15818 </pre>
15819
15820 !! end
15821
15822 !! test
15823 Parser hook: nested tags
15824 !! options
15825 noxml
15826 !! wikitext
15827 <tag><tag></tag></tag>
15828 !! html/php
15829 <pre>
15830 '<tag>'
15831 array (
15832 )
15833 </pre>&lt;/tag&gt;
15834
15835 !! end
15836
15837 !! test
15838 Parser hook: basic arguments
15839 !! wikitext
15840 <tag width=200 height = "100" depth = '50' square></tag>
15841 !! html/php
15842 <pre>
15843 ''
15844 array (
15845 'width' => '200',
15846 'height' => '100',
15847 'depth' => '50',
15848 'square' => '',
15849 )
15850 </pre>
15851
15852 !! end
15853
15854 !! test
15855 Parser hook: argument containing a forward slash (bug 5344)
15856 !! wikitext
15857 <tag filename='/tmp/bla'></tag>
15858 !! html/php
15859 <pre>
15860 ''
15861 array (
15862 'filename' => '/tmp/bla',
15863 )
15864 </pre>
15865
15866 !! end
15867
15868 !! test
15869 Parser hook: empty input using terminated empty elements (bug 2374)
15870 !! wikitext
15871 <tag foo=bar/>text
15872 !! html/php
15873 <pre>
15874 NULL
15875 array (
15876 'foo' => 'bar',
15877 )
15878 </pre>text
15879
15880 !! end
15881
15882 # </tag> should be output literally since there is no matching tag that begins it
15883 !! test
15884 Parser hook: basic arguments using terminated empty elements (bug 2374)
15885 !! wikitext
15886 <tag width=200 height = "100" depth = '50' square/>
15887 other stuff
15888 </tag>
15889 !! html/php
15890 <pre>
15891 NULL
15892 array (
15893 'width' => '200',
15894 'height' => '100',
15895 'depth' => '50',
15896 'square' => '',
15897 )
15898 </pre>
15899 <p>other stuff
15900 &lt;/tag&gt;
15901 </p>
15902 !! end
15903
15904 ###
15905 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
15906 ###
15907
15908 !! test
15909 Parser hook: static parser hook not inside a comment
15910 !! wikitext
15911 <statictag>hello, world</statictag>
15912 <statictag action=flush/>
15913 !! html/php
15914 <p>hello, world
15915 </p>
15916 !! end
15917
15918
15919 !! test
15920 Parser hook: static parser hook inside a comment
15921 !! wikitext
15922 <!-- <statictag>hello, world</statictag> -->
15923 <statictag action=flush/>
15924 !! html/php
15925 <p><br />
15926 </p>
15927 !! end
15928
15929 # Nested template calls; this case was broken by Parser.php rev 1.506,
15930 # since reverted.
15931
15932 !! article
15933 Template:One-parameter
15934 !! text
15935 (My parameter is: {{{1}}})
15936 !! endarticle
15937
15938 !! article
15939 Template:Map-one-parameter
15940 !! text
15941 {{{{{1}}}|{{{2}}}}}
15942 !! endarticle
15943
15944 !! test
15945 Nested template calls
15946 !! wikitext
15947 {{Map-one-parameter|One-parameter|param}}
15948 !! html
15949 <p>(My parameter is: param)
15950 </p>
15951 !! end
15952
15953
15954 ###
15955 ### Sanitizer
15956 ###
15957
15958 # HTML+Tidy effectively strips out the empty tags completely
15959 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
15960 # which Tidy would have done for the PHP parser had there been content inside it.
15961 !! test
15962 Sanitizer: Closing of open tags
15963 !! wikitext
15964 <s></s><table></table>
15965 !! html
15966 <s></s><table></table>
15967
15968 !! html/parsoid
15969 <p><s></s></p><table></table>
15970 !! end
15971
15972 !! test
15973 Sanitizer: Closing of open but not closed tags
15974 !! wikitext
15975 <s>foo
15976 !! html
15977 <p><s>foo</s>
15978 </p>
15979 !! end
15980
15981 !! test
15982 Sanitizer: Closing of closed but not open tags
15983 !! options
15984 parsoid=wt2html
15985 !! wikitext
15986 </s>
15987 !! html/php+tidy
15988 !! html/parsoid
15989 !! end
15990
15991 !! test
15992 Sanitizer: Closing of closed but not open table tags
15993 !! options
15994 parsoid=wt2html
15995 !! wikitext
15996 Table not started</td></tr></table>
15997 !! html/php+tidy
15998 <p>Table not started</p>
15999 !! html/parsoid
16000 <p>Table not started</p>
16001 !! end
16002
16003 !! test
16004 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16005 !! wikitext
16006 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16007 !! html
16008 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16009 </p>
16010 !! end
16011
16012 # In HTML5, the restrictions are that id must contain at least one character,
16013 # and must not contain any space characters.
16014 !! test
16015 Sanitizer: Validating the contents of the id attribute (bug 4515)
16016 !! options
16017 disabled
16018 !! wikitext
16019 <br id="" /><br id="a space" />
16020 !! html
16021 Something ...
16022 !! end
16023
16024 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16025 !! test
16026 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16027 !! options
16028 disabled
16029 !! wikitext
16030 <br id="foo" /><br id="foo" />
16031 !! html
16032 Something need to be done. foo-2 ?
16033 !! end
16034
16035 !! test
16036 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16037 !! wikitext
16038 <div itemscope>
16039 <meta itemprop="hello" content="world">
16040 <meta http-equiv="refresh" content="5">
16041 <meta itemprop="hello" http-equiv="refresh" content="5">
16042 <link itemprop="hello" href="{{SERVER}}">
16043 <link rel="stylesheet" href="{{SERVER}}">
16044 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16045 </div>
16046 !! html
16047 <div itemscope="">
16048 <p> <meta itemprop="hello" content="world" />
16049 &lt;meta http-equiv="refresh" content="5"&gt;
16050 <meta itemprop="hello" content="5" />
16051 </p>
16052 <link itemprop="hello" href="http&#58;//example.org" />
16053 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16054 <link itemprop="hello" href="http&#58;//example.org" />
16055 </div>
16056
16057 !! end
16058
16059 !! test
16060 Language converter: output gets cut off unexpectedly (bug 5757)
16061 !! options
16062 language=zh
16063 !! wikitext
16064 this bit is safe: }-
16065
16066 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16067
16068 then we get cut off here: }-
16069
16070 all additional text is vanished
16071 !! html
16072 <p>this bit is safe: }-
16073 </p><p>but if we add a conversion instance: xxx
16074 </p><p>then we get cut off here: }-
16075 </p><p>all additional text is vanished
16076 </p>
16077 !! end
16078
16079 !! test
16080 Self closed html pairs (bug 5487)
16081 !! options
16082 !! wikitext
16083 <center><font id="bug" />Centered text</center>
16084 <div><font id="bug2" />In div text</div>
16085 !! html
16086 <center>&lt;font id="bug" /&gt;Centered text</center>
16087 <div>&lt;font id="bug2" /&gt;In div text</div>
16088
16089 !! end
16090
16091 #
16092 #
16093 #
16094
16095 !! test
16096 Punctuation: nbsp before exclamation
16097 !! wikitext
16098 C'est grave !
16099 !! html
16100 <p>C'est grave&#160;!
16101 </p>
16102 !! end
16103
16104 !! test
16105 Punctuation: CSS !important (bug 11874)
16106 !! wikitext
16107 <div style="width:50% !important">important</div>
16108 !! html
16109 <div style="width:50% !important">important</div>
16110
16111 !!end
16112
16113 !! test
16114 Punctuation: CSS ! important (bug 11874; with space after)
16115 !! wikitext
16116 <div style="width:50% ! important">important</div>
16117 !! html
16118 <div style="width:50% ! important">important</div>
16119
16120 !!end
16121
16122 !! test
16123 HTML bullet list, closed tags (bug 5497)
16124 !! wikitext
16125 <ul>
16126 <li>One</li>
16127 <li>Two</li>
16128 </ul>
16129 !! html/php
16130 <ul>
16131 <li>One</li>
16132 <li>Two</li>
16133 </ul>
16134
16135 !! html/parsoid
16136 <ul data-parsoid='{"stx":"html"}'>
16137 <li data-parsoid='{"stx":"html"}'>One</li>
16138 <li data-parsoid='{"stx":"html"}'>Two</li>
16139 </ul>
16140
16141 !! end
16142
16143 !! test
16144 HTML bullet list, unclosed tags (bug 5497)
16145 !! wikitext
16146 <ul>
16147 <li>One
16148 <li>Two
16149 </ul>
16150 !! html/php+tidy
16151 <ul>
16152 <li>One</li>
16153 <li>Two</li>
16154 </ul>
16155 !! html/parsoid
16156 <ul data-parsoid='{"stx":"html"}'>
16157 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16158 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16159 </ul>
16160
16161 !! end
16162
16163 !! test
16164 HTML ordered list, closed tags (bug 5497)
16165 !! wikitext
16166 <ol>
16167 <li>One</li>
16168 <li>Two</li>
16169 </ol>
16170 !! html/php
16171 <ol>
16172 <li>One</li>
16173 <li>Two</li>
16174 </ol>
16175
16176 !! html/parsoid
16177 <ol data-parsoid='{"stx":"html"}'>
16178 <li data-parsoid='{"stx":"html"}'>One</li>
16179 <li data-parsoid='{"stx":"html"}'>Two</li>
16180 </ol>
16181
16182 !! end
16183
16184 !! test
16185 HTML ordered list, unclosed tags (bug 5497)
16186 !! options
16187 !! wikitext
16188 <ol>
16189 <li>One
16190 <li>Two
16191 </ol>
16192 !! html/php+tidy
16193 <ol>
16194 <li>One</li>
16195 <li>Two</li>
16196 </ol>
16197 !! html/parsoid
16198 <ol data-parsoid='{"stx":"html"}'>
16199 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16200 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16201 </ol>
16202
16203 !! end
16204
16205 !! test
16206 HTML nested bullet list, closed tags (bug 5497)
16207 !! wikitext
16208 <ul>
16209 <li>One</li>
16210 <li>Two:
16211 <ul>
16212 <li>Sub-one</li>
16213 <li>Sub-two</li>
16214 </ul>
16215 </li>
16216 </ul>
16217 !! html
16218 <ul>
16219 <li>One</li>
16220 <li>Two:
16221 <ul>
16222 <li>Sub-one</li>
16223 <li>Sub-two</li>
16224 </ul>
16225 </li>
16226 </ul>
16227
16228 !! end
16229
16230 !! test
16231 HTML nested bullet list, open tags (bug 5497)
16232 !! wikitext
16233 <ul>
16234 <li>One
16235 <li>Two:
16236 <ul>
16237 <li>Sub-one
16238 <li>Sub-two
16239 </ul>
16240 </ul>
16241 !! html/php+tidy
16242 <ul>
16243 <li>One</li>
16244 <li>Two:
16245 <ul>
16246 <li>Sub-one</li>
16247 <li>Sub-two</li>
16248 </ul>
16249 </li>
16250 </ul>
16251 !! html/parsoid
16252 <ul>
16253 <li>One
16254 </li>
16255 <li>Two:
16256 <ul>
16257 <li>Sub-one
16258 </li>
16259 <li>Sub-two
16260 </li>
16261 </ul>
16262 </li>
16263 </ul>
16264
16265 !! end
16266
16267 !! test
16268 HTML nested ordered list, closed tags (bug 5497)
16269 !! wikitext
16270 <ol>
16271 <li>One</li>
16272 <li>Two:
16273 <ol>
16274 <li>Sub-one</li>
16275 <li>Sub-two</li>
16276 </ol>
16277 </li>
16278 </ol>
16279 !! html
16280 <ol>
16281 <li>One</li>
16282 <li>Two:
16283 <ol>
16284 <li>Sub-one</li>
16285 <li>Sub-two</li>
16286 </ol>
16287 </li>
16288 </ol>
16289
16290 !! end
16291
16292 !! test
16293 HTML nested ordered list, open tags (bug 5497)
16294 !! wikitext
16295 <ol>
16296 <li>One
16297 <li>Two:
16298 <ol>
16299 <li>Sub-one
16300 <li>Sub-two
16301 </ol>
16302 </ol>
16303 !! html/php
16304 <ol>
16305 <li>One
16306 <li>Two:
16307 <ol>
16308 <li>Sub-one
16309 <li>Sub-two
16310 </ol>
16311 </ol>
16312
16313 !! html/parsoid
16314 <ol>
16315 <li>One
16316 </li>
16317 <li>Two:
16318 <ol>
16319 <li>Sub-one
16320 </li>
16321 <li>Sub-two
16322 </li>
16323 </ol>
16324 </li>
16325 </ol>
16326
16327 !! end
16328
16329 !! test
16330 HTML ordered list item with parameters oddity
16331 !! wikitext
16332 <ol><li id="fragment">One</li>
16333 </ol>
16334 !! html
16335 <ol><li id="fragment">One</li>
16336 </ol>
16337
16338 !! end
16339
16340 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16341 !!test
16342 bug 5918: autonumbering
16343 !! wikitext
16344 [http://first/] [http://second] [ftp://ftp]
16345
16346 ftp://inlineftp
16347
16348 [mailto:enclosed@mail.tld With target]
16349
16350 [mailto:enclosed@mail.tld]
16351
16352 mailto:inline@mail.tld
16353 !! html/php
16354 <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>
16355 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16356 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16357 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16358 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16359 </p>
16360 !! html/parsoid
16361 <p><a rel="mw:ExtLink" href="http://first/"></a> <a rel="mw:ExtLink" href="http://second"></a> <a rel="mw:ExtLink" href="ftp://ftp"></a></p>
16362 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16363 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16364 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16365 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16366 !! end
16367
16368
16369 #
16370 # Security and HTML correctness
16371 # From Nick Jenkins' fuzz testing
16372 #
16373
16374 !! test
16375 Fuzz testing: Parser13
16376 !! wikitext
16377 {|
16378 | http://a|
16379 !! html
16380 <table>
16381 <tr>
16382 <td>
16383 </td>
16384 </tr>
16385 </table>
16386
16387 !! end
16388
16389 !! test
16390 Fuzz testing: Parser14
16391 !! wikitext
16392 == onmouseover= ==
16393 http://__TOC__
16394 !! html
16395 <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>
16396 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16397 <ul>
16398 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16399 </ul>
16400 </div>
16401
16402
16403 !! html+tidy
16404 <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>
16405 <p>http://</p>
16406 <div id="toc" class="toc">
16407 <div id="toctitle">
16408 <h2>Contents</h2>
16409 </div>
16410 <ul>
16411 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16412 </ul>
16413 </div>
16414 <p></p>
16415 !! end
16416
16417 !! test
16418 Fuzz testing: Parser14-table
16419 !! wikitext
16420 ==a==
16421 {| STYLE=__TOC__
16422 !! html
16423 <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>
16424 <table style="&#95;_TOC&#95;_">
16425 <tr><td></td></tr>
16426 </table>
16427
16428 !! html+tidy
16429 <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>
16430 <table style="__TOC__">
16431 <tr>
16432 <td></td>
16433 </tr>
16434 </table>
16435 !! end
16436
16437 # Known to produce bogus xml (extra </td>)
16438 !! test
16439 Fuzz testing: Parser16
16440 !! options
16441 noxml
16442 !! wikitext
16443 {|
16444 !https://||||||
16445 !! html
16446 <table>
16447 <tr>
16448 <th>https://</th>
16449 <th></th>
16450 <th></th>
16451 <th>
16452 </td>
16453 </tr>
16454 </table>
16455
16456 !! html+tidy
16457 <table>
16458 <tr>
16459 <th>https://</th>
16460 <th></th>
16461 <th></th>
16462 <th></th>
16463 </tr>
16464 </table>
16465 !! end
16466
16467 !! test
16468 Fuzz testing: Parser21
16469 !! wikitext
16470 {|
16471 ! irc://{{ftp://a" onmouseover="alert('hello world');"
16472 |
16473 !! html
16474 <table>
16475 <tr>
16476 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
16477 </th>
16478 <td>
16479 </td>
16480 </tr>
16481 </table>
16482
16483 !! end
16484
16485 !! test
16486 Fuzz testing: Parser22
16487 !! wikitext
16488 http://===r:::https://b
16489
16490 {|
16491 !! html
16492 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
16493 </p>
16494 <table>
16495 <tr><td></td></tr>
16496 </table>
16497
16498 !! end
16499
16500 # Known to produce bad XML for now
16501 !! test
16502 Fuzz testing: Parser24
16503 !! options
16504 noxml
16505 !! wikitext
16506 {|
16507 {{{|
16508 <u CLASS=
16509 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
16510 <br style="onmouseover='alert(document.cookie);' " />
16511
16512 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16513 |
16514 !! html
16515 <table>
16516 {{{|
16517 <u class="&#124;">}}}} &gt;
16518 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
16519
16520 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16521 <tr>
16522 <td></u>
16523 </td>
16524 </tr>
16525 </table>
16526
16527 !! end
16528
16529 # Note: the current result listed for this is not what the original one was,
16530 # but the original bug was JavaScript injection, which is fixed in any case.
16531 # It's not clear that the original result listed was any more correct than the
16532 # current one. Original result:
16533 # <p>{{{|
16534 # </p>
16535 # <li class="&#124;&#124;">
16536 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16537 !!test
16538 Fuzz testing: Parser25 (bug 6055)
16539 !! wikitext
16540 {{{
16541 |
16542 <LI CLASS=||
16543 >
16544 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
16545 !! html
16546 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16547 </p>
16548 !! end
16549
16550 !!test
16551 Fuzz testing: URL adjacent extension (with space, clean)
16552 !! wikitext
16553 http://example.com <nowiki>junk</nowiki>
16554 !! html/php
16555 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
16556 </p>
16557 !! html/parsoid
16558 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
16559 !! end
16560
16561 !!test
16562 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
16563 !! wikitext
16564 http://example.com<nowiki>junk</nowiki>
16565 !! html/php
16566 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
16567 </p>
16568 !! html/parsoid
16569 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
16570 !! end
16571
16572 !!test
16573 Fuzz testing: URL adjacent extension (no space, dirty; pre)
16574 !! wikitext
16575 http://example.com<pre>junk</pre>
16576 !! html/php
16577 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
16578
16579 !! html/php+tidy
16580 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
16581 <pre>
16582 junk
16583 </pre>
16584 !! html/parsoid
16585 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a></p><pre data-parsoid='{"stx":"html"}'>junk</pre>
16586 !!end
16587
16588 !!test
16589 Fuzz testing: image with bogus manual thumbnail
16590 !! wikitext
16591 [[Image:foobar.jpg|thumbnail= ]]
16592 !! html/php
16593 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
16594
16595 !! html/parsoid
16596 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,2,2]}' data-mw='{"errors":[{"key":"missing-thumbnail","message":"This thumbnail does not exist.","params":{"name":""}}],"thumb":""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{},"dsr":[2,30,null,null]}'><img resource="./File:Foobar.jpg" src="./Special:FilePath/" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"220"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
16597 !!end
16598
16599 !! test
16600 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
16601 !! wikitext
16602 <pre dir="&#10;"></pre>
16603 !! html
16604 <pre dir="&#10;"></pre>
16605
16606 !! end
16607
16608 !! test
16609 Parsing optional HTML elements (Bug 6171)
16610 !! options
16611 !! wikitext
16612 <table>
16613 <tr>
16614 <td> Some tabular data</td>
16615 <td> More tabular data ...
16616 <td> And yet som tabular data</td>
16617 </tr>
16618 </table>
16619 !! html
16620 <table>
16621 <tr>
16622 <td> Some tabular data</td>
16623 <td> More tabular data ...
16624 </td><td> And yet som tabular data</td>
16625 </tr>
16626 </table>
16627
16628 !! end
16629
16630 !! test
16631 Correct handling of <td>, <tr> (Bug 6171)
16632 !! options
16633 !! wikitext
16634 <table>
16635 <tr>
16636 <td> Some tabular data</td>
16637 <td> More tabular data ...</td>
16638 <td> And yet som tabular data</td>
16639 </tr>
16640 </table>
16641 !! html
16642 <table>
16643 <tr>
16644 <td> Some tabular data</td>
16645 <td> More tabular data ...</td>
16646 <td> And yet som tabular data</td>
16647 </tr>
16648 </table>
16649
16650 !! end
16651
16652
16653 !! test
16654 Parsing crashing regression (fr:JavaScript)
16655 !! wikitext
16656 </body></x>
16657 !! html
16658 <p>&lt;/body&gt;&lt;/x&gt;
16659 </p>
16660 !! end
16661
16662 !! test
16663 Inline wiki vs wiki block nesting
16664 !! wikitext
16665 '''Bold paragraph
16666
16667 New wiki paragraph
16668 !! html
16669 <p><b>Bold paragraph</b>
16670 </p><p>New wiki paragraph
16671 </p>
16672 !! end
16673
16674 # FIXME: The current php output is documented
16675 # and desired output is the parsoid target.
16676 !! test
16677 Inline HTML vs wiki block nesting
16678 !! wikitext
16679 <b>Bold paragraph
16680
16681 New wiki paragraph
16682 !! html/php
16683 <p><b>Bold paragraph
16684 </p><p>New wiki paragraph</b>
16685 </p>
16686 !! html/parsoid
16687 <p><b>Bold paragraph</b>
16688 </p><p>New wiki paragraph
16689 </p>
16690 !! end
16691
16692 # Original result was this:
16693 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
16694 # </p>
16695 # While that might be marginally more intuitive, maybe, the six-apostrophe
16696 # construct is clearly pathological and the result stated here (which is what
16697 # the parser actually does) is about as reasonable as anything.
16698 !!test
16699 Mixing markup for italics and bold
16700 !! options
16701 !! wikitext
16702 '''bold''''''bold''bolditalics'''''
16703 !! html
16704 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
16705 </p>
16706 !! end
16707
16708
16709 !! article
16710 Xyzzyx
16711 !! text
16712 Article for special page transclusion test
16713 !! endarticle
16714
16715 !! test
16716 Special page transclusion
16717 !! options
16718 !! wikitext
16719 {{Special:Prefixindex/Xyzzyx}}
16720 !! html
16721 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16722
16723 !! end
16724
16725 !! test
16726 Special page transclusion twice (bug 5021)
16727 !! options
16728 !! wikitext
16729 {{Special:Prefixindex/Xyzzyx}}
16730 {{Special:Prefixindex/Xyzzyx}}
16731 !! html
16732 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16733 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16734
16735 !! end
16736
16737 !! test
16738 Transclusion of default MediaWiki message
16739 !! wikitext
16740 {{MediaWiki:Mainpage}}
16741 !! html
16742 <p>Main Page
16743 </p>
16744 !! end
16745
16746 !! test
16747 Transclusion of nonexistent MediaWiki message
16748 !! wikitext
16749 {{MediaWiki:Mainpagexxx}}
16750 !! html
16751 <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>
16752 </p>
16753 !! end
16754
16755 !! test
16756 Transclusion of MediaWiki message with underscore
16757 !! wikitext
16758 {{MediaWiki:history_short}}
16759 !! html
16760 <p>History
16761 </p>
16762 !! end
16763
16764 !! test
16765 Transclusion of MediaWiki message with space
16766 !! wikitext
16767 {{MediaWiki:history short}}
16768 !! html
16769 <p>History
16770 </p>
16771 !! end
16772
16773 !! test
16774 Invalid header with following text
16775 !! wikitext
16776 = x = y
16777 !! html
16778 <p>= x = y
16779 </p>
16780 !! end
16781
16782
16783 !! test
16784 Section extraction test (section 0)
16785 !! options
16786 section=0
16787 !! wikitext
16788 start
16789 ==a==
16790 ===aa===
16791 ====aaa====
16792 ==b==
16793 ===ba===
16794 ===bb===
16795 ====bba====
16796 ===bc===
16797 ==c==
16798 ===ca===
16799 !! html/php
16800 start
16801 !! end
16802
16803 !! test
16804 Section extraction test (section 1)
16805 !! options
16806 section=1
16807 !! wikitext
16808 start
16809 ==a==
16810 ===aa===
16811 ====aaa====
16812 ==b==
16813 ===ba===
16814 ===bb===
16815 ====bba====
16816 ===bc===
16817 ==c==
16818 ===ca===
16819 !! html/php
16820 ==a==
16821 ===aa===
16822 ====aaa====
16823 !! end
16824
16825 !! test
16826 Section extraction test (section 2)
16827 !! options
16828 section=2
16829 !! wikitext
16830 start
16831 ==a==
16832 ===aa===
16833 ====aaa====
16834 ==b==
16835 ===ba===
16836 ===bb===
16837 ====bba====
16838 ===bc===
16839 ==c==
16840 ===ca===
16841 !! html/php
16842 ===aa===
16843 ====aaa====
16844 !! end
16845
16846 !! test
16847 Section extraction test (section 3)
16848 !! options
16849 section=3
16850 !! wikitext
16851 start
16852 ==a==
16853 ===aa===
16854 ====aaa====
16855 ==b==
16856 ===ba===
16857 ===bb===
16858 ====bba====
16859 ===bc===
16860 ==c==
16861 ===ca===
16862 !! html/php
16863 ====aaa====
16864 !! end
16865
16866 !! test
16867 Section extraction test (section 4)
16868 !! options
16869 section=4
16870 !! wikitext
16871 start
16872 ==a==
16873 ===aa===
16874 ====aaa====
16875 ==b==
16876 ===ba===
16877 ===bb===
16878 ====bba====
16879 ===bc===
16880 ==c==
16881 ===ca===
16882 !! html/php
16883 ==b==
16884 ===ba===
16885 ===bb===
16886 ====bba====
16887 ===bc===
16888 !! end
16889
16890 !! test
16891 Section extraction test (section 5)
16892 !! options
16893 section=5
16894 !! wikitext
16895 start
16896 ==a==
16897 ===aa===
16898 ====aaa====
16899 ==b==
16900 ===ba===
16901 ===bb===
16902 ====bba====
16903 ===bc===
16904 ==c==
16905 ===ca===
16906 !! html/php
16907 ===ba===
16908 !! end
16909
16910 !! test
16911 Section extraction test (section 6)
16912 !! options
16913 section=6
16914 !! wikitext
16915 start
16916 ==a==
16917 ===aa===
16918 ====aaa====
16919 ==b==
16920 ===ba===
16921 ===bb===
16922 ====bba====
16923 ===bc===
16924 ==c==
16925 ===ca===
16926 !! html/php
16927 ===bb===
16928 ====bba====
16929 !! end
16930
16931 !! test
16932 Section extraction test (section 7)
16933 !! options
16934 section=7
16935 !! wikitext
16936 start
16937 ==a==
16938 ===aa===
16939 ====aaa====
16940 ==b==
16941 ===ba===
16942 ===bb===
16943 ====bba====
16944 ===bc===
16945 ==c==
16946 ===ca===
16947 !! html/php
16948 ====bba====
16949 !! end
16950
16951 !! test
16952 Section extraction test (section 8)
16953 !! options
16954 section=8
16955 !! wikitext
16956 start
16957 ==a==
16958 ===aa===
16959 ====aaa====
16960 ==b==
16961 ===ba===
16962 ===bb===
16963 ====bba====
16964 ===bc===
16965 ==c==
16966 ===ca===
16967 !! html/php
16968 ===bc===
16969 !! end
16970
16971 !! test
16972 Section extraction test (section 9)
16973 !! options
16974 section=9
16975 !! wikitext
16976 start
16977 ==a==
16978 ===aa===
16979 ====aaa====
16980 ==b==
16981 ===ba===
16982 ===bb===
16983 ====bba====
16984 ===bc===
16985 ==c==
16986 ===ca===
16987 !! html/php
16988 ==c==
16989 ===ca===
16990 !! end
16991
16992 !! test
16993 Section extraction test (section 10)
16994 !! options
16995 section=10
16996 !! wikitext
16997 start
16998 ==a==
16999 ===aa===
17000 ====aaa====
17001 ==b==
17002 ===ba===
17003 ===bb===
17004 ====bba====
17005 ===bc===
17006 ==c==
17007 ===ca===
17008 !! html/php
17009 ===ca===
17010 !! end
17011
17012 !! test
17013 Section extraction test (nonexistent section 11)
17014 !! options
17015 section=11
17016 !! wikitext
17017 start
17018 ==a==
17019 ===aa===
17020 ====aaa====
17021 ==b==
17022 ===ba===
17023 ===bb===
17024 ====bba====
17025 ===bc===
17026 ==c==
17027 ===ca===
17028 !! html/php
17029 !! end
17030
17031 !! test
17032 Section extraction test with bogus heading (section 1)
17033 !! options
17034 section=1
17035 !! wikitext
17036 ==a==
17037 ==bogus== not a legal section
17038 ==b==
17039 !! html/php
17040 ==a==
17041 ==bogus== not a legal section
17042 !! end
17043
17044 !! test
17045 Section extraction test with bogus heading (section 2)
17046 !! options
17047 section=2
17048 !! wikitext
17049 ==a==
17050 ==bogus== not a legal section
17051 ==b==
17052 !! html/php
17053 ==b==
17054 !! end
17055
17056 !! test
17057 Section extraction test with comment after heading (section 1)
17058 !! options
17059 section=1
17060 !! wikitext
17061 ==a==
17062 ==b== <!-- -->
17063 ==c==
17064 !! html/php
17065 ==a==
17066 !! end
17067
17068 !! test
17069 Section extraction test with comment after heading (section 2)
17070 !! options
17071 section=2
17072 !! wikitext
17073 ==a==
17074 ==b== <!-- -->
17075 ==c==
17076 !! html/php
17077 ==b== <!-- -->
17078 !! end
17079
17080 !! test
17081 Section extraction test with bogus <nowiki> heading (section 1)
17082 !! options
17083 section=1
17084 !! wikitext
17085 ==a==
17086 ==bogus== <nowiki>not a legal section</nowiki>
17087 ==b==
17088 !! html/php
17089 ==a==
17090 ==bogus== <nowiki>not a legal section</nowiki>
17091 !! end
17092
17093 !! test
17094 Section extraction test with bogus <nowiki> heading (section 2)
17095 !! options
17096 section=2
17097 !! wikitext
17098 ==a==
17099 ==bogus== <nowiki>not a legal section</nowiki>
17100 ==b==
17101 !! html/php
17102 ==b==
17103 !! end
17104
17105 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17106 # instead of respecting commented sections
17107 !! test
17108 Section extraction prefixed by comment (section 1)
17109 !! options
17110 section=1
17111 !! wikitext
17112 <!-- -->==sec1==
17113 ==sec2==
17114 !! html/php
17115 ==sec2==
17116 !!end
17117
17118 !! test
17119 Section extraction prefixed by comment (section 2)
17120 !! options
17121 section=2
17122 !! wikitext
17123 <!-- -->==sec1==
17124 ==sec2==
17125 !! html/php
17126
17127 !!end
17128
17129 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17130 # instead of respecting HTML-style headings
17131 !! test
17132 Section extraction, mixed wiki and html (section 1)
17133 !! options
17134 section=1
17135 !! wikitext
17136 <h2>unmarked</h2>
17137 unmarked
17138 ==1==
17139 one
17140 ==2==
17141 two
17142 !! html/php
17143 ==1==
17144 one
17145 !! end
17146
17147 !! test
17148 Section extraction, mixed wiki and html (section 2)
17149 !! options
17150 section=2
17151 !! wikitext
17152 <h2>unmarked</h2>
17153 unmarked
17154 ==1==
17155 one
17156 ==2==
17157 two
17158 !! html/php
17159 ==2==
17160 two
17161 !! end
17162
17163
17164 # Formerly testing for bug 3342
17165 !! test
17166 Section extraction, heading surrounded by <noinclude>
17167 !! options
17168 section=1
17169 !! wikitext
17170 <noinclude>==unmarked==</noinclude>
17171 ==marked==
17172 !! html/php
17173 ==marked==
17174 !!end
17175
17176 # Test behavior of bug 19910
17177 !! test
17178 Sectiion with all-equals
17179 !! options
17180 section=2
17181 !! wikitext
17182 ===
17183 The line above must have a trailing space
17184 === <!--
17185 --> <!-- -->
17186 But just in case it doesn't...
17187 !! html/php
17188 === <!--
17189 --> <!-- -->
17190 But just in case it doesn't...
17191 !! end
17192
17193 !! test
17194 Section replacement test (section 0)
17195 !! options
17196 replace=0,"xxx"
17197 !! wikitext
17198 start
17199 ==a==
17200 ===aa===
17201 ====aaa====
17202 ==b==
17203 ===ba===
17204 ===bb===
17205 ====bba====
17206 ===bc===
17207 ==c==
17208 ===ca===
17209 !! html/php
17210 xxx
17211
17212 ==a==
17213 ===aa===
17214 ====aaa====
17215 ==b==
17216 ===ba===
17217 ===bb===
17218 ====bba====
17219 ===bc===
17220 ==c==
17221 ===ca===
17222 !! end
17223
17224 !! test
17225 Section replacement test (section 1)
17226 !! options
17227 replace=1,"xxx"
17228 !! wikitext
17229 start
17230 ==a==
17231 ===aa===
17232 ====aaa====
17233 ==b==
17234 ===ba===
17235 ===bb===
17236 ====bba====
17237 ===bc===
17238 ==c==
17239 ===ca===
17240 !! html/php
17241 start
17242 xxx
17243
17244 ==b==
17245 ===ba===
17246 ===bb===
17247 ====bba====
17248 ===bc===
17249 ==c==
17250 ===ca===
17251 !! end
17252
17253 !! test
17254 Section replacement test (section 2)
17255 !! options
17256 replace=2,"xxx"
17257 !! wikitext
17258 start
17259 ==a==
17260 ===aa===
17261 ====aaa====
17262 ==b==
17263 ===ba===
17264 ===bb===
17265 ====bba====
17266 ===bc===
17267 ==c==
17268 ===ca===
17269 !! html/php
17270 start
17271 ==a==
17272 xxx
17273
17274 ==b==
17275 ===ba===
17276 ===bb===
17277 ====bba====
17278 ===bc===
17279 ==c==
17280 ===ca===
17281 !! end
17282
17283 !! test
17284 Section replacement test (section 3)
17285 !! options
17286 replace=3,"xxx"
17287 !! wikitext
17288 start
17289 ==a==
17290 ===aa===
17291 ====aaa====
17292 ==b==
17293 ===ba===
17294 ===bb===
17295 ====bba====
17296 ===bc===
17297 ==c==
17298 ===ca===
17299 !! html/php
17300 start
17301 ==a==
17302 ===aa===
17303 xxx
17304
17305 ==b==
17306 ===ba===
17307 ===bb===
17308 ====bba====
17309 ===bc===
17310 ==c==
17311 ===ca===
17312 !! end
17313
17314 !! test
17315 Section replacement test (section 4)
17316 !! options
17317 replace=4,"xxx"
17318 !! wikitext
17319 start
17320 ==a==
17321 ===aa===
17322 ====aaa====
17323 ==b==
17324 ===ba===
17325 ===bb===
17326 ====bba====
17327 ===bc===
17328 ==c==
17329 ===ca===
17330 !! html/php
17331 start
17332 ==a==
17333 ===aa===
17334 ====aaa====
17335 xxx
17336
17337 ==c==
17338 ===ca===
17339 !! end
17340
17341 !! test
17342 Section replacement test (section 5)
17343 !! options
17344 replace=5,"xxx"
17345 !! wikitext
17346 start
17347 ==a==
17348 ===aa===
17349 ====aaa====
17350 ==b==
17351 ===ba===
17352 ===bb===
17353 ====bba====
17354 ===bc===
17355 ==c==
17356 ===ca===
17357 !! html/php
17358 start
17359 ==a==
17360 ===aa===
17361 ====aaa====
17362 ==b==
17363 xxx
17364
17365 ===bb===
17366 ====bba====
17367 ===bc===
17368 ==c==
17369 ===ca===
17370 !! end
17371
17372 !! test
17373 Section replacement test (section 6)
17374 !! options
17375 replace=6,"xxx"
17376 !! wikitext
17377 start
17378 ==a==
17379 ===aa===
17380 ====aaa====
17381 ==b==
17382 ===ba===
17383 ===bb===
17384 ====bba====
17385 ===bc===
17386 ==c==
17387 ===ca===
17388 !! html/php
17389 start
17390 ==a==
17391 ===aa===
17392 ====aaa====
17393 ==b==
17394 ===ba===
17395 xxx
17396
17397 ===bc===
17398 ==c==
17399 ===ca===
17400 !! end
17401
17402 !! test
17403 Section replacement test (section 7)
17404 !! options
17405 replace=7,"xxx"
17406 !! wikitext
17407 start
17408 ==a==
17409 ===aa===
17410 ====aaa====
17411 ==b==
17412 ===ba===
17413 ===bb===
17414 ====bba====
17415 ===bc===
17416 ==c==
17417 ===ca===
17418 !! html/php
17419 start
17420 ==a==
17421 ===aa===
17422 ====aaa====
17423 ==b==
17424 ===ba===
17425 ===bb===
17426 xxx
17427
17428 ===bc===
17429 ==c==
17430 ===ca===
17431 !! end
17432
17433 !! test
17434 Section replacement test (section 8)
17435 !! options
17436 replace=8,"xxx"
17437 !! wikitext
17438 start
17439 ==a==
17440 ===aa===
17441 ====aaa====
17442 ==b==
17443 ===ba===
17444 ===bb===
17445 ====bba====
17446 ===bc===
17447 ==c==
17448 ===ca===
17449 !! html/php
17450 start
17451 ==a==
17452 ===aa===
17453 ====aaa====
17454 ==b==
17455 ===ba===
17456 ===bb===
17457 ====bba====
17458 xxx
17459
17460 ==c==
17461 ===ca===
17462 !!end
17463
17464 !! test
17465 Section replacement test (section 9)
17466 !! options
17467 replace=9,"xxx"
17468 !! wikitext
17469 start
17470 ==a==
17471 ===aa===
17472 ====aaa====
17473 ==b==
17474 ===ba===
17475 ===bb===
17476 ====bba====
17477 ===bc===
17478 ==c==
17479 ===ca===
17480 !! html/php
17481 start
17482 ==a==
17483 ===aa===
17484 ====aaa====
17485 ==b==
17486 ===ba===
17487 ===bb===
17488 ====bba====
17489 ===bc===
17490 xxx
17491 !! end
17492
17493 !! test
17494 Section replacement test (section 10)
17495 !! options
17496 replace=10,"xxx"
17497 !! wikitext
17498 start
17499 ==a==
17500 ===aa===
17501 ====aaa====
17502 ==b==
17503 ===ba===
17504 ===bb===
17505 ====bba====
17506 ===bc===
17507 ==c==
17508 ===ca===
17509 !! html/php
17510 start
17511 ==a==
17512 ===aa===
17513 ====aaa====
17514 ==b==
17515 ===ba===
17516 ===bb===
17517 ====bba====
17518 ===bc===
17519 ==c==
17520 xxx
17521 !! end
17522
17523 !! test
17524 Section replacement test with initial whitespace (bug 13728)
17525 !! options
17526 replace=2,"xxx"
17527 !! wikitext
17528 Preformatted initial line
17529 ==a==
17530 ===a===
17531 !! html/php
17532 Preformatted initial line
17533 ==a==
17534 xxx
17535 !! end
17536
17537
17538 !! test
17539 Section extraction, heading followed by pre with 20 spaces (bug 6398)
17540 !! options
17541 section=1
17542 !! wikitext
17543 ==a==
17544 a
17545 !! html/php
17546 ==a==
17547 a
17548 !! end
17549
17550 !! test
17551 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
17552 !! options
17553 section=1
17554 !! wikitext
17555 ==a==
17556 a
17557 !! html/php
17558 ==a==
17559 a
17560 !! end
17561
17562
17563 !! test
17564 Section extraction, <pre> around bogus header (bug 10309)
17565 !! options
17566 noxml section=2
17567 !! wikitext
17568 == Section One ==
17569 <pre>
17570 =======
17571 </pre>
17572
17573 == Section Two ==
17574 stuff
17575 !! html/php
17576 == Section Two ==
17577 stuff
17578 !! end
17579
17580 !! test
17581 Section replacement, <pre> around bogus header (bug 10309)
17582 !! options
17583 noxml replace=2,"xxx"
17584 !! wikitext
17585 == Section One ==
17586 <pre>
17587 =======
17588 </pre>
17589
17590 == Section Two ==
17591 stuff
17592 !! html/php
17593 == Section One ==
17594 <pre>
17595 =======
17596 </pre>
17597
17598 xxx
17599 !! end
17600
17601
17602 !! test
17603 Handling of &#x0A; in URLs
17604 !! wikitext
17605 ** irc://&#x0A;a
17606 !! html/php
17607 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17608
17609 !! html/parsoid
17610 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
17611 a">irc://
17612 a</a></li></ul></li></ul>
17613 !! end
17614
17615 !! test
17616 Handling of %0A in URLs
17617 !! wikitext
17618 ** irc://%0Aa
17619 !! html/php
17620 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17621
17622 !! html/parsoid
17623 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17624 !! end
17625
17626
17627 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
17628 !! test
17629 5 quotes, code coverage +1 line
17630 !! options
17631 parsoid=wt2html
17632 !! wikitext
17633 '''''
17634 !! html/php
17635 !! html/parsoid
17636 <p><b><i></i></b></p>
17637 !! end
17638
17639 # same html as previous, but wikitext adjusted to match parsoid html2wt
17640 # note that wt2html and html2html will put the <i> before the <b>
17641 !! test
17642 5 quotes, code coverage +1 line w/ nowiki (1)
17643 !! options
17644 parsoid=wt2wt,html2wt
17645 !! wikitext
17646 '''''<nowiki/>'''''
17647 !! html/php
17648 <p><i></i>
17649 </p>
17650 !! html/parsoid
17651 <p><b><i></i></b></p>
17652 !! end
17653
17654 # same as previous, just swapping the <i> and <b>
17655 !! test
17656 5 quotes, code coverage +1 line w/ nowiki (2)
17657 !! wikitext
17658 '''''<nowiki/>'''''
17659 !! html/php
17660 <p><i></i>
17661 </p>
17662 !! html/parsoid
17663 <p><i><b></b></i></p>
17664 !! end
17665
17666 !! test
17667 Special:Search page linking.
17668 !! wikitext
17669 {{Special:search}}
17670 !! html
17671 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
17672 </p>
17673 !! end
17674
17675 !! test
17676 {{!}} is a magic word
17677 !! wikitext
17678 {{!}} is a magic word there and {{!}} is still a magic word here
17679 !! html/php
17680 <p>| is a magic word there and | is still a magic word here
17681 </p>
17682 !! html/parsoid
17683 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}' data-parsoid='{"pi":[[]]}'>|</span> is a magic word there and <span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}' data-parsoid='{"pi":[[]]}'>|</span> is still a magic word here</p>
17684 !! end
17685
17686 !! test
17687 Say the magic word
17688 !! options
17689 title=[[Parser test]]
17690 !! wikitext
17691 * {{PAGENAME}}
17692 * {{PAGENAMEE}}
17693 * {{FULLPAGENAME}}
17694 * {{FULLPAGENAMEE}}
17695 * {{BASEPAGENAME}}
17696 * {{BASEPAGENAMEE}}
17697 * {{SUBPAGENAME}}
17698 * {{SUBPAGENAMEE}}
17699 * {{ROOTPAGENAME}}
17700 * {{ROOTPAGENAMEE}}
17701 * {{TALKPAGENAME}}
17702 * {{TALKPAGENAMEE}}
17703 * {{SUBJECTPAGENAME}}
17704 * {{SUBJECTPAGENAMEE}}
17705 * {{NAMESPACEE}}
17706 * {{NAMESPACE}}
17707 * {{NAMESPACENUMBER}}
17708 * {{TALKSPACE}}
17709 * {{TALKSPACEE}}
17710 * {{SUBJECTSPACE}}
17711 * {{SUBJECTSPACEE}}
17712 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
17713 !! html
17714 <ul><li> Parser test</li>
17715 <li> Parser_test</li>
17716 <li> Parser test</li>
17717 <li> Parser_test</li>
17718 <li> Parser test</li>
17719 <li> Parser_test</li>
17720 <li> Parser test</li>
17721 <li> Parser_test</li>
17722 <li> Parser test</li>
17723 <li> Parser_test</li>
17724 <li> Talk:Parser test</li>
17725 <li> Talk:Parser_test</li>
17726 <li> Parser test</li>
17727 <li> Parser_test</li>
17728 <li> </li>
17729 <li> </li>
17730 <li> 0</li>
17731 <li> Talk</li>
17732 <li> Talk</li>
17733 <li> </li>
17734 <li> </li>
17735 <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></li></ul>
17736
17737 !! end
17738 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
17739
17740 !! test
17741 Gallery
17742 !! wikitext
17743 <gallery>
17744 image1.png |
17745 image2.gif|||||
17746
17747 image3|
17748 image4 |300px| centre
17749 image5.svg| http://///////
17750 [[x|xx]]]]
17751 * image6
17752 </gallery>
17753 !! html
17754 <ul class="gallery mw-gallery-traditional">
17755 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17756 <div class="thumb" style="height: 150px;">Image1.png</div>
17757 <div class="gallerytext">
17758 </div>
17759 </div></li>
17760 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17761 <div class="thumb" style="height: 150px;">Image2.gif</div>
17762 <div class="gallerytext">
17763 <p>||||
17764 </p>
17765 </div>
17766 </div></li>
17767 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17768 <div class="thumb" style="height: 150px;">Image3</div>
17769 <div class="gallerytext">
17770 </div>
17771 </div></li>
17772 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17773 <div class="thumb" style="height: 150px;">Image4</div>
17774 <div class="gallerytext">
17775 <p>300px| centre
17776 </p>
17777 </div>
17778 </div></li>
17779 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17780 <div class="thumb" style="height: 150px;">Image5.svg</div>
17781 <div class="gallerytext">
17782 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
17783 </p>
17784 </div>
17785 </div></li>
17786 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17787 <div class="thumb" style="height: 150px;">* image6</div>
17788 <div class="gallerytext">
17789 </div>
17790 </div></li>
17791 </ul>
17792
17793 !! end
17794
17795 !! test
17796 Gallery (with options)
17797 !! wikitext
17798 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
17799 File:Nonexistent.jpg|caption
17800 File:Nonexistent.jpg
17801 image:foobar.jpg|some '''caption''' [[Main Page]]
17802 image:foobar.jpg
17803 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
17804 </gallery>
17805 !! html
17806 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
17807 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
17808 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17809 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17810 <div class="gallerytext">
17811 <p>caption
17812 </p>
17813 </div>
17814 </div></li>
17815 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17816 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17817 <div class="gallerytext">
17818 </div>
17819 </div></li>
17820 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17821 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
17822 <div class="gallerytext">
17823 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17824 </p>
17825 </div>
17826 </div></li>
17827 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17828 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
17829 <div class="gallerytext">
17830 </div>
17831 </div></li>
17832 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17833 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
17834 <div class="gallerytext">
17835 <p>Blabla|blabla.
17836 </p>
17837 </div>
17838 </div></li>
17839 </ul>
17840
17841 !! end
17842
17843 !! test
17844 Gallery with link that has fragment
17845 !! wikitext
17846 <gallery>
17847 image:foobar.jpg|link=Main_Page
17848 image:foobar.jpg|link=Main_Page#section
17849 image:foobar.jpg|link=Main Page#section|caption
17850 </gallery>
17851 !! html
17852 <ul class="gallery mw-gallery-traditional">
17853 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17854 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17855 <div class="gallerytext">
17856 </div>
17857 </div></li>
17858 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17859 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17860 <div class="gallerytext">
17861 </div>
17862 </div></li>
17863 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17864 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17865 <div class="gallerytext">
17866 <p>caption
17867 </p>
17868 </div>
17869 </div></li>
17870 </ul>
17871
17872 !! end
17873
17874 !! test
17875 Gallery with wikitext inside caption
17876 !! wikitext
17877 <gallery>
17878 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
17879 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
17880 </gallery>
17881 !! html
17882 <ul class="gallery mw-gallery-traditional">
17883 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17884 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17885 <div class="gallerytext">
17886 <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>
17887 </p>
17888 </div>
17889 </div></li>
17890 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17891 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17892 <div class="gallerytext">
17893 <p>This is a test template
17894 </p>
17895 </div>
17896 </div></li>
17897 </ul>
17898
17899 !! end
17900
17901 !! test
17902 gallery (with showfilename option)
17903 !! wikitext
17904 <gallery showfilename>
17905 File:Nonexistent.jpg|caption
17906 File:Nonexistent.jpg
17907 image:foobar.jpg|some '''caption''' [[Main Page]]
17908 File:Foobar.jpg
17909 </gallery>
17910 !! html
17911 <ul class="gallery mw-gallery-traditional">
17912 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17913 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17914 <div class="gallerytext">
17915 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17916 caption
17917 </p>
17918 </div>
17919 </div></li>
17920 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17921 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17922 <div class="gallerytext">
17923 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17924 </p>
17925 </div>
17926 </div></li>
17927 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17928 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17929 <div class="gallerytext">
17930 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17931 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17932 </p>
17933 </div>
17934 </div></li>
17935 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17936 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17937 <div class="gallerytext">
17938 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17939 </p>
17940 </div>
17941 </div></li>
17942 </ul>
17943
17944 !! end
17945
17946 !! test
17947 Gallery (with namespace-less filenames)
17948 !! wikitext
17949 <gallery>
17950 File:Nonexistent.jpg
17951 Nonexistent.jpg
17952 image:foobar.jpg
17953 foobar.jpg
17954 </gallery>
17955 !! html
17956 <ul class="gallery mw-gallery-traditional">
17957 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17958 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17959 <div class="gallerytext">
17960 </div>
17961 </div></li>
17962 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17963 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17964 <div class="gallerytext">
17965 </div>
17966 </div></li>
17967 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17968 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17969 <div class="gallerytext">
17970 </div>
17971 </div></li>
17972 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17973 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17974 <div class="gallerytext">
17975 </div>
17976 </div></li>
17977 </ul>
17978
17979 !! end
17980
17981 !! test
17982 HTML Hex character encoding (spells the word "JavaScript")
17983 !! options
17984 parsoid=wt2html,wt2wt,html2html
17985 !! wikitext
17986 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
17987 !! html/php
17988 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
17989 </p>
17990 !! html/php+tidy
17991 <p>JavaScript</p>
17992 !! html/parsoid
17993 <p><span typeof="mw:Entity">J</span><span typeof="mw:Entity">a</span><span typeof="mw:Entity">v</span><span typeof="mw:Entity">a</span><span typeof="mw:Entity">S</span><span typeof="mw:Entity">c</span><span typeof="mw:Entity">r</span><span typeof="mw:Entity">i</span><span typeof="mw:Entity">p</span><span typeof="mw:Entity">t</span></p>
17994 !! end
17995
17996 !! test
17997 HTML Hex character encoding bogus encoding (bug 26437 regression check)
17998 !! wikitext
17999 &#xsee;&#XSEE;
18000 !! html/php
18001 <p>&amp;#xsee;&amp;#XSEE;
18002 </p>
18003 !! html/parsoid
18004 <p>&amp;#xsee;&amp;#XSEE;</p>
18005 !! end
18006
18007 !! test
18008 HTML Hex character encoding mixed case
18009 !! options
18010 parsoid=wt2html,wt2wt,html2html
18011 !! wikitext
18012 &#xEE;&#Xee;
18013 !! html/php
18014 <p>&#xee;&#xee;
18015 </p>
18016 !! html/php+tidy
18017 <p>îî</p>
18018 !! html/parsoid
18019 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18020 !! end
18021
18022 !! test
18023 __FORCETOC__ override
18024 !! wikitext
18025 __NEWSECTIONLINK__
18026 __FORCETOC__
18027 !! html/php
18028 <p><br />
18029 </p>
18030 !! end
18031
18032 !! test
18033 ISBN code coverage
18034 !! wikitext
18035 ISBN 978-0-1234-56&#x20;789
18036 !! html
18037 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18038 </p>
18039 !! html+tidy
18040 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18041 !! html/parsoid
18042 <p><a href="./Special:BookSources/9780123456" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>789</p>
18043 !! end
18044
18045 !! test
18046 ISBN followed by 5 spaces
18047 !! wikitext
18048 ISBN
18049 !! html
18050 <p>ISBN
18051 </p>
18052 !! end
18053
18054 !! test
18055 Double ISBN
18056 !! wikitext
18057 ISBN ISBN 1234567890
18058 !! html/php
18059 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18060 </p>
18061 !! html/parsoid
18062 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18063 !! end
18064
18065 !! test
18066 ISBN with an X
18067 !! wikitext
18068 ISBN 3-462-04561-X
18069 ISBN 080442957X
18070 ISBN 978080442957X
18071 !! html/php
18072 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18073 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18074 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18075 </p>
18076 !! html/parsoid
18077 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18078 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18079 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a></p>
18080 !! end
18081
18082 !! test
18083 ISBN with empty prefix (parsoid test)
18084 !! wikitext
18085 ISBN 1234567890
18086 !! html/php
18087 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18088 </p>
18089 !! html/parsoid
18090 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
18091 !! end
18092
18093 !! test
18094 Bug 22905: <abbr> followed by ISBN followed by </a>
18095 !! wikitext
18096 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18097 !! html/php
18098 <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>
18099 </p>
18100 !! html/parsoid
18101 <p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" href="http://www.example.com">example.com</a></p>
18102 !! end
18103
18104 !! test
18105 Double RFC
18106 !! wikitext
18107 RFC RFC 1234
18108 !! html
18109 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18110 </p>
18111 !! end
18112
18113 !! test
18114 Double RFC with a wiki link
18115 !! wikitext
18116 RFC [[RFC 1234]]
18117 !! html
18118 <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>
18119 </p>
18120 !! end
18121
18122 !! test
18123 RFC code coverage
18124 !! wikitext
18125 RFC 983&#x20;987
18126 !! html
18127 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18128 </p>
18129 !! html+tidy
18130 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18131 !! end
18132
18133 !! test
18134 Centre-aligned image
18135 !! wikitext
18136 [[Image:foobar.jpg|centre]]
18137 !! html
18138 <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>
18139
18140 !!end
18141
18142 !! test
18143 None-aligned image
18144 !! wikitext
18145 [[Image:foobar.jpg|none]]
18146 !! html
18147 <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>
18148
18149 !!end
18150
18151 !! test
18152 Width + Height sized image (using px) (height is ignored)
18153 !! wikitext
18154 [[Image:foobar.jpg|640x480px]]
18155 !! html
18156 <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>
18157 </p>
18158 !!end
18159
18160 !! test
18161 Width-sized image (using px, no following whitespace)
18162 !! wikitext
18163 [[Image:foobar.jpg|640px]]
18164 !! html
18165 <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>
18166 </p>
18167 !!end
18168
18169 !! test
18170 Width-sized image (using px, with following whitespace - test regression from r39467)
18171 !! wikitext
18172 [[Image:foobar.jpg|640px ]]
18173 !! html
18174 <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>
18175 </p>
18176 !!end
18177
18178 !! test
18179 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18180 !! wikitext
18181 [[Image:foobar.jpg| 640px]]
18182 !! html
18183 <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>
18184 </p>
18185 !!end
18186
18187 !! test
18188 Image with page parameter
18189 !! options
18190 djvu
18191 !! wikitext
18192 [[File:LoremIpsum.djvu|page=2]]
18193 !! html/php
18194 <p><a href="/index.php?title=File:LoremIpsum.djvu&amp;page=2" class="image"><img alt="LoremIpsum.djvu" src="http://example.com/images/thumb/5/5f/LoremIpsum.djvu/page2-2480px-LoremIpsum.djvu.jpg" width="2480" height="3508" srcset="http://example.com/images/thumb/5/5f/LoremIpsum.djvu/page2-3720px-LoremIpsum.djvu.jpg 1.5x, http://example.com/images/thumb/5/5f/LoremIpsum.djvu/page2-4960px-LoremIpsum.djvu.jpg 2x" /></a>
18195 </p>
18196 !! html/parsoid
18197 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"page","ak":"page=2"}]}'><a href="./File:LoremIpsum.djvu" data-parsoid='{"a":{"href":"./File:LoremIpsum.djvu"},"sa":{}}'><img resource="./File:LoremIpsum.djvu" src="//example.com/images/5/5f/LoremIpsum.djvu" data-file-width="2480" data-file-height="3508" data-file-type="bitmap" height="3508" width="2480" data-parsoid='{"a":{"resource":"./File:LoremIpsum.djvu","height":"3508","width":"2480"},"sa":{"resource":"File:LoremIpsum.djvu"}}'/></a></span></p>
18198 !! end
18199
18200 !! test
18201 Another italics / bold test
18202 !! wikitext
18203 ''' ''x'
18204 !! html
18205 <pre>'<i> </i>x'
18206 </pre>
18207 !!end
18208
18209 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18210 !! test
18211 dt/dd/dl test
18212 !! wikitext
18213 :;;;::
18214 !! html/php
18215 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18216
18217 !! html/parsoid
18218 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18219
18220 !!end
18221
18222
18223 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18224 !! test
18225 Images with the "|" character in the comment
18226 !! wikitext
18227 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18228 !! html/php
18229 <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"></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx">external</a> URL</div></div></div>
18230
18231 !! html/parsoid
18232 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>An <a rel="mw:ExtLink" href="http://test/?param1=|left|&amp;param2=|x">external</a> URL</figcaption></figure>
18233 !! end
18234
18235 !! test
18236 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18237 !! wikitext
18238 <html><script>alert(1);</script></html>
18239 !! html
18240 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18241 </p>
18242 !! end
18243
18244 !! test
18245 HTML with raw HTML ($wgRawHtml==true)
18246 !! options
18247 wgRawHtml=1
18248 !! wikitext
18249 <html><script>alert(1);</script></html>
18250 !! html
18251 <p><script>alert(1);</script>
18252 </p>
18253 !! end
18254
18255 !! test
18256 Parents of subpages, one level up
18257 !! options
18258 subpage title=[[Subpage test/L1/L2/L3]]
18259 !! wikitext
18260 [[../|L2]]
18261 !! html
18262 <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>
18263 </p>
18264 !! end
18265
18266
18267 !! test
18268 Parents of subpages, one level up, not named
18269 !! options
18270 subpage title=[[Subpage test/L1/L2/L3]]
18271 !! wikitext
18272 [[../]]
18273 !! html
18274 <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>
18275 </p>
18276 !! end
18277
18278
18279
18280 !! test
18281 Parents of subpages, two levels up
18282 !! options
18283 subpage title=[[Subpage test/L1/L2/L3]]
18284 !! wikitext
18285 [[../../|L1]]2
18286
18287 [[../../|L1]]l
18288 !! html
18289 <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
18290 </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>
18291 </p>
18292 !! end
18293
18294 !! test
18295 Parents of subpages, two levels up, without trailing slash or name.
18296 !! options
18297 subpage title=[[Subpage test/L1/L2/L3]]
18298 !! wikitext
18299 [[../..]]
18300 !! html
18301 <p>[[../..]]
18302 </p>
18303 !! end
18304
18305 !! test
18306 Parents of subpages, two levels up, with lots of extra trailing slashes.
18307 !! options
18308 subpage title=[[Subpage test/L1/L2/L3]]
18309 !! wikitext
18310 [[../../////]]
18311 !! html
18312 <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)">Subpage test/L1</a>
18313 </p>
18314 !! end
18315
18316 !! article
18317 Subpage test/L1/L2/L3Sibling
18318 !! text
18319 Sibling article
18320 !! endarticle
18321
18322 !! test
18323 Transclusion of a sibling page (one level up)
18324 !! options
18325 subpage title=[[Subpage test/L1/L2/L3]]
18326 !! wikitext
18327 {{../L3Sibling}}
18328 !! html
18329 <p>Sibling article
18330 </p>
18331 !! end
18332
18333 !! test
18334 Transclusion of a child page
18335 !! options
18336 subpage title=[[Subpage test/L1/L2]]
18337 !! wikitext
18338 {{/L3Sibling}}
18339 !! html
18340 <p>Sibling article
18341 </p>
18342 !! end
18343
18344 !! test
18345 Non-transclusion because of too many up levels
18346 !! options
18347 subpage title=[[Subpage test/L1/L2/L3]]
18348 !! wikitext
18349 {{../../../../More than parent}}
18350 !! html
18351 <p>{{../../../../More than parent}}
18352 </p>
18353 !! end
18354
18355 !! test
18356 Definition list code coverage
18357 !! wikitext
18358 ; title : def
18359 ; title : def
18360 ;title: def
18361 !! html/php
18362 <dl><dt> title &#160;</dt>
18363 <dd> def</dd>
18364 <dt> title&#160;</dt>
18365 <dd> def</dd>
18366 <dt>title</dt>
18367 <dd> def</dd></dl>
18368
18369 !! html/parsoid
18370 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18371 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18372 <dt>title</dt><dd> def</dd></dl>
18373 !! end
18374
18375 !! test
18376 Don't fall for the self-closing div
18377 !! wikitext
18378 <div>hello world</div/>
18379 !! html
18380 <div>hello world</div>
18381
18382 !! end
18383
18384 !! test
18385 MSGNW magic word
18386 !! wikitext
18387 {{MSGNW:msg}}
18388 !! html/php
18389 <p>&#91;&#91;:Template:Msg&#93;&#93;
18390 </p>
18391 !! end
18392
18393 !! test
18394 RAW magic word
18395 !! wikitext
18396 {{RAW:QUERTY}}
18397 !! html
18398 <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>
18399 </p>
18400 !! end
18401
18402 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
18403 !! test
18404 Always escape literal '>' in output, not just after '<'
18405 !! wikitext
18406 ><>
18407 !! html
18408 <p>&gt;&lt;&gt;
18409 </p>
18410 !! end
18411
18412 !! test
18413 Template caching
18414 !! wikitext
18415 {{Test}}
18416 {{Test}}
18417 !! html
18418 <p>This is a test template
18419 This is a test template
18420 </p>
18421 !! end
18422
18423
18424 !! article
18425 MediaWiki:Fake
18426 !! text
18427 ==header==
18428 !! endarticle
18429
18430 !! test
18431 Inclusion of !userCanEdit() content
18432 !! wikitext
18433 {{MediaWiki:Fake}}
18434 !! html
18435 <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>
18436
18437 !! end
18438
18439
18440 !! test
18441 Out-of-order TOC heading levels
18442 !! wikitext
18443 ==2==
18444 ======6======
18445 ===3===
18446 =1=
18447 =====5=====
18448 ==2==
18449 !! html
18450 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18451 <ul>
18452 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
18453 <ul>
18454 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
18455 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
18456 </ul>
18457 </li>
18458 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
18459 <ul>
18460 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
18461 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
18462 </ul>
18463 </li>
18464 </ul>
18465 </div>
18466
18467 <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>
18468 <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>
18469 <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>
18470 <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>
18471 <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>
18472 <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>
18473
18474 !! end
18475
18476
18477 !! test
18478 ISBN with a dummy number
18479 !! wikitext
18480 ISBN ---
18481 !! html
18482 <p>ISBN ---
18483 </p>
18484 !! end
18485
18486
18487 !! test
18488 ISBN with space-delimited number
18489 !! wikitext
18490 ISBN 92 9017 032 8
18491 !! html
18492 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
18493 </p>
18494 !! end
18495
18496
18497 !! test
18498 ISBN with multiple spaces, no number
18499 !! wikitext
18500 ISBN foo
18501 !! html
18502 <p>ISBN foo
18503 </p>
18504 !! end
18505
18506
18507 !! test
18508 ISBN length
18509 !! wikitext
18510 ISBN 123456789
18511
18512 ISBN 1234567890
18513
18514 ISBN 12345678901
18515 !! html
18516 <p>ISBN 123456789
18517 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18518 </p><p>ISBN 12345678901
18519 </p>
18520 !! end
18521
18522
18523 !! test
18524 ISBN with trailing year (bug 8110)
18525 !! wikitext
18526 ISBN 1-234-56789-0 - 2006
18527
18528 ISBN 1 234 56789 0 - 2006
18529 !! html
18530 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
18531 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
18532 </p>
18533 !! end
18534
18535
18536 !! test
18537 anchorencode
18538 !! wikitext
18539 {{anchorencode:foo bar©#%n}}
18540 !! html
18541 <p>foo_bar.C2.A9.23.25n
18542 </p>
18543 !! end
18544
18545 !! test
18546 anchorencode trims spaces
18547 !! wikitext
18548 {{anchorencode: __pretty__please__}}
18549 !! html
18550 <p>pretty_please
18551 </p>
18552 !! end
18553
18554 !! test
18555 anchorencode deals with links
18556 !! wikitext
18557 {{anchorencode: [[hello|world]] [[hi]]}}
18558 !! html
18559 <p>world_hi
18560 </p>
18561 !! end
18562
18563 !! test
18564 anchorencode deals with templates
18565 !! wikitext
18566 {{anchorencode: {{Foo}} }}
18567 !! html
18568 <p>FOO
18569 </p>
18570 !! end
18571
18572 !! test
18573 anchorencode encodes like the TOC generator: (bug 18431)
18574 !! wikitext
18575 === _ +:.3A%3A&&amp;]] ===
18576 {{anchorencode: _ +:.3A%3A&&amp;]] }}
18577 __NOEDITSECTION__
18578 !! html
18579 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
18580 <p>.2B:.3A.253A.26.26.5D.5D
18581 </p>
18582 !! end
18583
18584 !! test
18585 Bug 6200: blockquotes and paragraph formatting
18586 !! wikitext
18587 <blockquote>
18588 foo
18589 </blockquote>
18590
18591 bar
18592
18593 baz
18594 !! html
18595 <blockquote>
18596 <p>foo
18597 </p>
18598 </blockquote>
18599 <p>bar
18600 </p>
18601 <pre>baz
18602 </pre>
18603 !! end
18604
18605 !! test
18606 Bug 8293: Use of center tag ruins paragraph formatting
18607 !! wikitext
18608 <center>
18609 foo
18610 </center>
18611
18612 bar
18613
18614 baz
18615 !! html
18616 <center>
18617 <p>foo
18618 </p>
18619 </center>
18620 <p>bar
18621 </p>
18622 <pre>baz
18623 </pre>
18624 !! end
18625
18626 !!test
18627 Parsing of overlapping (improperly nested) inline html tags
18628 !! wikitext
18629 <span><s>x</span></s>
18630 !! html/php
18631 <p><span><s>x&lt;/span&gt;</s></span>
18632 </p>
18633 !! html/parsoid
18634 <p><span><s>x</s></span>
18635 </p>
18636 !!end
18637
18638 ###
18639 ### Language variants related tests
18640 ###
18641 !! test
18642 Self-link in language variants
18643 !! options
18644 title=[[Dunav]] language=sr
18645 !! wikitext
18646 Both [[Dunav]] and [[Дунав]] are names for this river.
18647 !! html
18648 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
18649 </p>
18650 !!end
18651
18652 !! article
18653 Дуна
18654 !! text
18655 content
18656 !! endarticle
18657
18658 !! test
18659 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
18660 !! options
18661 title=[[Duna]] language=sr
18662 !! wikitext
18663 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
18664 !! html
18665 <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.
18666 </p>
18667 !! end
18668
18669 !! test
18670 Link to a section of a variant of this title shouldn't be parsed as self-link
18671 !! options
18672 title=[[Duna]] language=sr
18673 !! wikitext
18674 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
18675 !! html
18676 <p><strong class="selflink">Dуна</strong> is a self-link while <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dunа#Foo</a> and <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dуна#Foo</a> are not self-links.
18677 </p>
18678 !! end
18679
18680 !! test
18681 Link to pages in language variants
18682 !! options
18683 language=sr
18684 !! wikitext
18685 Main Page can be written as [[Маин Паге]]
18686 !! html
18687 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
18688 </p>
18689 !!end
18690
18691
18692 !! test
18693 Multiple links to pages in language variants
18694 !! options
18695 language=sr
18696 !! wikitext
18697 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
18698 !! html
18699 <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>.
18700 </p>
18701 !!end
18702
18703
18704 !! test
18705 Simple template in language variants
18706 !! options
18707 language=sr
18708 !! wikitext
18709 {{тест}}
18710 !! html
18711 <p>This is a test template
18712 </p>
18713 !! end
18714
18715
18716 !! test
18717 Template with explicit namespace in language variants
18718 !! options
18719 language=sr
18720 !! wikitext
18721 {{Template:тест}}
18722 !! html
18723 <p>This is a test template
18724 </p>
18725 !! end
18726
18727
18728 !! test
18729 Basic test for template parameter in language variants
18730 !! options
18731 language=sr
18732 !! wikitext
18733 {{парамтест|param=foo}}
18734 !! html
18735 <p>This is a test template with parameter foo
18736 </p>
18737 !! end
18738
18739
18740 !! test
18741 Simple category in language variants
18742 !! options
18743 language=sr cat
18744 !! wikitext
18745 [[Category:МедиаWики Усер'с Гуиде]]
18746 !! html
18747 <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>
18748 !! end
18749
18750
18751 !! article
18752 Category:分类
18753 !! text
18754 blah
18755 !! endarticle
18756
18757 !! article
18758 Category:分類
18759 !! text
18760 blah
18761 !! endarticle
18762
18763 !! test
18764 Don't convert blue categorylinks to another variant (bug 33210)
18765 !! options
18766 language=zh cat
18767 !! wikitext
18768 [[A]][[Category:分类]]
18769 !! html
18770 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
18771 !! end
18772
18773
18774 !! test
18775 Stripping -{}- tags (language variants)
18776 !! options
18777 language=sr
18778 !! wikitext
18779 Latin proverb: -{Ne nuntium necare}-
18780 !! html
18781 <p>Latin proverb: Ne nuntium necare
18782 </p>
18783 !! end
18784
18785
18786 !! test
18787 Prevent conversion with -{}- tags (language variants)
18788 !! options
18789 language=sr variant=sr-ec
18790 !! wikitext
18791 Latinski: -{Ne nuntium necare}-
18792 !! html
18793 <p>Латински: Ne nuntium necare
18794 </p>
18795 !! end
18796
18797
18798 !! test
18799 Prevent conversion of text with -{}- tags (language variants)
18800 !! options
18801 language=sr variant=sr-ec
18802 !! wikitext
18803 Latinski: -{Ne nuntium necare}-
18804 !! html
18805 <p>Латински: Ne nuntium necare
18806 </p>
18807 !! end
18808
18809
18810 !! test
18811 Prevent conversion of links with -{}- tags (language variants)
18812 !! options
18813 language=sr variant=sr-ec
18814 !! wikitext
18815 -{[[Main Page]]}-
18816 !! html
18817 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18818 </p>
18819 !! end
18820
18821
18822 !! test
18823 -{}- tags within headlines (within html for parserConvert())
18824 !! options
18825 language=sr variant=sr-ec
18826 !! wikitext
18827 == -{Naslov}- ==
18828 !! html
18829 <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>
18830
18831 !! end
18832
18833
18834 !! test
18835 Explicit definition of language variant alternatives
18836 !! options
18837 language=zh variant=zh-tw
18838 !! wikitext
18839 -{zh:China;zh-tw:Taiwan}-, not China
18840 !! html
18841 <p>Taiwan, not China
18842 </p>
18843 !! end
18844
18845
18846 !! test
18847 Conversion around HTML tags
18848 !! options
18849 language=sr variant=sr-ec
18850 !! wikitext
18851 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
18852 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
18853 !! html
18854 <p>
18855 <span title="ЛаCтин">ски</span>
18856 </p>
18857 !! end
18858
18859
18860 !! test
18861 Explicit session-wise language variant mapping (A flag and - flag)
18862 !! options
18863 language=zh variant=zh-tw
18864 !! wikitext
18865 Taiwan is not China.
18866 But -{A|zh:China;zh-tw:Taiwan}- is China,
18867 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
18868 and -{China}- is China.
18869 !! html
18870 <p>Taiwan is not China.
18871 But Taiwan is Taiwan,
18872 (This should be stripped!)
18873 and China is China.
18874 </p>
18875 !! end
18876
18877 !! test
18878 Explicit session-wise language variant mapping (H flag for hide)
18879 !! options
18880 language=zh variant=zh-tw
18881 !! wikitext
18882 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
18883 Taiwan is China.
18884 !! html
18885 <p>(This should be stripped!)
18886 Taiwan is Taiwan.
18887 </p>
18888 !! end
18889
18890 !! test
18891 Adding explicit conversion rule for title (T flag)
18892 !! options
18893 language=zh variant=zh-tw showtitle
18894 !! wikitext
18895 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18896 !! html
18897 Taiwan
18898 <p>Should be stripped!
18899 </p>
18900 !! end
18901
18902 !! test
18903 Testing that changing the language variant here in the tests actually works
18904 !! options
18905 language=zh variant=zh showtitle
18906 !! wikitext
18907 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18908 !! html
18909 China
18910 <p>Should be stripped!
18911 </p>
18912 !! end
18913
18914 !! test
18915 Recursive conversion of alt and title attrs shouldn't clear converter state
18916 !! options
18917 language=zh variant=zh-cn showtitle
18918 !! wikitext
18919 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
18920 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
18921 !! html
18922 China
18923 <p>
18924 Should be stripped<span title="Exclamation">!</span>
18925 </p>
18926 !! end
18927
18928 !! test
18929 Bug 24072: more test on conversion rule for title
18930 !! options
18931 language=zh variant=zh-tw showtitle
18932 !! wikitext
18933 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18934 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
18935 !! html
18936 Taiwan
18937 <p>This should be stripped!
18938 This won't take interferes with the title rule.
18939 </p>
18940 !! end
18941
18942 !! test
18943 Partly disable title conversion if variant == main language code
18944 !! options
18945 language=zh variant=zh title=[[ZH]] showtitle
18946 !! wikitext
18947 -{T|zh-cn:CN;zh-tw:TW}-
18948 !! html
18949 ZH
18950 <p>
18951 </p>
18952 !! end
18953
18954 !! test
18955 Partly disable title conversion if variant == main language code, more
18956 !! options
18957 language=zh variant=zh title=[[ZH]] showtitle
18958 !! wikitext
18959 -{T|TW}-
18960 !! html
18961 ZH
18962 <p>
18963 </p>
18964 !! end
18965
18966 !! test
18967 Raw output of variant escape tags (R flag)
18968 !! options
18969 language=zh variant=zh-tw
18970 !! wikitext
18971 Raw: -{R|zh:China;zh-tw:Taiwan}-
18972 !! html
18973 <p>Raw: zh:China;zh-tw:Taiwan
18974 </p>
18975 !! end
18976
18977 !! test
18978 Strings evaluating false shouldn't be ignored by Language converter (T51072)
18979 !! options
18980 language=zh variant=zh-cn
18981 !! input
18982 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
18983 !! result
18984 <p>0
18985 </p>
18986 !! end
18987
18988 !! test
18989 Conversion rules from [numeric-only string] to [something else] (T48634)
18990 !! options
18991 language=zh variant=zh-cn
18992 !! input
18993 -{H|0=>zh-cn:B}--{H|0=>zh-cn:C;0=>zh-cn:D}--{H|0=>zh-hans:A}-012345-{A|zh-tw:0;zh-cn:E;}-012345
18994 !! result
18995 <p>D12345EE12345
18996 </p>
18997 !! end
18998
18999 !! test
19000 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19001 !! options
19002 language=zh variant=zh-cn
19003 !! input
19004 -{H|zh-cn:foo;zh-tw:;}-foobar
19005 !! result
19006 <p>foobar
19007 </p>
19008 !! end
19009
19010 !! test
19011 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19012 !! options
19013 language=zh variant=zh-cn
19014 !! input
19015 -{H|=>zh-cn:foo;}-foobar
19016 !! result
19017 <p>foobar
19018 </p>
19019 !! end
19020
19021 !! test
19022 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19023 !! options
19024 language=zh variant=zh-cn
19025 !! input
19026 -{H|}-foobar
19027 !! result
19028 <p>foobar
19029 </p>
19030 !! end
19031
19032 !! test
19033 Nested using of manual convert syntax
19034 !! options
19035 language=zh variant=zh-hk
19036 !! wikitext
19037 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19038 !! html
19039 <p>Nested: Hello Hong Kong!
19040 </p>
19041 !! end
19042
19043 !! test
19044 Proper conversion of text in external links
19045 !! options
19046 language=sr variant=sr-ec
19047 !! wikitext
19048 http://www.google.com
19049 gopher://www.google.com
19050 [http://www.google.com http://www.google.com]
19051 [gopher://www.google.com gopher://www.google.com]
19052 [https://www.google.com irc://www.google.com]
19053 [ftp://www.google.com www.google.com/ftp://dir]
19054 [//www.google.com www.google.com]
19055 !! html
19056 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19057 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19058 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19059 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19060 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19061 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19062 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19063 </p>
19064 !! end
19065
19066 !! test
19067 Do not convert roman numbers to language variants
19068 !! options
19069 language=sr variant=sr-ec
19070 !! wikitext
19071 Fridrih IV je car.
19072 !! html
19073 <p>Фридрих IV је цар.
19074 </p>
19075 !! end
19076
19077 !! test
19078 Unclosed language converter markup "-{"
19079 !! options
19080 language=sr
19081 !! wikitext
19082 -{T|hello
19083 !! html
19084 <p>-{T|hello
19085 </p>
19086 !! end
19087
19088 !! test
19089 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19090 !! options
19091 language=sr
19092 !! wikitext
19093 -{R|=&gt;}-
19094 !! html
19095 <p>=&gt;
19096 </p>
19097 !!end
19098
19099 !! test
19100 Don't break link parsing if language converter markup is in the caption.
19101 !! options
19102 language=sr variant=sr-ec
19103 !! wikitext
19104 [[Main Page|-{R|main page}-]]
19105 !! html
19106 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19107 </p>
19108 !! end
19109
19110 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19111 !! test
19112 Don't break image parsing if language converter markup is in the caption.
19113 !! options
19114 language=sr
19115 !! wikitext
19116 [[File:Foobar.jpg|-{R|caption}-]]
19117 !! html/parsoid
19118 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
19119 </p>
19120 !! end
19121
19122 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19123 !! test
19124 Don't break list handling if language converter markup is in the item.
19125 !! options
19126 language=zh variant=zh-cn
19127 !! wikitext
19128 ;-{zh-cn:AAA;zh-tw:BBB}-
19129 !! html/php
19130 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19131
19132 !! html/parsoid
19133 <dl><dt>AAA
19134 </dt></dl>
19135 !! end
19136
19137 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19138 !! test
19139 Don't break table handling if language converter markup is in the cell.
19140 !! options
19141 language=sr variant=sr-ec
19142 !! wikitext
19143 {|
19144 |-
19145 | -{R|B}-
19146 |}
19147 !! html/php
19148 <table>
19149
19150 <tr>
19151 <td>Б}-
19152 </td></tr></table>
19153
19154 !! html/parsoid
19155 <table>
19156
19157 <tr>
19158 <td> B
19159 </td></tr></table>
19160
19161 !! end
19162
19163 !! test
19164 Bug 529: Uncovered bullet
19165 !! wikitext
19166 * Foo {{bullet}}
19167 !! html
19168 <ul><li> Foo </li>
19169 <li> Bar</li></ul>
19170
19171 !! end
19172
19173 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19174 # Templates in Wikipedia rely on this behavior, as tidy has always been
19175 # enabled there. These tests are normally run *without* tidy, so specify the
19176 # full output here.
19177 # To test realistic parsing behavior, apply a tidy-like transformation to both
19178 # the expected output and your parser's output.
19179 !! test
19180 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19181 !! wikitext
19182 ******* Foo {{bullet}}
19183 !! html
19184 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo </li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li>
19185 <li> Bar</li></ul>
19186
19187 !! end
19188
19189 !! test
19190 Bug 529: Uncovered table already at line-start
19191 !! wikitext
19192 x
19193
19194 {{table}}
19195 y
19196 !! html
19197 <p>x
19198 </p>
19199 <table>
19200 <tr>
19201 <td> 1 </td>
19202 <td> 2
19203 </td></tr>
19204 <tr>
19205 <td> 3 </td>
19206 <td> 4
19207 </td></tr></table>
19208 <p>y
19209 </p>
19210 !! end
19211
19212 !! test
19213 Bug 529: Uncovered bullet in parser function result
19214 !! wikitext
19215 * Foo {{lc:{{bullet}} }}
19216 !! html
19217 <ul><li> Foo </li>
19218 <li> bar</li></ul>
19219
19220 !! end
19221
19222 !! test
19223 Bug 5678: Double-parsed template argument
19224 !! wikitext
19225 {{lc:{{{1}}}|hello}}
19226 !! html
19227 <p>{{{1}}}
19228 </p>
19229 !! end
19230
19231 !! test
19232 Bug 5678: Double-parsed template invocation
19233 !! wikitext
19234 {{lc:{{paramtest {{!}} param = hello }} }}
19235 !! html
19236 <p>{{paramtest | param = hello }}
19237 </p>
19238 !! end
19239
19240 !! test
19241 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19242 !! options
19243 language=cs
19244 title=[[Main Page]]
19245 !! wikitext
19246 {{PRVNÍVELKÉ:ěščř}}
19247 {{prvnívelké:ěščř}}
19248 {{PRVNÍMALÉ:ěščř}}
19249 {{prvnímalé:ěščř}}
19250 {{MALÁ:ěščř}}
19251 {{malá:ěščř}}
19252 {{VELKÁ:ěščř}}
19253 {{velká:ěščř}}
19254 !! html
19255 <p>Ěščř
19256 Ěščř
19257 ěščř
19258 ěščř
19259 ěščř
19260 ěščř
19261 ĚŠČŘ
19262 ĚŠČŘ
19263 </p>
19264 !! end
19265
19266 !! test
19267 Morwen/13: Unclosed link followed by heading
19268 !! wikitext
19269 [[link
19270 ==heading==
19271 !! html
19272 <p>[[link
19273 </p>
19274 <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>
19275
19276 !! end
19277
19278 !! test
19279 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19280 !! wikitext
19281 {{foo|
19282 =heading=
19283 !! html
19284 <p>{{foo|
19285 </p>
19286 <h1><span class="mw-headline" id="heading">heading</span></h1>
19287
19288 !! end
19289
19290 !! test
19291 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19292 !! wikitext
19293 {{foo|
19294 ==heading==
19295 !! html
19296 <p>{{foo|
19297 </p>
19298 <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>
19299
19300 !! end
19301
19302 !! test
19303 Tildes in comments
19304 !! options
19305 pst
19306 !! wikitext
19307 <!-- ~~~~ -->
19308 !! html
19309 <!-- ~~~~ -->
19310 !! end
19311
19312 !! test
19313 Paragraphs inside divs (no extra line breaks)
19314 !! wikitext
19315 <div>Line one
19316
19317 Line two</div>
19318 !! html
19319 <div>Line one
19320 Line two</div>
19321
19322 !! end
19323
19324 !! test
19325 Paragraphs inside divs (extra line break on open)
19326 !! wikitext
19327 <div>
19328 Line one
19329
19330 Line two</div>
19331 !! html
19332 <div>
19333 <p>Line one
19334 </p>
19335 Line two</div>
19336
19337 !! end
19338
19339 !! test
19340 Paragraphs inside divs (extra line break on close)
19341 !! wikitext
19342 <div>Line one
19343
19344 Line two
19345 </div>
19346 !! html
19347 <div>Line one
19348 <p>Line two
19349 </p>
19350 </div>
19351
19352 !! end
19353
19354 !! test
19355 Paragraphs inside divs (extra line break on open and close)
19356 !! wikitext
19357 <div>
19358 Line one
19359
19360 Line two
19361 </div>
19362 !! html
19363 <div>
19364 <p>Line one
19365 </p><p>Line two
19366 </p>
19367 </div>
19368
19369 !! end
19370
19371 !! test
19372 Nesting tags, paragraphs on lines which begin with <div>
19373 !! wikitext
19374 <div></div><strong>A
19375 B</strong>
19376 !! html/php+tidy
19377 <p><strong>A</strong></p>
19378 <p><strong>B</strong></p>
19379 !! html/parsoid
19380 <div></div>
19381 <p><strong>A
19382 B</strong>
19383 </p>
19384 !! end
19385
19386 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
19387 !! test
19388 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
19389 !! wikitext
19390 <blockquote>Line one
19391
19392 Line two</blockquote>
19393 !! html
19394 <blockquote>Line one
19395 Line two</blockquote>
19396
19397 !! html+tidy
19398 <blockquote>
19399 <p>Line one Line two</p>
19400 </blockquote>
19401 !! end
19402
19403 !! test
19404 Bug 6200: paragraphs inside blockquotes (extra line break on open)
19405 !! wikitext
19406 <blockquote>
19407 Line one
19408
19409 Line two</blockquote>
19410 !! html
19411 <blockquote>
19412 <p>Line one
19413 </p>
19414 Line two</blockquote>
19415
19416 !! html+tidy
19417 <blockquote>
19418 <p>Line one</p>
19419 Line two</blockquote>
19420 !! end
19421
19422 !! test
19423 Bug 6200: paragraphs inside blockquotes (extra line break on close)
19424 !! wikitext
19425 <blockquote>Line one
19426
19427 Line two
19428 </blockquote>
19429 !! html
19430 <blockquote>Line one
19431 <p>Line two
19432 </p>
19433 </blockquote>
19434
19435 !! html+tidy
19436 <blockquote>
19437 <p>Line one</p>
19438 <p>Line two</p>
19439 </blockquote>
19440 !! end
19441
19442 !! test
19443 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
19444 !! wikitext
19445 <blockquote>
19446 Line one
19447
19448 Line two
19449 </blockquote>
19450 !! html
19451 <blockquote>
19452 <p>Line one
19453 </p><p>Line two
19454 </p>
19455 </blockquote>
19456
19457 !! html+tidy
19458 <blockquote>
19459 <p>Line one</p>
19460 <p>Line two</p>
19461 </blockquote>
19462 !! end
19463
19464 !! test
19465 Paragraphs inside blockquotes/divs (no extra line breaks)
19466 !! wikitext
19467 <blockquote><div>Line one
19468
19469 Line two</div></blockquote>
19470 !! html
19471 <blockquote><div>Line one
19472 Line two</div></blockquote>
19473
19474 !! end
19475
19476 !! test
19477 Paragraphs inside blockquotes/divs (extra line break on open)
19478 !! wikitext
19479 <blockquote><div>
19480 Line one
19481
19482 Line two</div></blockquote>
19483 !! html
19484 <blockquote><div>
19485 <p>Line one
19486 </p>
19487 Line two</div></blockquote>
19488
19489 !! end
19490
19491 !! test
19492 Paragraphs inside blockquotes/divs (extra line break on close)
19493 !! wikitext
19494 <blockquote><div>Line one
19495
19496 Line two
19497 </div></blockquote>
19498 !! html
19499 <blockquote><div>Line one
19500 <p>Line two
19501 </p>
19502 </div></blockquote>
19503
19504 !! end
19505
19506 !! test
19507 Paragraphs inside blockquotes/divs (extra line break on open and close)
19508 !! wikitext
19509 <blockquote><div>
19510 Line one
19511
19512 Line two
19513 </div></blockquote>
19514 !! html
19515 <blockquote><div>
19516 <p>Line one
19517 </p><p>Line two
19518 </p>
19519 </div></blockquote>
19520
19521 !! end
19522
19523 !! test
19524 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
19525 !! options
19526 wgLinkHolderBatchSize=0
19527 !! wikitext
19528 [[meatball:1]]
19529 [[meatball:2]]
19530 [[meatball:3]]
19531 !! html
19532 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
19533 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
19534 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
19535 </p>
19536 !! end
19537
19538 !! test
19539 Free external link invading image caption
19540 !! wikitext
19541 [[Image:Foobar.jpg|thumb|http://x|hello]]
19542 !! html
19543 <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"></a></div>hello</div></div></div>
19544
19545 !! end
19546
19547 !! test
19548 Bug 15196: localised external link numbers
19549 !! options
19550 language=fa
19551 !! wikitext
19552 [http://en.wikipedia.org/]
19553 !! html/php
19554 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
19555 </p>
19556 !! html/parsoid
19557 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
19558 !! end
19559
19560 !! test
19561 Multibyte character in padleft
19562 !! wikitext
19563 {{padleft:-Hello|7|Æ}}
19564 !! html
19565 <p>Æ-Hello
19566 </p>
19567 !! end
19568
19569 !! test
19570 Multibyte character in padright
19571 !! wikitext
19572 {{padright:Hello-|7|Æ}}
19573 !! html
19574 <p>Hello-Æ
19575 </p>
19576 !! end
19577
19578 !!test
19579 formatdate parser function
19580 !! wikitext
19581 {{#formatdate:2009-03-24}}
19582 !! html
19583 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
19584 </p>
19585 !! end
19586
19587 !!test
19588 formatdate parser function, with default format
19589 !! wikitext
19590 {{#formatdate:2009-03-24|mdy}}
19591 !! html
19592 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
19593 </p>
19594 !! end
19595
19596 !! test
19597 Spacing of numbers in formatted dates
19598 !! wikitext
19599 {{#formatdate:January 15}}
19600 !! html
19601 <p><span class="mw-formatted-date" title="01-15">January 15</span>
19602 </p>
19603 !! end
19604
19605 !! test
19606 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
19607 !! options
19608 language=nl title=[[MediaWiki:Common.css]]
19609 !! wikitext
19610 {{#formatdate:2009-03-24|dmy}}
19611 !! html
19612 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
19613 </p>
19614 !! end
19615
19616 #
19617 #
19618 #
19619
19620 #
19621 # Edit comments
19622 #
19623
19624 !! test
19625 Edit comment with link
19626 !! options
19627 comment
19628 !! wikitext
19629 I like the [[Main Page]] a lot
19630 !! html
19631 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
19632 !!end
19633
19634 !! test
19635 Edit comment with link and link text
19636 !! options
19637 comment
19638 !! wikitext
19639 I like the [[Main Page|best pages]] a lot
19640 !! html
19641 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19642 !!end
19643
19644 !! test
19645 Edit comment with link and link text with suffix
19646 !! options
19647 comment
19648 !! wikitext
19649 I like the [[Main Page|best page]]s a lot
19650 !! html
19651 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19652 !!end
19653
19654 !! test
19655 Edit comment with section link (non-local, eg in history list)
19656 !! options
19657 comment title=[[Main Page]]
19658 !! wikitext
19659 /* External links */ removed bogus entries
19660 !! html
19661 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19662 !!end
19663
19664 !! test
19665 Edit comment with section link and text before it (non-local, eg in history list)
19666 !! options
19667 comment title=[[Main Page]]
19668 !! wikitext
19669 pre-comment text /* External links */ removed bogus entries
19670 !! html
19671 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>
19672 !!end
19673
19674 !! test
19675 Edit comment with section link (local, eg in diff view)
19676 !! options
19677 comment local title=[[Main Page]]
19678 !! wikitext
19679 /* External links */ removed bogus entries
19680 !! html
19681 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19682 !!end
19683
19684 !! test
19685 Edit comment with subpage link (bug 14080)
19686 !! options
19687 comment
19688 subpage
19689 title=[[Subpage test]]
19690 !! wikitext
19691 Poked at a [[/subpage]] here...
19692 !! html
19693 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
19694 !!end
19695
19696 !! test
19697 Edit comment with subpage link and link text (bug 14080)
19698 !! options
19699 comment
19700 subpage
19701 title=[[Subpage test]]
19702 !! wikitext
19703 Poked at a [[/subpage|neat little page]] here...
19704 !! html
19705 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
19706 !!end
19707
19708 !! test
19709 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
19710 !! options
19711 comment
19712 title=[[Subpage test]]
19713 !! wikitext
19714 Poked at a [[/subpage]] here...
19715 !! html
19716 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...
19717 !!end
19718
19719 !! test
19720 Edit comment with bare anchor link (local, as on diff)
19721 !! options
19722 comment
19723 local
19724 title=[[Main Page]]
19725 !! wikitext
19726 [[#section]]
19727 !! html
19728 <a href="#section">#section</a>
19729 !! end
19730
19731 !! test
19732 Edit comment with bare anchor link (non-local, as on history)
19733 !! options
19734 comment
19735 title=[[Main Page]]
19736 !! wikitext
19737 [[#section]]
19738 !! html
19739 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
19740 !! end
19741
19742 !! test
19743 Anchor starting with underscore
19744 !! wikitext
19745 [[#_ref|One]]
19746 !! html
19747 <p><a href="#_ref">One</a>
19748 </p>
19749 !! end
19750
19751 !! test
19752 Id starting with underscore
19753 !! wikitext
19754 <div id="_ref"></div>
19755 !! html
19756 <div id="_ref"></div>
19757
19758 !! end
19759
19760 !! test
19761 Space normalisation on autocomment (bug 22784)
19762 !! options
19763 comment
19764 title=[[Main Page]]
19765 !! wikitext
19766 /* __hello__world__ */
19767 !! html
19768 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
19769 !! end
19770
19771 !! test
19772 percent-encoding and + signs in comments (Bug 26410)
19773 !! options
19774 comment
19775 !! wikitext
19776 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
19777 !! html/php
19778 <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>
19779 !! end
19780
19781 # Parsoid doesn't support this yet: see bug 73581
19782 # but it *should* omit the 'src' attribute if the image is bad.
19783 # PHP side of tests was disabled in
19784 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
19785 # because of issues in the PHP parserTests infrastructure
19786 # (but the output below is indeed what the PHP side emits)
19787 !! test
19788 Bad images - basic functionality
19789 !! wikitext
19790 [[File:Bad.jpg]]
19791 !! DISABLED/html/php
19792 !! html/parsoid
19793 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"bad-image","message":"This image is blacklisted in this context."}]}'><a href="./File:Bad.jpg"><img resource="./File:Bad.jpg" height="220" width="220"/></a></span></p>
19794 !! end
19795
19796 !! test
19797 Bad images - bug 16039: text after bad image disappears
19798 !! wikitext
19799 Foo bar
19800 [[File:Bad.jpg]]
19801 Bar foo
19802 !! DISABLED/html/php
19803 <p>Foo bar
19804 </p><p>Bar foo
19805 </p>
19806 !! html/parsoid
19807 <p>Foo bar
19808 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"bad-image","message":"This image is blacklisted in this context."}]}'><a href="./File:Bad.jpg"><img resource="./File:Bad.jpg" height="220" width="220"/></a></span>
19809 Bar foo</p>
19810 !! end
19811
19812 !! test
19813 Verify that displaytitle works (bug #22501) no displaytitle
19814 !! options
19815 showtitle
19816 !! config
19817 wgAllowDisplayTitle=true
19818 wgRestrictDisplayTitle=false
19819 !! wikitext
19820 this is not the the title
19821 !! html/php
19822 Parser test
19823 <p>this is not the the title
19824 </p>
19825 !! end
19826
19827 !! test
19828 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
19829 !! options
19830 showtitle
19831 title=[[Screen]]
19832 !! config
19833 wgAllowDisplayTitle=true
19834 wgRestrictDisplayTitle=false
19835 !! wikitext
19836 this is not the the title
19837 {{DISPLAYTITLE:whatever}}
19838 !! html/php
19839 whatever
19840 <p>this is not the the title
19841 </p>
19842 !! end
19843
19844 !! test
19845 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
19846 !! options
19847 showtitle
19848 title=[[Screen]]
19849 !! config
19850 wgAllowDisplayTitle=true
19851 wgRestrictDisplayTitle=true
19852 !! wikitext
19853 this is not the the title
19854 {{DISPLAYTITLE:whatever}}
19855 !! html/php
19856 Screen
19857 <p>this is not the the title
19858 </p>
19859 !! end
19860
19861 !! test
19862 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
19863 !! options
19864 showtitle
19865 title=[[Screen]]
19866 !! config
19867 wgAllowDisplayTitle=true
19868 wgRestrictDisplayTitle=true
19869 !! wikitext
19870 this is not the the title
19871 {{DISPLAYTITLE:screen}}
19872 !! html/php
19873 screen
19874 <p>this is not the the title
19875 </p>
19876 !! end
19877
19878 !! test
19879 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
19880 !! options
19881 showtitle
19882 title=[[Screen]]
19883 !! config
19884 wgAllowDisplayTitle=false
19885 !! wikitext
19886 this is not the the title
19887 {{DISPLAYTITLE:screen}}
19888 !! html/php
19889 Screen
19890 <p>this is not the the title
19891 <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>
19892 </p>
19893 !! end
19894
19895 !! test
19896 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
19897 !! options
19898 showtitle
19899 title=[[Screen]]
19900 !! config
19901 wgAllowDisplayTitle=false
19902 !! wikitext
19903 this is not the the title
19904 !! html/php
19905 Screen
19906 <p>this is not the the title
19907 </p>
19908 !! end
19909
19910 !! test
19911 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
19912 !! options
19913 showtitle
19914 title=[[Screen]]
19915 !! config
19916 wgAllowDisplayTitle=true
19917 wgRestrictDisplayTitle=true
19918 !! wikitext
19919 this is not the the title
19920 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
19921 !! html/php
19922 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
19923 <p>this is not the the title
19924 </p>
19925 !! end
19926
19927 !! test
19928 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
19929 !! options
19930 showtitle
19931 title=[[Screen]]
19932 !! config
19933 wgAllowDisplayTitle=true
19934 wgRestrictDisplayTitle=true
19935 !! wikitext
19936 this is not the the title
19937 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
19938 !! html/php
19939 <span style="color: red;">s</span>creen
19940 <p>this is not the the title
19941 </p>
19942 !! end
19943
19944 !! test
19945 Page status indicators: Empty name is invalid
19946 !! options
19947 showindicators
19948 !! wikitext
19949 <indicator name=" "></indicator>
19950 <indicator></indicator>
19951 !! html
19952 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19953 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19954 </p>
19955 !! end
19956
19957 !! test
19958 Page status indicators: Weird syntaxes that are okay
19959 !! options
19960 showindicators
19961 !! wikitext
19962 <indicator name="empty" />
19963 <indicator name="name"></indicator>
19964 !! html
19965 empty=
19966 name=
19967 <p><br />
19968 </p>
19969 !! end
19970
19971 !! test
19972 Page status indicators: Torture test
19973 !! options
19974 showindicators
19975 !! wikitext
19976 <indicator name="01">hello world</indicator>
19977 <indicator name="02">[[Main Page]]</indicator>
19978 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
19979 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
19980 <indicator name="05">* foo
19981 * bar</indicator>
19982 <indicator name="06"><nowiki>foo</nowiki></indicator>
19983 <indicator name="07"> Preformatted</indicator>
19984 <indicator name="08"><div>Broken tag</indicator>
19985 <indicator name="09">{| class=wikitable
19986 | cell
19987 |}</indicator>
19988 <indicator name="10">Two
19989
19990 paragraphs</indicator>
19991 !! html
19992 01=hello world
19993 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19994 03=<img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/25px-Foobar.jpg" width="25" height="3" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/38px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg 2x" />
19995 04=<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/25px-Foobar.jpg" width="25" height="3" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/38px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg 2x" /></a>
19996 05=<ul><li> foo</li>
19997 <li> bar</li></ul>
19998
19999 06=foo
20000 07=<pre>Preformatted
20001 </pre>
20002 08=<div>Broken tag</div>
20003
20004 09=<table class="wikitable">
20005 <tr>
20006 <td> cell
20007 </td></tr></table>
20008
20009 10=<p>Two
20010 </p><p>paragraphs
20011 </p>
20012 <p><br />
20013 </p><p><br />
20014 </p><p><br />
20015 </p><p><br />
20016 </p><p><br />
20017 </p>
20018 !! end
20019
20020 !! test
20021 preload: check <noinclude> and <includeonly>
20022 !! options
20023 preload
20024 !! wikitext
20025 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20026 !! html/php
20027 Hello kind world.
20028 !! end
20029
20030 !! test
20031 preload: check <onlyinclude>
20032 !! options
20033 preload
20034 !! wikitext
20035 Goodbye <onlyinclude>Hello world</onlyinclude>
20036 !! html/php
20037 Hello world
20038 !! end
20039
20040 !! test
20041 preload: can pass tags through if we want to
20042 !! options
20043 preload
20044 !! wikitext
20045 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20046 !! html/php
20047 <includeonly>Hello world</includeonly>
20048 !! end
20049
20050 !! test
20051 preload: check that it doesn't try to do tricks
20052 !! options
20053 preload
20054 !! wikitext
20055 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20056 !! html/php
20057 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20058 !! end
20059
20060 !! test
20061 Play a bit with r67090 and bug 3158
20062 !! wikitext
20063 <div style="width:50% !important">&nbsp;</div>
20064 <div style="width:50%&nbsp;!important">&nbsp;</div>
20065 <div style="width:50%&#160;!important">&nbsp;</div>
20066 <div style="border : solid;">&nbsp;</div>
20067 !! html/php
20068 <div style="width:50% !important">&#160;</div>
20069 <div style="width:50% !important">&#160;</div>
20070 <div style="width:50% !important">&#160;</div>
20071 <div style="border&#160;: solid;">&#160;</div>
20072
20073 !! html/parsoid
20074 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20075 <div style="width:50% !important" data-parsoid='{"stx":"html","a":{"style":"width:50% !important"},"sa":{"style":"width:50%&amp;nbsp;!important"}}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20076 <div style="width:50% !important" data-parsoid='{"stx":"html","a":{"style":"width:50% !important"},"sa":{"style":"width:50%&amp;#160;!important"}}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20077 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20078
20079 !! end
20080
20081 !! test
20082 HTML5 data attributes
20083 !! wikitext
20084 <span data-foo="bar">Baz</span>
20085 <p data-abc-def_hij="">Quuz</p>
20086 !! html
20087 <p><span data-foo="bar">Baz</span>
20088 </p>
20089 <p data-abc-def_hij="">Quuz</p>
20090
20091 !! end
20092
20093 !! test
20094 percent-encoding and + signs in internal links (Bug 26410)
20095 !! wikitext
20096 [[User:+%]] [[Page+title%]]
20097 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20098 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20099 [[%33%45]] [[%33%45+]]
20100 !! html/php
20101 <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>
20102 <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>
20103 <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>
20104 <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>
20105 </p>
20106 !! html/parsoid
20107 <p><a rel="mw:WikiLink" href="./User:+%25" title="User:+%">User:+%</a> <a rel="mw:WikiLink" href="Page+title%25" title="Page+title%">Page+title%</a>
20108 <a rel="mw:WikiLink" href="%25+" title="%+">%+</a> <a rel="mw:WikiLink" href="%25+" title="%+">%20</a> <a rel="mw:WikiLink" href="%25+" title="%+">%+ </a> <a rel="mw:WikiLink" href="%25+r" title="%+r">%+r</a>
20109 <a rel="mw:WikiLink" href="%25" title="%">%</a> <a rel="mw:WikiLink" href="+" title="+">+</a> <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"foo"},{"ck":"caption","ak":"[[bar]]"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"[[bar]]"}'><a href="./File:%25+abc9" data-parsoid='{"a":{"href":"./File:%25+abc9"},"sa":{}}'><img resource="./File:%25+abc9" src="./Special:FilePath/%25+abc9" height="220" width="220" data-parsoid='{"a":{"resource":"./File:%25+abc9","height":"220","width":"220"},"sa":{"resource":"File:%+abc%39"}}'/></a></span>
20110 <a rel="mw:WikiLink" href="./3E" title="3E" data-parsoid='{"stx":"simple","a":{"href":"./3E"},"sa":{"href":"%33%45"}}'>3E</a> <a rel="mw:WikiLink" href="./3E+" title="3E+" data-parsoid='{"stx":"simple","a":{"href":"./3E+"},"sa":{"href":"%33%45+"}}'>3E+</a></p>
20111 !! end
20112
20113 !! test
20114 Special characters in embedded file links (bug 27679)
20115 !! wikitext
20116 [[File:Contains & ampersand.jpg]]
20117 [[File:Does not exist.jpg|Title with & ampersand]]
20118 !! html/php
20119 <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>
20120 <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>
20121 </p>
20122 !! html/parsoid
20123 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Contains_&amp;_ampersand.jpg"><img resource="./File:Contains_&amp;_ampersand.jpg" src="./Special:FilePath/Contains_&amp;_ampersand.jpg" height="220" width="220"/></a></span>
20124 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"Title with &amp; ampersand"}'><a href="./File:Does_not_exist.jpg"><img resource="./File:Does_not_exist.jpg" src="./Special:FilePath/Does_not_exist.jpg" height="220" width="220"/></a></span></p>
20125 !! end
20126
20127 !! test
20128 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20129 !! wikitext
20130 Text&apos;s been normalized?
20131 !! html
20132 <p>Text&#39;s been normalized?
20133 </p>
20134 !! end
20135
20136 !! test
20137 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20138 !! wikitext
20139 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20140 !! html
20141 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20142 </p>
20143 !! end
20144
20145 !! test
20146 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20147 !! wikitext
20148 [http://www.example.org/ ideograms]
20149 !! html
20150 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20151 </p>
20152 !! end
20153
20154 !! test
20155 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20156 !! wikitext
20157 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20158 !! html
20159 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20160 </p>
20161 !! end
20162
20163 !! article
20164 Mediawiki:loop1
20165 !! text
20166 {{Identical|A}}
20167 !! endarticle
20168
20169 !! article
20170 Mediawiki:loop2
20171 !! text
20172 {{Identical|B}}
20173 !! endarticle
20174
20175 !! article
20176 Template:Identical
20177 !! text
20178 {{int:loop1}}
20179 {{int:loop2}}
20180 !! endarticle
20181
20182 !! test
20183 Bug 31098 Template which includes system messages which includes the template
20184 !! wikitext
20185 {{Identical}}
20186 !! html
20187 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20188 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20189 </p>
20190 !! end
20191
20192 !! test
20193 Bug31490 Turkish: ucfirst 'blah'
20194 !! options
20195 language=tr
20196 !! wikitext
20197 {{ucfirst:blah}}
20198 !! html
20199 <p>Blah
20200 </p>
20201 !! end
20202
20203 !! test
20204 Bug31490 Turkish: ucfirst 'ix'
20205 !! options
20206 language=tr
20207 !! wikitext
20208 {{ucfirst:ix}}
20209 !! html
20210 <p>İx
20211 </p>
20212 !! end
20213
20214 !! test
20215 Bug31490 Turkish: lcfirst 'BLAH'
20216 !! options
20217 language=tr
20218 !! wikitext
20219 {{lcfirst:BLAH}}
20220 !! html
20221 <p>bLAH
20222 </p>
20223 !! end
20224
20225 !! test
20226 Bug31490 Turkish: ucfırst (with a dotless i)
20227 !! options
20228 language=tr
20229 !! wikitext
20230 {{ucfırst:blah}}
20231 !! html
20232 <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>
20233 </p>
20234 !! end
20235
20236 !! test
20237 Bug31490 ucfırst (with a dotless i) with English language
20238 !! options
20239 language=en
20240 !! wikitext
20241 {{ucfırst:blah}}
20242 !! html
20243 <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>
20244 </p>
20245 !! end
20246
20247 !! test
20248 Bug 26375: TOC with italics
20249 !! options
20250 title=[[Main Page]]
20251 !! wikitext
20252 __TOC__
20253 == ''Lost'' episodes ==
20254 !! html
20255 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20256 <ul>
20257 <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>
20258 </ul>
20259 </div>
20260
20261 <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>
20262
20263 !! end
20264
20265 !! test
20266 Bug 26375: TOC with bold
20267 !! options
20268 title=[[Main Page]]
20269 !! wikitext
20270 __TOC__
20271 == '''should be bold''' then normal text ==
20272 !! html
20273 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20274 <ul>
20275 <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>
20276 </ul>
20277 </div>
20278
20279 <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>
20280
20281 !! end
20282
20283 !! test
20284 Bug 33845: Headings become cursive in TOC when they contain an image
20285 !! options
20286 title=[[Main Page]]
20287 !! wikitext
20288 __TOC__
20289 == Image [[Image:foobar.jpg]] ==
20290 !! html
20291 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20292 <ul>
20293 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20294 </ul>
20295 </div>
20296
20297 <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>
20298
20299 !! end
20300
20301 !! test
20302 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20303 !! options
20304 title=[[Main Page]]
20305 !! wikitext
20306 __TOC__
20307 == <blockquote>Quote</blockquote> ==
20308 !! html
20309 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20310 <ul>
20311 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20312 </ul>
20313 </div>
20314
20315 <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>
20316
20317 !! html+tidy
20318 <p></p>
20319 <div id="toc" class="toc">
20320 <div id="toctitle">
20321 <h2>Contents</h2>
20322 </div>
20323 <ul>
20324 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20325 </ul>
20326 </div>
20327 <p></p>
20328 <h2><span class="mw-headline" id="Quote"></span></h2>
20329 <blockquote>
20330 <p><span class="mw-headline" id="Quote">Quote</span></p>
20331 </blockquote>
20332 <p><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></p>
20333 !! end
20334
20335 !! test
20336 Unclosed tags in TOC
20337 !! options
20338 title=[[Main Page]]
20339 !! wikitext
20340 __TOC__
20341 == Proof: 2 < 3 ==
20342 <small>Hanc marginis exiguitas non caperet.</small>
20343 QED
20344 !! html
20345 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20346 <ul>
20347 <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>
20348 </ul>
20349 </div>
20350
20351 <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>
20352 <p><small>Hanc marginis exiguitas non caperet.</small>
20353 QED
20354 </p>
20355 !! end
20356
20357 !! test
20358 Multiple tags in TOC
20359 !! wikitext
20360 __TOC__
20361 == <i>Foo</i> <b>Bar</b> ==
20362
20363 == <i>Foo</i> <blockquote>Bar</blockquote> ==
20364 !! html
20365 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20366 <ul>
20367 <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>
20368 <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>
20369 </ul>
20370 </div>
20371
20372 <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>
20373 <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>
20374
20375 !! html+tidy
20376 <p></p>
20377 <div id="toc" class="toc">
20378 <div id="toctitle">
20379 <h2>Contents</h2>
20380 </div>
20381 <ul>
20382 <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>
20383 <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>
20384 </ul>
20385 </div>
20386 <p></p>
20387 <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>
20388 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
20389 <blockquote>
20390 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
20391 </blockquote>
20392 <p><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></p>
20393 !! end
20394
20395 !! test
20396 Tags with parameters in TOC
20397 !! wikitext
20398 __TOC__
20399 == <sup class="in-h2">Hello</sup> ==
20400
20401 == <sup class="a > b">Evilbye</sup> ==
20402 !! html
20403 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20404 <ul>
20405 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
20406 <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>
20407 </ul>
20408 </div>
20409
20410 <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>
20411 <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;&gt;Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
20412
20413 !! end
20414
20415 !! test
20416 span tags with directionality in TOC
20417 !! wikitext
20418 __TOC__
20419 == <span dir="ltr">C++</span> ==
20420
20421 == <span dir="rtl">זבנג!</span> ==
20422
20423 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
20424
20425 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
20426
20427 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
20428 !! html
20429 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20430 <ul>
20431 <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>
20432 <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>
20433 <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>
20434 <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>
20435 <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>
20436 </ul>
20437 </div>
20438
20439 <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>
20440 <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>
20441 <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>
20442 <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>
20443 <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>
20444
20445 !! end
20446
20447 !! test
20448 Bug 72884: bdi element in ToC
20449 !! wikitext
20450 __TOC__
20451 == <bdi>test</bdi> ==
20452 !! html
20453 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20454 <ul>
20455 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
20456 </ul>
20457 </div>
20458
20459 <h2><span class="mw-headline" id="test"><bdi>test</bdi></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: test">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
20460
20461 !! end
20462
20463 # Note that the html output does not have the <p></p>, but the
20464 # html+tidy output *does*. This is because the empty <p></p> is
20465 # removed by the sanitizer, but only when tidy is *not* enabled (!).
20466 !! test
20467 Empty <p> tag in TOC, removed by Sanitizer (T92892)
20468 !! wikitext
20469 __TOC__
20470 == x ==
20471 !! html
20472 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20473 <ul>
20474 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20475 </ul>
20476 </div>
20477
20478 <h2><span class="mw-headline" id="x">x</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: x">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
20479
20480 !! html+tidy
20481 <p></p>
20482 <div id="toc" class="toc">
20483 <div id="toctitle">
20484 <h2>Contents</h2>
20485 </div>
20486 <ul>
20487 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20488 </ul>
20489 </div>
20490 <p></p>
20491 <h2><span class="mw-headline" id="x">x</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: x">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
20492 !! end
20493
20494 !! article
20495 MediaWiki:Bug32057
20496 !! text
20497 == {{int:headline_sample}} ==
20498 !! endarticle
20499
20500 !! test
20501 Bug 32057: Title needed when expanding <h> nodes.
20502 !! options
20503 title=[[Main Page]]
20504 !! wikitext
20505 {{int:Bug32057}}
20506 !! html
20507 <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>
20508
20509 !! end
20510
20511 !! test
20512 Strip marker in urlencode
20513 !! wikitext
20514 {{urlencode:x<nowiki/>y}}
20515 {{urlencode:x<nowiki/>y|wiki}}
20516 {{urlencode:x<nowiki/>y|path}}
20517 {{urlencode:x<pre id="one">two</pre>y}}
20518 !! html
20519 <p>xy
20520 xy
20521 xy
20522 xy
20523 </p>
20524 !! end
20525
20526 !! test
20527 Strip marker in lc
20528 !! wikitext
20529 {{lc:x<nowiki/>y}}
20530 !! html
20531 <p>xy
20532 </p>
20533 !! end
20534
20535 !! test
20536 Strip marker in uc
20537 !! wikitext
20538 {{uc:x<nowiki/>y}}
20539 !! html
20540 <p>XY
20541 </p>
20542 !! end
20543
20544 !! test
20545 Strip marker in formatNum
20546 !! wikitext
20547 {{formatnum:1<nowiki/>2}}
20548 {{formatnum:1<nowiki/>2|R}}
20549 !! html
20550 <p>12
20551 12
20552 </p>
20553 !! end
20554
20555 !! test
20556 Check noCommafy in formatNum
20557 !! options
20558 language=be-tarask
20559 !! wikitext
20560 {{formatnum:123456.78}}
20561 {{formatnum:123456.78|NOSEP}}
20562 !! html
20563 <p>123 456,78
20564 123456.78
20565 </p>
20566 !! end
20567
20568 !! test
20569 Wrong option for formatNum (bug 56199)
20570 !! wikitext
20571 {{formatnum:1,234.56|Random}}
20572 {{formatnum:1,234.56|EVERYTHING}}
20573 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
20574 !! html
20575 <p>1,234.56
20576 1,234.56
20577 1,234.56
20578 </p>
20579 !! end
20580
20581 !! test
20582 Strip marker in grammar
20583 !! options
20584 language=fi
20585 !! wikitext
20586 {{grammar:elative|foo<nowiki/>bar}}
20587 !! html
20588 <p>foobarista
20589 </p>
20590 !! end
20591
20592 !! test
20593 Strip marker in padleft
20594 !! wikitext
20595 {{padleft:|2|x<nowiki/>y}}
20596 !! html
20597 <p>xy
20598 </p>
20599 !! end
20600
20601 !! test
20602 Strip marker in padright
20603 !! wikitext
20604 {{padright:|2|x<nowiki/>y}}
20605 !! html
20606 <p>xy
20607 </p>
20608 !! end
20609
20610 !! test
20611 Strip marker in anchorencode
20612 !! wikitext
20613 {{anchorencode:x<nowiki/>y}}
20614 !! html
20615 <p>xy
20616 </p>
20617 !! end
20618
20619 !! test
20620 nowiki inside link inside heading (bug 18295)
20621 !! wikitext
20622 ==[[foo|x<nowiki>y</nowiki>z]]==
20623 !! html
20624 <h2><span class="mw-headline" id="xyz"><a href="/wiki/Foo" title="Foo">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>
20625
20626 !! end
20627
20628 !! test
20629 new support for bdi element (bug 31817)
20630 !! wikitext
20631 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20632 !! html
20633 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20634
20635 !!end
20636
20637 !! test
20638 Ignore pipe between table row attributes
20639 !! wikitext
20640 {|
20641 | quux
20642 |- id=foo | style='color: red'
20643 | bar
20644 |}
20645 !! html
20646 <table>
20647 <tr>
20648 <td> quux
20649 </td></tr>
20650 <tr id="foo" style="color: red">
20651 <td> bar
20652 </td></tr></table>
20653
20654 !! end
20655
20656 !!test
20657 Gallery override link with WikiLink (bug 34852)
20658 !! wikitext
20659 <gallery>
20660 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
20661 </gallery>
20662 !! html
20663 <ul class="gallery mw-gallery-traditional">
20664 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20665 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
20666 <div class="gallerytext">
20667 <p>caption
20668 </p>
20669 </div>
20670 </div></li>
20671 </ul>
20672
20673 !! end
20674
20675 !!test
20676 Gallery override link with absolute external link (bug 34852)
20677 !! wikitext
20678 <gallery>
20679 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20680 </gallery>
20681 !! html
20682 <ul class="gallery mw-gallery-traditional">
20683 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20684 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
20685 <div class="gallerytext">
20686 <p>caption
20687 </p>
20688 </div>
20689 </div></li>
20690 </ul>
20691
20692 !! end
20693
20694 !!test
20695 Gallery override link with malicious javascript (bug 34852)
20696 !! wikitext
20697 <gallery>
20698 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20699 </gallery>
20700 !! html
20701 <ul class="gallery mw-gallery-traditional">
20702 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20703 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
20704 <div class="gallerytext">
20705 <p>caption
20706 </p>
20707 </div>
20708 </div></li>
20709 </ul>
20710
20711 !! end
20712
20713 !!test
20714 Gallery with invalid title as link (bug 43964)
20715 !! wikitext
20716 <gallery>
20717 File:foobar.jpg|link=<
20718 </gallery>
20719 !! html
20720 <ul class="gallery mw-gallery-traditional">
20721 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20722 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
20723 <div class="gallerytext">
20724 </div>
20725 </div></li>
20726 </ul>
20727
20728 !! end
20729
20730 !!test
20731 Language parser function
20732 !! wikitext
20733 {{#language:ar}}
20734 !! html
20735 <p>العربية
20736 </p>
20737 !! end
20738
20739 !!test
20740 Padleft and padright as substr
20741 !! wikitext
20742 {{padleft:|3|abcde}}
20743 {{padright:|3|abcde}}
20744 !! html
20745 <p>abc
20746 abc
20747 </p>
20748 !! end
20749
20750 !!test
20751 Special parser function
20752 !! wikitext
20753 {{#special:RandomPage}}
20754 {{#special:BaDtItLe}}
20755 {{#special:Foobar}}
20756 !! html
20757 <p>Special:Random
20758 Special:Badtitle
20759 Special:Foobar
20760 </p>
20761 !! end
20762
20763 !!test
20764 Bug 34939 - Case insensitive link parsing ([HttP://])
20765 !! wikitext
20766 [HttP://MediaWiki.Org/]
20767 !! html/php
20768 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
20769 </p>
20770 !! html/parsoid
20771 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
20772 !! end
20773
20774 !!test
20775 Bug 34939 - Case insensitive link parsing ([HttP:// title])
20776 !! wikitext
20777 [HttP://MediaWiki.Org/ MediaWiki]
20778 !! html
20779 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
20780 </p>
20781 !! end
20782
20783 !!test
20784 Bug 34939 - Case insensitive link parsing (HttP://)
20785 !! wikitext
20786 HttP://MediaWiki.Org/
20787 !! html/php
20788 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
20789 </p>
20790 !! html/parsoid
20791 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
20792 !! end
20793
20794 !!test
20795 Disable TOC
20796 !! options
20797 notoc
20798 !! wikitext
20799 Lead
20800 == Section 1 ==
20801 == Section 2 ==
20802 == Section 3 ==
20803 == Section 4 ==
20804 == Section 5 ==
20805 !! html
20806 <p>Lead
20807 </p>
20808
20809 <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>
20810 <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=2" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
20811 <h2><span class="mw-headline" id="Section_3">Section 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: Section 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
20812 <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=4" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
20813 <h2><span class="mw-headline" id="Section_5">Section 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: Section 5">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
20814
20815 !! end
20816
20817
20818 ###
20819 ### Parsoid-specific tests
20820 ### Parsoid-PHP parser incompatibilities
20821 ###
20822 !!test
20823 1. SOL-sensitive wikitext tokens as template-args
20824 !!options
20825 parsoid=wt2html,wt2wt
20826 !! wikitext
20827 {{echo|*a}}
20828 {{echo|#a}}
20829 {{echo|:a}}
20830 !! html
20831 <span about="#mwt1" typeof="mw:Transclusion">
20832 </span><ul about="#mwt1"><li>a</li>
20833 </ul>
20834 <span about="#mwt2" typeof="mw:Transclusion">
20835 </span><ol about="#mwt2"><li>a</li>
20836 </ol>
20837 <span about="#mwt3" typeof="mw:Transclusion">
20838 </span><dl about="#mwt3"><dd>a</dd>
20839 </dl>
20840 !!end
20841
20842 #### -----------------------------------------------------------------
20843 #### Parsoid-specific functionality tests
20844 #### -----------------------------------------------------------------
20845
20846 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
20847 # We know wt2wt will fail, but we expect selser to pass.
20848 # Due to the nature of our testing, wt2wt and selser tests will enter the
20849 # blacklist and we'll catch selser regressions based on changes to the
20850 # blacklist entries for selser tests.
20851 !! test
20852 1. Bad treebuilder fixup of formatting elt is cleaned up
20853 !! options
20854 parsoid=wt2html,wt2wt
20855 !! wikitext
20856 {|
20857 |
20858 <small>
20859 [[Image:Foobar.jpg|right|Test]]
20860 </small>
20861 |}
20862 !! html/parsoid
20863 <table>
20864 <tbody><tr><td>
20865 <small>
20866 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Test</figcaption></figure>
20867 </small>
20868 </td></tr>
20869 </tbody></table>
20870 !! end
20871
20872 !! test
20873 2. Bad treebuilder fixup of formatting elt is cleaned up
20874 !! options
20875 parsoid=wt2html,wt2wt
20876 !! wikitext
20877 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
20878
20879 <small>[[Image:Foobar.jpg|right|300px]]</small>
20880 !! html/parsoid
20881
20882 <p><b>foo</b></p>
20883 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><b>caption</b></figcaption></figure>
20884 <p><b>bar</b></p>
20885 <small><figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></figure></small>
20886 !! end
20887
20888 !! test
20889 3. Bad treebuilder fixup of formatting elt is cleaned up
20890 !! options
20891 parsoid=wt2html,wt2wt
20892 !! wikitext
20893 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
20894 !! html/parsoid
20895 <p><small><b>foo</b></small></p>
20896 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><small><b>caption</b></small></figcaption></figure>
20897 <p><small><b>bar</b></small></p>
20898 !! end
20899
20900 !! test
20901 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
20902 !! options
20903 parsoid=wt2html,wt2wt
20904 !! wikitext
20905 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
20906 !! html/parsoid
20907 <p><b><small></small></b></p>
20908 <figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></figure>
20909 <p></p>
20910 !! end
20911
20912 #### ----------------------------------------------------------------
20913 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
20914 #### tags. Parsoid's output for these tags differs from that of the
20915 #### PHP parser.
20916 #### ----------------------------------------------------------------
20917
20918 !!test
20919 Ref: 1. ref-location should be replaced with an index span
20920 !!options
20921 parsoid
20922 !! wikitext
20923 A <ref>foo</ref>
20924 B <ref name="x">foo</ref>
20925 C <ref name="y" />
20926 <references />
20927 !! html
20928 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
20929 B <span about="#mwt4" class="mw-ref" id="cite_ref-x_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-2"},"attrs":{"name":"x"}}'><a href="#cite_note-x-2"><span class="mw-reflink-text">[2]</span></a></span>
20930 C <span about="#mwt6" class="mw-ref" id="cite_ref-y_3-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"y"}}'><a href="#cite_note-y-3"><span class="mw-reflink-text">[3]</span></a></span></p>
20931 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20932 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
20933 <li about="#cite_note-x-2" id="cite_note-x-2"><a href="#cite_ref-x_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-x-2" class="mw-reference-text">foo</span></li>
20934 <li about="#cite_note-y-3" id="cite_note-y-3"><a href="#cite_ref-y_3-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-y-3" class="mw-reference-text"></span></li>
20935 </ol>
20936 !!end
20937
20938 !!test
20939 Ref: 2. ref-tags with identical names should all get the same index
20940 !!options
20941 parsoid
20942 !! wikitext
20943 A <ref name="x">foo</ref>
20944 B <ref name="x" />
20945 <references />
20946 !! html
20947 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
20948 B <span about="#mwt4" class="mw-ref" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
20949 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20950 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
20951 </ol>
20952 !!end
20953
20954 !!test
20955 Ref: 3. spaces in ref-names should be ignored
20956 !!options
20957 parsoid
20958 !! wikitext
20959 A <ref name="x">foo</ref>
20960 B <ref name=" x " />
20961 C <ref name= x />
20962 <references />
20963 !! html
20964 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
20965 B <span about="#mwt4" class="mw-ref" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
20966 C <span about="#mwt6" class="mw-ref" id="cite_ref-x_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
20967 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20968 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a><a href="#cite_ref-x_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
20969 </ol>
20970 !!end
20971
20972 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
20973 !!test
20974 Ref: 4. 'constructor' should be accepted as a valid ref-name
20975 !!options
20976 parsoid
20977 !! wikitext
20978 A <ref name="constructor">foo</ref>
20979 <references />
20980 !! html
20981 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-constructor_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-constructor-1"},"attrs":{"name":"constructor"}}'><a href="#cite_note-constructor-1"><span class="mw-reflink-text">[1]</span></a></span></p>
20982 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20983 <li about="#cite_note-constructor-1" id="cite_note-constructor-1"><a href="#cite_ref-constructor_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-constructor-1" class="mw-reference-text">foo</span></li>
20984 </ol>
20985 !!end
20986
20987 !!test
20988 Ref: 5. body should accept generic wikitext
20989 !!options
20990 parsoid
20991 !! wikitext
20992 A <ref>
20993 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
20994 </ref>
20995
20996 <references />
20997 !! html
20998 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
20999
21000 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21001 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">This is a <b><a rel="mw:WikiLink" href="Bolded_link" title="Bolded link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}'>transclusion</span>
21002 </span></li>
21003 </ol>
21004 !!end
21005
21006 !!test
21007 Ref: 6. indent-pres should not be output in ref-body
21008 !!options
21009 parsoid
21010 !! wikitext
21011 A <ref>
21012 foo
21013 bar
21014 baz
21015 </ref>
21016
21017 <references />
21018 !! html
21019 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21020
21021 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21022 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
21023 bar
21024 baz
21025 </span></li>
21026 </ol>
21027 !!end
21028
21029 !!test
21030 Ref: 7. No p-wrapping in ref-body
21031 !!options
21032 parsoid
21033 !! wikitext
21034 A <ref>
21035 foo
21036
21037 bar
21038
21039
21040 baz
21041
21042
21043
21044 booz
21045 </ref>
21046
21047 <references />
21048 !! html
21049 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21050
21051 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21052 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
21053
21054 bar
21055
21056
21057 baz
21058
21059
21060
21061 booz
21062 </span></li>
21063 </ol>
21064 !!end
21065
21066 !!test
21067 Ref: 8. transclusion wikitext has lower precedence
21068 !!options
21069 parsoid
21070 !! wikitext
21071 A <ref> foo {{echo|</ref> B C}}
21072
21073 <references />
21074 !! html
21075 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C<span typeof="mw:Nowiki">}}</span></p>
21076 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21077 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <span typeof="mw:Nowiki" data-parsoid='{"src":"{{","dsr":[12,14,0,0]}'>{{</span>echo|</span></li>
21078 </ol>
21079 !!end
21080
21081 !!test
21082 Ref: 9. unclosed comments should not leak out of ref-body
21083 !!options
21084 parsoid
21085 !! wikitext
21086 A <ref> foo <!--</ref> B C
21087 <references />
21088 !! html
21089 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
21090 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21091 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <!----></span></li>
21092 </ol>
21093 !!end
21094
21095 !!test
21096 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21097 !!options
21098 parsoid
21099 !! wikitext
21100 A <ref> <b> foo </ref> B C
21101
21102 <references />
21103 !! html
21104 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
21105
21106
21107 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21108 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></span></li>
21109 </ol>
21110 !!end
21111
21112 !!test
21113 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21114 !!options
21115 parsoid
21116 !! wikitext
21117 A <ref>foo</ref> B
21118 C <ref>bar</ref> D
21119 <references />
21120 !! html
21121 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B
21122 C <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> D</p>
21123 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21124 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
21125 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
21126 </ol>
21127 !!end
21128
21129 !!test
21130 Ref: 12. ref-tags act as trailing newline migration barrier
21131 !! wikitext
21132 <!--the newline at the end of this line moves out of the p tag-->a
21133
21134 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21135 <ref />
21136
21137 c
21138 <references />
21139 !! html/parsoid
21140 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21141
21142
21143 <p>b<!--the newline at the end of this line stays inside the p tag--> <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
21144 <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span></p>
21145
21146 <p>c</p>
21147 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21148 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"></span></li>
21149 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"></span></li></ol>
21150 !!end
21151
21152 !!test
21153 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21154 !!options
21155 parsoid
21156 !! wikitext
21157 <ref>foo</ref> A
21158 <ref>bar
21159 </ref> B
21160 <references />
21161 !! html
21162 <p><span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> A
21163 <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> B</p>
21164 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21165 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
21166 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar
21167 </span></li>
21168 </ol>
21169 !!end
21170
21171 !!test
21172 Ref: 14. A nested ref-tag should be emitted as plain text
21173 !!options
21174 parsoid
21175 !! wikitext
21176 <ref>foo <ref>bar</ref> baz</ref>
21177
21178 <references />
21179 !! html
21180 <p><span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
21181 </p>
21182 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21183 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo &lt;ref>bar&lt;/ref> baz</span></li>
21184 </ol>
21185 !!end
21186
21187 !!test
21188 Ref: 15. ref-tags with identical names should get identical indexes
21189 !!options
21190 parsoid
21191 !! wikitext
21192 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21193 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21194
21195 <references />
21196 !! html
21197 <p>A1 <span about="#mwt3" class="mw-ref" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a-1"},"attrs":{"name":"a"}}'><a href="#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span> A2 <span about="#mwt4" class="mw-ref" id="cite_ref-a_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
21198 B1 <span about="#mwt7" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"b"}}'><a href="#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span> B2 <span about="#mwt8" class="mw-ref" id="cite_ref-b_2-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
21199
21200 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-a_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b_2-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-b_2-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
21201 </ol>
21202 !!end
21203
21204 ## We don't bother wt2wt-ing non-standard whitespace
21205 !!test
21206 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21207 !!options
21208 parsoid=wt2html
21209 !! wikitext
21210 A <ref >foo</ref >
21211
21212 <references />
21213 !! html
21214 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21215 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21216 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
21217 !!end
21218
21219 !!test
21220 Ref: 17. Generate valid HTML5 id/about attributes
21221 !!options
21222 parsoid
21223 !!wikitext
21224 <ref name="a b">foo</ref>
21225
21226 <references />
21227 !!html
21228 <p><span class="mw-ref" id="cite_ref-a_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a_b-1"},"attrs":{"name":"a b"}}'><a href="#cite_note-a_b-1"><span class="mw-reflink-text">[1]</span></a></span>
21229 </p>
21230
21231 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21232 <li about="#cite_note-a_b-1" id="cite_note-a_b-1"><a href="#cite_ref-a_b_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a_b-1" class="mw-reference-text">foo</span></li>
21233 </ol>
21234 !!end
21235
21236 !!test
21237 Ref: 18. T58916: Extension attributes should be parsed as plain text
21238 !!options
21239 parsoid
21240 !!wikitext
21241 <ref name="{{echo|a}}">foo</ref>
21242
21243 <references />
21244 !!html
21245 <p><span class="mw-ref" id="cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1"},"attrs":{"name":"{{echo|a}}"}}'><a href="#cite_note-.7B.7Becho.7Ca.7D.7D-1"><span class="mw-reflink-text">[1]</span></a></span>
21246 </p>
21247
21248 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21249 <li about="#cite_note-.7B.7Becho.7Ca.7D.7D-1" id="cite_note-.7B.7Becho.7Ca.7D.7D-1"><a href="#cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1" class="mw-reference-text">foo</span></li>
21250 </ol>
21251 !!end
21252
21253 !!test
21254 Ref: 19. ref-tags with identical name encodings should get identical indexes
21255 !!options
21256 parsoid
21257 !! wikitext
21258 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21259
21260 <references />
21261 !! html
21262 <p>1 <span about="#mwt3" class="mw-ref" id="cite_ref-a_.26_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a_.26_b-1"},"attrs":{"name":"a &amp; b"}}'><a href="#cite_note-a_.26_b-1"><span class="mw-reflink-text">[1]</span></a></span> 2 <span about="#mwt4" class="mw-ref" id="cite_ref-a_.26_b_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a &amp;amp; b"}}'><a href="#cite_note-a_.26_b-1"><span class="mw-reflink-text">[1]</span></a></span>
21263 </p>
21264 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21265 <li about="#cite_note-a_.26_b-1" id="cite_note-a_.26_b-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_.26_b_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-a_.26_b_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a_.26_b-1" class="mw-reference-text">foo</span></li>
21266 </ol>
21267 !!end
21268
21269 !!test
21270 Ref: 20. ref-tags with identical names but different content should keep it
21271 !!options
21272 parsoid
21273 !! wikitext
21274 A <ref name="foo">Foo one</ref>
21275 B <ref name="foo">Foo two</ref>
21276 C <ref name="foo" />
21277
21278 <references />
21279 !! html
21280 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-foo_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-foo-1"},"attrs":{"name":"foo"}}'><a href="#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
21281 B <span about="#mwt4" class="mw-ref" id="cite_ref-foo_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"Foo two"},"attrs":{"name":"foo"}}'><a href="#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
21282 C <span about="#mwt6" class="mw-ref" id="cite_ref-foo_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"foo"}}'><a href="#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21283
21284 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-foo-1" id="cite_note-foo-1"><span rel="mw:referencedBy"><a href="#cite_ref-foo_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-foo_1-1"><span class="mw-linkback-text">2 </span></a><a href="#cite_ref-foo_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-foo-1" class="mw-reference-text">Foo one</span></li>
21285 </ol>
21286 !!end
21287
21288 !!test
21289 References: 1. references tag without any refs should be handled properly
21290 !! wikitext
21291 <references />
21292 !! html/parsoid
21293 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21294 !!end
21295
21296 !!test
21297 References: 2. references tag with group only outputs references from that group
21298 !! wikitext
21299 A <ref group="a">foo</ref>
21300 B <ref group="b">bar</ref>
21301 C <ref>baz</ref>
21302
21303 <references group="a" />
21304 <references />
21305 <references group="b" />
21306 !! html/parsoid
21307 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
21308 B <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"b"}}'><a href="#cite_note-2" data-mw-group="b"><span class="mw-reflink-text">[b 1]</span></a></span>
21309 C <span class="mw-ref" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="#cite_note-3"><span class="mw-reflink-text">[1]</span></a></span></p>
21310
21311 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21312 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
21313 </ol>
21314 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21315 <li about="#cite_note-3" id="cite_note-3"><a href="#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">baz</span></li>
21316 </ol>
21317 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21318 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" data-mw-group="b" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
21319 </ol>
21320 !!end
21321
21322 !!test
21323 References: 3. ref list should be cleared after processing references
21324 !! wikitext
21325 A <ref>foo</ref>
21326
21327 <references />
21328
21329 B <ref>bar</ref>
21330
21331 <references />
21332 !! html/parsoid
21333 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21334
21335 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
21336 </ol>
21337
21338 <p>B <span about="#mwt6" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
21339
21340 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21341 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
21342 </ol>
21343 !!end
21344
21345 !!test
21346 References: 4. only referenced group should be cleared after processing references
21347 !! wikitext
21348 A <ref group="a">afoo</ref>
21349 B <ref>bfoo</ref>
21350
21351 <references group="a" />
21352
21353 C <ref>cfoo</ref>
21354
21355 <references />
21356 !! html/parsoid
21357 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
21358 B <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
21359
21360 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">afoo</span></li>
21361 </ol>
21362
21363 <p>C <span about="#mwt8" class="mw-ref" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="#cite_note-3"><span class="mw-reflink-text">[2]</span></a></span></p>
21364
21365 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bfoo</span></li><li about="#cite_note-3" id="cite_note-3"><a href="#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">cfoo</span></li>
21366 </ol>
21367 !!end
21368
21369 !!test
21370 References: 5. ref tags in references should be processed while ignoring all other content
21371 !! wikitext
21372 A <ref name="a" />
21373 B <ref name="b">bar</ref>
21374
21375 <references>
21376 <ref name="a">foo</ref>
21377 This should just get lost.
21378 </references>
21379 !! html/parsoid
21380 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
21381 B <span about="#mwt4" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
21382
21383
21384 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"a\">foo&lt;/ref>\nThis should just get lost.","html":"\n&lt;span about=\"#mwt8\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[59,82,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-a-1\"},\"attrs\":{\"name\":\"a\"}}&#39;>&lt;a href=\"#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>\n"},"attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><a href="#cite_ref-a_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><a href="#cite_ref-b_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
21385 </ol>
21386 !!end
21387
21388 !!test
21389 References: 6. <references /> from a transclusion
21390 !! wikitext
21391 <ref>Foo</ref> {{echo|<references />}}
21392 !! html/parsoid
21393 <p><span about="#mwt3" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p> <ol class="mw-references" typeof="mw:Extension/references mw:Transclusion" about="#mwt4" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;references />"}},"i":0}}]}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">Foo</span></li>
21394 </ol>
21395 !!end
21396
21397 !! test
21398 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
21399 !! wikitext
21400 A <ref>foo bar for a</ref>
21401 B <ref group="X" name="b" />
21402
21403 <references />
21404
21405 <references group="X">
21406 <ref name="b">foo</ref>
21407 </references>
21408 !! html/parsoid
21409 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
21410 B <span about="#mwt4" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}'><a href="#cite_note-b-2" data-mw-group="X"><span class="mw-reflink-text">[X 1]</span></a></span>
21411 </p>
21412
21413 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21414 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo bar for a</span></li>
21415 </ol>
21416
21417 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="X" data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"b\">foo&lt;/ref>","html":"\n&lt;span about=\"#mwt10\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[96,119,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-b-2\"},\"attrs\":{\"name\":\"b\"}}&#39;>&lt;a href=\"#cite_note-b-2\" style=\"counter-reset: mw-Ref 1;\" data-mw-group=\"X\">&lt;span class=\"mw-reflink-text\">[X 1]&lt;/span>&lt;/a>&lt;/span>\n"},"attrs":{"group":"X"}}'>
21418 <li about="#cite_note-b-2" id="cite_note-b-2"><a href="#cite_ref-b_2-0" data-mw-group="X" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">foo</span></li>
21419 </ol>
21420 !! end
21421
21422 !! test
21423 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
21424 !! wikitext
21425 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
21426 <references />
21427 !! html/parsoid
21428 <p>X<span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo {{echo|&lt;b>bar&lt;/b>}} and {{echo|baz}} boo&lt;/ref>"}},"i":0}}]}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21429 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt7" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <b data-parsoid='{"stx":"html"}'>bar</b> and baz boo</span></li>
21430 </ol>
21431 !!end
21432
21433 # This test only works in wt2html now as the <references /> are always generated
21434 # unless selser is active. Once T72722 is fixed, we should add a changes test
21435 # here to ensure that unrelated changes don't add the new <references /> in
21436 # wt2wt.
21437 !! test
21438 References: 9. Generate missing references list at the end
21439 !! wikitext
21440 A <ref>foo</ref>
21441 B <ref group="inexistent">bar</ref>
21442 !! html/parsoid
21443 <p>A <span class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B <span class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"inexistent"}}'><a href="#cite_note-2" data-mw-group="inexistent"><span class="mw-reflink-text">[inexistent 1]</span></a></span></p>
21444 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21445 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
21446 </ol>
21447 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
21448 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" data-mw-group="inexistent" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
21449 </ol>
21450 !! end
21451
21452 !! test
21453 References: 10. New <references/> shouldn't be added for unrelated edits.
21454 !! options
21455 parsoid={
21456 "modes": ["selser"],
21457 "changes": [["#x", "remove"]],
21458 "selser": "noauto"
21459 }
21460 !! wikitext
21461 Unrelated text<span id="x"> that's going to disappear</span>.
21462 A <ref>foo</ref>
21463 !! wikitext/edited
21464 Unrelated text.
21465 A <ref>foo</ref>
21466 !!end
21467
21468 !! test
21469 Entities in ref name
21470 !! wikitext
21471 <ref name="test &amp; me">hi</ref>
21472 <references />
21473 !! html/parsoid
21474 <p><span about="#mwt2" class="mw-ref" id="cite_ref-test_.26_me_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-test_.26_me-1"},"attrs":{"name":"test &amp;amp; me"}}'><a href="#cite_note-test_.26_me-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21475 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21476 <li about="#cite_note-test_.26_me-1" id="cite_note-test_.26_me-1"><a href="#cite_ref-test_.26_me_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-test_.26_me-1" class="mw-reference-text">hi</span></li>
21477 </ol>
21478 !! end
21479
21480 # This test is wt2html only because we're permitting the serializer to produce
21481 # dirty diffs, normalizing the unclosed references to the self-closed version.
21482 !! test
21483 Generate references for unclosed references tag
21484 !! options
21485 parsoid=wt2html
21486 !! wikitext
21487 a<ref>foo</ref>
21488
21489 <references>
21490 !! html/parsoid
21491 <p>a<span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21492 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21493 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
21494 !! end
21495
21496 !! test
21497 New reference serializes on its own line
21498 !! options
21499 parsoid=wt2wt,html2wt
21500 !! wikitext
21501 foo
21502 <references />
21503 !! html/parsoid
21504 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21505 !! end
21506
21507 #### ----------------------------------------------------------------
21508 #### Parsoid-only testing of Parsoid's impl of LST
21509 #### Not implemented yet, see
21510 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
21511 #### ----------------------------------------------------------------
21512
21513 !!test
21514 LST Sections: 1. Simple section start and end
21515 !! wikitext
21516 <section begin="2011-05-16" />
21517 <section end="2014-04-10 (MW 1.23wmf22)" />
21518 !! html/parsoid
21519 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
21520 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
21521 !! end
21522
21523 #--------- Test stripping of empty nodes in template content ----------
21524 !!test
21525 Empty LI and TR nodes should be stripped from template content
21526 !!wikitext
21527 {{EmptyLITest}}
21528 {{EmptyTRTest}}
21529 !!html/parsoid
21530 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
21531 <li>a</li>
21532 <li>b</li>
21533 </ul>
21534 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
21535 <tbody>
21536 <tr>
21537 <td>foo</td>
21538 </tr>
21539 <tr>
21540 <td>bar</td>
21541 </tr>
21542 </tbody>
21543 </table>
21544 !!end
21545
21546 !!test
21547 Empty LI and TR nodes should not be stripped from top-level content
21548 !!wikitext
21549 * a
21550 *
21551 * b
21552 {|
21553 |-
21554 |-
21555 |foo
21556 |}
21557 !!html/parsoid
21558 <ul>
21559 <li> a</li>
21560 <li></li>
21561 <li> b</li>
21562 </ul>
21563 <table>
21564 <tbody>
21565 <tr></tr>
21566 <tr>
21567 <td>foo</td>
21568 </tr>
21569 </tbody>
21570 </table>
21571 !!end
21572
21573 !!test
21574 Empty TR nodes should not be stripped if they have any attributes set
21575 !!wikitext
21576 {{EmptyTRWithHTMLAttrTest}}
21577 !!html/parsoid
21578 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
21579 <tr align="center"></tr>
21580 <tr><td>foo</td></tr>
21581 <tr align="center"></tr>
21582 <tr><td>bar</td></tr>
21583 </table>
21584 !!end
21585
21586 #### ----------------------------------------------------------------
21587 #### The following section of tests are primarily to test
21588 #### wikitext escaping capabilities of Parsoid. Given that
21589 #### escaping can be done any number of ways, the wikitext (input)
21590 #### is always adjusted to reflect how Parsoid adds nowiki
21591 #### escape tags.
21592 ####
21593 #### We are marking several tests as parsoid-only since the
21594 #### HTML in the result section is different from what the
21595 #### PHP parser generates for it.
21596 #### ----------------------------------------------------------------
21597
21598
21599 #### --------------- Headings ---------------
21600 #### 0. Unnested
21601 #### 1. Nested inside html <h1>=foo=</h1>
21602 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
21603 #### 3. Nested inside html with wikitext split by html tags
21604 #### 4. No escape needed
21605 #### 5. Empty headings <h1></h1>
21606 #### 6. Heading chars in SOL context
21607 #### ----------------------------------------
21608 !! test
21609 Headings: 0. Unnested
21610 !! options
21611 parsoid
21612 !! wikitext
21613 <nowiki>=foo=</nowiki>
21614
21615 <nowiki> =foo= </nowiki>
21616 <!--cmt-->
21617 <nowiki>=foo=</nowiki>
21618
21619 =foo''a''<nowiki>=</nowiki>
21620 !! html
21621 <p><span typeof="mw:Nowiki">=foo=</span></p>
21622
21623 <p><span typeof="mw:Nowiki"> =foo= </span>
21624 <!--cmt-->
21625 <span typeof="mw:Nowiki">=foo=</span></p>
21626
21627 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
21628 !!end
21629
21630 # New headings and existing headings are handled differently
21631 !! test
21632 Headings: 1. Nested inside html
21633 !! options
21634 parsoid=html2wt
21635 !! html
21636 <h1>=foo=</h1>
21637 <h2>=foo=</h2>
21638 <h3>=foo=</h3>
21639
21640 <h1 data-parsoid=''>=foo=</h1>
21641 <h2 data-parsoid=''>=foo=</h2>
21642 <h3 data-parsoid=''>=foo=</h3>
21643 <h4 data-parsoid=''>=foo=</h4>
21644 <h5 data-parsoid=''>=foo=</h5>
21645 <h6 data-parsoid=''>=foo=</h6>
21646 !! wikitext
21647 = =foo= =
21648
21649 == =foo= ==
21650
21651 === =foo= ===
21652
21653 =<nowiki>=foo=</nowiki>=
21654 ==<nowiki>=foo=</nowiki>==
21655 ===<nowiki>=foo=</nowiki>===
21656 ====<nowiki>=foo=</nowiki>====
21657 =====<nowiki>=foo=</nowiki>=====
21658 ======<nowiki>=foo=</nowiki>======
21659
21660 !!end
21661
21662 !! test
21663 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
21664 !! options
21665 parsoid=html2wt
21666 !! html
21667 <h1>foo</h1>*bar
21668 <h1>foo</h1>=bar
21669 <h1>foo</h1>=bar=
21670 !! wikitext
21671 = foo =
21672 <nowiki>*</nowiki>bar
21673
21674 = foo =
21675 =bar
21676
21677 = foo =
21678 <nowiki>=bar=</nowiki>
21679 !!end
21680
21681 !! test
21682 Headings: 3. Nested inside html with wikitext split by html tags
21683 !! options
21684 parsoid=html2wt,wt2wt
21685 !! wikitext
21686 = ='''bold'''<nowiki>foo=</nowiki> =
21687 !! html/parsoid
21688 <h1>=<b>bold</b>foo=</h1>
21689 !!end
21690
21691 !! test
21692 Headings: 4a. No escaping needed (testing just h1 and h2)
21693 !! wikitext
21694 = =foo =
21695
21696 = foo= =
21697
21698 = =foo= =
21699
21700 = =foo= bar =
21701
21702 == =foo ==
21703
21704 == foo= ==
21705
21706 = = =
21707
21708 = ''=''foo= =
21709 !! html/parsoid
21710 <h1>=foo</h1>
21711 <h1>foo=</h1>
21712 <h1> =foo= </h1>
21713 <h1>=foo= bar</h1>
21714 <h2>=foo</h2>
21715 <h2>foo=</h2>
21716 <h1>=</h1>
21717 <h1><i>=</i>foo=</h1>
21718 !!end
21719
21720 !! test
21721 Headings: 4b. No escaping needed (inside p-tags)
21722 !! options
21723 parsoid=html2wt
21724 !! html
21725 <p>===
21726 =foo= x
21727 =foo= <s></s>
21728 </p>
21729 !! wikitext
21730 ===
21731 =foo= x
21732 =foo= <s></s>
21733 !!end
21734
21735 !! test
21736 Headings: 5. Empty headings
21737 !! wikitext
21738 =<nowiki/>=
21739
21740 ==<nowiki/>==
21741
21742 ===<nowiki/>===
21743
21744 ====<nowiki/>====
21745
21746 =====<nowiki/>=====
21747
21748 ======<nowiki/>======
21749 !! html/parsoid
21750 <h1 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h1>
21751
21752 <h2 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h2>
21753
21754 <h3 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h3>
21755
21756 <h4 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h4>
21757
21758 <h5 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h5>
21759
21760 <h6 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h6>
21761 !!end
21762
21763 !! test
21764 Headings: 6a. Heading chars in SOL context (with trailing spaces)
21765 !! wikitext
21766 <nowiki>=a=</nowiki>
21767
21768 <nowiki>=a=</nowiki>
21769
21770 <nowiki>=a=</nowiki>
21771
21772 <nowiki>=a=</nowiki>
21773 !! html/php
21774 <p>=a=
21775 </p><p>=a=
21776 </p><p>=a=
21777 </p><p>=a=
21778 </p>
21779 !! html/parsoid
21780 <p><span typeof="mw:Nowiki">=a=</span></p>
21781
21782 <p><span typeof="mw:Nowiki">=a=</span></p>
21783
21784 <p><span typeof="mw:Nowiki">=a=</span></p>
21785
21786 <p><span typeof="mw:Nowiki">=a=</span></p>
21787 !!end
21788
21789 !! test
21790 Headings: 6b. Heading chars in SOL context (with trailing newlines)
21791 !! wikitext
21792 <nowiki>=a=
21793 b</nowiki>
21794
21795 <nowiki>=a=
21796 b</nowiki>
21797
21798 <nowiki>=a=
21799 b</nowiki>
21800
21801 <nowiki>=a=
21802 b</nowiki>
21803 !! html/php
21804 <p>=a=
21805 b
21806 </p><p>=a=
21807 b
21808 </p><p>=a=
21809 b
21810 </p><p>=a=
21811 b
21812 </p>
21813 !! html/parsoid
21814 <p><span typeof="mw:Nowiki">=a=
21815 b</span></p>
21816
21817 <p><span typeof="mw:Nowiki">=a=
21818 b</span></p>
21819
21820 <p><span typeof="mw:Nowiki">=a=
21821 b</span></p>
21822
21823 <p><span typeof="mw:Nowiki">=a=
21824 b</span></p>
21825 !!end
21826
21827 !! test
21828 Headings: 6c. Heading chars in SOL context (leading newline break)
21829 !! wikitext
21830 a
21831 <nowiki>=b=</nowiki>
21832 !! html/php
21833 <p>a
21834 =b=
21835 </p>
21836 !! html/parsoid
21837 <p>a
21838 <span typeof="mw:Nowiki">=b=</span>
21839 !!end
21840
21841 !! test
21842 Headings: 6d. Heading chars in SOL context (with interspersed comments)
21843 !! wikitext
21844 <!--c0--><nowiki>=a=</nowiki>
21845
21846 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
21847 !! html/php
21848 <p>=a=
21849 </p><p>=a=
21850 </p>
21851 !! html/parsoid
21852 <!--c0--><p><span typeof="mw:Nowiki">=a=</span></p>
21853
21854 <!--c1--><p><span typeof="mw:Nowiki">=a=</span></p> <!--c2--> <!--c3-->
21855 !!end
21856
21857 !! test
21858 Headings: 6d. Heading chars in SOL context (No escaping needed)
21859 !! options
21860 parsoid=html2wt
21861 !! html/parsoid
21862 =a=<div>b</div>
21863 !! wikitext
21864 =a=<div>b</div>
21865 !!end
21866
21867 !! test
21868 Headings: 7. Insert a newline between new content and headings
21869 !! options
21870 parsoid=html2wt
21871 !! html/parsoid
21872 <h2>NEW</h2>
21873 <p>new</p>
21874 <h2 data-parsoid='{}'>A</h2>
21875 <p data-parsoid='{}'>a</p>
21876 !! wikitext
21877 == NEW ==
21878 new
21879
21880 ==A==
21881 a
21882
21883 !! end
21884
21885 #### --------------- Lists ---------------
21886 #### 0. Outside nests (*foo, etc.)
21887 #### 1. Nested inside html <ul><li>*foo</li></ul>
21888 #### 2. Inside definition lists
21889 #### 3. Only bullets at start should be escaped
21890 #### 4. No escapes needed
21891 #### 5. No unnecessary escapes
21892 #### 6. Escape bullets in SOL position
21893 #### 7. Escape bullets in a multi-line context
21894 #### ----------------------------------------
21895
21896 !! test
21897 Lists: 0. Outside nests
21898 !! wikitext
21899 <nowiki>*</nowiki>foo
21900
21901 <nowiki>#</nowiki>foo
21902
21903 <nowiki>;Foo:</nowiki>bar
21904 !! html/php
21905 <p>*foo
21906 </p><p>#foo
21907 </p><p>;Foo:bar
21908 </p>
21909 !! html/parsoid
21910 <p><span typeof="mw:Nowiki">*</span>foo</p>
21911
21912 <p><span typeof="mw:Nowiki">#</span>foo</p>
21913
21914 <p><span typeof="mw:Nowiki">;Foo:</span>bar</p>
21915 !!end
21916
21917 !! test
21918 Lists: 1. Nested inside html
21919 !! wikitext
21920 *<nowiki>*foo</nowiki>
21921
21922 *<nowiki>#foo</nowiki>
21923
21924 *<nowiki>:foo</nowiki>
21925
21926 *<nowiki>;foo</nowiki>
21927
21928 #<nowiki>*foo</nowiki>
21929
21930 #<nowiki>#foo</nowiki>
21931
21932 #<nowiki>:foo</nowiki>
21933
21934 #<nowiki>;foo</nowiki>
21935 !! html
21936 <ul><li>*foo</li></ul>
21937 <ul><li>#foo</li></ul>
21938 <ul><li>:foo</li></ul>
21939 <ul><li>;foo</li></ul>
21940 <ol><li>*foo</li></ol>
21941 <ol><li>#foo</li></ol>
21942 <ol><li>:foo</li></ol>
21943 <ol><li>;foo</li></ol>
21944
21945 !!end
21946
21947 !! test
21948 Lists: 2. Inside definition lists
21949 !! wikitext
21950 ;<nowiki>;foo</nowiki>
21951
21952 ;<nowiki>:foo</nowiki>
21953
21954 ;<nowiki>:foo</nowiki>
21955 :bar
21956
21957 :<nowiki>:foo</nowiki>
21958 !! html
21959 <dl><dt>;foo</dt></dl>
21960 <dl><dt>:foo</dt></dl>
21961 <dl><dt>:foo</dt>
21962 <dd>bar</dd></dl>
21963 <dl><dd>:foo</dd></dl>
21964
21965 !!end
21966
21967 !! test
21968 Lists: 3. Only bullets at start of text should be escaped
21969 !! wikitext
21970 *<nowiki>*foo*bar</nowiki>
21971
21972 *<nowiki>*foo</nowiki>''it''*bar
21973 !! html
21974 <ul><li>*foo*bar</li></ul>
21975 <ul><li>*foo<i>it</i>*bar</li></ul>
21976
21977 !!end
21978
21979 !! test
21980 Lists: 4. No escapes needed
21981 !! options
21982 parsoid
21983 !! wikitext
21984 *foo*bar
21985
21986 *''foo''*bar
21987
21988 *[[Foo]]: bar
21989
21990 *[[Foo]]*bar
21991 !! html
21992 <ul>
21993 <li>foo*bar
21994 </li>
21995 </ul>
21996 <ul>
21997 <li><i>foo</i>*bar
21998 </li>
21999 </ul>
22000 <ul>
22001 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22002 </li>
22003 </ul>
22004 <ul>
22005 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22006 </li>
22007 </ul>
22008 !!end
22009
22010 !! test
22011 Lists: 5. No unnecessary escapes
22012 !! wikitext
22013 * bar <span><nowiki>[[foo]]</nowiki></span>
22014
22015 * =bar <span><nowiki>[[foo]]</nowiki></span>
22016
22017 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22018
22019 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22020
22021 * =bar <span>foo]]</span>=
22022
22023 * <s></s>: a
22024
22025 * ''* foo''
22026 !! html
22027 <ul><li> bar <span>[[foo]]</span></li></ul>
22028 <ul><li> =bar <span>[[foo]]</span></li></ul>
22029 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22030 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22031 <ul><li> =bar <span>foo]]</span>=</li></ul>
22032 <ul><li> <s></s>: a</li></ul>
22033 <ul><li> <i>* foo</i></li></ul>
22034
22035 !!end
22036
22037 !! test
22038 Lists: 6. Escape bullets in SOL position
22039 !! options
22040 parsoid=html2wt
22041 !! html
22042 <p><!--cmt-->*foo</p>
22043 !! wikitext
22044 <!--cmt--><nowiki>*</nowiki>foo
22045 !!end
22046
22047 !! test
22048 Lists: 7. Escape bullets in a multi-line context
22049 !! wikitext
22050 a
22051 <nowiki>*</nowiki>b
22052 !! html
22053 <p>a
22054 *b
22055 </p>
22056 !!end
22057
22058 !! test
22059 Lists: 8. Escape colons only if not present in tags
22060 !! options
22061 parsoid=html2wt
22062 !! html
22063 <dl><dt>a:b<i>c:d</i></dt></dl>
22064 !! wikitext
22065 ; <nowiki>a:b</nowiki>''c:d''
22066 !! end
22067
22068 #### --------------- HRs ---------------
22069 #### 1. Single line
22070 #### -----------------------------------
22071
22072 !! test
22073 HRs: 1. Single line
22074 !! wikitext
22075 ----<nowiki>----</nowiki>
22076 ----=foo=
22077 ----*foo
22078 !! html+tidy
22079 <hr />
22080 <p>----</p>
22081 <hr />
22082 <p>=foo=</p>
22083 <hr />
22084 <p>*foo</p>
22085 !! end
22086
22087 #### --------------- Tables ---------------
22088 #### 1a. Simple example
22089 #### 1b. No escaping needed (!foo)
22090 #### 1c. No escaping needed (|foo)
22091 #### 1d. No escaping needed (|}foo)
22092 ####
22093 #### 2a. Nested in td (<td>foo|bar</td>)
22094 #### 2b. Nested in td (<td>foo||bar</td>)
22095 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22096 ####
22097 #### 3a. Nested in th (<th>foo!bar</th>)
22098 #### 3b. Nested in th (<th>foo!!bar</th>)
22099 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22100 ####
22101 #### 4a. Escape -
22102 #### 4b. Escape +
22103 #### 4c. No escaping needed
22104 #### --------------------------------------
22105
22106 !! test
22107 Tables: 1a. Simple example
22108 !! wikitext
22109 <nowiki>{|
22110 |}</nowiki>
22111 !! html
22112 <p>{|
22113 |}
22114 </p>
22115 !! end
22116
22117 !! test
22118 Tables: 1b. No escaping needed
22119 !! wikitext
22120 !foo
22121 !! html
22122 <p>!foo
22123 </p>
22124 !! end
22125
22126 !! test
22127 Tables: 1c. No escaping needed
22128 !! wikitext
22129 |foo
22130 !! html
22131 <p>|foo
22132 </p>
22133 !! end
22134
22135 !! test
22136 Tables: 1d. No escaping needed
22137 !! wikitext
22138 |}foo
22139 !! html
22140 <p>|}foo
22141 </p>
22142 !! end
22143
22144 !! test
22145 Tables: 2a. Nested in td
22146 !! options
22147 parsoid=html2wt
22148 !! html/parsoid
22149 <table><tbody><tr>
22150 <td>foo|bar</td></tr>
22151 <tr><td>x<div>a|b</div></td>
22152 </tbody></table>
22153 !! wikitext
22154 {|
22155 |<nowiki>foo|bar</nowiki>
22156 |-
22157 |x<div><nowiki>a|b</nowiki></div>
22158 |}
22159 !! html/php+tidy
22160 <table>
22161 <tr>
22162 <td>foo|bar</td>
22163 </tr>
22164 <tr>
22165 <td>x
22166 <div>a|b</div>
22167 </td>
22168 </tr>
22169 </table>
22170 !! end
22171
22172 !! test
22173 Tables: 2b. Nested in td
22174 !! options
22175 parsoid=html2wt
22176 !! html/parsoid
22177 <table><tbody><tr>
22178 <td>foo||bar</td>
22179 <td>a<i>b||c</i></td>
22180 <td>a<i><div>b||c</div></i></td>
22181 </tr></tbody></table>
22182 !! wikitext
22183 {|
22184 |<nowiki>foo||bar</nowiki>
22185 |a''<nowiki>b||c</nowiki>''
22186 |a''<div><nowiki>b||c</nowiki></div>''
22187 |}
22188 !! html/php
22189 <table>
22190 <tr>
22191 <td>foo||bar
22192 </td>
22193 <td>a<i>b||c</i>
22194 </td>
22195 <td>a<i><div>b||c</div></i>
22196 </td></tr></table>
22197
22198 !! end
22199
22200 !! test
22201 Tables: 2c. Nested in td -- no escaping needed
22202 !! wikitext
22203 {|
22204
22205 |foo!!bar
22206 |}
22207 !! html/*
22208 <table>
22209
22210 <tr>
22211 <td>foo!!bar
22212 </td></tr></table>
22213
22214 !! end
22215
22216 !! test
22217 Tables: 3a. Nested in th
22218 !! wikitext
22219 {|
22220
22221 !foo!bar
22222 |}
22223 !! html/*
22224 <table>
22225
22226 <tr>
22227 <th>foo!bar
22228 </th></tr></table>
22229
22230 !! end
22231
22232 !! test
22233 Tables: 3b. Nested in th
22234 !! options
22235 parsoid=html2wt
22236 !! html/parsoid
22237 <table><tbody>
22238 <tr><th>foo!!bar</th>
22239 <th><i>foo|bar</i></th>
22240 <th><i>foo!!bar</i></th>
22241 <th><i><span>foo!!bar</span></i></th>
22242 </tr></tbody></table>
22243 !! wikitext
22244 {|
22245 !<nowiki>foo!!bar</nowiki>
22246 !''<nowiki>foo|bar</nowiki>''
22247 !''<nowiki>foo!!bar</nowiki>''
22248 !''<span><nowiki>foo!!bar</nowiki></span>''
22249 |}
22250 !! html/php
22251 <table>
22252 <tr>
22253 <th>foo!!bar
22254 </th>
22255 <th><i>foo|bar</i>
22256 </th>
22257 <th><i>foo!!bar</i>
22258 </th>
22259 <th><i><span>foo!!bar</span></i>
22260 </th></tr></table>
22261
22262 !! end
22263
22264 !! test
22265 Tables: 3c. Nested in th
22266 !! options
22267 parsoid=html2wt
22268 !! html/parsoid
22269 <table><tbody>
22270 <tr><th>foo||bar</th>
22271 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22272 </tr></tbody></table>
22273 !! wikitext
22274 {|
22275 !<nowiki>foo||bar</nowiki>
22276 !<nowiki>foo||bar</nowiki>
22277 |}
22278 !! html/php
22279 <table>
22280 <tr>
22281 <th>foo||bar
22282 </th>
22283 <th>foo||bar
22284 </th></tr></table>
22285
22286 !! end
22287
22288 !! test
22289 Tables: 4a. Escape -
22290 !! options
22291 parsoid=html2wt
22292 !! html/*
22293 <table>
22294
22295 <tr>
22296 <th>-bar
22297 </th></tr>
22298 <tr>
22299 <td>-bar
22300 </td></tr></table>
22301
22302 !! wikitext
22303 {|
22304
22305 !-bar
22306
22307 |-
22308 |<nowiki>-bar</nowiki>
22309 |}
22310 !! end
22311
22312 !! test
22313 Tables: 4b. Escape +
22314 !! options
22315 parsoid=html2wt
22316 !! html/*
22317 <table>
22318
22319 <tr>
22320 <th>+bar
22321 </th></tr>
22322 <tr>
22323 <td>+bar
22324 </td></tr></table>
22325
22326 !! wikitext
22327 {|
22328
22329 !+bar
22330
22331 |-
22332 |<nowiki>+bar</nowiki>
22333 |}
22334 !! end
22335
22336 !! test
22337 Tables: 4c. No escaping needed
22338 !! wikitext
22339 {|
22340 |foo-bar
22341 |foo+bar
22342 |-
22343 |''foo''-bar
22344 |''foo''+bar
22345 |-
22346 |foo
22347 bar|baz
22348 +bar
22349 -bar
22350 |-
22351 |x
22352 <div>a|b</div>
22353 |}
22354 !! html/php
22355 <table>
22356 <tr>
22357 <td>foo-bar
22358 </td>
22359 <td>foo+bar
22360 </td></tr>
22361 <tr>
22362 <td><i>foo</i>-bar
22363 </td>
22364 <td><i>foo</i>+bar
22365 </td></tr>
22366 <tr>
22367 <td>foo
22368 <p>bar|baz
22369 +bar
22370 -bar
22371 </p>
22372 </td></tr>
22373 <tr>
22374 <td>x
22375 <div>a|b</div>
22376 </td></tr></table>
22377
22378 !! html/parsoid
22379 <table><tbody>
22380 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22381 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22382 <tr><td>foo
22383 <p>bar|baz
22384 +bar
22385 -bar</p></td></tr>
22386 <tr><td>x
22387 <div>a|b</div></td>
22388 </tbody></table>
22389 !! end
22390
22391 !! test
22392 Tables: 4d. No escaping needed
22393 !! wikitext
22394 {|
22395 |[[Foo]]-bar
22396 ||+1
22397 ||-2
22398 |}
22399 !! html/php
22400 <table>
22401 <tr>
22402 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
22403 </td>
22404 <td>+1
22405 </td>
22406 <td>-2
22407 </td></tr></table>
22408
22409 !! html/parsoid
22410 <table>
22411 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
22412 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
22413 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
22414 </tbody></table>
22415 !! end
22416
22417 !! test
22418 Tables: Digest broken attributes on table and tr tag
22419 !! options
22420 parsoid=wt2html
22421 !! wikitext
22422 {| || |} ++
22423 |- || || ++ --
22424 |- > [
22425 |}
22426 !! html
22427 <table>
22428 <tbody>
22429 <tr></tr>
22430 <tr></tr>
22431 </tbody></table>
22432 !! end
22433
22434 !! test
22435 T97430: Don't emit empty nowiki pairs around marker meta tags
22436 !! options
22437 parsoid=html2wt
22438 !! html
22439 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22440 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
22441 !! wikitext
22442 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22443 <nowiki>|</nowiki>** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
22444 !! end
22445
22446 !! test
22447 Unclosed xmlish element in table line shouldn't eat end delimiters
22448 !! wikitext
22449 {|
22450 | <foo
22451 | bar>
22452 |}
22453 !! html/php
22454 <table>
22455 <tr>
22456 <td> &lt;foo
22457 </td>
22458 <td> bar&gt;
22459 </td></tr></table>
22460
22461 !! html/parsoid
22462 <table>
22463 <tbody><tr><td> &lt;foo</td>
22464 <td> bar></td></tr>
22465 </tbody></table>
22466 !! end
22467
22468 #### --------------- Links ----------------
22469 #### 1. Quote marks in link text
22470 #### 2. Wikilinks: Escapes needed
22471 #### 3. Wikilinks: No escapes needed
22472 #### 4. Extlinks: Escapes needed
22473 #### 5. Extlinks: No escapes needed
22474 #### --------------------------------------
22475 !! test
22476 Links 1. WikiLinks: No escapes needed
22477 !! wikitext
22478 [[Foo|Foo''boo'']]
22479 [[Foo|[Foobar]]]
22480 [[Foo|x [Foobar] x]]
22481 !! html/php
22482 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
22483 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
22484 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
22485 </p>
22486 !! html/parsoid
22487 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
22488 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
22489 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
22490 !! end
22491
22492 !! test
22493 Links 2. WikiLinks: Escapes needed
22494 !! options
22495 parsoid=html2wt
22496 !! html/parsoid
22497 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
22498 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
22499 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
22500 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
22501 <a href="Foo" rel="mw:WikiLink">|Bar</a>
22502 <a href="Foo" rel="mw:WikiLink">]]bar</a>
22503 <a href="Foo" rel="mw:WikiLink">[[bar</a>
22504 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
22505 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
22506 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
22507 !! wikitext
22508 [[Foo|<nowiki>Foobar]</nowiki>]]
22509 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
22510 [[Foo|<nowiki>[[Bar]]</nowiki>]]
22511 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
22512 [[Foo|<nowiki>|Bar</nowiki>]]
22513 [[Foo|<nowiki>]]bar</nowiki>]]
22514 [[Foo|<nowiki>[[bar</nowiki>]]
22515 [[Foo|<nowiki>x [[ y</nowiki>]]
22516 [[Foo|<nowiki>x ]] y</nowiki>]]
22517 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
22518 !! html/php
22519 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
22520 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
22521 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
22522 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
22523 <a href="/wiki/Foo" title="Foo">|Bar</a>
22524 <a href="/wiki/Foo" title="Foo">]]bar</a>
22525 <a href="/wiki/Foo" title="Foo">[[bar</a>
22526 <a href="/wiki/Foo" title="Foo">x [[ y</a>
22527 <a href="/wiki/Foo" title="Foo">x ]] y</a>
22528 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
22529 </p>
22530 !! end
22531
22532 !! test
22533 Links 3. WikiLinks: No escapes needed
22534 !! wikitext
22535 [[Foo|[Foobar]]
22536 [[Foo|foo|bar]]
22537 !! html/php
22538 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
22539 <a href="/wiki/Foo" title="Foo">foo|bar</a>
22540 </p>
22541 !! html/parsoid
22542 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
22543 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
22544 !! end
22545
22546 !! test
22547 Links 4. ExtLinks: Escapes needed
22548 !! options
22549 parsoid=html2wt
22550 !! html/parsoid
22551 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
22552 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
22553 <p>[http://google.com]</p>
22554 <p>[http://google.com google]</p>
22555 !! wikitext
22556 [http://google.com <nowiki>[google]</nowiki>]
22557 [http://google.com <nowiki>google]</nowiki>]
22558
22559 <nowiki>[http://google.com]</nowiki>
22560
22561 <nowiki>[http://google.com google]</nowiki>
22562
22563 !! html/php
22564 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
22565 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
22566 </p><p>[http://google.com]
22567 </p><p>[http://google.com google]
22568 </p>
22569 !! end
22570
22571 !! test
22572 Links 5. ExtLinks: No escapes needed
22573 !! wikitext
22574 [http://google.com [google]
22575 !! html/php
22576 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
22577 </p>
22578 !! html/parsoid
22579 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
22580 !! end
22581
22582 !! test
22583 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
22584 !! html/parsoid
22585 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
22586 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
22587 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
22588 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
22589 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
22590 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
22591 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22592 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
22593 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22594 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
22595 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
22596 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
22597 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
22598 </p>
22599 !! wikitext
22600 x<nowiki/>http://example.com<nowiki/>y
22601 http://example.com<nowiki/>?x
22602 http://example.com<nowiki/>&x
22603 http://example.com<nowiki/>'x
22604 http://example.com<nowiki/>,x
22605 http://example.com<nowiki/>.x
22606 http://example.com<nowiki/>;x
22607 http://example.com<nowiki/>:x
22608 http://example.com<nowiki/>;x
22609 http://example.com<nowiki/>!x
22610 http://example.com<nowiki/>=x
22611 http://example.com<nowiki/>(x)
22612 http://example.com(x<nowiki/>)
22613 !! end
22614
22615 !! test
22616 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22617 !! html/parsoid
22618 <p>x
22619 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
22620 y
22621 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
22622 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
22623 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
22624 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
22625 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
22626 </p>
22627 !! wikitext
22628 x
22629 http://example.com
22630 y
22631 "http://example.com"
22632 (http://example.com)
22633 (http://example.com) foo
22634 http://example.com,
22635 http://example.com, foo
22636 !! html/php
22637 <p>x
22638 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
22639 y
22640 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
22641 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
22642 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
22643 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
22644 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
22645 </p>
22646 !! end
22647
22648 !! test
22649 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22650 !! html/parsoid
22651 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
22652 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
22653 !! wikitext
22654 http://example.com.,;:!?\
22655 -http://example.com:
22656 !! html/php
22657 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
22658 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
22659 </p>
22660 !! end
22661
22662 !! test
22663 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
22664 !! html/parsoid
22665 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
22666 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
22667 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
22668 !! wikitext
22669 RFC 123<nowiki/>4
22670 RFC 123<nowiki/>y
22671 X<nowiki/>RFC 123<nowiki/>y
22672 !! end
22673
22674 !! test
22675 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
22676 !! html/parsoid
22677 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
22678 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
22679 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
22680 </p>
22681 !! wikitext
22682 RFC 123?foo
22683 RFC 123&foo
22684 -RFC 123-
22685 !! html/php
22686 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
22687 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
22688 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
22689 </p>
22690 !! end
22691
22692 !! test
22693 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
22694 !! html/parsoid
22695 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
22696 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22697 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22698 !! wikitext
22699 PMID 123<nowiki/>4
22700 PMID 123<nowiki/>y
22701 X<nowiki/>PMID 123<nowiki/>y
22702 !! end
22703
22704 !! test
22705 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
22706 !! html/parsoid
22707 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
22708 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
22709 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
22710 </p>
22711 !! wikitext
22712 PMID 123?foo
22713 PMID 123&foo
22714 -PMID 123-
22715 !! html/php
22716 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
22717 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
22718 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
22719 </p>
22720 !! end
22721
22722 !! test
22723 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
22724 !! html/parsoid
22725 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
22726 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
22727 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
22728 </p>
22729 !! wikitext
22730 ISBN 1234567890<nowiki/>1
22731 ISBN 1234567890<nowiki/>x
22732 a<nowiki/>ISBN 1234567890<nowiki/>b
22733 !! end
22734
22735 !! test
22736 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
22737 !! html/parsoid
22738 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
22739 !! wikitext
22740 -ISBN 1234567890's
22741 !! html/php
22742 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
22743 </p>
22744 !! end
22745
22746 !! test
22747 Links 14. Protect link-like plain text. (Parsoid bug T78425)
22748 !! options
22749 parsoid=html2wt
22750 !! html/*
22751 <p>this is not a link: http://example.com
22752 </p>
22753 !! wikitext
22754 this is not a link: <nowiki>http://example.com</nowiki>
22755 !! end
22756
22757 !! test
22758 Links 15. Link trails can't become link prefixes.
22759 !! options
22760 language=is
22761 !! wikitext
22762 [[Söfnuður]]-[[00]]
22763 !! html/php
22764 <p><a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">Söfnuður-</a><a href="/wiki/00" title="00">00</a>
22765 </p>
22766 !! html/parsoid
22767 <p><a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður" data-parsoid='{"stx":"simple","tail":"-"}'>Söfnuður-</a><a rel="mw:WikiLink" href="00" title="00">00</a></p>
22768 !! end
22769
22770 #### --------------- Quotes ---------------
22771 #### 1. Quotes inside <b> and <i>
22772 #### 2. Link fragments separated by <i> and <b> tags
22773 #### 3. Link fragments inside <i> and <b>
22774 #### 4. No escaping needed
22775 #### --------------------------------------
22776 !! test
22777 1a. Quotes inside <b> and <i>
22778 !! options
22779 parsoid=html2wt,wt2wt
22780 !! wikitext
22781 ''<nowiki/>'foo'''
22782 ''<nowiki>''foo''</nowiki>''
22783 ''<nowiki>'''foo'''</nowiki>''
22784 ''foo''<nowiki/>'s
22785 '''<nowiki/>'foo''''
22786 '''<nowiki>''foo''</nowiki>'''
22787 '''<nowiki>'''foo'''</nowiki>'''
22788 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
22789 '''foo'''<nowiki/>'s
22790 '''foo''
22791 ''foo''<nowiki/>'
22792 ''foo'''<nowiki/>'
22793 '''foo''<nowiki/>'
22794 ''''foo'''
22795 '''foo'''<nowiki/>'
22796 ''''foo'''<nowiki/>'
22797 ''fools'<span> errand</span>''
22798 ''<span>fool</span>'s errand''
22799 '<nowiki/>''foo'' bar '''baz''
22800 a|!*#-:;+-~[]{}b'''x''
22801 !! html/*
22802 <p><i>'foo'</i>
22803 <i>''foo''</i>
22804 <i>'''foo'''</i>
22805 <i>foo</i>'s
22806 <b>'foo'</b>
22807 <b>''foo''</b>
22808 <b>'''foo'''</b>
22809 <b>foo'<i>bar'</i>baz</b>
22810 <b>foo</b>'s
22811 '<i>foo</i>
22812 <i>foo</i>'
22813 <i>foo'</i>'
22814 '<i>foo</i>'
22815 '<b>foo</b>
22816 <b>foo</b>'
22817 '<b>foo</b>'
22818 <i>fools'<span> errand</span></i>
22819 <i><span>fool</span>'s errand</i>
22820 '<i>foo</i> bar '<i>baz</i>
22821 a|!*#-:;+-~[]{}b'<i>x</i>
22822 </p>
22823 !! end
22824
22825 !! test
22826 1b. Quotes inside <b> and <i> with other tags on same line
22827 !! options
22828 parsoid=html2wt,wt2wt
22829 !! wikitext
22830 '''a'' foo ''[[bar]]''
22831 ''a''' foo ''[[bar]]''
22832 ''a''' foo '''{{echo|[[bar]]}}'''
22833 [[foo]] x'''[[bar]]''
22834 '''foo'' <ref>test</ref>
22835 '''foo'' <div title="name">test</div>
22836 '''foo'' and <br> bar
22837 <references />
22838 !! html
22839 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22840 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22841 <i>a'</i> foo <b><a rel="mw:WikiLink" href="Bar" title="Bar" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[bar]]"}},"i":0}}]}'>bar</a></b>
22842 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
22843 '<i>foo</i> <span class="mw-ref" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
22844 '<i>foo</i> <div title="name">test</div>
22845 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
22846 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22847 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">test</span></li>
22848 </ol>
22849 !! end
22850
22851 !! test
22852 2. Link fragments separated by <i> and <b> tags
22853 !! wikitext
22854 [[''foo''<nowiki>hello]]</nowiki>
22855
22856 [['''foo'''<nowiki>hello]]</nowiki>
22857 !! html
22858 <p>[[<i>foo</i>hello]]
22859 </p><p>[[<b>foo</b>hello]]
22860 </p>
22861 !! end
22862
22863 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
22864 # this is one of the shortcomings of this format
22865 !! test
22866 3. Link fragments inside <i> and <b>
22867 !! wikitext
22868 ''[[foo''<nowiki>]]</nowiki>
22869
22870 '''[[foo'''<nowiki>]]</nowiki>
22871 !! html
22872 <p><i>[[foo</i>]]
22873 </p><p><b>[[foo</b>]]
22874 </p>
22875 !! end
22876
22877 !! test
22878 4. No escaping needed
22879 !! wikitext
22880 '<span>''bar''</span>'
22881 '<span>'''bar'''</span>'
22882 'a:b'foo
22883 !! html
22884 <p>'<span><i>bar</i></span>'
22885 '<span><b>bar</b></span>'
22886 'a:b'foo
22887 </p>
22888 !! end
22889
22890 #### ----------- Paragraphs ---------------
22891 #### 1. No unnecessary escapes
22892 #### --------------------------------------
22893
22894 !! test
22895 1. No unnecessary escapes
22896 !! wikitext
22897 bar <span><nowiki>[[foo]]</nowiki></span>
22898
22899 =bar <span><nowiki>[[foo]]</nowiki></span>
22900
22901 [[bar <span><nowiki>[[foo]]</nowiki></span>
22902
22903 ]]bar <span><nowiki>[[foo]]</nowiki></span>
22904
22905 =bar <span>foo]]</span><nowiki>=</nowiki>
22906 !! html
22907 <p>bar <span>[[foo]]</span>
22908 </p><p>=bar <span>[[foo]]</span>
22909 </p><p>[[bar <span>[[foo]]</span>
22910 </p><p>]]bar <span>[[foo]]</span>
22911 </p><p>=bar <span>foo]]</span>=
22912 </p>
22913 !!end
22914
22915 #### ----------------------- PRE --------------------------
22916 #### 1. Leading whitespace in SOL context should be escaped
22917 #### ------------------------------------------------------
22918 !! test
22919 1. Leading whitespace in SOL context should be escaped
22920 !! options
22921 parsoid
22922 !! wikitext
22923 <nowiki> </nowiki>a
22924
22925 <nowiki> </nowiki> a
22926
22927 <nowiki> </nowiki>a(tab)
22928
22929 <nowiki> </nowiki> a
22930 <!--cmt-->
22931 <nowiki> </nowiki> a
22932
22933 a
22934 <nowiki> </nowiki>b
22935
22936 a
22937 <nowiki> </nowiki>b
22938
22939 a
22940 <nowiki> </nowiki> b
22941 !! html
22942 <p> a</p>
22943 <p> a</p>
22944 <p> a(tab)</p>
22945 <p> a</p>
22946 <p><!--cmt--> a</p>
22947 <p>a
22948 b</p>
22949 <p>a
22950 b</p>
22951 <p>a
22952 b</p>
22953 !! end
22954
22955 !! test
22956 2. Leading whitespace in non-indent-pre contexts should not be escaped
22957 !! options
22958 parsoid
22959 !! wikitext
22960 foo <ref>''a''
22961 b</ref>
22962 <references />
22963 !! html
22964 <p>foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22965 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22966 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><i data-parsoid='{"dsr":[9,14,2,2]}'>a</i>
22967 b</span></li>
22968 </ol>
22969 !! end
22970
22971 !! test
22972 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
22973 !! options
22974 parsoid
22975 !! wikitext
22976 <blockquote>
22977 a
22978 <span>b</span>
22979 c
22980 </blockquote>
22981 !! html
22982 <blockquote>
22983 <p>
22984 a
22985 <span>b</span>
22986 c</p>
22987 </blockquote>
22988 !! end
22989
22990 !! test
22991 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
22992 !! options
22993 parsoid
22994 !! wikitext
22995 [[File:Foobar.jpg|thumb|caption]]
22996 !! html/parsoid
22997 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
22998 !! end
22999
23000 !! test
23001 5. Nowiki escaping should account for indent-pres
23002 !! options
23003 parsoid=html2wt
23004 !! html
23005 <pre>==foo==</pre>
23006 !! wikitext
23007 ==foo==
23008 !! end
23009
23010 !!test
23011 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23012 !! options
23013 parsoid
23014 !! wikitext
23015 * foo
23016 * bar
23017 !! html
23018 <pre>
23019 * foo
23020 * bar
23021 </pre>
23022 !! end
23023
23024 #### --------------- Behavior Switches --------------------
23025
23026 !! test
23027 1. Valid behavior switches should be escaped
23028 !! options
23029 parsoid=html2wt
23030 !! html
23031 __TOC__
23032 <i>__TOC__</i>
23033 !! wikitext
23034 <nowiki>__TOC__</nowiki>
23035 ''<nowiki>__TOC__</nowiki>''
23036 !! end
23037
23038 !! test
23039 2. Invalid behavior switches should not be escaped
23040 !! options
23041 parsoid=html2wt
23042 !! html
23043 __TOO__
23044 __|__
23045 !! wikitext
23046 __TOO__
23047 __|__
23048 !! end
23049
23050 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23051 !! test
23052 Behavior switches should be SOL-transparent
23053 !! wikitext
23054 __TOC__
23055
23056 <!-- this one's bogus -->
23057 __TOO__
23058
23059 __TOC__ foo
23060
23061 __TOC__ bar
23062 !! html/parsoid
23063 <meta property="mw:PageProp/toc" />
23064
23065 <!-- this one's bogus -->
23066 <pre>__TOO__</pre>
23067
23068 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23069
23070 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23071 !! end
23072
23073 #### --------------- HTML tags ---------------
23074 #### 1. a tags
23075 #### 2. other tags
23076 #### 3. multi-line html tag
23077 #### 4. extension tags
23078 #### -----------------------------------------
23079 !! test
23080 1. a tags
23081 !! options
23082 parsoid
23083 !! wikitext
23084 <a href="http://google.com">google</a>
23085 !! html
23086 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23087 !! end
23088
23089 !! test
23090 2. other tags
23091 !! wikitext
23092 * <nowiki><div>foo</div></nowiki>
23093 * <nowiki><div style="color:red">foo</div></nowiki>
23094 * <nowiki><td></nowiki>
23095 !! html
23096 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23097 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23098 <li> &lt;td&gt;</li></ul>
23099
23100 !! end
23101
23102 !! test
23103 3. multi-line html tag
23104 !! wikitext
23105 <nowiki><div
23106 >foo</div
23107 ></nowiki>
23108 !! html
23109 <p>&lt;div
23110 &gt;foo&lt;/div
23111 &gt;
23112 </p>
23113 !! end
23114
23115 !! test
23116 4. extension tags
23117 !! wikitext
23118 <nowiki><ref>foo</ref></nowiki>
23119
23120 <nowiki><ref>bar</nowiki>
23121
23122 baz<nowiki></ref></nowiki>
23123 !! html
23124 <p>&lt;ref&gt;foo&lt;/ref&gt;
23125 </p><p>&lt;ref&gt;bar
23126 </p><p>baz&lt;/ref&gt;
23127 </p>
23128 !! end
23129
23130 #### --------------- Others ---------------
23131 !! test
23132 Escaping nowikis
23133 !! wikitext
23134 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23135 !! html
23136 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23137 </p>
23138 !! end
23139
23140 ## The quote-char in the input is necessary for triggering the bug
23141 !! test
23142 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23143 !! options
23144 parsoid=wt2wt,html2wt
23145 !! wikitext
23146 foo's bar :
23147 !! html
23148 <p>foo's bar :</p>
23149 !! end
23150
23151 !! test
23152
23153 Tag-like HTML structures are passed through as text
23154 !! wikitext
23155 <x y>
23156
23157 <x.y>
23158
23159 <x-y>
23160
23161 1>2
23162
23163 x<y
23164
23165 a>b
23166
23167 1<d e>f
23168 !! html
23169 <p>&lt;x y&gt;
23170 </p><p>&lt;x.y&gt;
23171 </p><p>&lt;x-y&gt;
23172 </p><p>1&gt;2
23173 </p><p>x&lt;y
23174 </p><p>a&gt;b
23175 </p><p>1&lt;d e&gt;f
23176 </p>
23177 !! end
23178
23179 !! test
23180 HTML tag with necessary entities in attributes
23181 !! wikitext
23182 <span title="&amp;amp;">foo</span>
23183 !! html
23184 <p><span title="&amp;amp;">foo</span>
23185 </p>
23186 !! end
23187
23188 !! test
23189 HTML tag with 'unnecessary' entity encoding in attributes
23190 !! wikitext
23191 <span title="&amp;">foo</span>
23192 !! html
23193 <p><span title="&amp;">foo</span>
23194 </p>
23195 !! end
23196
23197 !! test
23198 HTML tag with broken attribute value quoting
23199 !! wikitext
23200 <span title="Hello world>Foo</span>
23201 !! html/php
23202 <p><span>Foo</span>
23203 </p>
23204 !! html/parsoid
23205 <p><span title="Hello world">Foo</span>
23206 </p>
23207 !! end
23208
23209 !! test
23210 Parsoid-only: HTML tag with broken attribute value quoting
23211 !! options
23212 parsoid
23213 !! wikitext
23214 <span title="Hello world>Foo</span>
23215 !! html
23216 <p><span title="Hello world">Foo</span>
23217 </p>
23218 !! end
23219
23220 !! test
23221 Table with broken attribute value quoting
23222 !! wikitext
23223 {|
23224 | title="Hello world|Foo
23225 |}
23226 !! html/php
23227 <table>
23228 <tr>
23229 <td>Foo
23230 </td></tr></table>
23231
23232 !! html/parsoid
23233 <table>
23234 <tr>
23235 <td title="Hello world">Foo
23236 </td></tr></table>
23237
23238 !! end
23239
23240 !! test
23241 Table with broken attribute value quoting on consecutive lines
23242 !! wikitext
23243 {|
23244 | title="Hello world|Foo
23245 | style="color:red|Bar
23246 |}
23247 !! html/php
23248 <table>
23249 <tr>
23250 <td>Foo
23251 </td>
23252 <td>Bar
23253 </td></tr></table>
23254
23255 !! html/parsoid
23256 <table><tbody>
23257 <tr>
23258 <td title="Hello world">Foo
23259 </td><td style="color: red">Bar
23260 </td></tr></tbody></table>
23261
23262 !! end
23263
23264 !! test
23265 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23266 !! options
23267 parsoid
23268 !! wikitext
23269 {{}}
23270 !! html
23271 {{}}
23272 !! end
23273
23274 !! test
23275 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23276 !! options
23277 parsoid
23278 !! wikitext
23279 }}{{
23280 !! html
23281 }}{{
23282 !! end
23283
23284 !!test
23285 Accept empty td cell attribute
23286 !! wikitext
23287 {|
23288 | align="center" | foo || |
23289 |}
23290 !! html
23291 <table>
23292 <tr>
23293 <td align="center"> foo </td>
23294 <td>
23295 </td></tr></table>
23296
23297 !!end
23298
23299 !!test
23300 Non-empty attributes in th-cells
23301 !! wikitext
23302 {|
23303 ! Foo !! style="color: red" | Bar
23304 |}
23305 !! html
23306 <table>
23307 <tr>
23308 <th> Foo </th>
23309 <th style="color: red"> Bar
23310 </th></tr></table>
23311
23312 !!end
23313
23314 !!test
23315 Accept empty attributes in th-cells
23316 !! wikitext
23317 {|
23318 !| foo !!| bar
23319 |}
23320 !! html
23321 <table>
23322 <tr>
23323 <th> foo </th>
23324 <th> bar
23325 </th></tr></table>
23326
23327 !!end
23328
23329 !!test
23330 Empty table rows go away
23331 !! wikitext
23332 {|
23333 | Hello
23334 | there
23335 |- class="foo"
23336 |-
23337 |}
23338 !! html
23339 <table>
23340 <tr>
23341 <td> Hello
23342 </td>
23343 <td> there
23344 </td></tr>
23345
23346 </table>
23347
23348 !! end
23349
23350 ###
23351 ### Parsoid-centric tests for testing RTing of inter-element separators
23352 ### Edge cases not tested by existing parser tests and specific to
23353 ### Parsoid-specific serialization strategies.
23354 ###
23355
23356 !!test
23357 RT-ed inter-element separators should be valid separators
23358 !! wikitext
23359 {|
23360 |- [[foo]]
23361 |}
23362 !! html
23363 <table>
23364
23365 </table>
23366
23367 !!end
23368
23369 # Parsoid-only since PHP parser relies on Tidy for correct output
23370 !!test
23371 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
23372 !!options
23373 parsoid
23374 !! wikitext
23375 {|
23376 |<small>foo
23377 bar
23378 |}
23379
23380 {|
23381 |<small>foo<small>
23382 |}
23383 !! html
23384 <table>
23385 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
23386 <p>bar</p></small></td></tr>
23387 </tbody></table>
23388
23389 <table>
23390 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo<small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></small></td></tr>
23391 </tbody></table>
23392 !!end
23393
23394 # Note that the "style" attribute is really a template parameter here.
23395 # The = would have to be {{=}} if you wanted the literal.
23396 !!test
23397 Empty TD followed by TD with tpl-generated attribute
23398 !! wikitext
23399 {|
23400 |-
23401 |
23402 |{{echo|style='color:red'}}|foo
23403 |}
23404 !! html
23405 <table>
23406
23407 <tr>
23408 <td>
23409 </td>
23410 <td>foo
23411 </td></tr></table>
23412
23413 !!end
23414
23415 !!test
23416 Indented table with an empty td
23417 !! wikitext
23418 {|
23419 |-
23420 |
23421 |foo
23422 |}
23423 !! html
23424 <table>
23425
23426 <tr>
23427 <td>
23428 </td>
23429 <td>foo
23430 </td></tr></table>
23431
23432 !!end
23433
23434 ## We have some newline diffs RT-ing this edge case
23435 ## and it is not important enough -- we seem to be emitting
23436 ## at most 2 newlines after a </tr> and this is unrelated to
23437 ## the issue from T85627 that this is testing.
23438 !!test
23439 Indented table with blank lines in between (T85627)
23440 !! options
23441 parsoid=wt2html
23442 !! wikitext
23443 {|
23444 |foo
23445
23446
23447 |}
23448 !! html
23449 <table>
23450
23451 <tr>
23452 <td>foo
23453 </td></tr></table>
23454
23455 !!end
23456
23457 !!test
23458 Indented block & table
23459 !! wikitext
23460 <div>foo</div>
23461 {|
23462 |foo
23463 |}
23464 !! html/php
23465 <div>foo</div>
23466 <table>
23467 <tr>
23468 <td>foo
23469 </td></tr></table>
23470
23471 !! html/parsoid
23472 <div data-parsoid='{"stx":"html"}'>foo</div>
23473 <table><tbody>
23474 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
23475 </tbody></table>
23476 !!end
23477
23478 !! test
23479 Indent and comment before table row
23480 !! wikitext
23481 {|
23482 <!--hi-->|-
23483 | there
23484 |}
23485 !! html/php
23486 <table>
23487
23488 <tr>
23489 <td> there
23490 </td></tr></table>
23491
23492 !! html/parsoid
23493 <table>
23494 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
23495 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
23496 </tbody></table>
23497 !! end
23498
23499 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
23500 !!test
23501 Empty TR followed by a template-generated TR
23502 !!options
23503 parsoid
23504 !! wikitext
23505 {|
23506 |-
23507 {{echo|<tr><td>foo</td></tr>}}
23508 |}
23509 !! html
23510 <table>
23511 <tbody>
23512 <tr></tr>
23513 <tr about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<tr><td>foo</td></tr>"}},"i":0}}]}'>
23514 <td>foo</td></tr>
23515 </tbody></table>
23516 !!end
23517
23518 ## PHP and parsoid output differ for this, and since this is primarily
23519 ## for testing Parsoid's serializer, marking this Parsoid only
23520 !!test
23521 Empty TR followed by mixed-ws-comment line should RT correctly
23522 !!options
23523 parsoid
23524 !! wikitext
23525 {|
23526 |-
23527 <!--c-->
23528 |-
23529 <!--c--> <!--d-->
23530 |}
23531 !! html
23532 <table>
23533 <tbody>
23534 <tr></tr>
23535 <!--c-->
23536 <tr>
23537 <!--c--> </tr><!--d-->
23538 </tbody></table>
23539
23540 !!end
23541
23542 !!test
23543 Multi-line image caption generated by templates with/without trailing newlines
23544 !! wikitext
23545 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
23546 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
23547 !! html/parsoid
23548 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a><figcaption>foo\n<span about="#mwt9" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"A"}},"i":0}}]}'>A</span>\n<span about="#mwt10" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"B"}},"i":0}}]}'>B</span>\n<span about="#mwt11" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"C"}},"i":0}}]}'>C</span></figcaption></figure>
23549 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a><figcaption>foo\n<span about="#mwt12" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"A"}},"i":0}}]}'>A</span>\n<span about="#mwt13" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"B"}},"i":0}}]}'>B</span>\n<span about="#mwt14" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"C"}},"i":0}}]}'>C</span>\n\n</figcaption></figure>
23550 !!end
23551
23552 !! test
23553 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
23554 !! options
23555 parsoid=html2wt
23556 !! html/parsoid
23557 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>foo&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><p>new para</p>
23558
23559 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
23560 !! wikitext
23561 <includeonly>foo</includeonly>
23562 new para
23563
23564 [[Category:Foo]]
23565
23566 = new heading =
23567 !! end
23568
23569 ## PHP emits broken html for this, and since this is primarily
23570 ## a Parsoid serializer test, marking this Parsoid only
23571 !!test
23572 Improperly nested inline or quotes tags with whitespace in between
23573 !! wikitext
23574 <span> <s>x</span> </s>
23575 ''' ''x''' ''
23576 !! html/parsoid
23577 <p><span> <s>x</s></span><s> </s>
23578 <b> <i>x</i></b><i> </i>
23579 </p>
23580 !!end
23581
23582 !!test
23583 Encapsulate protected attributes from wt
23584 !! wikitext
23585 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
23586 !! html/parsoid
23587 <body><div data-x-typeof="mw:placeholder stuff" data-x-data-mw="whoo" data-x-data-parsoid="weird" data-x-data-parsoid-other="no" data-x-about="time" data-x-rel="mw:true">foo</div>
23588 </body>
23589 !!end
23590
23591 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
23592 ## Having nested or stray pre tags results in the attempt to add duplicates,
23593 ## causing an assertion fail. This test tries to prevent that situation.
23594 !!test
23595 Ensure ParagraphWrapper can deal with stray closing pre tags
23596 !!options
23597 parsoid=wt2html
23598 !! wikitext
23599 plain text</pre>
23600 !! html/parsoid
23601 plain text
23602 !!end
23603
23604 !!test
23605 1. Ensure fostered text content is wrapped in element nodes
23606 !!options
23607 parsoid=wt2html
23608 !! wikitext
23609 <table>hi</table><table>ho</table>
23610 !! html/parsoid
23611 <p>hi</p>
23612 <table></table>
23613 <p>ho</p>
23614 <table></table>
23615 !!end
23616
23617 !!test
23618 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
23619 !!options
23620 parsoid=wt2html,wt2wt
23621 !! wikitext
23622 <table>
23623 <tr> || ||
23624 <td> a
23625 </table>
23626 !! html/parsoid
23627 <p> || ||
23628 </p><table>
23629 <tbody><tr><td> a</td></tr>
23630 </tbody></table>
23631 !!end
23632
23633 !!test
23634 Encapsulation properly handles null DSR information from foster box
23635 !!options
23636 parsoid=wt2html,wt2wt
23637 !! wikitext
23638 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
23639 !! html/parsoid
23640 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&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;<table>foo<tr><td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span><table><tbody><tr><td>bar</td></tr></tbody></table>
23641 !!end
23642
23643 !!test
23644 1. Encapsulate foster-parented transclusion content
23645 !!options
23646 parsoid=wt2wt,wt2html
23647 !! wikitext
23648 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
23649 !! html/parsoid
23650 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table>&quot;,{&quot;template&quot;:{&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<tr><td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</p><table>
23651 <tbody>
23652 <tr>
23653 <td>bar</td>
23654 </tr>
23655 </tbody>
23656 </table>
23657 !!end
23658
23659 !!test
23660 2. Encapsulate foster-parented transclusion content
23661 !!options
23662 parsoid=wt2wt,wt2html
23663 !! wikitext
23664 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
23665 !! html/parsoid
23666 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><div>&quot;,{&quot;template&quot;:{&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;i&quot;:0}},&quot;</div><tr><td>bar</td></tr></table>&quot;]}">foo</div>
23667 <table>
23668 <tbody>
23669 <tr>
23670 <td>bar</td>
23671 </tr>
23672 </tbody>
23673 </table>
23674 !!end
23675
23676 !!test
23677 3. Encapsulate foster-parented transclusion content
23678 !!options
23679 parsoid=wt2wt,wt2html
23680 !! wikitext
23681 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23682 !! html/parsoid
23683 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><div><p>&quot;,{&quot;template&quot;:{&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</p></div><tr><td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
23684 <p>foo</p>
23685 </div>
23686 <table>
23687 <tbody>
23688 <tr>
23689 <td>bar</td>
23690 </tr>
23691 </tbody>
23692 </table>
23693 !!end
23694
23695 !!test
23696 4. Encapsulate foster-parented transclusion content
23697 !!options
23698 parsoid=wt2wt,wt2html
23699 !! wikitext
23700 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23701 !! html/parsoid
23702 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><div><p>&quot;,{&quot;template&quot;:{&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</p></div><tr><td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
23703 <p>foo</p>
23704 </div>
23705 <table>
23706 <tbody>
23707 <tr>
23708 <td>bar</td>
23709 </tr>
23710 </tbody>
23711 </table>
23712 !!end
23713
23714 !!test
23715 5. Encapsulate foster-parented transclusion content
23716 !!options
23717 parsoid=wt2wt,wt2html
23718 !! wikitext
23719 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
23720 !! html/parsoid
23721 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><tr><td><div><p>&quot;,{&quot;template&quot;:{&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</p></div></td>foo&quot;}},&quot;i&quot;:0}},&quot;</tr></table>&quot;]}">foo</p>
23722 <table>
23723 <tbody>
23724 <tr>
23725 <td>
23726 <div>
23727 <p>foo</p>
23728 </div>
23729 </td>
23730 </tr>
23731 </tbody>
23732 </table>
23733 !!end
23734
23735 !!test
23736 6. Encapsulate foster-parented transclusion content
23737 !!options
23738 parsoid=wt2wt,wt2html
23739 !! wikitext
23740 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
23741 !! html/parsoid
23742 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><tr><td><div><p>&quot;,{&quot;template&quot;:{&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</p></div></td>foo</tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</p>
23743 <table>
23744 <tbody>
23745 <tr>
23746 <td>
23747 <div>
23748 <p>foo</p>
23749 </div>
23750 </td>
23751 </tr>
23752 </tbody>
23753 </table>
23754 <p>ok</p>
23755 !!end
23756
23757 !!test
23758 7. Encapsulate foster-parented transclusion content
23759 !!options
23760 parsoid=wt2wt,wt2html
23761 !! wikitext
23762 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
23763 !! html/parsoid
23764 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table>&quot;,{&quot;template&quot;:{&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;<p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;<td>bar</td></table>&quot;]}">foo</p>
23765 <table>
23766 <tbody>
23767 <tr>
23768 <td>bar</td>
23769 </tr>
23770 </tbody>
23771 </table>
23772 !!end
23773
23774 # Note that the wt is broken on purpose: the = should be {{=}} if you
23775 # don't want it to be a template parameter key.
23776 !!test
23777 8. Encapsulate foster-parented transclusion content
23778 !!options
23779 parsoid=wt2wt,wt2html
23780 !! wikitext
23781 {{echo|a
23782 }}{|{{echo|style='color:red'}}
23783 |-
23784 |b
23785 |}
23786 !! html/parsoid
23787 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
23788 <span> </span>
23789 <p typeof="mw:Transclusion" data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"style":{"wt":"&#39;color:red&#39;"}},"i":0}},"\n|-\n|b\n|}"]}'>{{{1}}}</p>
23790 <table>
23791 <tbody>
23792 <tr>
23793 <td>b</td>
23794 </tr>
23795 </tbody>
23796 </table>
23797 !!end
23798
23799 !!test
23800 9. Encapsulate foster-parented transclusion content
23801 !!options
23802 parsoid=wt2wt,wt2html
23803 !! wikitext
23804 <table>{{echo|hi</table>hello}}
23805 !! html/parsoid
23806 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["&lt;table>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi&lt;/table>hello"}},"i":0}}]}' data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"pi":[[{"k":"1","spc":["","","",""]}]]}'>hi</p><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><p about="#mwt2">hello</p>
23807 !!end
23808
23809 !!test
23810 Table in fosterable position
23811 !!options
23812 parsoid=wt2html,wt2wt
23813 !! wikitext
23814 {{OpenTable}}
23815 <div>
23816 {|
23817 |}
23818 </div>
23819 |}
23820 !! html/parsoid
23821 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"OpenTable","href":"./Template:OpenTable"},"params":{},"i":0}},"\n&lt;div>"]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[]]}'></div><span about="#mwt1">
23822 </span>
23823 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
23824
23825 <table>
23826 </table>
23827 !!end
23828
23829 # Parsoid only for bug 64747
23830 !! test
23831 Properly encapsulate empty-content transclusions in fosterable positions
23832 !! wikitext
23833 <table>
23834 {{#if:|
23835 <td>foo</td>
23836 }}
23837 </table>
23838 !! html/parsoid
23839 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["&lt;table>\n",{"template":{"target":{"wt":"#if:","function":"#if"},"params":{"1":{"wt":"\n&lt;td>foo&lt;/td>\n"}},"i":0}},"\n&lt;/table>"]}' data-parsoid='{"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}'>
23840
23841 </table>
23842 !! end
23843
23844 !!test
23845 Support <object> element with .data attribute
23846 !!options
23847 parsoid=html2wt
23848 !! html/parsoid
23849 <object data="test.swf"></object>
23850 !! wikitext
23851 <object data="test.swf"></object>
23852 !!end
23853
23854 !! test
23855 Don't block XML namespace declaration
23856 !! wikitext
23857 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
23858 !! html/php
23859 <p><span>MediaWiki</span>
23860 </p>
23861 !! html/parsoid
23862 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
23863 !! end
23864
23865 # -----------------------------------------------------------------
23866 # The following section of tests are primarily to spec requirements
23867 # around serialization of new/edited content.
23868 #
23869 # All these tests are marked Parsoid html2wt and html2html only
23870 # ----------------------------------------------------------------
23871
23872 # 'mi' is a localinterwiki prefix as well as a language
23873 !! test
23874 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
23875 !! options
23876 parsoid=html2wt
23877 !! html
23878 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
23879 !! wikitext
23880 [[Foo]]
23881 !! end
23882
23883 # See T93839
23884 !! test
23885 New wikilinks should be serialized properly
23886 !! options
23887 parsoid=html2wt
23888 !! html
23889 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
23890 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
23891 !! wikitext
23892 [[Foo]]
23893 [[Foo]]
23894 !! end
23895
23896 !! test
23897 New wiki links (href variations)
23898 !! options
23899 parsoid=html2wt
23900 !! html
23901 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23902 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
23903 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
23904 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
23905 !! wikitext
23906 [[Foo_bar]]
23907 [[Foo_bar]]
23908 [[Foo_bar]]
23909 [[Toxine bactérienne]]
23910 !! end
23911
23912 !! test
23913 New wiki links (content string variations)
23914 !! options
23915 parsoid=html2wt
23916 !! html
23917 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23918 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
23919 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
23920 !! wikitext
23921 [[Foo_bar]]
23922 [[Foo bar]]
23923 [[Foo_bar|./Foo_bar]]
23924 !! end
23925
23926 !! test
23927 New category links (href variations)
23928 !! options
23929 parsoid=html2wt
23930 !! html
23931 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
23932 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
23933 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
23934 !! wikitext
23935 [[Category:Toxine bactérienne]]
23936 [[Category:Toxine bactérienne]]
23937 [[Category:Toxine bactérienne]]
23938 !! end
23939
23940 !! test
23941 New sol transparent links don't need indent-pre nowiki protection
23942 !! options
23943 parsoid=html2wt
23944 language=de
23945 !! html
23946 <link rel="mw:PageProp/redirect" href="./Main_Page">
23947 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
23948 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
23949 !! wikitext
23950 #WEITERLEITUNG [[Main Page]]
23951 <!-- this is good --> [[Category:Good]]
23952 <!-- this is great --> [[Kategorie:Great]]
23953 !! end
23954
23955 !! test
23956 New interlanguage links (href variations)
23957 !! options
23958 parsoid=html2wt
23959 !! html
23960 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
23961 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
23962 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
23963 !! wikitext
23964 [[es:Toxine bactérienne]]
23965 [[es:Toxine_bactérienne]]
23966 [[es:Toxine_bactérienne]]
23967 !! end
23968
23969 !! test
23970 Image: Modifying size of an image (1)
23971 !! options
23972 parsoid={
23973 "modes": ["wt2wt"],
23974 "changes": [
23975 ["img[height]", "attr", "height", "22"],
23976 ["img[width]", "attr", "width", "200"]
23977 ]
23978 }
23979 !! wikitext
23980 [[Image:Foobar.jpg|230x230px]]
23981 !! wikitext/edited
23982 [[Image:Foobar.jpg|200x200px]]
23983 !!end
23984
23985 !! test
23986 Image: Modifying size of an image (2)
23987 !! options
23988 parsoid={
23989 "modes": ["wt2wt"],
23990 "changes": [
23991 ["img[height]", "attr", "height", "100"],
23992 ["img[width]", "attr", "width", "500"]
23993 ]
23994 }
23995 !! wikitext
23996 [[Image:Foobar.jpg|230x230px]]
23997 !! wikitext/edited
23998 [[Image:Foobar.jpg|500x500px]]
23999 !!end
24000
24001 # Change in size is ignored so long as class='mw-default-size'
24002 !! test
24003 Image: Modifying size of an image (3)
24004 !! options
24005 parsoid={
24006 "modes": ["wt2wt"],
24007 "changes": [
24008 ["figure[class]", "removeClass", "mw-default-size"],
24009 ["figure img", "attr", "height", "19"],
24010 ["figure img", "attr", "width", "170"]
24011 ]
24012 }
24013 !! wikitext
24014 [[Image:Foobar.jpg|thumb]]
24015 !! wikitext/edited
24016 [[Image:Foobar.jpg|thumb|170x170px]]
24017 !!end
24018
24019 !! test
24020 Image: Modifying alignment of an image (bug 48665)
24021 !! options
24022 parsoid={
24023 "modes": ["wt2wt"],
24024 "changes": [
24025 ["figure[class]", "removeClass", "mw-halign-right"],
24026 ["figure[class]", "addClass", "mw-halign-left"]
24027 ]
24028 }
24029 !! wikitext
24030 [[Image:Foobar.jpg|thumb|caption|right]]
24031 !! wikitext/edited
24032 [[Image:Foobar.jpg|thumb|caption|left]]
24033 !! end
24034
24035 !! test
24036 Image: Modifying mw-default-size of an frameless image (bug 62805)
24037 !! options
24038 parsoid={
24039 "modes": ["wt2wt"],
24040 "changes": [
24041 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24042 ]
24043 }
24044 !! wikitext
24045 [[Image:Foobar.jpg|frameless|right]]
24046 !! wikitext/edited
24047 [[Image:Foobar.jpg|frameless|right|220x220px]]
24048 !! end
24049
24050 !! test
24051 Image: Modifying valign of an image (bug 49221)
24052 !! options
24053 parsoid={
24054 "modes": ["wt2wt"],
24055 "changes": [
24056 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24057 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24058 ]
24059 }
24060 !! wikitext
24061 [[File:Foobar.jpg|20px|middle]]
24062 !! wikitext/edited
24063 [[File:Foobar.jpg|20px|text-top]]
24064 !! end
24065
24066 !! test
24067 Image: Modifying alt attribute of an image (bug 56400)
24068 !! options
24069 parsoid={
24070 "modes": ["wt2wt"],
24071 "changes": [
24072 ["img[alt]", "attr", "alt", "some alternate edited text"]
24073 ]
24074 }
24075 !! wikitext
24076 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24077 !! wikitext/edited
24078 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24079 !!end
24080
24081 !! test
24082 Image: Modifying caption of an image
24083 !! options
24084 parsoid={
24085 "modes": ["wt2wt"],
24086 "changes": [
24087 ["figcaption", "text", "new caption"]
24088 ]
24089 }
24090 !! wikitext
24091 [[Image:Foobar.jpg|thumb|original caption]]
24092 !! wikitext/edited
24093 [[Image:Foobar.jpg|thumb|new caption]]
24094 !!end
24095
24096 !! test
24097 Image: empty alt attribute (bug 48924)
24098 !! options
24099 parsoid
24100 !! wikitext
24101 [[File:Foobar.jpg|thumb|alt=|bar]]
24102 !! html
24103 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"alt","ak":"alt="},{"ck":"caption","ak":"bar"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img alt="" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=","resource":"File:Foobar.jpg"}}'/></a><figcaption>bar</figcaption></figure>
24104 !! end
24105
24106 #!! test
24107 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24108 #!! options
24109 #parsoid=html2wt
24110 #language=ar
24111 #!! html
24112 #<figure class="mw-default-size mw-halign-right" typeof="mw:Image/Thumb"><a href="Imagen:Foobar.jpg"><img resource="./Imagen:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="20" width="180"/></a></figure>
24113 #!! wikitext
24114 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24115 #!! end
24116
24117 !! test
24118 Image: Block level image should have \n before and after
24119 !! wikitext
24120 123
24121 [[File:Foobar.jpg|right|thumb|150x150px]]
24122 456
24123 !! html/parsoid
24124 <p>123</p>
24125 <figure class="mw-halign-right" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="17" width="150"/></a></figure>
24126 <p>456</p>
24127 !!end
24128
24129 !! test
24130 Image: New block level image should have \n before and after (existing content)
24131 !! wikitext
24132 123
24133 [[File:Foobar.jpg|right|thumb|150x150px]]
24134 456
24135 !! html/parsoid
24136 <p>123</p>
24137 <figure class="mw-halign-right" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"right","ak":"right"},{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"150x150px"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="17" width="150" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"17","width":"150"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure>
24138 <p>456</p>
24139 !!end
24140
24141 !! test
24142 Image: upright option (parsoid)
24143 !! wikitext
24144 [[File:Foobar.jpg|thumb|upright|caption]]
24145 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24146 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24147 !! html/parsoid
24148 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/170px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="19" width="170"/></a><figcaption>caption</figcaption></figure>
24149 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/110px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="12" width="110"/></a><figcaption>caption</figcaption></figure>
24150 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/500px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="57" width="500"/></a><figcaption>caption</figcaption></figure>
24151 !!end
24152
24153 !! test
24154 Image: upright option is ignored on inline and frame images (parsoid)
24155 !! wikitext
24156 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24157 !! html/parsoid
24158 <p><span typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/500px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="57" width="500"/></a></span></p>
24159 !!end
24160
24161 !! test
24162 Image: from basic HTML (1)
24163 !! options
24164 parsoid=html2wt
24165 !! html/parsoid
24166 <span typeof="mw:Image">
24167 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24168 </span>
24169 !! wikitext
24170 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24171 !! end
24172
24173 !! test
24174 Image: from basic HTML (2)
24175 !! options
24176 parsoid=html2wt
24177 !! html/parsoid
24178 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24179 !! wikitext
24180 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24181 !! end
24182
24183 !! test
24184 Image: from basic HTML (3)
24185 !! options
24186 parsoid=html2wt
24187 !! html/parsoid
24188 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24189 !! wikitext
24190 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24191 !! end
24192
24193 !! test
24194 Image: from basic HTML (4)
24195 !! options
24196 parsoid=html2wt
24197 !! html/parsoid
24198 <img src="./File:Foobar.jpg">
24199 !! wikitext
24200 [[File:Foobar.jpg|link=]]
24201 !! end
24202
24203 !! test
24204 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24205 !! options
24206 parsoid=html2wt
24207 !! html
24208 <ul>
24209 <li><p>foo</p></li>
24210 </ul>
24211 !! wikitext
24212 * foo
24213 !! end
24214
24215 !! test
24216 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24217 !! options
24218 parsoid=html2wt
24219 !! html
24220 <ul> <li>foo</li></ul>
24221 !! wikitext
24222 * foo
24223 !! end
24224
24225 !! test
24226 Don't strip leading whitespace when handling indent-pre suppressing tags
24227 !! options
24228 parsoid=html2wt
24229 !! html
24230 <table>
24231 <tr><td> indented row</td></tr>
24232 </table>
24233 <blockquote><p>
24234 <b>This is very bold of you!</b>
24235 </p>
24236 <table><tr><td>
24237 indented cell (no pre-wrapping!)
24238 </td></tr></table>
24239 </blockquote>
24240 <p>foo</p>
24241 <div>bar</div>
24242 !! wikitext
24243 {|
24244 | indented row
24245 |}
24246 <blockquote>
24247 '''This is very bold of you!'''
24248
24249 {|
24250 |
24251 indented cell (no pre-wrapping!)
24252 |}
24253 </blockquote>
24254 foo
24255 <div>bar</div>
24256 !! end
24257
24258 !! test
24259 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24260 !! options
24261 parsoid=html2wt
24262 !! wikitext
24263 foo
24264 <nowiki> </nowiki><span>bar</span>
24265
24266 <span>foo2
24267 <nowiki> </nowiki></span>bar2
24268
24269 <div>foo</div>
24270 <nowiki> </nowiki><span>bar</span>
24271
24272 <div>
24273 <nowiki> </nowiki><span>foo</span>
24274 </div>
24275 !! html
24276 <p>foo</p>
24277 <span>bar</span>
24278
24279 <span>foo2
24280 </span>bar2
24281
24282 <div>foo</div>
24283 <span>bar</span>
24284
24285 <div>
24286 <span>foo</span>
24287 </div>
24288 !! end
24289
24290 !! test
24291 Lists: Dont insert newlines in a serialized list item.
24292 !! options
24293 parsoid=html2wt
24294 !! html
24295 <ul><li>a<br>b</li><li>c</li></ul>
24296 !! wikitext
24297 * a<br>b
24298 * c
24299 !! end
24300
24301 !! test
24302 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
24303 !! options
24304 parsoid={
24305 "modes": ["html2wt"],
24306 "scrubWikitext": false
24307 }
24308 !! html
24309 <h2>hello there<link href="Category:A1" rel="mw:PageProp/Category" /></h2>
24310 <h2><link href="Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24311
24312 <h2><!--foo--> <link href="Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24313 <h2>it goes well <link href="Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24314
24315 <h2 data-parsoid='{}'>howdy<link href="Category:A5" rel="mw:PageProp/Category" /></h2>
24316
24317 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24318 !! wikitext
24319 == hello there [[Category:A1]] ==
24320
24321 == [[Category:A2]] hi pal ==
24322
24323 == <!--foo--> [[Category:A3]] how goes it ==
24324
24325 == it goes well [[Category:A4]] <!--bar--> ==
24326
24327 ==howdy [[Category:A5]] ==
24328
24329 == __TOC__ ok ==
24330 !! end
24331
24332 !! test
24333 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
24334 !! options
24335 parsoid={
24336 "modes": ["html2wt"],
24337 "scrubWikitext": true
24338 }
24339 !! html
24340 <h2>hello there<link href="Category:A1" rel="mw:PageProp/Category" /></h2>
24341 <h2><link href="Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24342
24343 <h2><!--foo--> <link href="Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24344 <h2>it goes well <link href="Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24345
24346 <h2 data-parsoid='{}'>howdy<link href="Category:A5" rel="mw:PageProp/Category" /></h2>
24347
24348 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24349 !! wikitext
24350 == hello there ==
24351 [[Category:A1]]
24352 [[Category:A2]]
24353
24354 == hi pal ==
24355
24356 <!--foo--> [[Category:A3]]
24357
24358 == how goes it ==
24359
24360 == it goes well ==
24361 [[Category:A4]] <!--bar-->
24362
24363 ==howdy [[Category:A5]] ==
24364
24365 __TOC__
24366
24367 == ok ==
24368 !! end
24369
24370 !! test
24371 Headings: Don't hoist metas that come from templates
24372 !! options
24373 parsoid={
24374 "modes": ["html2wt"],
24375 "scrubWikitext": true
24376 }
24377 !! html
24378 <h2><span about="#mwt1" typeof="mw:Transclusion" data-parsoid="{}" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo [[Category:Foo]]"}},"i":0}}]}'>foo </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" data-parsoid="{}" /></h2>
24379 !! wikitext
24380 == {{echo|foo [[Category:Foo]]}} ==
24381 !! end
24382
24383 !! test
24384 Headings: Category in ref isn't hoisted
24385 !! options
24386 parsoid={
24387 "modes": ["html2wt"],
24388 "scrubWikitext": true
24389 }
24390 !! html
24391 <h2> foo <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> </h2>
24392
24393 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">bar <link rel="mw:PageProp/Category" href="./Category:Baz" /> </span></li></ol>
24394 !! wikitext
24395 == foo <ref>bar
24396 [[Category:Baz]] </ref> ==
24397
24398 <references />
24399 !! end
24400
24401 !! test
24402 Parsoid: Serialize positional parameters with = in them as named parameter
24403 !! options
24404 parsoid=html2wt
24405 !! html
24406 <p about="#mwt1" typeof="mw:Transclusion"
24407 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
24408
24409 <p about="#mwt1" typeof="mw:Transclusion"
24410 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
24411
24412 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24413 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24414 <p data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]},{"k":"2","spc":["","","",""]}]]}' about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"},"2":{"wt":"bar"}},"i":0}}]}'>foo</p>
24415 !! wikitext
24416 {{echo|1 = f=oo}}
24417
24418 {{echo|1 = f=oo|2 = bar}}
24419
24420 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24421 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24422 {{echo|<nowiki>f=oo</nowiki>|bar}}
24423 !! end
24424
24425 !! test
24426 Parsoid: Serialize positional parameters with = in extlink as named parameter
24427 !! options
24428 parsoid=html2wt
24429 !! html
24430 <p><a rel="mw:ExtLink" href="http://stuff?is=ok" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://stuff?is=ok"}},"i":0}}]}'>http://stuff?is=ok</a></p>
24431 !! wikitext
24432 {{echo|1 = http://stuff?is=ok}}
24433 !! end
24434
24435 !! test
24436 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
24437 !! options
24438 parsoid=html2wt
24439 !! html
24440 <div>a<p>b</p></div>
24441 <div>a
24442 <p>b</p></div>
24443 <div>
24444 a
24445 <p>b</p></div>
24446 !! wikitext
24447 <div>a
24448 b
24449 </div>
24450 <div>a
24451 b
24452 </div>
24453 <div>
24454 a
24455
24456 b
24457 </div>
24458 !! end
24459
24460 !! test
24461 Substrings resembling wikitext in hrefs should not get nowiki escapes
24462 !! options
24463 parsoid=html2wt
24464 !! html
24465 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
24466 !! wikitext
24467 [[Foo''bar''baz]]
24468 !! end
24469
24470 !! test
24471 Enforce single-line context in the serializer
24472 !! options
24473 parsoid=html2wt
24474 !! html
24475 <h2>testing
24476 123</h2>
24477
24478 <h2> hi <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bogus","href":"./Template:Bogus"},"params":{"1":{"wt":"there\nyou"}},"i":0}}]}'>there</span><span about="#mwt1">
24479 </span><span about="#mwt1">you</span> </h2>
24480
24481 <h2> foo <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> </h2>
24482
24483 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">hello
24484 there</span></li></ol>
24485
24486 <ul><li>asd
24487 sdf</li></ul>
24488
24489 <ul><li>foo
24490 bar
24491 baz</li>
24492 <li>foo <b>bar</b>
24493 baz</li></ul>
24494
24495 <dl><dt>hi
24496 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
24497 ho</dd></dl>
24498
24499 <dl><dd> <table>
24500 <tbody><tr><td> ha
24501 ha
24502 ha</td></tr>
24503 </tbody></table></dd></dl>
24504 !! wikitext
24505 == testing 123 ==
24506
24507 == hi {{bogus|there
24508 you}} ==
24509
24510 == foo <ref>hello
24511 there</ref> ==
24512
24513 <references />
24514
24515 * asd sdf
24516
24517 * foo bar baz
24518 * foo '''bar''' baz
24519
24520 ; hi ho : hi ho
24521
24522 : {|
24523 | ha
24524 ha
24525 ha
24526 |}
24527 !! end
24528
24529 !! test
24530 Serialize new placeholder space without spans
24531 !! options
24532 parsoid=html2wt
24533 !! html
24534 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
24535
24536 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
24537
24538 <span typeof="mw:Extension/ref" data-mw="{&quot;name&quot;:&quot;ref&quot;,&quot;body&quot;:{&quot;html&quot;:&quot;foo<span typeof=\&quot;mw:Placeholder\&quot;>&amp;nbsp;</span>: bar&quot;}}"><sup>[1]</sup></span>ok</p>
24539 !! wikitext
24540 foo : bar
24541
24542 foo : bar
24543
24544 <ref>foo : bar</ref>ok
24545 !! end
24546
24547
24548 #-----------------------
24549 # Tag minimization tests
24550 #-----------------------
24551
24552 !! test
24553 1. I/B quote minimization: wikitext-only tags should be combined
24554 !! options
24555 parsoid=html2wt
24556 !! html
24557 <p><i>A</i><i>B</i></p>
24558 <p><b>A</b><b>B</b></p>
24559 <p><i>A</i><b><i>B</i></b></p>
24560 <p><b>A</b><i><b>B</b></i></p>
24561 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
24562 <p><i><b>A</b></i><i><b>B</b></i></p>
24563 <p><i><b>A</b></i><b><i>B</i></b></p>
24564 <p><b><i>A</i></b><i><b>B</b></i></p>
24565 !! wikitext
24566 ''AB''
24567
24568 '''AB'''
24569
24570 ''A'''B'''''
24571
24572 '''A''B'''''
24573
24574 '''A''BC''D'''
24575
24576 '''''AB'''''
24577
24578 '''''AB'''''
24579
24580 '''''AB'''''
24581 !! end
24582
24583 !! test
24584 2. I/B quote minimization: wikitext and html tags should not be combined
24585 !! options
24586 parsoid=html2wt
24587 !! html
24588 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
24589 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
24590 !! wikitext
24591 ''A''<i>B</i>
24592
24593 ''A''<nowiki/>'''<i>B</i>'''
24594 !! end
24595
24596 !! test
24597 3. I/B quote minimization: templated content stops minimization
24598 !! options
24599 parsoid=html2wt
24600 !! html
24601 <p><i>A</i><i about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;B&#39;&#39;"}},"i":0}}]}'>B</i>
24602 <p><i>A</i><b about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;&#39;&#39;&#39;B&#39;&#39;&#39;&#39;&#39;"}},"i":0}}]}'><i>B</i></b>
24603 !! wikitext
24604 ''A''{{echo|''B''}}
24605
24606 ''A''{{echo|'''''B'''''}}
24607 !! end
24608
24609 !! test
24610 4. I/B quote minimization: new content should be mimimized with adjacent old content
24611 !! options
24612 parsoid=html2wt
24613 !! html
24614 <p><i>A</i><i>B</i></p>
24615 <p><b>A</b><b>B</b></p>
24616 <p><i>A</i><b><i>B</i></b></p>
24617 !! wikitext
24618 ''AB''
24619
24620 '''AB'''
24621
24622 ''A'''B'''''
24623 !! end
24624
24625 !! test
24626 5a. Merge adjacent quote nodes if they've been edited
24627 !! options
24628 parsoid={
24629 "modes": ["wt2wt", "selser"],
24630 "changes": [
24631 ["p", "contents", "remove", ":contains('b')"]
24632 ]
24633 }
24634 !! wikitext
24635 ''a''b''c''
24636 !! wikitext/edited
24637 ''ac''
24638 !! end
24639
24640 !! test
24641 5b. Merge adjacent quote nodes if they've been edited
24642 !! options
24643 parsoid={
24644 "modes": ["wt2wt", "selser"],
24645 "changes": [
24646 ["#x", "remove"]
24647 ]
24648 }
24649 !! wikitext
24650 ''a''<span id="x">b</span>''c''
24651 !! wikitext/edited
24652 ''ac''
24653 !! end
24654
24655 !! test
24656 1. Merge adjacent link nodes as long as at least one element is new
24657 !! options
24658 parsoid={
24659 "modes": ["html2wt"],
24660 "scrubWikitext": true
24661 }
24662 !! html
24663 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24664 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24665 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
24666 !! wikitext
24667 [[Football]]
24668 [[Football]]
24669 [[Football|Foot]][[Football|ball]]
24670 !! end
24671
24672 !! test
24673 2. Merge adjacent link nodes and enable additional normalizations
24674 !! options
24675 parsoid={
24676 "modes": ["html2wt"],
24677 "scrubWikitext": true
24678 }
24679 !! html
24680 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
24681 !! wikitext
24682 [[Football|''Football'']]
24683 !! end
24684
24685 !! test
24686 3. Don't merge adjacent link nodes if scrubWikitext is false
24687 !! options
24688 parsoid={
24689 "modes": ["html2wt"],
24690 "scrubWikitext": false
24691 }
24692 !! html
24693 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24694 !! wikitext
24695 [[Football|Foot]][[Football|ball]]
24696 !! end
24697
24698 #------------------------------
24699 # End of tag minimization tests
24700 #------------------------------
24701
24702 !!test
24703 Bug 54262: New entities
24704 !! options
24705 parsoid=html2wt
24706 !! wikitext
24707 &nbsp;
24708 !! html
24709 <span typeof="mw:Entity">&nbsp;</span>
24710 !! end
24711
24712 ## Note that there is no wikitext output for 'unknownproperty' ##
24713 ## Unknown magic words are silently dropped ##
24714
24715 !! test
24716 Magic words
24717 !! options
24718 parsoid=html2wt
24719 !! html/parsoid
24720 <meta property='mw:PageProp/toc' />
24721 <meta property='mw:PageProp/notoc' />
24722 <meta property='mw:PageProp/forcetoc' />
24723 <meta property='mw:PageProp/index' />
24724 <meta property='mw:PageProp/noindex' />
24725 <meta property='mw:PageProp/nogallery' />
24726 <meta property='mw:PageProp/noeditsection' />
24727 <meta property='mw:PageProp/notitleconvert' />
24728 <meta property='mw:PageProp/nocontentconvert' />
24729 <meta property='mw:PageProp/unknownproperty' />
24730 !! wikitext
24731 __TOC__
24732 __NOTOC__
24733 __FORCETOC__
24734 __INDEX__
24735 __NOINDEX__
24736 __NOGALLERY__
24737 __NOEDITSECTION__
24738 __NOTITLECONVERT__
24739 __NOCONTENTCONVERT__
24740 !! end
24741
24742 !! test
24743 Consecutive <pre>s should not get merged
24744 !! options
24745 parsoid=html2wt,html2html
24746 !! html
24747 <pre>a</pre><pre>b</pre>
24748
24749 <pre>c
24750 </pre><pre>
24751 d</pre>
24752
24753 <pre>e
24754
24755 </pre><pre>
24756
24757 f</pre>
24758 !! wikitext
24759 a
24760
24761 b
24762
24763 c
24764
24765 d
24766
24767 e
24768
24769
24770
24771 f
24772 !! end
24773
24774 !! test
24775 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
24776 !! options
24777 parsoid=html2wt
24778 !! html
24779 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
24780 !! wikitext
24781 [[Special:BookSources/1234567890|ISBN 1234567895]]
24782 !! end
24783
24784 !! test
24785 Edited RFC links not serializable as RFC links should serialize as extlinks
24786 !! options
24787 parsoid=html2wt
24788 !! html
24789 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
24790 !! wikitext
24791 [//tools.ietf.org/html/rfc123 New RFC]
24792 !! end
24793
24794 !! test
24795 Edited PMID links not serializable as PMID links should serialize as extlinks
24796 !! options
24797 parsoid=html2wt
24798 !! html
24799 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
24800 !! wikitext
24801 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
24802 !! end
24803
24804 !! test
24805 WTS of autolinks with trailing/surrounding context
24806 !! options
24807 parsoid=html2wt
24808 !! html/parsoid
24809 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
24810 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
24811 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
24812 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
24813 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
24814 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
24815 !! wikitext
24816 http://cscott.net<nowiki/>'''foo'''
24817
24818 http://cscott.net<b>foo</b>
24819
24820 '''http://cscott.net<nowiki/>'''
24821
24822 '''http://cscott.net '''
24823
24824 '''http://cscott.net<nowiki/>x'''
24825
24826 http://cscott.net<nowiki/>x
24827 !! end
24828
24829 !! test
24830 WTS of autolinks with nowikis (round-trip)
24831 !! wikitext
24832 x<nowiki/>http://cscott.net<nowiki/>x
24833 !! html/parsoid
24834 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
24835 !! end
24836
24837 # this is the "easy" test because it leaves in place all the
24838 # data-parsoid information indicating this is an autolink
24839 !! test
24840 WTS of autolinks with escapes (editing)
24841 !! options
24842 parsoid={
24843 "modes": ["wt2wt"],
24844 "changes": [
24845 [ "meta", "remove" ]
24846 ]
24847 }
24848 !! wikitext
24849 x<nowiki/>http://cscott.net<nowiki/>x
24850 !! wikitext/edited
24851 x<nowiki/>http://cscott.net<nowiki/>x
24852 !! end
24853
24854 !! test
24855 WTS of edited autolink-like text (T103364)
24856 !! options
24857 parsoid={
24858 "modes": ["wt2wt"],
24859 "changes": [
24860 [ "span[typeof]", "removeAttr", "typeof" ]
24861 ]
24862 }
24863 !! wikitext
24864 Not a link: <nowiki>http://example.com</nowiki>.
24865 !! wikitext/edited
24866 Not a link: <span><nowiki>http://example.com</nowiki></span>.
24867 !! end
24868
24869 !! test
24870 WTS of newly-authored autolink-like text (T103364)
24871 !! options
24872 parsoid=html2wt
24873 !! html/parsoid
24874 <p>http://example.com is not a link.</p>
24875 !! wikitext
24876 <nowiki>http://example.com is not a link.</nowiki>
24877 !! end
24878
24879 !! test
24880 Edited Redirect link should emit a non-piped wikitext link
24881 !! options
24882 parsoid=html2wt
24883 !! html
24884 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
24885 !! wikitext
24886 #REDIRECT [[Bar]]
24887 !! end
24888
24889 !! test
24890 T75121: Infer extension name from typeOf if data-mw is not present
24891 !! options
24892 parsoid=html2wt
24893 !! html
24894 <div typeOf="mw:Extension/foo"></div>
24895 !! wikitext
24896 <foo />
24897 !! end
24898
24899 # Note that the <p> wrapping isn't present in PHP parser output
24900 # The important thing for this test is that P-wrapping doesn't
24901 # interfere with the <nowiki> protection for leading - in <td>
24902 # (which isn't necessary for <th>).
24903 !! test
24904 T88318: p-wrapped dash in table.
24905 !! options
24906 parsoid=html2wt,wt2wt
24907 !! html/parsoid
24908 <table><tbody>
24909 <tr><th><p>-</p></th><th><p>- </p></th></tr>
24910 <tr><td><p>-</p></td><td><p>- </p></td></tr>
24911 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
24912 </tbody></table>
24913 !! wikitext
24914 {|
24915 !-
24916 !-
24917 |-
24918 |<nowiki>-</nowiki>
24919 |<nowiki>- </nowiki>
24920 |-
24921 |<small>-</small>
24922 |<br>
24923 -
24924 |<br>
24925 -
24926 |}
24927 !! html/php+tidy
24928 <table>
24929 <tr>
24930 <th>-</th>
24931 <th>-</th>
24932 </tr>
24933 <tr>
24934 <td>-</td>
24935 <td>-</td>
24936 </tr>
24937 <tr>
24938 <td><small>-</small></td>
24939 <td><br />
24940 <p>-</p>
24941 </td>
24942 <td><br />
24943 <p>-</p>
24944 </td>
24945 </tr>
24946 </table>
24947 !! end
24948
24949 !! test
24950 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
24951 !! options
24952 parsoid=html2wt
24953 !! html
24954 <table id='mwAb'>
24955 <td id='mwAc'>foo</td>
24956 <td id='serialize-this'>bar</td>
24957 </table>
24958 !! wikitext
24959 {|
24960 |foo
24961 | id="serialize-this" |bar
24962 |}
24963 !! end
24964
24965 !! test
24966 Parsoid-like element ids should not be serialized to wikitext unless shadowed
24967 !! options
24968 parsoid=html2wt
24969 !! html
24970 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
24971 !! wikitext
24972 <div id="hello">ok</div>
24973 !! end
24974
24975 !! test
24976 WTS change modes
24977 !! options
24978 parsoid={
24979 "modes": ["wt2wt"],
24980 "changes": [
24981 [ "#xyz", "before", "<b>before</b> stuff " ],
24982 [ "#xyz", "after", " stuff <i>after</i>" ],
24983 [ "#xyz", "html", "x <b>y</b> z" ]
24984 ]
24985 }
24986 !! wikitext
24987 <span id="xyz">hello</span>
24988 !! wikitext/edited
24989 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
24990 !! end
24991
24992 !! test
24993 Never serialize a-tag as html, regardless of what data-parsoid has to say
24994 !! options
24995 parsoid=html2wt
24996 !! html
24997 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
24998 !! wikitext
24999 [[Foo]]
25000 !! end
25001
25002 ## SSS FIXME: This is broken output nevertheless.
25003 ## What might be a reasonable non-broken output for this?
25004 ## This is an edge case unlikely to be seen in production
25005 ## that I am not wasting more time on this right now.
25006 !! test
25007 Never serialize a-tag as html, no matter what attributes it has
25008 !! options
25009 parsoid=html2wt
25010 !! html
25011 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25012 !! wikitext
25013 [http://boo.org http://boohoo.org]
25014 !! end
25015
25016 # --------------------------------------------
25017 # Tests spec'ing wikitext serialization norms |
25018 # --------------------------------------------
25019
25020 !! test
25021 Lists: Add space after bullets
25022 !! options
25023 parsoid=html2wt
25024 !! html
25025 <ul>
25026 <li>foo</li>
25027 <li> bar</li>
25028 <li><span> baz</span></li>
25029 </ul>
25030 !! wikitext
25031 * foo
25032 * bar
25033 * <span> baz</span>
25034 !! end
25035
25036 !! test
25037 1. Headings: Add space before/after == (T53744)
25038 !! options
25039 parsoid=html2wt
25040 !! html
25041 <h2>foo</h2>
25042 <h2> bar</h2>
25043 <h2>baz </h2>
25044 <h2><span> baz</span></h2>
25045 !! wikitext
25046 == foo ==
25047
25048 == bar ==
25049
25050 == baz ==
25051
25052 == <span> baz</span> ==
25053 !! end
25054
25055 !! test
25056 2. Headings: Add space before/after == even after hoisted content
25057 !! options
25058 parsoid={
25059 "modes": ["html2wt"],
25060 "scrubWikitext": true
25061 }
25062 !! html
25063 <h2> <link href="Category:A2" rel="mw:PageProp/Category" />ok</h2>
25064 !! wikitext
25065 [[Category:A2]]
25066
25067 == ok ==
25068 !! end
25069
25070 !! test
25071 1. Headings: suppress newly created empty headings
25072 !! options
25073 parsoid={
25074 "modes": ["html2wt"],
25075 "scrubWikitext": true
25076 }
25077 !! html
25078 <h2></h2>
25079 !! wikitext
25080 !! end
25081
25082 !! test
25083 2. Headings: don't suppress empty headings if scrubWikitext is false
25084 !! options
25085 parsoid=html2wt
25086 !! html
25087 <h2></h2>
25088 !! wikitext
25089 ==<nowiki/>==
25090 !! end
25091
25092 !! test
25093 3. Headings: don't suppress empty headings for existing headings even if scrubWikitext is true
25094 !! options
25095 parsoid={
25096 "modes": ["html2wt"],
25097 "scrubWikitext": true
25098 }
25099 !! html
25100 <h2 data-parsoid='{}'></h2>
25101 !! wikitext
25102 ==<nowiki/>==
25103 !! end
25104
25105 !! test
25106 1. WT Quote Tags: suppress newly created empty style tags
25107 !! options
25108 parsoid={
25109 "modes": ["html2wt"],
25110 "scrubWikitext": true
25111 }
25112 !! html
25113 <i></i><b></b>
25114 !! wikitext
25115 !! end
25116
25117 !! test
25118 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
25119 !! options
25120 parsoid=html2wt
25121 !! html
25122 <i></i><b></b>
25123 !! wikitext
25124 ''<nowiki/>'''''<nowiki/>'''
25125 !! end
25126
25127 !! test
25128 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
25129 !! options
25130 parsoid={
25131 "modes": ["html2wt"],
25132 "scrubWikitext": true
25133 }
25134 !! html
25135 <p> hi</p>
25136 <p> hello</p>
25137 !! wikitext
25138 hi
25139
25140 hello
25141 !! end
25142
25143 !! test
25144 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
25145 !! options
25146 parsoid=html2wt
25147 !! html
25148 <p> hi</p>
25149 <p> hello</p>
25150 !! wikitext
25151 <nowiki> </nowiki>hi
25152
25153 <nowiki> </nowiki> hello
25154 !! end
25155
25156 !! test
25157 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
25158 !! options
25159 parsoid={
25160 "modes": ["html2wt"],
25161 "scrubWikitext": true
25162 }
25163 !! html/parsoid
25164 <p>Foo
25165 bar
25166 baz</p>
25167
25168 <table><tr><td>Foo
25169 bar
25170 baz bang</td></tr></table>
25171
25172 <p><!--boo--> foo
25173 bar</p>
25174
25175 <p> foo
25176 bar<span>boo</span></p>
25177 !! wikitext
25178 Foo
25179 bar
25180 baz
25181
25182 {|
25183 |Foo
25184 bar
25185 baz bang
25186 |}
25187
25188 <!--boo-->foo
25189 bar
25190
25191 foo
25192 bar<span>boo</span>
25193 !! end
25194
25195 !! test
25196 1. New links that end in spaces
25197 !! options
25198 parsoid={
25199 "modes": ["html2wt"],
25200 "scrubWikitext": false
25201 }
25202 !! html
25203 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25204 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25205 !! wikitext
25206 [[Berlin ]]<nowiki/>is the capital of Germany.
25207
25208 [[Foo ]]'''bar'''
25209 !! end
25210
25211 !! test
25212 2. New links that end in spaces
25213 !! options
25214 parsoid={
25215 "modes": ["html2wt"],
25216 "scrubWikitext": true
25217 }
25218 !! html
25219 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25220 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25221 !! wikitext
25222 [[Berlin]] is the capital of Germany.
25223
25224 [[Foo]] '''bar'''
25225 !! end
25226
25227 !! test
25228 3. Existing links that end in spaces
25229 !! options
25230 parsoid={
25231 "modes": ["html2wt"],
25232 "scrubWikitext": true
25233 }
25234 !! html
25235 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin" data-parsoid='{"stx":"simple","a":{"href":"./Berlin"},"sa":{"href":"Berlin "}}'>Berlin </a>is the capital of Germany.</p>
25236
25237 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"Foo "}}'>Foo </a><b>bar</b></p>
25238 !! wikitext
25239 [[Berlin ]]<nowiki/>is the capital of Germany.
25240
25241 [[Foo ]]'''bar'''
25242 !! end
25243
25244 # ---------------------------------------------------
25245 # End of tests spec'ing wikitext serialization norms |
25246 # ---------------------------------------------------
25247
25248 # -----------------------------------------------------------------
25249 # End of section for Parsoid-only html2wt tests for serialization
25250 # of new content
25251 # -----------------------------------------------------------------
25252
25253 # -----------------------------------------------------------------
25254 # The following section of tests are primarily to spec behavior of
25255 # the selective serializer. All these tests have manual selser
25256 # changes. The automated selser changes for all tests handle the
25257 # wide variation of changes, but these tests here capture specs
25258 # deterministically.
25259 # ----------------------------------------------------------------
25260
25261 ## T90517
25262 !! test
25263 Selser: New comments should not be lost
25264 !! options
25265 parsoid={
25266 "modes": ["selser"],
25267 "changes": [
25268 [ "#a", "after", "<!--c1-->" ],
25269 [ "#b", "before", "<!--c2-->" ]
25270 ]
25271 }
25272 !! wikitext
25273 <span id="a">a</span>
25274
25275 <span id="b">b</span>
25276 !! wikitext/edited
25277 <span id="a">a</span><!--c1-->
25278
25279 <!--c2--><span id="b">b</span>
25280 !! end
25281
25282 ## T89383
25283 !! test
25284 Selser: Check for validity of DSR before using it
25285 !! options
25286 parsoid={
25287 "modes": ["selser"],
25288 "changes": [
25289 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
25290 ]
25291 }
25292 !! wikitext
25293 <span id="a">a</span>
25294 !! wikitext/edited
25295 {{DISPLAYTITLE:foo}}
25296 <span id="a">a</span>
25297 !! end
25298
25299 !! test
25300 1. DOMDiff: Changes to <ref> content should be looked up using id
25301 !! options
25302 parsoid={
25303 "modes": ["selser"],
25304 "changes": [
25305 ["#X", "after", "bar"],
25306 ["#Y", "after", "baz"]
25307 ]
25308 }
25309 !! wikitext
25310 X <ref><span id="X">foo</span></ref>
25311 Y <ref name="a" />
25312 <references>
25313 <ref name="a"><span id="Y">foo</span></ref>
25314 </references>
25315 !! wikitext/edited
25316 X <ref><span id="X">foo</span>bar</ref>
25317 Y <ref name="a" />
25318 <references>
25319 <ref name="a"><span id="Y">foo</span>baz</ref>
25320 </references>
25321 !! end
25322
25323 !! test
25324 2. DOMDiff: Changes to <ref> content should be looked up using id
25325 !! options
25326 parsoid={
25327 "modes": ["selser"],
25328 "changes": [
25329 ["#Z", "after", "bar"]
25330 ]
25331 }
25332 !! wikitext
25333 A <ref>foo bar for a</ref>
25334 B <ref group="X" name="b" />
25335
25336 <references />
25337
25338 <references group="X">
25339 <ref name="b"><span id="Z">foo</span></ref>
25340 </references>
25341 !! wikitext/edited
25342 A <ref>foo bar for a</ref>
25343 B <ref group="X" name="b" />
25344
25345 <references />
25346
25347 <references group="X">
25348 <ref name="b"><span id="Z">foo</span>bar</ref>
25349 </references>
25350 !! end