Merge "Enable users to watch category membership changes"
[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 !! endarticle
10325
10326 # hmm, fix this or just deprecate msgnw and document its behavior?
10327 !! test
10328 msgnw keyword
10329 !! wikitext
10330 {{msgnw:MSGNW test}}
10331 !! html/php
10332 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10333 &#42; interpreted
10334 &#32;but rather passed unmodified
10335 &#123;&#123;test&#125;&#125;
10336 &#60;gallery&#62;
10337 File:Foobar.jpg
10338 &#60;/gallery&#62;
10339 </p>
10340 !! end
10341
10342 !! test
10343 int keyword
10344 !! wikitext
10345 {{int:youhavenewmessages|lots of money|not!}}
10346 !! html
10347 <p>You have lots of money (not!).
10348 </p>
10349 !! end
10350
10351 !! article
10352 Template:Includes
10353 !! text
10354 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10355 !! endarticle
10356
10357 !! test
10358 <includeonly> and <noinclude> being included
10359 !! wikitext
10360 {{Includes}}
10361 !! html
10362 <p>Foobar
10363 </p>
10364 !! end
10365
10366 !! article
10367 Template:Includes2
10368 !! text
10369 <onlyinclude>Foo</onlyinclude>bar
10370 !! endarticle
10371
10372 !! test
10373 <onlyinclude> being included
10374 !! wikitext
10375 {{Includes2}}
10376 !! html
10377 <p>Foo
10378 </p>
10379 !! end
10380
10381
10382 !! article
10383 Template:Includes3
10384 !! text
10385 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10386 !! endarticle
10387
10388 !! test
10389 <onlyinclude> and <includeonly> being included
10390 !! wikitext
10391 {{Includes3}}
10392 !! html
10393 <p>Foo
10394 </p>
10395 !! end
10396
10397 !! test
10398 <includeonly> and <noinclude> on a page
10399 !! wikitext
10400 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10401 !! html
10402 <p>Foozar
10403 </p>
10404 !! end
10405
10406 !! test
10407 Un-closed <noinclude>
10408 !! wikitext
10409 <noinclude>
10410 !! html
10411 !! end
10412
10413 !! test
10414 <onlyinclude> on a page
10415 !! wikitext
10416 <onlyinclude>Foo</onlyinclude>bar
10417 !! html
10418 <p>Foobar
10419 </p>
10420 !! end
10421
10422 !! test
10423 Un-closed <onlyinclude>
10424 !! wikitext
10425 <onlyinclude>
10426 !! html
10427 !! end
10428
10429 !!test
10430 Self-closed noinclude, includeonly, onlyinclude tags
10431 !! wikitext
10432 <noinclude />
10433 <includeonly />
10434 <onlyinclude />
10435 !! html
10436 <p><br />
10437 </p>
10438 !!end
10439
10440 !!test
10441 Unbalanced includeonly and noinclude tags
10442 !! wikitext
10443 {|
10444 |a</noinclude>
10445 |b</noinclude></noinclude>
10446 |c</noinclude></includeonly>
10447 |d</includeonly></includeonly>
10448 |}
10449 !! html
10450 <table>
10451 <tr>
10452 <td>a
10453 </td>
10454 <td>b
10455 </td>
10456 <td>c&lt;/includeonly&gt;
10457 </td>
10458 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10459 </td></tr></table>
10460
10461 !!end
10462
10463 !! article
10464 Template:Includeonly section
10465 !! text
10466 <includeonly>
10467 ==Includeonly section==
10468 </includeonly>
10469 ==Section T-1==
10470 !!endarticle
10471
10472 !! test
10473 Bug 6563: Edit link generation for section shown by <includeonly>
10474 !! wikitext
10475 {{includeonly section}}
10476 !! html
10477 <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>
10478 <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>
10479
10480 !! end
10481
10482 # Uses same input as the contents of [[Template:Includeonly section]]
10483 !! test
10484 Bug 6563: Section extraction for section shown by <includeonly>
10485 !! options
10486 section=T-2
10487 !! wikitext
10488 <includeonly>
10489 ==Includeonly section==
10490 </includeonly>
10491 ==Section T-2==
10492 !! html
10493 ==Section T-2==
10494 !! end
10495
10496 !! test
10497 Bug 6563: Edit link generation for section suppressed by <includeonly>
10498 !! wikitext
10499 <includeonly>
10500 ==Includeonly section==
10501 </includeonly>
10502 ==Section 1==
10503 !! html
10504 <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>
10505
10506 !! end
10507
10508 !! test
10509 Bug 6563: Section extraction for section suppressed by <includeonly>
10510 !! options
10511 section=1
10512 !! wikitext
10513 <includeonly>
10514 ==Includeonly section==
10515 </includeonly>
10516 ==Section 1==
10517 !! html
10518 ==Section 1==
10519 !! end
10520
10521 !! test
10522 Un-closed <includeonly>
10523 !! wikitext
10524 <includeonly>
10525 !! html
10526 !! end
10527
10528 !! test
10529 Includes and comments at SOL
10530 !! wikitext
10531 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10532
10533 <noinclude>
10534 some
10535 </noinclude>* stuff
10536 * here
10537
10538 <includeonly>can have stuff</includeonly>=== here ===
10539
10540 !! html/php
10541 <h2><span class="mw-headline" id="hu">hu</span></h2>
10542 <p>some
10543 </p>
10544 <ul><li> stuff</li>
10545 <li> here</li></ul>
10546 <h3><span class="mw-headline" id="here">here</span></h3>
10547
10548 !! html/parsoid
10549 <!-- 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>
10550
10551 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10552 <p>some</p>
10553 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10554 <li> here</li></ul>
10555
10556 <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>
10557
10558 !! end
10559
10560 # TODO: test with DOM fragment reuse!
10561 !! test
10562 Parsoid: DOM fragment reuse
10563 !! options
10564 parsoid=wt2wt,wt2html
10565 !! wikitext
10566 a{{echo|b<table></table>c}}d
10567
10568 a{{echo|b
10569 <table></table>
10570 c}}d
10571
10572 {{echo|a
10573
10574 <table></table>
10575
10576 b}}
10577 !! html
10578 <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>
10579
10580 <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">
10581 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10582 </span><p about="#mwt2">cd</p>
10583
10584 <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">
10585
10586 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10587
10588 </span><p about="#mwt3">b</p>
10589 !! end
10590
10591 !! test
10592 Parsoid: Merge double tds (bug 50603)
10593 !! options
10594 parsoid
10595 !! wikitext
10596 {|
10597 |{{echo|{{!}} foo}}
10598 |}
10599 !! html
10600 <table><tbody>
10601 <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>
10602 </tbody></table>
10603 !! end
10604
10605 !! test
10606 Parsoid: Merge double tds in nested transclusion content (bug 50603)
10607 !! options
10608 parsoid
10609 !! wikitext
10610 {{echo|<div>}}
10611 {|
10612 |{{echo|{{!}} foo}}
10613 |}
10614 {{echo|</div>}}
10615 !! html
10616 <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}}]}'>
10617 <table><tbody>
10618 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10619 </tbody></table>
10620 </div>
10621 !! end
10622
10623 ###
10624 ### <includeonly> and <noinclude> in attributes
10625 ###
10626 !!test
10627 0. includeonly around the entire attribute
10628 !! wikitext
10629 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10630 !! html
10631 <p><span id="v2">bar</span>
10632 </p>
10633 !!end
10634
10635 !!test
10636 1. includeonly in html attr key
10637 !! wikitext
10638 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10639 !! html
10640 <p><span id="foo">bar</span>
10641 </p>
10642 !!end
10643
10644 !!test
10645 2. includeonly in html attr value
10646 !! wikitext
10647 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
10648 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
10649 !! html
10650 <p><span id="v1">bar</span>
10651 <span id="v1">bar</span>
10652 </p>
10653 !!end
10654
10655 !!test
10656 3. includeonly in part of an attr value
10657 !! wikitext
10658 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
10659 !! html
10660 <p><span style="color:red;">bar</span>
10661 </p>
10662 !!end
10663
10664 !!test
10665 4. includeonly in table attributes
10666 !! wikitext
10667 {|
10668 |- <noinclude>
10669 |-
10670 |a
10671 </noinclude>
10672 |- <includeonly>
10673 |-
10674 |b
10675 </includeonly>
10676 |}
10677 !! html
10678 <table>
10679
10680
10681 <tr>
10682 <td>a
10683 </td></tr>
10684 </table>
10685
10686 !!end
10687
10688 ###
10689 ### Token Stream Patcher tests
10690 ###
10691 ### These tests won't always pass wt2wt and other modes because
10692 ### on serialization, the table will be output on a new line.
10693 ### For now, we are blacklisting them, and using this to test selser.
10694 ###
10695
10696 !!test
10697 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
10698 !!options
10699 parsoid=wt2html,wt2wt
10700 !!wikitext
10701 {{echo|}}{| width = '100%'
10702 |foo
10703 |}
10704 !!html/parsoid
10705 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10706 <tbody><tr><td>foo</td></tr>
10707 </tbody></table>
10708 !!end
10709
10710 !!test
10711 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10712 !!options
10713 parsoid=wt2html,wt2wt
10714 !!wikitext
10715 <includeonly>a</includeonly>{| {{{b}}}
10716 |c
10717 |}
10718 !!html/parsoid
10719 <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}}}":""}}'>
10720 <tbody><tr><td>c</td></tr>
10721 </tbody></table>
10722
10723 !!end
10724
10725 ###
10726 ### Testing parsing of templates where a template arg
10727 ### has the same name as the template itself.
10728 ###
10729
10730 !! article
10731 Template:quote
10732 !! text
10733 {{{quote|{{{1}}}}}}
10734 !! endarticle
10735
10736 !!test
10737 Templates: Template Name/Arg clash: 1. Use of positional param
10738 !! wikitext
10739 {{quote|foo}}
10740 !! html
10741 <p>foo
10742 </p>
10743 !!end
10744
10745 !!test
10746 Templates: Template Name/Arg clash: 2. Use of named param
10747 !! wikitext
10748 {{quote|quote=foo}}
10749 !! html
10750 <p>foo
10751 </p>
10752 !!end
10753
10754 !!test
10755 Templates: Template Name/Arg clash: 3. Use of named param with empty input
10756 !! wikitext
10757 {{quote|quote}}
10758 !! html
10759 <p>quote
10760 </p>
10761 !!end
10762
10763 ###
10764 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
10765 ###
10766
10767 !!test
10768 Templates: 1. Simple use
10769 !! wikitext
10770 {{echo|Foo}}
10771 !! html
10772 <p>Foo
10773 </p>
10774 !!end
10775
10776 !!test
10777 Templates: 2. Inside a block tag
10778 !! wikitext
10779 <div>{{echo|Foo}}</div>
10780 <blockquote>{{echo|Foo}}</blockquote>
10781 !! html
10782 <div>Foo</div>
10783 <blockquote>Foo</blockquote>
10784
10785 !! html+tidy
10786 <div>Foo</div>
10787 <blockquote>
10788 <p>Foo</p>
10789 </blockquote>
10790 !!end
10791
10792 !!test
10793 Templates: P-wrapping: 1a. Templates on consecutive lines
10794 !! wikitext
10795 {{echo|Foo}}
10796 {{echo|bar}}
10797 !! html
10798 <p>Foo
10799 bar
10800 </p>
10801 !!end
10802
10803 !!test
10804 Templates: P-wrapping: 1b. Templates on consecutive lines
10805 !! wikitext
10806 Foo
10807
10808 {{echo|bar}}
10809 {{echo|baz}}
10810 !! html
10811 <p>Foo
10812 </p><p>bar
10813 baz
10814 </p>
10815 !!end
10816
10817 !!test
10818 Templates: P-wrapping: 1c. Templates on consecutive lines
10819 !! wikitext
10820 {{echo|Foo}}
10821 {{echo|bar}} <div>baz</div>
10822 !! html
10823 <p>Foo
10824 </p>
10825 bar <div>baz</div>
10826
10827 !! html+tidy
10828 <p>Foo</p>
10829 <p>bar</p>
10830 <div>baz</div>
10831 !! end
10832
10833 !!test
10834 Templates: P-wrapping: 1d. Template preceded by comment-only line
10835 !!options
10836 parsoid
10837 !! wikitext
10838 <!-- foo -->
10839 {{echo|Bar}}
10840 !! html
10841 <!-- foo -->
10842
10843 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
10844 !!end
10845
10846 !!test
10847 Templates: Inline Text: 1. Multiple template uses
10848 !! wikitext
10849 {{echo|Foo}}bar{{echo|baz}}
10850 !! html
10851 <p>Foobarbaz
10852 </p>
10853 !!end
10854
10855 !!test
10856 Templates: Inline Text: 2. Back-to-back template uses
10857 !! wikitext
10858 {{echo|Foo}}{{echo|bar}}
10859 !! html
10860 <p>Foobar
10861 </p>
10862 !!end
10863
10864 !!test
10865 Templates: Block Tags: 1. Multiple template uses
10866 !! wikitext
10867 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
10868 !! html
10869 <div>Foo</div><div>bar</div><div>baz</div>
10870
10871 !!end
10872
10873 !!test
10874 Templates: Block Tags: 2. Back-to-back template uses
10875 !! wikitext
10876 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
10877 !! html
10878 <div>Foo</div><div>bar</div>
10879
10880 !!end
10881
10882 # This is an edge case relating to paragraph wrapping.
10883 !!test
10884 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
10885 !! wikitext
10886 {{echo|a
10887 b</p>}}
10888 !! html/parsoid
10889 <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
10890 b</p>
10891 !!end
10892
10893 !!test
10894 Templates: Links: 1. Simple example
10895 !! wikitext
10896 {{echo|[[Foo|bar]]}}
10897 !! html
10898 <p><a href="/wiki/Foo" title="Foo">bar</a>
10899 </p>
10900 !!end
10901
10902 !!test
10903 Templates: Links: 2. Generation of link href
10904 !! wikitext
10905 [[{{echo|Foo}}|bar]]
10906 !! html
10907 <p><a href="/wiki/Foo" title="Foo">bar</a>
10908 </p>
10909 !!end
10910
10911 !!test
10912 Templates: Links: 3. Generation of part of a link href
10913 !! wikitext
10914 [[Fo{{echo|o}}|bar]]
10915
10916 [[Foo{{echo|bar}}]]
10917
10918 [[Foo{{echo|bar}}baz]]
10919
10920 [[Foo{{echo|bar}}|bar]]
10921
10922 [[:Foo{{echo|bar}}]]
10923
10924 [[:Foo{{echo|bar}}|bar]]
10925 !! html
10926 <p><a href="/wiki/Foo" title="Foo">bar</a>
10927 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10928 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
10929 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10930 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</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>
10933 !!end
10934
10935 !!test
10936 Templates: Links: 4. Multiple templates generating link href
10937 !! wikitext
10938 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
10939 !! html
10940 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10941 </p>
10942 !!end
10943
10944 !!test
10945 Templates: Links: 5. Generation of link text
10946 !! wikitext
10947 [[Foo|{{echo|bar}}]]
10948 !! html
10949 <p><a href="/wiki/Foo" title="Foo">bar</a>
10950 </p>
10951 !!end
10952
10953 !!test
10954 Templates: Links: 5. Nested templates (only outermost template should be marked)
10955 !! wikitext
10956 {{echo|[[{{echo|Foo}}|bar]]}}
10957 !! html
10958 <p><a href="/wiki/Foo" title="Foo">bar</a>
10959 </p>
10960 !!end
10961
10962 !!test
10963 Templates: HTML Tag: 1. Generation of HTML attr. key
10964 !! wikitext
10965 <div {{echo|style}}="color:red;">foo</div>
10966 !! html
10967 <div style="color:red;">foo</div>
10968
10969 !!end
10970
10971 !!test
10972 Templates: HTML Tag: 2. Generation of HTML attr. value
10973 !! wikitext
10974 <div style={{echo|'color:red;'}}>foo</div>
10975 !! html
10976 <div style="color:red;">foo</div>
10977
10978 !!end
10979
10980 !!test
10981 Templates: HTML Tag: 3. Generation of HTML attr key and value
10982 !! wikitext
10983 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
10984 !! html
10985 <div style="color:red;">foo</div>
10986
10987 !!end
10988
10989 !!test
10990 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
10991 !! wikitext
10992 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
10993 !! html
10994 <div title="This is a long title with just one piece templated">foo</div>
10995
10996 !!end
10997
10998 !!test
10999 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11000 !! wikitext
11001 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11002 !! html
11003 <div title="This is a long title with just one piece templated">foo</div>
11004
11005 !!end
11006
11007 !!test
11008 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11009 !! wikitext
11010 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11011 !! html
11012 <div title="This is a long title with just one piece templated">foo</div>
11013
11014 !!end
11015
11016 # SSS FIXME: While it is great we added support for all this,
11017 # do we want to make this part of the spec? Maybe we want to
11018 # deprecate this kind of usage in the future?
11019 !!test
11020 Templates: HTML Tag: 7. Generation of partial attribute key string
11021 !! wikitext
11022 <div st{{echo|yle}}="color:red;">foo</div>
11023 !! html
11024 <div style="color:red;">foo</div>
11025
11026 !!end
11027
11028 !! test
11029 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11030 !! wikitext
11031 <div {{echo|1=id="v1"}}>bar</div>
11032 !! html
11033 <div id="v1">bar</div>
11034
11035 !!end
11036
11037 !! test
11038 Templates: HTML Tag: 9. Multiple template-generated attributes
11039 !! wikitext
11040 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11041 !! html
11042 <div id="v1" title="foo">bar</div>
11043
11044 !!end
11045
11046 !! test
11047 Templates: Support for templates generating attributes and content
11048 !! wikitext
11049 {| {{mixed_attr_content_template}}
11050 |-
11051 |bar
11052 |}
11053 !! html/php
11054 <table style="color:red;" title="T48811">
11055
11056 <tr>
11057 <td>foo
11058 </td></tr>
11059 <tr>
11060 <td>bar
11061 </td></tr></table>
11062
11063 !! html/parsoid
11064 <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|}"]}'>
11065 <tbody><tr>
11066 <td>foo</td></tr>
11067 <tr>
11068 <td>bar</td></tr>
11069 </tbody></table>
11070 !!end
11071
11072 !! test
11073 1. Entities and nowikis inside templated attributes should be handled correctly
11074 !! wikitext
11075 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11076 !! html/php
11077 <div style="background:#f9f9f9;">foo</div>
11078
11079 !! html/parsoid
11080 <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>
11081 !! end
11082
11083 !! test
11084 2. Entities and nowikis inside templated attributes should be handled correctly
11085 !! wikitext
11086 {|
11087 |{{table_attribs_3}}
11088 |}
11089 !! html/php
11090 <table>
11091 <tr>
11092 <td style="background:#f9f9f9;">Foo
11093 </td></tr></table>
11094
11095 !! html/parsoid
11096 <table>
11097 <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>
11098 </tbody></table>
11099 !! end
11100
11101 !! test
11102 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11103 !! wikitext
11104 {{tbl-start}}
11105 |{{table_attribs_3}}
11106 {{tbl-end}}
11107 !! html/php
11108 <table>
11109 <tr>
11110 <td style="background:#f9f9f9;">Foo
11111 </td></tr></table>
11112
11113 !! html/parsoid
11114 <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}}]}'>
11115 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11116 </tbody></table>
11117 !! end
11118
11119 # T107622
11120 !! test
11121 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11122 !! wikitext
11123 {|
11124 | {{table_attribs_6}} hi
11125 |}
11126 !! html/php
11127 <table>
11128 <tr>
11129 <td style="background: red;"> hi
11130 </td></tr></table>
11131
11132 !! html/parsoid
11133 <table>
11134 <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>
11135 </tbody></table>
11136 !! end
11137
11138 !!test
11139 Templates: HTML Tables: 1. Generating start of a HTML table
11140 !! wikitext
11141 {{echo|<table><tr><td>foo</td>}}</tr></table>
11142 !! html
11143 <table><tr><td>foo</td></tr></table>
11144
11145 !!end
11146
11147 !!test
11148 Templates: HTML Tables: 2a. Generating middle of a HTML table
11149 !! wikitext
11150 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11151 !! html
11152 <table><tr><td>foo</td></tr></table>
11153
11154 !!end
11155
11156 !!test
11157 Templates: HTML Tables: 2b. Generating middle of a HTML table
11158 !! wikitext
11159 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11160 !! html
11161 <table><tr><td>foo</td></tr></table>
11162
11163 !!end
11164
11165 !!test
11166 Templates: HTML Tables: 3. Generating end of a HTML table
11167 !! wikitext
11168 <table><tr>{{echo|<td>foo</td></tr></table>}}
11169 !! html
11170 <table><tr><td>foo</td></tr></table>
11171
11172 !!end
11173
11174 !!test
11175 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11176 !! wikitext
11177 {{echo|<table>}}<tr><td>foo</td></tr></table>
11178 !! html
11179 <table><tr><td>foo</td></tr></table>
11180
11181 !!end
11182
11183 !!test
11184 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11185 !! wikitext
11186 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11187 !! html
11188 <table><tr><td>foo</td></tr></table>
11189
11190 !!end
11191
11192 !!test
11193 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11194 !! wikitext
11195 <table><tr>{{echo|<td>}}foo</td></tr></table>
11196 !! html
11197 <table><tr><td>foo</td></tr></table>
11198
11199 !!end
11200
11201 !!test
11202 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11203 !! wikitext
11204 <table><tr><td>foo{{echo|</td>}}</tr></table>
11205 !! html
11206 <table><tr><td>foo</td></tr></table>
11207
11208 !!end
11209
11210 !!test
11211 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11212 !! wikitext
11213 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11214 !! html
11215 <table><tr><td>foo</td></tr></table>
11216
11217 !!end
11218
11219 !!test
11220 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11221 !! wikitext
11222 <table><tr><td>foo</td></tr>{{echo|</table>}}
11223 !! html
11224 <table><tr><td>foo</td></tr></table>
11225
11226 !!end
11227
11228 !!test
11229 Templates: HTML Tables: 5. Proper fostering of categories from inside
11230 !!options
11231 parsoid=wt2html,wt2wt
11232 !! wikitext
11233 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11234 <!--Two categories (Bug 50330)-->
11235 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11236 !! html
11237 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11238 <!--Two categories (Bug 50330)-->
11239 <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>
11240 !!end
11241
11242 !!test
11243 Templates: Wiki Tables: 1a. Fostering of entire template content
11244 !! wikitext
11245 {|
11246 {{echo|a}}
11247 |}
11248 !! html
11249 <table>
11250 a
11251 <tr><td></td></tr></table>
11252
11253 !! html+tidy
11254 <p>a</p>
11255 <table>
11256 <tr>
11257 <td></td>
11258 </tr>
11259 </table>
11260 !! end
11261
11262 !!test
11263 Templates: Wiki Tables: 1b. Fostering of entire template content
11264 !! wikitext
11265 {|
11266 {{echo|<div>}}
11267 foo
11268 {{echo|</div>}}
11269 |}
11270 !! html
11271 <table>
11272 <div>
11273 <p>foo
11274 </p>
11275 </div>
11276 <tr><td></td></tr></table>
11277
11278 !! html+tidy
11279 <div>
11280 <p>foo</p>
11281 </div>
11282 <table>
11283 <tr>
11284 <td></td>
11285 </tr>
11286 </table>
11287 !! end
11288
11289 !!test
11290 Templates: Wiki Tables: 2. Fostering of partial template content
11291 !! wikitext
11292 {|
11293 {{echo|a
11294 <div>b</div>}}
11295 |}
11296 !! html
11297 <table>
11298 a
11299 <div>b</div>
11300 <tr><td></td></tr></table>
11301
11302 !! html+tidy
11303 <p>a</p>
11304 <div>b</div>
11305 <table>
11306 <tr>
11307 <td></td>
11308 </tr>
11309 </table>
11310 !! end
11311
11312 !!test
11313 Templates: Wiki Tables: 3. td-content via multiple templates
11314 !! wikitext
11315 {|
11316 {{echo|{{pipe}}a}}{{echo|b}}
11317 |}
11318 !! html
11319 <table>
11320 <tr>
11321 <td>ab
11322 </td></tr></table>
11323
11324 !!end
11325
11326 !!test
11327 Templates: Wiki Tables: 4. Templated tags, no content
11328 !! wikitext
11329 {{tbl-start}}
11330 {{tbl-end}}
11331 !! html
11332 <table>
11333 <tr><td></td></tr></table>
11334
11335 !!end
11336
11337 !!test
11338 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11339 !! wikitext
11340 {{tbl-start}}
11341 |foo
11342 {{tbl-end}}
11343 !! html
11344 <table>
11345 <tr>
11346 <td>foo
11347 </td></tr></table>
11348
11349 !!end
11350
11351 !!test
11352 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11353 !! wikitext
11354 {{tbl-start}}
11355 {{!}}foo
11356 {{tbl-end}}
11357 !! html
11358 <table>
11359 <tr>
11360 <td>foo
11361 </td></tr></table>
11362
11363 !!end
11364
11365 ## This test case is very specific to Parsoid's internals
11366 ## and is hence only tested for Parsoid's code. Parsoid uses
11367 ## a <meta> marker tag for <ref> tags and they are expanded
11368 ## much later. We are verifying that this <meta> tag usage
11369 ## doesn't prevent foster parenting.
11370 !!test
11371 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11372 !!wikitext
11373 {{PartialTable}}<ref>foo</ref>
11374 |}
11375
11376 <references />
11377 !!html/parsoid
11378 <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">
11379 <tbody>
11380 </tbody></table>
11381
11382 <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>
11383 !!end
11384
11385 !! test
11386 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11387 !! wikitext
11388 {{echo|
11389 {{{!}}
11390 {{!}}-}}
11391 <onlyinclude>
11392 |foo
11393 </onlyinclude>
11394 {{!}}}
11395 !! html/parsoid
11396 <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{{!}}}"]}'>
11397 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11398 <tbody><tr>
11399
11400 <td>foo
11401 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11402 </tbody></table>
11403 !! end
11404
11405 !!test
11406 Templates: Lists: Multi-line list-items via templates
11407 !! wikitext
11408 *{{echo|a {{nonexistent|
11409 unused}}}}
11410 *{{echo|b {{nonexistent|
11411 unused}}}}
11412 !! html
11413 <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>
11414 <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>
11415
11416 !!end
11417
11418 !!test
11419 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11420 !! wikitext
11421 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11422 !! html
11423 <p><i>ab</i>c<i>d</i>e
11424 </p>
11425 !!end
11426
11427 !!test
11428 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11429 (PHP parser generates misnested html)
11430 !! wikitext
11431 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11432 !! html/parsoid
11433 <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>
11434 !!end
11435
11436 !!test
11437 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11438 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11439 !! options
11440 parsoid=wt2html,wt2wt
11441 !! wikitext
11442 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11443 !! html
11444 <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>
11445 <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>
11446 <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>
11447 !!end
11448
11449 !!test
11450 Templates: Ugly nesting: 4. Divs opened/closed across templates
11451 !! wikitext
11452 a<div>b{{echo|c</div>d}}e
11453 !! html
11454 a<div>bc</div>de
11455
11456 !! html+tidy
11457 <p>a</p>
11458 <div>bc</div>
11459 <p>de</p>
11460 !! end
11461
11462 !!test
11463 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11464 (Parsoid-centric)
11465 !! options
11466 parsoid
11467 !! wikitext
11468 {|
11469 |{{echo|foo</table>}}
11470 |bar
11471 |}
11472 !! html
11473 <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|}"]}'>
11474
11475 <tbody>
11476 <tr>
11477 <td>foo</td></tr></tbody></table><span about="#mwt1">
11478 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11479 |}</span>
11480 !!end
11481
11482 !!test
11483 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11484 (Parsoid-centric)
11485 !! options
11486 parsoid
11487 !! wikitext
11488 <table>
11489 <tr>
11490 <td>
11491 <table>
11492 <tr>
11493 <td>1. {{echo|foo </table>}}</td>
11494 <td> bar </td>
11495 <td>2. {{echo|baz </table>}}</td>
11496 </tr>
11497 <tr>
11498 <td>abc</td>
11499 </tr>
11500 </table>
11501 </td>
11502 </tr>
11503 <tr>
11504 <td>xyz</td>
11505 </tr>
11506 </table>
11507 !! html
11508 <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>"]}'>
11509 <tbody><tr>
11510 <td>
11511 <table>
11512 <tbody><tr>
11513 <td>1. foo </td></tr></tbody></table></td>
11514 <td> bar </td>
11515 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11516 </span><span about="#mwt2">
11517 </span><span about="#mwt2">
11518 </span><span about="#mwt2">abc</span><span about="#mwt2">
11519 </span><span about="#mwt2">
11520 </span><span about="#mwt2">
11521 </span><span about="#mwt2">
11522 </span><span about="#mwt2">
11523 </span><span about="#mwt2">
11524 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11525 </span><span about="#mwt2">
11526 </span>
11527 !!end
11528
11529 !! test
11530 Templates: Ugly templates: 3. newline-only template parameter
11531 !! wikitext
11532 foo {{echo|
11533 }}
11534 !! html
11535 <p>foo
11536 </p>
11537 !! end
11538
11539 # This looks like a bug: a single newline triggers p/br for some reason.
11540 !! test
11541 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11542 !! wikitext
11543 {{echo|
11544 }}
11545 !! html
11546 <p><br />
11547 </p>
11548 !! end
11549
11550 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11551 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11552 !! test
11553 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11554 !! wikitext
11555 {{echo|<table>}}
11556 {{echo|<div>foo}}
11557 {{echo|</table>}}
11558 !! html/parsoid
11559 <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
11560 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11561 </table>
11562 !! end
11563
11564 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
11565 # that are "identical" and generate nesting cycles in the algorithm
11566 !! test
11567 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11568 !! wikitext
11569 {{echo|<table><tr><td><table>}}
11570 {{echo|<div>}}
11571 {{echo|</div>}}
11572 !! html/parsoid
11573 <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"}'>
11574 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11575 </table></td></tr></tbody></table>
11576 !! end
11577
11578 !!test
11579 Parser Functions: 1. Simple example
11580 !! wikitext
11581 {{uc:foo}}
11582 !! html
11583 <p>FOO
11584 </p>
11585 !!end
11586
11587 !!test
11588 Parser Functions: 2. Nested use (only outermost should be marked up)
11589 !! wikitext
11590 {{uc:{{lc:FOO}}}}
11591 !! html
11592 <p>FOO
11593 </p>
11594 !!end
11595
11596 ###
11597 ### Pre-save transform tests
11598 ###
11599 !! test
11600 pre-save transform: subst:
11601 !! options
11602 pst
11603 !! wikitext
11604 {{subst:test}}
11605 !! html/php
11606 This is a test template
11607 !! end
11608
11609 !! test
11610 pre-save transform: normal template
11611 !! options
11612 pst
11613 !! wikitext
11614 {{test}}
11615 !! html/php
11616 {{test}}
11617 !! end
11618
11619 !! test
11620 pre-save transform: nonexistent template
11621 !! options
11622 pst
11623 !! wikitext
11624 {{thistemplatedoesnotexist}}
11625 !! html/php
11626 {{thistemplatedoesnotexist}}
11627 !! end
11628
11629 !! test
11630 pre-save transform: subst magic variables
11631 !! options
11632 pst
11633 !! wikitext
11634 {{subst:SITENAME}}
11635 !! html/php
11636 MediaWiki
11637 !! end
11638
11639 # This is bug 89, which I fixed. -- wtm
11640 !! test
11641 pre-save transform: subst: templates with parameters
11642 !! options
11643 pst
11644 !! wikitext
11645 {{subst:paramtest|param="something else"}}
11646 !! html/php
11647 This is a test template with parameter "something else"
11648 !! end
11649
11650 !! article
11651 Template:nowikitest
11652 !! text
11653 <nowiki>'''not wiki'''</nowiki>
11654 !! endarticle
11655
11656 !! test
11657 pre-save transform: nowiki in subst (bug 1188)
11658 !! options
11659 pst
11660 !! wikitext
11661 {{subst:nowikitest}}
11662 !! html/php
11663 <nowiki>'''not wiki'''</nowiki>
11664 !! end
11665
11666 !! article
11667 Template:commenttest
11668 !! text
11669 This template has <!-- a comment --> in it.
11670 !! endarticle
11671
11672 !! test
11673 pre-save transform: comment in subst (bug 1936)
11674 !! options
11675 pst
11676 !! wikitext
11677 {{subst:commenttest}}
11678 !! html/php
11679 This template has <!-- a comment --> in it.
11680 !! end
11681
11682 !! test
11683 pre-save transform: unclosed tag
11684 !! options
11685 pst noxml
11686 !! wikitext
11687 <nowiki>'''not wiki'''
11688 !! html/php
11689 <nowiki>'''not wiki'''
11690 !! end
11691
11692 !! test
11693 pre-save transform: mixed tag case
11694 !! options
11695 pst noxml
11696 !! wikitext
11697 <NOwiki>'''not wiki'''</noWIKI>
11698 !! html/php
11699 <NOwiki>'''not wiki'''</noWIKI>
11700 !! end
11701
11702 !! test
11703 pre-save transform: unclosed comment in <nowiki>
11704 !! options
11705 pst noxml
11706 !! wikitext
11707 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11708 !! html/php
11709 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11710 !!end
11711
11712 # Leading @ in this template definition works around a limitation
11713 # in parsoid's parserTests which otherwise strips the <span> from the
11714 # result (confusing it for a template wrapper)
11715 !! article
11716 Template:dangerous
11717 !!text
11718 @<span onmouseover="alert('crap')">Oh no</span>
11719 !!endarticle
11720
11721 !!test
11722 (confirming safety of fix for subst bug 1936)
11723 !! wikitext
11724 {{Template:dangerous}}
11725 !! html
11726 <p>@<span>Oh no</span>
11727 </p>
11728 !! end
11729
11730 !! test
11731 pre-save transform: comment containing gallery (bug 5024)
11732 !! options
11733 pst
11734 !! wikitext
11735 <!-- <gallery>data</gallery> -->
11736 !! html/php
11737 <!-- <gallery>data</gallery> -->
11738 !!end
11739
11740 !! test
11741 pre-save transform: comment containing extension
11742 !! options
11743 pst
11744 !! wikitext
11745 <!-- <tag>data</tag> -->
11746 !! html/php
11747 <!-- <tag>data</tag> -->
11748 !!end
11749
11750 !! test
11751 pre-save transform: comment containing nowiki
11752 !! options
11753 pst
11754 !! wikitext
11755 <!-- <nowiki>data</nowiki> -->
11756 !! html/php
11757 <!-- <nowiki>data</nowiki> -->
11758 !!end
11759
11760 !! test
11761 pre-save transform: <noinclude> in subst (bug 3298)
11762 !! options
11763 pst
11764 !! wikitext
11765 {{subst:Includes}}
11766 !! html/php
11767 Foobar
11768 !! end
11769
11770 !! test
11771 pre-save transform: <onlyinclude> in subst (bug 3298)
11772 !! options
11773 pst
11774 !! wikitext
11775 {{subst:Includes2}}
11776 !! html/php
11777 Foo
11778 !! end
11779
11780 !! article
11781 Template:SubstTest
11782 !!text
11783 {{<includeonly>subst:</includeonly>Includes}}
11784 !! endarticle
11785
11786 !! article
11787 Template:SafeSubstTest
11788 !! text
11789 {{<includeonly>safesubst:</includeonly>Includes}}
11790 !! endarticle
11791
11792 !! test
11793 bug 22297: safesubst: works during PST
11794 !! options
11795 pst
11796 !! wikitext
11797 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
11798 !! html/php
11799 FoobarFoobar
11800 !! end
11801
11802 !! test
11803 bug 22297: safesubst: works during normal parse
11804 !! wikitext
11805 {{SafeSubstTest}}
11806 !! html
11807 <p>Foobar
11808 </p>
11809 !! end
11810
11811 !! test
11812 subst: does not work during normal parse
11813 !! wikitext
11814 {{SubstTest}}
11815 !! html
11816 <p>{{subst:Includes}}
11817 </p>
11818 !! end
11819
11820 !! test
11821 pre-save transform: context links ("pipe trick")
11822 !! options
11823 pst
11824 !! wikitext
11825 [[Article (context)|]]
11826 [[Bar:Article|]]
11827 [[:Bar:Article|]]
11828 [[Bar:Article (context)|]]
11829 [[:Bar:Article (context)|]]
11830 [[|Article]]
11831 [[|Article (context)]]
11832 [[Bar:X (Y) Z|]]
11833 [[:Bar:X (Y) Z|]]
11834 !! html/php
11835 [[Article (context)|Article]]
11836 [[Bar:Article|Article]]
11837 [[:Bar:Article|Article]]
11838 [[Bar:Article (context)|Article]]
11839 [[:Bar:Article (context)|Article]]
11840 [[Article]]
11841 [[Article (context)]]
11842 [[Bar:X (Y) Z|X (Y) Z]]
11843 [[:Bar:X (Y) Z|X (Y) Z]]
11844 !! end
11845
11846 !! test
11847 pre-save transform: context links ("pipe trick") with interwiki prefix
11848 !! options
11849 pst
11850 !! wikitext
11851 [[interwiki:Article|]]
11852 [[:interwiki:Article|]]
11853 [[interwiki:Bar:Article|]]
11854 [[:interwiki:Bar:Article|]]
11855 !! html/php
11856 [[interwiki:Article|Article]]
11857 [[:interwiki:Article|Article]]
11858 [[interwiki:Bar:Article|Bar:Article]]
11859 [[:interwiki:Bar:Article|Bar:Article]]
11860 !! end
11861
11862 !! test
11863 pre-save transform: context links ("pipe trick") with parens in title
11864 !! options
11865 pst title=[[Somearticle (context)]]
11866 !! wikitext
11867 [[|Article]]
11868 !! html/php
11869 [[Article (context)|Article]]
11870 !! end
11871
11872 !! test
11873 pre-save transform: context links ("pipe trick") with comma in title
11874 !! options
11875 pst title=[[Someplace, Somewhere]]
11876 !! wikitext
11877 [[|Otherplace]]
11878 [[Otherplace, Elsewhere|]]
11879 [[Otherplace, Elsewhere, Anywhere|]]
11880 !! html/php
11881 [[Otherplace, Somewhere|Otherplace]]
11882 [[Otherplace, Elsewhere|Otherplace]]
11883 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
11884 !! end
11885
11886 !! test
11887 pre-save transform: context links ("pipe trick") with parens and comma
11888 !! options
11889 pst title=[[Someplace (IGNORED), Somewhere]]
11890 !! wikitext
11891 [[|Otherplace]]
11892 [[Otherplace (place), Elsewhere|]]
11893 !! html/php
11894 [[Otherplace, Somewhere|Otherplace]]
11895 [[Otherplace (place), Elsewhere|Otherplace]]
11896 !! end
11897
11898 !! test
11899 pre-save transform: context links ("pipe trick") with comma and parens
11900 !! options
11901 pst title=[[Who, me? (context)]]
11902 !! wikitext
11903 [[|Yes, you.]]
11904 [[Me, Myself, and I (1937 song)|]]
11905 !! html/php
11906 [[Yes, you. (context)|Yes, you.]]
11907 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
11908 !! end
11909
11910 !! test
11911 pre-save transform: context links ("pipe trick") with namespace
11912 !! options
11913 pst title=[[Ns:Somearticle]]
11914 !! wikitext
11915 [[|Article]]
11916 !! html/php
11917 [[Ns:Article|Article]]
11918 !! end
11919
11920 !! test
11921 pre-save transform: context links ("pipe trick") with namespace and parens
11922 !! options
11923 pst title=[[Ns:Somearticle (context)]]
11924 !! wikitext
11925 [[|Article]]
11926 !! html/php
11927 [[Ns:Article (context)|Article]]
11928 !! end
11929
11930 !! test
11931 pre-save transform: context links ("pipe trick") with namespace and comma
11932 !! options
11933 pst title=[[Ns:Somearticle, Context, Whatever]]
11934 !! wikitext
11935 [[|Article]]
11936 !! html/php
11937 [[Ns:Article, Context, Whatever|Article]]
11938 !! end
11939
11940 !! test
11941 pre-save transform: context links ("pipe trick") with namespace, comma and parens
11942 !! options
11943 pst title=[[Ns:Somearticle, Context (context)]]
11944 !! wikitext
11945 [[|Article]]
11946 !! html/php
11947 [[Ns:Article (context)|Article]]
11948 !! end
11949
11950 !! test
11951 pre-save transform: context links ("pipe trick") with namespace, parens and comma
11952 !! options
11953 pst title=[[Ns:Somearticle (IGNORED), Context]]
11954 !! wikitext
11955 [[|Article]]
11956 !! html/php
11957 [[Ns:Article, Context|Article]]
11958 !! end
11959
11960 !! test
11961 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
11962 !! options
11963 pst
11964 !! wikitext
11965 [[Article(context)|]]
11966 [[Bar:Article(context)|]]
11967 [[:Bar:Article(context)|]]
11968 [[|Article(context)]]
11969 [[Bar:X(Y)Z|]]
11970 [[:Bar:X(Y)Z|]]
11971 !! html/php
11972 [[Article(context)|Article]]
11973 [[Bar:Article(context)|Article]]
11974 [[:Bar:Article(context)|Article]]
11975 [[Article(context)]]
11976 [[Bar:X(Y)Z|X(Y)Z]]
11977 [[:Bar:X(Y)Z|X(Y)Z]]
11978 !! end
11979
11980 !! test
11981 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
11982 !! options
11983 pst
11984 !! wikitext
11985 [[Article (context)|]]
11986 [[Bar:Article (context)|]]
11987 [[:Bar:Article (context)|]]
11988 [[|Article (context)]]
11989 [[Bar:X (Y) Z|]]
11990 [[:Bar:X (Y) Z|]]
11991 !! html/php
11992 [[Article (context)|Article]]
11993 [[Bar:Article (context)|Article]]
11994 [[:Bar:Article (context)|Article]]
11995 [[Article (context)]]
11996 [[Bar:X (Y) Z|X (Y) Z]]
11997 [[:Bar:X (Y) Z|X (Y) Z]]
11998 !! end
11999
12000 !! test
12001 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12002 !! options
12003 pst
12004 !! wikitext
12005 [[Article(context)|]]
12006 [[Bar:Article(context)|]]
12007 [[:Bar:Article(context)|]]
12008 [[|Article(context)]]
12009 [[Bar:X(Y)Z|]]
12010 [[:Bar:X(Y)Z|]]
12011 !! html/php
12012 [[Article(context)|Article]]
12013 [[Bar:Article(context)|Article]]
12014 [[:Bar:Article(context)|Article]]
12015 [[Article(context)]]
12016 [[Bar:X(Y)Z|X(Y)Z]]
12017 [[:Bar:X(Y)Z|X(Y)Z]]
12018 !! end
12019
12020 !! test
12021 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12022 !! options
12023 pst
12024 !! wikitext
12025 [[Article (context), context|]]
12026 [[Article (context),context|]]
12027 [[Bar:Article (context), context|]]
12028 [[Bar:Article (context),context|]]
12029 [[:Bar:Article (context), context|]]
12030 [[:Bar:Article (context),context|]]
12031 !! html/php
12032 [[Article (context), context|Article]]
12033 [[Article (context),context|Article]]
12034 [[Bar:Article (context), context|Article]]
12035 [[Bar:Article (context),context|Article]]
12036 [[:Bar:Article (context), context|Article]]
12037 [[:Bar:Article (context),context|Article]]
12038 !! end
12039
12040 !! test
12041 pre-save transform: trim trailing empty lines
12042 !! options
12043 pst
12044 !! wikitext
12045 Empty lines are trimmed
12046
12047
12048
12049
12050 !! html/php
12051 Empty lines are trimmed
12052 !! end
12053
12054 !! test
12055 pre-save transform: Signature expansion
12056 !! options
12057 pst
12058 !! wikitext
12059 * ~~~
12060 * <noinclude>~~~</noinclude>
12061 * <includeonly>~~~</includeonly>
12062 * <onlyinclude>~~~</onlyinclude>
12063 !! html/php
12064 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12065 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12066 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12067 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12068 !! end
12069
12070
12071 !! test
12072 pre-save transform: Signature expansion in nowiki tags (bug 93)
12073 !! options
12074 pst disabled
12075 !! wikitext
12076 Shall not expand:
12077
12078 <nowiki>~~~~</nowiki>
12079
12080 <includeonly><nowiki>~~~~</nowiki></includeonly>
12081
12082 <noinclude><nowiki>~~~~</nowiki></noinclude>
12083
12084 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12085
12086 {{subst:Foo}} shall be converted to FOO
12087
12088 As well as inside noinclude/onlyinclude
12089 <noinclude>{{subst:Foo}}</noinclude>
12090 <onlyinclude>{{subst:Foo}}</onlyinclude>
12091
12092 But not inside includeonly
12093 <includeonly>{{subst:Foo}}</includeonly>
12094 !! html/php
12095 Shall not expand:
12096
12097 <nowiki>~~~~</nowiki>
12098
12099 <includeonly><nowiki>~~~~</nowiki></includeonly>
12100
12101 <noinclude><nowiki>~~~~</nowiki></noinclude>
12102
12103 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12104
12105 FOO shall be converted to FOO
12106
12107 As well as inside noinclude/onlyinclude
12108 <noinclude>FOO</noinclude>
12109 <onlyinclude>FOO</onlyinclude>
12110
12111 But not inside includeonly
12112 <includeonly>{{subst:Foo}}</includeonly>
12113 !! end
12114
12115 !! test
12116 Parsoid: Recognize nowiki with trailing space in tags
12117 !! options
12118 parsoid=wt2html
12119 !! wikitext
12120 <nowiki ><div>[[foo]]</nowiki >
12121
12122 a<nowiki / >b
12123
12124 c<nowiki />d
12125
12126 e<nowiki/ >f
12127 !! html
12128 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12129 <p>ab</p>
12130 <p>cd</p>
12131 <p>ef</p>
12132 !! end
12133
12134 !! test
12135 Parsoid: Recognize nowiki with odd capitalization
12136 !! options
12137 parsoid=wt2html
12138 !! wikitext
12139 <noWikI ><div>[[foo]]</Nowiki >
12140 !! html
12141 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12142 !! end
12143
12144
12145 !! test
12146 Parsoid: Escape nowiki with trailing space in tags
12147 !! options
12148 parsoid=html2wt
12149 !! html
12150 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12151 <p>a&lt;nowiki /&gt;b</p>
12152 <p>c&lt;nowiki/ &gt;d</p>
12153 !! wikitext
12154 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12155
12156 a&lt;nowiki /&gt;b
12157
12158 c&lt;nowiki/ &gt;d
12159 !! end
12160
12161 !! test
12162 Parsoid: Escape weird noWikI capitalizations
12163 !! options
12164 parsoid=html2wt
12165 !! html
12166 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12167 !! wikitext
12168 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12169 !! end
12170
12171 ###
12172 ### Message transform tests
12173 ###
12174 !! test
12175 message transform: magic variables
12176 !! options
12177 msg
12178 !! wikitext
12179 {{SITENAME}}
12180 !! html
12181 MediaWiki
12182 !! end
12183
12184 !! test
12185 message transform: should not transform wiki markup
12186 !! options
12187 msg
12188 !! wikitext
12189 ''test''
12190 !! html
12191 ''test''
12192 !! end
12193
12194 !! test
12195 message transform: <noinclude> in transcluded template (bug 4926)
12196 !! options
12197 msg
12198 !! wikitext
12199 {{Includes}}
12200 !! html
12201 Foobar
12202 !! end
12203
12204 !! test
12205 message transform: <onlyinclude> in transcluded template (bug 4926)
12206 !! options
12207 msg
12208 !! wikitext
12209 {{Includes2}}
12210 !! html
12211 Foo
12212 !! end
12213
12214 !! test
12215 {{#special:}} page name, known
12216 !! options
12217 msg
12218 !! wikitext
12219 {{#special:Recentchanges}}
12220 !! html
12221 Special:RecentChanges
12222 !! end
12223
12224 !! test
12225 {{#special:}} page name with subpage, known
12226 !! options
12227 msg
12228 !! wikitext
12229 {{#special:Recentchanges/param}}
12230 !! html
12231 Special:RecentChanges/param
12232 !! end
12233
12234 !! test
12235 {{#special:}} page name, unknown
12236 !! options
12237 msg
12238 !! wikitext
12239 {{#special:foobar nonexistent}}
12240 !! html
12241 Special:Foobar nonexistent
12242 !! end
12243
12244 !! test
12245 {{#speciale:}} page name, known
12246 !! options
12247 msg
12248 !! wikitext
12249 {{#speciale:Recentchanges}}
12250 !! html
12251 Special:RecentChanges
12252 !! end
12253
12254 !! test
12255 {{#speciale:}} page name with subpage, known
12256 !! options
12257 msg
12258 !! wikitext
12259 {{#speciale:Recentchanges/param}}
12260 !! html
12261 Special:RecentChanges/param
12262 !! end
12263
12264 !! test
12265 {{#speciale:}} page name, unknown
12266 !! options
12267 msg
12268 !! wikitext
12269 {{#speciale:foobar nonexistent}}
12270 !! html
12271 Special:Foobar_nonexistent
12272 !! end
12273
12274 ###
12275 ### Images
12276 ###
12277 ### For Parsoid-specific tests, see
12278 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12279
12280 !! test
12281 Simple image
12282 !! options
12283 parsoid=wt2html,wt2wt,html2html
12284 !! wikitext
12285 [[Image:foobar.jpg]]
12286 !! html/php
12287 <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>
12288 </p>
12289 !! html/parsoid
12290 <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>
12291 !! end
12292
12293 !! test
12294 Simple image (using File: namespace, now canonical)
12295 !! wikitext
12296 [[File:Foobar.jpg]]
12297 !! html/php
12298 <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>
12299 </p>
12300 !! html/parsoid
12301 <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>
12302 !! end
12303
12304 !! test
12305 Right-aligned image
12306 !! wikitext
12307 [[File:Foobar.jpg|right]]
12308 !! html/php
12309 <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>
12310
12311 !! html/parsoid
12312 <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>
12313 !! end
12314
12315 !! test
12316 Image with caption
12317 !! wikitext
12318 [[File:Foobar.jpg|right|Caption text]]
12319 !! html/php
12320 <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>
12321
12322 !! html/parsoid
12323 <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>
12324 !! end
12325
12326 !! test
12327 Image with caption, bug 53312 #1
12328 !! wikitext
12329 [[File:Foobar.jpg|right|Caption page stuff]]
12330 !! html/php
12331 <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>
12332
12333 !! html/parsoid
12334 <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>
12335 !! end
12336
12337 !! test
12338 Image with caption, bug 53312 #2
12339 !! wikitext
12340 [[File:Foobar.jpg|right|Caption page=]]
12341 !! html/php
12342 <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>
12343
12344 !! html/parsoid
12345 <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>
12346 !! end
12347
12348 !! test
12349 Image with caption, bug 53312 #3
12350 !! wikitext
12351 [[File:Foobar.jpg|right|Caption page=stuff]]
12352 !! html/php
12353 <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>
12354
12355 !! html/parsoid
12356 <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>
12357 !! end
12358
12359 !! test
12360 Allow empty links in image captions (Bug 60753)
12361 !! options
12362 thumbsize=220
12363 !! wikitext
12364 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12365 [[]]
12366 [[Link2]]
12367 ]]
12368 !! html/php
12369 <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>
12370
12371 !! html/parsoid
12372 <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>
12373 [[]]
12374 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12375 </figcaption></figure>
12376 !! end
12377
12378 !! test
12379 Titles in unlinked images (T23454)
12380 !! wikitext
12381 [[File:Foobar.jpg|link=|stuff]]
12382 !! html/php
12383 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12384 </p>
12385 !! end
12386
12387 !! test
12388 Link with empty target
12389 !! wikitext
12390 [[]]
12391 !! html
12392 <p>[[]]
12393 </p>
12394 !! end
12395
12396 !! test
12397 Image with link trail
12398 !! wikitext
12399 Linktrails should not work for images: [[File:Foobar.jpg]]s
12400 !! html/php
12401 <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
12402 </p>
12403 !! html/parsoid
12404 <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>
12405 !! end
12406
12407 !! test
12408 Image with empty attribute
12409 !! options
12410 parsoid=wt2html,wt2wt,html2html
12411 !! wikitext
12412 [[File:Foobar.jpg|right||Caption text]]
12413 !! html/php
12414 <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>
12415
12416 !! html/parsoid
12417 <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>
12418 !! end
12419
12420 !! test
12421 1. Block image with individual attributes from templates
12422 !! wikitext
12423 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12424 !! html/php
12425 <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>
12426
12427 !! html/parsoid
12428 <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>
12429 !! end
12430
12431 !! test
12432 2. Block Image with individual attributes from templates
12433 !! wikitext
12434 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12435 !! html/php
12436 <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>
12437
12438 !! html/parsoid
12439 <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>
12440 !! end
12441
12442 !! test
12443 3. Inline image with individual attributes from templates
12444 !! wikitext
12445 [[File:Foobar.jpg|{{echo|50px}}]]
12446 !! html/php
12447 <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>
12448 </p>
12449 !! html/parsoid
12450 <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>
12451 !! end
12452
12453 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12454 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12455 !! test
12456 Image with multiple attributes from the same template
12457 !! wikitext
12458 [[File:Foobar.jpg|{{image_attribs}}]]
12459 !! html/php
12460 <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>
12461
12462 !! html/parsoid
12463 <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>
12464 !! end
12465
12466 !! test
12467 Image with link tails
12468 !! options
12469 thumbsize=220
12470 !! wikitext
12471 123[[File:Foobar.jpg]]456
12472 123[[File:Foobar.jpg|right]]456
12473 123[[File:Foobar.jpg|thumb]]456
12474 !! html/php
12475 <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
12476 </p>
12477 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
12478 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
12479
12480 !! html/php+tidy
12481 <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>
12482 <p>123</p>
12483 <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>
12484 <p>456 123</p>
12485 <div class="thumb tright">
12486 <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>
12487 <div class="thumbcaption">
12488 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12489 </div>
12490 </div>
12491 </div>
12492 <p>456</p>
12493 !! html/parsoid
12494 <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>
12495 <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>
12496 <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>
12497 !! end
12498
12499 !! test
12500 Image with multiple captions -- only last one is accepted
12501 !! wikitext
12502 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12503 !! html/php
12504 <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>
12505
12506 !! html/parsoid
12507 <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>
12508 !! end
12509
12510 !! test
12511 Image with multiple widths -- use last
12512 !! wikitext
12513 [[File:Foobar.jpg|200px|300px|caption]]
12514 !! html/php
12515 <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>
12516 </p>
12517 !! html/parsoid
12518 <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>
12519 !! end
12520
12521 !! test
12522 Image with multiple alignments -- use first (bug 48664)
12523 !! options
12524 thumbsize=220
12525 !! wikitext
12526 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12527
12528 [[File:Foobar.jpg|middle|text-top|caption]]
12529 !! html/php
12530 <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>
12531 <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>
12532 </p>
12533 !! html/parsoid
12534 <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>
12535 <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>
12536 !! end
12537
12538 !! test
12539 Image with width attribute at different positions
12540 !! wikitext
12541 [[File:Foobar.jpg|200px|right|Caption]]
12542 [[File:Foobar.jpg|right|200px|Caption]]
12543 [[File:Foobar.jpg|right|Caption|200px]]
12544 !! html/php
12545 <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>
12546 <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>
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
12549 !! html/parsoid
12550 <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>
12551 <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>
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 !! end
12554
12555 # a sad bit of backward-compatibility
12556 !! test
12557 Image with size specified with pxpx (bug 13500, 51628)
12558 !! options
12559 parsoid=wt2html,wt2wt,html2html
12560 !! wikitext
12561 [[File:Foobar.jpg|20pxpx]]
12562 [[File:Foobar.jpg|200x20pxpx]]
12563 !! html/php
12564 <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>
12565 <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>
12566 </p>
12567 !! html/parsoid
12568 <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>
12569 !! end
12570
12571 !! test
12572 Image with link parameter, wiki target
12573 !! wikitext
12574 [[File:Foobar.jpg|link=Main Page]]
12575 !! html/php
12576 <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>
12577 </p>
12578 !! html/parsoid
12579 <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>
12580 !! end
12581
12582 # parsoid bug 49293 (part 1)
12583 !! test
12584 Image with link parameter, URL target
12585 !! wikitext
12586 [[File:Foobar.jpg|link=http://example.com/]]
12587 !! html/php
12588 <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>
12589 </p>
12590 !! html/parsoid
12591 <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>
12592 !! end
12593
12594 # parsoid bug 49293 (part 2)
12595 !! test
12596 Image with link parameter, protocol-less URL target
12597 !! wikitext
12598 [[File:Foobar.jpg|link=//example.com/]]
12599 !! html/php
12600 <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>
12601 </p>
12602 !! html/parsoid
12603 <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>
12604 !! end
12605
12606 !! test
12607 Image with link parameter, wgExternalLinkTarget
12608 !! wikitext
12609 [[Image:foobar.jpg|link=http://example.com/]]
12610 !! config
12611 wgExternalLinkTarget='foobar'
12612 !! html
12613 <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>
12614 </p>
12615 !! end
12616
12617 !! test
12618 Image with link parameter, wgNoFollowLinks set to false
12619 !! wikitext
12620 [[Image:foobar.jpg|link=http://example.com/]]
12621 !! config
12622 wgNoFollowLinks=false
12623 !! html
12624 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12625 </p>
12626 !! end
12627
12628 !! test
12629 Image with link parameter, wgNoFollowDomainExceptions
12630 !! wikitext
12631 [[Image:foobar.jpg|link=http://example.com/]]
12632 !! config
12633 wgNoFollowDomainExceptions='example.com'
12634 !! html
12635 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12636 </p>
12637 !! end
12638
12639 !! test
12640 Image with link parameter, wgExternalLinkTarget, unnamed parameter
12641 !! wikitext
12642 [[Image:foobar.jpg|link=http://example.com/|Title]]
12643 !! config
12644 wgExternalLinkTarget='foobar'
12645 !! html
12646 <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>
12647 </p>
12648 !! end
12649
12650 !! test
12651 Image with empty link parameter
12652 !! wikitext
12653 [[File:Foobar.jpg|link=]]
12654 !! html/php
12655 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
12656 </p>
12657 !! html/parsoid
12658 <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>
12659 !! end
12660
12661 !! test
12662 Image with link parameter (wiki target) and unnamed parameter
12663 !! wikitext
12664 [[File:Foobar.jpg|link=Main_Page|Title]]
12665 !! html/php
12666 <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>
12667 </p>
12668 !! html/parsoid
12669 <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>
12670 !! end
12671
12672 !! test
12673 Image with link parameter (URL target) and unnamed parameter
12674 !! wikitext
12675 [[File:Foobar.jpg|link=http://example.com/|Title]]
12676 !! html/php
12677 <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>
12678 </p>
12679 !! html/parsoid
12680 <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>
12681 !! end
12682
12683 !! test
12684 Thumbnail image with link parameter
12685 !! options
12686 thumbsize=220
12687 parsoid=wt2html,wt2wt,html2html
12688 !! wikitext
12689 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
12690 !! html/php
12691 <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>
12692
12693 !! html/parsoid
12694 <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>
12695 !! end
12696
12697 !! test
12698 Manually-specified thumbnail image
12699 !! options
12700 thumbsize=220
12701 !! wikitext
12702 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
12703 !! html/php
12704 <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>
12705
12706 !! html/parsoid
12707 <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>
12708 !! end
12709
12710 !! test
12711 Manually-specified thumbnail image with explicit link to wiki page
12712 !! options
12713 thumbsize=220
12714 parsoid=wt2html,wt2wt,html2html
12715 !! wikitext
12716 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
12717 !! html/php
12718 <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>
12719
12720 !! html/parsoid
12721 <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>
12722 !! end
12723
12724 !! test
12725 Manually-specified thumbnail image with explicit link to url
12726 !! options
12727 thumbsize=220
12728 parsoid=wt2html,wt2wt,html2html
12729 !! wikitext
12730 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
12731 !! html/php
12732 <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>
12733
12734 !! html/parsoid
12735 <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>
12736 !! end
12737
12738 !! test
12739 Manually-specified thumbnail image with explicit no link
12740 !! options
12741 thumbsize=220
12742 parsoid=wt2html,wt2wt,html2html
12743 !! wikitext
12744 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
12745 !! html/php
12746 <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>
12747
12748 !! html/parsoid
12749 <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>
12750 !! end
12751
12752 !! test
12753 Manually-specified thumbnail image with explicit link and alt text
12754 !! options
12755 thumbsize=220
12756 parsoid=wt2html,wt2wt,html2html
12757 !! wikitext
12758 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
12759 !! html/php
12760 <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>
12761
12762 !! html/parsoid
12763 <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>
12764 !! end
12765
12766 !! test
12767 Image with frame and link
12768 !! options
12769 parsoid=wt2html,wt2wt,html2html
12770 !! wikitext
12771 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
12772 !! html/php
12773 <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>
12774
12775 !! html/parsoid
12776 <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>
12777 !! end
12778
12779 !! test
12780 Image with frame and link and explicit alt
12781 !! options
12782 parsoid=wt2html,wt2wt,html2html
12783 !! wikitext
12784 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
12785 !! html/php
12786 <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>
12787
12788 !! html/parsoid
12789 <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>
12790 !! end
12791
12792 !! test
12793 Image with wiki markup in implicit alt
12794 !! options
12795 parsoid=wt2html,wt2wt,html2html
12796 !! wikitext
12797 [[Image:Foobar.jpg|testing '''bold''' in alt]]
12798
12799 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
12800 !! html/php
12801 <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>
12802 </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>
12803 </p>
12804 !! html/parsoid
12805 <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>
12806 <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>
12807 !! end
12808
12809 !! test
12810 Alt image option should handle most kinds of wikitext without barfing
12811 !! wikitext
12812 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
12813 !! html/php
12814 <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>
12815
12816 !! html/parsoid
12817 <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>
12818 !! end
12819
12820 ###################
12821 # Conflicting image format options.
12822 # First option specified should 'win'.
12823 # All three cases in each test should be identical.
12824
12825 !! test
12826 Image with 'frameless' first.
12827 !! options
12828 parsoid=wt2html,wt2wt,html2html
12829 !! wikitext
12830 [[File:Foobar.jpg|frameless|caption]]
12831
12832 [[File:Foobar.jpg|frameless|frame|caption]]
12833
12834 [[File:Foobar.jpg|frameless|thumb|caption]]
12835 !! html/php
12836 <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>
12837 </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>
12838 </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>
12839 </p>
12840 !! html/parsoid
12841 <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>
12842 <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>
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 !! end
12845
12846 !! test
12847 Image with 'frame' first.
12848 !! options
12849 parsoid=wt2html,wt2wt,html2html
12850 !! wikitext
12851 [[File:Foobar.jpg|frame|caption]]
12852 [[File:Foobar.jpg|frame|frameless|caption]]
12853 [[File:Foobar.jpg|frame|thumb|caption]]
12854 !! html/php
12855 <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>
12856 <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>
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
12859 !! html/parsoid
12860 <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>
12861 <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>
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 !! end
12864
12865 !! test
12866 Image with 'thumb' first.
12867 !! options
12868 parsoid=wt2html,wt2wt,html2html
12869 !! wikitext
12870 [[File:Foobar.jpg|thumb|caption]]
12871 [[File:Foobar.jpg|thumb|frameless|caption]]
12872 [[File:Foobar.jpg|thumb|frame|caption]]
12873 !! html/php
12874 <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>
12875 <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>
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
12878 !! html/parsoid
12879 <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>
12880 <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>
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 !! end
12883
12884 ###################
12885 # Image sizing.
12886 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
12887 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
12888 # Foobar has actual size of 1941x220
12889 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
12890 # a scalable format.
12891 # 2. Framed images always ignore size options; always render at default size.
12892 # 3. "Unspecified format" and border are the only types which can be
12893 # enlarged.
12894
12895 !! test
12896 Image: "unspecified format" and border enlarge
12897 !! options
12898 parsoid=wt2html,wt2wt,html2html
12899 !! wikitext
12900 [[File:Foobar.jpg|2000px]]
12901
12902 [[File:Foobar.jpg|border|2000px]]
12903 !! html/php
12904 <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>
12905 </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>
12906 </p>
12907 !! html/parsoid
12908 <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>
12909 <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>
12910 !! end
12911
12912 !! test
12913 Image: "unspecified format" and border reduce
12914 !! options
12915 parsoid=wt2html,wt2wt,html2html
12916 !! wikitext
12917 [[File:Foobar.jpg|1000px]]
12918
12919 [[File:Foobar.jpg|border|1000px]]
12920 !! html/php
12921 <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>
12922 </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>
12923 </p>
12924 !! html/parsoid
12925 <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>
12926 <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>
12927 !! end
12928
12929 !! test
12930 Image: thumbs reduce
12931 !! options
12932 parsoid=wt2html,wt2wt,html2html
12933 !! wikitext
12934 [[File:Foobar.jpg|thumb|50px]]
12935 !! html/php
12936 <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>
12937
12938 !! html/parsoid
12939 <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>
12940 !! end
12941
12942 !! test
12943 Image: bitmap thumbs can't be enlarged past original size, but vector can.
12944 !! options
12945 parsoid=wt2html,wt2wt,html2html
12946 !! wikitext
12947 [[File:Foobar.jpg|thumb|2000px]]
12948
12949 [[File:Foobar.svg|thumb|2000px]]
12950 !! html/php
12951 <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>
12952 <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>
12953
12954 !! html/parsoid
12955 <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>
12956 <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>
12957 !! end
12958
12959 !! test
12960 Image: frameless can reduce in size
12961 !! options
12962 parsoid=wt2html,wt2wt,html2html
12963 !! wikitext
12964 [[File:Foobar.jpg|frameless|50px]]
12965 !! html/php
12966 <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>
12967 </p>
12968 !! html/parsoid
12969 <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>
12970 !! end
12971
12972 !! test
12973 Image: bitmap frameless can't be enlarged past original size, but vector can
12974 !! options
12975 parsoid=wt2html,wt2wt,html2html
12976 !! wikitext
12977 [[File:Foobar.jpg|frameless|2000px]]
12978
12979 [[File:Foobar.svg|frameless|2000px]]
12980 !! html/php
12981 <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>
12982 </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>
12983 </p>
12984 !! html/parsoid
12985 <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>
12986 <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>
12987 !! end
12988
12989 !! test
12990 Image: framed images are always unscaled.
12991 !! options
12992 parsoid=wt2html,wt2wt,html2html
12993 !! wikitext
12994 [[File:Foobar.jpg|frame]]
12995
12996 [[File:Foobar.jpg|frame|50px]]
12997
12998 [[File:Foobar.jpg|frame|50x50px]]
12999
13000 [[File:Foobar.jpg|frame|2000px]]
13001 !! html/php
13002 <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>
13003 <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>
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
13007 !! html/parsoid
13008 <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>
13009 <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>
13010 <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>
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 !! end
13013
13014 ###################
13015
13016 !! test
13017 Link to image page- image page normally doesn't exists, hence edit link
13018 Add test with existing image page
13019 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13020 !! wikitext
13021 [[:Image:test]]
13022 !! html
13023 <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>
13024 </p>
13025 !! end
13026
13027 !! test
13028 bug 18784 Link to non-existent image page with caption should use caption as link text
13029 !! wikitext
13030 [[:Image:test|caption]]
13031 !! html
13032 <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>
13033 </p>
13034 !! end
13035
13036 !! test
13037 Frameless image caption with a free URL
13038 !! wikitext
13039 [[File:Foobar.jpg|http://example.com]]
13040 !! html/php
13041 <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>
13042 </p>
13043 !! html/parsoid
13044 <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>
13045 !! end
13046
13047 !! test
13048 Thumbnail image caption with a free URL
13049 !! options
13050 thumbsize=220
13051 !! wikitext
13052 [[File:Foobar.jpg|thumb|http://example.com]]
13053 !! html/php
13054 <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>
13055
13056 !! html/parsoid
13057 <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>
13058 !! end
13059
13060 !! test
13061 Thumbnail image caption with a free URL and explicit alt
13062 !! options
13063 thumbsize=220
13064 parsoid=wt2html,wt2wt,html2html
13065 !! wikitext
13066 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13067 !! html/php
13068 <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>
13069
13070 !! html/parsoid
13071 <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>
13072 !! end
13073
13074 !! test
13075 SVG thumbnails with no language set
13076 !! options
13077 !! wikitext
13078 [[File:Foobar.svg|thumb|caption]]
13079 !! html/php
13080 <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>
13081
13082 !! html/parsoid
13083 <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>
13084 !! end
13085
13086 !! test
13087 SVG thumbnails with language de
13088 !! options
13089 parsoid=wt2html,wt2wt,html2html
13090 !! wikitext
13091 [[File:Foobar.svg|thumb|caption|lang=de]]
13092 !! html/php
13093 <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>
13094
13095 !! html/parsoid
13096 <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>
13097 !! end
13098
13099 !! test
13100 SVG thumbnails with invalid language code
13101 !! options
13102 parsoid=wt2html,wt2wt,html2html
13103 !! wikitext
13104 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13105 !! html/php
13106 <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>
13107
13108 !! html/parsoid
13109 <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>
13110 !! end
13111
13112 !! test
13113 BUG 1887: A ISBN with a thumbnail
13114 !! wikitext
13115 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13116 !! html/php
13117 <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>
13118
13119 !! html/parsoid
13120 <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>
13121 !! end
13122
13123 !! test
13124 BUG 1887: A RFC with a thumbnail
13125 !! wikitext
13126 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13127 !! html/php
13128 <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>
13129
13130 !! html/parsoid
13131 <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>
13132 !! end
13133
13134 !! test
13135 BUG 1887: A mailto link with a thumbnail
13136 !! wikitext
13137 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13138 !! html/php
13139 <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>
13140
13141 !! html/parsoid
13142 <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>
13143 !! end
13144
13145 # Pending resolution to bug 368
13146 !! test
13147 BUG 648: Frameless image caption with a link
13148 !! wikitext
13149 [[File:Foobar.jpg|text with a [[link]] in it]]
13150 !! html/php
13151 <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>
13152 </p>
13153 !! html/parsoid
13154 <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>
13155 !! end
13156
13157 !! test
13158 BUG 648: Frameless image caption with a link (suffix)
13159 !! wikitext
13160 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13161 !! html/php
13162 <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>
13163 </p>
13164 !! html/parsoid
13165 <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>
13166 !! end
13167
13168 !! test
13169 BUG 648: Frameless image caption with an interwiki link
13170 !! wikitext
13171 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13172 !! html/php
13173 <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>
13174 </p>
13175 !! html/parsoid
13176 <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>
13177 !! end
13178
13179 !! test
13180 BUG 648: Frameless image caption with a piped interwiki link
13181 !! wikitext
13182 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13183 !! html/php
13184 <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>
13185 </p>
13186 !! html/parsoid
13187 <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>
13188 !! end
13189
13190 !! test
13191 Escape HTML special chars in image alt text
13192 !! wikitext
13193 [[File:Foobar.jpg|& < > "]]
13194 !! html/php
13195 <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>
13196 </p>
13197 !! html/parsoid
13198 <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>
13199 !! end
13200
13201 !! test
13202 BUG 499: Alt text should have &#1234;, not &amp;1234;
13203 !! wikitext
13204 [[File:Foobar.jpg|&#9792;]]
13205 !! html/php
13206 <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>
13207 </p>
13208 !! html/parsoid
13209 <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>
13210 !! end
13211
13212 !! test
13213 Broken image caption with link
13214 !! options
13215 parsoid=wt2html,wt2wt,html2html
13216 !! wikitext
13217 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13218 !! html/php
13219 <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.
13220 </p>
13221 !! html/parsoid
13222 <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>
13223 !! end
13224
13225 !! test
13226 Image caption containing another image
13227 !! wikitext
13228 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13229 !! html/php
13230 <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>
13231
13232 !! html/parsoid
13233 <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>
13234 !! end
13235
13236 !! test
13237 Image: caption containing a newline
13238 !! wikitext
13239 [[File:Foobar.jpg|This
13240 *is some text]]
13241 !! html/php
13242 <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>
13243 </p>
13244 !! html/parsoid
13245 <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>
13246 !!end
13247
13248 !!test
13249 Image: caption containing leading space
13250 (The leading space should not trigger nowiki escaping in wt2wt mode)
13251 !! wikitext
13252 [[File:Foobar.jpg|thumb| bar]]
13253 !! html/php
13254 <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>
13255
13256 !! html/parsoid
13257 <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>
13258 !!end
13259
13260 !! test
13261 Image: caption containing a table
13262 !! options
13263 parsoid=wt2html,wt2wt,html2html
13264 !! wikitext
13265 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13266 {|
13267 ! Foo !! Bar
13268 |-
13269 | Foo1 || Bar1
13270 |}
13271 and some more text.]]
13272 !! html/php
13273 <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>
13274
13275 !! html/parsoid
13276 <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
13277 <table>
13278 <tbody>
13279 <tr><th>Foo </th><th>Bar</th></tr>
13280 <tr>
13281 <td>Foo1 </td>
13282 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13283 !! end
13284
13285 !! test
13286 Bug 3090: External links other than http: in image captions
13287 !! wikitext
13288 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13289 !! html/php
13290 <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>
13291
13292 !! html/parsoid
13293 <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>
13294 !! end
13295
13296 !! test
13297 Custom class
13298 !! options
13299 parsoid=wt2html,wt2wt,html2html
13300 !! wikitext
13301 [[Image:foobar.jpg|a|class=b]]
13302 !! html/php
13303 <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>
13304 </p>
13305 !! html/parsoid
13306 <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>
13307 !! end
13308
13309 !! test
13310 Localized image handling (1).
13311 !! options
13312 parsoid=wt2html,wt2wt,html2html
13313 language=es
13314 !! wikitext
13315 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13316 !! html/php
13317 <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>
13318
13319 !! html/parsoid
13320 <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>
13321 !! end
13322
13323 !! test
13324 Localized image handling (2).
13325 !! options
13326 thumbsize=220
13327 parsoid=wt2html,wt2wt,html2html
13328 language=es
13329 !! wikitext
13330 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13331 !! html/php
13332 <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>
13333
13334 !! html/parsoid
13335 <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>
13336 !! end
13337
13338 !! test
13339 "border", "frameless" and "class" attributes on an image.
13340 !! options
13341 thumbsize=220
13342 parsoid=wt2html,wt2wt,html2html
13343 !! wikitext
13344 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13345 !! html/php
13346 <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>
13347 </p>
13348 !! html/parsoid
13349 <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>
13350 !! end
13351
13352 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13353 !! test
13354 Invalid image attributes (bug 62500)
13355 !! options
13356 thumbsize=220
13357 parsoid=wt2html,wt2wt,html2html
13358 !! wikitext
13359 [[File:Foobar.jpg|thumb|float|left|caption]]
13360
13361 [[File:Foobar.jpg|thumb|righ|caption]]
13362
13363 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13364 !! html/php
13365 <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>
13366 <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>
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
13369 !! html/parsoid
13370 <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>
13371 <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>
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 !! end
13374
13375 !! article
13376 File:Barfoo.jpg
13377 !! text
13378 #REDIRECT [[File:Barfoo.jpg]]
13379 !! endarticle
13380
13381 # FIXME: Parsoid should run this test -- but we'd need to teach the
13382 # mockAPI about the redirected Barfoo.jpg image.
13383 !! test
13384 Redirected image
13385 !! wikitext
13386 [[Image:Barfoo.jpg]]
13387 !! html/php
13388 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13389 </p>
13390 !! end
13391
13392 !! test
13393 Missing image with uploads disabled
13394 !! options
13395 wgEnableUploads=0
13396 !! wikitext
13397 [[File:Foobaz.jpg]]
13398 !! html/php
13399 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13400 </p>
13401 !! html/parsoid
13402 <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>
13403 !! end
13404
13405 # Parsoid-specific testing for images
13406 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13407 # Currently imperfect due to a flaw in the Parsoid testrunner
13408 # Work in progress
13409 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13410 # image tests.
13411
13412 !! test
13413 Parsoid-specific image handling - simple image with size and middle alignment
13414 !! wikitext
13415 [[File:Foobar.jpg|middle|50px]]
13416 !! html/parsoid
13417 <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>
13418 !! end
13419
13420 !! test
13421 Parsoid-specific image handling - simple image with size, middle alignment,
13422 non-standard namespace alias
13423 !! options
13424 parsoid=wt2wt,wt2html,html2html
13425 !! wikitext
13426 [[Image:Foobar.jpg|middle|50px]]
13427 !! html/parsoid
13428 <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>
13429 !! end
13430
13431 !! test
13432 Parsoid-specific image handling - simple image with size and middle alignment
13433 (existing content)
13434 !! wikitext
13435 [[File:Foobar.jpg|50px|middle]]
13436 !! html/parsoid
13437 <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>
13438 !! end
13439
13440 !! test
13441 Parsoid-specific image handling - simple image with size and middle alignment
13442 and non-standard namespace name
13443 !! options
13444 parsoid=wt2html,wt2wt,html2html
13445 !! wikitext
13446 [[Image:Foobar.jpg|50px|middle]]
13447 !! html/parsoid
13448 <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>
13449 !! end
13450
13451 !! test
13452 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13453 !! wikitext
13454 [[File:Foobar.jpg|500x10px|baseline|caption]]
13455 !! html/parsoid
13456 <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>
13457 !! end
13458
13459 !! test
13460 Parsoid-specific image handling - simple image with border and size spec
13461 !! wikitext
13462 [[File:Foobar.jpg|50px|border|caption]]
13463 !! html/parsoid
13464 <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>
13465 !! end
13466
13467 !! test
13468 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13469 !! wikitext
13470 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13471 !! html/parsoid
13472 <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>
13473 !! end
13474
13475 !! test
13476 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13477 (existing content)
13478 !! wikitext
13479 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13480 !! html/parsoid
13481 <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>
13482 !! end
13483
13484 !! test
13485 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13486 !! wikitext
13487 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13488 !! html/parsoid
13489 <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>
13490 !! end
13491
13492 !! test
13493 Parsoid-specific image handling - thumbnail with specific size, halign,
13494 valign, and caption (existing content)
13495 !! wikitext
13496 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13497 !! html/parsoid
13498 <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>
13499 !! end
13500
13501 !! test
13502 Parsoid-specific image handling - framed image with specific size and caption
13503 (size is ignored)
13504 !! options
13505 parsoid=wt2html,wt2wt,html2html
13506 !! wikitext
13507 [[File:Foobar.jpg|frame|500x50px|caption]]
13508 !! html/parsoid
13509 <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>
13510 !! end
13511
13512 !! test
13513 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13514 (size is ignored)
13515 !! options
13516 parsoid=wt2html,wt2wt,html2html
13517 !! wikitext
13518 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13519 !! html/parsoid
13520 <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>
13521 !! end
13522
13523 !! test
13524 Parsoid-specific image handling - frameless image with specific size, border, and caption
13525 !! wikitext
13526 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
13527 !! html/parsoid
13528 <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>
13529 !! end
13530
13531 !! test
13532 Parsoid-specific image handling - simple image with a formatted caption
13533 !! wikitext
13534 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
13535 !! html/parsoid
13536 <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>
13537 !! end
13538
13539 !! test
13540 Parsoid-specific image handling - caption with a template in it
13541 !! wikitext
13542 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
13543 !! html/parsoid
13544 <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>
13545 !! end
13546
13547 !! test
13548 Parsoid-specific image handling - caption with unbalanced tags in it
13549 !! options
13550 parsoid=wt2html,wt2wt,html2html
13551 !! wikitext
13552 foo
13553 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
13554 bar
13555 !! html/parsoid
13556 <p>foo</p>
13557 <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>
13558 <p>bar</p>
13559 !! end
13560
13561 !! test
13562 Parsoid-specific image handling - empty caption (1)
13563 !! options
13564 parsoid=wt2html,wt2wt
13565 !! wikitext
13566 [[File:Foobar.jpg|thumb|]]
13567 !! html/parsoid
13568 <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>
13569 !! end
13570
13571 # empty captions don't get serialized unless we're in the "round trip" case
13572 !! test
13573 Parsoid-specific image handling - empty caption (2)
13574 !! options
13575 parsoid=html2wt
13576 !! html/parsoid
13577 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13578 <a href="./File:Foobar.jpg">
13579 <img resource="./File:Foobar.jpg"
13580 src="//example.com/images/3/3a/Foobar.jpg"
13581 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
13582 height="25" width="220"/>
13583 </a>
13584 <figcaption></figcaption>
13585 </figure>
13586 !! wikitext
13587 [[File:Foobar.jpg|thumb]]
13588 !! end
13589
13590 !! test
13591 Parsoid-specific image handling - whitespace caption
13592 !! wikitext
13593 [[File:Foobar.jpg|thumb| ]]
13594 !! html/parsoid
13595 <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>
13596 !! end
13597
13598 !! test
13599 Parsoid-specific image handling - lang option
13600 !! wikitext
13601 foo
13602 [[File:Foobar.svg|lang=de|caption]]
13603 bar
13604 !! html/parsoid
13605 <p>foo
13606 <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>
13607 bar</p>
13608 !! end
13609
13610
13611 ###
13612 ### Subpages
13613 ###
13614 !! article
13615 Subpage test/subpage
13616 !! text
13617 foo
13618 !! endarticle
13619
13620 !! test
13621 Subpage link
13622 !! options
13623 subpage title=[[Subpage test]]
13624 !! wikitext
13625 [[/subpage]]
13626 !! html
13627 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
13628 </p>
13629 !! end
13630
13631 !! test
13632 Subpage noslash link
13633 !! options
13634 subpage title=[[Subpage test]]
13635 !! wikitext
13636 [[/subpage/]]
13637 !! html
13638 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
13639 </p>
13640 !! end
13641
13642 !! article
13643 Subpage test/1/2/subpage
13644 !! text
13645 blah
13646 !! endarticle
13647
13648 !! test
13649 Relative subpage noslash link
13650 !! options
13651 parsoid=wt2wt,wt2html,html2html
13652 subpage title=[[Subpage test/1/2/3/4]]
13653 !! wikitext
13654 [[../../subpage/]]
13655
13656 [[../../subpage]]
13657 !! html/php
13658 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
13659 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
13660 </p>
13661 !! html/parsoid
13662 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
13663 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
13664 !! end
13665
13666 !! test
13667 Parsoid: dot-slash prefixed wikilinks
13668 !! wikitext
13669 [[./foo]]
13670
13671 [[././bar]]
13672
13673 [[././baz/]]
13674 !! html/php
13675 <p>[[./foo]]
13676 </p><p>[[././bar]]
13677 </p><p>[[././baz/]]
13678 </p>
13679 !! html/parsoid
13680 <p>[[./foo]]
13681 </p><p>[[././bar]]
13682 </p><p>[[././baz/]]
13683 </p>
13684 !! end
13685
13686 !! test
13687 Render invalid page names as plain text (bug 51090)
13688 !! wikitext
13689 [[./../foo|bar]]
13690 [[foo�|bar]]
13691 [[foo/.|bar]]
13692 [[foo/..|bar]]
13693 [[foo~~~bar]]
13694 [[foo>bar]]
13695 [[foo[bar]]
13696 [[.]]
13697 [[..]]
13698 [[foo././bar]]
13699
13700 [[{{echo|./../foo}}|bar]]
13701 [[{{echo|foo/.}}|bar]]
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 !!html/php
13712 <p>[[./../foo|bar]]
13713 [[foo�|bar]]
13714 [[foo/.|bar]]
13715 [[foo/..|bar]]
13716 [[foo~~~bar]]
13717 [[foo&gt;bar]]
13718 [[foo[bar]]
13719 [[.]]
13720 [[..]]
13721 [[foo././bar]]
13722 </p><p>[[./../foo|bar]]
13723 [[foo/.|bar]]
13724 [[foo/..|bar]]
13725 [[foo~~~~bar]]
13726 [[foo&gt;bar]]
13727 [[foo././bar]]
13728 [[foo{bar]]
13729 [[foo}bar]]
13730 [[foo[bar]]
13731 [[foo]bar]]
13732 [[foo&lt;bar]]
13733 </p>
13734 !!html/parsoid
13735 <p>[[./../foo|bar]]
13736 [[foo�|bar]]
13737 [[foo/.|bar]]
13738 [[foo/..|bar]]
13739 [[foo~~~bar]]
13740 [[foo>bar]]
13741 [[foo[bar]]
13742 [[.]]
13743 [[..]]
13744 [[foo././bar]]</p>
13745
13746 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
13747 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
13748 [[<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~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
13750 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
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&lt;bar"}},"i":0}}]}'>foo&lt;bar</span>]]</p>
13757 !!end
13758
13759 !! test
13760 Disabled subpages
13761 !! wikitext
13762 [[/subpage]]
13763 !! html
13764 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
13765 </p>
13766 !! end
13767
13768 !! test
13769 BUG 561: {{/Subpage}}
13770 !! options
13771 subpage title=[[Page]]
13772 !! wikitext
13773 {{/Subpage}}
13774 !! html
13775 <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>
13776 </p>
13777 !! end
13778
13779 ###
13780 ### Categories
13781 ###
13782 !! article
13783 Category:MediaWiki User's Guide
13784 !! text
13785 blah
13786 !! endarticle
13787
13788 !! test
13789 Link to category
13790 !! wikitext
13791 [[:Category:MediaWiki User's Guide]]
13792 !! html
13793 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
13794 </p>
13795 !! end
13796
13797 !! test
13798 Simple category
13799 !! options
13800 cat
13801 !! wikitext
13802 [[Category:MediaWiki User's Guide]]
13803 !! html
13804 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13805 !! end
13806
13807 !! test
13808 PAGESINCATEGORY invalid title fatal (r33546 fix)
13809 !! wikitext
13810 {{PAGESINCATEGORY:<bogus>}}
13811 !! html
13812 <p>0
13813 </p>
13814 !! end
13815
13816 !! test
13817 Category with different sort key
13818 !! options
13819 cat
13820 !! wikitext
13821 [[Category:MediaWiki User's Guide|Foo]]
13822 !! html
13823 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13824 !! end
13825
13826 !! test
13827 Category with identical sort key
13828 !! options
13829 cat
13830 !! wikitext
13831 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13832 !! html
13833 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13834 !! end
13835
13836 !! test
13837 Category with empty sort key
13838 !! options
13839 cat
13840 pst
13841 !! wikitext
13842 [[Category:MediaWiki User's Guide|]]
13843 !! html
13844 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13845 !! end
13846
13847 !! test
13848 Category with empty sort key and parentheses
13849 !! options
13850 cat
13851 pst
13852 !! wikitext
13853 [[Category:Foo (bar)|]]
13854 !! html
13855 [[Category:Foo (bar)|Foo]]
13856 !! end
13857
13858 !! test
13859 Category with link tail
13860 !! options
13861 cat
13862 pst
13863 !! wikitext
13864 123[[Category:Foo]]456
13865 !! html
13866 123[[Category:Foo]]456
13867 !! end
13868
13869 !! test
13870 Category with template
13871 !! options
13872 cat
13873 pst
13874 !! wikitext
13875 [[Category:{{echo|Foo}}]]
13876 !! html
13877 [[Category:{{echo|Foo}}]]
13878 !! end
13879
13880 !! test
13881 Category with template in sort key
13882 !! options
13883 cat
13884 pst
13885 !! wikitext
13886 [[Category:Foo|{{echo|Bar}}]]
13887 !! html
13888 [[Category:Foo|{{echo|Bar}}]]
13889 !! end
13890
13891 !! test
13892 Category with template in sort key and title
13893 !! options
13894 cat
13895 pst
13896 !! wikitext
13897 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13898 !! html
13899 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13900 !! end
13901
13902 !! test
13903 Category / paragraph interactions
13904 !! wikitext
13905 Foo [[Category:Baz]] Bar
13906
13907 Foo [[Category:Baz]]
13908 Bar
13909
13910 Foo
13911 [[Category:Baz]]
13912 Bar
13913
13914 Foo
13915 [[Category:Baz]] Bar
13916
13917 Foo
13918 [[Category:Baz]]
13919 [[Category:Baz]]
13920 [[Category:Baz]]
13921 Bar
13922
13923 [[Category:Baz]]
13924 [[Category:Baz]]
13925 [[Category:Baz]]
13926
13927 [[Category:Baz]]
13928 {{echo|[[Category:Baz]]}}
13929 [[Category:Baz]]
13930 !! html
13931 <p>Foo Bar
13932 </p><p>Foo
13933 Bar
13934 </p><p>Foo
13935 Bar
13936 </p><p>Foo Bar
13937 </p><p>Foo
13938 Bar
13939 </p>
13940 !! end
13941
13942 ## The whitespace on the empty line is part of the test. Please do not delete
13943 !! test
13944 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
13945 !! options
13946 parsoid=wt2html,wt2wt
13947 !! wikitext
13948 This
13949
13950 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
13951
13952 {{echo|[[Category:Foo]] and so should this!}}
13953 !! html
13954 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
13955 </p>
13956 !! html/parsoid
13957 <p>This
13958
13959 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
13960
13961 <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>
13962 !! end
13963
13964 ## Parsoid will not try to wt2wt this while preserving newlines because
13965 ## it suppresses excess newlines within list items -- and we don't want to
13966 ## introduce a special case just for categories, which is, in reality somewhat
13967 ## odd behavior -- categories are unlikely to be used in list items like this
13968 ## in top-level pages and are only likely to show up in template-generated
13969 ## list items where this RT-ing is a non-issue.
13970 ##
13971 ## The whitespace on the empty line is part of the test. Please do not delete
13972 !! test
13973 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
13974 !! options
13975 parsoid=wt2html
13976 !! wikitext
13977 * This
13978
13979 [[Category:Foo]] and this should be part of the same list item
13980 * So should this
13981
13982 {{echo|[[Category:Foo]] and this should be part of the same list item}}
13983 !! html
13984 <ul><li>This and this should be part of the same list item</li>
13985 <li>So should this and this should be part of the same list item</li></ul>
13986 !! html/parsoid
13987 <ul>
13988 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
13989 <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>
13990 </ul>
13991 !! end
13992
13993 ## Newlines and categories that follow the last item of a list
13994 ## are treated differently because this (list followed by categories)
13995 ## is an extremely common pattern on wikis.
13996 !! test
13997 3. Categories and newlines: newline suppression for last list item should RT properly
13998 !! wikitext
13999 * a
14000 * b
14001
14002 [[Category:Foo]]
14003
14004 [[Category:Bar]]
14005 [[Category:Baz]]
14006 !! html/parsoid
14007 <ul><li> a</li>
14008 <li> b</li></ul>
14009
14010 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14011
14012 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14013 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14014 !! end
14015
14016 !! test
14017 4. Categories and newlines: newline suppression for last list item should RT properly
14018 !! wikitext
14019 * a
14020 **** b
14021
14022 [[Category:Foo]]
14023 !! html/parsoid
14024 <ul><li> a
14025 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14026
14027 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14028 !! end
14029
14030 ## only wt2html for this to make sure the algo only applies to the rightmost path
14031 !! test
14032 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14033 !! options
14034 parsoid=wt2html
14035 !! wikitext
14036 * a
14037 ** b
14038 [[Category:Foo]]
14039 * c
14040 ** d
14041 [[Category:Foo]]
14042 !! html/parsoid
14043 <ul><li> a
14044 <ul><li> b
14045 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14046 <li> c
14047 <ul><li> d</li></ul></li></ul>
14048 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14049 !! end
14050
14051 !! test
14052 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14053 !! wikitext
14054 * a [[Category:Foo]]
14055 !! html/parsoid
14056 <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>
14057 !! end
14058
14059 # This test also demonstrates because of newline+category tunneling
14060 # through the list hander, template wrapping doesn't expand to the
14061 # containing list when the list item swallows the category.
14062 !! test
14063 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14064 !! wikitext
14065 * {{echo|a
14066 [[Category:Foo]]}}
14067 !! html/parsoid
14068 <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">
14069 </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>
14070 !! end
14071
14072 !! test
14073 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14074 !! wikitext
14075 * a
14076
14077 {{echo|[[Category:Foo]]
14078 [[Category:Bar]]}}
14079 [[Category:Baz]]
14080 !! html/parsoid
14081 <ul><li> a</li></ul>
14082
14083 <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">
14084 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14085 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14086 !! end
14087
14088 !! test
14089 Parsoid: Serialize link to category page with colon escape
14090 !! options
14091 parsoid
14092 !! wikitext
14093
14094 [[:Category:Foo]]
14095 [[:Category:Foo|Bar]]
14096 !! html
14097 <p>
14098 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
14099 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
14100 </p>
14101 !! end
14102
14103 # html2wt localizes the "Category" namespace.
14104 # XXX the <link> element needs an empty data-parsoid attribute, or
14105 # else the html2html test fails because spaces are inserted.
14106 !! test
14107 Link prefix/suffixes aren't applied to category links
14108 !! options
14109 parsoid=wt2html,wt2wt,html2html
14110 language=is
14111 !! wikitext
14112 x[[Category:Foo]]y
14113 !! html/php
14114 <p>xy
14115 </p>
14116 !! html/parsoid
14117 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14118 !! end
14119
14120 !! test
14121 Parsoid: Serialize link to file page with colon escape
14122 !! options
14123 parsoid
14124 !! wikitext
14125
14126 [[:File:Foo.png]]
14127 [[:File:Foo.png|Bar]]
14128 !! html
14129 <p>
14130 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14131 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14132 </p>
14133 !! end
14134
14135 !! test
14136 Parsoid: Serialize a genuine category link without colon escape
14137 !! options
14138 parsoid
14139 !! wikitext
14140 [[Category:Foo]]
14141 [[Category:Foo|Bar]]
14142 !! html
14143 <link rel="mw:PageProp/Category" href="Category:Foo">
14144 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
14145 !! end
14146
14147 !! test
14148 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14149 !! options
14150 parsoid=html2wt
14151 !! html
14152 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14153 !! wikitext
14154 [[Category:Toxine bactérienne]]
14155 !! end
14156
14157 !! test
14158 Parsoid: Defaultsort
14159 !! wikitext
14160 {{DEFAULTSORT:Foo}}
14161 !! html/parsoid
14162 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14163 !! end
14164
14165 !! test
14166 Parsoid: Defaultsort (template-generated)
14167 !! wikitext
14168 {{{{echo|DEFAULTSORT}}:Foo}}
14169 !! html/parsoid
14170 <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}}]}'/>
14171 !! end
14172
14173 ###
14174 ### Inter-language links
14175 ###
14176 !! test
14177 Interlanguage links
14178 !! options
14179 ill
14180 !! wikitext
14181 [[es:Alimento]]
14182 [[fr:Nourriture]]
14183 [[zh:食品]]
14184 !! html/php
14185 es:Alimento fr:Nourriture zh:食品
14186 !! html/parsoid
14187 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14188 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14189 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14190 !! end
14191
14192 !! test
14193 Duplicate interlanguage links (bug 24502)
14194 !! options
14195 ill
14196 !! wikitext
14197 [[es:1]]
14198 [[es:2]]
14199 [[fr:1]]
14200 [[fr:2]]
14201 !! html/php
14202 es:1 fr:1
14203 !! html/parsoid
14204 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14205 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14206 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14207 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14208 !! end
14209
14210 ###
14211 ### Sections
14212 ###
14213 !! test
14214 Basic section headings
14215 !! wikitext
14216 == Headline 1 ==
14217 Some text
14218
14219 ==Headline 2==
14220 More
14221 ===Smaller headline===
14222 Blah blah
14223 !! html
14224 <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>
14225 <p>Some text
14226 </p>
14227 <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>
14228 <p>More
14229 </p>
14230 <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>
14231 <p>Blah blah
14232 </p>
14233 !! end
14234
14235 !! test
14236 Section headings with TOC
14237 !! wikitext
14238 == Headline 1 ==
14239 === Subheadline 1 ===
14240 ===== Skipping a level =====
14241 ====== Skipping a level ======
14242
14243 == Headline 2 ==
14244 Some text
14245 ===Another headline===
14246 !! html
14247 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14248 <ul>
14249 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14250 <ul>
14251 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14252 <ul>
14253 <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>
14254 <ul>
14255 <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>
14256 </ul>
14257 </li>
14258 </ul>
14259 </li>
14260 </ul>
14261 </li>
14262 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14263 <ul>
14264 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14265 </ul>
14266 </li>
14267 </ul>
14268 </div>
14269
14270 <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>
14271 <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>
14272 <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>
14273 <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>
14274 <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>
14275 <p>Some text
14276 </p>
14277 <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>
14278
14279 !! end
14280
14281 !! test
14282 TOC anchors don't collide
14283 !! wikitext
14284 __FORCETOC__
14285 == Headline 2 ==
14286 == Headline ==
14287 == Headline 2 ==
14288 == Headline ==
14289 !! html/php
14290 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14291 <ul>
14292 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14293 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14294 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14295 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14296 </ul>
14297 </div>
14298
14299 <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>
14300 <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>
14301 <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>
14302 <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>
14303
14304 !! end
14305
14306 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14307 !! test
14308 Handling of sections up to level 6 and beyond
14309 !! wikitext
14310 = Level 1 Heading=
14311 == Level 2 Heading==
14312 === Level 3 Heading===
14313 ==== Level 4 Heading====
14314 ===== Level 5 Heading=====
14315 ====== Level 6 Heading======
14316 ======= Level 7 Heading=======
14317 ======== Level 8 Heading========
14318 ========= Level 9 Heading=========
14319 ========== Level 10 Heading==========
14320 !! html
14321 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14322 <ul>
14323 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14324 <ul>
14325 <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>
14326 <ul>
14327 <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>
14328 <ul>
14329 <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>
14330 <ul>
14331 <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>
14332 <ul>
14333 <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>
14334 <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>
14335 <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>
14336 <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>
14337 <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>
14338 </ul>
14339 </li>
14340 </ul>
14341 </li>
14342 </ul>
14343 </li>
14344 </ul>
14345 </li>
14346 </ul>
14347 </li>
14348 </ul>
14349 </div>
14350
14351 <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>
14352 <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>
14353 <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>
14354 <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>
14355 <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>
14356 <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>
14357 <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>
14358 <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>
14359 <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>
14360 <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>
14361
14362 !! end
14363
14364 !! test
14365 TOC regression (T11764)
14366 !! wikitext
14367 == title 1 ==
14368 === title 1.1 ===
14369 ==== title 1.1.1 ====
14370 === title 1.2 ===
14371 == title 2 ==
14372 === title 2.1 ===
14373 !! html
14374 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14375 <ul>
14376 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14377 <ul>
14378 <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>
14379 <ul>
14380 <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>
14381 </ul>
14382 </li>
14383 <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>
14384 </ul>
14385 </li>
14386 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14387 <ul>
14388 <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>
14389 </ul>
14390 </li>
14391 </ul>
14392 </div>
14393
14394 <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>
14395 <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>
14396 <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>
14397 <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>
14398 <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>
14399 <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>
14400
14401 !! end
14402
14403 !! test
14404 TOC for heading containing <span id="..."></span> (T96153)
14405 !! wikitext
14406 __FORCETOC__
14407 ==<span id="old-anchor"></span>New title==
14408 !! html/php
14409 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14410 <ul>
14411 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14412 </ul>
14413 </div>
14414
14415 <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>
14416
14417 !! end
14418
14419 !! test
14420 TOC with wgMaxTocLevel=3 (bug 6204)
14421 !! options
14422 wgMaxTocLevel=3
14423 !! wikitext
14424 == title 1 ==
14425 === title 1.1 ===
14426 ==== title 1.1.1 ====
14427 === title 1.2 ===
14428 == title 2 ==
14429 === title 2.1 ===
14430 !! html
14431 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14432 <ul>
14433 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14434 <ul>
14435 <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>
14436 <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>
14437 </ul>
14438 </li>
14439 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14440 <ul>
14441 <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>
14442 </ul>
14443 </li>
14444 </ul>
14445 </div>
14446
14447 <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>
14448 <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>
14449 <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>
14450 <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>
14451 <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>
14452 <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>
14453
14454 !! end
14455
14456 !! test
14457 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
14458 !! options
14459 wgMaxTocLevel=3
14460 !! wikitext
14461 ==Section 1==
14462 ===Section 1.1===
14463 ====Section 1.1.1====
14464 ====Section 1.1.1.1====
14465 ==Section 2==
14466 !! html
14467 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14468 <ul>
14469 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
14470 <ul>
14471 <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>
14472 </ul>
14473 </li>
14474 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
14475 </ul>
14476 </div>
14477
14478 <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>
14479 <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>
14480 <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>
14481 <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>
14482 <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>
14483
14484 !! end
14485
14486
14487 !! test
14488 Resolving duplicate section names
14489 !! wikitext
14490 == Foo bar ==
14491 == Foo bar ==
14492 !! html
14493 <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>
14494 <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>
14495
14496 !! end
14497
14498 !! test
14499 Resolving duplicate section names with differing case (bug 10721)
14500 !! wikitext
14501 == Foo bar ==
14502 == Foo Bar ==
14503 !! html
14504 <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>
14505 <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>
14506
14507 !! end
14508
14509 !! article
14510 Template:sections
14511 !! text
14512 ===Section 1===
14513 ==Section 2==
14514 !! endarticle
14515
14516 !! test
14517 Template with sections, __NOTOC__
14518 !! wikitext
14519 __NOTOC__
14520 ==Section 0==
14521 {{sections}}
14522 ==Section 4==
14523 !! html
14524 <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>
14525 <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>
14526 <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>
14527 <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>
14528
14529 !! end
14530
14531 !! test
14532 __NOEDITSECTION__ keyword
14533 !! wikitext
14534 __NOEDITSECTION__
14535 ==Section 1==
14536 ==Section 2==
14537 !! html
14538 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
14539 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
14540
14541 !! end
14542
14543 !! test
14544 Link inside a section heading
14545 !! wikitext
14546 ==Section with a [[Main Page|link]] in it==
14547 !! html
14548 <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>
14549
14550 !! end
14551
14552 !! test
14553 TOC regression (T14077)
14554 !! wikitext
14555 __TOC__
14556 == title 1 ==
14557 === title 1.1 ===
14558 == title 2 ==
14559 !! html
14560 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14561 <ul>
14562 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14563 <ul>
14564 <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>
14565 </ul>
14566 </li>
14567 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
14568 </ul>
14569 </div>
14570
14571 <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>
14572 <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>
14573 <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>
14574
14575 !! end
14576
14577 !! test
14578 BUG 1219 URL next to image (good)
14579 !! wikitext
14580 http://example.com [[File:Foobar.jpg]]
14581 !! html/php
14582 <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>
14583 </p>
14584 !! html/parsoid
14585 <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>
14586 !!end
14587
14588 !! test
14589 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
14590 !! wikitext
14591 ===
14592 The line above must have a trailing space!
14593 === <!--
14594 --> <!-- -->
14595 But just in case it doesn't...
14596 !! html
14597 <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>
14598 <p>The line above must have a trailing space!
14599 </p>
14600 <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>
14601 <p>But just in case it doesn't...
14602 </p>
14603 !! end
14604
14605 !! test
14606 Header with special characters (bug 25462)
14607 !! wikitext
14608 The tooltips shall not show entities to the user (ie. be double escaped)
14609
14610 == text > text ==
14611 section 1
14612
14613 == text < text ==
14614 section 2
14615
14616 == text & text ==
14617 section 3
14618
14619 == text ' text ==
14620 section 4
14621
14622 == text " text ==
14623 section 5
14624 !! html
14625 <p>The tooltips shall not show entities to the user (ie. be double escaped)
14626 </p>
14627 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14628 <ul>
14629 <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>
14630 <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>
14631 <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>
14632 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
14633 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
14634 </ul>
14635 </div>
14636
14637 <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>
14638 <p>section 1
14639 </p>
14640 <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>
14641 <p>section 2
14642 </p>
14643 <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>
14644 <p>section 3
14645 </p>
14646 <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>
14647 <p>section 4
14648 </p>
14649 <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>
14650 <p>section 5
14651 </p>
14652 !! end
14653
14654 !! test
14655 Header with space, plus and underscore as entity
14656 !! wikitext
14657 Id should not contain + for spaces
14658
14659 == Space between Text ==
14660 section 1
14661
14662 == Space-Entity&#32;between&#32;Text ==
14663 section 2
14664
14665 == Plus+between+Text ==
14666 section 3
14667
14668 == Plus-Entity&#43;between&#43;Text ==
14669 section 4
14670
14671 == Underscore_between_Text ==
14672 section 5
14673
14674 == Underscore-Entity&#95;between&#95;Text ==
14675 section 6
14676
14677 [[#Space between Text]]
14678 [[#Space-Entity&#32;between&#32;Text]]
14679 [[#Plus+between+Text]]
14680 [[#Plus-Entity&#43;between&#43;Text]]
14681 [[#Underscore_between_Text]]
14682 [[#Underscore-Entity&#95;between&#95;Text]]
14683 !! html
14684 <p>Id should not contain + for spaces
14685 </p>
14686 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14687 <ul>
14688 <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>
14689 <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>
14690 <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>
14691 <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>
14692 <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>
14693 <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>
14694 </ul>
14695 </div>
14696
14697 <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>
14698 <p>section 1
14699 </p>
14700 <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>
14701 <p>section 2
14702 </p>
14703 <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>
14704 <p>section 3
14705 </p>
14706 <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>
14707 <p>section 4
14708 </p>
14709 <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>
14710 <p>section 5
14711 </p>
14712 <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>
14713 <p>section 6
14714 </p><p><a href="#Space_between_Text">#Space between Text</a>
14715 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
14716 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
14717 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
14718 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
14719 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
14720 </p>
14721 !! end
14722
14723 !! test
14724 Headers with excess '=' characters
14725 (Are similar tests necessary beyond the 1st level?)
14726 !! wikitext
14727 =foo==
14728 ==foo=
14729 =''italic'' heading==
14730 ==''italic'' heading=
14731 !! html
14732 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14733 <ul>
14734 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
14735 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
14736 <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>
14737 <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>
14738 </ul>
14739 </div>
14740
14741 <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>
14742 <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>
14743 <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>
14744 <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>
14745
14746 !! end
14747
14748 !! test
14749 HTML headers vs TOC (bug 23393)
14750 (__NOEDITSECTION__ for clearer output, doesn't matter here)
14751 !! wikitext
14752 <h1>Header 1</h1>
14753 == Header 1.1 ==
14754 == Header 1.2 ==
14755
14756 <h1>Header 2
14757 </h1>
14758 == Header 2.1 ==
14759 == Header 2.2 ==
14760 __NOEDITSECTION__
14761 !! html
14762 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14763 <ul>
14764 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
14765 <ul>
14766 <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>
14767 <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>
14768 </ul>
14769 </li>
14770 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
14771 <ul>
14772 <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>
14773 <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>
14774 </ul>
14775 </li>
14776 </ul>
14777 </div>
14778
14779 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
14780 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
14781 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
14782 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
14783 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
14784 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
14785
14786 !! end
14787
14788 !! test
14789 Single-line or multiline-comments can follow headings
14790 !! options
14791 parsoid=wt2html,wt2wt
14792 !! wikitext
14793 ==foo==<!---->
14794 ==bar==<!--c1-->
14795 ==baz==<!--
14796 c2
14797 c3-->
14798 !! html
14799 <h2><span class="mw-headline" id="foo">foo</span></h2>
14800 <h2><span class="mw-headline" id="bar">bar</span></h2>
14801 <h2><span class="mw-headline" id="baz">baz</span></h2>
14802
14803 !! end
14804
14805 !! test
14806 BUG 1219 URL next to image (broken)
14807 !! wikitext
14808 http://example.com[[File:Foobar.jpg]]
14809 !! html/php
14810 <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>
14811 </p>
14812 !! html/parsoid
14813 <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>
14814 !!end
14815
14816 !! test
14817 Bug 1186 news: in the middle of text
14818 !! wikitext
14819 http://en.wikinews.org/wiki/Wikinews:Workplace
14820 !! html
14821 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
14822 </p>
14823 !!end
14824
14825
14826 !! test
14827 Namespaced link must have a title
14828 !! wikitext
14829 [[Project:]]
14830 !! html
14831 <p>[[Project:]]
14832 </p>
14833 !!end
14834
14835 !! test
14836 Namespaced link must have a title (bad fragment version)
14837 !! wikitext
14838 [[Project:#fragment]]
14839 !! html
14840 <p>[[Project:#fragment]]
14841 </p>
14842 !!end
14843
14844
14845 ###
14846 ### HTML tags and HTML attributes
14847 ###
14848
14849 !! test
14850 div with no attributes
14851 !! wikitext
14852 <div>HTML rocks</div>
14853 !! html
14854 <div>HTML rocks</div>
14855
14856 !! end
14857
14858 !! test
14859 div with double-quoted attribute
14860 !! wikitext
14861 <div id="rock">HTML rocks</div>
14862 !! html
14863 <div id="rock">HTML rocks</div>
14864
14865 !! end
14866
14867 !! test
14868 div with single-quoted attribute
14869 !! wikitext
14870 <div id='rock'>HTML rocks</div>
14871 !! html
14872 <div id="rock">HTML rocks</div>
14873
14874 !! end
14875
14876 !! test
14877 div with unquoted attribute
14878 !! wikitext
14879 <div id=rock>HTML rocks</div>
14880 !! html
14881 <div id="rock">HTML rocks</div>
14882
14883 !! end
14884
14885 !! test
14886 div with illegal double attributes
14887 !! wikitext
14888 <div id="a" id="b">HTML rocks</div>
14889 !! html
14890 <div id="b">HTML rocks</div>
14891
14892 !!end
14893
14894 # FIXME: produce empty string instead of "class" in the PHP parser, following
14895 # the HTML5 spec.
14896 !! test
14897 div with empty attribute value, space before equals
14898 !! options
14899 parsoid
14900 !! wikitext
14901 <div class =>HTML rocks</div>
14902 !! html
14903 <div class="">HTML rocks</div>
14904
14905 !! end
14906
14907 !! test
14908 div with multiple empty attribute values
14909 !! options
14910 parsoid
14911 !! wikitext
14912 <div id= title=>HTML rocks</div>
14913 !! html
14914 <div id="" title="">HTML rocks</div>
14915
14916 !! end
14917
14918 !! test
14919 table with multiple empty attribute values
14920 !! options
14921 parsoid
14922 !! wikitext
14923 {| title= id=
14924 | hi
14925 |}
14926 !! html
14927 <table title="" id="">
14928 <tbody><tr><td> hi</td></tr>
14929 </tbody></table>
14930 !! end
14931
14932 !! test
14933 div with braces in attribute value
14934 !! wikitext
14935 <div title="{}">Foo</div>
14936 !! html/php
14937 <div title="&#123;}">Foo</div>
14938
14939 !! html/parsoid
14940 <div title="{}">Foo</div>
14941 !! end
14942
14943 # This it very inconsistent in the PHP parser: it returns
14944 # class="class" if there is a space between the name and the equal sign (see
14945 # 'div with empty attribute value, space before equals'), but strips the
14946 # attribute completely if the space is missing. We hope that not much content
14947 # depends on this, so are implementing the behavior below in Parsoid for
14948 # consistencies' sake.
14949 # FIXME: fix this behavior in the PHP parser?
14950 !! test
14951 div with empty attribute value, no space before equals
14952 !! options
14953 parsoid=wt2html,html2html
14954 !! wikitext
14955 <div class=>HTML rocks</div>
14956 !! html/php
14957 <div>HTML rocks</div>
14958
14959 !! html/parsoid
14960 <div class="">HTML rocks</div>
14961 !! end
14962
14963 !! test
14964 HTML multiple attributes correction
14965 !! wikitext
14966 <p class="error" class="awesome">Awesome!</p>
14967 !! html
14968 <p class="awesome">Awesome!</p>
14969
14970 !!end
14971
14972 !! test
14973 Table multiple attributes correction
14974 !! wikitext
14975 {|
14976 !+ class="error" class="awesome"| status
14977 |}
14978 !! html
14979 <table>
14980 <tr>
14981 <th class="awesome"> status
14982 </th></tr></table>
14983
14984 !!end
14985
14986 !! test
14987 DIV IN UPPERCASE
14988 !! wikitext
14989 <DIV ID="x">HTML ROCKS</DIV>
14990 !! html
14991 <div id="x">HTML ROCKS</div>
14992
14993 !!end
14994
14995 !! test
14996 Non-ASCII pseudo-tags are rendered as text
14997 !! wikitext
14998 <khyô>
14999 !! html
15000 <p>&lt;khyô&gt;
15001 </p>
15002 !! end
15003
15004 !! test
15005 Pseudo-tag with URL 'name' renders as url link
15006 !! wikitext
15007 <http://example.com/>
15008 !! html
15009 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15010 </p>
15011 !! end
15012
15013 !! test
15014 text with amp in the middle of nowhere
15015 !! wikitext
15016 Remember AT&T?
15017 !! html
15018 <p>Remember AT&amp;T?
15019 </p>
15020 !! end
15021
15022 !! test
15023 text with character entity: eacute
15024 !! wikitext
15025 I always thought &eacute; was a cute letter.
15026 !! html
15027 <p>I always thought &#233; was a cute letter.
15028 </p>
15029 !! html+tidy
15030 <p>I always thought é was a cute letter.</p>
15031 !! end
15032
15033 !! test
15034 text with entity-escaped character entity-like string: eacute
15035 !! wikitext
15036 I always thought &amp;eacute; was a cute letter.
15037 !! html
15038 <p>I always thought &amp;eacute; was a cute letter.
15039 </p>
15040 !! end
15041
15042 !! test
15043 text with undefined character entity: xacute
15044 !! wikitext
15045 I always thought &xacute; was a cute letter.
15046 !! html
15047 <p>I always thought &amp;xacute; was a cute letter.
15048 </p>
15049 !! end
15050
15051 # TODO: generalize to PHP parser?
15052 !! test
15053 HTML5 tags
15054 !! options
15055 parsoid
15056 !! wikitext
15057 <data value="5">five</data>
15058 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15059 <mark>This highlighted text</mark>
15060 !! html
15061 <p><data value="5">five</data>
15062 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15063 <mark>This highlighted text</mark></p>
15064 !! end
15065
15066 !! test
15067 HTML tag with leading space is parsed as text
15068 !! wikitext
15069 < div>foo< /div>
15070 !! html
15071 <p>&lt; div&gt;foo&lt; /div&gt;
15072 </p>
15073 !! end
15074
15075 ###
15076 ### Nesting tests (see bug 41545, 50604, 51081)
15077 ###
15078
15079 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15080 # Note that html2wt is considerably more difficult if we use <b> in
15081 # the test case, instead of <big>
15082 !! test
15083 Ensure that HTML adoption agency algorithm is properly implemented.
15084 !! wikitext
15085 <big>X<big>Y</big>Z</big>
15086 !! html
15087 <p><big>X<big>Y</big>Z</big>
15088 </p>
15089 !! end
15090
15091 # This was bug 41545 in the PHP parser.
15092 # Note that tidy doesn't handle this correctly.
15093 !! test
15094 Nesting of <kbd>
15095 !! wikitext
15096 <kbd>X<kbd>Y</kbd>Z</kbd>
15097 !! html
15098 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15099 </p>
15100 !! end
15101
15102 # The following cases were bug 51081 in the PHP parser.
15103 # Note that there are some other nestable tags (b, i, etc) which are
15104 # not covered; see bug 51081 for discussion.
15105
15106 # Note that tidy doesn't handle this correctly.
15107 !! test
15108 Nesting of <em>
15109 !! wikitext
15110 <em>X<em>Y</em>Z</em>
15111 !! html
15112 <p><em>X<em>Y</em>Z</em>
15113 </p>
15114 !! end
15115
15116 # Note that tidy doesn't handle this correctly.
15117 !! test
15118 Nesting of <strong>
15119 !! wikitext
15120 <strong>X<strong>Y</strong>Z</strong>
15121 !! html
15122 <p><strong>X<strong>Y</strong>Z</strong>
15123 </p>
15124 !! end
15125
15126 !! test
15127 Nesting of <q>
15128 !! wikitext
15129 <q>X<q>Y</q>Z</q>
15130 !! html+tidy
15131 <p><q>X<q>Y</q>Z</q></p>
15132 !! end
15133
15134 # Note that tidy doesn't handle this correctly.
15135 !! test
15136 Nesting of <ruby>
15137 !! wikitext
15138 <ruby>X<ruby>Y</ruby>Z</ruby>
15139 !! html
15140 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15141 </p>
15142 !! end
15143
15144 # Note that tidy doesn't handle this correctly.
15145 !! test
15146 Nesting of <bdo>
15147 !! wikitext
15148 <bdo>X<bdo>Y</bdo>Z</bdo>
15149 !! html
15150 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15151 </p>
15152 !! end
15153
15154
15155 ###
15156 ### Media links
15157 ###
15158
15159 !! test
15160 Media link
15161 !! wikitext
15162 [[Media:Foobar.jpg]]
15163 !! html
15164 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15165 </p>
15166 !! end
15167
15168 !! test
15169 Media link with text
15170 !! wikitext
15171 [[Media:Foobar.jpg|A neat file to look at]]
15172 !! html
15173 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15174 </p>
15175 !! end
15176
15177 # FIXME: this is still bad HTML tag nesting
15178 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15179 !! test
15180 Media link with nasty text
15181 !! wikitext
15182 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15183 !! html
15184 <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>
15185
15186 !! html+tidy
15187 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15188 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15189 !! end
15190
15191 !! test
15192 Media link to nonexistent file (bug 1702)
15193 !! wikitext
15194 [[Media:No such.jpg]]
15195 !! html
15196 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15197 </p>
15198 !! end
15199
15200 !! test
15201 Image link to nonexistent file (bug 1850 - good)
15202 !! wikitext
15203 [[File:No_such.jpg]]
15204 !! html/php
15205 <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>
15206 </p>
15207 !! html/parsoid
15208 <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>
15209 !! end
15210
15211 !! test
15212 :Image link to nonexistent file (bug 1850 - bad)
15213 !! wikitext
15214 [[:Image:No such.jpg]]
15215 !! html/php
15216 <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>
15217 </p>
15218 !! html/parsoid
15219 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15220 !! end
15221
15222
15223
15224 !! test
15225 Character reference normalization in link text (bug 1938)
15226 !! wikitext
15227 [[Main Page|this&that]]
15228 !! html
15229 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15230 </p>
15231 !!end
15232
15233 !! article
15234 אַ
15235 !! text
15236 Test for unicode normalization
15237
15238 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15239 !! endarticle
15240
15241 !! test
15242 (bug 19451) Links should refer to the normalized form.
15243 !! wikitext
15244 [[&#xFB2E;]]
15245 [[&#x5d0;&#x5b7;]]
15246 [[&#x5d0;ַ]]
15247 [[א&#x5b7;]]
15248 [[אַ]]
15249 !! html
15250 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15251 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15252 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15253 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15254 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15255 </p>
15256 !! end
15257
15258 !! test
15259 Empty attribute crash test (bug 2067)
15260 !! wikitext
15261 <font color="">foo</font>
15262 !! html
15263 <p><font color="">foo</font>
15264 </p>
15265 !! end
15266
15267 !! test
15268 Empty attribute crash test single-quotes (bug 2067)
15269 !! wikitext
15270 <font color=''>foo</font>
15271 !! html
15272 <p><font color="">foo</font>
15273 </p>
15274 !! end
15275
15276 !! test
15277 Attribute test: equals, then nothing
15278 !! wikitext
15279 <font color=>foo</font>
15280 !! html
15281 <p><font>foo</font>
15282 </p>
15283 !! end
15284
15285 !! test
15286 Attribute test: unquoted value
15287 !! wikitext
15288 <font color=x>foo</font>
15289 !! html
15290 <p><font color="x">foo</font>
15291 </p>
15292 !! end
15293
15294 !! test
15295 Attribute test: unquoted but illegal value (hash)
15296 !! wikitext
15297 <font color=#x>foo</font>
15298 !! html
15299 <p><font color="#x">foo</font>
15300 </p>
15301 !! end
15302
15303 # Parsoid does not serialize to empty attribute syntax,
15304 # so wt2wt and html2wt cases are skipped
15305 !! test
15306 Attribute test: no value (T54330)
15307 !! options
15308 parsoid=wt2html,html2html
15309 !! wikitext
15310 <font color>foo</font>
15311 !! html/php
15312 <p><font color="">foo</font>
15313 </p>
15314 !! html/parsoid
15315 <p><font color="">foo</font></p>
15316 !! end
15317
15318 !! test
15319 Bug 2095: link with three closing brackets
15320 !! wikitext
15321 [[Main Page]]]
15322 !! html/php
15323 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15324 </p>
15325 !! html/parsoid
15326 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15327 !! end
15328
15329 !! test
15330 Bug 2095: link with pipe and three closing brackets
15331 !! wikitext
15332 [[Main Page|link]]]
15333 !! html/php
15334 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15335 </p>
15336 !! html/parsoid
15337 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15338 !! end
15339
15340 !! test
15341 Bug 2095: link with pipe and three closing brackets, version 2
15342 !! wikitext
15343 [[Main Page|[http://example.com/]]]
15344 !! html/php
15345 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15346 </p>
15347 !! html/parsoid
15348 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15349 !! end
15350
15351
15352 ###
15353 ### Safety
15354 ###
15355
15356 !! article
15357 Template:Dangerous attribute
15358 !! text
15359 " onmouseover="alert(document.cookie)
15360 !! endarticle
15361
15362 !! article
15363 Template:Dangerous style attribute
15364 !! text
15365 border-size: expression(alert(document.cookie))
15366 !! endarticle
15367
15368 !! article
15369 Template:Div style
15370 !! text
15371 <div style="float: right; {{{1}}}">Magic div</div>
15372 !! endarticle
15373
15374 !! test
15375 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15376 !! wikitext
15377 <div title="{{test}}"></div>
15378 !! html
15379 <div title="This is a test template"></div>
15380
15381 !! end
15382
15383 # Parsoid has enough context to handle this case
15384 !! test
15385 Bug 2304: HTML attribute safety (dangerous template; 2309)
15386 !! wikitext
15387 <div title="{{dangerous attribute}}"></div>
15388 !! html/php
15389 <div title=""></div>
15390
15391 !! html/parsoid
15392 <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>
15393 !! end
15394
15395 !! test
15396 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15397 !! wikitext
15398 <div style="{{dangerous style attribute}}"></div>
15399 !! html
15400 <div style="/* insecure input */"></div>
15401
15402 !! end
15403
15404 !! test
15405 Bug 2304: HTML attribute safety (safe parameter; 2309)
15406 !! wikitext
15407 {{div style|width: 200px}}
15408 !! html
15409 <div style="float: right; width: 200px">Magic div</div>
15410
15411 !! end
15412
15413 !! test
15414 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15415 !! wikitext
15416 {{div style|width: expression(alert(document.cookie))}}
15417 !! html
15418 <div style="/* insecure input */">Magic div</div>
15419
15420 !! end
15421
15422 !! test
15423 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15424 !! wikitext
15425 {{div style|"><script>alert(document.cookie)</script>}}
15426 !! html
15427 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15428
15429 !! end
15430
15431 !! test
15432 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15433 !! wikitext
15434 {{div style|" ><script>alert(document.cookie)</script>}}
15435 !! html
15436 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15437
15438 !! end
15439
15440 !! test
15441 Bug 2304: HTML attribute safety (link)
15442 !! wikitext
15443 <div title="[[Main Page]]"></div>
15444 !! html
15445 <div title="&#91;&#91;Main Page]]"></div>
15446
15447 !! end
15448
15449 !! test
15450 Bug 2304: HTML attribute safety (italics)
15451 !! wikitext
15452 <div title="''foobar''"></div>
15453 !! html
15454 <div title="&#39;&#39;foobar&#39;&#39;"></div>
15455
15456 !! end
15457
15458 !! test
15459 Bug 2304: HTML attribute safety (bold)
15460 !! wikitext
15461 <div title="'''foobar'''"></div>
15462 !! html
15463 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
15464
15465 !! end
15466
15467
15468 !! test
15469 Bug 2304: HTML attribute safety (ISBN)
15470 !! wikitext
15471 <div title="ISBN 1234567890"></div>
15472 !! html
15473 <div title="&#73;SBN 1234567890"></div>
15474
15475 !! end
15476
15477 !! test
15478 Bug 2304: HTML attribute safety (RFC)
15479 !! wikitext
15480 <div title="RFC 1234"></div>
15481 !! html
15482 <div title="&#82;FC 1234"></div>
15483
15484 !! end
15485
15486 !! test
15487 Bug 2304: HTML attribute safety (PMID)
15488 !! wikitext
15489 <div title="PMID 1234567890"></div>
15490 !! html
15491 <div title="&#80;MID 1234567890"></div>
15492
15493 !! end
15494
15495 !! test
15496 Bug 2304: HTML attribute safety (web link)
15497 !! wikitext
15498 <div title="http://example.com/"></div>
15499 !! html
15500 <div title="http&#58;//example.com/"></div>
15501
15502 !! end
15503
15504 !! test
15505 Bug 2304: HTML attribute safety (named web link)
15506 !! wikitext
15507 <div title="[http://example.com/ link]"></div>
15508 !! html
15509 <div title="&#91;http&#58;//example.com/ link]"></div>
15510
15511 !! end
15512
15513 !! test
15514 Bug 3244: HTML attribute safety (extension; safe)
15515 !! wikitext
15516 <div style="<nowiki>background:blue</nowiki>"></div>
15517 !! html
15518 <div style="background:blue"></div>
15519
15520 !! end
15521
15522 !! test
15523 Bug 3244: HTML attribute safety (extension; unsafe)
15524 !! wikitext
15525 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
15526 !! html
15527 <div style="/* insecure input */"></div>
15528
15529 !! end
15530
15531 # More MSIE fun discovered by Tom Gilder
15532
15533 !! test
15534 MSIE CSS safety test: spurious slash
15535 !! wikitext
15536 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
15537 !! html
15538 <div style="/* insecure input */">evil</div>
15539
15540 !! end
15541
15542 !! test
15543 MSIE CSS safety test: hex code
15544 !! wikitext
15545 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
15546 !! html
15547 <div style="/* insecure input */">evil</div>
15548
15549 !! end
15550
15551 !! test
15552 MSIE CSS safety test: comment in url
15553 !! wikitext
15554 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
15555 !! html
15556 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
15557
15558 !! end
15559
15560 !! test
15561 MSIE CSS safety test: comment in expression
15562 !! wikitext
15563 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
15564 !! html
15565 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
15566
15567 !! end
15568
15569 !! test
15570 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
15571 !! wikitext
15572 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
15573 !! html
15574 <p style="/* invalid control char */">A</p>
15575
15576 !! end
15577
15578 !! test
15579 MSIE 6 CSS safety test: Fullwidth (bug 55332)
15580 !! wikitext
15581 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
15582 <div style="top:EXPRESSION(alert())">B</div>
15583 !! html
15584 <p style="/* insecure input */">A</p>
15585 <div style="/* insecure input */">B</div>
15586
15587 !! end
15588
15589 !! test
15590 MSIE 6 CSS safety test: IPA extensions (bug 55332)
15591 !! wikitext
15592 <div style="background-image:uʀʟ(javascript:alert())">A</div>
15593 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
15594 !! html
15595 <div style="/* insecure input */">A</div>
15596 <p style="/* insecure input */">B</p>
15597
15598 !! end
15599
15600 !! test
15601 MSIE 6 CSS safety test: sup/sub script (bug 55332)
15602 !! wikitext
15603 <div style="background-image:url⁽javascript:alert())">A</div>
15604 <div style="background-image:url₍javascript:alert())">B</div>
15605 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
15606 !! html
15607 <div style="/* insecure input */">A</div>
15608 <div style="/* insecure input */">B</div>
15609 <p style="/* insecure input */">C</p>
15610
15611 !! end
15612
15613 !! test
15614 Opera -o-link CSS
15615 !! wikitext
15616 <div
15617 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;"
15618 style="-o-link:attr(title);-o-link-source:current">X</div>
15619 !! html
15620 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
15621
15622 !! end
15623
15624 !! test
15625 MSIE 6 CSS safety test: Repetition markers (bug 55332)
15626 !! wikitext
15627 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
15628 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
15629 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
15630 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
15631 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
15632 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
15633 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
15634 !! html
15635 <p style="/* insecure input */">A</p>
15636 <p style="/* insecure input */">B</p>
15637 <p style="/* insecure input */">C</p>
15638 <p style="/* insecure input */">D</p>
15639 <p style="/* insecure input */">E</p>
15640 <p style="/* insecure input */">F</p>
15641 <p style="/* insecure input */">G</p>
15642
15643 !! end
15644
15645 !! test
15646 Table attribute legitimate extension
15647 !! wikitext
15648 {|
15649 !+ style="<nowiki>color:blue</nowiki>"| status
15650 |}
15651 !! html
15652 <table>
15653 <tr>
15654 <th style="color:blue"> status
15655 </th></tr></table>
15656
15657 !!end
15658
15659 !! test
15660 Table attribute safety
15661 !! wikitext
15662 {|
15663 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
15664 |}
15665 !! html
15666 <table>
15667 <tr>
15668 <th style="/* insecure input */"> status
15669 </th></tr></table>
15670
15671 !! end
15672
15673 !! test
15674 CSS line continuation 1
15675 !! wikitext
15676 <div style="background-image: u\&#10;rl(test.jpg);"></div>
15677 !! html
15678 <div style="/* insecure input */"></div>
15679
15680 !! end
15681
15682 !! test
15683 CSS line continuation 2
15684 !! wikitext
15685 <div style="background-image: u\&#13;rl(test.jpg); "></div>
15686 !! html
15687 <div style="/* insecure input */"></div>
15688
15689 !! end
15690
15691 !! article
15692 Template:Identity
15693 !! text
15694 {{{1}}}
15695 !! endarticle
15696
15697 !! test
15698 Expansion of multi-line templates in attribute values (bug 6255)
15699 !! wikitext
15700 <div style="background: {{identity|#00FF00}}">-</div>
15701 !! html
15702 <div style="background: #00FF00">-</div>
15703
15704 !! end
15705
15706
15707 !! test
15708 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
15709 !! wikitext
15710 <div style="background:
15711 #00FF00">-</div>
15712 !! html/php
15713 <div style="background: #00FF00">-</div>
15714
15715 !! html/parsoid
15716 <div style="background:
15717 #00FF00">-</div>
15718 !! end
15719
15720 !! test
15721 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
15722 !! wikitext
15723 <div style="background: &#10;#00FF00">-</div>
15724 !! html
15725 <div style="background: &#10;#00FF00">-</div>
15726
15727 !! end
15728
15729 !! test
15730 evil <math>-wiki-tags without Extension:Math enabled
15731 !! wikitext
15732 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
15733 !! html+tidy
15734 <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>
15735 !! end
15736
15737 ###
15738 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
15739 ###
15740 !! test
15741 Parser hook: empty input
15742 !! wikitext
15743 <tag></tag>
15744 !! html/php
15745 <pre>
15746 ''
15747 array (
15748 )
15749 </pre>
15750
15751 !! end
15752
15753 !! test
15754 Parser hook: empty input using terminated empty elements
15755 !! wikitext
15756 <tag/>
15757 !! html/php
15758 <pre>
15759 NULL
15760 array (
15761 )
15762 </pre>
15763
15764 !! end
15765
15766 !! test
15767 Parser hook: empty input using terminated empty elements (space before)
15768 !! wikitext
15769 <tag />
15770 !! html/php
15771 <pre>
15772 NULL
15773 array (
15774 )
15775 </pre>
15776
15777 !! end
15778
15779 !! test
15780 Parser hook: basic input
15781 !! wikitext
15782 <tag>input</tag>
15783 !! html/php
15784 <pre>
15785 'input'
15786 array (
15787 )
15788 </pre>
15789
15790 !! end
15791
15792
15793 !! test
15794 Parser hook: case insensitive
15795 !! wikitext
15796 <TAG>input</TAG>
15797 !! html/php
15798 <pre>
15799 'input'
15800 array (
15801 )
15802 </pre>
15803
15804 !! end
15805
15806
15807 !! test
15808 Parser hook: case insensitive, redux
15809 !! wikitext
15810 <TaG>input</TAg>
15811 !! html/php
15812 <pre>
15813 'input'
15814 array (
15815 )
15816 </pre>
15817
15818 !! end
15819
15820 !! test
15821 Parser hook: nested tags
15822 !! options
15823 noxml
15824 !! wikitext
15825 <tag><tag></tag></tag>
15826 !! html/php
15827 <pre>
15828 '<tag>'
15829 array (
15830 )
15831 </pre>&lt;/tag&gt;
15832
15833 !! end
15834
15835 !! test
15836 Parser hook: basic arguments
15837 !! wikitext
15838 <tag width=200 height = "100" depth = '50' square></tag>
15839 !! html/php
15840 <pre>
15841 ''
15842 array (
15843 'width' => '200',
15844 'height' => '100',
15845 'depth' => '50',
15846 'square' => '',
15847 )
15848 </pre>
15849
15850 !! end
15851
15852 !! test
15853 Parser hook: argument containing a forward slash (bug 5344)
15854 !! wikitext
15855 <tag filename='/tmp/bla'></tag>
15856 !! html/php
15857 <pre>
15858 ''
15859 array (
15860 'filename' => '/tmp/bla',
15861 )
15862 </pre>
15863
15864 !! end
15865
15866 !! test
15867 Parser hook: empty input using terminated empty elements (bug 2374)
15868 !! wikitext
15869 <tag foo=bar/>text
15870 !! html/php
15871 <pre>
15872 NULL
15873 array (
15874 'foo' => 'bar',
15875 )
15876 </pre>text
15877
15878 !! end
15879
15880 # </tag> should be output literally since there is no matching tag that begins it
15881 !! test
15882 Parser hook: basic arguments using terminated empty elements (bug 2374)
15883 !! wikitext
15884 <tag width=200 height = "100" depth = '50' square/>
15885 other stuff
15886 </tag>
15887 !! html/php
15888 <pre>
15889 NULL
15890 array (
15891 'width' => '200',
15892 'height' => '100',
15893 'depth' => '50',
15894 'square' => '',
15895 )
15896 </pre>
15897 <p>other stuff
15898 &lt;/tag&gt;
15899 </p>
15900 !! end
15901
15902 ###
15903 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
15904 ###
15905
15906 !! test
15907 Parser hook: static parser hook not inside a comment
15908 !! wikitext
15909 <statictag>hello, world</statictag>
15910 <statictag action=flush/>
15911 !! html/php
15912 <p>hello, world
15913 </p>
15914 !! end
15915
15916
15917 !! test
15918 Parser hook: static parser hook inside a comment
15919 !! wikitext
15920 <!-- <statictag>hello, world</statictag> -->
15921 <statictag action=flush/>
15922 !! html/php
15923 <p><br />
15924 </p>
15925 !! end
15926
15927 # Nested template calls; this case was broken by Parser.php rev 1.506,
15928 # since reverted.
15929
15930 !! article
15931 Template:One-parameter
15932 !! text
15933 (My parameter is: {{{1}}})
15934 !! endarticle
15935
15936 !! article
15937 Template:Map-one-parameter
15938 !! text
15939 {{{{{1}}}|{{{2}}}}}
15940 !! endarticle
15941
15942 !! test
15943 Nested template calls
15944 !! wikitext
15945 {{Map-one-parameter|One-parameter|param}}
15946 !! html
15947 <p>(My parameter is: param)
15948 </p>
15949 !! end
15950
15951
15952 ###
15953 ### Sanitizer
15954 ###
15955
15956 # HTML+Tidy effectively strips out the empty tags completely
15957 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
15958 # which Tidy would have done for the PHP parser had there been content inside it.
15959 !! test
15960 Sanitizer: Closing of open tags
15961 !! wikitext
15962 <s></s><table></table>
15963 !! html
15964 <s></s><table></table>
15965
15966 !! html/parsoid
15967 <p><s></s></p><table></table>
15968 !! end
15969
15970 !! test
15971 Sanitizer: Closing of open but not closed tags
15972 !! wikitext
15973 <s>foo
15974 !! html
15975 <p><s>foo</s>
15976 </p>
15977 !! end
15978
15979 !! test
15980 Sanitizer: Closing of closed but not open tags
15981 !! options
15982 parsoid=wt2html
15983 !! wikitext
15984 </s>
15985 !! html/php+tidy
15986 !! html/parsoid
15987 !! end
15988
15989 !! test
15990 Sanitizer: Closing of closed but not open table tags
15991 !! options
15992 parsoid=wt2html
15993 !! wikitext
15994 Table not started</td></tr></table>
15995 !! html/php+tidy
15996 <p>Table not started</p>
15997 !! html/parsoid
15998 <p>Table not started</p>
15999 !! end
16000
16001 !! test
16002 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16003 !! wikitext
16004 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16005 !! html
16006 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16007 </p>
16008 !! end
16009
16010 # In HTML5, the restrictions are that id must contain at least one character,
16011 # and must not contain any space characters.
16012 !! test
16013 Sanitizer: Validating the contents of the id attribute (bug 4515)
16014 !! options
16015 disabled
16016 !! wikitext
16017 <br id="" /><br id="a space" />
16018 !! html
16019 Something ...
16020 !! end
16021
16022 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16023 !! test
16024 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16025 !! options
16026 disabled
16027 !! wikitext
16028 <br id="foo" /><br id="foo" />
16029 !! html
16030 Something need to be done. foo-2 ?
16031 !! end
16032
16033 !! test
16034 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16035 !! wikitext
16036 <div itemscope>
16037 <meta itemprop="hello" content="world">
16038 <meta http-equiv="refresh" content="5">
16039 <meta itemprop="hello" http-equiv="refresh" content="5">
16040 <link itemprop="hello" href="{{SERVER}}">
16041 <link rel="stylesheet" href="{{SERVER}}">
16042 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16043 </div>
16044 !! html
16045 <div itemscope="">
16046 <p> <meta itemprop="hello" content="world" />
16047 &lt;meta http-equiv="refresh" content="5"&gt;
16048 <meta itemprop="hello" content="5" />
16049 </p>
16050 <link itemprop="hello" href="http&#58;//example.org" />
16051 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16052 <link itemprop="hello" href="http&#58;//example.org" />
16053 </div>
16054
16055 !! end
16056
16057 !! test
16058 Language converter: output gets cut off unexpectedly (bug 5757)
16059 !! options
16060 language=zh
16061 !! wikitext
16062 this bit is safe: }-
16063
16064 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16065
16066 then we get cut off here: }-
16067
16068 all additional text is vanished
16069 !! html
16070 <p>this bit is safe: }-
16071 </p><p>but if we add a conversion instance: xxx
16072 </p><p>then we get cut off here: }-
16073 </p><p>all additional text is vanished
16074 </p>
16075 !! end
16076
16077 !! test
16078 Self closed html pairs (bug 5487)
16079 !! options
16080 !! wikitext
16081 <center><font id="bug" />Centered text</center>
16082 <div><font id="bug2" />In div text</div>
16083 !! html
16084 <center>&lt;font id="bug" /&gt;Centered text</center>
16085 <div>&lt;font id="bug2" /&gt;In div text</div>
16086
16087 !! end
16088
16089 #
16090 #
16091 #
16092
16093 !! test
16094 Punctuation: nbsp before exclamation
16095 !! wikitext
16096 C'est grave !
16097 !! html
16098 <p>C'est grave&#160;!
16099 </p>
16100 !! end
16101
16102 !! test
16103 Punctuation: CSS !important (bug 11874)
16104 !! wikitext
16105 <div style="width:50% !important">important</div>
16106 !! html
16107 <div style="width:50% !important">important</div>
16108
16109 !!end
16110
16111 !! test
16112 Punctuation: CSS ! important (bug 11874; with space after)
16113 !! wikitext
16114 <div style="width:50% ! important">important</div>
16115 !! html
16116 <div style="width:50% ! important">important</div>
16117
16118 !!end
16119
16120 !! test
16121 HTML bullet list, closed tags (bug 5497)
16122 !! wikitext
16123 <ul>
16124 <li>One</li>
16125 <li>Two</li>
16126 </ul>
16127 !! html/php
16128 <ul>
16129 <li>One</li>
16130 <li>Two</li>
16131 </ul>
16132
16133 !! html/parsoid
16134 <ul data-parsoid='{"stx":"html"}'>
16135 <li data-parsoid='{"stx":"html"}'>One</li>
16136 <li data-parsoid='{"stx":"html"}'>Two</li>
16137 </ul>
16138
16139 !! end
16140
16141 !! test
16142 HTML bullet list, unclosed tags (bug 5497)
16143 !! wikitext
16144 <ul>
16145 <li>One
16146 <li>Two
16147 </ul>
16148 !! html/php+tidy
16149 <ul>
16150 <li>One</li>
16151 <li>Two</li>
16152 </ul>
16153 !! html/parsoid
16154 <ul data-parsoid='{"stx":"html"}'>
16155 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16156 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16157 </ul>
16158
16159 !! end
16160
16161 !! test
16162 HTML ordered list, closed tags (bug 5497)
16163 !! wikitext
16164 <ol>
16165 <li>One</li>
16166 <li>Two</li>
16167 </ol>
16168 !! html/php
16169 <ol>
16170 <li>One</li>
16171 <li>Two</li>
16172 </ol>
16173
16174 !! html/parsoid
16175 <ol data-parsoid='{"stx":"html"}'>
16176 <li data-parsoid='{"stx":"html"}'>One</li>
16177 <li data-parsoid='{"stx":"html"}'>Two</li>
16178 </ol>
16179
16180 !! end
16181
16182 !! test
16183 HTML ordered list, unclosed tags (bug 5497)
16184 !! options
16185 !! wikitext
16186 <ol>
16187 <li>One
16188 <li>Two
16189 </ol>
16190 !! html/php+tidy
16191 <ol>
16192 <li>One</li>
16193 <li>Two</li>
16194 </ol>
16195 !! html/parsoid
16196 <ol data-parsoid='{"stx":"html"}'>
16197 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16198 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16199 </ol>
16200
16201 !! end
16202
16203 !! test
16204 HTML nested bullet list, closed tags (bug 5497)
16205 !! wikitext
16206 <ul>
16207 <li>One</li>
16208 <li>Two:
16209 <ul>
16210 <li>Sub-one</li>
16211 <li>Sub-two</li>
16212 </ul>
16213 </li>
16214 </ul>
16215 !! html
16216 <ul>
16217 <li>One</li>
16218 <li>Two:
16219 <ul>
16220 <li>Sub-one</li>
16221 <li>Sub-two</li>
16222 </ul>
16223 </li>
16224 </ul>
16225
16226 !! end
16227
16228 !! test
16229 HTML nested bullet list, open tags (bug 5497)
16230 !! wikitext
16231 <ul>
16232 <li>One
16233 <li>Two:
16234 <ul>
16235 <li>Sub-one
16236 <li>Sub-two
16237 </ul>
16238 </ul>
16239 !! html/php+tidy
16240 <ul>
16241 <li>One</li>
16242 <li>Two:
16243 <ul>
16244 <li>Sub-one</li>
16245 <li>Sub-two</li>
16246 </ul>
16247 </li>
16248 </ul>
16249 !! html/parsoid
16250 <ul>
16251 <li>One
16252 </li>
16253 <li>Two:
16254 <ul>
16255 <li>Sub-one
16256 </li>
16257 <li>Sub-two
16258 </li>
16259 </ul>
16260 </li>
16261 </ul>
16262
16263 !! end
16264
16265 !! test
16266 HTML nested ordered list, closed tags (bug 5497)
16267 !! wikitext
16268 <ol>
16269 <li>One</li>
16270 <li>Two:
16271 <ol>
16272 <li>Sub-one</li>
16273 <li>Sub-two</li>
16274 </ol>
16275 </li>
16276 </ol>
16277 !! html
16278 <ol>
16279 <li>One</li>
16280 <li>Two:
16281 <ol>
16282 <li>Sub-one</li>
16283 <li>Sub-two</li>
16284 </ol>
16285 </li>
16286 </ol>
16287
16288 !! end
16289
16290 !! test
16291 HTML nested ordered list, open tags (bug 5497)
16292 !! wikitext
16293 <ol>
16294 <li>One
16295 <li>Two:
16296 <ol>
16297 <li>Sub-one
16298 <li>Sub-two
16299 </ol>
16300 </ol>
16301 !! html/php
16302 <ol>
16303 <li>One
16304 <li>Two:
16305 <ol>
16306 <li>Sub-one
16307 <li>Sub-two
16308 </ol>
16309 </ol>
16310
16311 !! html/parsoid
16312 <ol>
16313 <li>One
16314 </li>
16315 <li>Two:
16316 <ol>
16317 <li>Sub-one
16318 </li>
16319 <li>Sub-two
16320 </li>
16321 </ol>
16322 </li>
16323 </ol>
16324
16325 !! end
16326
16327 !! test
16328 HTML ordered list item with parameters oddity
16329 !! wikitext
16330 <ol><li id="fragment">One</li>
16331 </ol>
16332 !! html
16333 <ol><li id="fragment">One</li>
16334 </ol>
16335
16336 !! end
16337
16338 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16339 !!test
16340 bug 5918: autonumbering
16341 !! wikitext
16342 [http://first/] [http://second] [ftp://ftp]
16343
16344 ftp://inlineftp
16345
16346 [mailto:enclosed@mail.tld With target]
16347
16348 [mailto:enclosed@mail.tld]
16349
16350 mailto:inline@mail.tld
16351 !! html/php
16352 <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>
16353 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16354 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16355 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16356 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16357 </p>
16358 !! html/parsoid
16359 <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>
16360 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16361 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16362 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16363 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16364 !! end
16365
16366
16367 #
16368 # Security and HTML correctness
16369 # From Nick Jenkins' fuzz testing
16370 #
16371
16372 !! test
16373 Fuzz testing: Parser13
16374 !! wikitext
16375 {|
16376 | http://a|
16377 !! html
16378 <table>
16379 <tr>
16380 <td>
16381 </td>
16382 </tr>
16383 </table>
16384
16385 !! end
16386
16387 !! test
16388 Fuzz testing: Parser14
16389 !! wikitext
16390 == onmouseover= ==
16391 http://__TOC__
16392 !! html
16393 <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>
16394 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16395 <ul>
16396 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16397 </ul>
16398 </div>
16399
16400
16401 !! html+tidy
16402 <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>
16403 <p>http://</p>
16404 <div id="toc" class="toc">
16405 <div id="toctitle">
16406 <h2>Contents</h2>
16407 </div>
16408 <ul>
16409 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16410 </ul>
16411 </div>
16412 <p></p>
16413 !! end
16414
16415 !! test
16416 Fuzz testing: Parser14-table
16417 !! wikitext
16418 ==a==
16419 {| STYLE=__TOC__
16420 !! html
16421 <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>
16422 <table style="&#95;_TOC&#95;_">
16423 <tr><td></td></tr>
16424 </table>
16425
16426 !! html+tidy
16427 <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>
16428 <table style="__TOC__">
16429 <tr>
16430 <td></td>
16431 </tr>
16432 </table>
16433 !! end
16434
16435 # Known to produce bogus xml (extra </td>)
16436 !! test
16437 Fuzz testing: Parser16
16438 !! options
16439 noxml
16440 !! wikitext
16441 {|
16442 !https://||||||
16443 !! html
16444 <table>
16445 <tr>
16446 <th>https://</th>
16447 <th></th>
16448 <th></th>
16449 <th>
16450 </td>
16451 </tr>
16452 </table>
16453
16454 !! html+tidy
16455 <table>
16456 <tr>
16457 <th>https://</th>
16458 <th></th>
16459 <th></th>
16460 <th></th>
16461 </tr>
16462 </table>
16463 !! end
16464
16465 !! test
16466 Fuzz testing: Parser21
16467 !! wikitext
16468 {|
16469 ! irc://{{ftp://a" onmouseover="alert('hello world');"
16470 |
16471 !! html
16472 <table>
16473 <tr>
16474 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
16475 </th>
16476 <td>
16477 </td>
16478 </tr>
16479 </table>
16480
16481 !! end
16482
16483 !! test
16484 Fuzz testing: Parser22
16485 !! wikitext
16486 http://===r:::https://b
16487
16488 {|
16489 !! html
16490 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
16491 </p>
16492 <table>
16493 <tr><td></td></tr>
16494 </table>
16495
16496 !! end
16497
16498 # Known to produce bad XML for now
16499 !! test
16500 Fuzz testing: Parser24
16501 !! options
16502 noxml
16503 !! wikitext
16504 {|
16505 {{{|
16506 <u CLASS=
16507 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
16508 <br style="onmouseover='alert(document.cookie);' " />
16509
16510 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16511 |
16512 !! html
16513 <table>
16514 {{{|
16515 <u class="&#124;">}}}} &gt;
16516 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
16517
16518 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16519 <tr>
16520 <td></u>
16521 </td>
16522 </tr>
16523 </table>
16524
16525 !! end
16526
16527 # Note: the current result listed for this is not what the original one was,
16528 # but the original bug was JavaScript injection, which is fixed in any case.
16529 # It's not clear that the original result listed was any more correct than the
16530 # current one. Original result:
16531 # <p>{{{|
16532 # </p>
16533 # <li class="&#124;&#124;">
16534 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16535 !!test
16536 Fuzz testing: Parser25 (bug 6055)
16537 !! wikitext
16538 {{{
16539 |
16540 <LI CLASS=||
16541 >
16542 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
16543 !! html
16544 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16545 </p>
16546 !! end
16547
16548 !!test
16549 Fuzz testing: URL adjacent extension (with space, clean)
16550 !! wikitext
16551 http://example.com <nowiki>junk</nowiki>
16552 !! html/php
16553 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
16554 </p>
16555 !! html/parsoid
16556 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
16557 !! end
16558
16559 !!test
16560 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
16561 !! wikitext
16562 http://example.com<nowiki>junk</nowiki>
16563 !! html/php
16564 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
16565 </p>
16566 !! html/parsoid
16567 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
16568 !! end
16569
16570 !!test
16571 Fuzz testing: URL adjacent extension (no space, dirty; pre)
16572 !! wikitext
16573 http://example.com<pre>junk</pre>
16574 !! html/php
16575 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
16576
16577 !! html/php+tidy
16578 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
16579 <pre>
16580 junk
16581 </pre>
16582 !! html/parsoid
16583 <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>
16584 !!end
16585
16586 !!test
16587 Fuzz testing: image with bogus manual thumbnail
16588 !! wikitext
16589 [[Image:foobar.jpg|thumbnail= ]]
16590 !! html/php
16591 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
16592
16593 !! html/parsoid
16594 <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>
16595 !!end
16596
16597 !! test
16598 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
16599 !! wikitext
16600 <pre dir="&#10;"></pre>
16601 !! html
16602 <pre dir="&#10;"></pre>
16603
16604 !! end
16605
16606 !! test
16607 Parsing optional HTML elements (Bug 6171)
16608 !! options
16609 !! wikitext
16610 <table>
16611 <tr>
16612 <td> Some tabular data</td>
16613 <td> More tabular data ...
16614 <td> And yet som tabular data</td>
16615 </tr>
16616 </table>
16617 !! html
16618 <table>
16619 <tr>
16620 <td> Some tabular data</td>
16621 <td> More tabular data ...
16622 </td><td> And yet som tabular data</td>
16623 </tr>
16624 </table>
16625
16626 !! end
16627
16628 !! test
16629 Correct handling of <td>, <tr> (Bug 6171)
16630 !! options
16631 !! wikitext
16632 <table>
16633 <tr>
16634 <td> Some tabular data</td>
16635 <td> More tabular data ...</td>
16636 <td> And yet som tabular data</td>
16637 </tr>
16638 </table>
16639 !! html
16640 <table>
16641 <tr>
16642 <td> Some tabular data</td>
16643 <td> More tabular data ...</td>
16644 <td> And yet som tabular data</td>
16645 </tr>
16646 </table>
16647
16648 !! end
16649
16650
16651 !! test
16652 Parsing crashing regression (fr:JavaScript)
16653 !! wikitext
16654 </body></x>
16655 !! html
16656 <p>&lt;/body&gt;&lt;/x&gt;
16657 </p>
16658 !! end
16659
16660 !! test
16661 Inline wiki vs wiki block nesting
16662 !! wikitext
16663 '''Bold paragraph
16664
16665 New wiki paragraph
16666 !! html
16667 <p><b>Bold paragraph</b>
16668 </p><p>New wiki paragraph
16669 </p>
16670 !! end
16671
16672 # FIXME: The current php output is documented
16673 # and desired output is the parsoid target.
16674 !! test
16675 Inline HTML vs wiki block nesting
16676 !! wikitext
16677 <b>Bold paragraph
16678
16679 New wiki paragraph
16680 !! html/php
16681 <p><b>Bold paragraph
16682 </p><p>New wiki paragraph</b>
16683 </p>
16684 !! html/parsoid
16685 <p><b>Bold paragraph</b>
16686 </p><p>New wiki paragraph
16687 </p>
16688 !! end
16689
16690 # Original result was this:
16691 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
16692 # </p>
16693 # While that might be marginally more intuitive, maybe, the six-apostrophe
16694 # construct is clearly pathological and the result stated here (which is what
16695 # the parser actually does) is about as reasonable as anything.
16696 !!test
16697 Mixing markup for italics and bold
16698 !! options
16699 !! wikitext
16700 '''bold''''''bold''bolditalics'''''
16701 !! html
16702 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
16703 </p>
16704 !! end
16705
16706
16707 !! article
16708 Xyzzyx
16709 !! text
16710 Article for special page transclusion test
16711 !! endarticle
16712
16713 !! test
16714 Special page transclusion
16715 !! options
16716 !! wikitext
16717 {{Special:Prefixindex/Xyzzyx}}
16718 !! html
16719 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16720
16721 !! end
16722
16723 !! test
16724 Special page transclusion twice (bug 5021)
16725 !! options
16726 !! wikitext
16727 {{Special:Prefixindex/Xyzzyx}}
16728 {{Special:Prefixindex/Xyzzyx}}
16729 !! html
16730 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16731 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16732
16733 !! end
16734
16735 !! test
16736 Transclusion of default MediaWiki message
16737 !! wikitext
16738 {{MediaWiki:Mainpage}}
16739 !! html
16740 <p>Main Page
16741 </p>
16742 !! end
16743
16744 !! test
16745 Transclusion of nonexistent MediaWiki message
16746 !! wikitext
16747 {{MediaWiki:Mainpagexxx}}
16748 !! html
16749 <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>
16750 </p>
16751 !! end
16752
16753 !! test
16754 Transclusion of MediaWiki message with underscore
16755 !! wikitext
16756 {{MediaWiki:history_short}}
16757 !! html
16758 <p>History
16759 </p>
16760 !! end
16761
16762 !! test
16763 Transclusion of MediaWiki message with space
16764 !! wikitext
16765 {{MediaWiki:history short}}
16766 !! html
16767 <p>History
16768 </p>
16769 !! end
16770
16771 !! test
16772 Invalid header with following text
16773 !! wikitext
16774 = x = y
16775 !! html
16776 <p>= x = y
16777 </p>
16778 !! end
16779
16780
16781 !! test
16782 Section extraction test (section 0)
16783 !! options
16784 section=0
16785 !! wikitext
16786 start
16787 ==a==
16788 ===aa===
16789 ====aaa====
16790 ==b==
16791 ===ba===
16792 ===bb===
16793 ====bba====
16794 ===bc===
16795 ==c==
16796 ===ca===
16797 !! html/php
16798 start
16799 !! end
16800
16801 !! test
16802 Section extraction test (section 1)
16803 !! options
16804 section=1
16805 !! wikitext
16806 start
16807 ==a==
16808 ===aa===
16809 ====aaa====
16810 ==b==
16811 ===ba===
16812 ===bb===
16813 ====bba====
16814 ===bc===
16815 ==c==
16816 ===ca===
16817 !! html/php
16818 ==a==
16819 ===aa===
16820 ====aaa====
16821 !! end
16822
16823 !! test
16824 Section extraction test (section 2)
16825 !! options
16826 section=2
16827 !! wikitext
16828 start
16829 ==a==
16830 ===aa===
16831 ====aaa====
16832 ==b==
16833 ===ba===
16834 ===bb===
16835 ====bba====
16836 ===bc===
16837 ==c==
16838 ===ca===
16839 !! html/php
16840 ===aa===
16841 ====aaa====
16842 !! end
16843
16844 !! test
16845 Section extraction test (section 3)
16846 !! options
16847 section=3
16848 !! wikitext
16849 start
16850 ==a==
16851 ===aa===
16852 ====aaa====
16853 ==b==
16854 ===ba===
16855 ===bb===
16856 ====bba====
16857 ===bc===
16858 ==c==
16859 ===ca===
16860 !! html/php
16861 ====aaa====
16862 !! end
16863
16864 !! test
16865 Section extraction test (section 4)
16866 !! options
16867 section=4
16868 !! wikitext
16869 start
16870 ==a==
16871 ===aa===
16872 ====aaa====
16873 ==b==
16874 ===ba===
16875 ===bb===
16876 ====bba====
16877 ===bc===
16878 ==c==
16879 ===ca===
16880 !! html/php
16881 ==b==
16882 ===ba===
16883 ===bb===
16884 ====bba====
16885 ===bc===
16886 !! end
16887
16888 !! test
16889 Section extraction test (section 5)
16890 !! options
16891 section=5
16892 !! wikitext
16893 start
16894 ==a==
16895 ===aa===
16896 ====aaa====
16897 ==b==
16898 ===ba===
16899 ===bb===
16900 ====bba====
16901 ===bc===
16902 ==c==
16903 ===ca===
16904 !! html/php
16905 ===ba===
16906 !! end
16907
16908 !! test
16909 Section extraction test (section 6)
16910 !! options
16911 section=6
16912 !! wikitext
16913 start
16914 ==a==
16915 ===aa===
16916 ====aaa====
16917 ==b==
16918 ===ba===
16919 ===bb===
16920 ====bba====
16921 ===bc===
16922 ==c==
16923 ===ca===
16924 !! html/php
16925 ===bb===
16926 ====bba====
16927 !! end
16928
16929 !! test
16930 Section extraction test (section 7)
16931 !! options
16932 section=7
16933 !! wikitext
16934 start
16935 ==a==
16936 ===aa===
16937 ====aaa====
16938 ==b==
16939 ===ba===
16940 ===bb===
16941 ====bba====
16942 ===bc===
16943 ==c==
16944 ===ca===
16945 !! html/php
16946 ====bba====
16947 !! end
16948
16949 !! test
16950 Section extraction test (section 8)
16951 !! options
16952 section=8
16953 !! wikitext
16954 start
16955 ==a==
16956 ===aa===
16957 ====aaa====
16958 ==b==
16959 ===ba===
16960 ===bb===
16961 ====bba====
16962 ===bc===
16963 ==c==
16964 ===ca===
16965 !! html/php
16966 ===bc===
16967 !! end
16968
16969 !! test
16970 Section extraction test (section 9)
16971 !! options
16972 section=9
16973 !! wikitext
16974 start
16975 ==a==
16976 ===aa===
16977 ====aaa====
16978 ==b==
16979 ===ba===
16980 ===bb===
16981 ====bba====
16982 ===bc===
16983 ==c==
16984 ===ca===
16985 !! html/php
16986 ==c==
16987 ===ca===
16988 !! end
16989
16990 !! test
16991 Section extraction test (section 10)
16992 !! options
16993 section=10
16994 !! wikitext
16995 start
16996 ==a==
16997 ===aa===
16998 ====aaa====
16999 ==b==
17000 ===ba===
17001 ===bb===
17002 ====bba====
17003 ===bc===
17004 ==c==
17005 ===ca===
17006 !! html/php
17007 ===ca===
17008 !! end
17009
17010 !! test
17011 Section extraction test (nonexistent section 11)
17012 !! options
17013 section=11
17014 !! wikitext
17015 start
17016 ==a==
17017 ===aa===
17018 ====aaa====
17019 ==b==
17020 ===ba===
17021 ===bb===
17022 ====bba====
17023 ===bc===
17024 ==c==
17025 ===ca===
17026 !! html/php
17027 !! end
17028
17029 !! test
17030 Section extraction test with bogus heading (section 1)
17031 !! options
17032 section=1
17033 !! wikitext
17034 ==a==
17035 ==bogus== not a legal section
17036 ==b==
17037 !! html/php
17038 ==a==
17039 ==bogus== not a legal section
17040 !! end
17041
17042 !! test
17043 Section extraction test with bogus heading (section 2)
17044 !! options
17045 section=2
17046 !! wikitext
17047 ==a==
17048 ==bogus== not a legal section
17049 ==b==
17050 !! html/php
17051 ==b==
17052 !! end
17053
17054 !! test
17055 Section extraction test with comment after heading (section 1)
17056 !! options
17057 section=1
17058 !! wikitext
17059 ==a==
17060 ==b== <!-- -->
17061 ==c==
17062 !! html/php
17063 ==a==
17064 !! end
17065
17066 !! test
17067 Section extraction test with comment after heading (section 2)
17068 !! options
17069 section=2
17070 !! wikitext
17071 ==a==
17072 ==b== <!-- -->
17073 ==c==
17074 !! html/php
17075 ==b== <!-- -->
17076 !! end
17077
17078 !! test
17079 Section extraction test with bogus <nowiki> heading (section 1)
17080 !! options
17081 section=1
17082 !! wikitext
17083 ==a==
17084 ==bogus== <nowiki>not a legal section</nowiki>
17085 ==b==
17086 !! html/php
17087 ==a==
17088 ==bogus== <nowiki>not a legal section</nowiki>
17089 !! end
17090
17091 !! test
17092 Section extraction test with bogus <nowiki> heading (section 2)
17093 !! options
17094 section=2
17095 !! wikitext
17096 ==a==
17097 ==bogus== <nowiki>not a legal section</nowiki>
17098 ==b==
17099 !! html/php
17100 ==b==
17101 !! end
17102
17103 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17104 # instead of respecting commented sections
17105 !! test
17106 Section extraction prefixed by comment (section 1)
17107 !! options
17108 section=1
17109 !! wikitext
17110 <!-- -->==sec1==
17111 ==sec2==
17112 !! html/php
17113 ==sec2==
17114 !!end
17115
17116 !! test
17117 Section extraction prefixed by comment (section 2)
17118 !! options
17119 section=2
17120 !! wikitext
17121 <!-- -->==sec1==
17122 ==sec2==
17123 !! html/php
17124
17125 !!end
17126
17127 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17128 # instead of respecting HTML-style headings
17129 !! test
17130 Section extraction, mixed wiki and html (section 1)
17131 !! options
17132 section=1
17133 !! wikitext
17134 <h2>unmarked</h2>
17135 unmarked
17136 ==1==
17137 one
17138 ==2==
17139 two
17140 !! html/php
17141 ==1==
17142 one
17143 !! end
17144
17145 !! test
17146 Section extraction, mixed wiki and html (section 2)
17147 !! options
17148 section=2
17149 !! wikitext
17150 <h2>unmarked</h2>
17151 unmarked
17152 ==1==
17153 one
17154 ==2==
17155 two
17156 !! html/php
17157 ==2==
17158 two
17159 !! end
17160
17161
17162 # Formerly testing for bug 3342
17163 !! test
17164 Section extraction, heading surrounded by <noinclude>
17165 !! options
17166 section=1
17167 !! wikitext
17168 <noinclude>==unmarked==</noinclude>
17169 ==marked==
17170 !! html/php
17171 ==marked==
17172 !!end
17173
17174 # Test behavior of bug 19910
17175 !! test
17176 Sectiion with all-equals
17177 !! options
17178 section=2
17179 !! wikitext
17180 ===
17181 The line above must have a trailing space
17182 === <!--
17183 --> <!-- -->
17184 But just in case it doesn't...
17185 !! html/php
17186 === <!--
17187 --> <!-- -->
17188 But just in case it doesn't...
17189 !! end
17190
17191 !! test
17192 Section replacement test (section 0)
17193 !! options
17194 replace=0,"xxx"
17195 !! wikitext
17196 start
17197 ==a==
17198 ===aa===
17199 ====aaa====
17200 ==b==
17201 ===ba===
17202 ===bb===
17203 ====bba====
17204 ===bc===
17205 ==c==
17206 ===ca===
17207 !! html/php
17208 xxx
17209
17210 ==a==
17211 ===aa===
17212 ====aaa====
17213 ==b==
17214 ===ba===
17215 ===bb===
17216 ====bba====
17217 ===bc===
17218 ==c==
17219 ===ca===
17220 !! end
17221
17222 !! test
17223 Section replacement test (section 1)
17224 !! options
17225 replace=1,"xxx"
17226 !! wikitext
17227 start
17228 ==a==
17229 ===aa===
17230 ====aaa====
17231 ==b==
17232 ===ba===
17233 ===bb===
17234 ====bba====
17235 ===bc===
17236 ==c==
17237 ===ca===
17238 !! html/php
17239 start
17240 xxx
17241
17242 ==b==
17243 ===ba===
17244 ===bb===
17245 ====bba====
17246 ===bc===
17247 ==c==
17248 ===ca===
17249 !! end
17250
17251 !! test
17252 Section replacement test (section 2)
17253 !! options
17254 replace=2,"xxx"
17255 !! wikitext
17256 start
17257 ==a==
17258 ===aa===
17259 ====aaa====
17260 ==b==
17261 ===ba===
17262 ===bb===
17263 ====bba====
17264 ===bc===
17265 ==c==
17266 ===ca===
17267 !! html/php
17268 start
17269 ==a==
17270 xxx
17271
17272 ==b==
17273 ===ba===
17274 ===bb===
17275 ====bba====
17276 ===bc===
17277 ==c==
17278 ===ca===
17279 !! end
17280
17281 !! test
17282 Section replacement test (section 3)
17283 !! options
17284 replace=3,"xxx"
17285 !! wikitext
17286 start
17287 ==a==
17288 ===aa===
17289 ====aaa====
17290 ==b==
17291 ===ba===
17292 ===bb===
17293 ====bba====
17294 ===bc===
17295 ==c==
17296 ===ca===
17297 !! html/php
17298 start
17299 ==a==
17300 ===aa===
17301 xxx
17302
17303 ==b==
17304 ===ba===
17305 ===bb===
17306 ====bba====
17307 ===bc===
17308 ==c==
17309 ===ca===
17310 !! end
17311
17312 !! test
17313 Section replacement test (section 4)
17314 !! options
17315 replace=4,"xxx"
17316 !! wikitext
17317 start
17318 ==a==
17319 ===aa===
17320 ====aaa====
17321 ==b==
17322 ===ba===
17323 ===bb===
17324 ====bba====
17325 ===bc===
17326 ==c==
17327 ===ca===
17328 !! html/php
17329 start
17330 ==a==
17331 ===aa===
17332 ====aaa====
17333 xxx
17334
17335 ==c==
17336 ===ca===
17337 !! end
17338
17339 !! test
17340 Section replacement test (section 5)
17341 !! options
17342 replace=5,"xxx"
17343 !! wikitext
17344 start
17345 ==a==
17346 ===aa===
17347 ====aaa====
17348 ==b==
17349 ===ba===
17350 ===bb===
17351 ====bba====
17352 ===bc===
17353 ==c==
17354 ===ca===
17355 !! html/php
17356 start
17357 ==a==
17358 ===aa===
17359 ====aaa====
17360 ==b==
17361 xxx
17362
17363 ===bb===
17364 ====bba====
17365 ===bc===
17366 ==c==
17367 ===ca===
17368 !! end
17369
17370 !! test
17371 Section replacement test (section 6)
17372 !! options
17373 replace=6,"xxx"
17374 !! wikitext
17375 start
17376 ==a==
17377 ===aa===
17378 ====aaa====
17379 ==b==
17380 ===ba===
17381 ===bb===
17382 ====bba====
17383 ===bc===
17384 ==c==
17385 ===ca===
17386 !! html/php
17387 start
17388 ==a==
17389 ===aa===
17390 ====aaa====
17391 ==b==
17392 ===ba===
17393 xxx
17394
17395 ===bc===
17396 ==c==
17397 ===ca===
17398 !! end
17399
17400 !! test
17401 Section replacement test (section 7)
17402 !! options
17403 replace=7,"xxx"
17404 !! wikitext
17405 start
17406 ==a==
17407 ===aa===
17408 ====aaa====
17409 ==b==
17410 ===ba===
17411 ===bb===
17412 ====bba====
17413 ===bc===
17414 ==c==
17415 ===ca===
17416 !! html/php
17417 start
17418 ==a==
17419 ===aa===
17420 ====aaa====
17421 ==b==
17422 ===ba===
17423 ===bb===
17424 xxx
17425
17426 ===bc===
17427 ==c==
17428 ===ca===
17429 !! end
17430
17431 !! test
17432 Section replacement test (section 8)
17433 !! options
17434 replace=8,"xxx"
17435 !! wikitext
17436 start
17437 ==a==
17438 ===aa===
17439 ====aaa====
17440 ==b==
17441 ===ba===
17442 ===bb===
17443 ====bba====
17444 ===bc===
17445 ==c==
17446 ===ca===
17447 !! html/php
17448 start
17449 ==a==
17450 ===aa===
17451 ====aaa====
17452 ==b==
17453 ===ba===
17454 ===bb===
17455 ====bba====
17456 xxx
17457
17458 ==c==
17459 ===ca===
17460 !!end
17461
17462 !! test
17463 Section replacement test (section 9)
17464 !! options
17465 replace=9,"xxx"
17466 !! wikitext
17467 start
17468 ==a==
17469 ===aa===
17470 ====aaa====
17471 ==b==
17472 ===ba===
17473 ===bb===
17474 ====bba====
17475 ===bc===
17476 ==c==
17477 ===ca===
17478 !! html/php
17479 start
17480 ==a==
17481 ===aa===
17482 ====aaa====
17483 ==b==
17484 ===ba===
17485 ===bb===
17486 ====bba====
17487 ===bc===
17488 xxx
17489 !! end
17490
17491 !! test
17492 Section replacement test (section 10)
17493 !! options
17494 replace=10,"xxx"
17495 !! wikitext
17496 start
17497 ==a==
17498 ===aa===
17499 ====aaa====
17500 ==b==
17501 ===ba===
17502 ===bb===
17503 ====bba====
17504 ===bc===
17505 ==c==
17506 ===ca===
17507 !! html/php
17508 start
17509 ==a==
17510 ===aa===
17511 ====aaa====
17512 ==b==
17513 ===ba===
17514 ===bb===
17515 ====bba====
17516 ===bc===
17517 ==c==
17518 xxx
17519 !! end
17520
17521 !! test
17522 Section replacement test with initial whitespace (bug 13728)
17523 !! options
17524 replace=2,"xxx"
17525 !! wikitext
17526 Preformatted initial line
17527 ==a==
17528 ===a===
17529 !! html/php
17530 Preformatted initial line
17531 ==a==
17532 xxx
17533 !! end
17534
17535
17536 !! test
17537 Section extraction, heading followed by pre with 20 spaces (bug 6398)
17538 !! options
17539 section=1
17540 !! wikitext
17541 ==a==
17542 a
17543 !! html/php
17544 ==a==
17545 a
17546 !! end
17547
17548 !! test
17549 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
17550 !! options
17551 section=1
17552 !! wikitext
17553 ==a==
17554 a
17555 !! html/php
17556 ==a==
17557 a
17558 !! end
17559
17560
17561 !! test
17562 Section extraction, <pre> around bogus header (bug 10309)
17563 !! options
17564 noxml section=2
17565 !! wikitext
17566 == Section One ==
17567 <pre>
17568 =======
17569 </pre>
17570
17571 == Section Two ==
17572 stuff
17573 !! html/php
17574 == Section Two ==
17575 stuff
17576 !! end
17577
17578 !! test
17579 Section replacement, <pre> around bogus header (bug 10309)
17580 !! options
17581 noxml replace=2,"xxx"
17582 !! wikitext
17583 == Section One ==
17584 <pre>
17585 =======
17586 </pre>
17587
17588 == Section Two ==
17589 stuff
17590 !! html/php
17591 == Section One ==
17592 <pre>
17593 =======
17594 </pre>
17595
17596 xxx
17597 !! end
17598
17599
17600 !! test
17601 Handling of &#x0A; in URLs
17602 !! wikitext
17603 ** irc://&#x0A;a
17604 !! html/php
17605 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17606
17607 !! html/parsoid
17608 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
17609 a">irc://
17610 a</a></li></ul></li></ul>
17611 !! end
17612
17613 !! test
17614 Handling of %0A in URLs
17615 !! wikitext
17616 ** irc://%0Aa
17617 !! html/php
17618 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17619
17620 !! html/parsoid
17621 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17622 !! end
17623
17624
17625 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
17626 !! test
17627 5 quotes, code coverage +1 line
17628 !! options
17629 parsoid=wt2html
17630 !! wikitext
17631 '''''
17632 !! html/php
17633 !! html/parsoid
17634 <p><b><i></i></b></p>
17635 !! end
17636
17637 # same html as previous, but wikitext adjusted to match parsoid html2wt
17638 # note that wt2html and html2html will put the <i> before the <b>
17639 !! test
17640 5 quotes, code coverage +1 line w/ nowiki (1)
17641 !! options
17642 parsoid=wt2wt,html2wt
17643 !! wikitext
17644 '''''<nowiki/>'''''
17645 !! html/php
17646 <p><i></i>
17647 </p>
17648 !! html/parsoid
17649 <p><b><i></i></b></p>
17650 !! end
17651
17652 # same as previous, just swapping the <i> and <b>
17653 !! test
17654 5 quotes, code coverage +1 line w/ nowiki (2)
17655 !! wikitext
17656 '''''<nowiki/>'''''
17657 !! html/php
17658 <p><i></i>
17659 </p>
17660 !! html/parsoid
17661 <p><i><b></b></i></p>
17662 !! end
17663
17664 !! test
17665 Special:Search page linking.
17666 !! wikitext
17667 {{Special:search}}
17668 !! html
17669 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
17670 </p>
17671 !! end
17672
17673 !! test
17674 {{!}} is a magic word
17675 !! wikitext
17676 {{!}} is a magic word there and {{!}} is still a magic word here
17677 !! html/php
17678 <p>| is a magic word there and | is still a magic word here
17679 </p>
17680 !! html/parsoid
17681 <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>
17682 !! end
17683
17684 !! test
17685 Say the magic word
17686 !! options
17687 title=[[Parser test]]
17688 !! wikitext
17689 * {{PAGENAME}}
17690 * {{PAGENAMEE}}
17691 * {{FULLPAGENAME}}
17692 * {{FULLPAGENAMEE}}
17693 * {{BASEPAGENAME}}
17694 * {{BASEPAGENAMEE}}
17695 * {{SUBPAGENAME}}
17696 * {{SUBPAGENAMEE}}
17697 * {{ROOTPAGENAME}}
17698 * {{ROOTPAGENAMEE}}
17699 * {{TALKPAGENAME}}
17700 * {{TALKPAGENAMEE}}
17701 * {{SUBJECTPAGENAME}}
17702 * {{SUBJECTPAGENAMEE}}
17703 * {{NAMESPACEE}}
17704 * {{NAMESPACE}}
17705 * {{NAMESPACENUMBER}}
17706 * {{TALKSPACE}}
17707 * {{TALKSPACEE}}
17708 * {{SUBJECTSPACE}}
17709 * {{SUBJECTSPACEE}}
17710 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
17711 !! html
17712 <ul><li> Parser test</li>
17713 <li> Parser_test</li>
17714 <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> Talk:Parser test</li>
17723 <li> Talk:Parser_test</li>
17724 <li> Parser test</li>
17725 <li> Parser_test</li>
17726 <li> </li>
17727 <li> </li>
17728 <li> 0</li>
17729 <li> Talk</li>
17730 <li> Talk</li>
17731 <li> </li>
17732 <li> </li>
17733 <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>
17734
17735 !! end
17736 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
17737
17738 !! test
17739 Gallery
17740 !! wikitext
17741 <gallery>
17742 image1.png |
17743 image2.gif|||||
17744
17745 image3|
17746 image4 |300px| centre
17747 image5.svg| http://///////
17748 [[x|xx]]]]
17749 * image6
17750 </gallery>
17751 !! html
17752 <ul class="gallery mw-gallery-traditional">
17753 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17754 <div class="thumb" style="height: 150px;">Image1.png</div>
17755 <div class="gallerytext">
17756 </div>
17757 </div></li>
17758 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17759 <div class="thumb" style="height: 150px;">Image2.gif</div>
17760 <div class="gallerytext">
17761 <p>||||
17762 </p>
17763 </div>
17764 </div></li>
17765 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17766 <div class="thumb" style="height: 150px;">Image3</div>
17767 <div class="gallerytext">
17768 </div>
17769 </div></li>
17770 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17771 <div class="thumb" style="height: 150px;">Image4</div>
17772 <div class="gallerytext">
17773 <p>300px| centre
17774 </p>
17775 </div>
17776 </div></li>
17777 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17778 <div class="thumb" style="height: 150px;">Image5.svg</div>
17779 <div class="gallerytext">
17780 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
17781 </p>
17782 </div>
17783 </div></li>
17784 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17785 <div class="thumb" style="height: 150px;">* image6</div>
17786 <div class="gallerytext">
17787 </div>
17788 </div></li>
17789 </ul>
17790
17791 !! end
17792
17793 !! test
17794 Gallery (with options)
17795 !! wikitext
17796 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
17797 File:Nonexistent.jpg|caption
17798 File:Nonexistent.jpg
17799 image:foobar.jpg|some '''caption''' [[Main Page]]
17800 image:foobar.jpg
17801 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
17802 </gallery>
17803 !! html
17804 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
17805 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
17806 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17807 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17808 <div class="gallerytext">
17809 <p>caption
17810 </p>
17811 </div>
17812 </div></li>
17813 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17814 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17815 <div class="gallerytext">
17816 </div>
17817 </div></li>
17818 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17819 <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>
17820 <div class="gallerytext">
17821 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17822 </p>
17823 </div>
17824 </div></li>
17825 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17826 <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>
17827 <div class="gallerytext">
17828 </div>
17829 </div></li>
17830 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17831 <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>
17832 <div class="gallerytext">
17833 <p>Blabla|blabla.
17834 </p>
17835 </div>
17836 </div></li>
17837 </ul>
17838
17839 !! end
17840
17841 !! test
17842 Gallery with link that has fragment
17843 !! wikitext
17844 <gallery>
17845 image:foobar.jpg|link=Main_Page
17846 image:foobar.jpg|link=Main_Page#section
17847 image:foobar.jpg|link=Main Page#section|caption
17848 </gallery>
17849 !! html
17850 <ul class="gallery mw-gallery-traditional">
17851 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17852 <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>
17853 <div class="gallerytext">
17854 </div>
17855 </div></li>
17856 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17857 <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>
17858 <div class="gallerytext">
17859 </div>
17860 </div></li>
17861 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17862 <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>
17863 <div class="gallerytext">
17864 <p>caption
17865 </p>
17866 </div>
17867 </div></li>
17868 </ul>
17869
17870 !! end
17871
17872 !! test
17873 Gallery with wikitext inside caption
17874 !! wikitext
17875 <gallery>
17876 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
17877 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
17878 </gallery>
17879 !! html
17880 <ul class="gallery mw-gallery-traditional">
17881 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17882 <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>
17883 <div class="gallerytext">
17884 <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>
17885 </p>
17886 </div>
17887 </div></li>
17888 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17889 <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>
17890 <div class="gallerytext">
17891 <p>This is a test template
17892 </p>
17893 </div>
17894 </div></li>
17895 </ul>
17896
17897 !! end
17898
17899 !! test
17900 gallery (with showfilename option)
17901 !! wikitext
17902 <gallery showfilename>
17903 File:Nonexistent.jpg|caption
17904 File:Nonexistent.jpg
17905 image:foobar.jpg|some '''caption''' [[Main Page]]
17906 File:Foobar.jpg
17907 </gallery>
17908 !! html
17909 <ul class="gallery mw-gallery-traditional">
17910 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17911 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17912 <div class="gallerytext">
17913 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17914 caption
17915 </p>
17916 </div>
17917 </div></li>
17918 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17919 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17920 <div class="gallerytext">
17921 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17922 </p>
17923 </div>
17924 </div></li>
17925 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17926 <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>
17927 <div class="gallerytext">
17928 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17929 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17930 </p>
17931 </div>
17932 </div></li>
17933 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17934 <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>
17935 <div class="gallerytext">
17936 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17937 </p>
17938 </div>
17939 </div></li>
17940 </ul>
17941
17942 !! end
17943
17944 !! test
17945 Gallery (with namespace-less filenames)
17946 !! wikitext
17947 <gallery>
17948 File:Nonexistent.jpg
17949 Nonexistent.jpg
17950 image:foobar.jpg
17951 foobar.jpg
17952 </gallery>
17953 !! html
17954 <ul class="gallery mw-gallery-traditional">
17955 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17956 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17957 <div class="gallerytext">
17958 </div>
17959 </div></li>
17960 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17961 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17962 <div class="gallerytext">
17963 </div>
17964 </div></li>
17965 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17966 <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>
17967 <div class="gallerytext">
17968 </div>
17969 </div></li>
17970 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17971 <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>
17972 <div class="gallerytext">
17973 </div>
17974 </div></li>
17975 </ul>
17976
17977 !! end
17978
17979 !! test
17980 HTML Hex character encoding (spells the word "JavaScript")
17981 !! options
17982 parsoid=wt2html,wt2wt,html2html
17983 !! wikitext
17984 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
17985 !! html/php
17986 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
17987 </p>
17988 !! html/php+tidy
17989 <p>JavaScript</p>
17990 !! html/parsoid
17991 <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>
17992 !! end
17993
17994 !! test
17995 HTML Hex character encoding bogus encoding (bug 26437 regression check)
17996 !! wikitext
17997 &#xsee;&#XSEE;
17998 !! html/php
17999 <p>&amp;#xsee;&amp;#XSEE;
18000 </p>
18001 !! html/parsoid
18002 <p>&amp;#xsee;&amp;#XSEE;</p>
18003 !! end
18004
18005 !! test
18006 HTML Hex character encoding mixed case
18007 !! options
18008 parsoid=wt2html,wt2wt,html2html
18009 !! wikitext
18010 &#xEE;&#Xee;
18011 !! html/php
18012 <p>&#xee;&#xee;
18013 </p>
18014 !! html/php+tidy
18015 <p>îî</p>
18016 !! html/parsoid
18017 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18018 !! end
18019
18020 !! test
18021 __FORCETOC__ override
18022 !! wikitext
18023 __NEWSECTIONLINK__
18024 __FORCETOC__
18025 !! html/php
18026 <p><br />
18027 </p>
18028 !! end
18029
18030 !! test
18031 ISBN code coverage
18032 !! wikitext
18033 ISBN 978-0-1234-56&#x20;789
18034 !! html
18035 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18036 </p>
18037 !! html+tidy
18038 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18039 !! html/parsoid
18040 <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>
18041 !! end
18042
18043 !! test
18044 ISBN followed by 5 spaces
18045 !! wikitext
18046 ISBN
18047 !! html
18048 <p>ISBN
18049 </p>
18050 !! end
18051
18052 !! test
18053 Double ISBN
18054 !! wikitext
18055 ISBN ISBN 1234567890
18056 !! html/php
18057 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18058 </p>
18059 !! html/parsoid
18060 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18061 !! end
18062
18063 !! test
18064 ISBN with an X
18065 !! wikitext
18066 ISBN 3-462-04561-X
18067 ISBN 080442957X
18068 ISBN 978080442957X
18069 !! html/php
18070 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18071 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18072 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18073 </p>
18074 !! html/parsoid
18075 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18076 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18077 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a></p>
18078 !! end
18079
18080 !! test
18081 ISBN with empty prefix (parsoid test)
18082 !! wikitext
18083 ISBN 1234567890
18084 !! html/php
18085 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18086 </p>
18087 !! html/parsoid
18088 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
18089 !! end
18090
18091 !! test
18092 Bug 22905: <abbr> followed by ISBN followed by </a>
18093 !! wikitext
18094 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18095 !! html/php
18096 <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>
18097 </p>
18098 !! html/parsoid
18099 <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>
18100 !! end
18101
18102 !! test
18103 Double RFC
18104 !! wikitext
18105 RFC RFC 1234
18106 !! html
18107 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18108 </p>
18109 !! end
18110
18111 !! test
18112 Double RFC with a wiki link
18113 !! wikitext
18114 RFC [[RFC 1234]]
18115 !! html
18116 <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>
18117 </p>
18118 !! end
18119
18120 !! test
18121 RFC code coverage
18122 !! wikitext
18123 RFC 983&#x20;987
18124 !! html
18125 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18126 </p>
18127 !! html+tidy
18128 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18129 !! end
18130
18131 !! test
18132 Centre-aligned image
18133 !! wikitext
18134 [[Image:foobar.jpg|centre]]
18135 !! html
18136 <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>
18137
18138 !!end
18139
18140 !! test
18141 None-aligned image
18142 !! wikitext
18143 [[Image:foobar.jpg|none]]
18144 !! html
18145 <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>
18146
18147 !!end
18148
18149 !! test
18150 Width + Height sized image (using px) (height is ignored)
18151 !! wikitext
18152 [[Image:foobar.jpg|640x480px]]
18153 !! html
18154 <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>
18155 </p>
18156 !!end
18157
18158 !! test
18159 Width-sized image (using px, no following whitespace)
18160 !! wikitext
18161 [[Image:foobar.jpg|640px]]
18162 !! html
18163 <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>
18164 </p>
18165 !!end
18166
18167 !! test
18168 Width-sized image (using px, with following whitespace - test regression from r39467)
18169 !! wikitext
18170 [[Image:foobar.jpg|640px ]]
18171 !! html
18172 <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>
18173 </p>
18174 !!end
18175
18176 !! test
18177 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18178 !! wikitext
18179 [[Image:foobar.jpg| 640px]]
18180 !! html
18181 <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>
18182 </p>
18183 !!end
18184
18185 !! test
18186 Image with page parameter
18187 !! options
18188 djvu
18189 !! wikitext
18190 [[File:LoremIpsum.djvu|page=2]]
18191 !! html/php
18192 <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>
18193 </p>
18194 !! html/parsoid
18195 <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>
18196 !! end
18197
18198 !! test
18199 Another italics / bold test
18200 !! wikitext
18201 ''' ''x'
18202 !! html
18203 <pre>'<i> </i>x'
18204 </pre>
18205 !!end
18206
18207 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18208 !! test
18209 dt/dd/dl test
18210 !! wikitext
18211 :;;;::
18212 !! html/php
18213 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18214
18215 !! html/parsoid
18216 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18217
18218 !!end
18219
18220
18221 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18222 !! test
18223 Images with the "|" character in the comment
18224 !! wikitext
18225 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18226 !! html/php
18227 <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>
18228
18229 !! html/parsoid
18230 <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>
18231 !! end
18232
18233 !! test
18234 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18235 !! wikitext
18236 <html><script>alert(1);</script></html>
18237 !! html
18238 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18239 </p>
18240 !! end
18241
18242 !! test
18243 HTML with raw HTML ($wgRawHtml==true)
18244 !! options
18245 wgRawHtml=1
18246 !! wikitext
18247 <html><script>alert(1);</script></html>
18248 !! html
18249 <p><script>alert(1);</script>
18250 </p>
18251 !! end
18252
18253 !! test
18254 Parents of subpages, one level up
18255 !! options
18256 subpage title=[[Subpage test/L1/L2/L3]]
18257 !! wikitext
18258 [[../|L2]]
18259 !! html
18260 <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>
18261 </p>
18262 !! end
18263
18264
18265 !! test
18266 Parents of subpages, one level up, not named
18267 !! options
18268 subpage title=[[Subpage test/L1/L2/L3]]
18269 !! wikitext
18270 [[../]]
18271 !! html
18272 <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>
18273 </p>
18274 !! end
18275
18276
18277
18278 !! test
18279 Parents of subpages, two levels up
18280 !! options
18281 subpage title=[[Subpage test/L1/L2/L3]]
18282 !! wikitext
18283 [[../../|L1]]2
18284
18285 [[../../|L1]]l
18286 !! html
18287 <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
18288 </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>
18289 </p>
18290 !! end
18291
18292 !! test
18293 Parents of subpages, two levels up, without trailing slash or name.
18294 !! options
18295 subpage title=[[Subpage test/L1/L2/L3]]
18296 !! wikitext
18297 [[../..]]
18298 !! html
18299 <p>[[../..]]
18300 </p>
18301 !! end
18302
18303 !! test
18304 Parents of subpages, two levels up, with lots of extra trailing slashes.
18305 !! options
18306 subpage title=[[Subpage test/L1/L2/L3]]
18307 !! wikitext
18308 [[../../////]]
18309 !! html
18310 <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>
18311 </p>
18312 !! end
18313
18314 !! article
18315 Subpage test/L1/L2/L3Sibling
18316 !! text
18317 Sibling article
18318 !! endarticle
18319
18320 !! test
18321 Transclusion of a sibling page (one level up)
18322 !! options
18323 subpage title=[[Subpage test/L1/L2/L3]]
18324 !! wikitext
18325 {{../L3Sibling}}
18326 !! html
18327 <p>Sibling article
18328 </p>
18329 !! end
18330
18331 !! test
18332 Transclusion of a child page
18333 !! options
18334 subpage title=[[Subpage test/L1/L2]]
18335 !! wikitext
18336 {{/L3Sibling}}
18337 !! html
18338 <p>Sibling article
18339 </p>
18340 !! end
18341
18342 !! test
18343 Non-transclusion because of too many up levels
18344 !! options
18345 subpage title=[[Subpage test/L1/L2/L3]]
18346 !! wikitext
18347 {{../../../../More than parent}}
18348 !! html
18349 <p>{{../../../../More than parent}}
18350 </p>
18351 !! end
18352
18353 !! test
18354 Definition list code coverage
18355 !! wikitext
18356 ; title : def
18357 ; title : def
18358 ;title: def
18359 !! html/php
18360 <dl><dt> title &#160;</dt>
18361 <dd> def</dd>
18362 <dt> title&#160;</dt>
18363 <dd> def</dd>
18364 <dt>title</dt>
18365 <dd> def</dd></dl>
18366
18367 !! html/parsoid
18368 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18369 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18370 <dt>title</dt><dd> def</dd></dl>
18371 !! end
18372
18373 !! test
18374 Don't fall for the self-closing div
18375 !! wikitext
18376 <div>hello world</div/>
18377 !! html
18378 <div>hello world</div>
18379
18380 !! end
18381
18382 !! test
18383 MSGNW magic word
18384 !! wikitext
18385 {{MSGNW:msg}}
18386 !! html/php
18387 <p>&#91;&#91;:Template:Msg&#93;&#93;
18388 </p>
18389 !! end
18390
18391 !! test
18392 RAW magic word
18393 !! wikitext
18394 {{RAW:QUERTY}}
18395 !! html
18396 <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>
18397 </p>
18398 !! end
18399
18400 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
18401 !! test
18402 Always escape literal '>' in output, not just after '<'
18403 !! wikitext
18404 ><>
18405 !! html
18406 <p>&gt;&lt;&gt;
18407 </p>
18408 !! end
18409
18410 !! test
18411 Template caching
18412 !! wikitext
18413 {{Test}}
18414 {{Test}}
18415 !! html
18416 <p>This is a test template
18417 This is a test template
18418 </p>
18419 !! end
18420
18421
18422 !! article
18423 MediaWiki:Fake
18424 !! text
18425 ==header==
18426 !! endarticle
18427
18428 !! test
18429 Inclusion of !userCanEdit() content
18430 !! wikitext
18431 {{MediaWiki:Fake}}
18432 !! html
18433 <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>
18434
18435 !! end
18436
18437
18438 !! test
18439 Out-of-order TOC heading levels
18440 !! wikitext
18441 ==2==
18442 ======6======
18443 ===3===
18444 =1=
18445 =====5=====
18446 ==2==
18447 !! html
18448 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18449 <ul>
18450 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
18451 <ul>
18452 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
18453 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
18454 </ul>
18455 </li>
18456 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
18457 <ul>
18458 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
18459 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
18460 </ul>
18461 </li>
18462 </ul>
18463 </div>
18464
18465 <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>
18466 <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>
18467 <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>
18468 <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>
18469 <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>
18470 <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>
18471
18472 !! end
18473
18474
18475 !! test
18476 ISBN with a dummy number
18477 !! wikitext
18478 ISBN ---
18479 !! html
18480 <p>ISBN ---
18481 </p>
18482 !! end
18483
18484
18485 !! test
18486 ISBN with space-delimited number
18487 !! wikitext
18488 ISBN 92 9017 032 8
18489 !! html
18490 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
18491 </p>
18492 !! end
18493
18494
18495 !! test
18496 ISBN with multiple spaces, no number
18497 !! wikitext
18498 ISBN foo
18499 !! html
18500 <p>ISBN foo
18501 </p>
18502 !! end
18503
18504
18505 !! test
18506 ISBN length
18507 !! wikitext
18508 ISBN 123456789
18509
18510 ISBN 1234567890
18511
18512 ISBN 12345678901
18513 !! html
18514 <p>ISBN 123456789
18515 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18516 </p><p>ISBN 12345678901
18517 </p>
18518 !! end
18519
18520
18521 !! test
18522 ISBN with trailing year (bug 8110)
18523 !! wikitext
18524 ISBN 1-234-56789-0 - 2006
18525
18526 ISBN 1 234 56789 0 - 2006
18527 !! html
18528 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
18529 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
18530 </p>
18531 !! end
18532
18533
18534 !! test
18535 anchorencode
18536 !! wikitext
18537 {{anchorencode:foo bar©#%n}}
18538 !! html
18539 <p>foo_bar.C2.A9.23.25n
18540 </p>
18541 !! end
18542
18543 !! test
18544 anchorencode trims spaces
18545 !! wikitext
18546 {{anchorencode: __pretty__please__}}
18547 !! html
18548 <p>pretty_please
18549 </p>
18550 !! end
18551
18552 !! test
18553 anchorencode deals with links
18554 !! wikitext
18555 {{anchorencode: [[hello|world]] [[hi]]}}
18556 !! html
18557 <p>world_hi
18558 </p>
18559 !! end
18560
18561 !! test
18562 anchorencode deals with templates
18563 !! wikitext
18564 {{anchorencode: {{Foo}} }}
18565 !! html
18566 <p>FOO
18567 </p>
18568 !! end
18569
18570 !! test
18571 anchorencode encodes like the TOC generator: (bug 18431)
18572 !! wikitext
18573 === _ +:.3A%3A&&amp;]] ===
18574 {{anchorencode: _ +:.3A%3A&&amp;]] }}
18575 __NOEDITSECTION__
18576 !! html
18577 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
18578 <p>.2B:.3A.253A.26.26.5D.5D
18579 </p>
18580 !! end
18581
18582 !! test
18583 Bug 6200: blockquotes and paragraph formatting
18584 !! wikitext
18585 <blockquote>
18586 foo
18587 </blockquote>
18588
18589 bar
18590
18591 baz
18592 !! html
18593 <blockquote>
18594 <p>foo
18595 </p>
18596 </blockquote>
18597 <p>bar
18598 </p>
18599 <pre>baz
18600 </pre>
18601 !! end
18602
18603 !! test
18604 Bug 8293: Use of center tag ruins paragraph formatting
18605 !! wikitext
18606 <center>
18607 foo
18608 </center>
18609
18610 bar
18611
18612 baz
18613 !! html
18614 <center>
18615 <p>foo
18616 </p>
18617 </center>
18618 <p>bar
18619 </p>
18620 <pre>baz
18621 </pre>
18622 !! end
18623
18624 !!test
18625 Parsing of overlapping (improperly nested) inline html tags
18626 !! wikitext
18627 <span><s>x</span></s>
18628 !! html/php
18629 <p><span><s>x&lt;/span&gt;</s></span>
18630 </p>
18631 !! html/parsoid
18632 <p><span><s>x</s></span>
18633 </p>
18634 !!end
18635
18636 ###
18637 ### Language variants related tests
18638 ###
18639 !! test
18640 Self-link in language variants
18641 !! options
18642 title=[[Dunav]] language=sr
18643 !! wikitext
18644 Both [[Dunav]] and [[Дунав]] are names for this river.
18645 !! html
18646 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
18647 </p>
18648 !!end
18649
18650 !! article
18651 Дуна
18652 !! text
18653 content
18654 !! endarticle
18655
18656 !! test
18657 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
18658 !! options
18659 title=[[Duna]] language=sr
18660 !! wikitext
18661 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
18662 !! html
18663 <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.
18664 </p>
18665 !! end
18666
18667 !! test
18668 Link to a section of a variant of this title shouldn't be parsed as self-link
18669 !! options
18670 title=[[Duna]] language=sr
18671 !! wikitext
18672 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
18673 !! html
18674 <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.
18675 </p>
18676 !! end
18677
18678 !! test
18679 Link to pages in language variants
18680 !! options
18681 language=sr
18682 !! wikitext
18683 Main Page can be written as [[Маин Паге]]
18684 !! html
18685 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
18686 </p>
18687 !!end
18688
18689
18690 !! test
18691 Multiple links to pages in language variants
18692 !! options
18693 language=sr
18694 !! wikitext
18695 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
18696 !! html
18697 <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>.
18698 </p>
18699 !!end
18700
18701
18702 !! test
18703 Simple template in language variants
18704 !! options
18705 language=sr
18706 !! wikitext
18707 {{тест}}
18708 !! html
18709 <p>This is a test template
18710 </p>
18711 !! end
18712
18713
18714 !! test
18715 Template with explicit namespace in language variants
18716 !! options
18717 language=sr
18718 !! wikitext
18719 {{Template:тест}}
18720 !! html
18721 <p>This is a test template
18722 </p>
18723 !! end
18724
18725
18726 !! test
18727 Basic test for template parameter in language variants
18728 !! options
18729 language=sr
18730 !! wikitext
18731 {{парамтест|param=foo}}
18732 !! html
18733 <p>This is a test template with parameter foo
18734 </p>
18735 !! end
18736
18737
18738 !! test
18739 Simple category in language variants
18740 !! options
18741 language=sr cat
18742 !! wikitext
18743 [[Category:МедиаWики Усер'с Гуиде]]
18744 !! html
18745 <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>
18746 !! end
18747
18748
18749 !! article
18750 Category:分类
18751 !! text
18752 blah
18753 !! endarticle
18754
18755 !! article
18756 Category:分類
18757 !! text
18758 blah
18759 !! endarticle
18760
18761 !! test
18762 Don't convert blue categorylinks to another variant (bug 33210)
18763 !! options
18764 language=zh cat
18765 !! wikitext
18766 [[A]][[Category:分类]]
18767 !! html
18768 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
18769 !! end
18770
18771
18772 !! test
18773 Stripping -{}- tags (language variants)
18774 !! options
18775 language=sr
18776 !! wikitext
18777 Latin proverb: -{Ne nuntium necare}-
18778 !! html
18779 <p>Latin proverb: Ne nuntium necare
18780 </p>
18781 !! end
18782
18783
18784 !! test
18785 Prevent conversion with -{}- tags (language variants)
18786 !! options
18787 language=sr variant=sr-ec
18788 !! wikitext
18789 Latinski: -{Ne nuntium necare}-
18790 !! html
18791 <p>Латински: Ne nuntium necare
18792 </p>
18793 !! end
18794
18795
18796 !! test
18797 Prevent conversion of text with -{}- tags (language variants)
18798 !! options
18799 language=sr variant=sr-ec
18800 !! wikitext
18801 Latinski: -{Ne nuntium necare}-
18802 !! html
18803 <p>Латински: Ne nuntium necare
18804 </p>
18805 !! end
18806
18807
18808 !! test
18809 Prevent conversion of links with -{}- tags (language variants)
18810 !! options
18811 language=sr variant=sr-ec
18812 !! wikitext
18813 -{[[Main Page]]}-
18814 !! html
18815 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18816 </p>
18817 !! end
18818
18819
18820 !! test
18821 -{}- tags within headlines (within html for parserConvert())
18822 !! options
18823 language=sr variant=sr-ec
18824 !! wikitext
18825 == -{Naslov}- ==
18826 !! html
18827 <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>
18828
18829 !! end
18830
18831
18832 !! test
18833 Explicit definition of language variant alternatives
18834 !! options
18835 language=zh variant=zh-tw
18836 !! wikitext
18837 -{zh:China;zh-tw:Taiwan}-, not China
18838 !! html
18839 <p>Taiwan, not China
18840 </p>
18841 !! end
18842
18843
18844 !! test
18845 Conversion around HTML tags
18846 !! options
18847 language=sr variant=sr-ec
18848 !! wikitext
18849 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
18850 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
18851 !! html
18852 <p>
18853 <span title="ЛаCтин">ски</span>
18854 </p>
18855 !! end
18856
18857
18858 !! test
18859 Explicit session-wise language variant mapping (A flag and - flag)
18860 !! options
18861 language=zh variant=zh-tw
18862 !! wikitext
18863 Taiwan is not China.
18864 But -{A|zh:China;zh-tw:Taiwan}- is China,
18865 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
18866 and -{China}- is China.
18867 !! html
18868 <p>Taiwan is not China.
18869 But Taiwan is Taiwan,
18870 (This should be stripped!)
18871 and China is China.
18872 </p>
18873 !! end
18874
18875 !! test
18876 Explicit session-wise language variant mapping (H flag for hide)
18877 !! options
18878 language=zh variant=zh-tw
18879 !! wikitext
18880 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
18881 Taiwan is China.
18882 !! html
18883 <p>(This should be stripped!)
18884 Taiwan is Taiwan.
18885 </p>
18886 !! end
18887
18888 !! test
18889 Adding explicit conversion rule for title (T flag)
18890 !! options
18891 language=zh variant=zh-tw showtitle
18892 !! wikitext
18893 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18894 !! html
18895 Taiwan
18896 <p>Should be stripped!
18897 </p>
18898 !! end
18899
18900 !! test
18901 Testing that changing the language variant here in the tests actually works
18902 !! options
18903 language=zh variant=zh showtitle
18904 !! wikitext
18905 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18906 !! html
18907 China
18908 <p>Should be stripped!
18909 </p>
18910 !! end
18911
18912 !! test
18913 Recursive conversion of alt and title attrs shouldn't clear converter state
18914 !! options
18915 language=zh variant=zh-cn showtitle
18916 !! wikitext
18917 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
18918 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
18919 !! html
18920 China
18921 <p>
18922 Should be stripped<span title="Exclamation">!</span>
18923 </p>
18924 !! end
18925
18926 !! test
18927 Bug 24072: more test on conversion rule for title
18928 !! options
18929 language=zh variant=zh-tw showtitle
18930 !! wikitext
18931 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18932 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
18933 !! html
18934 Taiwan
18935 <p>This should be stripped!
18936 This won't take interferes with the title rule.
18937 </p>
18938 !! end
18939
18940 !! test
18941 Partly disable title conversion if variant == main language code
18942 !! options
18943 language=zh variant=zh title=[[ZH]] showtitle
18944 !! wikitext
18945 -{T|zh-cn:CN;zh-tw:TW}-
18946 !! html
18947 ZH
18948 <p>
18949 </p>
18950 !! end
18951
18952 !! test
18953 Partly disable title conversion if variant == main language code, more
18954 !! options
18955 language=zh variant=zh title=[[ZH]] showtitle
18956 !! wikitext
18957 -{T|TW}-
18958 !! html
18959 ZH
18960 <p>
18961 </p>
18962 !! end
18963
18964 !! test
18965 Raw output of variant escape tags (R flag)
18966 !! options
18967 language=zh variant=zh-tw
18968 !! wikitext
18969 Raw: -{R|zh:China;zh-tw:Taiwan}-
18970 !! html
18971 <p>Raw: zh:China;zh-tw:Taiwan
18972 </p>
18973 !! end
18974
18975 !! test
18976 Strings evaluating false shouldn't be ignored by Language converter (T51072)
18977 !! options
18978 language=zh variant=zh-cn
18979 !! input
18980 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
18981 !! result
18982 <p>0
18983 </p>
18984 !! end
18985
18986 !! test
18987 Conversion rules from [numeric-only string] to [something else] (T48634)
18988 !! options
18989 language=zh variant=zh-cn
18990 !! input
18991 -{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
18992 !! result
18993 <p>D12345EE12345
18994 </p>
18995 !! end
18996
18997 !! test
18998 Bidirectional converter rule entries with an empty value should be ignored (T53551)
18999 !! options
19000 language=zh variant=zh-cn
19001 !! input
19002 -{H|zh-cn:foo;zh-tw:;}-foobar
19003 !! result
19004 <p>foobar
19005 </p>
19006 !! end
19007
19008 !! test
19009 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19010 !! options
19011 language=zh variant=zh-cn
19012 !! input
19013 -{H|=>zh-cn:foo;}-foobar
19014 !! result
19015 <p>foobar
19016 </p>
19017 !! end
19018
19019 !! test
19020 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19021 !! options
19022 language=zh variant=zh-cn
19023 !! input
19024 -{H|}-foobar
19025 !! result
19026 <p>foobar
19027 </p>
19028 !! end
19029
19030 !! test
19031 Nested using of manual convert syntax
19032 !! options
19033 language=zh variant=zh-hk
19034 !! wikitext
19035 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19036 !! html
19037 <p>Nested: Hello Hong Kong!
19038 </p>
19039 !! end
19040
19041 !! test
19042 Proper conversion of text in external links
19043 !! options
19044 language=sr variant=sr-ec
19045 !! wikitext
19046 http://www.google.com
19047 gopher://www.google.com
19048 [http://www.google.com http://www.google.com]
19049 [gopher://www.google.com gopher://www.google.com]
19050 [https://www.google.com irc://www.google.com]
19051 [ftp://www.google.com www.google.com/ftp://dir]
19052 [//www.google.com www.google.com]
19053 !! html
19054 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19055 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19056 <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 text" href="https://www.google.com">irc://www.google.com</a>
19059 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19060 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19061 </p>
19062 !! end
19063
19064 !! test
19065 Do not convert roman numbers to language variants
19066 !! options
19067 language=sr variant=sr-ec
19068 !! wikitext
19069 Fridrih IV je car.
19070 !! html
19071 <p>Фридрих IV је цар.
19072 </p>
19073 !! end
19074
19075 !! test
19076 Unclosed language converter markup "-{"
19077 !! options
19078 language=sr
19079 !! wikitext
19080 -{T|hello
19081 !! html
19082 <p>-{T|hello
19083 </p>
19084 !! end
19085
19086 !! test
19087 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19088 !! options
19089 language=sr
19090 !! wikitext
19091 -{R|=&gt;}-
19092 !! html
19093 <p>=&gt;
19094 </p>
19095 !!end
19096
19097 !! test
19098 Don't break link parsing if language converter markup is in the caption.
19099 !! options
19100 language=sr variant=sr-ec
19101 !! wikitext
19102 [[Main Page|-{R|main page}-]]
19103 !! html
19104 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19105 </p>
19106 !! end
19107
19108 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19109 !! test
19110 Don't break image parsing if language converter markup is in the caption.
19111 !! options
19112 language=sr
19113 !! wikitext
19114 [[File:Foobar.jpg|-{R|caption}-]]
19115 !! html/parsoid
19116 <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>
19117 </p>
19118 !! end
19119
19120 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19121 !! test
19122 Don't break list handling if language converter markup is in the item.
19123 !! options
19124 language=zh variant=zh-cn
19125 !! wikitext
19126 ;-{zh-cn:AAA;zh-tw:BBB}-
19127 !! html/php
19128 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19129
19130 !! html/parsoid
19131 <dl><dt>AAA
19132 </dt></dl>
19133 !! end
19134
19135 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19136 !! test
19137 Don't break table handling if language converter markup is in the cell.
19138 !! options
19139 language=sr variant=sr-ec
19140 !! wikitext
19141 {|
19142 |-
19143 | -{R|B}-
19144 |}
19145 !! html/php
19146 <table>
19147
19148 <tr>
19149 <td>Б}-
19150 </td></tr></table>
19151
19152 !! html/parsoid
19153 <table>
19154
19155 <tr>
19156 <td> B
19157 </td></tr></table>
19158
19159 !! end
19160
19161 !! test
19162 Bug 529: Uncovered bullet
19163 !! wikitext
19164 * Foo {{bullet}}
19165 !! html
19166 <ul><li> Foo </li>
19167 <li> Bar</li></ul>
19168
19169 !! end
19170
19171 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19172 # Templates in Wikipedia rely on this behavior, as tidy has always been
19173 # enabled there. These tests are normally run *without* tidy, so specify the
19174 # full output here.
19175 # To test realistic parsing behavior, apply a tidy-like transformation to both
19176 # the expected output and your parser's output.
19177 !! test
19178 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19179 !! wikitext
19180 ******* Foo {{bullet}}
19181 !! html
19182 <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>
19183 <li> Bar</li></ul>
19184
19185 !! end
19186
19187 !! test
19188 Bug 529: Uncovered table already at line-start
19189 !! wikitext
19190 x
19191
19192 {{table}}
19193 y
19194 !! html
19195 <p>x
19196 </p>
19197 <table>
19198 <tr>
19199 <td> 1 </td>
19200 <td> 2
19201 </td></tr>
19202 <tr>
19203 <td> 3 </td>
19204 <td> 4
19205 </td></tr></table>
19206 <p>y
19207 </p>
19208 !! end
19209
19210 !! test
19211 Bug 529: Uncovered bullet in parser function result
19212 !! wikitext
19213 * Foo {{lc:{{bullet}} }}
19214 !! html
19215 <ul><li> Foo </li>
19216 <li> bar</li></ul>
19217
19218 !! end
19219
19220 !! test
19221 Bug 5678: Double-parsed template argument
19222 !! wikitext
19223 {{lc:{{{1}}}|hello}}
19224 !! html
19225 <p>{{{1}}}
19226 </p>
19227 !! end
19228
19229 !! test
19230 Bug 5678: Double-parsed template invocation
19231 !! wikitext
19232 {{lc:{{paramtest {{!}} param = hello }} }}
19233 !! html
19234 <p>{{paramtest | param = hello }}
19235 </p>
19236 !! end
19237
19238 !! test
19239 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19240 !! options
19241 language=cs
19242 title=[[Main Page]]
19243 !! wikitext
19244 {{PRVNÍVELKÉ:ěščř}}
19245 {{prvnívelké:ěščř}}
19246 {{PRVNÍMALÉ:ěščř}}
19247 {{prvnímalé:ěščř}}
19248 {{MALÁ:ěščř}}
19249 {{malá:ěščř}}
19250 {{VELKÁ:ěščř}}
19251 {{velká:ěščř}}
19252 !! html
19253 <p>Ěščř
19254 Ěščř
19255 ěščř
19256 ěščř
19257 ěščř
19258 ěščř
19259 ĚŠČŘ
19260 ĚŠČŘ
19261 </p>
19262 !! end
19263
19264 !! test
19265 Morwen/13: Unclosed link followed by heading
19266 !! wikitext
19267 [[link
19268 ==heading==
19269 !! html
19270 <p>[[link
19271 </p>
19272 <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>
19273
19274 !! end
19275
19276 !! test
19277 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19278 !! wikitext
19279 {{foo|
19280 =heading=
19281 !! html
19282 <p>{{foo|
19283 </p>
19284 <h1><span class="mw-headline" id="heading">heading</span></h1>
19285
19286 !! end
19287
19288 !! test
19289 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19290 !! wikitext
19291 {{foo|
19292 ==heading==
19293 !! html
19294 <p>{{foo|
19295 </p>
19296 <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>
19297
19298 !! end
19299
19300 !! test
19301 Tildes in comments
19302 !! options
19303 pst
19304 !! wikitext
19305 <!-- ~~~~ -->
19306 !! html
19307 <!-- ~~~~ -->
19308 !! end
19309
19310 !! test
19311 Paragraphs inside divs (no extra line breaks)
19312 !! wikitext
19313 <div>Line one
19314
19315 Line two</div>
19316 !! html
19317 <div>Line one
19318 Line two</div>
19319
19320 !! end
19321
19322 !! test
19323 Paragraphs inside divs (extra line break on open)
19324 !! wikitext
19325 <div>
19326 Line one
19327
19328 Line two</div>
19329 !! html
19330 <div>
19331 <p>Line one
19332 </p>
19333 Line two</div>
19334
19335 !! end
19336
19337 !! test
19338 Paragraphs inside divs (extra line break on close)
19339 !! wikitext
19340 <div>Line one
19341
19342 Line two
19343 </div>
19344 !! html
19345 <div>Line one
19346 <p>Line two
19347 </p>
19348 </div>
19349
19350 !! end
19351
19352 !! test
19353 Paragraphs inside divs (extra line break on open and close)
19354 !! wikitext
19355 <div>
19356 Line one
19357
19358 Line two
19359 </div>
19360 !! html
19361 <div>
19362 <p>Line one
19363 </p><p>Line two
19364 </p>
19365 </div>
19366
19367 !! end
19368
19369 !! test
19370 Nesting tags, paragraphs on lines which begin with <div>
19371 !! wikitext
19372 <div></div><strong>A
19373 B</strong>
19374 !! html/php+tidy
19375 <p><strong>A</strong></p>
19376 <p><strong>B</strong></p>
19377 !! html/parsoid
19378 <div></div>
19379 <p><strong>A
19380 B</strong>
19381 </p>
19382 !! end
19383
19384 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
19385 !! test
19386 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
19387 !! wikitext
19388 <blockquote>Line one
19389
19390 Line two</blockquote>
19391 !! html
19392 <blockquote>Line one
19393 Line two</blockquote>
19394
19395 !! html+tidy
19396 <blockquote>
19397 <p>Line one Line two</p>
19398 </blockquote>
19399 !! end
19400
19401 !! test
19402 Bug 6200: paragraphs inside blockquotes (extra line break on open)
19403 !! wikitext
19404 <blockquote>
19405 Line one
19406
19407 Line two</blockquote>
19408 !! html
19409 <blockquote>
19410 <p>Line one
19411 </p>
19412 Line two</blockquote>
19413
19414 !! html+tidy
19415 <blockquote>
19416 <p>Line one</p>
19417 Line two</blockquote>
19418 !! end
19419
19420 !! test
19421 Bug 6200: paragraphs inside blockquotes (extra line break on close)
19422 !! wikitext
19423 <blockquote>Line one
19424
19425 Line two
19426 </blockquote>
19427 !! html
19428 <blockquote>Line one
19429 <p>Line two
19430 </p>
19431 </blockquote>
19432
19433 !! html+tidy
19434 <blockquote>
19435 <p>Line one</p>
19436 <p>Line two</p>
19437 </blockquote>
19438 !! end
19439
19440 !! test
19441 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
19442 !! wikitext
19443 <blockquote>
19444 Line one
19445
19446 Line two
19447 </blockquote>
19448 !! html
19449 <blockquote>
19450 <p>Line one
19451 </p><p>Line two
19452 </p>
19453 </blockquote>
19454
19455 !! html+tidy
19456 <blockquote>
19457 <p>Line one</p>
19458 <p>Line two</p>
19459 </blockquote>
19460 !! end
19461
19462 !! test
19463 Paragraphs inside blockquotes/divs (no extra line breaks)
19464 !! wikitext
19465 <blockquote><div>Line one
19466
19467 Line two</div></blockquote>
19468 !! html
19469 <blockquote><div>Line one
19470 Line two</div></blockquote>
19471
19472 !! end
19473
19474 !! test
19475 Paragraphs inside blockquotes/divs (extra line break on open)
19476 !! wikitext
19477 <blockquote><div>
19478 Line one
19479
19480 Line two</div></blockquote>
19481 !! html
19482 <blockquote><div>
19483 <p>Line one
19484 </p>
19485 Line two</div></blockquote>
19486
19487 !! end
19488
19489 !! test
19490 Paragraphs inside blockquotes/divs (extra line break on close)
19491 !! wikitext
19492 <blockquote><div>Line one
19493
19494 Line two
19495 </div></blockquote>
19496 !! html
19497 <blockquote><div>Line one
19498 <p>Line two
19499 </p>
19500 </div></blockquote>
19501
19502 !! end
19503
19504 !! test
19505 Paragraphs inside blockquotes/divs (extra line break on open and close)
19506 !! wikitext
19507 <blockquote><div>
19508 Line one
19509
19510 Line two
19511 </div></blockquote>
19512 !! html
19513 <blockquote><div>
19514 <p>Line one
19515 </p><p>Line two
19516 </p>
19517 </div></blockquote>
19518
19519 !! end
19520
19521 !! test
19522 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
19523 !! options
19524 wgLinkHolderBatchSize=0
19525 !! wikitext
19526 [[meatball:1]]
19527 [[meatball:2]]
19528 [[meatball:3]]
19529 !! html
19530 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
19531 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
19532 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
19533 </p>
19534 !! end
19535
19536 !! test
19537 Free external link invading image caption
19538 !! wikitext
19539 [[Image:Foobar.jpg|thumb|http://x|hello]]
19540 !! html
19541 <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>
19542
19543 !! end
19544
19545 !! test
19546 Bug 15196: localised external link numbers
19547 !! options
19548 language=fa
19549 !! wikitext
19550 [http://en.wikipedia.org/]
19551 !! html/php
19552 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
19553 </p>
19554 !! html/parsoid
19555 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
19556 !! end
19557
19558 !! test
19559 Multibyte character in padleft
19560 !! wikitext
19561 {{padleft:-Hello|7|Æ}}
19562 !! html
19563 <p>Æ-Hello
19564 </p>
19565 !! end
19566
19567 !! test
19568 Multibyte character in padright
19569 !! wikitext
19570 {{padright:Hello-|7|Æ}}
19571 !! html
19572 <p>Hello-Æ
19573 </p>
19574 !! end
19575
19576 !!test
19577 formatdate parser function
19578 !! wikitext
19579 {{#formatdate:2009-03-24}}
19580 !! html
19581 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
19582 </p>
19583 !! end
19584
19585 !!test
19586 formatdate parser function, with default format
19587 !! wikitext
19588 {{#formatdate:2009-03-24|mdy}}
19589 !! html
19590 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
19591 </p>
19592 !! end
19593
19594 !! test
19595 Spacing of numbers in formatted dates
19596 !! wikitext
19597 {{#formatdate:January 15}}
19598 !! html
19599 <p><span class="mw-formatted-date" title="01-15">January 15</span>
19600 </p>
19601 !! end
19602
19603 !! test
19604 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
19605 !! options
19606 language=nl title=[[MediaWiki:Common.css]]
19607 !! wikitext
19608 {{#formatdate:2009-03-24|dmy}}
19609 !! html
19610 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
19611 </p>
19612 !! end
19613
19614 #
19615 #
19616 #
19617
19618 #
19619 # Edit comments
19620 #
19621
19622 !! test
19623 Edit comment with link
19624 !! options
19625 comment
19626 !! wikitext
19627 I like the [[Main Page]] a lot
19628 !! html
19629 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
19630 !!end
19631
19632 !! test
19633 Edit comment with link and link text
19634 !! options
19635 comment
19636 !! wikitext
19637 I like the [[Main Page|best pages]] a lot
19638 !! html
19639 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19640 !!end
19641
19642 !! test
19643 Edit comment with link and link text with suffix
19644 !! options
19645 comment
19646 !! wikitext
19647 I like the [[Main Page|best page]]s a lot
19648 !! html
19649 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19650 !!end
19651
19652 !! test
19653 Edit comment with section link (non-local, eg in history list)
19654 !! options
19655 comment title=[[Main Page]]
19656 !! wikitext
19657 /* External links */ removed bogus entries
19658 !! html
19659 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19660 !!end
19661
19662 !! test
19663 Edit comment with section link and text before it (non-local, eg in history list)
19664 !! options
19665 comment title=[[Main Page]]
19666 !! wikitext
19667 pre-comment text /* External links */ removed bogus entries
19668 !! html
19669 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>
19670 !!end
19671
19672 !! test
19673 Edit comment with section link (local, eg in diff view)
19674 !! options
19675 comment local title=[[Main Page]]
19676 !! wikitext
19677 /* External links */ removed bogus entries
19678 !! html
19679 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19680 !!end
19681
19682 !! test
19683 Edit comment with subpage link (bug 14080)
19684 !! options
19685 comment
19686 subpage
19687 title=[[Subpage test]]
19688 !! wikitext
19689 Poked at a [[/subpage]] here...
19690 !! html
19691 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
19692 !!end
19693
19694 !! test
19695 Edit comment with subpage link and link text (bug 14080)
19696 !! options
19697 comment
19698 subpage
19699 title=[[Subpage test]]
19700 !! wikitext
19701 Poked at a [[/subpage|neat little page]] here...
19702 !! html
19703 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
19704 !!end
19705
19706 !! test
19707 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
19708 !! options
19709 comment
19710 title=[[Subpage test]]
19711 !! wikitext
19712 Poked at a [[/subpage]] here...
19713 !! html
19714 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...
19715 !!end
19716
19717 !! test
19718 Edit comment with bare anchor link (local, as on diff)
19719 !! options
19720 comment
19721 local
19722 title=[[Main Page]]
19723 !! wikitext
19724 [[#section]]
19725 !! html
19726 <a href="#section">#section</a>
19727 !! end
19728
19729 !! test
19730 Edit comment with bare anchor link (non-local, as on history)
19731 !! options
19732 comment
19733 title=[[Main Page]]
19734 !! wikitext
19735 [[#section]]
19736 !! html
19737 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
19738 !! end
19739
19740 !! test
19741 Anchor starting with underscore
19742 !! wikitext
19743 [[#_ref|One]]
19744 !! html
19745 <p><a href="#_ref">One</a>
19746 </p>
19747 !! end
19748
19749 !! test
19750 Id starting with underscore
19751 !! wikitext
19752 <div id="_ref"></div>
19753 !! html
19754 <div id="_ref"></div>
19755
19756 !! end
19757
19758 !! test
19759 Space normalisation on autocomment (bug 22784)
19760 !! options
19761 comment
19762 title=[[Main Page]]
19763 !! wikitext
19764 /* __hello__world__ */
19765 !! html
19766 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
19767 !! end
19768
19769 !! test
19770 percent-encoding and + signs in comments (Bug 26410)
19771 !! options
19772 comment
19773 !! wikitext
19774 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
19775 !! html/php
19776 <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>
19777 !! end
19778
19779 # Parsoid doesn't support this yet: see bug 73581
19780 # but it *should* omit the 'src' attribute if the image is bad.
19781 # PHP side of tests was disabled in
19782 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
19783 # because of issues in the PHP parserTests infrastructure
19784 # (but the output below is indeed what the PHP side emits)
19785 !! test
19786 Bad images - basic functionality
19787 !! wikitext
19788 [[File:Bad.jpg]]
19789 !! DISABLED/html/php
19790 !! html/parsoid
19791 <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>
19792 !! end
19793
19794 !! test
19795 Bad images - bug 16039: text after bad image disappears
19796 !! wikitext
19797 Foo bar
19798 [[File:Bad.jpg]]
19799 Bar foo
19800 !! DISABLED/html/php
19801 <p>Foo bar
19802 </p><p>Bar foo
19803 </p>
19804 !! html/parsoid
19805 <p>Foo bar
19806 <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>
19807 Bar foo</p>
19808 !! end
19809
19810 !! test
19811 Verify that displaytitle works (bug #22501) no displaytitle
19812 !! options
19813 showtitle
19814 !! config
19815 wgAllowDisplayTitle=true
19816 wgRestrictDisplayTitle=false
19817 !! wikitext
19818 this is not the the title
19819 !! html/php
19820 Parser test
19821 <p>this is not the the title
19822 </p>
19823 !! end
19824
19825 !! test
19826 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
19827 !! options
19828 showtitle
19829 title=[[Screen]]
19830 !! config
19831 wgAllowDisplayTitle=true
19832 wgRestrictDisplayTitle=false
19833 !! wikitext
19834 this is not the the title
19835 {{DISPLAYTITLE:whatever}}
19836 !! html/php
19837 whatever
19838 <p>this is not the the title
19839 </p>
19840 !! end
19841
19842 !! test
19843 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
19844 !! options
19845 showtitle
19846 title=[[Screen]]
19847 !! config
19848 wgAllowDisplayTitle=true
19849 wgRestrictDisplayTitle=true
19850 !! wikitext
19851 this is not the the title
19852 {{DISPLAYTITLE:whatever}}
19853 !! html/php
19854 Screen
19855 <p>this is not the the title
19856 </p>
19857 !! end
19858
19859 !! test
19860 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
19861 !! options
19862 showtitle
19863 title=[[Screen]]
19864 !! config
19865 wgAllowDisplayTitle=true
19866 wgRestrictDisplayTitle=true
19867 !! wikitext
19868 this is not the the title
19869 {{DISPLAYTITLE:screen}}
19870 !! html/php
19871 screen
19872 <p>this is not the the title
19873 </p>
19874 !! end
19875
19876 !! test
19877 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
19878 !! options
19879 showtitle
19880 title=[[Screen]]
19881 !! config
19882 wgAllowDisplayTitle=false
19883 !! wikitext
19884 this is not the the title
19885 {{DISPLAYTITLE:screen}}
19886 !! html/php
19887 Screen
19888 <p>this is not the the title
19889 <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>
19890 </p>
19891 !! end
19892
19893 !! test
19894 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
19895 !! options
19896 showtitle
19897 title=[[Screen]]
19898 !! config
19899 wgAllowDisplayTitle=false
19900 !! wikitext
19901 this is not the the title
19902 !! html/php
19903 Screen
19904 <p>this is not the the title
19905 </p>
19906 !! end
19907
19908 !! test
19909 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
19910 !! options
19911 showtitle
19912 title=[[Screen]]
19913 !! config
19914 wgAllowDisplayTitle=true
19915 wgRestrictDisplayTitle=true
19916 !! wikitext
19917 this is not the the title
19918 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
19919 !! html/php
19920 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
19921 <p>this is not the the title
19922 </p>
19923 !! end
19924
19925 !! test
19926 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
19927 !! options
19928 showtitle
19929 title=[[Screen]]
19930 !! config
19931 wgAllowDisplayTitle=true
19932 wgRestrictDisplayTitle=true
19933 !! wikitext
19934 this is not the the title
19935 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
19936 !! html/php
19937 <span style="color: red;">s</span>creen
19938 <p>this is not the the title
19939 </p>
19940 !! end
19941
19942 !! test
19943 Page status indicators: Empty name is invalid
19944 !! options
19945 showindicators
19946 !! wikitext
19947 <indicator name=" "></indicator>
19948 <indicator></indicator>
19949 !! html
19950 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19951 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19952 </p>
19953 !! end
19954
19955 !! test
19956 Page status indicators: Weird syntaxes that are okay
19957 !! options
19958 showindicators
19959 !! wikitext
19960 <indicator name="empty" />
19961 <indicator name="name"></indicator>
19962 !! html
19963 empty=
19964 name=
19965 <p><br />
19966 </p>
19967 !! end
19968
19969 !! test
19970 Page status indicators: Torture test
19971 !! options
19972 showindicators
19973 !! wikitext
19974 <indicator name="01">hello world</indicator>
19975 <indicator name="02">[[Main Page]]</indicator>
19976 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
19977 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
19978 <indicator name="05">* foo
19979 * bar</indicator>
19980 <indicator name="06"><nowiki>foo</nowiki></indicator>
19981 <indicator name="07"> Preformatted</indicator>
19982 <indicator name="08"><div>Broken tag</indicator>
19983 <indicator name="09">{| class=wikitable
19984 | cell
19985 |}</indicator>
19986 <indicator name="10">Two
19987
19988 paragraphs</indicator>
19989 !! html
19990 01=hello world
19991 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19992 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" />
19993 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>
19994 05=<ul><li> foo</li>
19995 <li> bar</li></ul>
19996
19997 06=foo
19998 07=<pre>Preformatted
19999 </pre>
20000 08=<div>Broken tag</div>
20001
20002 09=<table class="wikitable">
20003 <tr>
20004 <td> cell
20005 </td></tr></table>
20006
20007 10=<p>Two
20008 </p><p>paragraphs
20009 </p>
20010 <p><br />
20011 </p><p><br />
20012 </p><p><br />
20013 </p><p><br />
20014 </p><p><br />
20015 </p>
20016 !! end
20017
20018 !! test
20019 preload: check <noinclude> and <includeonly>
20020 !! options
20021 preload
20022 !! wikitext
20023 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20024 !! html/php
20025 Hello kind world.
20026 !! end
20027
20028 !! test
20029 preload: check <onlyinclude>
20030 !! options
20031 preload
20032 !! wikitext
20033 Goodbye <onlyinclude>Hello world</onlyinclude>
20034 !! html/php
20035 Hello world
20036 !! end
20037
20038 !! test
20039 preload: can pass tags through if we want to
20040 !! options
20041 preload
20042 !! wikitext
20043 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20044 !! html/php
20045 <includeonly>Hello world</includeonly>
20046 !! end
20047
20048 !! test
20049 preload: check that it doesn't try to do tricks
20050 !! options
20051 preload
20052 !! wikitext
20053 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20054 !! html/php
20055 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20056 !! end
20057
20058 !! test
20059 Play a bit with r67090 and bug 3158
20060 !! wikitext
20061 <div style="width:50% !important">&nbsp;</div>
20062 <div style="width:50%&nbsp;!important">&nbsp;</div>
20063 <div style="width:50%&#160;!important">&nbsp;</div>
20064 <div style="border : solid;">&nbsp;</div>
20065 !! html/php
20066 <div style="width:50% !important">&#160;</div>
20067 <div style="width:50% !important">&#160;</div>
20068 <div style="width:50% !important">&#160;</div>
20069 <div style="border&#160;: solid;">&#160;</div>
20070
20071 !! html/parsoid
20072 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20073 <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>
20074 <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>
20075 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20076
20077 !! end
20078
20079 !! test
20080 HTML5 data attributes
20081 !! wikitext
20082 <span data-foo="bar">Baz</span>
20083 <p data-abc-def_hij="">Quuz</p>
20084 !! html
20085 <p><span data-foo="bar">Baz</span>
20086 </p>
20087 <p data-abc-def_hij="">Quuz</p>
20088
20089 !! end
20090
20091 !! test
20092 percent-encoding and + signs in internal links (Bug 26410)
20093 !! wikitext
20094 [[User:+%]] [[Page+title%]]
20095 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20096 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20097 [[%33%45]] [[%33%45+]]
20098 !! html/php
20099 <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>
20100 <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>
20101 <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>
20102 <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>
20103 </p>
20104 !! html/parsoid
20105 <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>
20106 <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>
20107 <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>
20108 <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>
20109 !! end
20110
20111 !! test
20112 Special characters in embedded file links (bug 27679)
20113 !! wikitext
20114 [[File:Contains & ampersand.jpg]]
20115 [[File:Does not exist.jpg|Title with & ampersand]]
20116 !! html/php
20117 <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>
20118 <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>
20119 </p>
20120 !! html/parsoid
20121 <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>
20122 <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>
20123 !! end
20124
20125 !! test
20126 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20127 !! wikitext
20128 Text&apos;s been normalized?
20129 !! html
20130 <p>Text&#39;s been normalized?
20131 </p>
20132 !! end
20133
20134 !! test
20135 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20136 !! wikitext
20137 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20138 !! html
20139 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20140 </p>
20141 !! end
20142
20143 !! test
20144 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20145 !! wikitext
20146 [http://www.example.org/ ideograms]
20147 !! html
20148 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20149 </p>
20150 !! end
20151
20152 !! test
20153 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20154 !! wikitext
20155 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20156 !! html
20157 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20158 </p>
20159 !! end
20160
20161 !! article
20162 Mediawiki:loop1
20163 !! text
20164 {{Identical|A}}
20165 !! endarticle
20166
20167 !! article
20168 Mediawiki:loop2
20169 !! text
20170 {{Identical|B}}
20171 !! endarticle
20172
20173 !! article
20174 Template:Identical
20175 !! text
20176 {{int:loop1}}
20177 {{int:loop2}}
20178 !! endarticle
20179
20180 !! test
20181 Bug 31098 Template which includes system messages which includes the template
20182 !! wikitext
20183 {{Identical}}
20184 !! html
20185 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20186 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20187 </p>
20188 !! end
20189
20190 !! test
20191 Bug31490 Turkish: ucfirst 'blah'
20192 !! options
20193 language=tr
20194 !! wikitext
20195 {{ucfirst:blah}}
20196 !! html
20197 <p>Blah
20198 </p>
20199 !! end
20200
20201 !! test
20202 Bug31490 Turkish: ucfirst 'ix'
20203 !! options
20204 language=tr
20205 !! wikitext
20206 {{ucfirst:ix}}
20207 !! html
20208 <p>İx
20209 </p>
20210 !! end
20211
20212 !! test
20213 Bug31490 Turkish: lcfirst 'BLAH'
20214 !! options
20215 language=tr
20216 !! wikitext
20217 {{lcfirst:BLAH}}
20218 !! html
20219 <p>bLAH
20220 </p>
20221 !! end
20222
20223 !! test
20224 Bug31490 Turkish: ucfırst (with a dotless i)
20225 !! options
20226 language=tr
20227 !! wikitext
20228 {{ucfırst:blah}}
20229 !! html
20230 <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>
20231 </p>
20232 !! end
20233
20234 !! test
20235 Bug31490 ucfırst (with a dotless i) with English language
20236 !! options
20237 language=en
20238 !! wikitext
20239 {{ucfırst:blah}}
20240 !! html
20241 <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>
20242 </p>
20243 !! end
20244
20245 !! test
20246 Bug 26375: TOC with italics
20247 !! options
20248 title=[[Main Page]]
20249 !! wikitext
20250 __TOC__
20251 == ''Lost'' episodes ==
20252 !! html
20253 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20254 <ul>
20255 <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>
20256 </ul>
20257 </div>
20258
20259 <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>
20260
20261 !! end
20262
20263 !! test
20264 Bug 26375: TOC with bold
20265 !! options
20266 title=[[Main Page]]
20267 !! wikitext
20268 __TOC__
20269 == '''should be bold''' then normal text ==
20270 !! html
20271 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20272 <ul>
20273 <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>
20274 </ul>
20275 </div>
20276
20277 <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>
20278
20279 !! end
20280
20281 !! test
20282 Bug 33845: Headings become cursive in TOC when they contain an image
20283 !! options
20284 title=[[Main Page]]
20285 !! wikitext
20286 __TOC__
20287 == Image [[Image:foobar.jpg]] ==
20288 !! html
20289 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20290 <ul>
20291 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20292 </ul>
20293 </div>
20294
20295 <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>
20296
20297 !! end
20298
20299 !! test
20300 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20301 !! options
20302 title=[[Main Page]]
20303 !! wikitext
20304 __TOC__
20305 == <blockquote>Quote</blockquote> ==
20306 !! html
20307 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20308 <ul>
20309 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20310 </ul>
20311 </div>
20312
20313 <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>
20314
20315 !! html+tidy
20316 <p></p>
20317 <div id="toc" class="toc">
20318 <div id="toctitle">
20319 <h2>Contents</h2>
20320 </div>
20321 <ul>
20322 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20323 </ul>
20324 </div>
20325 <p></p>
20326 <h2><span class="mw-headline" id="Quote"></span></h2>
20327 <blockquote>
20328 <p><span class="mw-headline" id="Quote">Quote</span></p>
20329 </blockquote>
20330 <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>
20331 !! end
20332
20333 !! test
20334 Unclosed tags in TOC
20335 !! options
20336 title=[[Main Page]]
20337 !! wikitext
20338 __TOC__
20339 == Proof: 2 < 3 ==
20340 <small>Hanc marginis exiguitas non caperet.</small>
20341 QED
20342 !! html
20343 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20344 <ul>
20345 <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>
20346 </ul>
20347 </div>
20348
20349 <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>
20350 <p><small>Hanc marginis exiguitas non caperet.</small>
20351 QED
20352 </p>
20353 !! end
20354
20355 !! test
20356 Multiple tags in TOC
20357 !! wikitext
20358 __TOC__
20359 == <i>Foo</i> <b>Bar</b> ==
20360
20361 == <i>Foo</i> <blockquote>Bar</blockquote> ==
20362 !! html
20363 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20364 <ul>
20365 <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>
20366 <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>
20367 </ul>
20368 </div>
20369
20370 <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>
20371 <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>
20372
20373 !! html+tidy
20374 <p></p>
20375 <div id="toc" class="toc">
20376 <div id="toctitle">
20377 <h2>Contents</h2>
20378 </div>
20379 <ul>
20380 <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>
20381 <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>
20382 </ul>
20383 </div>
20384 <p></p>
20385 <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>
20386 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
20387 <blockquote>
20388 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
20389 </blockquote>
20390 <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>
20391 !! end
20392
20393 !! test
20394 Tags with parameters in TOC
20395 !! wikitext
20396 __TOC__
20397 == <sup class="in-h2">Hello</sup> ==
20398
20399 == <sup class="a > b">Evilbye</sup> ==
20400 !! html
20401 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20402 <ul>
20403 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
20404 <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>
20405 </ul>
20406 </div>
20407
20408 <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>
20409 <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>
20410
20411 !! end
20412
20413 !! test
20414 span tags with directionality in TOC
20415 !! wikitext
20416 __TOC__
20417 == <span dir="ltr">C++</span> ==
20418
20419 == <span dir="rtl">זבנג!</span> ==
20420
20421 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
20422
20423 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
20424
20425 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
20426 !! html
20427 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20428 <ul>
20429 <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>
20430 <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>
20431 <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>
20432 <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>
20433 <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>
20434 </ul>
20435 </div>
20436
20437 <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>
20438 <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>
20439 <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>
20440 <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>
20441 <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>
20442
20443 !! end
20444
20445 !! test
20446 Bug 72884: bdi element in ToC
20447 !! wikitext
20448 __TOC__
20449 == <bdi>test</bdi> ==
20450 !! html
20451 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20452 <ul>
20453 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
20454 </ul>
20455 </div>
20456
20457 <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>
20458
20459 !! end
20460
20461 # Note that the html output does not have the <p></p>, but the
20462 # html+tidy output *does*. This is because the empty <p></p> is
20463 # removed by the sanitizer, but only when tidy is *not* enabled (!).
20464 !! test
20465 Empty <p> tag in TOC, removed by Sanitizer (T92892)
20466 !! wikitext
20467 __TOC__
20468 == x ==
20469 !! html
20470 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20471 <ul>
20472 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20473 </ul>
20474 </div>
20475
20476 <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>
20477
20478 !! html+tidy
20479 <p></p>
20480 <div id="toc" class="toc">
20481 <div id="toctitle">
20482 <h2>Contents</h2>
20483 </div>
20484 <ul>
20485 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20486 </ul>
20487 </div>
20488 <p></p>
20489 <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>
20490 !! end
20491
20492 !! article
20493 MediaWiki:Bug32057
20494 !! text
20495 == {{int:headline_sample}} ==
20496 !! endarticle
20497
20498 !! test
20499 Bug 32057: Title needed when expanding <h> nodes.
20500 !! options
20501 title=[[Main Page]]
20502 !! wikitext
20503 {{int:Bug32057}}
20504 !! html
20505 <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>
20506
20507 !! end
20508
20509 !! test
20510 Strip marker in urlencode
20511 !! wikitext
20512 {{urlencode:x<nowiki/>y}}
20513 {{urlencode:x<nowiki/>y|wiki}}
20514 {{urlencode:x<nowiki/>y|path}}
20515 {{urlencode:x<pre id="one">two</pre>y}}
20516 !! html
20517 <p>xy
20518 xy
20519 xy
20520 xy
20521 </p>
20522 !! end
20523
20524 !! test
20525 Strip marker in lc
20526 !! wikitext
20527 {{lc:x<nowiki/>y}}
20528 !! html
20529 <p>xy
20530 </p>
20531 !! end
20532
20533 !! test
20534 Strip marker in uc
20535 !! wikitext
20536 {{uc:x<nowiki/>y}}
20537 !! html
20538 <p>XY
20539 </p>
20540 !! end
20541
20542 !! test
20543 Strip marker in formatNum
20544 !! wikitext
20545 {{formatnum:1<nowiki/>2}}
20546 {{formatnum:1<nowiki/>2|R}}
20547 !! html
20548 <p>12
20549 12
20550 </p>
20551 !! end
20552
20553 !! test
20554 Check noCommafy in formatNum
20555 !! options
20556 language=be-tarask
20557 !! wikitext
20558 {{formatnum:123456.78}}
20559 {{formatnum:123456.78|NOSEP}}
20560 !! html
20561 <p>123 456,78
20562 123456.78
20563 </p>
20564 !! end
20565
20566 !! test
20567 Wrong option for formatNum (bug 56199)
20568 !! wikitext
20569 {{formatnum:1,234.56|Random}}
20570 {{formatnum:1,234.56|EVERYTHING}}
20571 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
20572 !! html
20573 <p>1,234.56
20574 1,234.56
20575 1,234.56
20576 </p>
20577 !! end
20578
20579 !! test
20580 Strip marker in grammar
20581 !! options
20582 language=fi
20583 !! wikitext
20584 {{grammar:elative|foo<nowiki/>bar}}
20585 !! html
20586 <p>foobarista
20587 </p>
20588 !! end
20589
20590 !! test
20591 Strip marker in padleft
20592 !! wikitext
20593 {{padleft:|2|x<nowiki/>y}}
20594 !! html
20595 <p>xy
20596 </p>
20597 !! end
20598
20599 !! test
20600 Strip marker in padright
20601 !! wikitext
20602 {{padright:|2|x<nowiki/>y}}
20603 !! html
20604 <p>xy
20605 </p>
20606 !! end
20607
20608 !! test
20609 Strip marker in anchorencode
20610 !! wikitext
20611 {{anchorencode:x<nowiki/>y}}
20612 !! html
20613 <p>xy
20614 </p>
20615 !! end
20616
20617 !! test
20618 nowiki inside link inside heading (bug 18295)
20619 !! wikitext
20620 ==[[foo|x<nowiki>y</nowiki>z]]==
20621 !! html
20622 <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>
20623
20624 !! end
20625
20626 !! test
20627 new support for bdi element (bug 31817)
20628 !! wikitext
20629 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20630 !! html
20631 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20632
20633 !!end
20634
20635 !! test
20636 Ignore pipe between table row attributes
20637 !! wikitext
20638 {|
20639 | quux
20640 |- id=foo | style='color: red'
20641 | bar
20642 |}
20643 !! html
20644 <table>
20645 <tr>
20646 <td> quux
20647 </td></tr>
20648 <tr id="foo" style="color: red">
20649 <td> bar
20650 </td></tr></table>
20651
20652 !! end
20653
20654 !!test
20655 Gallery override link with WikiLink (bug 34852)
20656 !! wikitext
20657 <gallery>
20658 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
20659 </gallery>
20660 !! html
20661 <ul class="gallery mw-gallery-traditional">
20662 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20663 <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>
20664 <div class="gallerytext">
20665 <p>caption
20666 </p>
20667 </div>
20668 </div></li>
20669 </ul>
20670
20671 !! end
20672
20673 !!test
20674 Gallery override link with absolute external link (bug 34852)
20675 !! wikitext
20676 <gallery>
20677 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20678 </gallery>
20679 !! html
20680 <ul class="gallery mw-gallery-traditional">
20681 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20682 <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>
20683 <div class="gallerytext">
20684 <p>caption
20685 </p>
20686 </div>
20687 </div></li>
20688 </ul>
20689
20690 !! end
20691
20692 !!test
20693 Gallery override link with malicious javascript (bug 34852)
20694 !! wikitext
20695 <gallery>
20696 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20697 </gallery>
20698 !! html
20699 <ul class="gallery mw-gallery-traditional">
20700 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20701 <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>
20702 <div class="gallerytext">
20703 <p>caption
20704 </p>
20705 </div>
20706 </div></li>
20707 </ul>
20708
20709 !! end
20710
20711 !!test
20712 Gallery with invalid title as link (bug 43964)
20713 !! wikitext
20714 <gallery>
20715 File:foobar.jpg|link=<
20716 </gallery>
20717 !! html
20718 <ul class="gallery mw-gallery-traditional">
20719 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20720 <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>
20721 <div class="gallerytext">
20722 </div>
20723 </div></li>
20724 </ul>
20725
20726 !! end
20727
20728 !!test
20729 Language parser function
20730 !! wikitext
20731 {{#language:ar}}
20732 !! html
20733 <p>العربية
20734 </p>
20735 !! end
20736
20737 !!test
20738 Padleft and padright as substr
20739 !! wikitext
20740 {{padleft:|3|abcde}}
20741 {{padright:|3|abcde}}
20742 !! html
20743 <p>abc
20744 abc
20745 </p>
20746 !! end
20747
20748 !!test
20749 Special parser function
20750 !! wikitext
20751 {{#special:RandomPage}}
20752 {{#special:BaDtItLe}}
20753 {{#special:Foobar}}
20754 !! html
20755 <p>Special:Random
20756 Special:Badtitle
20757 Special:Foobar
20758 </p>
20759 !! end
20760
20761 !!test
20762 Bug 34939 - Case insensitive link parsing ([HttP://])
20763 !! wikitext
20764 [HttP://MediaWiki.Org/]
20765 !! html/php
20766 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
20767 </p>
20768 !! html/parsoid
20769 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
20770 !! end
20771
20772 !!test
20773 Bug 34939 - Case insensitive link parsing ([HttP:// title])
20774 !! wikitext
20775 [HttP://MediaWiki.Org/ MediaWiki]
20776 !! html
20777 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
20778 </p>
20779 !! end
20780
20781 !!test
20782 Bug 34939 - Case insensitive link parsing (HttP://)
20783 !! wikitext
20784 HttP://MediaWiki.Org/
20785 !! html/php
20786 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
20787 </p>
20788 !! html/parsoid
20789 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
20790 !! end
20791
20792 !!test
20793 Disable TOC
20794 !! options
20795 notoc
20796 !! wikitext
20797 Lead
20798 == Section 1 ==
20799 == Section 2 ==
20800 == Section 3 ==
20801 == Section 4 ==
20802 == Section 5 ==
20803 !! html
20804 <p>Lead
20805 </p>
20806
20807 <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>
20808 <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>
20809 <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>
20810 <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>
20811 <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>
20812
20813 !! end
20814
20815
20816 ###
20817 ### Parsoid-specific tests
20818 ### Parsoid-PHP parser incompatibilities
20819 ###
20820 !!test
20821 1. SOL-sensitive wikitext tokens as template-args
20822 !!options
20823 parsoid=wt2html,wt2wt
20824 !! wikitext
20825 {{echo|*a}}
20826 {{echo|#a}}
20827 {{echo|:a}}
20828 !! html
20829 <span about="#mwt1" typeof="mw:Transclusion">
20830 </span><ul about="#mwt1"><li>a</li>
20831 </ul>
20832 <span about="#mwt2" typeof="mw:Transclusion">
20833 </span><ol about="#mwt2"><li>a</li>
20834 </ol>
20835 <span about="#mwt3" typeof="mw:Transclusion">
20836 </span><dl about="#mwt3"><dd>a</dd>
20837 </dl>
20838 !!end
20839
20840 #### -----------------------------------------------------------------
20841 #### Parsoid-specific functionality tests
20842 #### -----------------------------------------------------------------
20843
20844 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
20845 # We know wt2wt will fail, but we expect selser to pass.
20846 # Due to the nature of our testing, wt2wt and selser tests will enter the
20847 # blacklist and we'll catch selser regressions based on changes to the
20848 # blacklist entries for selser tests.
20849 !! test
20850 1. Bad treebuilder fixup of formatting elt is cleaned up
20851 !! options
20852 parsoid=wt2html,wt2wt
20853 !! wikitext
20854 {|
20855 |
20856 <small>
20857 [[Image:Foobar.jpg|right|Test]]
20858 </small>
20859 |}
20860 !! html/parsoid
20861 <table>
20862 <tbody><tr><td>
20863 <small>
20864 <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>
20865 </small>
20866 </td></tr>
20867 </tbody></table>
20868 !! end
20869
20870 !! test
20871 2. Bad treebuilder fixup of formatting elt is cleaned up
20872 !! options
20873 parsoid=wt2html,wt2wt
20874 !! wikitext
20875 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
20876
20877 <small>[[Image:Foobar.jpg|right|300px]]</small>
20878 !! html/parsoid
20879
20880 <p><b>foo</b></p>
20881 <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>
20882 <p><b>bar</b></p>
20883 <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>
20884 !! end
20885
20886 !! test
20887 3. Bad treebuilder fixup of formatting elt is cleaned up
20888 !! options
20889 parsoid=wt2html,wt2wt
20890 !! wikitext
20891 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
20892 !! html/parsoid
20893 <p><small><b>foo</b></small></p>
20894 <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>
20895 <p><small><b>bar</b></small></p>
20896 !! end
20897
20898 !! test
20899 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
20900 !! options
20901 parsoid=wt2html,wt2wt
20902 !! wikitext
20903 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
20904 !! html/parsoid
20905 <p><b><small></small></b></p>
20906 <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>
20907 <p></p>
20908 !! end
20909
20910 #### ----------------------------------------------------------------
20911 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
20912 #### tags. Parsoid's output for these tags differs from that of the
20913 #### PHP parser.
20914 #### ----------------------------------------------------------------
20915
20916 !!test
20917 Ref: 1. ref-location should be replaced with an index span
20918 !!options
20919 parsoid
20920 !! wikitext
20921 A <ref>foo</ref>
20922 B <ref name="x">foo</ref>
20923 C <ref name="y" />
20924 <references />
20925 !! html
20926 <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>
20927 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>
20928 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>
20929 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20930 <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>
20931 <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>
20932 <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>
20933 </ol>
20934 !!end
20935
20936 !!test
20937 Ref: 2. ref-tags with identical names should all get the same index
20938 !!options
20939 parsoid
20940 !! wikitext
20941 A <ref name="x">foo</ref>
20942 B <ref name="x" />
20943 <references />
20944 !! html
20945 <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>
20946 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>
20947 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20948 <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>
20949 </ol>
20950 !!end
20951
20952 !!test
20953 Ref: 3. spaces in ref-names should be ignored
20954 !!options
20955 parsoid
20956 !! wikitext
20957 A <ref name="x">foo</ref>
20958 B <ref name=" x " />
20959 C <ref name= x />
20960 <references />
20961 !! html
20962 <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>
20963 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>
20964 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>
20965 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20966 <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>
20967 </ol>
20968 !!end
20969
20970 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
20971 !!test
20972 Ref: 4. 'constructor' should be accepted as a valid ref-name
20973 !!options
20974 parsoid
20975 !! wikitext
20976 A <ref name="constructor">foo</ref>
20977 <references />
20978 !! html
20979 <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>
20980 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20981 <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>
20982 </ol>
20983 !!end
20984
20985 !!test
20986 Ref: 5. body should accept generic wikitext
20987 !!options
20988 parsoid
20989 !! wikitext
20990 A <ref>
20991 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
20992 </ref>
20993
20994 <references />
20995 !! html
20996 <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>
20997
20998 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20999 <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>
21000 </span></li>
21001 </ol>
21002 !!end
21003
21004 !!test
21005 Ref: 6. indent-pres should not be output in ref-body
21006 !!options
21007 parsoid
21008 !! wikitext
21009 A <ref>
21010 foo
21011 bar
21012 baz
21013 </ref>
21014
21015 <references />
21016 !! html
21017 <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>
21018
21019 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21020 <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
21021 bar
21022 baz
21023 </span></li>
21024 </ol>
21025 !!end
21026
21027 !!test
21028 Ref: 7. No p-wrapping in ref-body
21029 !!options
21030 parsoid
21031 !! wikitext
21032 A <ref>
21033 foo
21034
21035 bar
21036
21037
21038 baz
21039
21040
21041
21042 booz
21043 </ref>
21044
21045 <references />
21046 !! html
21047 <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>
21048
21049 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21050 <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
21051
21052 bar
21053
21054
21055 baz
21056
21057
21058
21059 booz
21060 </span></li>
21061 </ol>
21062 !!end
21063
21064 !!test
21065 Ref: 8. transclusion wikitext has lower precedence
21066 !!options
21067 parsoid
21068 !! wikitext
21069 A <ref> foo {{echo|</ref> B C}}
21070
21071 <references />
21072 !! html
21073 <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>
21074 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21075 <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>
21076 </ol>
21077 !!end
21078
21079 !!test
21080 Ref: 9. unclosed comments should not leak out of ref-body
21081 !!options
21082 parsoid
21083 !! wikitext
21084 A <ref> foo <!--</ref> B C
21085 <references />
21086 !! html
21087 <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>
21088 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21089 <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>
21090 </ol>
21091 !!end
21092
21093 !!test
21094 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21095 !!options
21096 parsoid
21097 !! wikitext
21098 A <ref> <b> foo </ref> B C
21099
21100 <references />
21101 !! html
21102 <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>
21103
21104
21105 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21106 <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>
21107 </ol>
21108 !!end
21109
21110 !!test
21111 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21112 !!options
21113 parsoid
21114 !! wikitext
21115 A <ref>foo</ref> B
21116 C <ref>bar</ref> D
21117 <references />
21118 !! html
21119 <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
21120 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>
21121 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21122 <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>
21123 <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>
21124 </ol>
21125 !!end
21126
21127 !!test
21128 Ref: 12. ref-tags act as trailing newline migration barrier
21129 !! wikitext
21130 <!--the newline at the end of this line moves out of the p tag-->a
21131
21132 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21133 <ref />
21134
21135 c
21136 <references />
21137 !! html/parsoid
21138 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21139
21140
21141 <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>
21142 <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>
21143
21144 <p>c</p>
21145 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21146 <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>
21147 <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>
21148 !!end
21149
21150 !!test
21151 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21152 !!options
21153 parsoid
21154 !! wikitext
21155 <ref>foo</ref> A
21156 <ref>bar
21157 </ref> B
21158 <references />
21159 !! html
21160 <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
21161 <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>
21162 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21163 <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>
21164 <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
21165 </span></li>
21166 </ol>
21167 !!end
21168
21169 !!test
21170 Ref: 14. A nested ref-tag should be emitted as plain text
21171 !!options
21172 parsoid
21173 !! wikitext
21174 <ref>foo <ref>bar</ref> baz</ref>
21175
21176 <references />
21177 !! html
21178 <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>
21179 </p>
21180 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21181 <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>
21182 </ol>
21183 !!end
21184
21185 !!test
21186 Ref: 15. ref-tags with identical names should get identical indexes
21187 !!options
21188 parsoid
21189 !! wikitext
21190 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21191 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21192
21193 <references />
21194 !! html
21195 <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>
21196 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>
21197
21198 <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>
21199 </ol>
21200 !!end
21201
21202 ## We don't bother wt2wt-ing non-standard whitespace
21203 !!test
21204 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21205 !!options
21206 parsoid=wt2html
21207 !! wikitext
21208 A <ref >foo</ref >
21209
21210 <references />
21211 !! html
21212 <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>
21213 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21214 <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>
21215 !!end
21216
21217 !!test
21218 Ref: 17. Generate valid HTML5 id/about attributes
21219 !!options
21220 parsoid
21221 !!wikitext
21222 <ref name="a b">foo</ref>
21223
21224 <references />
21225 !!html
21226 <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>
21227 </p>
21228
21229 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21230 <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>
21231 </ol>
21232 !!end
21233
21234 !!test
21235 Ref: 18. T58916: Extension attributes should be parsed as plain text
21236 !!options
21237 parsoid
21238 !!wikitext
21239 <ref name="{{echo|a}}">foo</ref>
21240
21241 <references />
21242 !!html
21243 <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>
21244 </p>
21245
21246 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21247 <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>
21248 </ol>
21249 !!end
21250
21251 !!test
21252 Ref: 19. ref-tags with identical name encodings should get identical indexes
21253 !!options
21254 parsoid
21255 !! wikitext
21256 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21257
21258 <references />
21259 !! html
21260 <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>
21261 </p>
21262 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21263 <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>
21264 </ol>
21265 !!end
21266
21267 !!test
21268 Ref: 20. ref-tags with identical names but different content should keep it
21269 !!options
21270 parsoid
21271 !! wikitext
21272 A <ref name="foo">Foo one</ref>
21273 B <ref name="foo">Foo two</ref>
21274 C <ref name="foo" />
21275
21276 <references />
21277 !! html
21278 <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>
21279 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>
21280 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>
21281
21282 <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>
21283 </ol>
21284 !!end
21285
21286 !!test
21287 References: 1. references tag without any refs should be handled properly
21288 !! wikitext
21289 <references />
21290 !! html/parsoid
21291 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21292 !!end
21293
21294 !!test
21295 References: 2. references tag with group only outputs references from that group
21296 !! wikitext
21297 A <ref group="a">foo</ref>
21298 B <ref group="b">bar</ref>
21299 C <ref>baz</ref>
21300
21301 <references group="a" />
21302 <references />
21303 <references group="b" />
21304 !! html/parsoid
21305 <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>
21306 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>
21307 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>
21308
21309 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21310 <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>
21311 </ol>
21312 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21313 <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>
21314 </ol>
21315 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21316 <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>
21317 </ol>
21318 !!end
21319
21320 !!test
21321 References: 3. ref list should be cleared after processing references
21322 !! wikitext
21323 A <ref>foo</ref>
21324
21325 <references />
21326
21327 B <ref>bar</ref>
21328
21329 <references />
21330 !! html/parsoid
21331 <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>
21332
21333 <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>
21334 </ol>
21335
21336 <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>
21337
21338 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21339 <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>
21340 </ol>
21341 !!end
21342
21343 !!test
21344 References: 4. only referenced group should be cleared after processing references
21345 !! wikitext
21346 A <ref group="a">afoo</ref>
21347 B <ref>bfoo</ref>
21348
21349 <references group="a" />
21350
21351 C <ref>cfoo</ref>
21352
21353 <references />
21354 !! html/parsoid
21355 <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>
21356 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>
21357
21358 <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>
21359 </ol>
21360
21361 <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>
21362
21363 <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>
21364 </ol>
21365 !!end
21366
21367 !!test
21368 References: 5. ref tags in references should be processed while ignoring all other content
21369 !! wikitext
21370 A <ref name="a" />
21371 B <ref name="b">bar</ref>
21372
21373 <references>
21374 <ref name="a">foo</ref>
21375 This should just get lost.
21376 </references>
21377 !! html/parsoid
21378 <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>
21379 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>
21380
21381
21382 <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>
21383 </ol>
21384 !!end
21385
21386 !!test
21387 References: 6. <references /> from a transclusion
21388 !! wikitext
21389 <ref>Foo</ref> {{echo|<references />}}
21390 !! html/parsoid
21391 <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>
21392 </ol>
21393 !!end
21394
21395 !! test
21396 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
21397 !! wikitext
21398 A <ref>foo bar for a</ref>
21399 B <ref group="X" name="b" />
21400
21401 <references />
21402
21403 <references group="X">
21404 <ref name="b">foo</ref>
21405 </references>
21406 !! html/parsoid
21407 <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>
21408 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>
21409 </p>
21410
21411 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21412 <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>
21413 </ol>
21414
21415 <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"}}'>
21416 <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>
21417 </ol>
21418 !! end
21419
21420 !! test
21421 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
21422 !! wikitext
21423 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
21424 <references />
21425 !! html/parsoid
21426 <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>
21427 <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>
21428 </ol>
21429 !!end
21430
21431 # This test only works in wt2html now as the <references /> are always generated
21432 # unless selser is active. Once T72722 is fixed, we should add a changes test
21433 # here to ensure that unrelated changes don't add the new <references /> in
21434 # wt2wt.
21435 !! test
21436 References: 9. Generate missing references list at the end
21437 !! wikitext
21438 A <ref>foo</ref>
21439 B <ref group="inexistent">bar</ref>
21440 !! html/parsoid
21441 <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>
21442 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21443 <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>
21444 </ol>
21445 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
21446 <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>
21447 </ol>
21448 !! end
21449
21450 !! test
21451 References: 10. New <references/> shouldn't be added for unrelated edits.
21452 !! options
21453 parsoid={
21454 "modes": ["selser"],
21455 "changes": [["#x", "remove"]],
21456 "selser": "noauto"
21457 }
21458 !! wikitext
21459 Unrelated text<span id="x"> that's going to disappear</span>.
21460 A <ref>foo</ref>
21461 !! wikitext/edited
21462 Unrelated text.
21463 A <ref>foo</ref>
21464 !!end
21465
21466 !! test
21467 Entities in ref name
21468 !! wikitext
21469 <ref name="test &amp; me">hi</ref>
21470 <references />
21471 !! html/parsoid
21472 <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>
21473 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21474 <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>
21475 </ol>
21476 !! end
21477
21478 # This test is wt2html only because we're permitting the serializer to produce
21479 # dirty diffs, normalizing the unclosed references to the self-closed version.
21480 !! test
21481 Generate references for unclosed references tag
21482 !! options
21483 parsoid=wt2html
21484 !! wikitext
21485 a<ref>foo</ref>
21486
21487 <references>
21488 !! html/parsoid
21489 <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>
21490 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21491 <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>
21492 !! end
21493
21494 !! test
21495 New reference serializes on its own line
21496 !! options
21497 parsoid=wt2wt,html2wt
21498 !! wikitext
21499 foo
21500 <references />
21501 !! html/parsoid
21502 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21503 !! end
21504
21505 #### ----------------------------------------------------------------
21506 #### Parsoid-only testing of Parsoid's impl of LST
21507 #### Not implemented yet, see
21508 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
21509 #### ----------------------------------------------------------------
21510
21511 !!test
21512 LST Sections: 1. Simple section start and end
21513 !! wikitext
21514 <section begin="2011-05-16" />
21515 <section end="2014-04-10 (MW 1.23wmf22)" />
21516 !! html/parsoid
21517 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
21518 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
21519 !! end
21520
21521 #--------- Test stripping of empty nodes in template content ----------
21522 !!test
21523 Empty LI and TR nodes should be stripped from template content
21524 !!wikitext
21525 {{EmptyLITest}}
21526 {{EmptyTRTest}}
21527 !!html/parsoid
21528 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
21529 <li>a</li>
21530 <li>b</li>
21531 </ul>
21532 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
21533 <tbody>
21534 <tr>
21535 <td>foo</td>
21536 </tr>
21537 <tr>
21538 <td>bar</td>
21539 </tr>
21540 </tbody>
21541 </table>
21542 !!end
21543
21544 !!test
21545 Empty LI and TR nodes should not be stripped from top-level content
21546 !!wikitext
21547 * a
21548 *
21549 * b
21550 {|
21551 |-
21552 |-
21553 |foo
21554 |}
21555 !!html/parsoid
21556 <ul>
21557 <li> a</li>
21558 <li></li>
21559 <li> b</li>
21560 </ul>
21561 <table>
21562 <tbody>
21563 <tr></tr>
21564 <tr>
21565 <td>foo</td>
21566 </tr>
21567 </tbody>
21568 </table>
21569 !!end
21570
21571 !!test
21572 Empty TR nodes should not be stripped if they have any attributes set
21573 !!wikitext
21574 {{EmptyTRWithHTMLAttrTest}}
21575 !!html/parsoid
21576 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
21577 <tr align="center"></tr>
21578 <tr><td>foo</td></tr>
21579 <tr align="center"></tr>
21580 <tr><td>bar</td></tr>
21581 </table>
21582 !!end
21583
21584 #### ----------------------------------------------------------------
21585 #### The following section of tests are primarily to test
21586 #### wikitext escaping capabilities of Parsoid. Given that
21587 #### escaping can be done any number of ways, the wikitext (input)
21588 #### is always adjusted to reflect how Parsoid adds nowiki
21589 #### escape tags.
21590 ####
21591 #### We are marking several tests as parsoid-only since the
21592 #### HTML in the result section is different from what the
21593 #### PHP parser generates for it.
21594 #### ----------------------------------------------------------------
21595
21596
21597 #### --------------- Headings ---------------
21598 #### 0. Unnested
21599 #### 1. Nested inside html <h1>=foo=</h1>
21600 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
21601 #### 3. Nested inside html with wikitext split by html tags
21602 #### 4. No escape needed
21603 #### 5. Empty headings <h1></h1>
21604 #### 6. Heading chars in SOL context
21605 #### ----------------------------------------
21606 !! test
21607 Headings: 0. Unnested
21608 !! options
21609 parsoid
21610 !! wikitext
21611 <nowiki>=foo=</nowiki>
21612
21613 <nowiki> =foo= </nowiki>
21614 <!--cmt-->
21615 <nowiki>=foo=</nowiki>
21616
21617 =foo''a''<nowiki>=</nowiki>
21618 !! html
21619 <p><span typeof="mw:Nowiki">=foo=</span></p>
21620
21621 <p><span typeof="mw:Nowiki"> =foo= </span>
21622 <!--cmt-->
21623 <span typeof="mw:Nowiki">=foo=</span></p>
21624
21625 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
21626 !!end
21627
21628 # New headings and existing headings are handled differently
21629 !! test
21630 Headings: 1. Nested inside html
21631 !! options
21632 parsoid=html2wt
21633 !! html
21634 <h1>=foo=</h1>
21635 <h2>=foo=</h2>
21636 <h3>=foo=</h3>
21637
21638 <h1 data-parsoid=''>=foo=</h1>
21639 <h2 data-parsoid=''>=foo=</h2>
21640 <h3 data-parsoid=''>=foo=</h3>
21641 <h4 data-parsoid=''>=foo=</h4>
21642 <h5 data-parsoid=''>=foo=</h5>
21643 <h6 data-parsoid=''>=foo=</h6>
21644 !! wikitext
21645 = =foo= =
21646
21647 == =foo= ==
21648
21649 === =foo= ===
21650
21651 =<nowiki>=foo=</nowiki>=
21652 ==<nowiki>=foo=</nowiki>==
21653 ===<nowiki>=foo=</nowiki>===
21654 ====<nowiki>=foo=</nowiki>====
21655 =====<nowiki>=foo=</nowiki>=====
21656 ======<nowiki>=foo=</nowiki>======
21657
21658 !!end
21659
21660 !! test
21661 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
21662 !! options
21663 parsoid=html2wt
21664 !! html
21665 <h1>foo</h1>*bar
21666 <h1>foo</h1>=bar
21667 <h1>foo</h1>=bar=
21668 !! wikitext
21669 = foo =
21670 <nowiki>*</nowiki>bar
21671
21672 = foo =
21673 =bar
21674
21675 = foo =
21676 <nowiki>=bar=</nowiki>
21677 !!end
21678
21679 !! test
21680 Headings: 3. Nested inside html with wikitext split by html tags
21681 !! options
21682 parsoid=html2wt,wt2wt
21683 !! wikitext
21684 = ='''bold'''<nowiki>foo=</nowiki> =
21685 !! html/parsoid
21686 <h1>=<b>bold</b>foo=</h1>
21687 !!end
21688
21689 !! test
21690 Headings: 4a. No escaping needed (testing just h1 and h2)
21691 !! wikitext
21692 = =foo =
21693
21694 = foo= =
21695
21696 = =foo= =
21697
21698 = =foo= bar =
21699
21700 == =foo ==
21701
21702 == foo= ==
21703
21704 = = =
21705
21706 = ''=''foo= =
21707 !! html/parsoid
21708 <h1>=foo</h1>
21709 <h1>foo=</h1>
21710 <h1> =foo= </h1>
21711 <h1>=foo= bar</h1>
21712 <h2>=foo</h2>
21713 <h2>foo=</h2>
21714 <h1>=</h1>
21715 <h1><i>=</i>foo=</h1>
21716 !!end
21717
21718 !! test
21719 Headings: 4b. No escaping needed (inside p-tags)
21720 !! options
21721 parsoid=html2wt
21722 !! html
21723 <p>===
21724 =foo= x
21725 =foo= <s></s>
21726 </p>
21727 !! wikitext
21728 ===
21729 =foo= x
21730 =foo= <s></s>
21731 !!end
21732
21733 !! test
21734 Headings: 5. Empty headings
21735 !! wikitext
21736 =<nowiki/>=
21737
21738 ==<nowiki/>==
21739
21740 ===<nowiki/>===
21741
21742 ====<nowiki/>====
21743
21744 =====<nowiki/>=====
21745
21746 ======<nowiki/>======
21747 !! html/parsoid
21748 <h1 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h1>
21749
21750 <h2 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h2>
21751
21752 <h3 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h3>
21753
21754 <h4 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h4>
21755
21756 <h5 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h5>
21757
21758 <h6 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h6>
21759 !!end
21760
21761 !! test
21762 Headings: 6a. Heading chars in SOL context (with trailing spaces)
21763 !! wikitext
21764 <nowiki>=a=</nowiki>
21765
21766 <nowiki>=a=</nowiki>
21767
21768 <nowiki>=a=</nowiki>
21769
21770 <nowiki>=a=</nowiki>
21771 !! html/php
21772 <p>=a=
21773 </p><p>=a=
21774 </p><p>=a=
21775 </p><p>=a=
21776 </p>
21777 !! html/parsoid
21778 <p><span typeof="mw:Nowiki">=a=</span></p>
21779
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 !!end
21786
21787 !! test
21788 Headings: 6b. Heading chars in SOL context (with trailing newlines)
21789 !! wikitext
21790 <nowiki>=a=
21791 b</nowiki>
21792
21793 <nowiki>=a=
21794 b</nowiki>
21795
21796 <nowiki>=a=
21797 b</nowiki>
21798
21799 <nowiki>=a=
21800 b</nowiki>
21801 !! html/php
21802 <p>=a=
21803 b
21804 </p><p>=a=
21805 b
21806 </p><p>=a=
21807 b
21808 </p><p>=a=
21809 b
21810 </p>
21811 !! html/parsoid
21812 <p><span typeof="mw:Nowiki">=a=
21813 b</span></p>
21814
21815 <p><span typeof="mw:Nowiki">=a=
21816 b</span></p>
21817
21818 <p><span typeof="mw:Nowiki">=a=
21819 b</span></p>
21820
21821 <p><span typeof="mw:Nowiki">=a=
21822 b</span></p>
21823 !!end
21824
21825 !! test
21826 Headings: 6c. Heading chars in SOL context (leading newline break)
21827 !! wikitext
21828 a
21829 <nowiki>=b=</nowiki>
21830 !! html/php
21831 <p>a
21832 =b=
21833 </p>
21834 !! html/parsoid
21835 <p>a
21836 <span typeof="mw:Nowiki">=b=</span>
21837 !!end
21838
21839 !! test
21840 Headings: 6d. Heading chars in SOL context (with interspersed comments)
21841 !! wikitext
21842 <!--c0--><nowiki>=a=</nowiki>
21843
21844 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
21845 !! html/php
21846 <p>=a=
21847 </p><p>=a=
21848 </p>
21849 !! html/parsoid
21850 <!--c0--><p><span typeof="mw:Nowiki">=a=</span></p>
21851
21852 <!--c1--><p><span typeof="mw:Nowiki">=a=</span></p> <!--c2--> <!--c3-->
21853 !!end
21854
21855 !! test
21856 Headings: 6d. Heading chars in SOL context (No escaping needed)
21857 !! options
21858 parsoid=html2wt
21859 !! html/parsoid
21860 =a=<div>b</div>
21861 !! wikitext
21862 =a=<div>b</div>
21863 !!end
21864
21865 !! test
21866 Headings: 7. Insert a newline between new content and headings
21867 !! options
21868 parsoid=html2wt
21869 !! html/parsoid
21870 <h2>NEW</h2>
21871 <p>new</p>
21872 <h2 data-parsoid='{}'>A</h2>
21873 <p data-parsoid='{}'>a</p>
21874 !! wikitext
21875 == NEW ==
21876 new
21877
21878 ==A==
21879 a
21880
21881 !! end
21882
21883 #### --------------- Lists ---------------
21884 #### 0. Outside nests (*foo, etc.)
21885 #### 1. Nested inside html <ul><li>*foo</li></ul>
21886 #### 2. Inside definition lists
21887 #### 3. Only bullets at start should be escaped
21888 #### 4. No escapes needed
21889 #### 5. No unnecessary escapes
21890 #### 6. Escape bullets in SOL position
21891 #### 7. Escape bullets in a multi-line context
21892 #### ----------------------------------------
21893
21894 !! test
21895 Lists: 0. Outside nests
21896 !! wikitext
21897 <nowiki>*</nowiki>foo
21898
21899 <nowiki>#</nowiki>foo
21900
21901 <nowiki>;Foo:</nowiki>bar
21902 !! html/php
21903 <p>*foo
21904 </p><p>#foo
21905 </p><p>;Foo:bar
21906 </p>
21907 !! html/parsoid
21908 <p><span typeof="mw:Nowiki">*</span>foo</p>
21909
21910 <p><span typeof="mw:Nowiki">#</span>foo</p>
21911
21912 <p><span typeof="mw:Nowiki">;Foo:</span>bar</p>
21913 !!end
21914
21915 !! test
21916 Lists: 1. Nested inside html
21917 !! wikitext
21918 *<nowiki>*foo</nowiki>
21919
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 !! html
21934 <ul><li>*foo</li></ul>
21935 <ul><li>#foo</li></ul>
21936 <ul><li>:foo</li></ul>
21937 <ul><li>;foo</li></ul>
21938 <ol><li>*foo</li></ol>
21939 <ol><li>#foo</li></ol>
21940 <ol><li>:foo</li></ol>
21941 <ol><li>;foo</li></ol>
21942
21943 !!end
21944
21945 !! test
21946 Lists: 2. Inside definition lists
21947 !! wikitext
21948 ;<nowiki>;foo</nowiki>
21949
21950 ;<nowiki>:foo</nowiki>
21951
21952 ;<nowiki>:foo</nowiki>
21953 :bar
21954
21955 :<nowiki>:foo</nowiki>
21956 !! html
21957 <dl><dt>;foo</dt></dl>
21958 <dl><dt>:foo</dt></dl>
21959 <dl><dt>:foo</dt>
21960 <dd>bar</dd></dl>
21961 <dl><dd>:foo</dd></dl>
21962
21963 !!end
21964
21965 !! test
21966 Lists: 3. Only bullets at start of text should be escaped
21967 !! wikitext
21968 *<nowiki>*foo*bar</nowiki>
21969
21970 *<nowiki>*foo</nowiki>''it''*bar
21971 !! html
21972 <ul><li>*foo*bar</li></ul>
21973 <ul><li>*foo<i>it</i>*bar</li></ul>
21974
21975 !!end
21976
21977 !! test
21978 Lists: 4. No escapes needed
21979 !! options
21980 parsoid
21981 !! wikitext
21982 *foo*bar
21983
21984 *''foo''*bar
21985
21986 *[[Foo]]: bar
21987
21988 *[[Foo]]*bar
21989 !! html
21990 <ul>
21991 <li>foo*bar
21992 </li>
21993 </ul>
21994 <ul>
21995 <li><i>foo</i>*bar
21996 </li>
21997 </ul>
21998 <ul>
21999 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22000 </li>
22001 </ul>
22002 <ul>
22003 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22004 </li>
22005 </ul>
22006 !!end
22007
22008 !! test
22009 Lists: 5. No unnecessary escapes
22010 !! wikitext
22011 * bar <span><nowiki>[[foo]]</nowiki></span>
22012
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>foo]]</span>=
22020
22021 * <s></s>: a
22022
22023 * ''* foo''
22024 !! html
22025 <ul><li> bar <span>[[foo]]</span></li></ul>
22026 <ul><li> =bar <span>[[foo]]</span></li></ul>
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> <s></s>: a</li></ul>
22031 <ul><li> <i>* foo</i></li></ul>
22032
22033 !!end
22034
22035 !! test
22036 Lists: 6. Escape bullets in SOL position
22037 !! options
22038 parsoid=html2wt
22039 !! html
22040 <p><!--cmt-->*foo</p>
22041 !! wikitext
22042 <!--cmt--><nowiki>*</nowiki>foo
22043 !!end
22044
22045 !! test
22046 Lists: 7. Escape bullets in a multi-line context
22047 !! wikitext
22048 a
22049 <nowiki>*</nowiki>b
22050 !! html
22051 <p>a
22052 *b
22053 </p>
22054 !!end
22055
22056 !! test
22057 Lists: 8. Escape colons only if not present in tags
22058 !! options
22059 parsoid=html2wt
22060 !! html
22061 <dl><dt>a:b<i>c:d</i></dt></dl>
22062 !! wikitext
22063 ; <nowiki>a:b</nowiki>''c:d''
22064 !! end
22065
22066 #### --------------- HRs ---------------
22067 #### 1. Single line
22068 #### -----------------------------------
22069
22070 !! test
22071 HRs: 1. Single line
22072 !! wikitext
22073 ----<nowiki>----</nowiki>
22074 ----=foo=
22075 ----*foo
22076 !! html+tidy
22077 <hr />
22078 <p>----</p>
22079 <hr />
22080 <p>=foo=</p>
22081 <hr />
22082 <p>*foo</p>
22083 !! end
22084
22085 #### --------------- Tables ---------------
22086 #### 1a. Simple example
22087 #### 1b. No escaping needed (!foo)
22088 #### 1c. No escaping needed (|foo)
22089 #### 1d. No escaping needed (|}foo)
22090 ####
22091 #### 2a. Nested in td (<td>foo|bar</td>)
22092 #### 2b. Nested in td (<td>foo||bar</td>)
22093 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22094 ####
22095 #### 3a. Nested in th (<th>foo!bar</th>)
22096 #### 3b. Nested in th (<th>foo!!bar</th>)
22097 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22098 ####
22099 #### 4a. Escape -
22100 #### 4b. Escape +
22101 #### 4c. No escaping needed
22102 #### --------------------------------------
22103
22104 !! test
22105 Tables: 1a. Simple example
22106 !! wikitext
22107 <nowiki>{|
22108 |}</nowiki>
22109 !! html
22110 <p>{|
22111 |}
22112 </p>
22113 !! end
22114
22115 !! test
22116 Tables: 1b. No escaping needed
22117 !! wikitext
22118 !foo
22119 !! html
22120 <p>!foo
22121 </p>
22122 !! end
22123
22124 !! test
22125 Tables: 1c. No escaping needed
22126 !! wikitext
22127 |foo
22128 !! html
22129 <p>|foo
22130 </p>
22131 !! end
22132
22133 !! test
22134 Tables: 1d. No escaping needed
22135 !! wikitext
22136 |}foo
22137 !! html
22138 <p>|}foo
22139 </p>
22140 !! end
22141
22142 !! test
22143 Tables: 2a. Nested in td
22144 !! options
22145 parsoid=html2wt
22146 !! html/parsoid
22147 <table><tbody><tr>
22148 <td>foo|bar</td></tr>
22149 <tr><td>x<div>a|b</div></td>
22150 </tbody></table>
22151 !! wikitext
22152 {|
22153 |<nowiki>foo|bar</nowiki>
22154 |-
22155 |x<div><nowiki>a|b</nowiki></div>
22156 |}
22157 !! html/php+tidy
22158 <table>
22159 <tr>
22160 <td>foo|bar</td>
22161 </tr>
22162 <tr>
22163 <td>x
22164 <div>a|b</div>
22165 </td>
22166 </tr>
22167 </table>
22168 !! end
22169
22170 !! test
22171 Tables: 2b. Nested in td
22172 !! options
22173 parsoid=html2wt
22174 !! html/parsoid
22175 <table><tbody><tr>
22176 <td>foo||bar</td>
22177 <td>a<i>b||c</i></td>
22178 <td>a<i><div>b||c</div></i></td>
22179 </tr></tbody></table>
22180 !! wikitext
22181 {|
22182 |<nowiki>foo||bar</nowiki>
22183 |a''<nowiki>b||c</nowiki>''
22184 |a''<div><nowiki>b||c</nowiki></div>''
22185 |}
22186 !! html/php
22187 <table>
22188 <tr>
22189 <td>foo||bar
22190 </td>
22191 <td>a<i>b||c</i>
22192 </td>
22193 <td>a<i><div>b||c</div></i>
22194 </td></tr></table>
22195
22196 !! end
22197
22198 !! test
22199 Tables: 2c. Nested in td -- no escaping needed
22200 !! wikitext
22201 {|
22202
22203 |foo!!bar
22204 |}
22205 !! html/*
22206 <table>
22207
22208 <tr>
22209 <td>foo!!bar
22210 </td></tr></table>
22211
22212 !! end
22213
22214 !! test
22215 Tables: 3a. Nested in th
22216 !! wikitext
22217 {|
22218
22219 !foo!bar
22220 |}
22221 !! html/*
22222 <table>
22223
22224 <tr>
22225 <th>foo!bar
22226 </th></tr></table>
22227
22228 !! end
22229
22230 !! test
22231 Tables: 3b. Nested in th
22232 !! options
22233 parsoid=html2wt
22234 !! html/parsoid
22235 <table><tbody>
22236 <tr><th>foo!!bar</th>
22237 <th><i>foo|bar</i></th>
22238 <th><i>foo!!bar</i></th>
22239 <th><i><span>foo!!bar</span></i></th>
22240 </tr></tbody></table>
22241 !! wikitext
22242 {|
22243 !<nowiki>foo!!bar</nowiki>
22244 !''<nowiki>foo|bar</nowiki>''
22245 !''<nowiki>foo!!bar</nowiki>''
22246 !''<span><nowiki>foo!!bar</nowiki></span>''
22247 |}
22248 !! html/php
22249 <table>
22250 <tr>
22251 <th>foo!!bar
22252 </th>
22253 <th><i>foo|bar</i>
22254 </th>
22255 <th><i>foo!!bar</i>
22256 </th>
22257 <th><i><span>foo!!bar</span></i>
22258 </th></tr></table>
22259
22260 !! end
22261
22262 !! test
22263 Tables: 3c. Nested in th
22264 !! options
22265 parsoid=html2wt
22266 !! html/parsoid
22267 <table><tbody>
22268 <tr><th>foo||bar</th>
22269 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22270 </tr></tbody></table>
22271 !! wikitext
22272 {|
22273 !<nowiki>foo||bar</nowiki>
22274 !<nowiki>foo||bar</nowiki>
22275 |}
22276 !! html/php
22277 <table>
22278 <tr>
22279 <th>foo||bar
22280 </th>
22281 <th>foo||bar
22282 </th></tr></table>
22283
22284 !! end
22285
22286 !! test
22287 Tables: 4a. Escape -
22288 !! options
22289 parsoid=html2wt
22290 !! html/*
22291 <table>
22292
22293 <tr>
22294 <th>-bar
22295 </th></tr>
22296 <tr>
22297 <td>-bar
22298 </td></tr></table>
22299
22300 !! wikitext
22301 {|
22302
22303 !-bar
22304
22305 |-
22306 |<nowiki>-bar</nowiki>
22307 |}
22308 !! end
22309
22310 !! test
22311 Tables: 4b. Escape +
22312 !! options
22313 parsoid=html2wt
22314 !! html/*
22315 <table>
22316
22317 <tr>
22318 <th>+bar
22319 </th></tr>
22320 <tr>
22321 <td>+bar
22322 </td></tr></table>
22323
22324 !! wikitext
22325 {|
22326
22327 !+bar
22328
22329 |-
22330 |<nowiki>+bar</nowiki>
22331 |}
22332 !! end
22333
22334 !! test
22335 Tables: 4c. No escaping needed
22336 !! wikitext
22337 {|
22338 |foo-bar
22339 |foo+bar
22340 |-
22341 |''foo''-bar
22342 |''foo''+bar
22343 |-
22344 |foo
22345 bar|baz
22346 +bar
22347 -bar
22348 |-
22349 |x
22350 <div>a|b</div>
22351 |}
22352 !! html/php
22353 <table>
22354 <tr>
22355 <td>foo-bar
22356 </td>
22357 <td>foo+bar
22358 </td></tr>
22359 <tr>
22360 <td><i>foo</i>-bar
22361 </td>
22362 <td><i>foo</i>+bar
22363 </td></tr>
22364 <tr>
22365 <td>foo
22366 <p>bar|baz
22367 +bar
22368 -bar
22369 </p>
22370 </td></tr>
22371 <tr>
22372 <td>x
22373 <div>a|b</div>
22374 </td></tr></table>
22375
22376 !! html/parsoid
22377 <table><tbody>
22378 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22379 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22380 <tr><td>foo
22381 <p>bar|baz
22382 +bar
22383 -bar</p></td></tr>
22384 <tr><td>x
22385 <div>a|b</div></td>
22386 </tbody></table>
22387 !! end
22388
22389 !! test
22390 Tables: 4d. No escaping needed
22391 !! wikitext
22392 {|
22393 |[[Foo]]-bar
22394 ||+1
22395 ||-2
22396 |}
22397 !! html/php
22398 <table>
22399 <tr>
22400 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
22401 </td>
22402 <td>+1
22403 </td>
22404 <td>-2
22405 </td></tr></table>
22406
22407 !! html/parsoid
22408 <table>
22409 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
22410 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
22411 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
22412 </tbody></table>
22413 !! end
22414
22415 !! test
22416 Tables: Digest broken attributes on table and tr tag
22417 !! options
22418 parsoid=wt2html
22419 !! wikitext
22420 {| || |} ++
22421 |- || || ++ --
22422 |- > [
22423 |}
22424 !! html
22425 <table>
22426 <tbody>
22427 <tr></tr>
22428 <tr></tr>
22429 </tbody></table>
22430 !! end
22431
22432 !! test
22433 T97430: Don't emit empty nowiki pairs around marker meta tags
22434 !! options
22435 parsoid=html2wt
22436 !! html
22437 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22438 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
22439 !! wikitext
22440 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22441 <nowiki>|</nowiki>** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
22442 !! end
22443
22444 !! test
22445 Unclosed xmlish element in table line shouldn't eat end delimiters
22446 !! wikitext
22447 {|
22448 | <foo
22449 | bar>
22450 |}
22451 !! html/php
22452 <table>
22453 <tr>
22454 <td> &lt;foo
22455 </td>
22456 <td> bar&gt;
22457 </td></tr></table>
22458
22459 !! html/parsoid
22460 <table>
22461 <tbody><tr><td> &lt;foo</td>
22462 <td> bar></td></tr>
22463 </tbody></table>
22464 !! end
22465
22466 #### --------------- Links ----------------
22467 #### 1. Quote marks in link text
22468 #### 2. Wikilinks: Escapes needed
22469 #### 3. Wikilinks: No escapes needed
22470 #### 4. Extlinks: Escapes needed
22471 #### 5. Extlinks: No escapes needed
22472 #### --------------------------------------
22473 !! test
22474 Links 1. WikiLinks: No escapes needed
22475 !! wikitext
22476 [[Foo|Foo''boo'']]
22477 [[Foo|[Foobar]]]
22478 [[Foo|x [Foobar] x]]
22479 !! html/php
22480 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
22481 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
22482 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
22483 </p>
22484 !! html/parsoid
22485 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
22486 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
22487 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
22488 !! end
22489
22490 !! test
22491 Links 2. WikiLinks: Escapes needed
22492 !! options
22493 parsoid=html2wt
22494 !! html/parsoid
22495 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
22496 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
22497 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
22498 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
22499 <a href="Foo" rel="mw:WikiLink">|Bar</a>
22500 <a href="Foo" rel="mw:WikiLink">]]bar</a>
22501 <a href="Foo" rel="mw:WikiLink">[[bar</a>
22502 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
22503 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
22504 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
22505 !! wikitext
22506 [[Foo|<nowiki>Foobar]</nowiki>]]
22507 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
22508 [[Foo|<nowiki>[[Bar]]</nowiki>]]
22509 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
22510 [[Foo|<nowiki>|Bar</nowiki>]]
22511 [[Foo|<nowiki>]]bar</nowiki>]]
22512 [[Foo|<nowiki>[[bar</nowiki>]]
22513 [[Foo|<nowiki>x [[ y</nowiki>]]
22514 [[Foo|<nowiki>x ]] y</nowiki>]]
22515 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
22516 !! html/php
22517 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
22518 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
22519 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
22520 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
22521 <a href="/wiki/Foo" title="Foo">|Bar</a>
22522 <a href="/wiki/Foo" title="Foo">]]bar</a>
22523 <a href="/wiki/Foo" title="Foo">[[bar</a>
22524 <a href="/wiki/Foo" title="Foo">x [[ y</a>
22525 <a href="/wiki/Foo" title="Foo">x ]] y</a>
22526 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
22527 </p>
22528 !! end
22529
22530 !! test
22531 Links 3. WikiLinks: No escapes needed
22532 !! wikitext
22533 [[Foo|[Foobar]]
22534 [[Foo|foo|bar]]
22535 !! html/php
22536 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
22537 <a href="/wiki/Foo" title="Foo">foo|bar</a>
22538 </p>
22539 !! html/parsoid
22540 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
22541 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
22542 !! end
22543
22544 !! test
22545 Links 4. ExtLinks: Escapes needed
22546 !! options
22547 parsoid=html2wt
22548 !! html/parsoid
22549 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
22550 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
22551 <p>[http://google.com]</p>
22552 <p>[http://google.com google]</p>
22553 !! wikitext
22554 [http://google.com <nowiki>[google]</nowiki>]
22555 [http://google.com <nowiki>google]</nowiki>]
22556
22557 <nowiki>[http://google.com]</nowiki>
22558
22559 <nowiki>[http://google.com google]</nowiki>
22560
22561 !! html/php
22562 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
22563 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
22564 </p><p>[http://google.com]
22565 </p><p>[http://google.com google]
22566 </p>
22567 !! end
22568
22569 !! test
22570 Links 5. ExtLinks: No escapes needed
22571 !! wikitext
22572 [http://google.com [google]
22573 !! html/php
22574 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
22575 </p>
22576 !! html/parsoid
22577 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
22578 !! end
22579
22580 !! test
22581 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
22582 !! html/parsoid
22583 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
22584 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
22585 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
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>,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(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
22596 </p>
22597 !! wikitext
22598 x<nowiki/>http://example.com<nowiki/>y
22599 http://example.com<nowiki/>?x
22600 http://example.com<nowiki/>&x
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(x<nowiki/>)
22611 !! end
22612
22613 !! test
22614 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22615 !! html/parsoid
22616 <p>x
22617 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
22618 y
22619 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
22620 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
22621 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
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 </p>
22625 !! wikitext
22626 x
22627 http://example.com
22628 y
22629 "http://example.com"
22630 (http://example.com)
22631 (http://example.com) foo
22632 http://example.com,
22633 http://example.com, foo
22634 !! html/php
22635 <p>x
22636 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
22637 y
22638 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
22639 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
22640 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
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 </p>
22644 !! end
22645
22646 !! test
22647 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22648 !! html/parsoid
22649 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
22650 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
22651 !! wikitext
22652 http://example.com.,;:!?\
22653 -http://example.com:
22654 !! html/php
22655 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
22656 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
22657 </p>
22658 !! end
22659
22660 !! test
22661 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
22662 !! html/parsoid
22663 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
22664 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
22665 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
22666 !! wikitext
22667 RFC 123<nowiki/>4
22668 RFC 123<nowiki/>y
22669 X<nowiki/>RFC 123<nowiki/>y
22670 !! end
22671
22672 !! test
22673 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
22674 !! html/parsoid
22675 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
22676 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
22677 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
22678 </p>
22679 !! wikitext
22680 RFC 123?foo
22681 RFC 123&foo
22682 -RFC 123-
22683 !! html/php
22684 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
22685 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
22686 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
22687 </p>
22688 !! end
22689
22690 !! test
22691 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
22692 !! html/parsoid
22693 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
22694 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22695 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22696 !! wikitext
22697 PMID 123<nowiki/>4
22698 PMID 123<nowiki/>y
22699 X<nowiki/>PMID 123<nowiki/>y
22700 !! end
22701
22702 !! test
22703 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
22704 !! html/parsoid
22705 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
22706 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
22707 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
22708 </p>
22709 !! wikitext
22710 PMID 123?foo
22711 PMID 123&foo
22712 -PMID 123-
22713 !! html/php
22714 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
22715 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
22716 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
22717 </p>
22718 !! end
22719
22720 !! test
22721 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
22722 !! html/parsoid
22723 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
22724 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
22725 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
22726 </p>
22727 !! wikitext
22728 ISBN 1234567890<nowiki/>1
22729 ISBN 1234567890<nowiki/>x
22730 a<nowiki/>ISBN 1234567890<nowiki/>b
22731 !! end
22732
22733 !! test
22734 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
22735 !! html/parsoid
22736 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
22737 !! wikitext
22738 -ISBN 1234567890's
22739 !! html/php
22740 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
22741 </p>
22742 !! end
22743
22744 !! test
22745 Links 14. Protect link-like plain text. (Parsoid bug T78425)
22746 !! options
22747 parsoid=html2wt
22748 !! html/*
22749 <p>this is not a link: http://example.com
22750 </p>
22751 !! wikitext
22752 this is not a link: <nowiki>http://example.com</nowiki>
22753 !! end
22754
22755 !! test
22756 Links 15. Link trails can't become link prefixes.
22757 !! options
22758 language=is
22759 !! wikitext
22760 [[Söfnuður]]-[[00]]
22761 !! html/php
22762 <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>
22763 </p>
22764 !! html/parsoid
22765 <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>
22766 !! end
22767
22768 #### --------------- Quotes ---------------
22769 #### 1. Quotes inside <b> and <i>
22770 #### 2. Link fragments separated by <i> and <b> tags
22771 #### 3. Link fragments inside <i> and <b>
22772 #### 4. No escaping needed
22773 #### --------------------------------------
22774 !! test
22775 1a. Quotes inside <b> and <i>
22776 !! options
22777 parsoid=html2wt,wt2wt
22778 !! wikitext
22779 ''<nowiki/>'foo'''
22780 ''<nowiki>''foo''</nowiki>''
22781 ''<nowiki>'''foo'''</nowiki>''
22782 ''foo''<nowiki/>'s
22783 '''<nowiki/>'foo''''
22784 '''<nowiki>''foo''</nowiki>'''
22785 '''<nowiki>'''foo'''</nowiki>'''
22786 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
22787 '''foo'''<nowiki/>'s
22788 '''foo''
22789 ''foo''<nowiki/>'
22790 ''foo'''<nowiki/>'
22791 '''foo''<nowiki/>'
22792 ''''foo'''
22793 '''foo'''<nowiki/>'
22794 ''''foo'''<nowiki/>'
22795 ''fools'<span> errand</span>''
22796 ''<span>fool</span>'s errand''
22797 '<nowiki/>''foo'' bar '''baz''
22798 a|!*#-:;+-~[]{}b'''x''
22799 !! html/*
22800 <p><i>'foo'</i>
22801 <i>''foo''</i>
22802 <i>'''foo'''</i>
22803 <i>foo</i>'s
22804 <b>'foo'</b>
22805 <b>''foo''</b>
22806 <b>'''foo'''</b>
22807 <b>foo'<i>bar'</i>baz</b>
22808 <b>foo</b>'s
22809 '<i>foo</i>
22810 <i>foo</i>'
22811 <i>foo'</i>'
22812 '<i>foo</i>'
22813 '<b>foo</b>
22814 <b>foo</b>'
22815 '<b>foo</b>'
22816 <i>fools'<span> errand</span></i>
22817 <i><span>fool</span>'s errand</i>
22818 '<i>foo</i> bar '<i>baz</i>
22819 a|!*#-:;+-~[]{}b'<i>x</i>
22820 </p>
22821 !! end
22822
22823 !! test
22824 1b. Quotes inside <b> and <i> with other tags on same line
22825 !! options
22826 parsoid=html2wt,wt2wt
22827 !! wikitext
22828 '''a'' foo ''[[bar]]''
22829 ''a''' foo ''[[bar]]''
22830 ''a''' foo '''{{echo|[[bar]]}}'''
22831 [[foo]] x'''[[bar]]''
22832 '''foo'' <ref>test</ref>
22833 '''foo'' <div title="name">test</div>
22834 '''foo'' and <br> bar
22835 <references />
22836 !! html
22837 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22838 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22839 <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>
22840 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
22841 '<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>
22842 '<i>foo</i> <div title="name">test</div>
22843 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
22844 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22845 <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>
22846 </ol>
22847 !! end
22848
22849 !! test
22850 2. Link fragments separated by <i> and <b> tags
22851 !! wikitext
22852 [[''foo''<nowiki>hello]]</nowiki>
22853
22854 [['''foo'''<nowiki>hello]]</nowiki>
22855 !! html
22856 <p>[[<i>foo</i>hello]]
22857 </p><p>[[<b>foo</b>hello]]
22858 </p>
22859 !! end
22860
22861 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
22862 # this is one of the shortcomings of this format
22863 !! test
22864 3. Link fragments inside <i> and <b>
22865 !! wikitext
22866 ''[[foo''<nowiki>]]</nowiki>
22867
22868 '''[[foo'''<nowiki>]]</nowiki>
22869 !! html
22870 <p><i>[[foo</i>]]
22871 </p><p><b>[[foo</b>]]
22872 </p>
22873 !! end
22874
22875 !! test
22876 4. No escaping needed
22877 !! wikitext
22878 '<span>''bar''</span>'
22879 '<span>'''bar'''</span>'
22880 'a:b'foo
22881 !! html
22882 <p>'<span><i>bar</i></span>'
22883 '<span><b>bar</b></span>'
22884 'a:b'foo
22885 </p>
22886 !! end
22887
22888 #### ----------- Paragraphs ---------------
22889 #### 1. No unnecessary escapes
22890 #### --------------------------------------
22891
22892 !! test
22893 1. No unnecessary escapes
22894 !! wikitext
22895 bar <span><nowiki>[[foo]]</nowiki></span>
22896
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>foo]]</span><nowiki>=</nowiki>
22904 !! html
22905 <p>bar <span>[[foo]]</span>
22906 </p><p>=bar <span>[[foo]]</span>
22907 </p><p>[[bar <span>[[foo]]</span>
22908 </p><p>]]bar <span>[[foo]]</span>
22909 </p><p>=bar <span>foo]]</span>=
22910 </p>
22911 !!end
22912
22913 #### ----------------------- PRE --------------------------
22914 #### 1. Leading whitespace in SOL context should be escaped
22915 #### ------------------------------------------------------
22916 !! test
22917 1. Leading whitespace in SOL context should be escaped
22918 !! options
22919 parsoid
22920 !! wikitext
22921 <nowiki> </nowiki>a
22922
22923 <nowiki> </nowiki> a
22924
22925 <nowiki> </nowiki>a(tab)
22926
22927 <nowiki> </nowiki> a
22928 <!--cmt-->
22929 <nowiki> </nowiki> a
22930
22931 a
22932 <nowiki> </nowiki>b
22933
22934 a
22935 <nowiki> </nowiki>b
22936
22937 a
22938 <nowiki> </nowiki> b
22939 !! html
22940 <p> a</p>
22941 <p> a</p>
22942 <p> a(tab)</p>
22943 <p> a</p>
22944 <p><!--cmt--> a</p>
22945 <p>a
22946 b</p>
22947 <p>a
22948 b</p>
22949 <p>a
22950 b</p>
22951 !! end
22952
22953 !! test
22954 2. Leading whitespace in non-indent-pre contexts should not be escaped
22955 !! options
22956 parsoid
22957 !! wikitext
22958 foo <ref>''a''
22959 b</ref>
22960 <references />
22961 !! html
22962 <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>
22963 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22964 <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>
22965 b</span></li>
22966 </ol>
22967 !! end
22968
22969 !! test
22970 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
22971 !! options
22972 parsoid
22973 !! wikitext
22974 <blockquote>
22975 a
22976 <span>b</span>
22977 c
22978 </blockquote>
22979 !! html
22980 <blockquote>
22981 <p>
22982 a
22983 <span>b</span>
22984 c</p>
22985 </blockquote>
22986 !! end
22987
22988 !! test
22989 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
22990 !! options
22991 parsoid
22992 !! wikitext
22993 [[File:Foobar.jpg|thumb|caption]]
22994 !! html/parsoid
22995 <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>
22996 !! end
22997
22998 !! test
22999 5. Nowiki escaping should account for indent-pres
23000 !! options
23001 parsoid=html2wt
23002 !! html
23003 <pre>==foo==</pre>
23004 !! wikitext
23005 ==foo==
23006 !! end
23007
23008 !!test
23009 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23010 !! options
23011 parsoid
23012 !! wikitext
23013 * foo
23014 * bar
23015 !! html
23016 <pre>
23017 * foo
23018 * bar
23019 </pre>
23020 !! end
23021
23022 #### --------------- Behavior Switches --------------------
23023
23024 !! test
23025 1. Valid behavior switches should be escaped
23026 !! options
23027 parsoid=html2wt
23028 !! html
23029 __TOC__
23030 <i>__TOC__</i>
23031 !! wikitext
23032 <nowiki>__TOC__</nowiki>
23033 ''<nowiki>__TOC__</nowiki>''
23034 !! end
23035
23036 !! test
23037 2. Invalid behavior switches should not be escaped
23038 !! options
23039 parsoid=html2wt
23040 !! html
23041 __TOO__
23042 __|__
23043 !! wikitext
23044 __TOO__
23045 __|__
23046 !! end
23047
23048 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23049 !! test
23050 Behavior switches should be SOL-transparent
23051 !! wikitext
23052 __TOC__
23053
23054 <!-- this one's bogus -->
23055 __TOO__
23056
23057 __TOC__ foo
23058
23059 __TOC__ bar
23060 !! html/parsoid
23061 <meta property="mw:PageProp/toc" />
23062
23063 <!-- this one's bogus -->
23064 <pre>__TOO__</pre>
23065
23066 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23067
23068 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23069 !! end
23070
23071 #### --------------- HTML tags ---------------
23072 #### 1. a tags
23073 #### 2. other tags
23074 #### 3. multi-line html tag
23075 #### 4. extension tags
23076 #### -----------------------------------------
23077 !! test
23078 1. a tags
23079 !! options
23080 parsoid
23081 !! wikitext
23082 <a href="http://google.com">google</a>
23083 !! html
23084 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23085 !! end
23086
23087 !! test
23088 2. other tags
23089 !! wikitext
23090 * <nowiki><div>foo</div></nowiki>
23091 * <nowiki><div style="color:red">foo</div></nowiki>
23092 * <nowiki><td></nowiki>
23093 !! html
23094 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23095 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23096 <li> &lt;td&gt;</li></ul>
23097
23098 !! end
23099
23100 !! test
23101 3. multi-line html tag
23102 !! wikitext
23103 <nowiki><div
23104 >foo</div
23105 ></nowiki>
23106 !! html
23107 <p>&lt;div
23108 &gt;foo&lt;/div
23109 &gt;
23110 </p>
23111 !! end
23112
23113 !! test
23114 4. extension tags
23115 !! wikitext
23116 <nowiki><ref>foo</ref></nowiki>
23117
23118 <nowiki><ref>bar</nowiki>
23119
23120 baz<nowiki></ref></nowiki>
23121 !! html
23122 <p>&lt;ref&gt;foo&lt;/ref&gt;
23123 </p><p>&lt;ref&gt;bar
23124 </p><p>baz&lt;/ref&gt;
23125 </p>
23126 !! end
23127
23128 #### --------------- Others ---------------
23129 !! test
23130 Escaping nowikis
23131 !! wikitext
23132 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23133 !! html
23134 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23135 </p>
23136 !! end
23137
23138 ## The quote-char in the input is necessary for triggering the bug
23139 !! test
23140 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23141 !! options
23142 parsoid=wt2wt,html2wt
23143 !! wikitext
23144 foo's bar :
23145 !! html
23146 <p>foo's bar :</p>
23147 !! end
23148
23149 !! test
23150
23151 Tag-like HTML structures are passed through as text
23152 !! wikitext
23153 <x y>
23154
23155 <x.y>
23156
23157 <x-y>
23158
23159 1>2
23160
23161 x<y
23162
23163 a>b
23164
23165 1<d e>f
23166 !! html
23167 <p>&lt;x y&gt;
23168 </p><p>&lt;x.y&gt;
23169 </p><p>&lt;x-y&gt;
23170 </p><p>1&gt;2
23171 </p><p>x&lt;y
23172 </p><p>a&gt;b
23173 </p><p>1&lt;d e&gt;f
23174 </p>
23175 !! end
23176
23177 !! test
23178 HTML tag with necessary entities in attributes
23179 !! wikitext
23180 <span title="&amp;amp;">foo</span>
23181 !! html
23182 <p><span title="&amp;amp;">foo</span>
23183 </p>
23184 !! end
23185
23186 !! test
23187 HTML tag with 'unnecessary' entity encoding in attributes
23188 !! wikitext
23189 <span title="&amp;">foo</span>
23190 !! html
23191 <p><span title="&amp;">foo</span>
23192 </p>
23193 !! end
23194
23195 !! test
23196 HTML tag with broken attribute value quoting
23197 !! wikitext
23198 <span title="Hello world>Foo</span>
23199 !! html/php
23200 <p><span>Foo</span>
23201 </p>
23202 !! html/parsoid
23203 <p><span title="Hello world">Foo</span>
23204 </p>
23205 !! end
23206
23207 !! test
23208 Parsoid-only: HTML tag with broken attribute value quoting
23209 !! options
23210 parsoid
23211 !! wikitext
23212 <span title="Hello world>Foo</span>
23213 !! html
23214 <p><span title="Hello world">Foo</span>
23215 </p>
23216 !! end
23217
23218 !! test
23219 Table with broken attribute value quoting
23220 !! wikitext
23221 {|
23222 | title="Hello world|Foo
23223 |}
23224 !! html/php
23225 <table>
23226 <tr>
23227 <td>Foo
23228 </td></tr></table>
23229
23230 !! html/parsoid
23231 <table>
23232 <tr>
23233 <td title="Hello world">Foo
23234 </td></tr></table>
23235
23236 !! end
23237
23238 !! test
23239 Table with broken attribute value quoting on consecutive lines
23240 !! wikitext
23241 {|
23242 | title="Hello world|Foo
23243 | style="color:red|Bar
23244 |}
23245 !! html/php
23246 <table>
23247 <tr>
23248 <td>Foo
23249 </td>
23250 <td>Bar
23251 </td></tr></table>
23252
23253 !! html/parsoid
23254 <table><tbody>
23255 <tr>
23256 <td title="Hello world">Foo
23257 </td><td style="color: red">Bar
23258 </td></tr></tbody></table>
23259
23260 !! end
23261
23262 !! test
23263 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23264 !! options
23265 parsoid
23266 !! wikitext
23267 {{}}
23268 !! html
23269 {{}}
23270 !! end
23271
23272 !! test
23273 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23274 !! options
23275 parsoid
23276 !! wikitext
23277 }}{{
23278 !! html
23279 }}{{
23280 !! end
23281
23282 !!test
23283 Accept empty td cell attribute
23284 !! wikitext
23285 {|
23286 | align="center" | foo || |
23287 |}
23288 !! html
23289 <table>
23290 <tr>
23291 <td align="center"> foo </td>
23292 <td>
23293 </td></tr></table>
23294
23295 !!end
23296
23297 !!test
23298 Non-empty attributes in th-cells
23299 !! wikitext
23300 {|
23301 ! Foo !! style="color: red" | Bar
23302 |}
23303 !! html
23304 <table>
23305 <tr>
23306 <th> Foo </th>
23307 <th style="color: red"> Bar
23308 </th></tr></table>
23309
23310 !!end
23311
23312 !!test
23313 Accept empty attributes in th-cells
23314 !! wikitext
23315 {|
23316 !| foo !!| bar
23317 |}
23318 !! html
23319 <table>
23320 <tr>
23321 <th> foo </th>
23322 <th> bar
23323 </th></tr></table>
23324
23325 !!end
23326
23327 !!test
23328 Empty table rows go away
23329 !! wikitext
23330 {|
23331 | Hello
23332 | there
23333 |- class="foo"
23334 |-
23335 |}
23336 !! html
23337 <table>
23338 <tr>
23339 <td> Hello
23340 </td>
23341 <td> there
23342 </td></tr>
23343
23344 </table>
23345
23346 !! end
23347
23348 ###
23349 ### Parsoid-centric tests for testing RTing of inter-element separators
23350 ### Edge cases not tested by existing parser tests and specific to
23351 ### Parsoid-specific serialization strategies.
23352 ###
23353
23354 !!test
23355 RT-ed inter-element separators should be valid separators
23356 !! wikitext
23357 {|
23358 |- [[foo]]
23359 |}
23360 !! html
23361 <table>
23362
23363 </table>
23364
23365 !!end
23366
23367 # Parsoid-only since PHP parser relies on Tidy for correct output
23368 !!test
23369 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
23370 !!options
23371 parsoid
23372 !! wikitext
23373 {|
23374 |<small>foo
23375 bar
23376 |}
23377
23378 {|
23379 |<small>foo<small>
23380 |}
23381 !! html
23382 <table>
23383 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
23384 <p>bar</p></small></td></tr>
23385 </tbody></table>
23386
23387 <table>
23388 <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>
23389 </tbody></table>
23390 !!end
23391
23392 # Note that the "style" attribute is really a template parameter here.
23393 # The = would have to be {{=}} if you wanted the literal.
23394 !!test
23395 Empty TD followed by TD with tpl-generated attribute
23396 !! wikitext
23397 {|
23398 |-
23399 |
23400 |{{echo|style='color:red'}}|foo
23401 |}
23402 !! html
23403 <table>
23404
23405 <tr>
23406 <td>
23407 </td>
23408 <td>foo
23409 </td></tr></table>
23410
23411 !!end
23412
23413 !!test
23414 Indented table with an empty td
23415 !! wikitext
23416 {|
23417 |-
23418 |
23419 |foo
23420 |}
23421 !! html
23422 <table>
23423
23424 <tr>
23425 <td>
23426 </td>
23427 <td>foo
23428 </td></tr></table>
23429
23430 !!end
23431
23432 ## We have some newline diffs RT-ing this edge case
23433 ## and it is not important enough -- we seem to be emitting
23434 ## at most 2 newlines after a </tr> and this is unrelated to
23435 ## the issue from T85627 that this is testing.
23436 !!test
23437 Indented table with blank lines in between (T85627)
23438 !! options
23439 parsoid=wt2html
23440 !! wikitext
23441 {|
23442 |foo
23443
23444
23445 |}
23446 !! html
23447 <table>
23448
23449 <tr>
23450 <td>foo
23451 </td></tr></table>
23452
23453 !!end
23454
23455 !!test
23456 Indented block & table
23457 !! wikitext
23458 <div>foo</div>
23459 {|
23460 |foo
23461 |}
23462 !! html/php
23463 <div>foo</div>
23464 <table>
23465 <tr>
23466 <td>foo
23467 </td></tr></table>
23468
23469 !! html/parsoid
23470 <div data-parsoid='{"stx":"html"}'>foo</div>
23471 <table><tbody>
23472 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
23473 </tbody></table>
23474 !!end
23475
23476 !! test
23477 Indent and comment before table row
23478 !! wikitext
23479 {|
23480 <!--hi-->|-
23481 | there
23482 |}
23483 !! html/php
23484 <table>
23485
23486 <tr>
23487 <td> there
23488 </td></tr></table>
23489
23490 !! html/parsoid
23491 <table>
23492 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
23493 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
23494 </tbody></table>
23495 !! end
23496
23497 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
23498 !!test
23499 Empty TR followed by a template-generated TR
23500 !!options
23501 parsoid
23502 !! wikitext
23503 {|
23504 |-
23505 {{echo|<tr><td>foo</td></tr>}}
23506 |}
23507 !! html
23508 <table>
23509 <tbody>
23510 <tr></tr>
23511 <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}}]}'>
23512 <td>foo</td></tr>
23513 </tbody></table>
23514 !!end
23515
23516 ## PHP and parsoid output differ for this, and since this is primarily
23517 ## for testing Parsoid's serializer, marking this Parsoid only
23518 !!test
23519 Empty TR followed by mixed-ws-comment line should RT correctly
23520 !!options
23521 parsoid
23522 !! wikitext
23523 {|
23524 |-
23525 <!--c-->
23526 |-
23527 <!--c--> <!--d-->
23528 |}
23529 !! html
23530 <table>
23531 <tbody>
23532 <tr></tr>
23533 <!--c-->
23534 <tr>
23535 <!--c--> </tr><!--d-->
23536 </tbody></table>
23537
23538 !!end
23539
23540 !!test
23541 Multi-line image caption generated by templates with/without trailing newlines
23542 !! wikitext
23543 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
23544 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
23545 !! html/parsoid
23546 <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>
23547 <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>
23548 !!end
23549
23550 !! test
23551 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
23552 !! options
23553 parsoid=html2wt
23554 !! html/parsoid
23555 <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>
23556
23557 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
23558 !! wikitext
23559 <includeonly>foo</includeonly>
23560 new para
23561
23562 [[Category:Foo]]
23563
23564 = new heading =
23565 !! end
23566
23567 ## PHP emits broken html for this, and since this is primarily
23568 ## a Parsoid serializer test, marking this Parsoid only
23569 !!test
23570 Improperly nested inline or quotes tags with whitespace in between
23571 !! wikitext
23572 <span> <s>x</span> </s>
23573 ''' ''x''' ''
23574 !! html/parsoid
23575 <p><span> <s>x</s></span><s> </s>
23576 <b> <i>x</i></b><i> </i>
23577 </p>
23578 !!end
23579
23580 !!test
23581 Encapsulate protected attributes from wt
23582 !! wikitext
23583 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
23584 !! html/parsoid
23585 <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>
23586 </body>
23587 !!end
23588
23589 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
23590 ## Having nested or stray pre tags results in the attempt to add duplicates,
23591 ## causing an assertion fail. This test tries to prevent that situation.
23592 !!test
23593 Ensure ParagraphWrapper can deal with stray closing pre tags
23594 !!options
23595 parsoid=wt2html
23596 !! wikitext
23597 plain text</pre>
23598 !! html/parsoid
23599 plain text
23600 !!end
23601
23602 !!test
23603 1. Ensure fostered text content is wrapped in element nodes
23604 !!options
23605 parsoid=wt2html
23606 !! wikitext
23607 <table>hi</table><table>ho</table>
23608 !! html/parsoid
23609 <p>hi</p>
23610 <table></table>
23611 <p>ho</p>
23612 <table></table>
23613 !!end
23614
23615 !!test
23616 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
23617 !!options
23618 parsoid=wt2html,wt2wt
23619 !! wikitext
23620 <table>
23621 <tr> || ||
23622 <td> a
23623 </table>
23624 !! html/parsoid
23625 <p> || ||
23626 </p><table>
23627 <tbody><tr><td> a</td></tr>
23628 </tbody></table>
23629 !!end
23630
23631 !!test
23632 Encapsulation properly handles null DSR information from foster box
23633 !!options
23634 parsoid=wt2html,wt2wt
23635 !! wikitext
23636 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
23637 !! html/parsoid
23638 <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>
23639 !!end
23640
23641 !!test
23642 1. Encapsulate foster-parented transclusion content
23643 !!options
23644 parsoid=wt2wt,wt2html
23645 !! wikitext
23646 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
23647 !! html/parsoid
23648 <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>
23649 <tbody>
23650 <tr>
23651 <td>bar</td>
23652 </tr>
23653 </tbody>
23654 </table>
23655 !!end
23656
23657 !!test
23658 2. Encapsulate foster-parented transclusion content
23659 !!options
23660 parsoid=wt2wt,wt2html
23661 !! wikitext
23662 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
23663 !! html/parsoid
23664 <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>
23665 <table>
23666 <tbody>
23667 <tr>
23668 <td>bar</td>
23669 </tr>
23670 </tbody>
23671 </table>
23672 !!end
23673
23674 !!test
23675 3. Encapsulate foster-parented transclusion content
23676 !!options
23677 parsoid=wt2wt,wt2html
23678 !! wikitext
23679 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23680 !! html/parsoid
23681 <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;]}">
23682 <p>foo</p>
23683 </div>
23684 <table>
23685 <tbody>
23686 <tr>
23687 <td>bar</td>
23688 </tr>
23689 </tbody>
23690 </table>
23691 !!end
23692
23693 !!test
23694 4. Encapsulate foster-parented transclusion content
23695 !!options
23696 parsoid=wt2wt,wt2html
23697 !! wikitext
23698 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23699 !! html/parsoid
23700 <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;]}">
23701 <p>foo</p>
23702 </div>
23703 <table>
23704 <tbody>
23705 <tr>
23706 <td>bar</td>
23707 </tr>
23708 </tbody>
23709 </table>
23710 !!end
23711
23712 !!test
23713 5. Encapsulate foster-parented transclusion content
23714 !!options
23715 parsoid=wt2wt,wt2html
23716 !! wikitext
23717 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
23718 !! html/parsoid
23719 <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>
23720 <table>
23721 <tbody>
23722 <tr>
23723 <td>
23724 <div>
23725 <p>foo</p>
23726 </div>
23727 </td>
23728 </tr>
23729 </tbody>
23730 </table>
23731 !!end
23732
23733 !!test
23734 6. Encapsulate foster-parented transclusion content
23735 !!options
23736 parsoid=wt2wt,wt2html
23737 !! wikitext
23738 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
23739 !! html/parsoid
23740 <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>
23741 <table>
23742 <tbody>
23743 <tr>
23744 <td>
23745 <div>
23746 <p>foo</p>
23747 </div>
23748 </td>
23749 </tr>
23750 </tbody>
23751 </table>
23752 <p>ok</p>
23753 !!end
23754
23755 !!test
23756 7. Encapsulate foster-parented transclusion content
23757 !!options
23758 parsoid=wt2wt,wt2html
23759 !! wikitext
23760 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
23761 !! html/parsoid
23762 <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>
23763 <table>
23764 <tbody>
23765 <tr>
23766 <td>bar</td>
23767 </tr>
23768 </tbody>
23769 </table>
23770 !!end
23771
23772 # Note that the wt is broken on purpose: the = should be {{=}} if you
23773 # don't want it to be a template parameter key.
23774 !!test
23775 8. Encapsulate foster-parented transclusion content
23776 !!options
23777 parsoid=wt2wt,wt2html
23778 !! wikitext
23779 {{echo|a
23780 }}{|{{echo|style='color:red'}}
23781 |-
23782 |b
23783 |}
23784 !! html/parsoid
23785 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
23786 <span> </span>
23787 <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>
23788 <table>
23789 <tbody>
23790 <tr>
23791 <td>b</td>
23792 </tr>
23793 </tbody>
23794 </table>
23795 !!end
23796
23797 !!test
23798 9. Encapsulate foster-parented transclusion content
23799 !!options
23800 parsoid=wt2wt,wt2html
23801 !! wikitext
23802 <table>{{echo|hi</table>hello}}
23803 !! html/parsoid
23804 <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>
23805 !!end
23806
23807 !!test
23808 Table in fosterable position
23809 !!options
23810 parsoid=wt2html,wt2wt
23811 !! wikitext
23812 {{OpenTable}}
23813 <div>
23814 {|
23815 |}
23816 </div>
23817 |}
23818 !! html/parsoid
23819 <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">
23820 </span>
23821 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
23822
23823 <table>
23824 </table>
23825 !!end
23826
23827 # Parsoid only for bug 64747
23828 !! test
23829 Properly encapsulate empty-content transclusions in fosterable positions
23830 !! wikitext
23831 <table>
23832 {{#if:|
23833 <td>foo</td>
23834 }}
23835 </table>
23836 !! html/parsoid
23837 <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":["","","",""]}]]}'>
23838
23839 </table>
23840 !! end
23841
23842 !!test
23843 Support <object> element with .data attribute
23844 !!options
23845 parsoid=html2wt
23846 !! html/parsoid
23847 <object data="test.swf"></object>
23848 !! wikitext
23849 <object data="test.swf"></object>
23850 !!end
23851
23852 !! test
23853 Don't block XML namespace declaration
23854 !! wikitext
23855 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
23856 !! html/php
23857 <p><span>MediaWiki</span>
23858 </p>
23859 !! html/parsoid
23860 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
23861 !! end
23862
23863 # -----------------------------------------------------------------
23864 # The following section of tests are primarily to spec requirements
23865 # around serialization of new/edited content.
23866 #
23867 # All these tests are marked Parsoid html2wt and html2html only
23868 # ----------------------------------------------------------------
23869
23870 # 'mi' is a localinterwiki prefix as well as a language
23871 !! test
23872 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
23873 !! options
23874 parsoid=html2wt
23875 !! html
23876 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
23877 !! wikitext
23878 [[Foo]]
23879 !! end
23880
23881 # See T93839
23882 !! test
23883 New wikilinks should be serialized properly
23884 !! options
23885 parsoid=html2wt
23886 !! html
23887 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
23888 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
23889 !! wikitext
23890 [[Foo]]
23891 [[Foo]]
23892 !! end
23893
23894 !! test
23895 New wiki links (href variations)
23896 !! options
23897 parsoid=html2wt
23898 !! html
23899 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23900 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
23901 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
23902 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
23903 !! wikitext
23904 [[Foo_bar]]
23905 [[Foo_bar]]
23906 [[Foo_bar]]
23907 [[Toxine bactérienne]]
23908 !! end
23909
23910 !! test
23911 New wiki links (content string variations)
23912 !! options
23913 parsoid=html2wt
23914 !! html
23915 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23916 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
23917 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
23918 !! wikitext
23919 [[Foo_bar]]
23920 [[Foo bar]]
23921 [[Foo_bar|./Foo_bar]]
23922 !! end
23923
23924 !! test
23925 New category links (href variations)
23926 !! options
23927 parsoid=html2wt
23928 !! html
23929 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
23930 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
23931 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
23932 !! wikitext
23933 [[Category:Toxine bactérienne]]
23934 [[Category:Toxine bactérienne]]
23935 [[Category:Toxine bactérienne]]
23936 !! end
23937
23938 !! test
23939 New sol transparent links don't need indent-pre nowiki protection
23940 !! options
23941 parsoid=html2wt
23942 language=de
23943 !! html
23944 <link rel="mw:PageProp/redirect" href="./Main_Page">
23945 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
23946 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
23947 !! wikitext
23948 #WEITERLEITUNG [[Main Page]]
23949 <!-- this is good --> [[Category:Good]]
23950 <!-- this is great --> [[Kategorie:Great]]
23951 !! end
23952
23953 !! test
23954 New interlanguage links (href variations)
23955 !! options
23956 parsoid=html2wt
23957 !! html
23958 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
23959 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
23960 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
23961 !! wikitext
23962 [[es:Toxine bactérienne]]
23963 [[es:Toxine_bactérienne]]
23964 [[es:Toxine_bactérienne]]
23965 !! end
23966
23967 !! test
23968 Image: Modifying size of an image (1)
23969 !! options
23970 parsoid={
23971 "modes": ["wt2wt"],
23972 "changes": [
23973 ["img[height]", "attr", "height", "22"],
23974 ["img[width]", "attr", "width", "200"]
23975 ]
23976 }
23977 !! wikitext
23978 [[Image:Foobar.jpg|230x230px]]
23979 !! wikitext/edited
23980 [[Image:Foobar.jpg|200x200px]]
23981 !!end
23982
23983 !! test
23984 Image: Modifying size of an image (2)
23985 !! options
23986 parsoid={
23987 "modes": ["wt2wt"],
23988 "changes": [
23989 ["img[height]", "attr", "height", "100"],
23990 ["img[width]", "attr", "width", "500"]
23991 ]
23992 }
23993 !! wikitext
23994 [[Image:Foobar.jpg|230x230px]]
23995 !! wikitext/edited
23996 [[Image:Foobar.jpg|500x500px]]
23997 !!end
23998
23999 # Change in size is ignored so long as class='mw-default-size'
24000 !! test
24001 Image: Modifying size of an image (3)
24002 !! options
24003 parsoid={
24004 "modes": ["wt2wt"],
24005 "changes": [
24006 ["figure[class]", "removeClass", "mw-default-size"],
24007 ["figure img", "attr", "height", "19"],
24008 ["figure img", "attr", "width", "170"]
24009 ]
24010 }
24011 !! wikitext
24012 [[Image:Foobar.jpg|thumb]]
24013 !! wikitext/edited
24014 [[Image:Foobar.jpg|thumb|170x170px]]
24015 !!end
24016
24017 !! test
24018 Image: Modifying alignment of an image (bug 48665)
24019 !! options
24020 parsoid={
24021 "modes": ["wt2wt"],
24022 "changes": [
24023 ["figure[class]", "removeClass", "mw-halign-right"],
24024 ["figure[class]", "addClass", "mw-halign-left"]
24025 ]
24026 }
24027 !! wikitext
24028 [[Image:Foobar.jpg|thumb|caption|right]]
24029 !! wikitext/edited
24030 [[Image:Foobar.jpg|thumb|caption|left]]
24031 !! end
24032
24033 !! test
24034 Image: Modifying mw-default-size of an frameless image (bug 62805)
24035 !! options
24036 parsoid={
24037 "modes": ["wt2wt"],
24038 "changes": [
24039 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24040 ]
24041 }
24042 !! wikitext
24043 [[Image:Foobar.jpg|frameless|right]]
24044 !! wikitext/edited
24045 [[Image:Foobar.jpg|frameless|right|220x220px]]
24046 !! end
24047
24048 !! test
24049 Image: Modifying valign of an image (bug 49221)
24050 !! options
24051 parsoid={
24052 "modes": ["wt2wt"],
24053 "changes": [
24054 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24055 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24056 ]
24057 }
24058 !! wikitext
24059 [[File:Foobar.jpg|20px|middle]]
24060 !! wikitext/edited
24061 [[File:Foobar.jpg|20px|text-top]]
24062 !! end
24063
24064 !! test
24065 Image: Modifying alt attribute of an image (bug 56400)
24066 !! options
24067 parsoid={
24068 "modes": ["wt2wt"],
24069 "changes": [
24070 ["img[alt]", "attr", "alt", "some alternate edited text"]
24071 ]
24072 }
24073 !! wikitext
24074 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24075 !! wikitext/edited
24076 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24077 !!end
24078
24079 !! test
24080 Image: Modifying caption of an image
24081 !! options
24082 parsoid={
24083 "modes": ["wt2wt"],
24084 "changes": [
24085 ["figcaption", "text", "new caption"]
24086 ]
24087 }
24088 !! wikitext
24089 [[Image:Foobar.jpg|thumb|original caption]]
24090 !! wikitext/edited
24091 [[Image:Foobar.jpg|thumb|new caption]]
24092 !!end
24093
24094 !! test
24095 Image: empty alt attribute (bug 48924)
24096 !! options
24097 parsoid
24098 !! wikitext
24099 [[File:Foobar.jpg|thumb|alt=|bar]]
24100 !! html
24101 <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>
24102 !! end
24103
24104 #!! test
24105 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24106 #!! options
24107 #parsoid=html2wt
24108 #language=ar
24109 #!! html
24110 #<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>
24111 #!! wikitext
24112 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24113 #!! end
24114
24115 !! test
24116 Image: Block level image should have \n before and after
24117 !! wikitext
24118 123
24119 [[File:Foobar.jpg|right|thumb|150x150px]]
24120 456
24121 !! html/parsoid
24122 <p>123</p>
24123 <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>
24124 <p>456</p>
24125 !!end
24126
24127 !! test
24128 Image: New block level image should have \n before and after (existing content)
24129 !! wikitext
24130 123
24131 [[File:Foobar.jpg|right|thumb|150x150px]]
24132 456
24133 !! html/parsoid
24134 <p>123</p>
24135 <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>
24136 <p>456</p>
24137 !!end
24138
24139 !! test
24140 Image: upright option (parsoid)
24141 !! wikitext
24142 [[File:Foobar.jpg|thumb|upright|caption]]
24143 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24144 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24145 !! html/parsoid
24146 <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>
24147 <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>
24148 <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>
24149 !!end
24150
24151 !! test
24152 Image: upright option is ignored on inline and frame images (parsoid)
24153 !! wikitext
24154 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24155 !! html/parsoid
24156 <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>
24157 !!end
24158
24159 !! test
24160 Image: from basic HTML (1)
24161 !! options
24162 parsoid=html2wt
24163 !! html/parsoid
24164 <span typeof="mw:Image">
24165 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24166 </span>
24167 !! wikitext
24168 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24169 !! end
24170
24171 !! test
24172 Image: from basic HTML (2)
24173 !! options
24174 parsoid=html2wt
24175 !! html/parsoid
24176 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24177 !! wikitext
24178 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24179 !! end
24180
24181 !! test
24182 Image: from basic HTML (3)
24183 !! options
24184 parsoid=html2wt
24185 !! html/parsoid
24186 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24187 !! wikitext
24188 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24189 !! end
24190
24191 !! test
24192 Image: from basic HTML (4)
24193 !! options
24194 parsoid=html2wt
24195 !! html/parsoid
24196 <img src="./File:Foobar.jpg">
24197 !! wikitext
24198 [[File:Foobar.jpg|link=]]
24199 !! end
24200
24201 !! test
24202 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24203 !! options
24204 parsoid=html2wt
24205 !! html
24206 <ul>
24207 <li><p>foo</p></li>
24208 </ul>
24209 !! wikitext
24210 * foo
24211 !! end
24212
24213 !! test
24214 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24215 !! options
24216 parsoid=html2wt
24217 !! html
24218 <ul> <li>foo</li></ul>
24219 !! wikitext
24220 * foo
24221 !! end
24222
24223 !! test
24224 Don't strip leading whitespace when handling indent-pre suppressing tags
24225 !! options
24226 parsoid=html2wt
24227 !! html
24228 <table>
24229 <tr><td> indented row</td></tr>
24230 </table>
24231 <blockquote><p>
24232 <b>This is very bold of you!</b>
24233 </p>
24234 <table><tr><td>
24235 indented cell (no pre-wrapping!)
24236 </td></tr></table>
24237 </blockquote>
24238 <p>foo</p>
24239 <div>bar</div>
24240 !! wikitext
24241 {|
24242 | indented row
24243 |}
24244 <blockquote>
24245 '''This is very bold of you!'''
24246
24247 {|
24248 |
24249 indented cell (no pre-wrapping!)
24250 |}
24251 </blockquote>
24252 foo
24253 <div>bar</div>
24254 !! end
24255
24256 !! test
24257 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24258 !! options
24259 parsoid=html2wt
24260 !! wikitext
24261 foo
24262 <nowiki> </nowiki><span>bar</span>
24263
24264 <span>foo2
24265 <nowiki> </nowiki></span>bar2
24266
24267 <div>foo</div>
24268 <nowiki> </nowiki><span>bar</span>
24269
24270 <div>
24271 <nowiki> </nowiki><span>foo</span>
24272 </div>
24273 !! html
24274 <p>foo</p>
24275 <span>bar</span>
24276
24277 <span>foo2
24278 </span>bar2
24279
24280 <div>foo</div>
24281 <span>bar</span>
24282
24283 <div>
24284 <span>foo</span>
24285 </div>
24286 !! end
24287
24288 !! test
24289 Lists: Dont insert newlines in a serialized list item.
24290 !! options
24291 parsoid=html2wt
24292 !! html
24293 <ul><li>a<br>b</li><li>c</li></ul>
24294 !! wikitext
24295 * a<br>b
24296 * c
24297 !! end
24298
24299 !! test
24300 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
24301 !! options
24302 parsoid={
24303 "modes": ["html2wt"],
24304 "scrubWikitext": false
24305 }
24306 !! html
24307 <h2>hello there<link href="Category:A1" rel="mw:PageProp/Category" /></h2>
24308 <h2><link href="Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24309
24310 <h2><!--foo--> <link href="Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24311 <h2>it goes well <link href="Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24312
24313 <h2 data-parsoid='{}'>howdy<link href="Category:A5" rel="mw:PageProp/Category" /></h2>
24314
24315 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24316 !! wikitext
24317 == hello there [[Category:A1]] ==
24318
24319 == [[Category:A2]] hi pal ==
24320
24321 == <!--foo--> [[Category:A3]] how goes it ==
24322
24323 == it goes well [[Category:A4]] <!--bar--> ==
24324
24325 ==howdy [[Category:A5]] ==
24326
24327 == __TOC__ ok ==
24328 !! end
24329
24330 !! test
24331 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
24332 !! options
24333 parsoid={
24334 "modes": ["html2wt"],
24335 "scrubWikitext": true
24336 }
24337 !! html
24338 <h2>hello there<link href="Category:A1" rel="mw:PageProp/Category" /></h2>
24339 <h2><link href="Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24340
24341 <h2><!--foo--> <link href="Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24342 <h2>it goes well <link href="Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24343
24344 <h2 data-parsoid='{}'>howdy<link href="Category:A5" rel="mw:PageProp/Category" /></h2>
24345
24346 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24347 !! wikitext
24348 == hello there ==
24349 [[Category:A1]]
24350 [[Category:A2]]
24351
24352 == hi pal ==
24353
24354 <!--foo--> [[Category:A3]]
24355
24356 == how goes it ==
24357
24358 == it goes well ==
24359 [[Category:A4]] <!--bar-->
24360
24361 ==howdy [[Category:A5]] ==
24362
24363 __TOC__
24364
24365 == ok ==
24366 !! end
24367
24368 !! test
24369 Headings: Don't hoist metas that come from templates
24370 !! options
24371 parsoid={
24372 "modes": ["html2wt"],
24373 "scrubWikitext": true
24374 }
24375 !! html
24376 <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>
24377 !! wikitext
24378 == {{echo|foo [[Category:Foo]]}} ==
24379 !! end
24380
24381 !! test
24382 Headings: Category in ref isn't hoisted
24383 !! options
24384 parsoid={
24385 "modes": ["html2wt"],
24386 "scrubWikitext": true
24387 }
24388 !! html
24389 <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>
24390
24391 <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>
24392 !! wikitext
24393 == foo <ref>bar
24394 [[Category:Baz]] </ref> ==
24395
24396 <references />
24397 !! end
24398
24399 !! test
24400 Parsoid: Serialize positional parameters with = in them as named parameter
24401 !! options
24402 parsoid=html2wt
24403 !! html
24404 <p about="#mwt1" typeof="mw:Transclusion"
24405 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
24406
24407 <p about="#mwt1" typeof="mw:Transclusion"
24408 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
24409
24410 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24411 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24412 <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>
24413 !! wikitext
24414 {{echo|1 = f=oo}}
24415
24416 {{echo|1 = f=oo|2 = bar}}
24417
24418 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24419 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24420 {{echo|<nowiki>f=oo</nowiki>|bar}}
24421 !! end
24422
24423 !! test
24424 Parsoid: Serialize positional parameters with = in extlink as named parameter
24425 !! options
24426 parsoid=html2wt
24427 !! html
24428 <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>
24429 !! wikitext
24430 {{echo|1 = http://stuff?is=ok}}
24431 !! end
24432
24433 !! test
24434 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
24435 !! options
24436 parsoid=html2wt
24437 !! html
24438 <div>a<p>b</p></div>
24439 <div>a
24440 <p>b</p></div>
24441 <div>
24442 a
24443 <p>b</p></div>
24444 !! wikitext
24445 <div>a
24446 b
24447 </div>
24448 <div>a
24449 b
24450 </div>
24451 <div>
24452 a
24453
24454 b
24455 </div>
24456 !! end
24457
24458 !! test
24459 Substrings resembling wikitext in hrefs should not get nowiki escapes
24460 !! options
24461 parsoid=html2wt
24462 !! html
24463 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
24464 !! wikitext
24465 [[Foo''bar''baz]]
24466 !! end
24467
24468 !! test
24469 Enforce single-line context in the serializer
24470 !! options
24471 parsoid=html2wt
24472 !! html
24473 <h2>testing
24474 123</h2>
24475
24476 <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">
24477 </span><span about="#mwt1">you</span> </h2>
24478
24479 <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>
24480
24481 <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
24482 there</span></li></ol>
24483
24484 <ul><li>asd
24485 sdf</li></ul>
24486
24487 <ul><li>foo
24488 bar
24489 baz</li>
24490 <li>foo <b>bar</b>
24491 baz</li></ul>
24492
24493 <dl><dt>hi
24494 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
24495 ho</dd></dl>
24496
24497 <dl><dd> <table>
24498 <tbody><tr><td> ha
24499 ha
24500 ha</td></tr>
24501 </tbody></table></dd></dl>
24502 !! wikitext
24503 == testing 123 ==
24504
24505 == hi {{bogus|there
24506 you}} ==
24507
24508 == foo <ref>hello
24509 there</ref> ==
24510
24511 <references />
24512
24513 * asd sdf
24514
24515 * foo bar baz
24516 * foo '''bar''' baz
24517
24518 ; hi ho : hi ho
24519
24520 : {|
24521 | ha
24522 ha
24523 ha
24524 |}
24525 !! end
24526
24527 !! test
24528 Serialize new placeholder space without spans
24529 !! options
24530 parsoid=html2wt
24531 !! html
24532 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
24533
24534 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
24535
24536 <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>
24537 !! wikitext
24538 foo : bar
24539
24540 foo : bar
24541
24542 <ref>foo : bar</ref>ok
24543 !! end
24544
24545
24546 #-----------------------
24547 # Tag minimization tests
24548 #-----------------------
24549
24550 !! test
24551 1. I/B quote minimization: wikitext-only tags should be combined
24552 !! options
24553 parsoid=html2wt
24554 !! html
24555 <p><i>A</i><i>B</i></p>
24556 <p><b>A</b><b>B</b></p>
24557 <p><i>A</i><b><i>B</i></b></p>
24558 <p><b>A</b><i><b>B</b></i></p>
24559 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
24560 <p><i><b>A</b></i><i><b>B</b></i></p>
24561 <p><i><b>A</b></i><b><i>B</i></b></p>
24562 <p><b><i>A</i></b><i><b>B</b></i></p>
24563 !! wikitext
24564 ''AB''
24565
24566 '''AB'''
24567
24568 ''A'''B'''''
24569
24570 '''A''B'''''
24571
24572 '''A''BC''D'''
24573
24574 '''''AB'''''
24575
24576 '''''AB'''''
24577
24578 '''''AB'''''
24579 !! end
24580
24581 !! test
24582 2. I/B quote minimization: wikitext and html tags should not be combined
24583 !! options
24584 parsoid=html2wt
24585 !! html
24586 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
24587 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
24588 !! wikitext
24589 ''A''<i>B</i>
24590
24591 ''A''<nowiki/>'''<i>B</i>'''
24592 !! end
24593
24594 !! test
24595 3. I/B quote minimization: templated content stops minimization
24596 !! options
24597 parsoid=html2wt
24598 !! html
24599 <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>
24600 <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>
24601 !! wikitext
24602 ''A''{{echo|''B''}}
24603
24604 ''A''{{echo|'''''B'''''}}
24605 !! end
24606
24607 !! test
24608 4. I/B quote minimization: new content should be mimimized with adjacent old content
24609 !! options
24610 parsoid=html2wt
24611 !! html
24612 <p><i>A</i><i>B</i></p>
24613 <p><b>A</b><b>B</b></p>
24614 <p><i>A</i><b><i>B</i></b></p>
24615 !! wikitext
24616 ''AB''
24617
24618 '''AB'''
24619
24620 ''A'''B'''''
24621 !! end
24622
24623 !! test
24624 5a. Merge adjacent quote nodes if they've been edited
24625 !! options
24626 parsoid={
24627 "modes": ["wt2wt", "selser"],
24628 "changes": [
24629 ["p", "contents", "remove", ":contains('b')"]
24630 ]
24631 }
24632 !! wikitext
24633 ''a''b''c''
24634 !! wikitext/edited
24635 ''ac''
24636 !! end
24637
24638 !! test
24639 5b. Merge adjacent quote nodes if they've been edited
24640 !! options
24641 parsoid={
24642 "modes": ["wt2wt", "selser"],
24643 "changes": [
24644 ["#x", "remove"]
24645 ]
24646 }
24647 !! wikitext
24648 ''a''<span id="x">b</span>''c''
24649 !! wikitext/edited
24650 ''ac''
24651 !! end
24652
24653 !! test
24654 1. Merge adjacent link nodes as long as at least one element is new
24655 !! options
24656 parsoid={
24657 "modes": ["html2wt"],
24658 "scrubWikitext": true
24659 }
24660 !! html
24661 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24662 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24663 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
24664 !! wikitext
24665 [[Football]]
24666 [[Football]]
24667 [[Football|Foot]][[Football|ball]]
24668 !! end
24669
24670 !! test
24671 2. Merge adjacent link nodes and enable additional normalizations
24672 !! options
24673 parsoid={
24674 "modes": ["html2wt"],
24675 "scrubWikitext": true
24676 }
24677 !! html
24678 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
24679 !! wikitext
24680 [[Football|''Football'']]
24681 !! end
24682
24683 !! test
24684 3. Don't merge adjacent link nodes if scrubWikitext is false
24685 !! options
24686 parsoid={
24687 "modes": ["html2wt"],
24688 "scrubWikitext": false
24689 }
24690 !! html
24691 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24692 !! wikitext
24693 [[Football|Foot]][[Football|ball]]
24694 !! end
24695
24696 #------------------------------
24697 # End of tag minimization tests
24698 #------------------------------
24699
24700 !!test
24701 Bug 54262: New entities
24702 !! options
24703 parsoid=html2wt
24704 !! wikitext
24705 &nbsp;
24706 !! html
24707 <span typeof="mw:Entity">&nbsp;</span>
24708 !! end
24709
24710 ## Note that there is no wikitext output for 'unknownproperty' ##
24711 ## Unknown magic words are silently dropped ##
24712
24713 !! test
24714 Magic words
24715 !! options
24716 parsoid=html2wt
24717 !! html/parsoid
24718 <meta property='mw:PageProp/toc' />
24719 <meta property='mw:PageProp/notoc' />
24720 <meta property='mw:PageProp/forcetoc' />
24721 <meta property='mw:PageProp/index' />
24722 <meta property='mw:PageProp/noindex' />
24723 <meta property='mw:PageProp/nogallery' />
24724 <meta property='mw:PageProp/noeditsection' />
24725 <meta property='mw:PageProp/notitleconvert' />
24726 <meta property='mw:PageProp/nocontentconvert' />
24727 <meta property='mw:PageProp/unknownproperty' />
24728 !! wikitext
24729 __TOC__
24730 __NOTOC__
24731 __FORCETOC__
24732 __INDEX__
24733 __NOINDEX__
24734 __NOGALLERY__
24735 __NOEDITSECTION__
24736 __NOTITLECONVERT__
24737 __NOCONTENTCONVERT__
24738 !! end
24739
24740 !! test
24741 Consecutive <pre>s should not get merged
24742 !! options
24743 parsoid=html2wt,html2html
24744 !! html
24745 <pre>a</pre><pre>b</pre>
24746
24747 <pre>c
24748 </pre><pre>
24749 d</pre>
24750
24751 <pre>e
24752
24753 </pre><pre>
24754
24755 f</pre>
24756 !! wikitext
24757 a
24758
24759 b
24760
24761 c
24762
24763 d
24764
24765 e
24766
24767
24768
24769 f
24770 !! end
24771
24772 !! test
24773 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
24774 !! options
24775 parsoid=html2wt
24776 !! html
24777 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
24778 !! wikitext
24779 [[Special:BookSources/1234567890|ISBN 1234567895]]
24780 !! end
24781
24782 !! test
24783 Edited RFC links not serializable as RFC links should serialize as extlinks
24784 !! options
24785 parsoid=html2wt
24786 !! html
24787 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
24788 !! wikitext
24789 [//tools.ietf.org/html/rfc123 New RFC]
24790 !! end
24791
24792 !! test
24793 Edited PMID links not serializable as PMID links should serialize as extlinks
24794 !! options
24795 parsoid=html2wt
24796 !! html
24797 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
24798 !! wikitext
24799 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
24800 !! end
24801
24802 !! test
24803 WTS of autolinks with trailing/surrounding context
24804 !! options
24805 parsoid=html2wt
24806 !! html/parsoid
24807 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
24808 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
24809 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
24810 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
24811 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
24812 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
24813 !! wikitext
24814 http://cscott.net<nowiki/>'''foo'''
24815
24816 http://cscott.net<b>foo</b>
24817
24818 '''http://cscott.net<nowiki/>'''
24819
24820 '''http://cscott.net '''
24821
24822 '''http://cscott.net<nowiki/>x'''
24823
24824 http://cscott.net<nowiki/>x
24825 !! end
24826
24827 !! test
24828 WTS of autolinks with nowikis (round-trip)
24829 !! wikitext
24830 x<nowiki/>http://cscott.net<nowiki/>x
24831 !! html/parsoid
24832 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
24833 !! end
24834
24835 # this is the "easy" test because it leaves in place all the
24836 # data-parsoid information indicating this is an autolink
24837 !! test
24838 WTS of autolinks with escapes (editing)
24839 !! options
24840 parsoid={
24841 "modes": ["wt2wt"],
24842 "changes": [
24843 [ "meta", "remove" ]
24844 ]
24845 }
24846 !! wikitext
24847 x<nowiki/>http://cscott.net<nowiki/>x
24848 !! wikitext/edited
24849 x<nowiki/>http://cscott.net<nowiki/>x
24850 !! end
24851
24852 !! test
24853 WTS of edited autolink-like text (T103364)
24854 !! options
24855 parsoid={
24856 "modes": ["wt2wt"],
24857 "changes": [
24858 [ "span[typeof]", "removeAttr", "typeof" ]
24859 ]
24860 }
24861 !! wikitext
24862 Not a link: <nowiki>http://example.com</nowiki>.
24863 !! wikitext/edited
24864 Not a link: <span><nowiki>http://example.com</nowiki></span>.
24865 !! end
24866
24867 !! test
24868 WTS of newly-authored autolink-like text (T103364)
24869 !! options
24870 parsoid=html2wt
24871 !! html/parsoid
24872 <p>http://example.com is not a link.</p>
24873 !! wikitext
24874 <nowiki>http://example.com is not a link.</nowiki>
24875 !! end
24876
24877 !! test
24878 Edited Redirect link should emit a non-piped wikitext link
24879 !! options
24880 parsoid=html2wt
24881 !! html
24882 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
24883 !! wikitext
24884 #REDIRECT [[Bar]]
24885 !! end
24886
24887 !! test
24888 T75121: Infer extension name from typeOf if data-mw is not present
24889 !! options
24890 parsoid=html2wt
24891 !! html
24892 <div typeOf="mw:Extension/foo"></div>
24893 !! wikitext
24894 <foo />
24895 !! end
24896
24897 # Note that the <p> wrapping isn't present in PHP parser output
24898 # The important thing for this test is that P-wrapping doesn't
24899 # interfere with the <nowiki> protection for leading - in <td>
24900 # (which isn't necessary for <th>).
24901 !! test
24902 T88318: p-wrapped dash in table.
24903 !! options
24904 parsoid=html2wt,wt2wt
24905 !! html/parsoid
24906 <table><tbody>
24907 <tr><th><p>-</p></th><th><p>- </p></th></tr>
24908 <tr><td><p>-</p></td><td><p>- </p></td></tr>
24909 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
24910 </tbody></table>
24911 !! wikitext
24912 {|
24913 !-
24914 !-
24915 |-
24916 |<nowiki>-</nowiki>
24917 |<nowiki>- </nowiki>
24918 |-
24919 |<small>-</small>
24920 |<br>
24921 -
24922 |<br>
24923 -
24924 |}
24925 !! html/php+tidy
24926 <table>
24927 <tr>
24928 <th>-</th>
24929 <th>-</th>
24930 </tr>
24931 <tr>
24932 <td>-</td>
24933 <td>-</td>
24934 </tr>
24935 <tr>
24936 <td><small>-</small></td>
24937 <td><br />
24938 <p>-</p>
24939 </td>
24940 <td><br />
24941 <p>-</p>
24942 </td>
24943 </tr>
24944 </table>
24945 !! end
24946
24947 !! test
24948 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
24949 !! options
24950 parsoid=html2wt
24951 !! html
24952 <table id='mwAb'>
24953 <td id='mwAc'>foo</td>
24954 <td id='serialize-this'>bar</td>
24955 </table>
24956 !! wikitext
24957 {|
24958 |foo
24959 | id="serialize-this" |bar
24960 |}
24961 !! end
24962
24963 !! test
24964 Parsoid-like element ids should not be serialized to wikitext unless shadowed
24965 !! options
24966 parsoid=html2wt
24967 !! html
24968 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
24969 !! wikitext
24970 <div id="hello">ok</div>
24971 !! end
24972
24973 !! test
24974 WTS change modes
24975 !! options
24976 parsoid={
24977 "modes": ["wt2wt"],
24978 "changes": [
24979 [ "#xyz", "before", "<b>before</b> stuff " ],
24980 [ "#xyz", "after", " stuff <i>after</i>" ],
24981 [ "#xyz", "html", "x <b>y</b> z" ]
24982 ]
24983 }
24984 !! wikitext
24985 <span id="xyz">hello</span>
24986 !! wikitext/edited
24987 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
24988 !! end
24989
24990 !! test
24991 Never serialize a-tag as html, regardless of what data-parsoid has to say
24992 !! options
24993 parsoid=html2wt
24994 !! html
24995 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
24996 !! wikitext
24997 [[Foo]]
24998 !! end
24999
25000 ## SSS FIXME: This is broken output nevertheless.
25001 ## What might be a reasonable non-broken output for this?
25002 ## This is an edge case unlikely to be seen in production
25003 ## that I am not wasting more time on this right now.
25004 !! test
25005 Never serialize a-tag as html, no matter what attributes it has
25006 !! options
25007 parsoid=html2wt
25008 !! html
25009 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25010 !! wikitext
25011 [http://boo.org http://boohoo.org]
25012 !! end
25013
25014 # --------------------------------------------
25015 # Tests spec'ing wikitext serialization norms |
25016 # --------------------------------------------
25017
25018 !! test
25019 Lists: Add space after bullets
25020 !! options
25021 parsoid=html2wt
25022 !! html
25023 <ul>
25024 <li>foo</li>
25025 <li> bar</li>
25026 <li><span> baz</span></li>
25027 </ul>
25028 !! wikitext
25029 * foo
25030 * bar
25031 * <span> baz</span>
25032 !! end
25033
25034 !! test
25035 1. Headings: Add space before/after == (T53744)
25036 !! options
25037 parsoid=html2wt
25038 !! html
25039 <h2>foo</h2>
25040 <h2> bar</h2>
25041 <h2>baz </h2>
25042 <h2><span> baz</span></h2>
25043 !! wikitext
25044 == foo ==
25045
25046 == bar ==
25047
25048 == baz ==
25049
25050 == <span> baz</span> ==
25051 !! end
25052
25053 !! test
25054 2. Headings: Add space before/after == even after hoisted content
25055 !! options
25056 parsoid={
25057 "modes": ["html2wt"],
25058 "scrubWikitext": true
25059 }
25060 !! html
25061 <h2> <link href="Category:A2" rel="mw:PageProp/Category" />ok</h2>
25062 !! wikitext
25063 [[Category:A2]]
25064
25065 == ok ==
25066 !! end
25067
25068 !! test
25069 1. Headings: suppress newly created empty headings
25070 !! options
25071 parsoid={
25072 "modes": ["html2wt"],
25073 "scrubWikitext": true
25074 }
25075 !! html
25076 <h2></h2>
25077 !! wikitext
25078 !! end
25079
25080 !! test
25081 2. Headings: don't suppress empty headings if scrubWikitext is false
25082 !! options
25083 parsoid=html2wt
25084 !! html
25085 <h2></h2>
25086 !! wikitext
25087 ==<nowiki/>==
25088 !! end
25089
25090 !! test
25091 3. Headings: don't suppress empty headings for existing headings even if scrubWikitext is true
25092 !! options
25093 parsoid={
25094 "modes": ["html2wt"],
25095 "scrubWikitext": true
25096 }
25097 !! html
25098 <h2 data-parsoid='{}'></h2>
25099 !! wikitext
25100 ==<nowiki/>==
25101 !! end
25102
25103 !! test
25104 1. WT Quote Tags: suppress newly created empty style tags
25105 !! options
25106 parsoid={
25107 "modes": ["html2wt"],
25108 "scrubWikitext": true
25109 }
25110 !! html
25111 <i></i><b></b>
25112 !! wikitext
25113 !! end
25114
25115 !! test
25116 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
25117 !! options
25118 parsoid=html2wt
25119 !! html
25120 <i></i><b></b>
25121 !! wikitext
25122 ''<nowiki/>'''''<nowiki/>'''
25123 !! end
25124
25125 !! test
25126 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
25127 !! options
25128 parsoid={
25129 "modes": ["html2wt"],
25130 "scrubWikitext": true
25131 }
25132 !! html
25133 <p> hi</p>
25134 <p> hello</p>
25135 !! wikitext
25136 hi
25137
25138 hello
25139 !! end
25140
25141 !! test
25142 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
25143 !! options
25144 parsoid=html2wt
25145 !! html
25146 <p> hi</p>
25147 <p> hello</p>
25148 !! wikitext
25149 <nowiki> </nowiki>hi
25150
25151 <nowiki> </nowiki> hello
25152 !! end
25153
25154 !! test
25155 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
25156 !! options
25157 parsoid={
25158 "modes": ["html2wt"],
25159 "scrubWikitext": true
25160 }
25161 !! html/parsoid
25162 <p>Foo
25163 bar
25164 baz</p>
25165
25166 <table><tr><td>Foo
25167 bar
25168 baz bang</td></tr></table>
25169
25170 <p><!--boo--> foo
25171 bar</p>
25172
25173 <p> foo
25174 bar<span>boo</span></p>
25175 !! wikitext
25176 Foo
25177 bar
25178 baz
25179
25180 {|
25181 |Foo
25182 bar
25183 baz bang
25184 |}
25185
25186 <!--boo-->foo
25187 bar
25188
25189 foo
25190 bar<span>boo</span>
25191 !! end
25192
25193 !! test
25194 1. New links that end in spaces
25195 !! options
25196 parsoid={
25197 "modes": ["html2wt"],
25198 "scrubWikitext": false
25199 }
25200 !! html
25201 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25202 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25203 !! wikitext
25204 [[Berlin ]]<nowiki/>is the capital of Germany.
25205
25206 [[Foo ]]'''bar'''
25207 !! end
25208
25209 !! test
25210 2. New links that end in spaces
25211 !! options
25212 parsoid={
25213 "modes": ["html2wt"],
25214 "scrubWikitext": true
25215 }
25216 !! html
25217 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25218 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25219 !! wikitext
25220 [[Berlin]] is the capital of Germany.
25221
25222 [[Foo]] '''bar'''
25223 !! end
25224
25225 !! test
25226 3. Existing links that end in spaces
25227 !! options
25228 parsoid={
25229 "modes": ["html2wt"],
25230 "scrubWikitext": true
25231 }
25232 !! html
25233 <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>
25234
25235 <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>
25236 !! wikitext
25237 [[Berlin ]]<nowiki/>is the capital of Germany.
25238
25239 [[Foo ]]'''bar'''
25240 !! end
25241
25242 # ---------------------------------------------------
25243 # End of tests spec'ing wikitext serialization norms |
25244 # ---------------------------------------------------
25245
25246 # -----------------------------------------------------------------
25247 # End of section for Parsoid-only html2wt tests for serialization
25248 # of new content
25249 # -----------------------------------------------------------------
25250
25251 # -----------------------------------------------------------------
25252 # The following section of tests are primarily to spec behavior of
25253 # the selective serializer. All these tests have manual selser
25254 # changes. The automated selser changes for all tests handle the
25255 # wide variation of changes, but these tests here capture specs
25256 # deterministically.
25257 # ----------------------------------------------------------------
25258
25259 ## T90517
25260 !! test
25261 Selser: New comments should not be lost
25262 !! options
25263 parsoid={
25264 "modes": ["selser"],
25265 "changes": [
25266 [ "#a", "after", "<!--c1-->" ],
25267 [ "#b", "before", "<!--c2-->" ]
25268 ]
25269 }
25270 !! wikitext
25271 <span id="a">a</span>
25272
25273 <span id="b">b</span>
25274 !! wikitext/edited
25275 <span id="a">a</span><!--c1-->
25276
25277 <!--c2--><span id="b">b</span>
25278 !! end
25279
25280 ## T89383
25281 !! test
25282 Selser: Check for validity of DSR before using it
25283 !! options
25284 parsoid={
25285 "modes": ["selser"],
25286 "changes": [
25287 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
25288 ]
25289 }
25290 !! wikitext
25291 <span id="a">a</span>
25292 !! wikitext/edited
25293 {{DISPLAYTITLE:foo}}
25294 <span id="a">a</span>
25295 !! end
25296
25297 !! test
25298 1. DOMDiff: Changes to <ref> content should be looked up using id
25299 !! options
25300 parsoid={
25301 "modes": ["selser"],
25302 "changes": [
25303 ["#X", "after", "bar"],
25304 ["#Y", "after", "baz"]
25305 ]
25306 }
25307 !! wikitext
25308 X <ref><span id="X">foo</span></ref>
25309 Y <ref name="a" />
25310 <references>
25311 <ref name="a"><span id="Y">foo</span></ref>
25312 </references>
25313 !! wikitext/edited
25314 X <ref><span id="X">foo</span>bar</ref>
25315 Y <ref name="a" />
25316 <references>
25317 <ref name="a"><span id="Y">foo</span>baz</ref>
25318 </references>
25319 !! end
25320
25321 !! test
25322 2. DOMDiff: Changes to <ref> content should be looked up using id
25323 !! options
25324 parsoid={
25325 "modes": ["selser"],
25326 "changes": [
25327 ["#Z", "after", "bar"]
25328 ]
25329 }
25330 !! wikitext
25331 A <ref>foo bar for a</ref>
25332 B <ref group="X" name="b" />
25333
25334 <references />
25335
25336 <references group="X">
25337 <ref name="b"><span id="Z">foo</span></ref>
25338 </references>
25339 !! wikitext/edited
25340 A <ref>foo bar for a</ref>
25341 B <ref group="X" name="b" />
25342
25343 <references />
25344
25345 <references group="X">
25346 <ref name="b"><span id="Z">foo</span>bar</ref>
25347 </references>
25348 !! end