parserTest: Make $wgResourceBasePath match $wgScriptPath
[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 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # noxml don't check for XML well-formedness
22 # title=[[XXX]] run test using article title XXX
23 # language=XXX set content language to XXX for this test
24 # variant=XXX set the variant of language for this test (eg zh-tw)
25 # disabled do not run test
26 # parsoid parsoid-specific options (not run by PHP parser unless
27 # the test includes an html/php section)
28 # php php-only test (not run by the parsoid parser unless
29 # the test includes an html/parsoid section)
30 # showtitle make the first line the title
31 # showindicators make the first lines the page status indicators
32 # comment run through Linker::formatComment() instead of main parser
33 # local format section links in edit comment text as local links
34 # notoc disable table of contents
35 # thumbsize=NNN set the default thumb size to NNNpx for this test
36 #
37 # You can also set the following parser properties via test options:
38 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
39 # wgLinkHolderBatchSize, wgRawHtml
40 #
41 # For testing purposes, temporary articles can created:
42 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
43 # where '/' denotes a newline.
44
45 # This is the standard article assumed to exist.
46 !! article
47 Main Page
48 !! text
49 blah blah
50 !! endarticle
51
52 !!article
53 Foo
54 !!text
55 FOO
56 !!endarticle
57
58 !!article
59 Template:Foo
60 !!text
61 FOO
62 !!endarticle
63
64 !! article
65 Template:Blank
66 !! text
67 !! endarticle
68
69 !! article
70 Template:pipe
71 !! text
72 |
73 !! endarticle
74
75 !! article
76 Template:=
77 !! text
78 <nowiki>=</nowiki>
79 !! endarticle
80
81 !!article
82 MediaWiki:bad image list
83 !!text
84 * [[File:Bad.jpg]] except [[Nasty page]]
85 !!endarticle
86
87 !! article
88 Template:inner list
89 !! text
90 * item 1
91 !! endarticle
92
93 !! article
94 Template:tbl-start
95 !! text
96 {|
97 !! endarticle
98
99 !! article
100 Template:tbl-end
101 !! text
102 |}
103 !! endarticle
104
105 !! article
106 Template:echo
107 !! text
108 {{{1}}}
109 !! endarticle
110
111 !! article
112 Template:echo_with_span
113 !! text
114 <span>{{{1}}}</span>
115 !! endarticle
116
117 !! article
118 Template:echo_with_div
119 !! text
120 <div>{{{1}}}</div>
121 !! endarticle
122
123 !! article
124 Template:blank_param
125 !! text
126 {{{1}}}
127 {{{}}}
128 !! endarticle
129
130 !! article
131 Template:table_attribs
132 !! text
133 <noinclude>
134 |</noinclude>style="color:red;"|Foo
135 !! endarticle
136
137 !! article
138 Template:table_attribs_2
139 !! text
140 <noinclude>
141 |</noinclude>style="color:red;"|Foo
142 |Bar||Baz
143 !! endarticle
144
145 !! article
146 Template:table_attribs_3
147 !! text
148 <noinclude>
149 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
150 !! endarticle
151
152 !! article
153 Template:table_attribs_4
154 !! text
155 | style="background-color:#DC241f;" width="10px" |
156 !! endarticle
157
158 !! article
159 Template:table_attribs_5
160 !! text
161 <noinclude>
162 |</noinclude>style="color:red;"||Bar
163 !! endarticle
164
165 !! article
166 Template:table_attribs_6
167 !! text
168 style="background: <nowiki>
169
170
171 red;</nowiki>" |
172 !! endarticle
173
174 !! article
175 Template:table_attribs_7
176 !! text
177 <noinclude>
178 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
179 !! endarticle
180
181 !! article
182 Template:table_header_cells
183 !! text
184 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
185 !! endarticle
186
187 !! article
188 Template:table_cells
189 !! text
190 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
191 !! endarticle
192
193 !! article
194 Template:PartialTable
195 !! text
196 {|
197 |-
198 !! endarticle
199
200 !! article
201 Template:image_attribs
202 !! text
203 <noinclude>
204 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
205 !! endarticle
206
207 ## See T48811 for details
208 !! article
209 Template:mixed_attr_content_template
210 !! text
211 style="color:red;" title="T48811"
212 |-
213 |foo
214 !! endarticle
215
216 !! article
217 Template:definition_list
218 !! text
219 one
220 ::two
221 !! endarticle
222
223 !! article
224 A?b
225 !! text
226 Weirdo titles!
227 !! endarticle
228
229 !!article
230 Template:Bullet
231 !!text
232 * Bar
233 !!endarticle
234
235 !!article
236 Template:OpenTable
237 !!text
238 {|
239 !!endarticle
240
241 !!article
242 Template:EmptyLITest
243 !!text
244 *a
245 *
246 *
247 *b
248 !!endarticle
249
250 !!article
251 Template:EmptyTRTest
252 !!text
253 {|
254 |-
255 |-
256 |foo
257 |-
258 |-
259 |bar
260 |}
261 !!endarticle
262
263 !!article
264 Template:EmptyTRWithHTMLAttrTest
265 !!text
266 <table>
267 <tr align="center"></tr>
268 <tr><td>foo</td></tr>
269 <tr align="center"></tr>
270 <tr><td>bar</td></tr>
271 </table>
272 !!endarticle
273
274 ###
275 ### Basic tests
276 ###
277 !! test
278 Blank input
279 !! wikitext
280 !! html
281 !! end
282
283
284 !! test
285 Simple paragraph
286 !! wikitext
287 This is a simple paragraph.
288 !! html
289 <p>This is a simple paragraph.
290 </p>
291 !! end
292
293 !! test
294 Paragraphs with extra newline spacing
295 !! wikitext
296 foo
297
298 bar
299
300
301 baz
302
303
304
305 booz
306 !! html
307 <p>foo
308 </p><p>bar
309 </p><p><br />
310 baz
311 </p><p><br />
312 </p><p>booz
313 </p>
314 !! end
315
316 !! test
317 Paragraphs with newline spacing with comment lines in between
318 !! wikitext
319 ----
320 a
321 <!--foo-->
322 b
323 ----
324 a
325 <!--foo--><!--More than 1 comment, still stripped-->
326 b
327 ----
328 a
329 <!--foo--> <!----> <!-- bar -->
330 b
331 ----
332 a
333 <!--foo-->
334
335 b
336 ----
337 a
338
339 <!--foo-->
340 b
341 ----
342 a
343 <!--foo-->
344
345
346 b
347 ----
348 a
349
350
351 <!--foo-->
352 b
353 ----
354 !! html
355 <hr />
356 <p>a
357 b
358 </p>
359 <hr />
360 <p>a
361 b
362 </p>
363 <hr />
364 <p>a
365 b
366 </p>
367 <hr />
368 <p>a
369 </p><p>b
370 </p>
371 <hr />
372 <p>a
373 </p><p>b
374 </p>
375 <hr />
376 <p>a
377 </p><p><br />
378 b
379 </p>
380 <hr />
381 <p>a
382 </p><p><br />
383 b
384 </p>
385 <hr />
386
387 !! end
388
389 !! test
390 Paragraphs with newline spacing with non-empty white-space lines in between
391 !! wikitext
392 ----
393 a
394
395 b
396 ----
397 a
398
399
400 b
401 ----
402 !! html
403 <hr />
404 <p>a
405 </p><p>b
406 </p>
407 <hr />
408 <p>a
409 </p><p><br />
410 b
411 </p>
412 <hr />
413
414 !! end
415
416 !! test
417 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
418 !! wikitext
419 ----
420 a
421 <!--foo-->
422 b
423 ----
424 a
425 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
426 b
427 ----
428 a
429
430 <!--foo-->
431 <!--bar-->
432 b
433 ----
434 a
435
436 <!--foo-->
437 <!--bar-->
438
439 b
440 ----
441 !! html
442 <hr />
443 <p>a
444 b
445 </p>
446 <hr />
447 <p>a
448 b
449 </p>
450 <hr />
451 <p>a
452 </p><p>b
453 </p>
454 <hr />
455 <p>a
456 </p><p><br />
457 b
458 </p>
459 <hr />
460
461 !! end
462
463 !! test
464 Extra newlines: More paragraphs with indented comment
465 !! wikitext
466 a
467
468 <!--boo-->
469
470 b
471 !! html
472 <p>a
473 </p><p><br />
474 b
475 </p>
476 !!end
477
478 !! test
479 Extra newlines followed by heading
480 !! wikitext
481 a
482
483
484
485 =b=
486 [[a]]
487
488
489 =b=
490 !! html
491 <p>a
492 </p><p><br />
493 </p>
494 <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>
495 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
496 </p><p><br />
497 </p>
498 <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>
499
500 !! end
501
502 !! test
503 Extra newlines between heading and content are swallowed
504 !! wikitext
505 =b=
506
507
508
509 [[a]]
510 !! html
511 <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>
512 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
513 </p>
514 !! end
515
516 !! test
517 Parsing an URL
518 !! wikitext
519 http://fr.wikipedia.org/wiki/🍺
520 <!-- EasterEgg we love beer, better be able be able to link to it -->
521 !! html
522 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
523 </p>
524 !! end
525
526 # Note that the html+tidy output removes the spaces after the <li>,
527 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
528 # This is an issue for all tests with lists. We intentionally do
529 # *not* add html+tidy clauses for these, as we don't want to
530 # document/test the broken behavior. (Parsoid matches the non-tidy
531 # output in these cases.)
532
533 !! test
534 Simple list
535 !! wikitext
536 * Item 1
537 * Item 2
538 !! html
539 <ul><li> Item 1</li>
540 <li> Item 2</li></ul>
541
542 !! end
543
544 !! test
545 Italics and bold
546 !! wikitext
547 * plain
548 * plain''italic''plain
549 * plain''italic''plain''italic''plain
550 * plain'''bold'''plain
551 * plain'''bold'''plain'''bold'''plain
552 * plain''italic''plain'''bold'''plain
553 * plain'''bold'''plain''italic''plain
554 * plain''italic'''bold-italic'''italic''plain
555 * plain'''bold''bold-italic''bold'''plain
556 * plain'''''bold-italic'''italic''plain
557 * plain'''''bold-italic''bold'''plain
558 * plain''italic'''bold-italic'''''plain
559 * plain'''bold''bold-italic'''''plain
560 * plain l'''italic''plain
561 * plain l''''bold''' plain
562 !! html
563 <ul><li> plain</li>
564 <li> plain<i>italic</i>plain</li>
565 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
566 <li> plain<b>bold</b>plain</li>
567 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
568 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
569 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
570 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
571 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
572 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
573 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
574 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
575 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
576 <li> plain l'<i>italic</i>plain</li>
577 <li> plain l'<b>bold</b> plain</li></ul>
578
579 !! end
580
581 # this example taken from the [[simple:Moon]] article (bug 47326)
582 !! test
583 Italics and possessives (1)
584 !! wikitext
585 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
586 !! html
587 <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
588 </p>
589 !! end
590
591 # this example taken from [[en:Flaming Pie]] (bug 49926)
592 !! test
593 Italics and possessives (2)
594 !! wikitext
595 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
596 !! html
597 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
598 </p>
599 !! end
600
601 # this example taken from [[en:Dictionary]] (bug 49926)
602 !! test
603 Italics and possessives (3)
604 !! wikitext
605 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''.
606 !! html
607 <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>.
608 </p>
609 !! end
610
611
612 ###
613 ### 2-quote opening sequence tests
614 ###
615 !! test
616 Italics and bold: 2-quote opening sequence: (2,2)
617 !! wikitext
618 ''foo''
619 !! html
620 <p><i>foo</i>
621 </p>
622 !!end
623
624 !! test
625 Italics and bold: 2-quote opening sequence: (2,3)
626 !! wikitext
627 ''foo'''
628 !! html/*
629 <p><i>foo'</i>
630 </p>
631 !!end
632
633 !! test
634 Italics and bold: 2-quote opening sequence: (2,4)
635 !! options
636 parsoid=wt2html
637 !! wikitext
638 ''foo''''
639 !! html/*
640 <p><i>foo''</i>
641 </p>
642 !!end
643
644 # same html as previous, but wikitext adjusted to match parsoid html2wt
645 !! test
646 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
647 !! wikitext
648 ''foo<nowiki>''</nowiki>''
649 !! html
650 <p><i>foo''</i>
651 </p>
652 !! end
653
654 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
655 !! test
656 Italics and bold: 2-quote opening sequence: (2,5)
657 !! options
658 parsoid=wt2html
659 !! wikitext
660 ''foo'''''
661 !! html/php
662 <p><i>foo</i>
663 </p>
664 !! html/parsoid
665 <p><i>foo</i><b></b>
666 </p>
667 !!end
668
669 # same html as previous, but wikitext adjusted to match parsoid html2wt
670 !! test
671 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
672 !! wikitext
673 ''foo'''''<nowiki/>'''
674 !! html/php
675 <p><i>foo</i>
676 </p>
677 !! html/parsoid
678 <p><i>foo</i><b></b>
679 </p>
680 !! end
681
682
683 ###
684 ### 3-quote opening sequence tests
685 ###
686
687 !! test
688 Italics and bold: 3-quote opening sequence: (3,2)
689 !! wikitext
690 '''foo''
691 !! html/*
692 <p>'<i>foo</i>
693 </p>
694 !!end
695
696 !! test
697 Italics and bold: 3-quote opening sequence: (3,3)
698 !! wikitext
699 '''foo'''
700 !! html
701 <p><b>foo</b>
702 </p>
703 !!end
704
705 !! test
706 Italics and bold: 3-quote opening sequence: (3,4)
707 !! wikitext
708 '''foo''''
709 !! html/*
710 <p><b>foo'</b>
711 </p>
712 !!end
713
714 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
715 !! test
716 Italics and bold: 3-quote opening sequence: (3,5)
717 !! options
718 parsoid=wt2html
719 !! wikitext
720 '''foo'''''
721 !! html/php
722 <p><b>foo</b>
723 </p>
724 !! html/parsoid
725 <p><b>foo</b><i></i>
726 </p>
727 !!end
728
729 # same html as previous, but wikitext adjusted to match parsoid html2wt
730 !! test
731 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
732 !! wikitext
733 '''foo'''''<nowiki/>''
734 !! html/php
735 <p><b>foo</b>
736 </p>
737 !! html/parsoid
738 <p><b>foo</b><i></i>
739 </p>
740 !! end
741
742
743 ###
744 ### 4-quote opening sequence tests
745 ###
746
747 !! test
748 Italics and bold: 4-quote opening sequence: (4,2)
749 !! options
750 parsoid=wt2html
751 !! wikitext
752 ''''foo''
753 !! html/*
754 <p>''<i>foo</i>
755 </p>
756 !!end
757
758 # same html as previous, but wikitext adjusted to match parsoid html2wt
759 !! test
760 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
761 !! wikitext
762 <nowiki>''</nowiki>''foo''
763 !! html
764 <p>''<i>foo</i>
765 </p>
766 !! end
767
768 !! test
769 Italics and bold: 4-quote opening sequence: (4,3)
770 !! wikitext
771 ''''foo'''
772 !! html/*
773 <p>'<b>foo</b>
774 </p>
775 !!end
776
777 !! test
778 Italics and bold: 4-quote opening sequence: (4,4)
779 !! options
780 parsoid=wt2html
781 !! wikitext
782 ''''foo''''
783 !! html/*
784 <p>'<b>foo'</b>
785 </p>
786 !!end
787
788 # same html as previous, but wikitext adjusted to match parsoid html2wt
789 !! test
790 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
791 !! wikitext
792 '<nowiki/>'''foo''''
793 !! html
794 <p>'<b>foo'</b>
795 </p>
796 !! end
797
798 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
799 !! test
800 Italics and bold: 4-quote opening sequence: (4,5)
801 !! options
802 parsoid=wt2html
803 !! wikitext
804 ''''foo'''''
805 !! html/php
806 <p>'<b>foo</b>
807 </p>
808 !! html/parsoid
809 <p>'<b>foo</b><i></i>
810 </p>
811 !!end
812
813 # same html as previous, but wikitext adjusted to match parsoid html2wt
814 !! test
815 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
816 !! wikitext
817 '<nowiki/>'''foo'''''<nowiki/>''
818 !! html/php
819 <p>'<b>foo</b>
820 </p>
821 !! html/parsoid
822 <p>'<b>foo</b><i></i>
823 </p>
824 !! end
825
826
827 ###
828 ### 5-quote opening sequence tests
829 ###
830
831 !! test
832 Italics and bold: 5-quote opening sequence: (5,2)
833 !! options
834 parsoid=wt2html
835 !! wikitext
836 '''''foo''
837 !! html/*
838 <p><b><i>foo</i></b>
839 </p>
840 !!end
841
842 # same html as previous, but wikitext adjusted to match parsoid html2wt
843 !! test
844 Italics and bold: 5-quote opening sequence: (5,2+3)
845 !! wikitext
846 '''''foo'''''
847 !! html/*
848 <p><i><b>foo</b></i>
849 </p>
850 !! end
851
852 !! test
853 Italics and bold: 5-quote opening sequence: (5,3)
854 !! options
855 parsoid=wt2html
856 !! wikitext
857 '''''foo'''
858 !! html/*
859 <p><i><b>foo</b></i>
860 </p>
861 !!end
862
863 # same html as previous, but wikitext adjusted to match parsoid html2wt
864 !! test
865 Italics and bold: 5-quote opening sequence: (5,3+2)
866 !! wikitext
867 '''''foo'''''
868 !! html
869 <p><i><b>foo</b></i>
870 </p>
871 !! end
872
873 !! test
874 Italics and bold: 5-quote opening sequence: (5,4)
875 !! options
876 parsoid=wt2html
877 !! wikitext
878 '''''foo''''
879 !! html/*
880 <p><i><b>foo'</b></i>
881 </p>
882 !!end
883
884 !! test
885 Italics and bold: 5-quote opening sequence: (5,5)
886 !! wikitext
887 '''''foo'''''
888 !! html
889 <p><i><b>foo</b></i>
890 </p>
891 !!end
892
893 !! test
894 Italics and bold: 5-quote opening sequence: (5,6)
895 !! wikitext
896 '''''foo''''''
897 !! html/*
898 <p><i><b>foo'</b></i>
899 </p>
900 !! end
901
902 ###
903 ### multiple quote sequences in a line
904 ###
905 !! test
906 Italics and bold: multiple quote sequences: (2,4,2)
907 !! options
908 parsoid=wt2html
909 !! wikitext
910 ''foo''''bar''
911 !! html/*
912 <p><i>foo'<b>bar</b></i>
913 </p>
914 !!end
915
916
917 # same html as previous, but wikitext adjusted to match parsoid html2wt
918 !! test
919 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
920 !! wikitext
921 ''foo'<nowiki/>'''bar'''''
922 !! html
923 <p><i>foo'<b>bar</b></i>
924 </p>
925 !! end
926
927
928 !! test
929 Italics and bold: multiple quote sequences: (2,4,3)
930 !! options
931 parsoid=wt2html
932 !! wikitext
933 ''foo''''bar'''
934 !! html/*
935 <p><i>foo'<b>bar</b></i>
936 </p>
937 !!end
938
939
940 # same html as previous, but wikitext adjusted to match parsoid html2wt
941 !! test
942 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
943 !! wikitext
944 ''foo'<nowiki/>'''bar'''''
945 !! html
946 <p><i>foo'<b>bar</b></i>
947 </p>
948 !! end
949
950
951 !! test
952 Italics and bold: multiple quote sequences: (2,4,4)
953 !! options
954 parsoid=wt2html
955 !! wikitext
956 ''foo''''bar''''
957 !! html/*
958 <p><i>foo'<b>bar'</b></i>
959 </p>
960 !!end
961
962
963 # same html as previous, but wikitext adjusted to match parsoid html2wt
964 !! test
965 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
966 !! wikitext
967 ''foo'<nowiki/>'''bar'<nowiki/>'''''
968 !! html
969 <p><i>foo'<b>bar'</b></i>
970 </p>
971 !! end
972
973
974 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
975 !! test
976 Italics and bold: multiple quote sequences: (3,4,2)
977 !! options
978 parsoid=wt2html
979 !! wikitext
980 '''foo''''bar''
981 !! html/php
982 <p><b>foo'</b>bar
983 </p>
984 !! html/parsoid
985 <p><b>foo'</b>bar<i></i>
986 </p>
987 !!end
988
989 # same html as previous, but wikitext adjusted to match parsoid html2wt
990 !! test
991 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
992 !! options
993 parsoid
994 !! wikitext
995 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
996 !! html/php
997 <p><b>foo'</b>bar
998 </p>
999 !! html/parsoid
1000 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
1001 </p>
1002 !! end
1003
1004
1005 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1006 !! test
1007 Italics and bold: multiple quote sequences: (3,4,3)
1008 !! options
1009 parsoid=wt2html
1010 !! wikitext
1011 '''foo''''bar'''
1012 !! html/php
1013 <p><b>foo'</b>bar
1014 </p>
1015 !! html/parsoid
1016 <p><b>foo'</b>bar<b></b>
1017 </p>
1018 !!end
1019
1020 # same html as previous, but wikitext adjusted to match parsoid html2wt
1021 !! test
1022 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1023 !! wikitext
1024 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1025 !! html/php
1026 <p><b>foo'</b>bar
1027 </p>
1028 !! html/parsoid
1029 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1030 </p>
1031 !! end
1032
1033 ###
1034 ### other quote tests
1035 ###
1036 !! test
1037 Italics and bold: other quote tests: (2,3,5)
1038 !! wikitext
1039 ''this is about '''foo's family'''''
1040 !! html
1041 <p><i>this is about <b>foo's family</b></i>
1042 </p>
1043 !!end
1044
1045
1046 !! test
1047 Italics and bold: other quote tests: (2,(3,3),2)
1048 !! wikitext
1049 ''this is about '''foo's''' family''
1050 !! html
1051 <p><i>this is about <b>foo's</b> family</i>
1052 </p>
1053 !!end
1054
1055
1056 !! test
1057 Italics and bold: other quote tests: (3,2,3,2)
1058 !! options
1059 parsoid=wt2html
1060 !! wikitext
1061 '''this is about ''foo'''s family''
1062 !! html/*
1063 <p><b>this is about <i>foo</i></b><i>s family</i>
1064 </p>
1065 !!end
1066
1067
1068 # same html as previous, but wikitext adjusted to match parsoid html2wt
1069 !! test
1070 Italics and bold: other quote tests: (3,2,3+2+2,2)
1071 !! wikitext
1072 '''this is about ''foo'''''<nowiki/>''s family''
1073 !! html
1074 <p><b>this is about <i>foo</i></b><i>s family</i>
1075 </p>
1076 !! end
1077
1078
1079 !! test
1080 Italics and bold: other quote tests: (3,2,3,3)
1081 !! wikitext
1082 '''this is about ''foo'''s family'''
1083 !! html/*
1084 <p>'<i>this is about </i>foo<b>s family</b>
1085 </p>
1086 !!end
1087
1088
1089 !! test
1090 Italics and bold: other quote tests: (3,(2,2),3)
1091 !! wikitext
1092 '''this is about ''foo's'' family'''
1093 !! html
1094 <p><b>this is about <i>foo's</i> family</b>
1095 </p>
1096 !!end
1097
1098
1099 !! test
1100 Italicized possessive
1101 !! wikitext
1102 The ''[[Main Page]]'''s talk page.
1103 !! html/php
1104 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1105 </p>
1106 !! html/parsoid
1107 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1108 !! end
1109
1110 !! test
1111 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1112 (Requires tidy for PHP parser output to be fixed up)
1113 !! options
1114 parsoid=wt2html,wt2wt
1115 !! wikitext
1116 {|
1117 !''a!!''b
1118 |''a||''b
1119 |}
1120 !! html/php+tidy
1121 <table>
1122 <tr>
1123 <th><i>a</i></th>
1124 <th><i>b</i></th>
1125 <td><i>a</i></td>
1126 <td><i>b</i></td>
1127 </tr>
1128 </table>
1129 !! html/parsoid
1130 <table>
1131 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1132 <td><i>a</i></td><td><i>b</i></td></tr>
1133 </tbody></table>
1134 !! end
1135
1136 ###
1137 ### Non-html5 tags
1138 ###
1139
1140 !! test
1141 Non-html5 tags should be accepted
1142 !! wikitext
1143 <center>''foo''</center>
1144 <big>''foo''</big>
1145 <font>''foo''</font>
1146 <strike>''foo''</strike>
1147 <tt>''foo''</tt>
1148 !! html
1149 <center><i>foo</i></center>
1150 <p><big><i>foo</i></big>
1151 <font><i>foo</i></font>
1152 <strike><i>foo</i></strike>
1153 <tt><i>foo</i></tt>
1154 </p>
1155 !! end
1156
1157 !! test
1158 <wbr> is valid wikitext (bug 52468)
1159 !! wikitext
1160 <wbr>
1161 !! html
1162 <p><wbr />
1163 </p>
1164 !! end
1165
1166 # <strike> is HTML4, <s> is HTML4/5.
1167 !! test
1168 <s> or <strike> for strikethrough
1169 !! wikitext
1170 <strike>strike</strike>
1171
1172 <s>s</s>
1173 !! html
1174 <p><strike>strike</strike>
1175 </p><p><s>s</s>
1176 </p>
1177 !! end
1178
1179 ## a not permitted
1180 ## i,b,br omitted
1181 !! test
1182 Text-level semantic html elements in wikitext
1183 !! wikitext
1184 <em>text</em>
1185 <strong>text</strong>
1186 <small>text</small>
1187 <s>text</s>
1188 <cite>text</cite>
1189 <q>text</q>
1190 <dfn>text</dfn>
1191 <abbr>text</abbr>
1192 <data>text</data>
1193 <time>text</time>
1194 <code>text</code>
1195 <var>text</var>
1196 <samp>text</samp>
1197 <kbd>text</kbd>
1198 <sub>text</sub>
1199 <u>text</u>
1200 <mark>text</mark>
1201 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1202 <bdi>text</bdi>
1203 <bdo>text</bdo>
1204 <span>text</span>
1205 <wbr />
1206 !! html
1207 <p><em>text</em>
1208 <strong>text</strong>
1209 <small>text</small>
1210 <s>text</s>
1211 <cite>text</cite>
1212 <q>text</q>
1213 <dfn>text</dfn>
1214 <abbr>text</abbr>
1215 <data>text</data>
1216 <time>text</time>
1217 <code>text</code>
1218 <var>text</var>
1219 <samp>text</samp>
1220 <kbd>text</kbd>
1221 <sub>text</sub>
1222 <u>text</u>
1223 <mark>text</mark>
1224 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1225 <bdi>text</bdi>
1226 <bdo>text</bdo>
1227 <span>text</span>
1228 <wbr />
1229 </p>
1230 !! end
1231
1232 # test cases taken from
1233 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1234 !! test
1235 Ruby markup (W3C-style)
1236 !! wikitext
1237 ; Mono-ruby for individual base characters
1238 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1239 ; Group ruby
1240 : <ruby>今日<rt>きょう</rt></ruby>
1241 ; Jukugo ruby
1242 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1243 ; Inline ruby
1244 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1245 ; Double-sided ruby
1246 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1247 <ruby>
1248 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1249 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1250 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1251 </ruby>
1252 !! html
1253 <dl><dt> Mono-ruby for individual base characters</dt>
1254 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1255 <dt> Group ruby</dt>
1256 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1257 <dt> Jukugo ruby</dt>
1258 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1259 <dt> Inline ruby</dt>
1260 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1261 <dt> Double-sided ruby</dt>
1262 <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>
1263 <p><ruby>
1264 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1265 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1266 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1267 </ruby>
1268 </p>
1269 !! end
1270
1271 # The next two test different paths in the sanitizer.
1272 !! test
1273 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1274 !! wikitext
1275 <blockquote|>a</blockquote>
1276
1277 <b→> doesn't terminate </b→>
1278
1279 <bä> doesn't terminate </bä>
1280
1281 <boo> doesn't terminate </boo>
1282
1283 <s.foo> doesn't terminate </s.foo>
1284
1285 <sub-ID#1>
1286 !! html
1287 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1288 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1289 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1290 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1291 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1292 </p><p>&lt;sub-ID#1&gt;
1293 </p>
1294 !! end
1295
1296 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1297 # If the non-word-character tag made it through the sanitizer, tidy
1298 # would munge it up.
1299 !! test
1300 Non-word characters don't terminate tag names + tidy
1301 !! wikitext
1302 <blockquote|>a</blockquote>
1303
1304 <b→> doesn't terminate </b→>
1305
1306 <bä> doesn't terminate </bä>
1307
1308 <boo> doesn't terminate </boo>
1309
1310 <s.foo> doesn't terminate </s.foo>
1311
1312 <sub-ID#1>
1313 !! html+tidy
1314 <p>&lt;blockquote|&gt;a</p>
1315 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1316 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1317 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1318 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1319 <p>&lt;sub-ID#1&gt;</p>
1320 !! end
1321
1322 ###
1323 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1324 ### This checks that HTML5 tags (with non-word characters in the tag
1325 ### name) make it safely through the parser -- the Sanitizer will
1326 ### munge them later, as it should.
1327 ###
1328 !! test
1329 Non-word characters are valid in extension tags (T19663)
1330 !! wikitext
1331 <tåg>tåg</tåg>
1332 !! html/php
1333 <pre>
1334 'tåg'
1335 array (
1336 )
1337 </pre>
1338
1339 !! html/parsoid
1340 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1341 !! end
1342
1343 !! test
1344 Isolated close tags should be treated as literal text (bug 52760)
1345 !! options
1346 parsoid=wt2html
1347 !! wikitext
1348 </b>
1349
1350 <s.foo>s</s>
1351 !! html/php+tidy
1352 <p>&lt;s.foo&gt;s</p>
1353 !! html/parsoid
1354 <p>&lt;s.foo&gt;s</p>
1355 !! end
1356
1357 ###
1358 ### Special characters
1359 ###
1360
1361 !! test
1362 Bare pipe character (bug 52363)
1363 !! wikitext
1364 |
1365 !! html
1366 <p>|
1367 </p>
1368 !! end
1369
1370 !! test
1371 Bare pipe character from a template (bug 52363)
1372 !! wikitext
1373 {{pipe}}
1374 !! html
1375 <p>|
1376 </p>
1377 !! end
1378
1379 ###
1380 ### <nowiki> test cases
1381 ###
1382
1383 !! test
1384 <nowiki> unordered list
1385 !! wikitext
1386 <nowiki>* This is not an unordered list item.</nowiki>
1387 !! html/php
1388 <p>* This is not an unordered list item.
1389 </p>
1390 !! html/parsoid
1391 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1392 !! end
1393
1394 !! test
1395 <nowiki> spacing
1396 !! wikitext
1397 <nowiki>Lorem ipsum dolor
1398
1399 sed abit.
1400 sed nullum.
1401
1402 :and a colon
1403 </nowiki>
1404 !! html/php
1405 <p>Lorem ipsum dolor
1406
1407 sed abit.
1408 sed nullum.
1409
1410 :and a colon
1411
1412 </p>
1413 !! html/parsoid
1414 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1415
1416 sed abit.
1417 sed nullum.
1418
1419 :and a colon
1420 </span></p>
1421 !! end
1422
1423 !! test
1424 nowiki 3
1425 !! wikitext
1426 :There is not nowiki.
1427 :There is <nowiki>nowiki</nowiki>.
1428
1429 #There is not nowiki.
1430 #There is <nowiki>nowiki</nowiki>.
1431
1432 *There is not nowiki.
1433 *There is <nowiki>nowiki</nowiki>.
1434 !! html/php
1435 <dl><dd>There is not nowiki.</dd>
1436 <dd>There is nowiki.</dd></dl>
1437 <ol><li>There is not nowiki.</li>
1438 <li>There is nowiki.</li></ol>
1439 <ul><li>There is not nowiki.</li>
1440 <li>There is nowiki.</li></ul>
1441
1442 !! html/parsoid
1443 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1444 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1445
1446 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1447 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1448
1449 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1450 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1451 !! end
1452
1453 !! test
1454 Entities inside <nowiki>
1455 !! wikitext
1456 <nowiki>&lt;</nowiki>
1457 !! html
1458 <p>&lt;
1459 </p>
1460 !! end
1461
1462 !! test
1463 Entities inside template parameters
1464 !! wikitext
1465 {{echo|&ndash;}}
1466 !! html/php+tidy
1467 <p>–</p>
1468 !! html/parsoid
1469 <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>
1470 !! end
1471
1472 !! test
1473 Properly escape nowiki when combined with other wiki markup
1474 !! options
1475 parsoid=html2wt
1476 !! html/parsoid
1477 <p>* &lt;/nowiki&gt; tag</p>
1478 !! wikitext
1479 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1480 !! end
1481
1482 !! test
1483 T93824: Put escaped HTML tags inside nowiki
1484 !! options
1485 parsoid=html2wt
1486 !! html/parsoid
1487 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1488 !! wikitext
1489 <nowiki><h2>foo</h2></nowiki>
1490 !! end
1491
1492 !! test
1493 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1494 !! options
1495 parsoid=html2wt
1496 !! html/parsoid
1497 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1498 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1499 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1500 !! wikitext
1501 This text: L'[[Foo]]
1502 This text: L<nowiki>''</nowiki>[[Foo]]
1503 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1504 !! end
1505
1506 # This test fails because wikitext whitespace is not normalized before comparing.
1507 !! test
1508 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1509 !! options
1510 parsoid=html2wt
1511 !! html/parsoid
1512 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1513 </p>
1514 !! wikitext
1515 This text : L<nowiki>''</nowiki>[[Foo]]
1516 !! end
1517
1518 # This test and the next one are html2wt only as they test that incorrect wikitext
1519 # passed in template arguments gets escaped or wrapped in nowikis where required.
1520 !! test
1521 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1522 !! options
1523 parsoid=html2wt
1524 !! html/parsoid
1525 <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>
1526 <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>
1527 !! wikitext
1528 {{echo|foo{{!}}bar}}
1529 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1530 !! end
1531
1532 !! test
1533 T53961: Output correct nowikis in template arguments
1534 !! options
1535 parsoid=html2wt
1536 !! html/parsoid
1537 <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>
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="#mwt2"></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 [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></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="#mwt4"></span>
1541 <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>
1542 !! wikitext
1543 {{echo|a [ b}}
1544 {{echo|a <nowiki>}}</nowiki> b}}
1545 {{echo|<nowiki>a [[ b</nowiki>}}
1546 {{echo|a {{!}} <nowiki>{{ ]]</nowiki>}}
1547 {{echo|a <nowiki>}</nowiki>}}
1548 !! end
1549
1550 !! test
1551 Cases where "!!" needs nowiki protection
1552 !! options
1553 parsoid=html2wt
1554 !! html/parsoid
1555 <table>
1556 <tr><th>this needs protection !! here</th></tr>
1557 </table>
1558
1559 <table>
1560 <tr><th>this does not need
1561 protection !! here</th></tr>
1562 </table>
1563 !! wikitext
1564 {|
1565 !<nowiki>this needs protection !! here</nowiki>
1566 |}
1567
1568 {|
1569 !this does not need
1570 protection !! here
1571 |}
1572 !! end
1573
1574 ###
1575 ### Comments
1576 ###
1577 !! test
1578 Comments and Indent-Pre
1579 !! wikitext
1580 <!-- comment 1 --> asdf
1581
1582 <!-- comment 1 --> asdf
1583 <!-- comment 2 -->
1584
1585 <!-- comment 1 --> asdf
1586 <!-- comment 2 -->xyz
1587
1588 <!-- comment 1 --> asdf
1589 <!-- comment 2 --> xyz
1590 !! html
1591 <pre>asdf
1592 </pre>
1593 <pre>asdf
1594 </pre>
1595 <pre>asdf
1596 </pre>
1597 <p>xyz
1598 </p>
1599 <pre>asdf
1600 xyz
1601 </pre>
1602 !! end
1603
1604 !! test
1605 Comment test 2a
1606 !! wikitext
1607 asdf
1608 <!-- comment 1 -->
1609 jkl
1610 !! html
1611 <p>asdf
1612 jkl
1613 </p>
1614 !! end
1615
1616 !! test
1617 Comment test 2b
1618 !! wikitext
1619 asdf
1620 <!-- comment 1 -->
1621
1622 jkl
1623 !! html
1624 <p>asdf
1625 </p><p>jkl
1626 </p>
1627 !! end
1628
1629 !! test
1630 Comment test 3
1631 !! wikitext
1632 asdf
1633 <!-- comment 1 -->
1634 <!-- comment 2 -->
1635 jkl
1636 !! html
1637 <p>asdf
1638 jkl
1639 </p>
1640 !! end
1641
1642 !! test
1643 Comment test 4
1644 !! wikitext
1645 asdf<!-- comment 1 -->jkl
1646 !! html
1647 <p>asdfjkl
1648 </p>
1649 !! end
1650
1651 !! test
1652 Comment spacing
1653 !! wikitext
1654 a
1655 <!-- foo --> b <!-- bar -->
1656 c
1657 !! html
1658 <p>a
1659 </p>
1660 <pre> b
1661 </pre>
1662 <p>c
1663 </p>
1664 !! end
1665
1666 !! test
1667 Comment whitespace
1668 !! wikitext
1669 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1670 !! html
1671
1672 !! end
1673
1674 !! test
1675 Comment semantics and delimiters
1676 !! wikitext
1677 <!-- --><!----><!-----><!------>
1678 !! html/php
1679
1680 !! html/parsoid
1681 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1682 !! end
1683
1684 !! test
1685 Comment semantics and delimiters, redux
1686 !! wikitext
1687 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1688 -- foo -- funky huh? ... -->
1689 !! html/php
1690
1691 !! html/parsoid
1692 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1693 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1694 !! end
1695
1696 !! test
1697 Comment semantics and delimiters: directors cut
1698 !! wikitext
1699 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1700 everything starting with < followed by !-- until the first -- and > we see,
1701 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1702 -->-->
1703 !! html/php
1704 <p>--&gt;
1705 </p>
1706 !! html/parsoid
1707 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1708 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1709 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1710 --><p>--></p>
1711 !! end
1712
1713 !! test
1714 Comment semantics: nesting
1715 !! wikitext
1716 <!--<!-- no, we're not going to do anything fancy here -->-->
1717 !! html/php
1718 <p>--&gt;
1719 </p>
1720 !! html/parsoid
1721 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1722 !! end
1723
1724 # Parsoid closes the unclosed comment, even if it means a slight
1725 # round-trip diff.
1726 !! test
1727 Comment semantics: unclosed comment at end
1728 !! options
1729 parsoid=wt2html,html2html
1730 !! wikitext
1731 <!--This comment will run out to the end of the document
1732 !! html/php
1733
1734 !! html/parsoid
1735 <!--This comment will run out to the end of the document-->
1736 !! end
1737
1738 !! test
1739 Comment semantics: normalize comments to play nice with XML and browsers
1740 !! wikitext
1741 <!-- Browsers --!> think this is closed -->
1742 <!--> This would normally be text -->
1743 <!---> As would this -->
1744 <!-- XML doesn't like trailing dashes -------->
1745 <!-- Nor doubled hyphens -- anywhere in the data -->
1746 But this is not a comment.
1747 !! html/php
1748 <p>But this is not a comment.
1749 </p>
1750 !! html/parsoid
1751 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1752 <!--&#x3E; This would normally be text -->
1753 <!--&#x2D;&#x3E; As would this -->
1754 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1755 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1756 <p>But this is not a comment.</p>
1757 !! end
1758
1759 !! test
1760 Comment semantics: round-trip even text which contains encoded -->
1761 !! wikitext
1762 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1763 !! html/parsoid
1764 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1765 !! end
1766
1767 !! test
1768 Comment in template title
1769 !! wikitext
1770 {{f<!---->oo}}
1771 !! html
1772 <p>FOO
1773 </p>
1774 !! end
1775
1776 !! test
1777 Comment on its own line post-expand
1778 !! wikitext
1779 a
1780 {{blank}}<!---->
1781 b
1782 !! html
1783 <p>a
1784 </p><p>b
1785 </p>
1786 !! end
1787
1788 !! test
1789 Comment on its own line post-expand with non-significant whitespace
1790 !! wikitext
1791 a
1792 {{blank}} <!---->
1793 b
1794 !! html
1795 <p>a
1796 </p><p>b
1797 </p>
1798 !! end
1799
1800 !! test
1801 Multiple comments should still parse as SOL-transparent
1802 !! options
1803 parsoid=wt2html,wt2wt
1804 !! wikitext
1805 <!--c1-->*a
1806 <!--c2--><!--c3--><!--c4-->*b
1807 !! html/php
1808 <ul><li>a</li>
1809 <li>b</li></ul>
1810
1811 !! html/parsoid
1812 <!--c1--><ul>
1813 <li>a
1814 </li>
1815 <!--c2--><!--c3--><!--c4-->
1816 <li>b
1817 </li>
1818 </ul>
1819 !! end
1820
1821 ###
1822 ### paragraph wrapping tests
1823 ###
1824 !! test
1825 No block tags
1826 !! wikitext
1827 a
1828
1829 b
1830 !! html
1831 <p>a
1832 </p><p>b
1833 </p>
1834 !! end
1835
1836 !! test
1837 Block tag on one line (<div>)
1838 !! wikitext
1839 a <div>foo</div>
1840
1841 b
1842 !! html
1843 a <div>foo</div>
1844 <p>b
1845 </p>
1846 !! html+tidy
1847 <p>a</p>
1848 <div>foo</div>
1849 <p>b</p>
1850 !! end
1851
1852 !! test
1853 Block tag on one line (<blockquote>)
1854 !! wikitext
1855 a <blockquote>foo</blockquote>
1856
1857 b
1858 !! html
1859 a <blockquote>foo</blockquote>
1860 <p>b
1861 </p>
1862 !! html+tidy
1863 <p>a</p>
1864 <blockquote>
1865 <p>foo</p>
1866 </blockquote>
1867 <p>b</p>
1868 !! end
1869
1870 !! test
1871 Block tag on both lines (<div>)
1872 !! wikitext
1873 a <div>foo</div>
1874
1875 b <div>foo</div>
1876 !! html
1877 a <div>foo</div>
1878 b <div>foo</div>
1879
1880 !! html+tidy
1881 <p>a</p>
1882 <div>foo</div>
1883 <p>b</p>
1884 <div>foo</div>
1885 !! end
1886
1887 !! test
1888 Block tag on both lines (<blockquote>)
1889 !! wikitext
1890 a <blockquote>foo</blockquote>
1891
1892 b <blockquote>foo</blockquote>
1893 !! html
1894 a <blockquote>foo</blockquote>
1895 b <blockquote>foo</blockquote>
1896
1897 !! html+tidy
1898 <p>a</p>
1899 <blockquote>
1900 <p>foo</p>
1901 </blockquote>
1902 <p>b</p>
1903 <blockquote>
1904 <p>foo</p>
1905 </blockquote>
1906 !! end
1907
1908 !! test
1909 Multiple lines without block tags
1910 !! wikitext
1911 <div>foo</div> a
1912 b
1913 c
1914 d<!--foo--> e
1915 x <div>foo</div> z
1916 !! html
1917 <div>foo</div> a
1918 <p>b
1919 c
1920 d e
1921 </p>
1922 x <div>foo</div> z
1923
1924 !! html+tidy
1925 <div>foo</div>
1926 <p>a</p>
1927 <p>b c d e</p>
1928 <p>x</p>
1929 <div>foo</div>
1930 <p>z</p>
1931 !! end
1932
1933 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1934 # So, we have a separate section for Parsoid. We don't want
1935 # to mimic this stripping behavior in Parsoid. It affects
1936 # editing experience and also requires us to maintain additional
1937 # info for RT-ing.
1938 !! test
1939 Empty lines between lines with block tags
1940 !! wikitext
1941 <div></div>
1942
1943
1944 <div></div>a
1945
1946 b
1947 <div>a</div>b
1948
1949 <div>b</div>d
1950
1951
1952 <div>e</div>
1953 !! html
1954 <div></div>
1955 <p><br />
1956 </p>
1957 <div></div>a
1958 <p>b
1959 </p>
1960 <div>a</div>b
1961 <div>b</div>d
1962 <p><br />
1963 </p>
1964 <div>e</div>
1965
1966 !! html+tidy
1967 <p><br /></p>
1968 <p>a</p>
1969 <p>b</p>
1970 <div>a</div>
1971 <p>b</p>
1972 <div>b</div>
1973 <p>d</p>
1974 <p><br /></p>
1975 <div>e</div>
1976 !! html/parsoid
1977 <div data-parsoid='{"stx":"html"}'></div>
1978
1979 <p><br /></p>
1980 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1981
1982 <p>b</p>
1983 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1984
1985 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1986
1987 <p><br /></p>
1988 <div data-parsoid='{"stx":"html"}'>e</div>
1989 !! end
1990
1991 ## PHP parser emits output which is broken
1992 !! test
1993 Unclosed HTML p-tags should be handled properly
1994 !! wikitext
1995 <div><p>foo</div>
1996 a
1997
1998 b
1999 !! html/php+tidy
2000 <div>
2001 <p>foo</p>
2002 </div>
2003 <p>a</p>
2004 <p>b</p>
2005 !! html/parsoid
2006 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2007 <p>a</p>
2008 <p>b</p>
2009 !! end
2010
2011 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2012 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2013 ## them for now.
2014 !! test
2015 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2016 !! options
2017 parsoid=wt2html
2018 !! wikitext
2019 a [[Category:A1]] [[Category:A2]]
2020 [[Category:A3]]
2021 [[Category:A4]]
2022 !! html/parsoid
2023 <p>a</p>
2024 <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"/>
2025 !! end
2026
2027 !! test
2028 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2029 !! options
2030 parsoid=wt2html
2031 !! wikitext
2032 [[Category:A1]]a
2033 !! html/parsoid
2034 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2035 !! end
2036
2037 ###
2038 ### Preformatted text
2039 ###
2040 !! test
2041 Preformatted text
2042 !! wikitext
2043 This is some
2044 Preformatted text
2045 With ''italic''
2046 And '''bold'''
2047 And a [[Main Page|link]]
2048 !! html
2049 <pre>This is some
2050 Preformatted text
2051 With <i>italic</i>
2052 And <b>bold</b>
2053 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2054 </pre>
2055 !! end
2056
2057 !! test
2058 Tabs don't trigger preformatted text
2059 !! wikitext
2060 This is not
2061 preformatted text.
2062 This is preformatted text.
2063 So is this.
2064 !! html/php
2065 <p> This is not
2066 preformatted text.
2067 </p>
2068 <pre>This is preformatted text.
2069 So is this.
2070 </pre>
2071 !! html/parsoid
2072 <p> This is not
2073 preformatted text.</p>
2074 <pre>This is preformatted text.
2075 So is this.</pre>
2076 !! end
2077
2078 !! test
2079 Space before tab needs nowiki pre protection
2080 !! options
2081 parsoid=html2wt
2082 !! html/parsoid
2083 <p> a</p>
2084 !! wikitext
2085 <nowiki> </nowiki> a
2086 !! end
2087
2088 !! test
2089 Ident preformatting with inline content
2090 !! wikitext
2091 a
2092 ''b''
2093 !! html
2094 <pre>a
2095 <i>b</i>
2096 </pre>
2097 !! end
2098
2099 !! test
2100 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2101 !! wikitext
2102 <pre><nowiki>
2103 <b>
2104 <cite>
2105 <em>
2106 </nowiki></pre>
2107 !! html
2108 <pre>
2109 &lt;b&gt;
2110 &lt;cite&gt;
2111 &lt;em&gt;
2112 </pre>
2113
2114 !! end
2115
2116 !! test
2117 Regression with preformatted in <center>
2118 !! wikitext
2119 <center>
2120 Blah
2121 </center>
2122 !! html
2123 <center>
2124 <pre>Blah
2125 </pre>
2126 </center>
2127
2128 !! end
2129
2130 !! test
2131 Bug 52763: Preformatted in <blockquote>
2132 !! wikitext
2133 <blockquote>
2134 Blah
2135 {|
2136 |
2137 indented cell (no pre-wrapping!)
2138 |}
2139 </blockquote>
2140 !! html
2141 <blockquote>
2142 <p> Blah
2143 </p>
2144 <table>
2145 <tr>
2146 <td>
2147 <p> indented cell (no pre-wrapping!)
2148 </p>
2149 </td></tr></table>
2150 </blockquote>
2151
2152 !! end
2153
2154 !! test
2155 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2156 !! wikitext
2157 <blockquote>
2158 Foo
2159
2160 Bar
2161 </blockquote>
2162 !! html
2163 <blockquote>
2164 <p>Foo
2165 </p><p>Bar
2166 </p>
2167 </blockquote>
2168
2169 !! end
2170
2171 !! test
2172 Bug 15491: <ins>/<del> in blockquote
2173 !! wikitext
2174 <blockquote>
2175 Foo <del>bar</del> <ins>baz</ins> quux
2176 </blockquote>
2177 !! html
2178 <blockquote>
2179 <p>Foo <del>bar</del> <ins>baz</ins> quux
2180 </p>
2181 </blockquote>
2182
2183 !! end
2184
2185 # Note that the p-wrapping is newline sensitive, which could be
2186 # considered a bug: tidy will wrap only the 'Foo' in the example
2187 # below in a <p> tag. (see comment 23-25 of bug #6200)
2188 !! test
2189 Bug 15491: <ins>/<del> in blockquote (2)
2190 !! wikitext
2191 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2192 </blockquote>
2193 !! html
2194 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2195 </blockquote>
2196
2197 !! html+tidy
2198 <blockquote>
2199 <p>Foo</p>
2200 <del>bar</del> <ins>baz</ins> quux</blockquote>
2201 !! end
2202
2203 !! test
2204 <pre> with attributes (bug 3202)
2205 !! wikitext
2206 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2207 !! html
2208 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2209
2210 !! end
2211
2212 !! test
2213 <pre> with width attribute (bug 3202)
2214 !! wikitext
2215 <pre width="8">Narrow screen goodies</pre>
2216 !! html
2217 <pre width="8">Narrow screen goodies</pre>
2218
2219 !! end
2220
2221 !! test
2222 <pre> with forbidden attribute (bug 3202)
2223 !! wikitext
2224 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2225 !! html
2226 <pre width="8">Narrow screen goodies</pre>
2227
2228 !! end
2229
2230 !! test
2231 Entities inside <pre>
2232 !! wikitext
2233 <pre>&lt;</pre>
2234 !! html
2235 <pre>&lt;</pre>
2236
2237 !! end
2238
2239 !! test
2240 <pre> with forbidden attribute values (bug 3202)
2241 !! wikitext
2242 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2243 !! html
2244 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2245
2246 !! end
2247
2248 !! test
2249 <nowiki> inside <pre> (bug 13238)
2250 !! wikitext
2251 <pre>
2252 <nowiki>
2253 </pre>
2254 <pre>
2255 <nowiki></nowiki>
2256 </pre>
2257 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2258 !! html
2259 <pre>
2260 &lt;nowiki&gt;
2261 </pre>
2262 <pre>
2263
2264 </pre>
2265 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2266
2267 !! end
2268
2269 !! test
2270 <nowiki> and <pre> preference (first one wins)
2271 !! wikitext
2272 <pre>
2273 <nowiki>
2274 </pre>
2275 </nowiki>
2276 </pre>
2277
2278 <nowiki>
2279 <pre>
2280 <nowiki>
2281 </pre>
2282 </nowiki>
2283 </pre>
2284
2285 !! html/php
2286 <pre>
2287 &lt;nowiki&gt;
2288 </pre>
2289 <p>&lt;/nowiki&gt;
2290 &lt;/pre&gt;
2291 </p><p>
2292 &lt;pre&gt;
2293 &lt;nowiki&gt;
2294 &lt;/pre&gt;
2295
2296 &lt;/pre&gt;
2297 </p>
2298 !! html/parsoid
2299 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2300 </pre>
2301 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2302 &lt;/pre></p>
2303
2304 <p><span typeof="mw:Nowiki">
2305 &lt;pre>
2306 &lt;nowiki>
2307 &lt;/pre>
2308 </span>
2309 &lt;/pre></p>
2310 !! end
2311
2312 !! test
2313 </pre> inside nowiki
2314 !! wikitext
2315 <nowiki></pre></nowiki>
2316 !! html
2317 <p>&lt;/pre&gt;
2318 </p>
2319 !! end
2320
2321 # Parsoid doesn't strip empty tags, like Tidy does.
2322 !! test
2323 Empty pre; pre inside other HTML tags (bug 54946)
2324 !! options
2325 parsoid=wt2html,wt2wt
2326 !! wikitext
2327 a
2328
2329 <div><pre>
2330 foo
2331 </pre></div>
2332 <pre></pre>
2333 !! html/php
2334 <p>a
2335 </p>
2336 <div><pre>
2337 foo
2338 </pre></div>
2339 <pre></pre>
2340
2341 !! html/php+tidy
2342 <p>a</p>
2343 <div>
2344 <pre>
2345 foo
2346 </pre></div>
2347 !! html/parsoid
2348 <p>a</p>
2349
2350 <div><pre>foo
2351 </pre></div>
2352 <pre></pre>
2353 !! end
2354
2355 !! test
2356 HTML pre followed by indent-pre
2357 !! wikitext
2358 <pre>foo</pre>
2359 bar
2360 !! html
2361 <pre>foo</pre>
2362 <pre>bar
2363 </pre>
2364 !! end
2365
2366 # Note that tidy removes the empty <p> tags from the start and end.
2367 # Parsoid does not, by design.
2368 !!test
2369 Block tag pre
2370 !! wikitext
2371 <p><pre>foo</pre></p>
2372 !! html/php+tidy
2373 <pre>
2374 foo
2375 </pre>
2376 !! html/parsoid
2377 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2378 !!end
2379
2380 !!test
2381 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2382 !! wikitext
2383 {{echo|}}
2384 !! html
2385
2386 !!end
2387
2388 !!test
2389 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2390 !! wikitext
2391 {{echo|
2392 foo}}
2393 !! html
2394 <p>foo
2395 </p>
2396 !!end
2397
2398 !! test
2399 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2400 !! wikitext
2401 {{echo|a
2402 b}}
2403 !! html
2404 <pre>a
2405 </pre>
2406 <p>b
2407 </p>
2408 !!end
2409
2410 !! test
2411 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2412 !! wikitext
2413 {{echo|a
2414 b
2415 c
2416 d
2417 e
2418 }}
2419 !! html
2420 <pre>a
2421 </pre>
2422 <p>b
2423 c
2424 </p>
2425 <pre>d
2426 </pre>
2427 <p>e
2428 </p>
2429 !!end
2430
2431 !!test
2432 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2433 !! wikitext
2434 {{echo| foo}}
2435
2436 {{echo| foo}}{{echo| bar}}
2437
2438 {{echo| foo}}
2439 {{echo| bar}}
2440
2441 {{echo|<!--cmt--> foo}}
2442
2443 <!--cmt-->{{echo| foo}}
2444
2445 {{echo|{{echo| }}bar}}
2446 !! html
2447 <pre>foo
2448 </pre>
2449 <pre>foo bar
2450 </pre>
2451 <pre>foo
2452 bar
2453 </pre>
2454 <pre>foo
2455 </pre>
2456 <pre>foo
2457 </pre>
2458 <pre>bar
2459 </pre>
2460 !!end
2461
2462 !! test
2463 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2464 !! wikitext
2465 {{echo| }}a
2466
2467 {{echo|
2468 }}a
2469
2470 {{echo|
2471 b}}
2472
2473 {{echo|a
2474 }}b
2475
2476 {{echo|a
2477 }} b
2478 !! html
2479 <pre>a
2480 </pre>
2481 <p><br />
2482 </p>
2483 <pre>a
2484 </pre>
2485 <p><br />
2486 </p>
2487 <pre>b
2488 </pre>
2489 <p>a
2490 </p>
2491 <pre>b
2492 </pre>
2493 <p>a
2494 </p>
2495 <pre>b
2496 </pre>
2497 !!end
2498
2499 !! test
2500 Pres with newline attributes
2501 !! wikitext
2502 <pre class="one
2503 two">hi</pre>
2504 !! html/php
2505 <pre class="one two">hi</pre>
2506
2507 !! html/parsoid
2508 <pre class="one
2509 two" data-parsoid='{"stx":"html"}'>hi</pre>
2510 !! end
2511
2512 !! test
2513 Things that look like <pre> tags aren't treated as such
2514 !! wikitext
2515 Barack Obama <President> of the United States
2516 <President></President>
2517 !! html
2518 <p>Barack Obama &lt;President&gt; of the United States
2519 &lt;President&gt;&lt;/President&gt;
2520 </p>
2521 !! end
2522
2523 ## PHP parser discards the "<pre " string
2524 !! test
2525 Handle broken pre-like tags (bug 64025)
2526 !! options
2527 parsoid=wt2html
2528 !! wikitext
2529 {{echo|<pre <pre>x</pre>}}
2530
2531 <table><pre </table>
2532 !! html/php
2533 <pre>x</pre>
2534 <table><pre></pre></table>
2535
2536 !! html/parsoid
2537 <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>
2538
2539
2540 <p>&lt;pre </p>
2541
2542 <table></table>
2543 !! end
2544
2545 !! test
2546 Parsoid: handle pre with space after attribute
2547 !! options
2548 parsoid=wt2html
2549 !! wikitext
2550 <pre style="width:50%;" >{{echo|foo}}</pre>
2551 !! html/php
2552 <pre style="width:50%;">{{echo|foo}}</pre>
2553
2554 !! html/parsoid
2555 <pre style="width:50%;">{{echo|foo}}</pre>
2556 !! end
2557
2558 # TODO / maybe: fix wt2wt for this
2559 !! test
2560 Parsoid: Don't paragraph-wrap fosterable content
2561 !! options
2562 parsoid=wt2html
2563 !! wikitext
2564 {|
2565 <td></td>
2566 <td></td>
2567
2568
2569
2570 |}
2571 !! html
2572 <table>
2573
2574 <tbody>
2575 <tr>
2576 <td></td>
2577
2578 <td></td></tr>
2579
2580
2581
2582 </tbody></table>
2583 !! end
2584
2585 !! test
2586 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2587 !! options
2588 parsoid=wt2html
2589 !! wikitext
2590 {|
2591 <td>
2592 <td>
2593 </td>
2594
2595
2596
2597 |}
2598 !! html
2599 <table>
2600
2601 <tbody>
2602 <tr>
2603 <td></td>
2604
2605 <td>
2606 </td></tr>
2607
2608
2609
2610 </tbody></table>
2611 !! end
2612
2613
2614 #--------------------------------------------------------------------
2615 # Transclusion parameter whitespace stripping tests
2616 # Behavior is different for positional and named parameters
2617 #--------------------------------------------------------------------
2618 !! test
2619 Templates: Strip leading and trailing whitespace from named-param values
2620 !! wikitext
2621 {{echo|1= a }}
2622
2623 {{echo|1= {{echo|b}} }}
2624
2625 {{echo| 1 =
2626 c }}
2627
2628 {{echo| 1 =
2629 * d
2630 }}
2631 !! html
2632 <p>a
2633 </p><p>b
2634 </p><p>c
2635 </p>
2636 <ul><li> d</li></ul>
2637
2638 !! end
2639
2640 !! test
2641 Templates: Don't strip whitespace from positional-param values
2642 !! wikitext
2643 {{echo|a }}
2644
2645 {{echo|{{echo|b}} }}
2646
2647 {{echo| c
2648 }}
2649
2650 {{echo| {{echo|d}}
2651 }}
2652
2653 {{echo|
2654 e}}
2655
2656 {{echo|
2657 * f}}
2658
2659 {{echo|
2660 }}g
2661 !! html
2662 <p>a
2663 </p><p>b
2664 </p>
2665 <pre>c
2666 </pre>
2667 <p><br />
2668 </p>
2669 <pre>d
2670 </pre>
2671 <p><br />
2672 </p>
2673 <pre>e
2674 </pre>
2675 <p><br />
2676 </p>
2677 <ul><li> f</li></ul>
2678 <p><br />
2679 </p>
2680 <pre>g
2681 </pre>
2682 !! end
2683
2684 !! test
2685 Templates: Handle empty comment-and-ws-only lines correctly
2686 !! wikitext
2687 {{echo|foo
2688 <!--should be ignored-->
2689 <!--should be ignored as well-->
2690 bar}}
2691 !! html
2692 <p>foo
2693 bar
2694 </p>
2695 !! end
2696
2697 !! test
2698 Templates: Handle comments in the target
2699 !! wikitext
2700 {{echo
2701 <!-- should be ignored -->
2702 |foo}}
2703
2704 {{echo<!-- should be ignored -->
2705 |foo}}
2706
2707 {{echo<!-- should be ignored -->|foo}}
2708
2709 {{<!-- should be ignored -->echo|foo}}
2710 !!html/parsoid
2711 <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>
2712
2713 <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>
2714
2715 <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>
2716
2717 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2718 !!end
2719
2720 !! test
2721 Templates: Handle comments in parameter names (bug 67657)
2722 !! wikitext
2723 {{echo|1
2724 <!-- should be ignored -->
2725 =foo}}
2726
2727 {{echo|
2728 <!-- should be ignored -->
2729 1 = foo}}
2730
2731 {{echo|1<!-- should be ignored --> = foo}}
2732
2733 {{echo|<!-- should be ignored -->1 = foo}}
2734 !!html/parsoid
2735 <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>
2736
2737 <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>
2738
2739 <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>
2740
2741 <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>
2742 !!end
2743
2744 !! test
2745 Templates: Other wikitext in parameter names (bug 67657)
2746 !! wikitext
2747 {{echo|''1''=foo}}
2748 !!html/parsoid
2749 <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>
2750 !!html/php
2751 <p>{{{1}}}
2752 </p>
2753 !!end
2754
2755 #--------------------------------------------------------------------
2756 # Transclusion parameter escaping tests
2757 #--------------------------------------------------------------------
2758 !! test
2759 Templates: Parsoid parameter escaping test 1
2760 !! wikitext
2761 {{echo|[foo]|{{echo|[bar]}}}}
2762 !! html/php+tidy
2763 <p>[foo]</p>
2764 !! html/parsoid
2765 <p about="#mwt1" typeof="mw:Transclusion"
2766 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2767 !! end
2768
2769 !! test
2770 Parsoid: Pipes in external links in template parameter
2771 !! wikitext
2772 {{echo|[{{echo|http://example.com}} link]}}
2773 !! html/php+tidy
2774 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2775 !! html/parsoid
2776 <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>
2777 !! end
2778
2779 !! test
2780 Parsoid: pipe in transclusion parameter
2781 !! wikitext
2782 {{echo|http://foo.com/a&#124;b}}
2783 !! html/php+tidy
2784 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2785 !! html/parsoid
2786 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2787 typeof="mw:Transclusion"
2788 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>
2789 !! end
2790
2791 !! test
2792 Parsoid: Pipe in external link target and content in template parameter
2793 !! options
2794 parsoid=html2wt,wt2wt
2795 !! wikitext
2796 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2797 !! html/php+tidy
2798 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2799 !! html/parsoid
2800 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2801 typeof="mw:Transclusion"
2802 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2803 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2804 !! end
2805
2806 !! test
2807 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2808 !! options
2809 parsoid
2810 !! wikitext
2811 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2812 !! html
2813 <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>
2814 !! end
2815
2816 !! test
2817 Templates: Don't escape already nowiki-escaped text in template parameters
2818 !! options
2819 parsoid=html2wt,wt2wt
2820 !! wikitext
2821 {{echo|foo<nowiki>|</nowiki>bar}}
2822 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2823 {{echo|<nowiki></nowiki>}}
2824 !! html/php+tidy
2825 <p>foo|bar &lt;div&gt;</p>
2826 !! html/parsoid
2827 <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>
2828 <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>
2829 <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>
2830 </p>
2831 !! end
2832
2833 ## Bug 52824
2834 !! test
2835 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2836 !! options
2837 parsoid=html2wt,wt2wt
2838 !! wikitext
2839 {{echo|{{echo|1=bar}}}}
2840 !! html/php+tidy
2841 <p>bar</p>
2842 !! html/parsoid
2843 <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>
2844 !! end
2845
2846 ## Bug 56733
2847 !! test
2848 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2849 !! wikitext
2850 {{echo|a : b}}
2851 !! html/php+tidy
2852 <p>a&#160;: b</p>
2853 !! html/parsoid
2854 <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>
2855 !! end
2856
2857 ## Bug T73412
2858 !! test
2859 Templates: Preserve blank parameter names
2860 !! wikitext
2861 {{echo|=foo}}
2862 !! html/php+tidy
2863 <p>{{{1}}}</p>
2864 !! html/parsoid
2865 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2866 !! end
2867
2868 !! test
2869 Templates: Preserve blank parameter names in other positions
2870 !! wikitext
2871 {{blank_param|bar|=foo}}
2872 !! html/php+tidy
2873 <p>bar foo</p>
2874 !! html/parsoid
2875 <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
2876 foo</p>
2877 !! end
2878
2879 ###
2880 ### Parsoid-centric tests for testing RT edge cases for pre
2881 ###
2882
2883 !!test
2884 1a. Indent-Pre and Comments
2885 !! wikitext
2886 a
2887 <!--a-->
2888 c
2889 !! html
2890 <pre>a
2891 </pre>
2892 <p>c
2893 </p>
2894 !!end
2895
2896 !!test
2897 1b. Indent-Pre and Comments
2898 !! wikitext
2899 a
2900 <!--a-->
2901 c
2902 !! html
2903 <pre>a
2904 </pre>
2905 <p>c
2906 </p>
2907 !!end
2908
2909 !!test
2910 1c. Indent-Pre and Comments
2911 !! wikitext
2912 <!--a--> a
2913
2914 <!--a--> a
2915 !! html
2916 <pre> a
2917 </pre>
2918 <pre> a
2919 </pre>
2920 !!end
2921
2922 !!test
2923 1d. Indent-Pre and Comments
2924 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2925 !! wikitext
2926 <!--a--> a
2927
2928 <!--b-->b
2929 !! html
2930 <pre>a
2931 </pre>
2932 <pre>b
2933 </pre>
2934 !!end
2935
2936 !!test
2937 2a. Indent-Pre and tables
2938 !! wikitext
2939 {|
2940 |-
2941 !h1!!h2
2942 |foo||bar
2943 |}
2944 !! html
2945 <table>
2946
2947 <tr>
2948 <th>h1</th>
2949 <th>h2
2950 </th>
2951 <td>foo</td>
2952 <td>bar
2953 </td></tr></table>
2954
2955 !!end
2956
2957 !!test
2958 2b. Indent-Pre and tables
2959 !! wikitext
2960 {|
2961 |-
2962 |foo
2963 |}
2964 !! html
2965 <table>
2966
2967 <tr>
2968 <td>foo
2969 </td></tr></table>
2970
2971 !!end
2972
2973 !!test
2974 2c. Indent-Pre and tables (bug 42252)
2975 !! wikitext
2976 {|
2977 |+ foo
2978 ! | bar
2979 |}
2980 !! html
2981 <table>
2982 <caption> foo
2983 </caption>
2984 <tr>
2985 <th> bar
2986 </th></tr></table>
2987
2988 !!end
2989
2990 !!test
2991 2d. Indent-Pre and tables
2992 !! wikitext
2993 a
2994 {|
2995 | b
2996 |}
2997 !! html/php
2998 <pre>a
2999 </pre>
3000 <table>
3001 <tr>
3002 <td> b
3003 </td></tr></table>
3004
3005 !! html/parsoid
3006 <pre>a</pre>
3007 <table>
3008 <tbody><tr><td> b</td></tr>
3009 </tbody></table>
3010 !!end
3011
3012 !!test
3013 2e. Indent-Pre and table-line syntax
3014 !! wikitext
3015 a
3016 | b
3017 | c
3018 !! html/php
3019 <pre>a
3020 | b
3021 | c
3022 </pre>
3023 !!end
3024
3025 !!test
3026 2f. Indent-pre started by table-line syntax
3027 !! wikitext
3028 a
3029 | b
3030 | c
3031 !! html/php
3032 <p>a
3033 </p>
3034 <pre>| b
3035 | c
3036 </pre>
3037 !! html/parsoid
3038 <p>a</p>
3039 <pre>
3040 | b
3041 | c</pre>
3042 !!end
3043
3044 !!test
3045 3a. Indent-Pre and block tags (single-line html)
3046 !! wikitext
3047 a <p> foo </p>
3048 b <div> foo </div>
3049 c <blockquote> foo </blockquote>
3050 <span> foo </span>
3051 !! html
3052 a <p> foo </p>
3053 b <div> foo </div>
3054 c <blockquote> foo </blockquote>
3055 <pre><span> foo </span>
3056 </pre>
3057 !! html/parsoid
3058 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3059 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3060 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3061 <pre><span> foo </span>
3062 </pre>
3063 !! html+tidy
3064 <p>a</p>
3065 <p>foo</p>
3066 <p>b</p>
3067 <div>foo</div>
3068 <p>c</p>
3069 <blockquote>
3070 <p>foo</p>
3071 </blockquote>
3072 <pre>
3073 <span> foo </span>
3074 </pre>
3075 !! end
3076
3077 !!test
3078 3b. Indent-Pre and block tags (multi-line html)
3079 !! wikitext
3080 a <span>foo</span>
3081 b <div> foo </div>
3082 !! html
3083 <pre>a <span>foo</span>
3084 </pre>
3085 b <div> foo </div>
3086
3087 !! html/parsoid
3088 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3089 b <div data-parsoid='{"stx":"html"}'> foo </div>
3090 !! html+tidy
3091 <pre>
3092 a <span>foo</span>
3093 </pre>
3094 <p>b</p>
3095 <div>foo</div>
3096 !!end
3097
3098 !!test
3099 3c. Indent-Pre and block tags (pre-content on separate line)
3100 !! wikitext
3101 <p>
3102 foo
3103 </p>
3104
3105 <div>
3106 foo
3107 </div>
3108
3109 <center>
3110 foo
3111 </center>
3112
3113 <blockquote>
3114 foo
3115 </blockquote>
3116
3117 <blockquote>
3118 <pre>
3119 foo
3120 </pre>
3121 </blockquote>
3122
3123 <table><tr><td>
3124 foo
3125 </td></tr></table>
3126
3127 <ul><li>
3128 foo
3129 </li></ul>
3130
3131 !! html
3132 <p>
3133 foo
3134 </p>
3135 <div>
3136 <pre>foo
3137 </pre>
3138 </div>
3139 <center>
3140 <pre>foo
3141 </pre>
3142 </center>
3143 <blockquote>
3144 <p> foo
3145 </p>
3146 </blockquote>
3147 <blockquote>
3148 <pre>
3149 foo
3150 </pre>
3151 </blockquote>
3152 <table><tr><td>
3153 <pre>foo
3154 </pre>
3155 </td></tr></table>
3156 <ul><li>
3157 foo
3158 </li></ul>
3159
3160 !!end
3161
3162 !!test
3163 4. Indent-Pre and extension tags
3164 !! wikitext
3165 a <gallery>
3166 File:foobar.jpg
3167 </gallery>
3168 !! html
3169 a <ul class="gallery mw-gallery-traditional">
3170 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3171 <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>
3172 <div class="gallerytext">
3173 </div>
3174 </div></li>
3175 </ul>
3176
3177 !! html+tidy
3178 <p>a</p>
3179 <ul class="gallery mw-gallery-traditional">
3180 <li class="gallerybox" style="width: 155px">
3181 <div style="width: 155px">
3182 <div class="thumb" style="width: 150px;">
3183 <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>
3184 </div>
3185 <div class="gallerytext"></div>
3186 </div>
3187 </li>
3188 </ul>
3189 !!end
3190
3191 !! test
3192 Table wikitext syntax outside wiki-tables
3193 !! wikitext
3194 a
3195 ! not a table heading
3196 |- not a table row
3197 | not a table cell
3198 | class="foo bar" | baz
3199 b
3200 |}
3201 |-
3202 c
3203 !! html
3204 <p>a
3205 ! not a table heading
3206 |- not a table row
3207 | not a table cell
3208 | class="foo bar" | baz
3209 b
3210 |}
3211 |-
3212 c
3213 </p>
3214 !! end
3215
3216 !!test
3217 Render paragraphs when indent-pre is suppressed in blocklevels
3218 !! wikitext
3219 <blockquote>
3220 foo
3221
3222 bar
3223 </blockquote>
3224 !! html
3225 <blockquote>
3226 <p> foo
3227 </p><p> bar
3228 </p>
3229 </blockquote>
3230
3231 !!end
3232
3233 !!test
3234 4. Multiple spaces at start-of-line
3235 !! wikitext
3236 <p> foo </p>
3237 foo
3238 {|
3239 |foo
3240 |}
3241 !! html
3242 <p> foo </p>
3243 <pre> foo
3244 </pre>
3245 <table>
3246 <tr>
3247 <td>foo
3248 </td></tr></table>
3249
3250 !!end
3251
3252 ## NOTE: the leading white-space chars on empty line are significant
3253 !! test
3254 5a. White-space in indent-pre
3255 !! wikitext
3256 a<br />
3257
3258 b
3259 !! html
3260 <pre>a<br />
3261
3262 b
3263 </pre>
3264 !! end
3265
3266 ## NOTE: the leading white-space chars on empty line are significant
3267 !! test
3268 5b. White-space in indent-pre
3269 !! wikitext
3270 a
3271
3272 b
3273
3274
3275 c
3276 !! html
3277 <pre>a
3278
3279 b
3280
3281
3282 c
3283 </pre>
3284 !! end
3285
3286 !! test
3287 5c. White-space in indent-pre
3288 !! wikitext
3289 ''a''
3290 ''b''
3291 ''c''
3292 !! html
3293 <pre><i>a</i>
3294 <i>b</i>
3295 <i>c</i>
3296 </pre>
3297 !! end
3298
3299 !! test
3300 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3301 !! wikitext
3302 a
3303
3304 <!-- continue -->
3305 b
3306
3307 c
3308
3309 d
3310 !! html
3311 <pre>a
3312
3313 b
3314 </pre>
3315 <pre>c
3316
3317 </pre>
3318 <p>d
3319 </p>
3320 !! end
3321
3322 !! test
3323 7a. Indent-pre and category links
3324 !! options
3325 parsoid=wt2html,wt2wt
3326 !! wikitext
3327 [[Category:foo]] <!-- No pre-wrapping -->
3328 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3329 !! html/php+tidy
3330 !! html/parsoid
3331 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3332 <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 -->
3333 !! end
3334
3335 ## We used to, but no longer wt2wt this test since the default serializer
3336 ## will normalize all categories to serialize on their own line.
3337 ## This wikitext usage is going to be fairly uncommon in production and
3338 ## selser will take care of preserving formatting in those scenarios.
3339 !! test
3340 7b. Indent-pre and category links
3341 !! options
3342 parsoid=wt2html
3343 !! wikitext
3344 [[Category:foo]] a
3345 [[Category:foo]] {{echo|b}}
3346 !! html/parsoid
3347 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3348 <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>
3349 !! end
3350
3351 !! test
3352 Indent-Pre: Newlines in comments shouldn't affect sol state
3353 !! wikitext
3354 a <!--
3355 foo
3356 --> b
3357 !! html/php+tidy
3358 <p>a b</p>
3359 !! html/parsoid
3360 <p>a <!--
3361 foo
3362 --> b</p>
3363 !! end
3364
3365 ###
3366 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3367 ###
3368
3369 !!test
3370 HTML-pre: 1. embedded newlines
3371 !! wikitext
3372 <pre>foo</pre>
3373
3374 <pre>
3375 foo
3376 </pre>
3377
3378 <pre>
3379
3380 foo
3381 </pre>
3382
3383 <pre>
3384
3385
3386 foo
3387 </pre>
3388 !! html/php+tidy
3389 <pre>
3390 foo
3391 </pre>
3392 <pre>
3393 foo
3394 </pre>
3395 <pre>
3396
3397 foo
3398 </pre>
3399 <pre>
3400
3401
3402 foo
3403 </pre>
3404 !! html/parsoid
3405 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3406
3407 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3408 foo
3409 </pre>
3410
3411 <pre data-parsoid='{"stx":"html"}'>
3412
3413 foo
3414 </pre>
3415
3416 <pre data-parsoid='{"stx":"html"}'>
3417
3418
3419 foo
3420 </pre>
3421 !!end
3422
3423 !! test
3424 HTML-pre: big spaces
3425 !! wikitext
3426 <pre>
3427
3428
3429
3430
3431 haha
3432
3433
3434
3435
3436 haha
3437
3438
3439
3440
3441 </pre>
3442 !! html/php+tidy
3443 <pre>
3444
3445
3446
3447
3448 haha
3449
3450
3451
3452
3453 haha
3454
3455
3456
3457
3458 </pre>
3459 !! html/parsoid
3460 <pre data-parsoid='{"stx":"html"}'>
3461
3462
3463
3464
3465 haha
3466
3467
3468
3469
3470 haha
3471
3472
3473
3474
3475 </pre>
3476 !! end
3477
3478 !!test
3479 HTML-pre: 2: indented text
3480 !! wikitext
3481 <pre>
3482 foo
3483 </pre>
3484 !! html
3485 <pre>
3486 foo
3487 </pre>
3488
3489 !!end
3490
3491 !!test
3492 HTML-pre: 3: other wikitext
3493 !! wikitext
3494 <pre>
3495 * foo
3496 # bar
3497 = no-h =
3498 '' no-italic ''
3499 [[ NoLink ]]
3500 </pre>
3501 !! html/php
3502 <pre>
3503 * foo
3504 # bar
3505 = no-h =
3506 '' no-italic ''
3507 [[ NoLink ]]
3508 </pre>
3509
3510 !! html/parsoid
3511 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3512 # bar
3513 = no-h =
3514 '' no-italic ''
3515 [[ NoLink ]]
3516 </pre>
3517 !!end
3518
3519 ###
3520 ### Definition lists
3521 ###
3522 !! test
3523 Simple definition
3524 !! wikitext
3525 ; name : Definition
3526 !! html
3527 <dl><dt> name&#160;</dt>
3528 <dd> Definition</dd></dl>
3529
3530 !! end
3531
3532 !! test
3533 Definition list for indentation only
3534 !! wikitext
3535 : Indented text
3536 !! html
3537 <dl><dd> Indented text</dd></dl>
3538
3539 !! end
3540
3541 !! test
3542 Definition list with no space
3543 !! wikitext
3544 ;name:Definition
3545 !! html
3546 <dl><dt>name</dt>
3547 <dd>Definition</dd></dl>
3548
3549 !!end
3550
3551 !! test
3552 Definition list with URL link
3553 !! wikitext
3554 ; http://example.com/ : definition
3555 !! html
3556 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3557 <dd> definition</dd></dl>
3558
3559 !! end
3560
3561 !! test
3562 Definition list with bracketed URL link
3563 !! wikitext
3564 ;[http://www.example.com/ Example]:Something about it
3565 !! html
3566 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3567 <dd>Something about it</dd></dl>
3568
3569 !! end
3570
3571 !! test
3572 Definition list with wikilink containing colon
3573 !! wikitext
3574 ; [[Help:FAQ]]: The least-read page on Wikipedia
3575 !! html
3576 <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>
3577 <dd> The least-read page on Wikipedia</dd></dl>
3578
3579 !! end
3580
3581 # At Brion's and JeLuF's insistence... :)
3582 !! test
3583 Definition list with news link containing colon
3584 !! wikitext
3585 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3586 !! html/php
3587 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3588 <dd> This isn't even a real newsgroup!</dd></dl>
3589
3590 !! html/parsoid
3591 <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>
3592 !! end
3593
3594 !! test
3595 Malformed definition list with colon
3596 !! wikitext
3597 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3598 !! html
3599 <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>
3600
3601 !! end
3602
3603 !! test
3604 Definition lists: colon in external link text
3605 !! wikitext
3606 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3607 !! html
3608 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3609 <dd> OK, I made that up</dd></dl>
3610
3611 !! end
3612
3613 !! test
3614 Definition lists: colon in HTML attribute
3615 !! wikitext
3616 ;<b style="display: inline">bold</b>
3617 !! html
3618 <dl><dt><b style="display: inline">bold</b></dt></dl>
3619
3620 !! end
3621
3622 !! test
3623 Definition lists: self-closed tag
3624 !! wikitext
3625 ;one<br/>two : two-line fun
3626 !! html
3627 <dl><dt>one<br />two&#160;</dt>
3628 <dd> two-line fun</dd></dl>
3629
3630 !! end
3631
3632 !! test
3633 Bug 11748: Literal closing tags
3634 !! wikitext
3635 <dl>
3636 <dt>test 1</dt>
3637 <dd>test test test test test</dd>
3638 <dt>test 2</dt>
3639 <dd>test test test test test</dd>
3640 </dl>
3641 !! html
3642 <dl>
3643 <dt>test 1</dt>
3644 <dd>test test test test test</dd>
3645 <dt>test 2</dt>
3646 <dd>test test test test test</dd>
3647 </dl>
3648
3649 !! end
3650
3651 !! test
3652 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3653 !! wikitext
3654 <ul><li>
3655 ; term : description
3656 * unordered
3657 </li></ul>
3658 !! html
3659 <ul><li>
3660 <dl><dt> term&#160;</dt>
3661 <dd> description</dd></dl>
3662 <ul><li> unordered</li></ul>
3663 </li></ul>
3664
3665 !! end
3666
3667 !! test
3668
3669 Definition list with empty definition and following paragraph
3670 !! wikitext
3671 ; term:
3672 Paragraph text
3673 !! html
3674 <dl><dt> term</dt>
3675 <dd></dd></dl>
3676 <p>Paragraph text
3677 </p>
3678 !! end
3679
3680 !! test
3681 Nested definition lists using html syntax
3682 !! wikitext
3683 <dl><dt>x</dt>
3684 <dd>a</dd>
3685 <dd>b</dd></dl>
3686
3687 !! end
3688
3689 !! test
3690 Definition Lists: No nesting: Multiple dd's
3691 !! wikitext
3692 ;x
3693 :a
3694 :b
3695 !! html
3696 <dl><dt>x</dt>
3697 <dd>a</dd>
3698 <dd>b</dd></dl>
3699
3700 !! end
3701
3702 !! test
3703 Definition Lists: Indentation: Regular
3704 !! wikitext
3705 :i1
3706 ::i2
3707 :::i3
3708 !! html
3709 <dl><dd>i1
3710 <dl><dd>i2
3711 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3712
3713 !! end
3714
3715 !! test
3716 Definition Lists: Indentation: Missing 1st level
3717 !! wikitext
3718 ::i2
3719 :::i3
3720 !! html
3721 <dl><dd><dl><dd>i2
3722 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3723
3724 !! end
3725
3726 !! test
3727 Definition Lists: Indentation: Multi-level indent
3728 !! wikitext
3729 :::i3
3730 !! html
3731 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3732
3733 !! end
3734
3735 !! test
3736 Definition Lists: Hacky use to indent tables
3737 !! wikitext
3738 ::{|
3739 |foo
3740 |bar
3741 |}
3742 this text
3743 should be left alone
3744 !! html
3745 <dl><dd><dl><dd><table>
3746 <tr>
3747 <td>foo
3748 </td>
3749 <td>bar
3750 </td></tr></table></dd></dl></dd></dl>
3751 <p>this text
3752 should be left alone
3753 </p>
3754 !! end
3755
3756 !! test
3757 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3758 !! wikitext
3759 <!-- foo -->
3760 ::{|
3761 |foo
3762 |bar
3763 |}<!-- bar -->
3764 this text
3765 should be left alone
3766 !! html/parsoid
3767 <!-- foo -->
3768 <dl><dd><dl><dd><table><tr>
3769 <td>foo</td>
3770 <td>bar</td>
3771 </tr></table><!-- bar --></dd></dl></dd></dl>
3772 <p>this text
3773 should be left alone</p>
3774 !! end
3775
3776 !! test
3777 Definition Lists: Hacky use to indent tables, with comment before table
3778 !! wikitext
3779 ::<!-- foo -->{|
3780 |foo
3781 |}
3782 !! html/parsoid
3783 <dl><dd><dl><dd><!-- foo --><table><tr>
3784 <td>foo</td>
3785 </tr></table></dd></dl></dd></dl>
3786 !! end
3787
3788 # The trailing whitespace in this test is to catch a regression in
3789 # Parsoid after T54473.
3790 !! test
3791 Definition Lists: Hacky use to indent tables (WS-insensitive)
3792 !! wikitext
3793 : {|
3794 |a
3795 |}
3796 !! html/php
3797 <dl><dd><table>
3798 <tr>
3799 <td>a
3800 </td></tr></table></dd></dl>
3801
3802 !! html/parsoid
3803 <dl><dd> <table>
3804 <tbody><tr><td>a</td></tr>
3805 </tbody></table> </dd></dl>
3806 !! end
3807
3808 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3809 ## as an empty dt item. It also ignores all but the last ";" when followed
3810 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3811 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3812 ## ";"s.
3813 ##
3814 ## Ex: ";;t2 ::d2" is transformed into:
3815 ##
3816 ## <dl>
3817 ## <dt>t2 </dt>
3818 ## <dd>
3819 ## <dl>
3820 ## <dt></dt>
3821 ## <dd>d2</dd>
3822 ## </dl>
3823 ## </dd>
3824 ## </dl>
3825 ##
3826 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3827 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3828 ##
3829 ## <dl>
3830 ## <dt>
3831 ## <dl>
3832 ## <dt>t2 </dt>
3833 ## <dd>:d2</dd>
3834 ## </dl>
3835 ## </dt>
3836 ## </dl>
3837 ##
3838 ## All Parsoid only definition list tests have this difference.
3839 ##
3840 ## See also: https://phabricator.wikimedia.org/T8569
3841 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3842
3843 !! test
3844 Table / list interaction: indented table with lists in table contents
3845 !! wikitext
3846 :{|
3847 |-
3848 | a
3849 * b
3850 |-
3851 | c
3852 * d
3853 |}
3854 !! html
3855 <dl><dd><table>
3856
3857 <tr>
3858 <td> a
3859 <ul><li> b</li></ul>
3860 </td></tr>
3861 <tr>
3862 <td> c
3863 <ul><li> d</li></ul>
3864 </td></tr></table></dd></dl>
3865
3866 !! end
3867
3868 !!test
3869 Table / list interaction: lists nested in tables nested in indented lists
3870 !! wikitext
3871 :{|
3872 |
3873 :a
3874 :b
3875 |
3876 *c
3877 *d
3878 |}
3879
3880 *e
3881 *f
3882 !! html
3883 <dl><dd><table>
3884 <tr>
3885 <td>
3886 <dl><dd>a</dd>
3887 <dd>b</dd></dl>
3888 </td>
3889 <td>
3890 <ul><li>c</li>
3891 <li>d</li></ul>
3892 </td></tr></table></dd></dl>
3893 <ul><li>e</li>
3894 <li>f</li></ul>
3895
3896 !!end
3897
3898 !! test
3899 Definition Lists: Nesting: Multi-level (Parsoid only)
3900 !! options
3901 parsoid
3902 !! wikitext
3903 ;t1 :d1
3904 ;;t2 ::d2
3905 ;;;t3 :::d3
3906 !! html
3907 <dl>
3908 <dt>t1 </dt>
3909 <dd>d1</dd>
3910 <dt>
3911 <dl>
3912 <dt>t2 </dt>
3913 <dd>:d2</dd>
3914 <dt>
3915 <dl>
3916 <dt>t3 </dt>
3917 <dd>::d3</dd>
3918 </dl>
3919 </dt>
3920 </dl>
3921 </dt>
3922 </dl>
3923
3924
3925 !! end
3926
3927
3928 !! test
3929 Definition Lists: Nesting: Test 2 (Parsoid only)
3930 !! wikitext
3931 ;t1
3932 ::d2
3933 !! html/php+tidy
3934 <dl>
3935 <dt>t1</dt>
3936 <dd>
3937 <dl>
3938 <dd>d2</dd>
3939 </dl>
3940 </dd>
3941 </dl>
3942 !! html/parsoid
3943 <dl>
3944 <dt>t1</dt>
3945 <dd>
3946 <dl>
3947 <dd>d2</dd>
3948 </dl>
3949 </dd>
3950 </dl>
3951
3952 !! end
3953
3954
3955 !! test
3956 Definition Lists: Nesting: Test 3 (Parsoid only)
3957 !! wikitext
3958 :;t1
3959 ::::d2
3960 !! html/php+tidy
3961 <dl>
3962 <dd>
3963 <dl>
3964 <dt>t1</dt>
3965 <dd>
3966 <dl>
3967 <dd>
3968 <dl>
3969 <dd>d2</dd>
3970 </dl>
3971 </dd>
3972 </dl>
3973 </dd>
3974 </dl>
3975 </dd>
3976 </dl>
3977 !! html/parsoid
3978 <dl>
3979 <dd>
3980 <dl>
3981 <dt>t1</dt>
3982 <dd>
3983 <dl>
3984 <dd>
3985 <dl>
3986 <dd>d2</dd>
3987 </dl>
3988 </dd>
3989 </dl>
3990 </dd>
3991 </dl>
3992 </dd>
3993 </dl>
3994
3995 !! end
3996
3997
3998 !! test
3999 Definition Lists: Nesting: Test 4
4000 !! wikitext
4001 ::;t3
4002 :::d3
4003 !! html
4004 <dl><dd><dl><dd><dl><dt>t3</dt>
4005 <dd>d3</dd></dl></dd></dl></dd></dl>
4006
4007 !! end
4008
4009
4010 ## The Parsoid team believes the following three test exposes a
4011 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4012 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4013 ## It also exposes a "misfeature" in tidy, which doesn't like
4014 ## <dl> tags with a single <dt> child; it converts the <dt> into
4015 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4016 !! test
4017 Definition Lists: Mixed Lists: Test 1
4018 !! wikitext
4019 :;* foo
4020 ::* bar
4021 :; baz
4022 !! html/php
4023 <dl><dd><dl><dt><ul><li> foo</li>
4024 <li> bar</li></ul></dt></dl>
4025 <dl><dt> baz</dt></dl></dd></dl>
4026
4027 !! html/php+tidy
4028 <dl>
4029 <dd>
4030 <dl>
4031 <dd>
4032 <ul>
4033 <li>foo</li>
4034 <li>bar</li>
4035 </ul>
4036 </dd>
4037 </dl>
4038 <dl>
4039 <dt>baz</dt>
4040 </dl>
4041 </dd>
4042 </dl>
4043 !! html/parsoid
4044 <dl>
4045 <dd><dl>
4046 <dt><ul>
4047 <li> foo
4048 </li>
4049 </ul></dt>
4050 <dd><ul>
4051 <li> bar
4052 </li>
4053 </ul></dd>
4054 <dt> baz</dt>
4055 </dl></dd>
4056 </dl>
4057 !! end
4058
4059 !! test
4060 Definition Lists: Mixed Lists: Test 2
4061 !! wikitext
4062 *: d1
4063 *: d2
4064 !! html
4065 <ul><li><dl><dd> d1</dd>
4066 <dd> d2</dd></dl></li></ul>
4067
4068 !! end
4069
4070
4071 !! test
4072 Definition Lists: Mixed Lists: Test 3
4073 !! wikitext
4074 *::: d1
4075 *::: d2
4076 !! html
4077 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4078 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4079
4080 !! end
4081
4082
4083 !! test
4084 Definition Lists: Mixed Lists: Test 4
4085 !! wikitext
4086 *;d1 :d2
4087 *;d3 :d4
4088 !! html
4089 <ul><li><dl><dt>d1&#160;</dt>
4090 <dd>d2</dd>
4091 <dt>d3&#160;</dt>
4092 <dd>d4</dd></dl></li></ul>
4093
4094 !! end
4095
4096
4097 !! test
4098 Definition Lists: Mixed Lists: Test 5
4099 !! wikitext
4100 *:d1
4101 *:: d2
4102 !! html
4103 <ul><li><dl><dd>d1
4104 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4105
4106 !! end
4107
4108
4109 !! test
4110 Definition Lists: Mixed Lists: Test 6
4111 !! wikitext
4112 #*:d1
4113 #*::: d3
4114 !! html
4115 <ol><li><ul><li><dl><dd>d1
4116 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4117
4118 !! end
4119
4120
4121 !! test
4122 Definition Lists: Mixed Lists: Test 7
4123 !! wikitext
4124 :* d1
4125 :* d2
4126 !! html
4127 <dl><dd><ul><li> d1</li>
4128 <li> d2</li></ul></dd></dl>
4129
4130 !! end
4131
4132
4133 !! test
4134 Definition Lists: Mixed Lists: Test 8
4135 !! wikitext
4136 :* d1
4137 ::* d2
4138 !! html
4139 <dl><dd><ul><li> d1</li></ul>
4140 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4141
4142 !! end
4143
4144
4145 !! test
4146 Definition Lists: Mixed Lists: Test 9
4147 !! wikitext
4148 *;foo :bar
4149 !! html
4150 <ul><li><dl><dt>foo&#160;</dt>
4151 <dd>bar</dd></dl></li></ul>
4152
4153 !! end
4154
4155
4156 !! test
4157 Definition Lists: Mixed Lists: Test 10
4158 !! wikitext
4159 *#;foo :bar
4160 !! html
4161 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4162 <dd>bar</dd></dl></li></ol></li></ul>
4163
4164 !! end
4165
4166 # The Parsoid team disagrees with the PHP parser's seemingly-random
4167 # rules regarding dd/dt on the next two tests. Parsoid is more
4168 # consistent, and recognizes the shared nesting and keeps the
4169 # still-open tags around until the nesting is complete.
4170 # (And tidy again converts <dt> to <dd> before 'bar'.)
4171
4172 !! test
4173 Definition Lists: Mixed Lists: Test 11
4174 !! wikitext
4175 *#*#;*;;foo :bar
4176 *#*#;boo :baz
4177 !! html/php
4178 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4179 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4180 <dl><dt>boo&#160;</dt>
4181 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4182
4183 !! html/php+tidy
4184 <ul>
4185 <li>
4186 <ol>
4187 <li>
4188 <ul>
4189 <li>
4190 <ol>
4191 <li>
4192 <dl>
4193 <dt>foo&#160;</dt>
4194 <dd>
4195 <ul>
4196 <li>
4197 <dl>
4198 <dd>
4199 <dl>
4200 <dt>bar</dt>
4201 </dl>
4202 </dd>
4203 </dl>
4204 </li>
4205 </ul>
4206 </dd>
4207 </dl>
4208 <dl>
4209 <dt>boo&#160;</dt>
4210 <dd>baz</dd>
4211 </dl>
4212 </li>
4213 </ol>
4214 </li>
4215 </ul>
4216 </li>
4217 </ol>
4218 </li>
4219 </ul>
4220 !! html/parsoid
4221 <ul>
4222 <li>
4223 <ol>
4224 <li>
4225 <ul>
4226 <li>
4227 <ol>
4228 <li>
4229 <dl>
4230 <dt>
4231 <ul>
4232 <li>
4233 <dl>
4234 <dt>
4235 <dl>
4236 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4237 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4238 </dl></dt>
4239 </dl></li>
4240 </ul></dt>
4241 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4242 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4243 </dl></li>
4244 </ol></li>
4245 </ul></li>
4246 </ol></li>
4247 </ul>
4248 !! end
4249
4250
4251 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4252 # From whitelist:
4253 # * The test is wrong, there are two colons where there should be :;
4254 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4255 !! test
4256 Definition Lists: Weird Ones: Test 1
4257 !! wikitext
4258 *#;*::;; foo : bar (who uses this?)
4259 !! html/php
4260 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4261 <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>
4262
4263 !! html/php+tidy
4264 <ul>
4265 <li>
4266 <ol>
4267 <li>
4268 <dl>
4269 <dt>foo&#160;</dt>
4270 <dd>
4271 <ul>
4272 <li>
4273 <dl>
4274 <dd>
4275 <dl>
4276 <dd>
4277 <dl>
4278 <dd>
4279 <dl>
4280 <dt>bar (who uses this?)</dt>
4281 </dl>
4282 </dd>
4283 </dl>
4284 </dd>
4285 </dl>
4286 </dd>
4287 </dl>
4288 </li>
4289 </ul>
4290 </dd>
4291 </dl>
4292 </li>
4293 </ol>
4294 </li>
4295 </ul>
4296 !! html/parsoid
4297 <ul>
4298 <li>
4299 <ol>
4300 <li>
4301 <dl>
4302 <dt>
4303 <ul>
4304 <li>
4305 <dl>
4306 <dd>
4307 <dl>
4308 <dd>
4309 <dl>
4310 <dt>
4311 <dl>
4312 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4313 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4314 </dl></dt>
4315 </dl></dd>
4316 </dl></dd>
4317 </dl></li>
4318 </ul></dt>
4319 </dl></li>
4320 </ol></li>
4321 </ul>
4322 !! end
4323
4324 !! test
4325 Definition Lists: colons occurring in tags
4326 !! wikitext
4327 ;a:b
4328 ;'''a:b'''
4329 ;<i>a:b</i>
4330 ;<span>a:b</span>
4331 ;<div>a:b</div>
4332 ;<div>a
4333 :b</div>
4334 ;{{echo|a:b}}
4335 ;{{echo|''a:b''}}
4336 ;;;''a:b''
4337 !! html+tidy
4338 <dl>
4339 <dt>a</dt>
4340 <dd>b</dd>
4341 <dt><b>a:b</b></dt>
4342 <dt><i>a:b</i></dt>
4343 <dt><span>a:b</span></dt>
4344 <dd>
4345 <div>a:b</div>
4346 </dd>
4347 <dd>
4348 <div>a
4349 <dl>
4350 <dd>b</dd>
4351 </dl>
4352 </div>
4353 </dd>
4354 <dt>a</dt>
4355 <dd>b</dd>
4356 <dt><i>a:b</i></dt>
4357 </dl>
4358 <dl>
4359 <dd>
4360 <dl>
4361 <dd>
4362 <dl>
4363 <dt><i>a:b</i></dt>
4364 </dl>
4365 </dd>
4366 </dl>
4367 </dd>
4368 </dl>
4369 !! html/parsoid
4370 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4371 <dt><b>a:b</b></dt>
4372 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4373 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4374 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4375 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4376 <dd>b</dd>
4377 <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>
4378 <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>
4379 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4380 !! end
4381
4382 !! test
4383 Definition Lists: colons and tables 1
4384 !! wikitext
4385 :{|
4386 | x
4387 |}
4388 :{|
4389 | y
4390 |}
4391 !! html
4392 <dl><dd><table>
4393 <tr>
4394 <td> x
4395 </td></tr></table></dd></dl>
4396 <dl><dd><table>
4397 <tr>
4398 <td> y
4399 </td></tr></table></dd></dl>
4400
4401 !! end
4402
4403 # Parsoid's output (as documented below) differs from php's in this case.
4404 # This is probably a bug. If we fixup parsoid to match php's output, the
4405 # above test should pass and the below test case can be removed. It is
4406 # unclear which output is more desirable.
4407
4408 !! test
4409 Definition Lists: colons and tables 2
4410 !! wikitext
4411 :{|
4412 | x
4413 |}
4414 :{|
4415 | y
4416 |}
4417 !! html/parsoid
4418 <dl><dd><table>
4419 <tr>
4420 <td> x
4421 </td></tr></table></dd>
4422 <dd><table>
4423 <tr>
4424 <td> y
4425 </td></tr></table></dd></dl>
4426 !! end
4427
4428 !! test
4429 Definition Lists: template interaction
4430 !! wikitext
4431 ::{{definition_list}}
4432
4433 :one
4434 ::{{definition_list}}
4435 :::two
4436 :::three
4437 ::four
4438 !! html/parsoid
4439 <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">
4440 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4441
4442 <dl><dd data-parsoid='{}'>one
4443 <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">
4444 </span><dd about="#mwt2">two
4445 <dl><dd>two</dd>
4446 <dd>three</dd></dl></dd>
4447 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4448 !! end
4449
4450
4451 ###
4452 ### External links
4453 ###
4454 !! test
4455 External links: non-bracketed
4456 !! wikitext
4457 Non-bracketed: http://example.com
4458 !! html
4459 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4460 </p>
4461 !! end
4462
4463 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4464 !! test
4465 External links: numbered
4466 !! wikitext
4467 Numbered: [http://example.com]
4468 Numbered: [http://example.net]
4469 Numbered: [http://example.com]
4470 !! html/php
4471 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4472 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4473 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4474 </p>
4475 !! html/parsoid
4476 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4477 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4478 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4479 !!end
4480
4481 !! test
4482 External links: specified text
4483 !! wikitext
4484 Specified text: [http://example.com link]
4485 !! html
4486 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4487 </p>
4488 !!end
4489
4490 !! test
4491 External links: trail
4492 !! wikitext
4493 Linktrails should not work for external links: [http://example.com link]s
4494 !! html
4495 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4496 </p>
4497 !! end
4498
4499 !! test
4500 External links: dollar sign in URL
4501 !! wikitext
4502 http://example.com/1$2345
4503 !! html
4504 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4505 </p>
4506 !! end
4507
4508 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4509 !! test
4510 External links: dollar sign in URL (autonumber)
4511 !! wikitext
4512 [http://example.com/1$2345]
4513 !! html/php
4514 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4515 </p>
4516 !! html/parsoid
4517 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4518 !!end
4519
4520 !! test
4521 External links: open square bracket forbidden in URL (bug 4377)
4522 !! options
4523 parsoid=wt2html,wt2wt,html2html
4524 !! wikitext
4525 http://example.com/1[2345
4526 !! html/php
4527 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4528 </p>
4529 !! html/parsoid
4530 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4531 !! end
4532
4533 !! test
4534 External links: open square bracket forbidden in URL (named) (bug 4377)
4535 !! options
4536 parsoid=wt2html,html2html
4537 !! wikitext
4538 [http://example.com/1[2345]
4539 !! html/php
4540 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4541 </p>
4542 !! html/parsoid
4543 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4544 !!end
4545
4546 # parsoid adds a space before the link name
4547 !! test
4548 External links: open square bracket forbidden in URL (named) (bug 4377)
4549 Parsoid variant.
4550 !! wikitext
4551 [http://example.com/1 [2345]
4552 !! html
4553 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4554 </p>
4555 !!end
4556
4557 !! test
4558 External links: nowiki in URL link text (bug 6230)
4559 !! wikitext
4560 [http://example.com/ <nowiki>''example site''</nowiki>]
4561 !! html
4562 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4563 </p>
4564 !! end
4565
4566 !! test
4567 External links: newline forbidden in text (bug 6230 regression check)
4568 !! wikitext
4569 [http://example.com/ first
4570 second]
4571 !! html
4572 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4573 second]
4574 </p>
4575 !!end
4576
4577 !! test
4578 External links: Pipe char between url and text
4579 !! wikitext
4580 [http://example.com | link]
4581 !! html
4582 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4583 </p>
4584 !!end
4585
4586 !! test
4587 External links: protocol-relative URL in brackets
4588 !! wikitext
4589 [//example.com/ Test]
4590 !! html
4591 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4592 </p>
4593 !! end
4594
4595 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4596 !! test
4597 External links: protocol-relative URL in brackets without text
4598 !! wikitext
4599 [//example.com]
4600 !! html/php
4601 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4602 </p>
4603 !! html/parsoid
4604 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4605 !! end
4606
4607 !! test
4608 External links: protocol-relative URL in free text is left alone
4609 !! wikitext
4610 //example.com/Foo
4611 !! html
4612 <p>//example.com/Foo
4613 </p>
4614 !!end
4615
4616 !! test
4617 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4618 !! wikitext
4619 foo//example.com/Foo
4620 !! html
4621 <p>foo//example.com/Foo
4622 </p>
4623 !! end
4624
4625 !! test
4626 External links: with no contents
4627 !! wikitext
4628 [http://en.wikipedia.org/wiki/Foo]
4629
4630 [[wikipedia:Foo|Bar]]
4631
4632 [[wikipedia:Foo|<span>Bar</span>]]
4633 !! html/php
4634 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4635 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4636 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4637 </p>
4638 !! html/parsoid
4639 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4640 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4641 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4642 !! end
4643
4644 !! test
4645 External links: Free with trailing punctuation
4646 !! wikitext
4647 http://example.com,
4648 http://example.com;
4649 http://example.com\
4650 http://example.com.
4651 http://example.com:
4652 http://example.com!
4653 http://example.com?
4654 http://example.com)
4655 http://example.com/url_with_(brackets)
4656 (http://example.com/url_without_brackets)
4657 http://example.com/url_with_entity&amp;
4658 http://example.com/url_with_entity&#x26;
4659 http://example.com/url_with_entity&#038;
4660 http://example.com/url_with_entity&nbsp;
4661 http://example.com/url_with_entity&#xA0;
4662 http://example.com/url_with_entity&#160;
4663 http://example.com/url_with_entity&lt;
4664 http://example.com/url_with_entity&#x3C;
4665 http://example.com/url_with_entity&#60;
4666 !! html/php
4667 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4668 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4669 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4670 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4671 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4672 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4673 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4674 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4675 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4676 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4677 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4678 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4679 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4680 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4681 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4682 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4683 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4684 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4685 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4686 </p>
4687 !! html/parsoid
4688 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4689 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4690 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4691 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4692 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4693 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4694 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4695 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4696 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4697 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4698 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4699 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4700 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4701 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4702 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
4703 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
4704 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
4705 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
4706 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
4707 !! end
4708
4709 !! test
4710 External links: tricky Parsoid html2html case
4711 !! options
4712 parsoid=wt2html,wt2wt,html2html
4713 !! wikitext
4714 http://example.com/url_with_entity&amp;amp;
4715 !! html/php
4716 <p><a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;
4717 </p>
4718 !! html/parsoid
4719 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4720 !! end
4721
4722 !! test
4723 External links: Free with trailing quotes (T113666)
4724 !! wikitext
4725 '''News:''' Stuff here
4726
4727 news:'a'b''c''d e
4728 !! html/php
4729 <p><b>News:</b> Stuff here
4730 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4731 </p>
4732 !! html/parsoid
4733 <p><b>News:</b> Stuff here</p>
4734 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4735 !! end
4736
4737 !! test
4738 External links: Lone protocols are never linked (T105697)
4739 !! wikitext
4740 http://
4741 http://;
4742 (http://)
4743 bitcoin:
4744 bitcoin:;
4745 (bitcoin:)
4746 !! html
4747 <p>http://
4748 http://;
4749 (http://)
4750 bitcoin:
4751 bitcoin:;
4752 (bitcoin:)
4753 </p>
4754 !! end
4755
4756 !! test
4757 External links: No preceding word characters allowed (bug 65278)
4758 !! wikitext
4759 NOPEhttp://example.com
4760 N0http://example.com
4761 ok:http://example.com
4762 ok-http://example.com
4763 !! html
4764 <p>NOPEhttp://example.com
4765 N0http://example.com
4766 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4767 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4768 </p>
4769 !! end
4770
4771 !! test
4772 External image
4773 !! wikitext
4774 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4775 !! html
4776 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4777 </p>
4778 !! end
4779
4780 !! test
4781 External image from https
4782 !! wikitext
4783 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4784 !! html
4785 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4786 </p>
4787 !! end
4788
4789 !! test
4790 External image (when not allowed)
4791 !! options
4792 wgAllowExternalImages=0
4793 !! wikitext
4794 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4795 !! html
4796 <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>
4797 </p>
4798 !! end
4799
4800 !! test
4801 Link to non-http image, no img tag
4802 !! wikitext
4803 Link to non-http image, no img tag: ftp://example.com/test.jpg
4804 !! html
4805 <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>
4806 </p>
4807 !! end
4808
4809 !! test
4810 External links: terminating separator
4811 !! wikitext
4812 Terminating separator: http://example.com/thing,
4813 !! html
4814 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4815 </p>
4816 !! end
4817
4818 !! test
4819 External links: intervening separator
4820 !! wikitext
4821 Intervening separator: http://example.com/1,2,3
4822 !! html
4823 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4824 </p>
4825 !! end
4826
4827 !! test
4828 External links: old bug with URL in query
4829 !! wikitext
4830 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4831 !! html
4832 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4833 </p>
4834 !! end
4835
4836 !! test
4837 External links: old URL-in-URL bug, mixed protocols
4838 !! wikitext
4839 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4840 !! html
4841 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4842 </p>
4843 !!end
4844
4845 !! test
4846 External links: URL in text
4847 !! wikitext
4848 URL in text: [http://example.com http://example.com]
4849 !! html
4850 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4851 </p>
4852 !! end
4853
4854 !! test
4855 External links: Clickable images
4856 !! wikitext
4857 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4858 !! html/php
4859 <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>
4860 </p>
4861 !! html/parsoid
4862 <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>
4863 !! end
4864
4865 !! test
4866 External links: raw ampersand
4867 !! wikitext
4868 Old &amp; use: http://x&y
4869 !! html
4870 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4871 </p>
4872 !! end
4873
4874 !! test
4875 External links: encoded ampersand
4876 !! wikitext
4877 Old &amp; use: http://x&amp;y
4878 !! html/php
4879 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4880 </p>
4881 !! html/parsoid
4882 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4883 !! end
4884
4885 !! test
4886 External links: encoded equals (bug 6102)
4887 !! wikitext
4888 http://example.com/?foo&#61;bar
4889 !! html/php
4890 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4891 </p>
4892 !! html/parsoid
4893 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4894 !! end
4895
4896 ##
4897 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4898 ## does it number them. As discussed in bug 53505, we can identify
4899 ## autonumbered links via CSS.
4900 ##
4901
4902 !! test
4903 External links: [raw ampersand]
4904 !! wikitext
4905 Old &amp; use: [http://x&y]
4906 !! html/php
4907 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4908 </p>
4909 !! html/parsoid
4910 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4911 !! end
4912
4913 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4914 # mode will return the [raw ampersand] wikitext
4915 !! test
4916 External links: [encoded ampersand]
4917 !! options
4918 parsoid=wt2html,wt2wt,html2html
4919 !! wikitext
4920 Old &amp; use: [http://x&amp;y]
4921 !! html/php
4922 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4923 </p>
4924 !! html/parsoid
4925 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4926 !! end
4927
4928 !! test
4929 External links: [raw equals]
4930 !! wikitext
4931 [http://example.com/?foo=bar]
4932 !! html/php
4933 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4934 </p>
4935 !! html/parsoid
4936 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4937 !! end
4938
4939 # note that parsoid html is identical to [raw equals] case; so html2wt
4940 # mode will return the [raw equals] wikitext
4941 !! test
4942 External links: [encoded equals] (bug 6102)
4943 !! options
4944 parsoid=wt2html,wt2wt,html2html
4945 !! wikitext
4946 [http://example.com/?foo&#61;bar]
4947 !! html/php
4948 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4949 </p>
4950 !! html/parsoid
4951 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4952 !! end
4953
4954 # xxx parsoid strips the IDN character, so the round-trip tests will
4955 # obviously fail and are disabled. --cscott
4956 !! test
4957 External links: [IDN ignored character reference in hostname; strip it right off]
4958 !! options
4959 parsoid=wt2html,wt2wt,html2html
4960 !! wikitext
4961 [http://e&zwnj;xample.com/]
4962 !! html/php
4963 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4964 </p>
4965 !! html/parsoid
4966 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4967 !! end
4968
4969 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4970 # Where an external link could easily circumvent the sanitization of the text of
4971 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4972 # test demands a higher standard. That's a bit strange.
4973 #
4974 # Example:
4975 #
4976 # http://e‌xample.com -> [http://example.com|http://example.com]
4977 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4978 #
4979 # The first example is sanitized, but the second is not. Any security benefits
4980 # from this production are trivial to circumvent. Either remove this test and
4981 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4982 # the test accordingly.
4983 #
4984 # All our love,
4985 # The Parsoid team.
4986 # xxx parsoid strips the IDN character, so the round-trip tests will
4987 # obviously fail and are disabled. --cscott
4988 !! test
4989 External links: IDN ignored character reference in hostname; strip it right off
4990 !! options
4991 parsoid=wt2html,html2html
4992 !! wikitext
4993 http://e&zwnj;xample.com/
4994 !! html/php
4995 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4996 </p>
4997 !! html/parsoid
4998 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4999 !! end
5000
5001 !! test
5002 External links: www.jpeg.org (bug 554)
5003 !! wikitext
5004 http://www.jpeg.org
5005 !! html
5006 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5007 </p>
5008 !! end
5009
5010 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5011 !! test
5012 External links: URL within URL (original bug 2)
5013 !! wikitext
5014 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5015 !! html/php
5016 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5017 </p>
5018 !! html/parsoid
5019 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5020 !! end
5021
5022 !! test
5023 BUG 361: URL inside bracketed URL
5024 !! wikitext
5025 [http://www.example.com/foo http://www.example.com/bar]
5026 !! html
5027 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5028 </p>
5029 !! end
5030
5031 !! test
5032 BUG 361: URL within URL, not bracketed
5033 !! wikitext
5034 http://www.example.com/foo?=http://www.example.com/bar
5035 !! html
5036 <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>
5037 </p>
5038 !! end
5039
5040 !! test
5041 BUG 289: ">"-token in URL-tail
5042 !! wikitext
5043 http://www.example.com/<hello>
5044 !! html
5045 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5046 </p>
5047 !!end
5048
5049 !! test
5050 BUG 289: literal ">"-token in URL-tail
5051 !! wikitext
5052 http://www.example.com/<b>html</b>
5053 !! html/php
5054 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5055 </p>
5056 !! html/parsoid
5057 <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>
5058 !! end
5059
5060 !! test
5061 BUG 289: ">"-token in bracketed URL
5062 !! wikitext
5063 [http://www.example.com/<hello> stuff]
5064 !! html
5065 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5066 </p>
5067 !!end
5068
5069 !! test
5070 BUG 289: literal ">"-token in bracketed URL
5071 !! wikitext
5072 [http://www.example.com/<b>html</b> stuff]
5073 !! html
5074 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5075 </p>
5076 !!end
5077
5078 !! test
5079 BUG 289: literal double quote at end of URL
5080 !! wikitext
5081 http://www.example.com/"hello"
5082 !! html
5083 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5084 </p>
5085 !!end
5086
5087 !! test
5088 BUG 289: literal double quote in bracketed URL
5089 !! wikitext
5090 [http://www.example.com/"hello" stuff]
5091 !! html
5092 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5093 </p>
5094 !!end
5095
5096 !! test
5097 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5098 !! wikitext
5099 [http://www.example.com test]
5100 !! html
5101 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5102 </p>
5103 !! end
5104
5105 !! test
5106 External links: link text with spaces
5107 !! wikitext
5108 [http://www.example.com a b c]
5109 [http://www.example.com ''a'' ''b'']
5110 !! html
5111 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5112 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5113 </p>
5114 !! end
5115
5116 !! test
5117 External links: wiki links within external link (Bug 3695)
5118 !! options
5119 parsoid=wt2html,html2html
5120 !! wikitext
5121 [http://example.com [[wikilink]] embedded in ext link]
5122 !! html/php
5123 <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>
5124 </p>
5125 !! html/parsoid
5126 <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>
5127 !! end
5128
5129 !! test
5130 BUG 787: Links with one slash after the url protocol are invalid
5131 !! wikitext
5132 http:/example.com
5133
5134 [http:/example.com title]
5135 !! html
5136 <p>http:/example.com
5137 </p><p>[http:/example.com title]
5138 </p>
5139 !! end
5140
5141 !! test
5142 Bracketed external links with template-generated invalid target
5143 !! wikitext
5144 [{{echo|http:/example.com}} title]
5145 !! html
5146 <p>[http:/example.com title]
5147 </p>
5148 !! end
5149
5150 !! test
5151 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5152 !! wikitext
5153 ''[http://example.com text'']
5154 [http://example.com '''text]'''
5155 ''Something [http://example.com in italic'']
5156 ''Something [http://example.com mixed''''', even bold]'''
5157 '''''Now [http://example.com both''''']
5158 !! html
5159 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5160 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5161 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5162 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5163 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5164 </p>
5165 !! end
5166
5167
5168 !! test
5169 Bug 4781: %26 in URL
5170 !! wikitext
5171 http://www.example.com/?title=AT%26T
5172 !! html/php
5173 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5174 </p>
5175 !! html/parsoid
5176 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5177 !! end
5178
5179 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5180 # % is actually legal in HTML5. Any change in output would need testing though.
5181 !! test
5182 Bug 4781, 5267: %25 in URL
5183 !! wikitext
5184 http://www.example.com/?title=100%25_Bran
5185 !! html/php
5186 <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>
5187 </p>
5188 !! html/parsoid
5189 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5190 !! end
5191
5192 !! test
5193 Bug 4781, 5267: %28, %29 in URL
5194 !! wikitext
5195 http://www.example.com/?title=Ben-Hur_%281959_film%29
5196 !! html/php
5197 <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>
5198 </p>
5199 !! html/parsoid
5200 <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>
5201 !! end
5202
5203
5204 !! test
5205 Bug 4781: %26 in autonumber URL
5206 !! wikitext
5207 [http://www.example.com/?title=AT%26T]
5208 !! html/php
5209 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5210 </p>
5211 !! html/parsoid
5212 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5213 !! end
5214
5215 !! test
5216 Bug 4781, 5267: %26 in autonumber URL
5217 !! wikitext
5218 [http://www.example.com/?title=100%25_Bran]
5219 !! html/php
5220 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5221 </p>
5222 !! html/parsoid
5223 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5224 !! end
5225
5226 !! test
5227 Bug 4781, 5267: %28, %29 in autonumber URL
5228 !! wikitext
5229 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5230 !! html/php
5231 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5232 </p>
5233 !! html/parsoid
5234 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5235 !! end
5236
5237
5238 !! test
5239 Bug 4781: %26 in bracketed URL
5240 !! wikitext
5241 [http://www.example.com/?title=AT%26T link]
5242 !! html/php
5243 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5244 </p>
5245 !! html/parsoid
5246 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5247 !! end
5248
5249 !! test
5250 Bug 4781, 5267: %25 in bracketed URL
5251 !! wikitext
5252 [http://www.example.com/?title=100%25_Bran link]
5253 !! html
5254 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5255 </p>
5256 !! end
5257
5258 !! test
5259 Bug 4781, 5267: %28, %29 in bracketed URL
5260 !! wikitext
5261 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5262 !! html/php
5263 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5264 </p>
5265 !! html/parsoid
5266 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5267 !! end
5268
5269 !! test
5270 External link containing a period in the anchor. (bug 63947)
5271 !! wikitext
5272 [//foo.org/bar#baz. bang]
5273
5274 [//foo.org/bar. bang]
5275 !! html/php
5276 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5277 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5278 </p>
5279 !! html/parsoid
5280 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5281 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5282 !! end
5283
5284 !! test
5285 External link containing a single quote. (bug 63947)
5286 !! wikitext
5287 [//foo.org/bar'baz]
5288
5289 [//foo.org/bar'baz bang]
5290 !! html/php
5291 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5292 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5293 </p>
5294 !! html/parsoid
5295 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5296 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5297 !! end
5298
5299 !! test
5300 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5301 !! wikitext
5302 Some [http://example.com/ pretty ''italics'' and stuff]!
5303 !! html
5304 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5305 </p>
5306 !! end
5307
5308 !! test
5309 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5310 !! wikitext
5311 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5312 !! html
5313 <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>
5314 </p>
5315 !! end
5316
5317 !! test
5318 External link containing double-single-quotes with no space separating the url from text in italics
5319 !! wikitext
5320 [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]].]
5321 !! html/php
5322 <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>
5323 </p>
5324 !! html/php+tidy
5325 <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>
5326 !! html/parsoid
5327 <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>
5328 !! end
5329
5330 !! test
5331 External link with comments in link text
5332 !! wikitext
5333 [http://www.google.com Google <!-- comment -->]
5334 !! html/php
5335 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5336 </p>
5337 !! html/parsoid
5338 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5339 !! end
5340
5341 !! test
5342 External link to bare IPv4 address
5343 !! wikitext
5344 [http://192.168.0.1 Link]
5345 !! html/php
5346 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5347 </p>
5348 !! html/parsoid
5349 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5350 !! end
5351
5352 !! test
5353 URL-encoding in URL functions (single parameter)
5354 !! wikitext
5355 {{localurl:Some page|amp=&}}
5356 !! html
5357 <p>/index.php?title=Some_page&amp;amp=&amp;
5358 </p>
5359 !! end
5360
5361 !! test
5362 URL-encoding in URL functions (multiple parameters)
5363 !! wikitext
5364 {{localurl:Some page|q=?&amp=&}}
5365 !! html
5366 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5367 </p>
5368 !! end
5369
5370 !! test
5371 Brackets in urls
5372 !! wikitext
5373 http://example.com/index.php?foozoid%5B%5D=bar
5374
5375 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5376 !! html/php
5377 <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>
5378 </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>
5379 </p>
5380 !! html/parsoid
5381 <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>
5382
5383 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5384 !! end
5385
5386 !! test
5387 IPv6 urls, autolink format (T23261)
5388 !! wikitext
5389 http://[2404:130:0:1000::187:2]/index.php
5390
5391 Examples from RFC 2373, section 2.2:
5392 * http://[1080::8:800:200C:417A]/unicast
5393 * http://[FF01::101]/multicast
5394 * http://[::1]/loopback
5395 * http://[::]/unspecified
5396 * http://[::13.1.68.3]/ipv4compat
5397 * http://[::FFFF:129.144.52.38]/ipv4compat
5398
5399 Examples from RFC 2732, section 2:
5400 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5401 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5402 * http://[3ffe:2a00:100:7031::1]
5403 * http://[1080::8:800:200C:417A]/foo
5404 * http://[::192.9.5.5]/ipng
5405 * http://[::FFFF:129.144.52.38]:80/index.html
5406 * http://[2010:836B:4179::836B:4179]
5407
5408 !! html/php
5409 <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>
5410 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5411 </p>
5412 <ul><li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5413 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5414 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5415 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5416 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5417 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5418 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5419 </p>
5420 <ul><li> <a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5421 <li> <a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5422 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5423 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5424 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5425 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5426 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5427
5428 !! html/parsoid
5429 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5430
5431 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5432 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5433 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5434 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5435 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5436 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5437 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5438
5439 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5440 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5441 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5442 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5443 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5444 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5445 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5446 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5447 !! end
5448
5449 !! test
5450 IPv6 urls, bracketed format (T23261)
5451 !! wikitext
5452 [http://[2404:130:0:1000::187:2]/index.php test]
5453
5454 Examples from RFC 2373, section 2.2:
5455 * [http://[1080::8:800:200C:417A] unicast]
5456 * [http://[FF01::101] multicast]
5457 * [http://[::1]/ loopback]
5458 * [http://[::] unspecified]
5459 * [http://[::13.1.68.3] ipv4compat]
5460 * [http://[::FFFF:129.144.52.38] ipv4compat]
5461
5462 Examples from RFC 2732, section 2:
5463 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5464 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5465 * [http://[3ffe:2a00:100:7031::1] 3]
5466 * [http://[1080::8:800:200C:417A]/foo 4]
5467 * [http://[::192.9.5.5]/ipng 5]
5468 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5469 * [http://[2010:836B:4179::836B:4179] 7]
5470
5471 !! html/php
5472 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5473 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5474 </p>
5475 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5476 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5477 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5478 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5479 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5480 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5481 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5482 </p>
5483 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5484 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5485 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5486 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5487 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5488 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5489 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5490
5491 !! html/parsoid
5492 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5493
5494 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5495 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5496 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5497 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5498 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5499 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5500 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5501
5502 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5503 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5504 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5505 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5506 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5507 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5508 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5509 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5510 !! end
5511
5512 !! test
5513 Non-extlinks in brackets
5514 !! wikitext
5515 [foo]
5516 [foo bar]
5517 [foo ''bar'']
5518 [fool's] errand
5519 [fool's errand]
5520 [{{echo|foo}}]
5521 [{{echo|foo}} bar]
5522 [{{echo|foo}} ''bar'']
5523 [{{echo|foo}}l's] errand
5524 [{{echo|foo}}l's errand]
5525 [url={{echo|foo}}]
5526 [url=http://example.com]
5527 [http:// bare protocols don't count]
5528 !! html/php
5529 <p>[foo]
5530 [foo bar]
5531 [foo <i>bar</i>]
5532 [fool's] errand
5533 [fool's errand]
5534 [foo]
5535 [foo bar]
5536 [foo <i>bar</i>]
5537 [fool's] errand
5538 [fool's errand]
5539 [url=foo]
5540 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5541 [http:// bare protocols don't count]
5542 </p>
5543 !! html/parsoid
5544 <p>[foo]
5545 [foo bar]
5546 [foo <i>bar</i>]
5547 [fool's] errand
5548 [fool's errand]
5549 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5550 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5551 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5552 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5553 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5554 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5555 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5556 [http:// bare protocols don't count]</p>
5557 !! end
5558
5559 !! test
5560 Percent encoding in external links
5561 !! wikitext
5562 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5563 !! html/php
5564 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5565 </p>
5566 !! html/parsoid
5567 <p><a rel="mw:ExtLink"
5568 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5569 !! end
5570
5571 !! test
5572 Use url link syntax for links where the content is equal the link target
5573 !! wikitext
5574 http://example.com
5575 !! html/php
5576 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5577 </p>
5578 !! html/parsoid
5579 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5580 !! end
5581
5582 !! test
5583 Parenthesis in external links, especially URL links
5584 !! wikitext
5585 http://example.com)
5586
5587 http://example.com/test)
5588
5589 http://example.com/(test)
5590
5591 http://example.com/((test)
5592
5593 (http://example.com/(test))
5594
5595 (http://example.com/(test)))))
5596
5597 http://example.com/a)b
5598
5599 [http://example.com) foo]
5600 !! html/php
5601 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5602 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5603 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5604 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5605 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5606 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5607 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5608 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5609 </p>
5610 !! html/parsoid
5611 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5612 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5613 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5614 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5615 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5616 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5617 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5618 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5619 !! end
5620
5621 !! test
5622 Parenthesis in external links, w/ transclusion or comment
5623 !! wikitext
5624 (http://example.com/{{echo|hi}})
5625
5626 (http://example.com<!-- hi -->)
5627 !! html/php
5628 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5629 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5630 </p>
5631 !! html/parsoid
5632 <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>
5633
5634 <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>
5635 !! end
5636
5637 !! test
5638 Serialize <a> tags with invalid link targets as plain text
5639 !! options
5640 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5641 !! html/parsoid
5642 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5643 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5644 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5645 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5646 !! wikitext
5647 text
5648 <nowiki>*</nowiki>text
5649 <nowiki>[[foo]]</nowiki>
5650 <nowiki>*a [[foo]]</nowiki>
5651 !! end
5652
5653 !! test
5654 mw:ExtLink -vs- mw:WikiLink (T94723)
5655 !! options
5656 parsoid=html2wt
5657 !! html/parsoid
5658 <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>
5659 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5660 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5661 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5662 <p>
5663 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5664 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5665 </p>
5666 !! wikitext
5667 [[Foo|Bar]]
5668 [[Foo|Bar]]
5669 [[wikipedia:Foo|Bar]]
5670 [[wikipedia:Foo|Bar]]
5671
5672 [[wikipedia:European_Robin|European Robin]]
5673 [[wikipedia:European_Robin|European Robin]]
5674 !! end
5675
5676 !! test
5677 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5678 !! options
5679 parsoid=wt2wt
5680 !! wikitext
5681 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5682 !! html/parsoid
5683 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5684 !! end
5685
5686
5687 ###
5688 ### Quotes
5689 ###
5690
5691 !! test
5692 Quotes
5693 !! wikitext
5694 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5695
5696 Normal text. '''''Bold italic text.''''' Normal text.
5697 !! html
5698 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5699 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5700 </p>
5701 !! end
5702
5703
5704 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5705 # parser strips. The wikitext contains just the first half of the bold
5706 # quote pair.
5707 !! test
5708 Unclosed and unmatched quotes
5709 !! wikitext
5710 '''''Bold italic text '''with bold deactivated''' in between.'''''
5711
5712 '''''Bold italic text ''with italic deactivated'' in between.'''''
5713
5714 '''Bold text..
5715
5716 ..spanning two paragraphs (should not work).'''
5717
5718 '''Bold tag left open
5719
5720 ''Italic tag left open
5721
5722 Normal text.
5723
5724 <!-- Unmatching number of opening, closing tags: -->
5725 '''This year''''s election ''should'' beat '''last year''''s.
5726
5727 ''Tom'''s car is bigger than ''Susan'''s.
5728
5729 Plain ''italic'''s plain
5730 !! html/php
5731 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5732 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5733 </p><p><b>Bold text..</b>
5734 </p><p>..spanning two paragraphs (should not work).
5735 </p><p><b>Bold tag left open</b>
5736 </p><p><i>Italic tag left open</i>
5737 </p><p>Normal text.
5738 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5739 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5740 </p><p>Plain <i>italic'</i>s plain
5741 </p>
5742 !! html/parsoid
5743 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5744 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5745 </p><p><b>Bold text..</b>
5746 </p><p>..spanning two paragraphs (should not work).<b></b>
5747 </p><p><b>Bold tag left open</b>
5748 </p><p><i>Italic tag left open</i>
5749 </p><p>Normal text.
5750 </p>
5751 <!-- Unmatching number of opening, closing tags: -->
5752 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5753 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5754 </p><p>Plain <i>italic'</i>s plain
5755 </p>
5756 !! end
5757
5758 ###
5759 ### Tables
5760 ###
5761 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5762 ###
5763
5764 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5765 # is the bare minimum required by the spec, see:
5766 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5767 # Parsoid team replies: empty table tags are legal in HTML5
5768 !! test
5769 A table with no data.
5770 !! options
5771 parsoid=wt2html
5772 !! wikitext
5773 {||}
5774 !! html/php
5775
5776 !! html/parsoid
5777 <table></table>
5778
5779 !! end
5780
5781 !! test
5782 A table with stray table end tags on start tag line (wt2html)
5783 !! options
5784 parsoid=wt2html
5785 !! wikitext
5786 {|style="color: red;"|}
5787
5788 {|style="color: red;" |}
5789 |foo
5790 |}
5791
5792 {|style="color: red;"|} id="foo"
5793 |foo
5794 |}
5795
5796 {|style="color: red;" |} id="foo"
5797 |foo
5798 |}
5799 !! html
5800 <table style="color: red;"></table>
5801
5802 <table style="color: red;">
5803 <tbody><tr>
5804 <td>foo</td>
5805 </tr></tbody>
5806 </table>
5807
5808 <table style="color: red;" id="foo">
5809 <tbody><tr>
5810 <td>foo</td>
5811 </tr></tbody>
5812 </table>
5813
5814 <table style="color: red;" id="foo">
5815 <tbody><tr>
5816 <td>foo</td>
5817 </tr></tbody>
5818 </table>
5819
5820 !! end
5821
5822 !! test
5823 A table with no data (take 2)
5824 !! wikitext
5825 {|
5826 |}
5827 !! html/parsoid
5828 <table></table>
5829 !! end
5830
5831 # A table with nothing but a caption is invalid XHTML, we might want to render
5832 # this as <p>caption</p>
5833 # Parsoid team replies: table with only a caption is legal in HTML5
5834 !! test
5835 A table with nothing but a caption
5836 !! wikitext
5837 {|
5838 |+ caption
5839 |}
5840 !! html/php
5841 <table>
5842 <caption> caption
5843 </caption><tr><td></td></tr></table>
5844
5845 !! html/parsoid
5846 <table><caption> caption</caption></table>
5847 !! end
5848
5849 !! test
5850 A table with caption with default-spaced attributes and a table row
5851 !! wikitext
5852 {|
5853 |+ style="color: red;" | caption1
5854 |-
5855 | foo
5856 |}
5857 !! html
5858 <table>
5859 <caption style="color: red;"> caption1
5860 </caption>
5861 <tr>
5862 <td> foo
5863 </td></tr></table>
5864
5865 !! end
5866
5867 !! test
5868 A table with captions with non-default spaced attributes and a table row
5869 !! wikitext
5870 {|
5871 |+style="color: red;"|caption2
5872 |+ style="color: red;"| caption3
5873 |-
5874 | foo
5875 |}
5876 !! html
5877 <table>
5878 <caption style="color: red;">caption2
5879 </caption>
5880 <caption style="color: red;"> caption3
5881 </caption>
5882 <tr>
5883 <td> foo
5884 </td></tr></table>
5885
5886 !! end
5887
5888 !! test
5889 Table td-cell syntax variations
5890 !! wikitext
5891 {|
5892 | foo bar foo | baz
5893 | foo bar foo || baz
5894 | style='color:red;' | baz
5895 | style='color:red;' || baz
5896 |}
5897 !! html
5898 <table>
5899 <tr>
5900 <td> baz
5901 </td>
5902 <td> foo bar foo </td>
5903 <td> baz
5904 </td>
5905 <td style="color:red;"> baz
5906 </td>
5907 <td> style='color:red;' </td>
5908 <td> baz
5909 </td></tr></table>
5910
5911 !! end
5912
5913 !! test
5914 Simple table
5915 !! wikitext
5916 {|
5917 | 1 || 2
5918 |-
5919 | 3 || 4
5920 |}
5921 !! html
5922 <table>
5923 <tr>
5924 <td> 1 </td>
5925 <td> 2
5926 </td></tr>
5927 <tr>
5928 <td> 3 </td>
5929 <td> 4
5930 </td></tr></table>
5931
5932 !! end
5933
5934 !! test
5935 Simple table but with multiple dashes for row wikitext
5936 !! wikitext
5937 {|
5938 | foo
5939 |-----
5940 | bar
5941 |}
5942 !! html
5943 <table>
5944 <tr>
5945 <td> foo
5946 </td></tr>
5947 <tr>
5948 <td> bar
5949 </td></tr></table>
5950
5951 !! end
5952
5953 !! test
5954 Multiplication table
5955 !! wikitext
5956 {| border="1" cellpadding="2"
5957 |+Multiplication table
5958 |-
5959 ! &times; !! 1 !! 2 !! 3
5960 |-
5961 ! 1
5962 | 1 || 2 || 3
5963 |-
5964 ! 2
5965 | 2 || 4 || 6
5966 |-
5967 ! 3
5968 | 3 || 6 || 9
5969 |-
5970 ! 4
5971 | 4 || 8 || 12
5972 |-
5973 ! 5
5974 | 5 || 10 || 15
5975 |}
5976 !! html
5977 <table border="1" cellpadding="2">
5978 <caption>Multiplication table
5979 </caption>
5980 <tr>
5981 <th> &#215; </th>
5982 <th> 1 </th>
5983 <th> 2 </th>
5984 <th> 3
5985 </th></tr>
5986 <tr>
5987 <th> 1
5988 </th>
5989 <td> 1 </td>
5990 <td> 2 </td>
5991 <td> 3
5992 </td></tr>
5993 <tr>
5994 <th> 2
5995 </th>
5996 <td> 2 </td>
5997 <td> 4 </td>
5998 <td> 6
5999 </td></tr>
6000 <tr>
6001 <th> 3
6002 </th>
6003 <td> 3 </td>
6004 <td> 6 </td>
6005 <td> 9
6006 </td></tr>
6007 <tr>
6008 <th> 4
6009 </th>
6010 <td> 4 </td>
6011 <td> 8 </td>
6012 <td> 12
6013 </td></tr>
6014 <tr>
6015 <th> 5
6016 </th>
6017 <td> 5 </td>
6018 <td> 10 </td>
6019 <td> 15
6020 </td></tr></table>
6021
6022 !! end
6023
6024 !! test
6025 Accept "||" in table headings
6026 !! wikitext
6027 {|
6028 !h1 || h2
6029 |}
6030 !! html
6031 <table>
6032 <tr>
6033 <th>h1 </th>
6034 <th> h2
6035 </th></tr></table>
6036
6037 !! end
6038
6039 !! test
6040 Accept "!!" in table data
6041 !! wikitext
6042 {|
6043 | Foo!! ||
6044 |}
6045 !! html
6046 <table>
6047 <tr>
6048 <td> Foo!! </td>
6049 <td>
6050 </td></tr></table>
6051
6052 !! html/parsoid
6053 <table>
6054 <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>
6055 </tbody></table>
6056 !! end
6057
6058 !! test
6059 Accept "||" in indented table headings
6060 !! wikitext
6061 :{|
6062 !h1 || h2
6063 |}
6064 !! html
6065 <dl><dd><table>
6066 <tr>
6067 <th>h1 </th>
6068 <th> h2
6069 </th></tr></table></dd></dl>
6070
6071 !! end
6072
6073 !! test
6074 Accept "!!" in templates
6075 !! wikitext
6076 {|
6077 !a {{echo|b!!c}}
6078 |}
6079 !! html/php
6080 <table>
6081 <tr>
6082 <th>a b</th>
6083 <th>c
6084 </th></tr></table>
6085
6086 !! html/parsoid
6087 <table>
6088 <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>
6089 !! end
6090
6091 !! test
6092 Accept "!!" in table headings after newline
6093 !! wikitext
6094 {|
6095 !a
6096 b!!c
6097 |}
6098 !! html/php
6099 <table>
6100 <tr>
6101 <th>a
6102 <p>b!!c
6103 </p>
6104 </th></tr></table>
6105
6106 !! html/parsoid
6107 <table>
6108 <tbody><tr><th>a
6109 <p>b!!c</p></th></tr>
6110 </tbody></table>
6111 !! end
6112
6113 !! test
6114 Accept "!!" in table data of mixed wikitext / html syntax
6115 !! wikitext
6116 {|
6117 !a
6118 <tr><td>b!!c</td></tr>
6119 |}
6120 !! html+tidy
6121 <table>
6122 <tr>
6123 <th>a</th>
6124 </tr>
6125 <tr>
6126 <td>b!!c</td>
6127 </tr>
6128 </table>
6129 !! html/parsoid
6130 <table>
6131 <tbody><tr><th>a</th></tr>
6132 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6133 </tbody></table>
6134 !! end
6135
6136 !! test
6137 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6138 !! wikitext
6139 {|
6140 !| h1
6141 || a
6142 |}
6143 !! html
6144 <table>
6145 <tr>
6146 <th> h1
6147 </th>
6148 <td> a
6149 </td></tr></table>
6150
6151 !! end
6152
6153 !!test
6154 Accept "| !" at start of line in tables (ignore !-attribute)
6155 !! wikitext
6156 {|
6157 |-
6158 | !style="color:red" | bar
6159 |}
6160 !! html
6161 <table>
6162
6163 <tr>
6164 <td> bar
6165 </td></tr></table>
6166
6167 !!end
6168
6169 !!test
6170 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 +/-
6171 !! wikitext
6172 {|
6173 |-
6174 |style='color:red;'|+1
6175 |style='color:blue;'|-1
6176 |-
6177 | 1 || 2 || 3
6178 | 1 ||+2 ||-3
6179 |-
6180 | +1
6181 | -1
6182 |}
6183 !! html
6184 <table>
6185
6186 <tr>
6187 <td style="color:red;">+1
6188 </td>
6189 <td style="color:blue;">-1
6190 </td></tr>
6191 <tr>
6192 <td> 1 </td>
6193 <td> 2 </td>
6194 <td> 3
6195 </td>
6196 <td> 1 </td>
6197 <td>+2 </td>
6198 <td>-3
6199 </td></tr>
6200 <tr>
6201 <td> +1
6202 </td>
6203 <td> -1
6204 </td></tr></table>
6205
6206 !!end
6207
6208 !! test
6209 Table rowspan
6210 !! wikitext
6211 {| border=1
6212 | Cell 1, row 1
6213 |rowspan=2| Cell 2, row 1 (and 2)
6214 | Cell 3, row 1
6215 |-
6216 | Cell 1, row 2
6217 | Cell 3, row 2
6218 |}
6219 !! html
6220 <table border="1">
6221 <tr>
6222 <td> Cell 1, row 1
6223 </td>
6224 <td rowspan="2"> Cell 2, row 1 (and 2)
6225 </td>
6226 <td> Cell 3, row 1
6227 </td></tr>
6228 <tr>
6229 <td> Cell 1, row 2
6230 </td>
6231 <td> Cell 3, row 2
6232 </td></tr></table>
6233
6234 !! end
6235
6236 !! test
6237 Nested table
6238 !! wikitext
6239 {| border=1
6240 | &alpha;
6241 |
6242 {| bgcolor=#ABCDEF border=2
6243 |nested
6244 |-
6245 |table
6246 |}
6247 |the original table again
6248 |}
6249 !! html
6250 <table border="1">
6251 <tr>
6252 <td> &#945;
6253 </td>
6254 <td>
6255 <table bgcolor="#ABCDEF" border="2">
6256 <tr>
6257 <td>nested
6258 </td></tr>
6259 <tr>
6260 <td>table
6261 </td></tr></table>
6262 </td>
6263 <td>the original table again
6264 </td></tr></table>
6265
6266 !! end
6267
6268 !! test
6269 Invalid attributes in table cell (bug 1830)
6270 !! wikitext
6271 {|
6272 |Cell:|broken
6273 |}
6274 !! html
6275 <table>
6276 <tr>
6277 <td>broken
6278 </td></tr></table>
6279
6280 !! end
6281
6282 !! test
6283 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6284 !! wikitext
6285 {|
6286 | title="foo" |bar
6287 | title="foo<nowiki>|</nowiki>" |bar
6288 | title="foo<nowiki>|</nowiki>" bar
6289 |}
6290 !! html/php
6291 <table>
6292 <tr>
6293 <td title="foo">bar
6294 </td>
6295 <td title="foo&#124;">bar
6296 </td>
6297 <td> title="foo|" bar
6298 </td></tr></table>
6299
6300 !! html/parsoid
6301 <table>
6302 <tbody><tr><td title="foo">bar</td>
6303 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6304 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6305 </tbody></table>
6306 !! end
6307
6308 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6309 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6310 # *2wt modes will fail.
6311 !! test
6312 Table security: embedded pipes
6313 !! options
6314 parsoid=wt2html,html2html
6315 !! wikitext
6316 {|
6317 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6318 !! html/php
6319 <table>
6320 <tr>
6321 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6322 <td>]" onmouseover="alert(document.cookie)"&gt;test
6323 </td>
6324 </tr>
6325 </table>
6326
6327 !! html/parsoid
6328 <table><tbody>
6329 <tr>
6330 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6331 !! end
6332
6333 !! test
6334 ! and || in element attributes should not be parsed as <th>/<td>
6335 !! wikitext
6336 {|
6337 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6338 |}
6339 !! html/php
6340 <table>
6341 <tr>
6342 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6343 </td></tr></table>
6344
6345 !! html/parsoid
6346 <table>
6347 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6348 </tbody></table>
6349 !! end
6350
6351 # FIXME: The output seems broken. Filed as T110268.
6352 !! test
6353 ! and || in td attributes should not be parsed as <th>/<td>
6354 !! options
6355 parsoid=wt2html
6356 !! wikitext
6357 {|
6358 | style="color: red !important;" data-contrived="put this here ||" | foo
6359 |}
6360 !! html/php
6361 <table>
6362 <tr>
6363 <td> style="color: red !important;" data-contrived="put this here </td>
6364 <td> foo
6365 </td></tr></table>
6366
6367 !! html/parsoid
6368 <table>
6369 <tbody><tr><td> style="color: red !important;" data-contrived="put this here </td><td data-parsoid='{"stx_v":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'> foo</td></tr>
6370 </tbody></table>
6371 !! end
6372
6373 !! test
6374 Indented table markup mixed with indented pre content (proposed in bug 6200)
6375 !! wikitext
6376 <table>
6377 <tr>
6378 <td>
6379 Text that should be rendered preformatted
6380 </td>
6381 </tr>
6382 </table>
6383 !! html
6384 <table>
6385 <tr>
6386 <td>
6387 <pre>Text that should be rendered preformatted
6388 </pre>
6389 </td>
6390 </tr>
6391 </table>
6392
6393 !! end
6394
6395 !! test
6396 1. Template-generated table cell attributes and cell content
6397 !! wikitext
6398 {|
6399 |{{table_attribs}}
6400 | {{table_attribs}}
6401 || {{table_attribs_5}}
6402 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6403 |align=center {{table_attribs}}
6404 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6405 |}
6406 !! html
6407 <table>
6408 <tr>
6409 <td style="color:red;">Foo
6410 </td>
6411 <td style="color:red;">Foo
6412 </td>
6413 <td> style="color:red;"</td>
6414 <td>Bar
6415 </td>
6416 <td style="color:red;">Foo
6417 </td>
6418 <td align="center" style="color:red;">Foo
6419 </td>
6420 <td align="center" style="color:red;">Foo
6421 </td></tr></table>
6422
6423 !! end
6424
6425 !! test
6426 2. Template-generated table cell attributes and cell content
6427 !! wikitext
6428 {|
6429 |{{table_attribs_2}}
6430 |}
6431 !! html/php
6432 <table>
6433 <tr>
6434 <td style="color:red;">Foo
6435 </td>
6436 <td>Bar</td>
6437 <td>Baz
6438 </td></tr></table>
6439
6440 !! html/parsoid
6441 <table>
6442 <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>
6443 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6444 </tbody></table>
6445 !! end
6446
6447 !! test
6448 3. Template-generated table cell attributes and cell content
6449 !! wikitext
6450 {|
6451 !align=center {{table_header_cells}}
6452 |-
6453 |align=center {{table_cells}}
6454 |}
6455 !! html/php
6456 <table>
6457 <tr>
6458 <th align="center" style="color:red;">Foo</th>
6459 <th style="color:red;"><i>Bar</i></th>
6460 <th style="color:brown;"><i>Foo</i> and Baz
6461 </th></tr>
6462 <tr>
6463 <td align="center" style="color:red;">Foo</td>
6464 <td style="color:red;"><i>Bar</i></td>
6465 <td style="color:brown;"><i>Foo</i> and Baz
6466 </td></tr></table>
6467
6468 !! html/parsoid
6469 <table>
6470 <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>
6471 <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>
6472 </tbody></table>
6473 !! end
6474
6475 !! test
6476 4. Template-generated table cell attributes and cell content inside a templated table
6477 !! wikitext
6478 {{tbl-start}}
6479 !align=center {{table_header_cells}}
6480 |-
6481 |align=center {{table_cells}}
6482 {{tbl-end}}
6483 !! html/php
6484 <table>
6485 <tr>
6486 <th align="center" style="color:red;">Foo</th>
6487 <th style="color:red;"><i>Bar</i></th>
6488 <th style="color:brown;"><i>Foo</i> and Baz
6489 </th></tr>
6490 <tr>
6491 <td align="center" style="color:red;">Foo</td>
6492 <td style="color:red;"><i>Bar</i></td>
6493 <td style="color:brown;"><i>Foo</i> and Baz
6494 </td></tr></table>
6495
6496 !! html/parsoid
6497 <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}}]}'>
6498 <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>
6499 <tr>
6500 <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>
6501 </tbody></table>
6502 !! end
6503
6504 ## Edge case fix to prevent future regressions
6505 !! test
6506 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6507 !! wikitext
6508 {|
6509 |{{table_attribs_7}}
6510 |}
6511 <references />
6512 !! html/parsoid
6513 <table>
6514 <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>
6515 </tbody></table>
6516 <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>
6517 !! end
6518
6519 !! test
6520 Table with row followed by newlines and table heading
6521 !! wikitext
6522 {|
6523 |-
6524
6525 ! foo
6526 |}
6527 !! html
6528 <table>
6529
6530
6531 <tr>
6532 <th> foo
6533 </th></tr></table>
6534
6535 !! end
6536
6537 !! test
6538 Table with empty line following the start tag
6539 !! wikitext
6540 {|
6541
6542 |-
6543 | foo
6544 |}
6545 !! html
6546 <table>
6547
6548
6549 <tr>
6550 <td> foo
6551 </td></tr></table>
6552
6553 !! end
6554
6555 !! test
6556 Table attributes with empty value
6557 !! wikitext
6558 {|
6559 | style=| hello
6560 |}
6561 !! html/php
6562 <table>
6563 <tr>
6564 <td style=""> hello
6565 </td></tr></table>
6566
6567 !! html/parsoid
6568 <table>
6569 <tbody>
6570 <tr>
6571 <td style=""> hello
6572 </td></tr></tbody></table>
6573
6574 !! end
6575
6576 !! test
6577 Wikitext table with a lot of comments
6578 !! wikitext
6579 {|
6580 <!-- c0 -->
6581 | foo
6582 <!-- c1 -->
6583 |-<!-- c2 -->
6584 <!-- c3 -->
6585 |<!-- c4 -->
6586 <!-- c5 -->
6587 |}
6588 !! html
6589 <table>
6590 <tr>
6591 <td> foo
6592 </td></tr>
6593 <tr>
6594 <td>
6595 </td></tr></table>
6596
6597 !! end
6598
6599 !! test
6600 Wikitext table comments represented in parsoid dom
6601 !! wikitext
6602 {|<!--c1--><!--c2-->
6603 |-<!--c3-->
6604 | x
6605 |}
6606 !! html/php+tidy
6607 <table>
6608 <tr>
6609 <td>x</td>
6610 </tr>
6611 </table>
6612 !! html/parsoid
6613 <table><!--c1--><!--c2-->
6614 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6615 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6616 </tbody></table>
6617 !! end
6618
6619 !! test
6620 Wikitext table with double-line table cell
6621 !! wikitext
6622 {|
6623 |a
6624 b
6625 |}
6626 !! html
6627 <table>
6628 <tr>
6629 <td>a
6630 <p>b
6631 </p>
6632 </td></tr></table>
6633
6634 !! end
6635
6636 !! test
6637 Table cell with a single comment
6638 !! wikitext
6639 {|
6640 | <!-- c1 -->
6641 | a
6642 |}
6643 !! html
6644 <table>
6645 <tr>
6646 <td>
6647 </td>
6648 <td> a
6649 </td></tr></table>
6650
6651 !! end
6652
6653 !! test
6654 Table-cell after a comment-only-empty-line
6655 !! wikitext
6656 {|
6657 |a
6658 <!--c1-->
6659 <!--c2-->| b
6660 |}
6661 !! html
6662 <table>
6663 <tr>
6664 <td>a
6665 </td>
6666 <td> b
6667 </td></tr></table>
6668
6669 !! html/parsoid
6670 <table>
6671 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6672 <!--c1-->
6673 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6674 </tbody></table>
6675
6676 !! end
6677
6678 !! test
6679 Build table with {{!}}
6680 !! wikitext
6681 {{{!}} class="wikitable"
6682 ! header
6683 ! second header
6684 {{!}}- style="color:red;"
6685 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6686 {{!}}}
6687 !! html
6688 <table class="wikitable">
6689 <tr>
6690 <th> header
6691 </th>
6692 <th> second header
6693 </th></tr>
6694 <tr style="color:red;">
6695 <td> data </td>
6696 <td style="color:red;"> second data
6697 </td></tr></table>
6698
6699 !! end
6700
6701 !! test
6702 Build table with pipe as data
6703 !! wikitext
6704 {| class="wikitable"
6705 ! header
6706 ! second header
6707 |- style="color:red;"
6708 | data || style="color:red;" | second data
6709 |-
6710 | style="color:red;" | data with | || style="color:red;" | second data with |
6711 |-
6712 || data with | ||| second data with |
6713 |}
6714 !! html
6715 <table class="wikitable">
6716 <tr>
6717 <th> header
6718 </th>
6719 <th> second header
6720 </th></tr>
6721 <tr style="color:red;">
6722 <td> data </td>
6723 <td style="color:red;"> second data
6724 </td></tr>
6725 <tr>
6726 <td style="color:red;"> data with | </td>
6727 <td style="color:red;"> second data with |
6728 </td></tr>
6729 <tr>
6730 <td> data with | </td>
6731 <td> second data with |
6732 </td></tr></table>
6733
6734 !! end
6735
6736 !! test
6737 Build table with wikilink
6738 !! wikitext
6739 {| class="wikitable"
6740 ! header || second header
6741 |- style="color:red;"
6742 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6743 |-
6744 | data || second data [[Main Page|link|text with pipe]]
6745 |}
6746 !! html
6747 <table class="wikitable">
6748 <tr>
6749 <th> header </th>
6750 <th> second header
6751 </th></tr>
6752 <tr style="color:red;">
6753 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6754 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6755 </td></tr>
6756 <tr>
6757 <td> data </td>
6758 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6759 </td></tr></table>
6760
6761 !! end
6762
6763 # The expected HTML structure in this test is debatable. The PHP parser does
6764 # not parse this kind of table at all. The main focus for Parsoid is on
6765 # round-tripping, so this output is ok for now. TODO: revisit!
6766 !! test
6767 Wikitext table with html-syntax row
6768 !! wikitext
6769 {|
6770 |-
6771 <td>foo</td>
6772 |}
6773 !! html/parsoid
6774 <table>
6775 <tbody>
6776 <tr>
6777 <td>foo</td></tr></tbody></table>
6778 !! end
6779
6780 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6781 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6782 ## PHP parser, which tidy then compounds by fostering the content
6783 ## entirely out of the table. Parsoid recognizes the table context
6784 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6785 ## depends on PHP's treatment of broken table markup!
6786 !! test
6787 Implicit <td> after a |-
6788 !! options
6789 parsoid=wt2html,html2html
6790 !! wikitext
6791 {|
6792 |-
6793 a
6794 |}
6795 !! html/php
6796 <table>
6797
6798 a
6799 </table>
6800
6801 !! html/php+tidy
6802 <p>a</p>
6803 !! html/parsoid
6804 <table>
6805 <tr><td>a</td></tr>
6806 </table>
6807 !! end
6808
6809 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6810 !! test
6811 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6812 !! options
6813 parsoid=wt2html,html2html
6814 !! wikitext
6815 {|
6816 |-
6817 |
6818 a
6819 |-
6820 b
6821 |}
6822 !! html/php
6823 <table>
6824
6825 <tr>
6826 <td>
6827 <pre>a
6828 </pre>
6829 </td></tr>
6830 b
6831 </table>
6832
6833 !! html/php+tidy
6834 <p>b</p>
6835 <table>
6836 <tr>
6837 <td>
6838 <pre>
6839 a
6840 </pre></td>
6841 </tr>
6842 </table>
6843 !! html/parsoid
6844 <table>
6845 <tbody>
6846 <tr><td><pre>a</pre></td></tr>
6847 <tr><td> b</td></tr>
6848 </tbody>
6849 </table>
6850 !! end
6851
6852 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6853 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6854 !! test
6855 Lists should be recognized in an implicit <td> context
6856 !! options
6857 parsoid=wt2html,html2html
6858 !! wikitext
6859 {|
6860 |-
6861 *a
6862 |}
6863 !! html/php
6864 <table>
6865
6866 <ul><li>a</li></ul>
6867 </table>
6868
6869 !! html/php+tidy
6870 <ul>
6871 <li>a</li>
6872 </ul>
6873 !! html/parsoid
6874 <table>
6875 <tr>
6876 <td><ul>
6877 <li>a</li>
6878 </ul></td>
6879 </tr>
6880 </table>
6881 !! end
6882
6883 !! test
6884 Table cells not properly parsed in an implicit-td context
6885 !! wikitext
6886 {|
6887 |-
6888 {{table_attribs_4}} || a || b
6889 |}
6890 !! html/php+tidy
6891 <table>
6892 <tr>
6893 <td style="background-color:#DC241f;" width="10px"></td>
6894 <td>a</td>
6895 <td>b</td>
6896 </tr>
6897 </table>
6898 !! html/parsoid
6899 <table>
6900 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6901 <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>
6902 </tbody></table>
6903 !! end
6904
6905 !! test
6906 Parsoid: Round-trip tables directly followed by content (bug 51219)
6907 !! options
6908 parsoid=wt2html,wt2wt
6909 !! wikitext
6910 {|
6911 |foo
6912 |} bar
6913
6914 {|
6915 |baz
6916 |}<b>quux</b>
6917 !! html+tidy
6918 <table>
6919 <tr>
6920 <td>foo</td>
6921 </tr>
6922 </table>
6923 <p>bar</p>
6924 <table>
6925 <tr>
6926 <td>baz</td>
6927 </tr>
6928 </table>
6929 <p><b>quux</b></p>
6930 !! end
6931
6932 !! test
6933 Parsoid: Default to a newline after tables in new content (bug 51219)
6934 !! options
6935 parsoid=html2wt
6936 !! html/parsoid
6937 <table><tbody>
6938 <tr><td>foo</td></tr></tbody></table> bar
6939 <table><tbody>
6940 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6941 !! wikitext
6942 {|
6943 |foo
6944 |}
6945 <nowiki> </nowiki>bar
6946 {|
6947 |baz
6948 |}
6949 '''quux'''
6950 !! end
6951
6952 !! test
6953 Parsoid: newline inducing block nodes don't suppress <nowiki>
6954 !! options
6955 parsoid=html2wt
6956 !! html/parsoid
6957 a<h1>foo</h1>
6958 !! wikitext
6959 <nowiki> </nowiki>a
6960
6961 = foo =
6962 !! end
6963
6964 !! test
6965 Parsoid: Row-syntax table headings followed by comment & table cells
6966 !! options
6967 parsoid=wt2html,wt2wt
6968 !! wikitext
6969 {|
6970 ! foo || bar
6971 <!-- foo --> || baz || quux
6972 |}
6973 !! html/php
6974 <table>
6975 <tr>
6976 <th> foo </th>
6977 <th> bar
6978 </th>
6979 <td> baz </td>
6980 <td> quux
6981 </td></tr></table>
6982
6983 !! html/parsoid
6984 <table>
6985 <tbody><tr><th> foo </th><th> bar
6986 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6987 </tbody></table>
6988 !! end
6989
6990 !!test
6991 Parsoid: Recover better from broken table attributes
6992 !!options
6993 parsoid=wt2html
6994 !!wikitext
6995 {| class="foo
6996 | class="bar" |
6997 foo
6998 |}
6999 !!html/php+tidy
7000 <table class="foo">
7001 <tr>
7002 <td class="bar">
7003 <p>foo</p>
7004 </td>
7005 </tr>
7006 </table>
7007 !!html/parsoid
7008 <table class="foo">
7009 <tr>
7010 <td class="bar">
7011 <p>foo</p></td></tr>
7012 </tbody></table>
7013 !!end
7014
7015 !! test
7016 Tables: Digest broken attributes on table and tr tag
7017 !! options
7018 parsoid=wt2html
7019 !! wikitext
7020 {| || |} ++
7021 |- || || ++ --
7022 |- > [
7023 |}
7024 !! html
7025 <table>
7026 <tbody>
7027 <tr></tr>
7028 <tr></tr>
7029 </tbody></table>
7030 !! end
7031
7032 !! test
7033 Strip unsupported table tags
7034 !! options
7035 parsoid=html2wt
7036 !! html/parsoid
7037 <table>
7038 <thead>
7039 <tr>
7040 <th>Month</th>
7041 <th>Savings</th>
7042 </tr>
7043 </thead>
7044 <tbody>
7045 <tr>
7046 <td>January</td>
7047 <td>$100</td>
7048 </tr>
7049 <tr>
7050 <td>February</td>
7051 <td>$80</td>
7052 </tr>
7053 </tbody>
7054 <tfoot>
7055 <tr>
7056 <td>Sum</td>
7057 <td>$180</td>
7058 </tr>
7059 </tfoot>
7060 </table>
7061 !! wikitext
7062 {|
7063
7064 !Month
7065 !Savings
7066
7067 |January
7068 |$100
7069
7070 |-
7071 |February
7072 |$80
7073
7074 |Sum
7075 |$180
7076
7077 |}
7078 !! end
7079
7080 !!test
7081 Testing serialization after deletion of table cells
7082 !!options
7083 parsoid={
7084 "modes": ["wt2wt", "selser"],
7085 "changes": [
7086 ["#x", "remove"]
7087 ]
7088 }
7089 !!wikitext
7090 {|
7091 !h1 !!h2 !!h3
7092 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7093 |}
7094 !! wikitext/edited
7095 {|
7096 !h1 !!h2 !!h3
7097 |c2 |||c3
7098 |}
7099 !!end
7100
7101 ###
7102 ### Internal links
7103 ###
7104 !! test
7105 Plain link, capitalized
7106 !! wikitext
7107 [[Main Page]]
7108 !! html
7109 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7110 </p>
7111 !! end
7112
7113 !! test
7114 Plain link, uncapitalized
7115 !! wikitext
7116 [[main Page]]
7117 !! html
7118 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7119 </p>
7120 !! end
7121
7122 !! test
7123 Piped link
7124 !! wikitext
7125 [[Main Page|The Main Page]]
7126 !! html
7127 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7128 </p>
7129 !! end
7130
7131 !! test
7132 Piped link with comment in link text
7133 !! wikitext
7134 [[Main Page|The Main<!--front--> Page]]
7135 !! html
7136 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7137 </p>
7138 !! end
7139
7140 !! test
7141 Piped link with multiple pipe characters in link text
7142 !! wikitext
7143 [[Main Page||The|Main|Page|]]
7144 !! html/php
7145 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7146 </p>
7147 !! html/parsoid
7148 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7149 !! end
7150
7151 !! test
7152 Piped link with no link text
7153 !! wikitext
7154 [[Thomas Bek (bishop of St David's)|]]
7155 !! html/php
7156 <p>[[Thomas Bek (bishop of St David's)|]]
7157 </p>
7158 !! html/parsoid
7159 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7160 !! end
7161
7162 !! test
7163 Broken link
7164 !! wikitext
7165 [[Zigzagzogzagzig]]
7166 !! html
7167 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7168 </p>
7169 !! end
7170
7171 !! test
7172 Broken link with fragment
7173 !! wikitext
7174 [[Zigzagzogzagzig#zug]]
7175 !! html
7176 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7177 </p>
7178 !! end
7179
7180 !! test
7181 Special page link with fragment
7182 !! wikitext
7183 [[Special:Version#anchor]]
7184 !! html
7185 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7186 </p>
7187 !! end
7188
7189 !! test
7190 Nonexistent special page link with fragment
7191 !! wikitext
7192 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7193 !! html
7194 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7195 </p>
7196 !! end
7197
7198 !! test
7199 Link with prefix
7200 !! wikitext
7201 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7202 !! html
7203 <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>
7204 </p>
7205 !! end
7206
7207 !! test
7208 Link with suffix
7209 !! wikitext
7210 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7211 !! html
7212 <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>!!!
7213 </p>
7214 !! end
7215
7216 !! article
7217 prefixed article
7218 !! text
7219 Some text
7220 !! endarticle
7221
7222 !! test
7223 Bug 43661: Piped links with identical prefixes
7224 !! wikitext
7225 [[prefixed article|prefixed articles with spaces]]
7226
7227 [[prefixed article|prefixed articlesaoeu]]
7228
7229 [[Main Page|Main Page test]]
7230 !! html
7231 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7232 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7233 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7234 </p>
7235 !! end
7236
7237
7238 !! test
7239 Link with HTML entity in suffix / tail
7240 !! wikitext
7241 [[Main Page]]&quot;, [[Main Page]]&#97;
7242 !! html/php
7243 <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;
7244 </p>
7245 !! html/parsoid
7246 <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>
7247 !! end
7248
7249 !! test
7250 Link with 3 brackets
7251 !! wikitext
7252 [[[Main Page]]]
7253 Foo [[[Main Page]]]
7254 !! html
7255 <p>[[[Main Page]]]
7256 Foo [[[Main Page]]]
7257 </p>
7258 !! end
7259
7260 !! test
7261 Link with 4 brackets
7262 !! wikitext
7263 [[[[Main Page]]]]
7264 !! html
7265 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7266 </p>
7267 !! end
7268
7269 !! test
7270 Piped link with 3 brackets
7271 !! wikitext
7272 [[[main page|the main page]]]
7273 !! html
7274 <p>[[[main page|the main page]]]
7275 </p>
7276 !! end
7277
7278 !! test
7279 Piped link with extlink-like text
7280 !! wikitext
7281 [[Main Page|[bar]]]
7282 [[Main Page|This is a [bar]]]
7283 !! html/php
7284 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7285 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7286 </p>
7287 !! html/parsoid
7288 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7289 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7290 !! end
7291
7292 !! test
7293 Link with multiple pipes
7294 !! wikitext
7295 [[Main Page|The|Main|Page]]
7296 !! html
7297 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7298 </p>
7299 !! end
7300
7301 # Note that parsoid does not munge anchor text; all non-space
7302 # characters are valid in HTML5 ids.
7303 !! test
7304 Anchor containing a #. (bug 63430)
7305 !! wikitext
7306 [[Main Page#And#Link]]
7307 !! html/php
7308 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7309 </p>
7310 !! html/parsoid
7311 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7312 !! end
7313
7314 !! test
7315 Link to namespaces
7316 !! wikitext
7317 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7318 !! html
7319 <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>
7320 </p>
7321 !! end
7322
7323 !! test
7324 Link with space in namespace
7325 !! wikitext
7326 [[User talk:Foo bar]]
7327 !! html
7328 <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>
7329 </p>
7330 !! end
7331
7332 !! article
7333 MemoryAlpha:AlphaTest
7334 !! text
7335 This is an article in the MemoryAlpha namespace
7336 (which shadows the memoryalpha interwiki link).
7337 !! endarticle
7338
7339 !! test
7340 Namespace takes precedence over interwiki link (bug 51680)
7341 !! wikitext
7342 [[MemoryAlpha:AlphaTest]]
7343 !! html
7344 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7345 </p>
7346 !! end
7347
7348 # The previous test doesn't work correctly in html2*, due to not recognizing the
7349 # link as an internal one. This one checks for the correct behavior.
7350 !! test
7351 Link to namespace preferred over interwiki with correct rel attribute
7352 !! options
7353 parsoid=html2wt,html2html
7354 !! html/parsoid
7355 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7356 !! wikitext
7357 [[MemoryAlpha:AlphaTest]]
7358 !! end
7359
7360 !! test
7361 Piped link to namespace
7362 !! wikitext
7363 [[Meta:Disclaimers|The disclaimers]]
7364 !! html
7365 <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>
7366 </p>
7367 !! end
7368
7369 !! test
7370 Link containing }
7371 !! wikitext
7372 [[Usually caused by a typo (oops}]]
7373 !! html
7374 <p>[[Usually caused by a typo (oops}]]
7375 </p>
7376 !! end
7377
7378 !! article
7379 7% Solution
7380 !! text
7381 Just a test of an article title containing a percent.
7382 !! endarticle
7383
7384 !! test
7385 Link containing % (not as a hex sequence)
7386 !! wikitext
7387 [[7% Solution]]
7388 !! html/php
7389 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7390 </p>
7391 !! html/parsoid
7392 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7393 !! end
7394
7395 # note that the parsoid HTML is identical to the previous test output,
7396 # so the previous test ensures that the html2wt mode will generate the
7397 # "not as a hex sequence" wikitext.
7398 !! test
7399 Link containing % as a single hex sequence interpreted to char
7400 !! options
7401 parsoid=wt2wt,wt2html,html2html
7402 !! wikitext
7403 [[7%25 Solution]]
7404 !! html/php
7405 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7406 </p>
7407 !! html/parsoid
7408 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7409 !!end
7410
7411 !! test
7412 Link containing % as a double hex sequence interpreted to hex sequence
7413 !! wikitext
7414 [[7%2525 Solution]]
7415 !! html
7416 <p>[[7%2525 Solution]]
7417 </p>
7418 !!end
7419
7420 # note that parsoid does not munge anchor text; all non-space
7421 # characters are valid in HTML5 anchors.
7422 !! test
7423 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7424 Example for such a section: == < ==
7425 !! wikitext
7426 [[%23%3c]][[%23%3e]]
7427 !! html/php
7428 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7429 </p>
7430 !! html/parsoid
7431 <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>
7432 !! end
7433
7434 !! test
7435 Link containing "<#" and ">#" as a hex sequences
7436 !! wikitext
7437 [[%3c%23]][[%3e%23]]
7438 !! html
7439 <p>[[%3c%23]][[%3e%23]]
7440 </p>
7441 !! end
7442
7443 !! test
7444 Link containing an equals sign
7445 !! wikitext
7446 [[Special:BookSources/isbn=4-00-026157-6]]
7447 !! html/php
7448 <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>
7449 </p>
7450 !! html/parsoid
7451 <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>
7452 !! end
7453
7454 !! article
7455 Foo~bar
7456 !! text
7457 Just a test of an article title containing a tilde.
7458 !! endarticle
7459
7460 # note that links containing signatures, like [[Foo~~~~]], are
7461 # massaged by the pre-save transform (PST) and so the tildes are never
7462 # seen by the parser.
7463 !! test
7464 Link containing a tilde
7465 !! wikitext
7466 [[Foo~bar]]
7467 !! html/php
7468 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7469 </p>
7470 !! html/parsoid
7471 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7472 !! end
7473
7474 !! test
7475 Link containing double-single-quotes '' (bug 4598)
7476 !! wikitext
7477 [[Lista d''e paise d''o munno]]
7478 !! html/php
7479 <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>
7480 </p>
7481 !! html/parsoid
7482 <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>
7483 !! end
7484
7485 !! test
7486 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7487 !! wikitext
7488 Some [[Link|pretty ''italics'' and stuff]]!
7489 !! html/php
7490 <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>!
7491 </p>
7492 !! html/parsoid
7493 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7494 !! end
7495
7496 !! test
7497 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7498 !! wikitext
7499 ''Some [[Link|pretty ''italics'' and stuff]]!''
7500 !! html
7501 <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>
7502 </p>
7503 !! end
7504
7505 !! test
7506 Link with double quotes in title part (literal) and alternate part (interpreted)
7507 !! wikitext
7508 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7509
7510 [[''Pentecoste'']]
7511
7512 [[''Pentecoste''|Pentecoste]]
7513
7514 [[''Pentecoste''|''Pentecoste'']]
7515 !! html/php
7516 <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>
7517 </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>
7518 </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>
7519 </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>
7520 </p>
7521 !! html/parsoid
7522 <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>
7523 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7524 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7525 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7526 !! end
7527
7528 !! test
7529 Broken image links with HTML captions (bug 39700)
7530 !! wikitext
7531 [[File:Nonexistent|<script></script>]]
7532 [[File:Nonexistent|100x100px|<script></script>]]
7533 [[File:Nonexistent|&lt;]]
7534 [[File:Nonexistent|a<i>b</i>c]]
7535 !! html/php
7536 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7537 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7538 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7539 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7540 </p>
7541 !! html/parsoid
7542 <p><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;script&amp;gt;&amp;lt;/script&amp;gt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7543 <span typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script&amp;gt;&amp;lt;/script&amp;gt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100"/></a></span>
7544 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;lt;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;&lt;&amp;quot;,&amp;quot;dsr&amp;quot;:[107,111,null,null]}\">&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7545 <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 data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[134,142,3,4]}\">b&lt;/i>c"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span></p>
7546 !! end
7547
7548 !! test
7549 Plain link to URL
7550 !! wikitext
7551 [[http://www.example.com]]
7552 !! html/php
7553 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7554 </p>
7555 !! html/parsoid
7556 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7557 !! end
7558
7559 !! test
7560 Plain link to URL with link text
7561 !! wikitext
7562 [[http://www.example.com Link text]]
7563 !! html
7564 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7565 </p>
7566 !! end
7567
7568 !! test
7569 Plain link to protocol-relative URL
7570 !! wikitext
7571 [[//www.example.com]]
7572 !! html/php
7573 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7574 </p>
7575 !! html/parsoid
7576 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7577 !! end
7578
7579 !! test
7580 Plain link to protocol-relative URL with link text
7581 !! wikitext
7582 [[//www.example.com Link text]]
7583 !! html
7584 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7585 </p>
7586 !! end
7587
7588 !! test
7589 Plain link to page with question mark in title
7590 !! wikitext
7591 [[A?b]]
7592
7593 [[A?b|Baz]]
7594 !! html
7595 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7596 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7597 </p>
7598 !! end
7599
7600
7601 # I'm fairly sure the expected result here is wrong.
7602 # We want these to be URL links, not pseudo-pages with URLs for titles....
7603 # However the current output is also pretty screwy.
7604 #
7605 # ----
7606 # I'm changing it to match the current output--it arguably makes more
7607 # sense in the light of the test above. Old expected result was:
7608 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7609 #</p>
7610 # But I think this test is bordering on "garbage in, garbage out" anyway.
7611 # -- wtm
7612 !! test
7613 Piped link to URL
7614 !! wikitext
7615 Piped link to URL: [[http://www.example.com|an example URL]]
7616 !! html/php
7617 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7618 </p>
7619 !! html/parsoid
7620 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7621 !! end
7622
7623 !! test
7624 BUG 2: [[page|http://url/]] should link to page, not http://url/
7625 !! wikitext
7626 [[Main Page|http://url/]]
7627 !! html/php
7628 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7629 </p>
7630 !! html/parsoid
7631 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7632 !! end
7633
7634 # Parsoid does not mark self-links, by design.
7635 !! test
7636 BUG 337: Escaped self-links should be bold
7637 !! options
7638 title=[[Bug462]]
7639 !! wikitext
7640 [[Bu&#103;462]] [[Bug462]]
7641 !! html/php
7642 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7643 </p>
7644 !! html/php+tidy
7645 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7646 !! html/parsoid
7647 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7648 !! end
7649
7650 !! test
7651 Self-link to section should not be bold
7652 !! options
7653 title=[[Main Page]]
7654 !! wikitext
7655 [[Main Page#section]]
7656 !! html
7657 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7658 </p>
7659 !! end
7660
7661 !! article
7662 00
7663 !! text
7664 This is 00.
7665 !! endarticle
7666
7667 !!test
7668 Self-link to numeric title
7669 !!options
7670 title=[[0]]
7671 !! wikitext
7672 [[0]]
7673 !! html
7674 <p><strong class="selflink">0</strong>
7675 </p>
7676 !!end
7677
7678 !!test
7679 Link to numeric-equivalent title
7680 !!options
7681 title=[[0]]
7682 !! wikitext
7683 [[00]]
7684 !! html
7685 <p><a href="/wiki/00" title="00">00</a>
7686 </p>
7687 !!end
7688
7689 !! test
7690 <nowiki> inside a link
7691 !! wikitext
7692 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7693 !! html
7694 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7695 </p>
7696 !! end
7697
7698 !! test
7699 Non-breaking spaces in title
7700 !! wikitext
7701 [[&nbsp; Main &nbsp; Page &nbsp;]]
7702 !! html
7703 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7704 </p>
7705 !!end
7706
7707 !! test
7708 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7709 !! options
7710 language=ca
7711 !! wikitext
7712 '''[[Main Page]]'''
7713 !! html
7714 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7715 </p>
7716 !! end
7717
7718 !! test
7719 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7720 !! options
7721 language=ca
7722 !! wikitext
7723 ''[[Main Page]]''
7724 !! html
7725 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7726 </p>
7727 !! end
7728
7729 !! test
7730 Internal link with en linktrail: no apostrophes (bug 27473)
7731 !! options
7732 language=en
7733 !! wikitext
7734 [[Something]]'nice
7735 !! html
7736 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7737 </p>
7738 !! end
7739
7740 !! test
7741 Internal link with ca linktrail with apostrophes (bug 27473)
7742 !! options
7743 language=ca
7744 !! wikitext
7745 [[Something]]'nice
7746 !! html
7747 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7748 </p>
7749 !! end
7750
7751 !! test
7752 Internal link with kaa linktrail with apostrophes (bug 27473)
7753 !! options
7754 language=kaa
7755 !! wikitext
7756 [[Something]]'nice
7757 !! html
7758 <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>
7759 </p>
7760 !! end
7761
7762 !! test
7763 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7764 !! wikitext
7765 [[User:Foo/Test/63636:Bar|Test]]
7766 !! html/php
7767 <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>
7768 </p>
7769 !! html/parsoid
7770 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7771 !! end
7772
7773 !! test
7774 Purely hash wikilink
7775 !! options
7776 title=[[User:test/123]]
7777 !! wikitext
7778 [[#a|b]]
7779 !! html/php
7780 <p><a href="#a">b</a>
7781 </p>
7782 !! html/parsoid
7783 <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>
7784 !! end
7785
7786 !! test
7787 1. Interaction of linktrail and template encapsulation
7788 !! options
7789 parsoid
7790 !! wikitext
7791 {{echo|[[Foo]]}}l
7792 !! html
7793 <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>
7794 !! end
7795
7796 !! test
7797 2. Interaction of linktrail and template encapsulation
7798 !! options
7799 parsoid
7800 !! wikitext
7801 {{echo|Some [[Fool]]}}s
7802 !! html
7803 <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>
7804 !! end
7805
7806 !! test
7807 3. Interaction of linktrail and template encapsulation
7808 !! options
7809 parsoid
7810 !! wikitext
7811 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7812 !! html
7813 <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>
7814 !! end
7815
7816 !! article
7817 Söfnuður
7818 !! text
7819 Test.
7820 !! endarticle
7821
7822 !! test
7823 Internal link with is link prefix
7824 !! options
7825 language=is
7826 !! wikitext
7827 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7828 !! html
7829 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7830 </p>
7831 !! end
7832
7833 !! article
7834 Mótmælendatrú
7835 !! text
7836 Test.
7837 !! endarticle
7838
7839 !! test
7840 Internal link with is link trail and link prefix
7841 !! options
7842 language=is
7843 !! wikitext
7844 [[mótmælendatrú|xxx]]ar
7845 [[mótmælendatrú]]ar
7846 mótmælenda[[söfnuður]]
7847 mótmælenda[[söfnuður|söfnuðir]]
7848 mótmælenda[[söfnuður|söfnuðir]]xxx
7849 !! html
7850 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7851 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7852 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7853 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7854 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7855 </p>
7856 !! end
7857
7858 !! test
7859 Parsoid link trail escaping
7860 !! options
7861 parsoid=html2wt,html2html
7862 !! html/parsoid
7863 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7864 !! wikitext
7865 [[apple]]<nowiki/>s
7866 !! end
7867
7868 !! test
7869 Parsoid link prefix escaping
7870 !! options
7871 language=is
7872 parsoid=html2wt,html2html
7873 !! html/parsoid
7874 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7875 !! wikitext
7876 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7877 !! end
7878
7879 !! test
7880 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7881 !! wikitext
7882 [[Foo| bar]]
7883
7884 [[Foo| ''bar'']]
7885
7886 [http://wp.org foo]
7887
7888 [http://wp.org ''foo'']
7889 !! html
7890 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7891 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7892 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7893 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7894 </p>
7895 !! end
7896
7897 !! test
7898 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7899 !! options
7900 parsoid
7901 !! wikitext
7902 [[Foo|{{echo|a}} b {{echo|c}}]]
7903 !! html
7904 <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>
7905 !! end
7906
7907 !! test
7908 Link with angle bracket after anchor
7909 !! wikitext
7910 [[Foo#<bar>]]
7911 !! html/php
7912 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7913 </p>
7914 !! html/parsoid
7915 <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>
7916 !! end
7917
7918 ###
7919 ### Interwiki links (see maintenance/interwiki.sql)
7920 ###
7921
7922 !! test
7923 Inline interwiki link
7924 !! options
7925 parsoid=wt2html,wt2wt,html2html
7926 !! wikitext
7927 [[MeatBall:SoftSecurity]]
7928 !! html/php
7929 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7930 </p>
7931 !! html/parsoid
7932 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7933 !! end
7934
7935 !! test
7936 Inline interwiki link with empty title (bug 2372)
7937 !! options
7938 parsoid=wt2html,wt2wt,html2html
7939 !! wikitext
7940 [[MeatBall:]]
7941 !! html/php
7942 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7943 </p>
7944 !! html/parsoid
7945 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7946 !! end
7947
7948 !! test
7949 Interwiki link encoding conversion (bug 1636)
7950 !! wikitext
7951 *[[Wikipedia:ro:Olteni&#0355;a]]
7952 *[[Wikipedia:ro:Olteni&#355;a]]
7953 !! html
7954 <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>
7955 <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>
7956
7957 !! html+tidy
7958 <ul>
7959 <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>
7960 <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>
7961 </ul>
7962 !! end
7963
7964 !! test
7965 Interwiki link with fragment (bug 2130)
7966 !! wikitext
7967 [[MeatBall:SoftSecurity#foo]]
7968 !! html
7969 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7970 </p>
7971 !! end
7972
7973 # Ideally the wikipedia: prefix here should be proto-relative too
7974 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7975 # define the 'en' prefix, and originally the test used 'wikipedia',
7976 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7977 # article.
7978 !! test
7979 Different interwiki prefixes mapping to the same URL
7980 !! wikitext
7981 [[:en:Foo]]
7982
7983 [[:en:Foo|Foo]]
7984
7985 [[wikipedia:Foo]]
7986
7987 [[:wikipedia:Foo|Foo]]
7988
7989 [[wikipedia:en:Foo]]
7990
7991 [[:wikipedia:en:Foo]]
7992
7993 [[ wikiPEdia :Foo]]
7994 !! html/parsoid
7995 <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>
7996
7997 <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>
7998
7999 <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>
8000
8001 <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>
8002
8003 <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>
8004
8005 <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>
8006
8007 <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>
8008 !! end
8009
8010 !! test
8011 Interwiki links that cannot be represented in wiki syntax
8012 !! wikitext
8013 [[meatball:ok]]
8014 [[meatball:ok#foo|ok with fragment]]
8015 [[meatball:ok_as_well?|ok ending with ? mark]]
8016 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8017 [http://de.wikipedia.org/wiki/#foo is just fragment]
8018
8019 !! html/php
8020 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8021 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8022 <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>
8023 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8024 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8025 </p>
8026 !! html/parsoid
8027 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8028 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8029 <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>
8030 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8031 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8032 !! end
8033
8034 !! test
8035 Interwiki links: trail
8036 !! wikitext
8037 [[wikipedia:Foo|Ba]]r
8038 !! html/php
8039 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8040 </p>
8041 !! html/parsoid
8042 <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>
8043 !! end
8044
8045 !! test
8046 Local interwiki link
8047 !! options
8048 parsoid=wt2html,wt2wt,html2html
8049 !! wikitext
8050 [[local:Template:Foo]]
8051 !! html/php
8052 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8053 </p>
8054 !! html/parsoid
8055 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8056 !! end
8057
8058 # Parsoid does not mark self-links, by design.
8059 !! test
8060 Local interwiki link: self-link to current page
8061 !! options
8062 title=[[Main Page]]
8063 parsoid=wt2html,wt2wt,html2html
8064 !! wikitext
8065 [[local:Main Page]]
8066 !! html/php
8067 <p><strong class="selflink">local:Main Page</strong>
8068 </p>
8069 !! html/parsoid
8070 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8071 !! end
8072
8073 !! test
8074 Local interwiki link: prefix only (bug 64167)
8075 !! options
8076 parsoid=wt2html,wt2wt,html2html
8077 !! wikitext
8078 [[local:]]
8079 !! html/php
8080 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8081 </p>
8082 !! html/parsoid
8083 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8084 !! end
8085
8086 !! test
8087 Local interwiki link: with additional interwiki prefix (bug 61357)
8088 !! options
8089 parsoid=wt2html,wt2wt,html2html
8090 !! wikitext
8091 [[local:meatball:Hello]]
8092 !! html/php
8093 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8094 </p>
8095 !! html/parsoid
8096 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8097 !! end
8098
8099 !! test
8100 Multiple local interwiki link prefixes
8101 !! wikitext
8102 [[local:local:local:local:mi:local:Foo]]
8103 !! options
8104 parsoid=wt2html,wt2wt,html2html
8105 !! html/php
8106 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8107 </p>
8108 !! html/parsoid
8109 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8110 !! end
8111
8112 ###
8113 ### Interlanguage links
8114 ### Language links (so that searching for '### language' matches..)
8115 ###
8116
8117 !! test
8118 Interlanguage link
8119 !! options
8120 parsoid=wt2html,wt2wt,html2html
8121 !! wikitext
8122 Blah blah blah
8123 [[zh:Chinese]]
8124 !! html/php
8125 <p>Blah blah blah
8126 </p>
8127 !! html/parsoid
8128 <p>Blah blah blah</p>
8129 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8130 !! end
8131
8132 !! test
8133 Interlanguage link with spacing
8134 !! options
8135 parsoid=wt2html,wt2wt,html2html
8136 !! wikitext
8137 Blah blah blah
8138 [[ zh : Chinese ]]
8139 !! html/php
8140 <p>Blah blah blah
8141 </p>
8142 !! html/parsoid
8143 <p>Blah blah blah</p>
8144 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8145 !! end
8146
8147 !! test
8148 Double interlanguage link
8149 !! options
8150 parsoid=wt2html,wt2wt,html2html
8151 !! wikitext
8152 Blah blah blah
8153 [[es:Spanish]]
8154 [[zh:Chinese]]
8155 !! html/php
8156 <p>Blah blah blah
8157 </p>
8158 !! html/parsoid
8159 <p>Blah blah blah</p>
8160 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8161 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8162 !! end
8163
8164 !! test
8165 Interlanguage link variations
8166 !! options
8167 parsoid=wt2html,wt2wt,html2html
8168 !! wikitext
8169 Blah blah blah
8170 [[ es :Spanish]]
8171 [[ ZH :Chinese]]
8172 [[es:Foo_bar]]
8173 !! html/php
8174 <p>Blah blah blah
8175 </p>
8176 !! html/parsoid
8177 <p>Blah blah blah</p>
8178 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8179 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8180 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8181 !! end
8182
8183 !! test
8184 Space and question mark encoding in interlanguage links (T95473)
8185 !! options
8186 parsoid=wt2html,wt2wt,html2html
8187 !! wikitext
8188 Blah blah blah
8189 [[es:Foo bar?]]
8190 !! html/php
8191 <p>Blah blah blah
8192 </p>
8193 !! html/parsoid
8194 <p>Blah blah blah</p>
8195 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8196 !! end
8197
8198 !! test
8199 Interlanguage link, with prefix links
8200 !! options
8201 language=ln
8202 !! wikitext
8203 Blah blah blah
8204 [[zh:Chinese]]
8205 !! html/php
8206 <p>Blah blah blah
8207 </p>
8208 !! html/parsoid
8209 <p>Blah blah blah</p>
8210 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8211 !! end
8212
8213 !! test
8214 Double interlanguage link, with prefix links (bug 8897)
8215 !! options
8216 language=ln
8217 !! wikitext
8218 Blah blah blah
8219 [[es:Spanish]]
8220 [[zh:Chinese]]
8221 !! html/php
8222 <p>Blah blah blah
8223 </p>
8224 !! html/parsoid
8225 <p>Blah blah blah</p>
8226 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8227 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8228 !! end
8229
8230 !! test
8231 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8232 !! wikitext
8233 Blah blah blah
8234 [[mul:Article]]
8235 !! html/php
8236 <p>Blah blah blah
8237 </p>
8238 !! html/parsoid
8239 <p>Blah blah blah</p>
8240 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8241 !! end
8242
8243 !! test
8244 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8245 !! options
8246 language=ln
8247 !! wikitext
8248 [[WW&nbsp;II]]
8249 !! html
8250 <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>
8251 </p>
8252 !! end
8253
8254 !! test
8255 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8256 !! options
8257 parsoid=html2wt
8258 !! html/parsoid
8259 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8260 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8261 !! wikitext
8262 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8263
8264 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8265 !! end
8266
8267 !! test
8268 Parsoid: handle constructor well
8269 !! wikitext
8270 [[constructor]]
8271
8272 [[constructor:foo]]
8273 !! html/php
8274 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8275 </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>
8276 </p>
8277 !! html/parsoid
8278 <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>
8279
8280 <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>
8281 !! end
8282
8283 !! article
8284 ko:
8285 !! text
8286 Test.
8287 !! endarticle
8288
8289 # Note that `ko` isn't a known interlanguage prefix
8290 !! test
8291 Parsoid: recognize interlanguage links without a target page
8292 !! options
8293 ill
8294 !! wikitext
8295 [[es:]]
8296
8297 [[ko:]]
8298 !! html/php
8299 es:
8300 !! html/parsoid
8301 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8302
8303 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8304 !! end
8305
8306 # Note that `ko` isn't a known interwiki prefix
8307 !! test
8308 Parsoid: recognize interwiki links without a target page
8309 !! options
8310 parsoid=wt2html,wt2wt,html2html
8311 !! wikitext
8312 [[:es:]]
8313
8314 [[:ko:]]
8315 !! html/php
8316 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8317 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8318 </p>
8319 !! html/parsoid
8320 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8321 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8322 !! end
8323
8324 !! test
8325 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8326 !! wikitext
8327 [[mi:Foo]]
8328 !! html/php
8329 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8330 </p>
8331 !! html/parsoid
8332 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8333 !! end
8334
8335 !! test
8336 Interlanguage link with preceding local interwiki link (bug 68085)
8337 !! options
8338 parsoid=wt2html,wt2wt,html2html
8339 !! wikitext
8340 Blah blah blah
8341 [[local:es:Spanish]]
8342 !! html/php
8343 <p>Blah blah blah
8344 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8345 </p>
8346 !! html/parsoid
8347 <p>Blah blah blah
8348 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8349 !! end
8350
8351 !! test
8352 Looks like an interlanguage link, but is actually a local interwiki
8353 !! options
8354 parsoid=wt2html,wt2wt,html2html
8355 !! wikitext
8356 Blah blah blah
8357 [[mi:Template:Foo]]
8358 !! html/php
8359 <p>Blah blah blah
8360 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8361 </p>
8362 !! html/parsoid
8363 <p>Blah blah blah
8364 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8365 !! end
8366
8367 ###
8368 ### Redirects, Parsoid-only
8369 ###
8370
8371 !! test
8372 1. Simple redirect to page
8373 !! wikitext
8374 #REDIRECT [[Main Page]]
8375 !! html/parsoid
8376 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8377 !! end
8378
8379 !! test
8380 2. Other redirect variants
8381 !! wikitext
8382 #REDIRECT [[Main_Page]]
8383 !! html/parsoid
8384 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8385 !! end
8386
8387 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8388 # This tests the Parsoid bail-out code.
8389 !! test
8390 3. Other redirect variants
8391 !! wikitext
8392 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8393 !! html/parsoid
8394 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8395 !! end
8396
8397 !! test
8398 4. Redirect to a templated destination
8399 !! wikitext
8400 #REDIRECT [[{{echo|Foo}}bar]]
8401 !! html/parsoid
8402 <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"}]]}'/>
8403 !! end
8404
8405 !! test
8406 Empty redirect
8407 !! options
8408 parsoid=wt2html,wt2wt
8409 !! wikitext
8410 #REDIRECT [[]]
8411 !! html/parsoid
8412 <ol>
8413 <li>REDIRECT [[]]</li></ol>
8414 !! end
8415
8416 !! test
8417 Optional colon in #REDIRECT
8418 !! options
8419 # the colon is archaic syntax. we support it for wt2html, but we
8420 # don't care that it roundtrips back to the modern syntax.
8421 parsoid=wt2html,html2html
8422 !! wikitext
8423 #REDIRECT:[[Main Page]]
8424 !! html/parsoid
8425 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8426 !! end
8427
8428 !! test
8429 Whitespace in #REDIRECT with optional colon
8430 !! options
8431 # the colon and gratuitous whitespace is archaic syntax. we support
8432 # it for wt2html, but we don't care that it roundtrips back to the
8433 # modern syntax (without extra whitespace)
8434 parsoid=wt2html,html2html
8435 !! wikitext
8436
8437 #REDIRECT
8438 :
8439 [[Main Page]]
8440 !! html/parsoid
8441 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8442 !! end
8443
8444 !! test
8445 Piped link in #REDIRECT
8446 !! options
8447 # content after piped link is ignored. we support this syntax,
8448 # but don't care that the piped link is lost when we roundtrip this.
8449 parsoid=wt2html
8450 !! wikitext
8451 #REDIRECT [[Main Page|bar]]
8452 !! html/parsoid
8453 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8454 !! end
8455
8456 !! test
8457 Redirect to category (T104502)
8458 !! options
8459 parsoid=wt2html,wt2wt
8460 !! wikitext
8461 #REDIRECT [[Category:Foo]]
8462 !! html/parsoid
8463 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8464 !! end
8465
8466 !! test
8467 Redirect to category with URL encoding (T104502)
8468 !! options
8469 parsoid=wt2html
8470 !! wikitext
8471 #REDIRECT [[Category%3AFoo]]
8472 !! html/parsoid
8473 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8474 !! end
8475
8476 !! test
8477 Redirect to category page
8478 !! wikitext
8479 #REDIRECT [[:Category:Foo]]
8480 !! html/parsoid
8481 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8482 !! end
8483
8484 !! test
8485 Redirect to image page (1)
8486 !! wikitext
8487 #REDIRECT [[File:Wiki.png]]
8488 !! html/parsoid
8489 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8490 !! end
8491
8492 !! test
8493 Redirect to image page (2)
8494 !! wikitext
8495 #REDIRECT [[Image:Wiki.png]]
8496 !! html/parsoid
8497 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8498 !! end
8499
8500 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8501 # Next test confirms this.
8502 !! test
8503 Redirect to language (1) (T104918)
8504 !! options
8505 parsoid=wt2html,wt2wt,html2html
8506 !! wikitext
8507 #REDIRECT [[en:File:Wiki.png]]
8508 !! html/parsoid
8509 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8510 !! end
8511
8512 !! test
8513 Redirect to language (2) (T104918)
8514 !! wikitext
8515 #REDIRECT [[:en:File:Wiki.png]]
8516 !! html/parsoid
8517 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8518 !! end
8519
8520 !! test
8521 Redirect to interwiki (T104918)
8522 !! wikitext
8523 #REDIRECT [[meatball:File:Wiki.png]]
8524 !! html/parsoid
8525 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8526 !! end
8527
8528 !! test
8529 Non-English #REDIRECT
8530 !! options
8531 language=is
8532 !! wikitext
8533 #TILVÍSUN [[Main Page]]
8534 !! html/parsoid
8535 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8536 !! end
8537
8538 !! test
8539 Redirect syntax under text isn't considered a redirect
8540 !! wikitext
8541 some text
8542 #redirect [[Main Page]]
8543 !! html/parsoid
8544 <p>some text</p>
8545 <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>
8546 !! end
8547
8548 # FIXME: Should hoist the redirect to the top of the page and ensure there
8549 # is only one.
8550 !! test
8551 New redirect
8552 !! options
8553 parsoid=html2wt
8554 !! html/parsoid
8555 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8556 !! wikitext
8557 Foo
8558 #REDIRECT [[Foo]]
8559 !! end
8560
8561 ##
8562 ## XHTML tidiness
8563 ###
8564
8565 !! test
8566 <br> to <br />
8567 !! wikitext
8568 1<br>2<br />3
8569 !! html
8570 <p>1<br />2<br />3
8571 </p>
8572 !! end
8573
8574 !! test
8575 Broken br tag sanitization
8576 !! wikitext
8577 </br>
8578 !! html/php
8579 <p>&lt;/br&gt;
8580 </p>
8581 !! end
8582
8583 # TODO: Fix html2html mode (bug 51055)!
8584 !! test
8585 Parsoid: Broken br tag recognition
8586 !! options
8587 parsoid=wt2html
8588 !! wikitext
8589 </br>
8590
8591 <br/ >
8592 !! html+tidy
8593 <p><br /></p>
8594 <p><br /></p>
8595 !! end
8596
8597 !! test
8598 Incorrecly removing closing slashes from correctly formed XHTML
8599 !! wikitext
8600 <br style="clear:both;" />
8601 !! html
8602 <p><br style="clear:both;" />
8603 </p>
8604 !! end
8605
8606 !! test
8607 Failing to transform badly formed HTML into correct XHTML
8608 !! wikitext
8609 <br style="clear: left;">
8610 <br style="clear: right;">
8611 <br style="clear: both;">
8612 !! html
8613 <p><br style="clear: left;" />
8614 <br style="clear: right;" />
8615 <br style="clear: both;" />
8616 </p>
8617 !!end
8618
8619 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8620 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8621 !! test
8622 Handling html with a div self-closing tag
8623 !! wikitext
8624 <div title />
8625 <div title/>
8626 <div title/ >
8627 <div title=bar />
8628 <div title=bar/>
8629 <div title=bar/ >
8630 !! html/php
8631 <p>&lt;div title /&gt;
8632 &lt;div title/&gt;
8633 </p>
8634 <div>
8635 <p>&lt;div title=bar /&gt;
8636 &lt;div title=bar/&gt;
8637 </p>
8638 <div title="bar/"></div>
8639 </div>
8640
8641 !! html/parsoid
8642 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8643 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8644 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8645 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8646 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8647 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8648 !! end
8649
8650 !! test
8651 Handling html with a br self-closing tag
8652 !! wikitext
8653 <br title />
8654 <br title/>
8655 <br title/ >
8656 <br title=bar />
8657 <br title=bar/>
8658 <br title=bar/ >
8659 !! html/php
8660 <p><br title="" />
8661 <br title="" />
8662 <br />
8663 <br title="bar" />
8664 <br title="bar" />
8665 <br title="bar/" />
8666 </p>
8667 !! html/parsoid
8668 <p><br title="" />
8669 <br title="" />
8670 <br title="" />
8671 <br title="bar" />
8672 <br title="bar" />
8673 <br title="bar/" />
8674 </p>
8675 !! end
8676
8677 !! test
8678 Horizontal ruler (should it add that extra space?)
8679 !! wikitext
8680 <hr>
8681 <hr >
8682 foo <hr
8683 > bar
8684 !! html+tidy
8685 <hr />
8686 <hr />
8687 <p>foo</p>
8688 <hr />
8689 <p>bar</p>
8690 !! end
8691
8692 !! test
8693 Horizontal ruler -- 4+ dashes render hr
8694 !! wikitext
8695 ----
8696 !! html
8697 <hr />
8698
8699 !! end
8700
8701 !! test
8702 Horizontal ruler -- eats additional dashes on the same line
8703 !! wikitext
8704 ---------
8705 !! html
8706 <hr />
8707
8708 !! end
8709
8710 !! test
8711 Horizontal ruler -- does not collapse dashes on consecutive lines
8712 !! wikitext
8713 ----
8714 ----
8715 !! html
8716 <hr />
8717 <hr />
8718
8719 !! end
8720
8721 !! test
8722 Horizontal ruler -- <4 dashes render as plain text
8723 !! wikitext
8724 ---
8725 !! html
8726 <p>---
8727 </p>
8728 !! end
8729
8730 !! test
8731 Horizontal ruler -- Supports content following dashes on same line
8732 !! wikitext
8733 ---- Foo
8734 !! html
8735 <hr /> Foo
8736
8737 !! html+tidy
8738 <hr />
8739 <p>Foo</p>
8740 !! end
8741
8742 ###
8743 ### Block-level elements
8744 ###
8745 !! test
8746 Common list
8747 !! wikitext
8748 *Common list
8749 * item 2
8750 *item 3
8751 !! html
8752 <ul><li>Common list</li>
8753 <li> item 2</li>
8754 <li>item 3</li></ul>
8755
8756 !! end
8757
8758 !! test
8759 Numbered list
8760 !! wikitext
8761 #Numbered list
8762 #item 2
8763 # item 3
8764 !! html
8765 <ol><li>Numbered list</li>
8766 <li>item 2</li>
8767 <li> item 3</li></ol>
8768
8769 !! end
8770
8771 !! test
8772 Mixed list
8773 !! wikitext
8774 *Mixed list
8775 *# with numbers
8776 ** and bullets
8777 *# and numbers
8778 *bullets again
8779 **bullet level 2
8780 ***bullet level 3
8781 ***#Number on level 4
8782 **bullet level 2
8783 **#Number on level 3
8784 **#Number on level 3
8785 *#number level 2
8786 *Level 1
8787 *** Level 3
8788 #** Level 3, but ordered
8789 !! html
8790 <ul><li>Mixed list
8791 <ol><li> with numbers</li></ol>
8792 <ul><li> and bullets</li></ul>
8793 <ol><li> and numbers</li></ol></li>
8794 <li>bullets again
8795 <ul><li>bullet level 2
8796 <ul><li>bullet level 3
8797 <ol><li>Number on level 4</li></ol></li></ul></li>
8798 <li>bullet level 2
8799 <ol><li>Number on level 3</li>
8800 <li>Number on level 3</li></ol></li></ul>
8801 <ol><li>number level 2</li></ol></li>
8802 <li>Level 1
8803 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8804 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8805
8806 !! end
8807
8808 !! test
8809 1. Nested mixed wikitext and html list
8810 !! wikitext
8811 * hi
8812 * <ul><li>ho</li></ul>
8813 * hi
8814 ** ho
8815 !! html/php
8816 <ul><li> hi</li>
8817 <li> <ul><li>ho</li></ul></li>
8818 <li> hi
8819 <ul><li> ho</li></ul></li></ul>
8820
8821 !! html/parsoid
8822 <ul><li> hi</li>
8823 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
8824 <li> hi
8825 <ul><li> ho</li></ul></li></ul>
8826 !! end
8827
8828 !! test
8829 2. Nested mixed wikitext and html list (incompatible)
8830 !! wikitext
8831 ; hi
8832 : {{echo|<li>ho</li>}}
8833 !! html/php
8834 <dl><dt> hi</dt>
8835 <dd> <li>ho</li></dd></dl>
8836
8837 !! html/parsoid
8838 <dl><dt> hi</dt>
8839 <dd> <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>ho&lt;/li>"}},"i":0}}]}'>ho</li></dd></dl>
8840 !! end
8841
8842 !! test
8843 Nested lists 1
8844 !! wikitext
8845 *foo
8846 **bar
8847 !! html
8848 <ul><li>foo
8849 <ul><li>bar</li></ul></li></ul>
8850
8851 !! end
8852
8853 !! test
8854 Nested lists 2
8855 !! wikitext
8856 **foo
8857 *bar
8858 !! html
8859 <ul><li><ul><li>foo</li></ul></li>
8860 <li>bar</li></ul>
8861
8862 !! end
8863
8864 !! test
8865 Nested lists 3 (first element empty)
8866 !! wikitext
8867 *
8868 **bar
8869 !! html
8870 <ul><li>
8871 <ul><li>bar</li></ul></li></ul>
8872
8873 !! end
8874
8875 !! test
8876 Nested lists 4 (first element empty)
8877 !! wikitext
8878 **
8879 *bar
8880 !! html
8881 <ul><li><ul><li></li></ul></li>
8882 <li>bar</li></ul>
8883
8884 !! end
8885
8886 !! test
8887 Nested lists 5 (both elements empty)
8888 !! wikitext
8889 **
8890 *
8891 !! html
8892 <ul><li><ul><li></li></ul></li>
8893 <li></li></ul>
8894
8895 !! end
8896
8897 !! test
8898 Nested lists 6 (both elements empty)
8899 !! wikitext
8900 *
8901 **
8902 !! html
8903 <ul><li>
8904 <ul><li></li></ul></li></ul>
8905
8906 !! end
8907
8908 !! test
8909 Nested lists 7 (skip initial nesting levels)
8910 !! wikitext
8911 *** foo
8912 !! html
8913 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8914
8915 !! end
8916
8917 !! test
8918 Nested lists 8 (multiple nesting transitions)
8919 !! wikitext
8920 * foo
8921 *** bar
8922 ** baz
8923 * boo
8924 !! html
8925 <ul><li> foo
8926 <ul><li><ul><li> bar</li></ul></li>
8927 <li> baz</li></ul></li>
8928 <li> boo</li></ul>
8929
8930 !! end
8931
8932 !! test
8933 Nested lists 9 (extension interaction)
8934 !! options
8935 parsoid
8936 !! wikitext
8937 *<references />
8938 !! html/parsoid
8939 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8940 !! end
8941
8942 !! test
8943 1. Lists with start-of-line-transparent tokens before bullets: Comments
8944 !! wikitext
8945 *foo
8946 *<!--cmt-->bar
8947 <!--cmt-->*baz
8948 !! html
8949 <ul><li>foo</li>
8950 <li>bar</li>
8951 <li>baz</li></ul>
8952
8953 !! end
8954
8955 !! test
8956 2. Lists with start-of-line-transparent tokens before bullets: Template close
8957 !! wikitext
8958 *foo {{echo|bar
8959 }}*baz
8960 !! html
8961 <ul><li>foo bar</li>
8962 <li>baz</li></ul>
8963
8964 !! end
8965
8966 !! test
8967 List items are not parsed correctly following a <pre> block (bug 785)
8968 !! wikitext
8969 * <pre>foo</pre>
8970 * <pre>bar</pre>
8971 * zar
8972 !! html/php
8973 <ul><li> <pre>foo</pre></li>
8974 <li> <pre>bar</pre></li>
8975 <li> zar</li></ul>
8976
8977 !! html/parsoid
8978 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8979 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8980 <li> zar</li></ul>
8981 !! end
8982
8983 !! test
8984 List items from template
8985 !! wikitext
8986
8987 {{inner list}}
8988 * item 2
8989
8990 * item 0
8991 {{inner list}}
8992 * item 2
8993
8994 * item 0
8995 * notSOL{{inner list}}
8996 * item 2
8997 !! html
8998 <ul><li> item 1</li>
8999 <li> item 2</li></ul>
9000 <ul><li> item 0</li>
9001 <li> item 1</li>
9002 <li> item 2</li></ul>
9003 <ul><li> item 0</li>
9004 <li> notSOL</li>
9005 <li> item 1</li>
9006 <li> item 2</li></ul>
9007
9008 !! end
9009
9010 !! test
9011 List interrupted by empty line or heading
9012 !! wikitext
9013 * foo
9014
9015 ** bar
9016 == A heading ==
9017 * Another list item
9018 !! html
9019 <ul><li> foo</li></ul>
9020 <ul><li><ul><li> bar</li></ul></li></ul>
9021 <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>
9022 <ul><li> Another list item</li></ul>
9023
9024 !!end
9025
9026 !!test
9027 Multiple list tags generated by templates
9028 !! wikitext
9029 {{echo|<li>}}a
9030 {{echo|<li>}}b
9031 {{echo|<li>}}c
9032 !! html
9033 <li>a
9034 <li>b
9035 <li>c</li>
9036 </li>
9037 </li>
9038
9039 !! html+tidy
9040 <ul>
9041 <li>a</li>
9042 <li>b</li>
9043 <li>c</li>
9044 </ul>
9045 !!end
9046
9047 !!test
9048 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9049 !! wikitext
9050 *a
9051 <!--This line will NOT split the list-->
9052 *b
9053 <!--This line will NOT split the list either-->
9054 *c
9055 <!--foo--> <!----> <!--This line NOT split the list either-->
9056 *d
9057 !! html
9058 <ul><li>a</li>
9059 <li>b</li>
9060 <li>c</li>
9061 <li>d</li></ul>
9062
9063 !!end
9064
9065 !!test
9066 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9067 !! wikitext
9068 *a
9069 <!--This line will NOT split the list-->
9070 *b
9071 <!--This line will NOT split the list either-->
9072 *c
9073 <!--foo--> <!----> <!--This line NOT split the list
9074 either-->
9075 *d
9076 !! html
9077 <ul><li>a</li>
9078 <li>b</li>
9079 <li>c</li>
9080 <li>d</li></ul>
9081
9082 !!end
9083
9084 !!test
9085 Test the li-hack
9086 (The PHP parser relies on Tidy for the hack)
9087 !!options
9088 parsoid=wt2html,wt2wt
9089 !! wikitext
9090 * foo
9091 * <li>li-hack
9092 * {{echo|<li>templated li-hack}}
9093 * <!--foo--> <li> unsupported li-hack with preceding comments
9094
9095 <ul>
9096 <li><li>not a li-hack
9097 </li>
9098 </ul>
9099 !! html+tidy
9100 <ul>
9101 <li>foo</li>
9102 <li>li-hack</li>
9103 <li>templated li-hack</li>
9104 <li>unsupported li-hack with preceding comments</li>
9105 </ul>
9106 <ul>
9107 <li>not a li-hack</li>
9108 </ul>
9109 !!end
9110
9111 !! test
9112 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9113 !! options
9114 parsoid
9115 !! wikitext
9116 # foo
9117 ## bar
9118 * foo
9119 ** bar
9120 : foo
9121 :: bar
9122 !! html
9123 <ol>
9124 <li> foo<ol>
9125 <li> bar</li>
9126 </ol></li>
9127 </ol><ul>
9128 <li> foo<ul>
9129 <li> bar</li>
9130 </ul></li>
9131 </ul><dl>
9132 <dd> foo<dl>
9133 <dd> bar</dd>
9134 </dl></dd>
9135 </dl>
9136 !! end
9137
9138 !! test
9139 Parsoid: Test of whitespace serialization with Templated bullets
9140 !! options
9141 parsoid
9142 !! wikitext
9143 * {{bullet}}
9144 !! html
9145 <ul>
9146 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9147 </ul>
9148 !! end
9149
9150 # ------------------------------------------------------------------------
9151 # The next set of tests are about Parsoid's ability to handle badly nested
9152 # tags (parse, minimize scope of fixup, and roundtrip back)
9153 # ------------------------------------------------------------------------
9154
9155 !! test
9156 Unbalanced closing block tags break a list
9157 (php parser relies on Tidy to fix up)
9158 !! wikitext
9159 <div>
9160 *a</div><div>
9161 *b</div>
9162 !! html+tidy
9163 <div>
9164 <ul>
9165 <li>a</li>
9166 </ul>
9167 </div>
9168 <div>
9169 <ul>
9170 <li>b</li>
9171 </ul>
9172 </div>
9173 !! end
9174
9175 # Parsoid fails this test, but it might be tricky to support properly.
9176 # See bug 68395.
9177 !! test
9178 Unbalanced closing non-block tags don't break a list
9179 (php parser relies on Tidy to fix up)
9180 !! wikitext
9181 <span>
9182 *a</span><span>
9183 *b</span>
9184 !! html/php+tidy
9185 <ul>
9186 <li><span>a</span></li>
9187 <li><span>b</span></li>
9188 </ul>
9189 !! html/parsoid
9190 <span>
9191 <ul>
9192 <li>a<span></span>
9193 </li>
9194 <li>b
9195 </li>
9196 </ul>
9197 </span>
9198 !! end
9199
9200 !! test
9201 Unclosed formatting tags that straddle lists are closed and reopened
9202 (php parser relies on Tidy to fix up)
9203 !! options
9204 parsoid=wt2html,wt2wt,html2html
9205 !! wikitext
9206 # <s> a
9207 # b </s>
9208 !! html/php+tidy
9209 <ol>
9210 <li><s>a</s></li>
9211 <li><s>b</s></li>
9212 </ol>
9213 !! html/parsoid
9214 <ol><li> <s> a</s></li>
9215 <li><s> b </s></li></ol>
9216 !! end
9217
9218 # See bug 68395.
9219 !!test
9220 1. List embedded in a formatting tag
9221 !! wikitext
9222 <small>
9223 * foo
9224 </small>
9225 !! html/php+tidy
9226 <ul>
9227 <li><small>foo</small></li>
9228 </ul>
9229 !! html/parsoid
9230 <small>
9231 <ul>
9232 <li> foo</li>
9233 </ul>
9234 </small>
9235 !!end
9236
9237 ## Ugly Parsoid output here
9238 ## Not sure what the right output is.
9239 !!test
9240 2. List embedded in a formatting tag
9241 !! wikitext
9242 <small>
9243 *a
9244 *b</small>
9245 !! html/php+tidy
9246 <ul>
9247 <li><small>a</small></li>
9248 <li><small>b</small></li>
9249 </ul>
9250 !! html/parsoid
9251 <small></small>
9252 <ul><small>
9253 <li>a</li>
9254 </small>
9255 <li><small>b</small></li>
9256 </ul>
9257 !!end
9258
9259 # Ugly Parsoid and PHP parser output here
9260 # Not sure if we want to make this a test!
9261 #
9262 ## !!test
9263 ## 3. Unclosed formatting tags in list elements
9264 ## !! wikitext
9265 ## *<small>a
9266 ## *<small>b
9267 ## !! html/php+tidy
9268 ## <ul>
9269 ## <li><small>a</small></li>
9270 ## <li><small><small>b</small></small></li>
9271 ## </ul>
9272 ## !! html/parsoid
9273 ## <ul>
9274 ## <li><small>a</small></li>
9275 ## <small>
9276 ## <li><small>b</small></li>
9277 ## </small></ul>
9278 ## !!end
9279
9280 # This is a bug in the PHP parser + tidy combination.
9281 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9282 # and then fostered out of the table by tidy.)
9283 # We believe the Parsoid output to be correct.
9284 !! test
9285 Table with missing opening <tr> tag
9286 !! options
9287 parsoid=wt2html,wt2wt
9288 !! wikitext
9289 <table>
9290 <td>foo</td>
9291 </tr>
9292 </table>
9293 !! html+tidy
9294 <table>
9295 <tr>
9296 <td>foo</td>
9297 </tr>
9298 </table>
9299 !! end
9300
9301 ###
9302 ### Magic Words
9303 ###
9304
9305 # Note that the current date is hard-coded as
9306 # 1970-01-01T00:02:03Z (a Thursday)
9307 # when running parser tests. The timezone is also fixed to GMT, so
9308 # local date will be identical to current date.
9309
9310 !! test
9311 Magic Word: {{CURRENTDAY}}
9312 !! wikitext
9313 {{CURRENTDAY}}
9314 !! html
9315 <p>1
9316 </p>
9317 !! end
9318
9319 !! test
9320 Magic Word: {{CURRENTDAY2}}
9321 !! wikitext
9322 {{CURRENTDAY2}}
9323 !! html
9324 <p>01
9325 </p>
9326 !! end
9327
9328 !! test
9329 Magic Word: {{CURRENTDAYNAME}}
9330 !! wikitext
9331 {{CURRENTDAYNAME}}
9332 !! html
9333 <p>Thursday
9334 </p>
9335 !! end
9336
9337 !! test
9338 Magic Word: {{CURRENTDOW}}
9339 !! wikitext
9340 {{CURRENTDOW}}
9341 !! html
9342 <p>4
9343 </p>
9344 !! end
9345
9346 !! test
9347 Magic Word: {{CURRENTMONTH}}
9348 !! wikitext
9349 {{CURRENTMONTH}}
9350 !! html
9351 <p>01
9352 </p>
9353 !! end
9354
9355 !! test
9356 Magic Word: {{CURRENTMONTH1}}
9357 !! wikitext
9358 {{CURRENTMONTH1}}
9359 !! html
9360 <p>1
9361 </p>
9362 !! end
9363
9364 !! test
9365 Magic Word: {{CURRENTMONTHABBREV}}
9366 !! wikitext
9367 {{CURRENTMONTHABBREV}}
9368 !! html
9369 <p>Jan
9370 </p>
9371 !! end
9372
9373 !! test
9374 Magic Word: {{CURRENTMONTHNAME}}
9375 !! wikitext
9376 {{CURRENTMONTHNAME}}
9377 !! html
9378 <p>January
9379 </p>
9380 !! end
9381
9382 !! test
9383 Magic Word: {{CURRENTMONTHNAMEGEN}}
9384 !! wikitext
9385 {{CURRENTMONTHNAMEGEN}}
9386 !! html
9387 <p>January
9388 </p>
9389 !! end
9390
9391 !! test
9392 Magic Word: {{CURRENTTIME}}
9393 !! wikitext
9394 {{CURRENTTIME}}
9395 !! html
9396 <p>00:02
9397 </p>
9398 !! end
9399
9400 !! test
9401 Magic Word: {{CURRENTHOUR}}
9402 !! wikitext
9403 {{CURRENTHOUR}}
9404 !! html
9405 <p>00
9406 </p>
9407 !! end
9408
9409 !! test
9410 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9411 !! wikitext
9412 {{CURRENTWEEK}}
9413 !! html
9414 <p>1
9415 </p>
9416 !! end
9417
9418 !! test
9419 Magic Word: {{CURRENTYEAR}}
9420 !! wikitext
9421 {{CURRENTYEAR}}
9422 !! html
9423 <p>1970
9424 </p>
9425 !! end
9426
9427 !! test
9428 Magic Word: {{CURRENTTIMESTAMP}}
9429 !! wikitext
9430 {{CURRENTTIMESTAMP}}
9431 !! html
9432 <p>19700101000203
9433 </p>
9434 !! end
9435
9436 !! test
9437 Magic Words LOCAL (UTC)
9438 !! wikitext
9439 * {{LOCALMONTH}}
9440 * {{LOCALMONTH1}}
9441 * {{LOCALMONTHNAME}}
9442 * {{LOCALMONTHNAMEGEN}}
9443 * {{LOCALMONTHABBREV}}
9444 * {{LOCALDAY}}
9445 * {{LOCALDAY2}}
9446 * {{LOCALDAYNAME}}
9447 * {{LOCALYEAR}}
9448 * {{LOCALTIME}}
9449 * {{LOCALHOUR}}
9450 * {{LOCALWEEK}}
9451 * {{LOCALDOW}}
9452 * {{LOCALTIMESTAMP}}
9453 !! html
9454 <ul><li> 01</li>
9455 <li> 1</li>
9456 <li> January</li>
9457 <li> January</li>
9458 <li> Jan</li>
9459 <li> 1</li>
9460 <li> 01</li>
9461 <li> Thursday</li>
9462 <li> 1970</li>
9463 <li> 00:02</li>
9464 <li> 00</li>
9465 <li> 1</li>
9466 <li> 4</li>
9467 <li> 19700101000203</li></ul>
9468
9469 !! end
9470
9471 !! test
9472 Magic Word: {{FULLPAGENAME}}
9473 !! options
9474 title=[[User:Ævar Arnfjörð Bjarmason]]
9475 !! wikitext
9476 {{FULLPAGENAME}}
9477 !! html
9478 <p>User:Ævar Arnfjörð Bjarmason
9479 </p>
9480 !! end
9481
9482 !! test
9483 Magic Word: {{FULLPAGENAMEE}}
9484 !! options
9485 title=[[User:Ævar Arnfjörð Bjarmason]]
9486 !! wikitext
9487 {{FULLPAGENAMEE}}
9488 !! html
9489 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9490 </p>
9491 !! end
9492
9493 !! test
9494 Magic Word: {{TALKSPACE}}
9495 !! options
9496 title=[[User:Ævar Arnfjörð Bjarmason]]
9497 !! wikitext
9498 {{TALKSPACE}}
9499 !! html
9500 <p>User talk
9501 </p>
9502 !! end
9503
9504 !! test
9505 Magic Word: {{TALKSPACE}}, same namespace
9506 !! options
9507 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9508 !! wikitext
9509 {{TALKSPACE}}
9510 !! html
9511 <p>User talk
9512 </p>
9513 !! end
9514
9515 !! test
9516 Magic Word: {{TALKSPACE}}, main namespace
9517 !! options
9518 title=[[Parser Test]]
9519 !! wikitext
9520 {{TALKSPACE}}
9521 !! html
9522 <p>Talk
9523 </p>
9524 !! end
9525
9526 !! test
9527 Magic Word: {{TALKSPACEE}}
9528 !! options
9529 title=[[User:Ævar Arnfjörð Bjarmason]]
9530 !! wikitext
9531 {{TALKSPACEE}}
9532 !! html
9533 <p>User_talk
9534 </p>
9535 !! end
9536
9537 !! test
9538 Magic Word: {{SUBJECTSPACE}}
9539 !! options
9540 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9541 !! wikitext
9542 {{SUBJECTSPACE}}
9543 !! html
9544 <p>User
9545 </p>
9546 !! end
9547
9548 !! test
9549 Magic Word: {{SUBJECTSPACE}}, same namespace
9550 !! options
9551 title=[[User:Ævar Arnfjörð Bjarmason]]
9552 !! wikitext
9553 {{SUBJECTSPACE}}
9554 !! html
9555 <p>User
9556 </p>
9557 !! end
9558
9559 !! test
9560 Magic Word: {{SUBJECTSPACE}}, main namespace
9561 !! options
9562 title=[[Parser Test]]
9563 !! wikitext
9564 {{SUBJECTSPACE}}
9565 !! html
9566
9567 !! end
9568
9569 !! test
9570 Magic Word: {{SUBJECTSPACEE}}
9571 !! options
9572 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9573 !! wikitext
9574 {{SUBJECTSPACEE}}
9575 !! html
9576 <p>User
9577 </p>
9578 !! end
9579
9580 !! test
9581 Magic Word: {{NAMESPACE}}
9582 !! options
9583 title=[[User:Ævar Arnfjörð Bjarmason]]
9584 !! wikitext
9585 {{NAMESPACE}}
9586 !! html
9587 <p>User
9588 </p>
9589 !! end
9590
9591 !! test
9592 Magic Word: {{NAMESPACEE}}
9593 !! options
9594 title=[[User:Ævar Arnfjörð Bjarmason]]
9595 !! wikitext
9596 {{NAMESPACEE}}
9597 !! html
9598 <p>User
9599 </p>
9600 !! end
9601
9602 !! test
9603 Magic Word: {{NAMESPACENUMBER}}
9604 !! options
9605 title=[[User:Ævar Arnfjörð Bjarmason]]
9606 !! wikitext
9607 {{NAMESPACENUMBER}}
9608 !! html
9609 <p>2
9610 </p>
9611 !! end
9612
9613 !! test
9614 Magic Word: {{SUBPAGENAME}}
9615 !! options
9616 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9617 !! wikitext
9618 {{SUBPAGENAME}}
9619 !! html
9620 <p>sub ö
9621 </p>
9622 !! end
9623
9624 !! test
9625 Magic Word: {{SUBPAGENAMEE}}
9626 !! options
9627 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9628 !! wikitext
9629 {{SUBPAGENAMEE}}
9630 !! html
9631 <p>sub_%C3%B6
9632 </p>
9633 !! end
9634
9635 !! test
9636 Magic Word: {{ROOTPAGENAME}}
9637 !! options
9638 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9639 !! wikitext
9640 {{ROOTPAGENAME}}
9641 !! html
9642 <p>Ævar Arnfjörð Bjarmason
9643 </p>
9644 !! end
9645
9646 !! test
9647 Magic Word: {{ROOTPAGENAMEE}}
9648 !! options
9649 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9650 !! wikitext
9651 {{ROOTPAGENAMEE}}
9652 !! html
9653 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9654 </p>
9655 !! end
9656
9657 !! test
9658 Magic Word: {{BASEPAGENAME}}
9659 !! options
9660 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9661 !! wikitext
9662 {{BASEPAGENAME}}
9663 !! html
9664 <p>Ævar Arnfjörð Bjarmason
9665 </p>
9666 !! end
9667
9668 !! test
9669 Magic Word: {{BASEPAGENAMEE}}
9670 !! options
9671 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9672 !! wikitext
9673 {{BASEPAGENAMEE}}
9674 !! html
9675 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9676 </p>
9677 !! end
9678
9679 !! test
9680 Magic Word: {{TALKPAGENAME}}
9681 !! options
9682 title=[[User:Ævar Arnfjörð Bjarmason]]
9683 !! wikitext
9684 {{TALKPAGENAME}}
9685 !! html
9686 <p>User talk:Ævar Arnfjörð Bjarmason
9687 </p>
9688 !! end
9689
9690 !! test
9691 Magic Word: {{TALKPAGENAMEE}}
9692 !! options
9693 title=[[User:Ævar Arnfjörð Bjarmason]]
9694 !! wikitext
9695 {{TALKPAGENAMEE}}
9696 !! html
9697 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9698 </p>
9699 !! end
9700
9701 !! test
9702 Magic Word: {{SUBJECTPAGENAME}}
9703 !! options
9704 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9705 !! wikitext
9706 {{SUBJECTPAGENAME}}
9707 !! html
9708 <p>User:Ævar Arnfjörð Bjarmason
9709 </p>
9710 !! end
9711
9712 !! test
9713 Magic Word: {{SUBJECTPAGENAMEE}}
9714 !! options
9715 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9716 !! wikitext
9717 {{SUBJECTPAGENAMEE}}
9718 !! html
9719 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9720 </p>
9721 !! end
9722
9723 !! test
9724 Magic Word: {{NUMBEROFFILES}}
9725 !! wikitext
9726 {{NUMBEROFFILES}}
9727 !! html
9728 <p>6
9729 </p>
9730 !! end
9731
9732 !! test
9733 Magic Word: {{PAGENAME}}
9734 !! options
9735 title=[[User:Ævar Arnfjörð Bjarmason]]
9736 !! wikitext
9737 {{PAGENAME}}
9738 !! html
9739 <p>Ævar Arnfjörð Bjarmason
9740 </p>
9741 !! end
9742
9743 !! test
9744 Magic Word: {{PAGENAME}} with metacharacters
9745 !! options
9746 title=[['foo & bar = baz']]
9747 !! wikitext
9748 ''{{PAGENAME}}''
9749 !! html/php
9750 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9751 </p>
9752 !! html+tidy
9753 <p><i>'foo &amp; bar = baz'</i></p>
9754 !! end
9755
9756 !! test
9757 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9758 !! options
9759 title=[[*RFC 1234 http://example.com/]]
9760 !! wikitext
9761 {{PAGENAME}}
9762 !! html/php
9763 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9764 </p>
9765 !! html+tidy
9766 <p>*RFC 1234 http://example.com/</p>
9767 !! end
9768
9769 !! test
9770 Magic Word: {{PAGENAMEE}}
9771 !! options
9772 title=[[User:Ævar Arnfjörð Bjarmason]]
9773 !! wikitext
9774 {{PAGENAMEE}}
9775 !! html
9776 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9777 </p>
9778 !! end
9779
9780 !! test
9781 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9782 !! options
9783 title=[[*RFC 1234 http://example.com/]]
9784 !! wikitext
9785 {{PAGENAMEE}}
9786 !! html/php
9787 <p>&#42;RFC_1234_http&#58;//example.com/
9788 </p>
9789 !! html+tidy
9790 <p>*RFC_1234_http://example.com/</p>
9791 !! end
9792
9793 !! test
9794 Magic Word: {{REVISIONID}}
9795 !! wikitext
9796 {{REVISIONID}}
9797 !! html
9798 <p>1337
9799 </p>
9800 !! end
9801
9802 !! test
9803 Magic Word: {{SCRIPTPATH}}
9804 !! wikitext
9805 {{SCRIPTPATH}}
9806 !! html
9807
9808 !! end
9809
9810 !! test
9811 Magic Word: {{STYLEPATH}}
9812 !! wikitext
9813 {{STYLEPATH}}
9814 !! html
9815 <p>/skins
9816 </p>
9817 !! end
9818
9819 !! test
9820 Magic Word: {{SERVER}}
9821 !! wikitext
9822 {{SERVER}}
9823 !! html
9824 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9825 </p>
9826 !! end
9827
9828 !! test
9829 Magic Word: {{SERVERNAME}}
9830 !! wikitext
9831 {{SERVERNAME}}
9832 !! html
9833 <p>example.org
9834 </p>
9835 !! end
9836
9837 !! test
9838 Magic Word: {{SITENAME}}
9839 !! wikitext
9840 {{SITENAME}}
9841 !! html
9842 <p>MediaWiki
9843 </p>
9844 !! end
9845
9846 !! test
9847 Case-sensitive magic words, when cased differently, should just be template transclusions
9848 !! wikitext
9849 {{CurrentMonth}}
9850 {{currentday}}
9851 {{cURreNTweEK}}
9852 {{currentHour}}
9853 !! html
9854 <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>
9855 <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>
9856 <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>
9857 <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>
9858 </p>
9859 !! end
9860
9861 !! test
9862 Case-insensitive magic words should still work with weird casing.
9863 !! wikitext
9864 {{sErVeRNaMe}}
9865 {{LCFirst:AOEU}}
9866 {{ucFIRST:aoeu}}
9867 {{SERver}}
9868 !! html
9869 <p>example.org
9870 aOEU
9871 Aoeu
9872 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9873 </p>
9874 !! end
9875
9876 # From plwiki:PLOS_ONE
9877 !! test
9878 Parsoid: Page property magic word with magic word contents
9879 !! wikitext
9880 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9881 !! html/parsoid
9882 <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>"}]]}'/>
9883 !! end
9884
9885 !! test
9886 Parsoid: Template-generated DISPLAYTITLE
9887 !! wikitext
9888 {{{{echo|DISPLAYTITLE}}:Foo}}
9889 !! html/parsoid
9890 <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}}]}'/>
9891 !! end
9892
9893 !! test
9894 Namespace 1 {{ns:1}}
9895 !! wikitext
9896 {{ns:1}}
9897 !! html
9898 <p>Talk
9899 </p>
9900 !! end
9901
9902 !! test
9903 Namespace 1 {{ns:01}}
9904 !! wikitext
9905 {{ns:01}}
9906 !! html
9907 <p>Talk
9908 </p>
9909 !! end
9910
9911 !! test
9912 Namespace 0 {{ns:0}} (bug 4783)
9913 !! wikitext
9914 {{ns:0}}
9915 !! html
9916
9917 !! end
9918
9919 !! test
9920 Namespace 0 {{ns:00}} (bug 4783)
9921 !! wikitext
9922 {{ns:00}}
9923 !! html
9924
9925 !! end
9926
9927 !! test
9928 Namespace -1 {{ns:-1}}
9929 !! wikitext
9930 {{ns:-1}}
9931 !! html
9932 <p>Special
9933 </p>
9934 !! end
9935
9936 !! test
9937 Namespace User {{ns:User}}
9938 !! wikitext
9939 {{ns:User}}
9940 !! html
9941 <p>User
9942 </p>
9943 !! end
9944
9945 !! test
9946 Namespace User talk {{ns:User_talk}}
9947 !! wikitext
9948 {{ns:User_talk}}
9949 !! html
9950 <p>User talk
9951 </p>
9952 !! end
9953
9954 !! test
9955 Namespace User talk {{ns:uSeR tAlK}}
9956 !! wikitext
9957 {{ns:uSeR tAlK}}
9958 !! html
9959 <p>User talk
9960 </p>
9961 !! end
9962
9963 !! test
9964 Namespace File {{ns:File}}
9965 !! wikitext
9966 {{ns:File}}
9967 !! html
9968 <p>File
9969 </p>
9970 !! end
9971
9972 !! test
9973 Namespace File {{ns:Image}}
9974 !! wikitext
9975 {{ns:Image}}
9976 !! html
9977 <p>File
9978 </p>
9979 !! end
9980
9981 !! test
9982 Namespace (lang=de) Benutzer {{ns:User}}
9983 !! options
9984 language=de
9985 !! wikitext
9986 {{ns:User}}
9987 !! html
9988 <p>Benutzer
9989 </p>
9990 !! end
9991
9992 !! test
9993 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9994 !! options
9995 language=de
9996 !! wikitext
9997 {{ns:3}}
9998 !! html
9999 <p>Benutzer Diskussion
10000 </p>
10001 !! end
10002
10003
10004 !! test
10005 Urlencode
10006 !! wikitext
10007 {{urlencode:hi world?!}}
10008 {{urlencode:hi world?!|WIKI}}
10009 {{urlencode:hi world?!|PATH}}
10010 {{urlencode:hi world?!|QUERY}}
10011 !! html
10012 <p>hi+world%3F%21
10013 hi_world%3F!
10014 hi%20world%3F%21
10015 hi+world%3F%21
10016 </p>
10017 !! end
10018
10019 !! test
10020 Magic Word: prioritize type info over data-parsoid
10021 !! options
10022 parsoid=html2wt
10023 !! html/parsoid
10024 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10025 !! wikitext
10026 __FORCETOC__
10027 !! end
10028
10029 !! test
10030 Magic Word: serialize on separate line (parsoid)
10031 !! options
10032 parsoid=wt2wt,html2wt
10033 !! wikitext
10034 foo
10035 __NOTOC__
10036 bar
10037 !! html/parsoid
10038 foo<meta property="mw:PageProp/notoc"/>bar
10039 !! end
10040
10041 !! test
10042 Magic Word: rt non-english wikis
10043 !! options
10044 parsoid=wt2wt
10045 language=de
10046 !! wikitext
10047 __NOEDITSECTION__
10048 !! html/parsoid
10049 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10050 !! end
10051
10052 !!test
10053 __proto__ is treated as normal wikitext (T105997)
10054 !!wikitext
10055 __proto__
10056 !!html
10057 <p>__proto__
10058 </p>
10059 !!end
10060
10061 ###
10062 ### Magic links
10063 ###
10064 !! test
10065 Magic links: internal link to RFC (bug 479)
10066 !! wikitext
10067 [[RFC 123]]
10068 !! html/php
10069 <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>
10070 </p>
10071 !! html/parsoid
10072 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10073 !! end
10074
10075 !! test
10076 Magic links: RFC (bug 479)
10077 !! wikitext
10078 RFC 822
10079 !! html/php
10080 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10081 </p>
10082 !! html/parsoid
10083 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10084 !! end
10085
10086 !! test
10087 Magic links: RFC (bug 65278)
10088 !! wikitext
10089 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10090 !! html/php
10091 <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.
10092 </p>
10093 !! html/parsoid
10094 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10095 !! end
10096
10097 !! test
10098 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10099 !! wikitext
10100 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10101 RFC
10102 822
10103 !! html/php
10104 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10105 RFC
10106 822
10107 </p>
10108 !! html/parsoid
10109 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 822</a>
10110 RFC
10111 822</p>
10112 !! end
10113
10114 !! test
10115 Magic links: ISBN (bug 1937)
10116 !! wikitext
10117 ISBN 0-306-40615-2
10118 !! html/php
10119 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10120 </p>
10121 !! html/parsoid
10122 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10123 !! end
10124
10125 !! test
10126 Magic links: ISBN (bug 65278)
10127 !! wikitext
10128 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10129 !! html/php
10130 <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.
10131 </p>
10132 !! html/parsoid
10133 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
10134 !! end
10135
10136 !! test
10137 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10138 !! wikitext
10139 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10140 ISBN
10141 9780316098113
10142 ISBN 978
10143 0316098113
10144 !! html/php
10145 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10146 ISBN
10147 9780316098113
10148 ISBN 978
10149 0316098113
10150 </p>
10151 !! html/parsoid
10152 <p><a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 978<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>0<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>316<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span>09811<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>3</a>
10153 ISBN
10154 9780316098113
10155 ISBN 978
10156 0316098113</p>
10157 !! end
10158
10159 !! test
10160 Magic links: PMID incorrectly converts space to underscore
10161 !! wikitext
10162 PMID 1234
10163 !! html/php
10164 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10165 </p>
10166 !! html/parsoid
10167 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10168 !! end
10169
10170 !! test
10171 Magic links: PMID (bug 65278)
10172 !! wikitext
10173 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10174 !! html/php
10175 <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.
10176 </p>
10177 !! html/parsoid
10178 <p>This is <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.</p>
10179 !! end
10180
10181 !! test
10182 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10183 !! wikitext
10184 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10185 PMID
10186 1234
10187 !! html/php
10188 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10189 PMID
10190 1234
10191 </p>
10192 !! html/parsoid
10193 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 1234</a>
10194 PMID
10195 1234</p>
10196 !! end
10197
10198 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10199 # since these are ExtLinkText, not MagicLinkText
10200 !! test
10201 Magic links: use appropriate serialization for "almost" magic links.
10202 !! wikitext
10203 X[[Special:BookSources/0978739256|foo]]
10204
10205 X[//tools.ietf.org/html/rfc1234 foo]
10206 !! html/php
10207 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10208 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10209 </p>
10210 !! html/parsoid
10211 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10212 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10213 !! end
10214
10215 ###
10216 ### Templates
10217 ####
10218
10219 !! test
10220 Nonexistent template
10221 !! wikitext
10222 {{thistemplatedoesnotexist}}
10223 !! html
10224 <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>
10225 </p>
10226 !! end
10227
10228 !! test
10229 Template with invalid target containing tags
10230 !! wikitext
10231 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10232 !! html
10233 <p>{{a<b>b</b>|foo|a=b|a = b}}
10234 </p>
10235 !! end
10236
10237 !! test
10238 Template with invalid target containing unclosed tag
10239 !! wikitext
10240 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10241 !! html
10242 <p>{{a<b>|foo|a=b|a = b}}</b>
10243 </p>
10244 !! end
10245
10246 !! test
10247 Template with invalid target containing wikilink
10248 !! wikitext
10249 {{[[Main Page]]}}
10250 !! html/php
10251 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10252 </p>
10253 !! html/parsoid
10254 <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>
10255 !! end
10256
10257 !! test
10258 Template with just whitespace in it, bug #68421
10259 !! wikitext
10260 {{echo|{{ }}}}
10261 !! html/parsoid
10262 <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>
10263 !! end
10264
10265 !! article
10266 Template:test
10267 !! text
10268 This is a test template
10269 !! endarticle
10270
10271 !! test
10272 Simple template
10273 !! wikitext
10274 {{test}}
10275 !! html
10276 <p>This is a test template
10277 </p>
10278 !! end
10279
10280 !! test
10281 Template with explicit namespace
10282 !! wikitext
10283 {{Template:test}}
10284 !! html
10285 <p>This is a test template
10286 </p>
10287 !! end
10288
10289
10290 !! article
10291 Template:paramtest
10292 !! text
10293 This is a test template with parameter {{{param}}}
10294 !! endarticle
10295
10296 !! test
10297 Template parameter
10298 !! wikitext
10299 {{paramtest|param=foo}}
10300 !! html
10301 <p>This is a test template with parameter foo
10302 </p>
10303 !! end
10304
10305 !! article
10306 Template:paramtestnum
10307 !! text
10308 [[{{{1}}}|{{{2}}}]]
10309 !! endarticle
10310
10311 !! test
10312 Template unnamed parameter
10313 !! wikitext
10314 {{paramtestnum|Main Page|the main page}}
10315 !! html
10316 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10317 </p>
10318 !! end
10319
10320 !! article
10321 Template:templatesimple
10322 !! text
10323 (test)
10324 !! endarticle
10325
10326 !! article
10327 Template:templateredirect
10328 !! text
10329 #redirect [[Template:templatesimple]]
10330 !! endarticle
10331
10332 !! article
10333 Template:templateasargtestnum
10334 !! text
10335 {{{{{1}}}}}
10336 !! endarticle
10337
10338 !! article
10339 Template:templateasargtest
10340 !! text
10341 {{template{{{templ}}}}}
10342 !! endarticle
10343
10344 !! article
10345 Template:templateasargtest2
10346 !! text
10347 {{{{{templ}}}}}
10348 !! endarticle
10349
10350 !! test
10351 Template with template name as unnamed argument
10352 !! wikitext
10353 {{templateasargtestnum|templatesimple}}
10354 !! html
10355 <p>(test)
10356 </p>
10357 !! end
10358
10359 !! test
10360 Template with template name as argument
10361 !! wikitext
10362 {{templateasargtest|templ=simple}}
10363 !! html
10364 <p>(test)
10365 </p>
10366 !! end
10367
10368 !! test
10369 Template with template name as argument (2)
10370 !! wikitext
10371 {{templateasargtest2|templ=templatesimple}}
10372 !! html
10373 <p>(test)
10374 </p>
10375 !! end
10376
10377 !! article
10378 Template:templateasargtestdefault
10379 !! text
10380 {{{{{templ|templatesimple}}}}}
10381 !! endarticle
10382
10383 !! article
10384 Template:templa
10385 !! text
10386 '''templ'''
10387 !! endarticle
10388
10389 !! test
10390 Template with default value
10391 !! wikitext
10392 {{templateasargtestdefault}}
10393 !! html
10394 <p>(test)
10395 </p>
10396 !! end
10397
10398 !! test
10399 Template with default value (value set)
10400 !! wikitext
10401 {{templateasargtestdefault|templ=templa}}
10402 !! html
10403 <p><b>templ</b>
10404 </p>
10405 !! end
10406
10407 !! test
10408 Template redirect
10409 !! wikitext
10410 {{templateredirect}}
10411 !! html/php
10412 <p>(test)
10413 </p>
10414 !! html/parsoid
10415 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10416 !! end
10417
10418 !! test
10419 Template with argument in separate line
10420 !! wikitext
10421 {{ templateasargtest |
10422 templ = simple }}
10423 !! html
10424 <p>(test)
10425 </p>
10426 !! end
10427
10428 !! test
10429 Template with complex template as argument
10430 !! wikitext
10431 {{paramtest|
10432 param ={{ templateasargtest |
10433 templ = simple }}}}
10434 !! html
10435 <p>This is a test template with parameter (test)
10436 </p>
10437 !! end
10438
10439 !! test
10440 Template with thumb image (with link in description)
10441 !! wikitext
10442 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10443 !! html/php
10444 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>
10445
10446 !! html+tidy
10447 <p>This is a test template with parameter</p>
10448 <div class="thumb tright">
10449 <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>
10450 <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>
10451 </div>
10452 </div>
10453 !! html/parsoid
10454 <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>
10455 !! end
10456
10457 !! article
10458 Template:complextemplate
10459 !! text
10460 {{{1}}} {{paramtest|
10461 param ={{{param}}}}}
10462 !! endarticle
10463
10464 !! test
10465 Template with complex arguments
10466 !! wikitext
10467 {{complextemplate|
10468 param ={{ templateasargtest |
10469 templ = simple }}|[[Template:complextemplate|link]]}}
10470 !! html
10471 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10472 </p>
10473 !! end
10474
10475 !! test
10476 BUG 553: link with two variables in a piped link
10477 !! wikitext
10478 {|
10479 |[[{{{1}}}|{{{2}}}]]
10480 |}
10481 !! html/php
10482 <table>
10483 <tr>
10484 <td>[[{{{1}}}|{{{2}}}]]
10485 </td></tr></table>
10486
10487 !! html/parsoid
10488 <table>
10489 <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-parsoid='{"src":"{{{1}}}"}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-parsoid='{"src":"{{{2}}}"}'>{{{2}}}</span>]]</td></tr>
10490 !! end
10491
10492 # See: T2553
10493 !! test
10494 Abort table cell attribute parsing on wikilink
10495 !! wikitext
10496 {|
10497 | testing [[one|two]] | three || four
10498 | testing one two | three || four
10499 |}
10500 !! html/php
10501 <table>
10502 <tr>
10503 <td> testing <a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a> | three </td>
10504 <td> four
10505 </td>
10506 <td> three </td>
10507 <td> four
10508 </td></tr></table>
10509
10510 !! html/parsoid
10511 <table>
10512 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> testing <a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a> | three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td>
10513 <td data-parsoid='{"a":{"testing":null,"one":null,"two":null},"sa":{"testing":"","one":"","two":""},"autoInsertedEnd":true}'> three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td></tr>
10514 </tbody></table>
10515 !! end
10516
10517 !! test
10518 Don't abort table cell attribute parsing if wikilink is found in template arg
10519 !! wikitext
10520 {|
10521 | Test {{#tag:ref|One two "[[three]]" four}}
10522 |}
10523 !! html/parsoid
10524 <table>
10525 <tbody><tr><td> Test <ref about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"#tag"},"params":{"1":{"wt":"One two \"[[three]]\" four"}},"i":0}}]}'>One two "<a rel="mw:WikiLink" href="./Three" title="Three">three</a>" four</ref></td></tr>
10526 </tbody></table>
10527 !! end
10528
10529 !! test
10530 Magic variable as template parameter
10531 !! wikitext
10532 {{paramtest|param={{SITENAME}}}}
10533 !! html
10534 <p>This is a test template with parameter MediaWiki
10535 </p>
10536 !! end
10537
10538 !! article
10539 Template:linktest
10540 !! text
10541 [[{{{param}}}|link]]
10542 !! endarticle
10543
10544 !! test
10545 Template parameter as link source
10546 !! wikitext
10547 {{linktest|param=Main Page}}
10548 !! html
10549 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10550 </p>
10551 !! end
10552
10553 !!article
10554 Template:paramtest2
10555 !! text
10556 including another template, {{paramtest|param={{{arg}}}}}
10557 !! endarticle
10558
10559 !! test
10560 Template passing argument to another template
10561 !! wikitext
10562 {{paramtest2|arg='hmm'}}
10563 !! html
10564 <p>including another template, This is a test template with parameter 'hmm'
10565 </p>
10566 !! end
10567
10568 !! article
10569 Template:Linktest2
10570 !! text
10571 Main Page
10572 !! endarticle
10573
10574 !! test
10575 Template as link source
10576 !! wikitext
10577 [[{{linktest2}}]]
10578
10579 [[{{linktest2}}|Main Page]]
10580
10581 [[{{linktest2}}]]Page
10582 !! html
10583 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10584 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10585 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10586 </p>
10587 !! end
10588
10589
10590 !! article
10591 Template:loop1
10592 !! text
10593 {{loop2}}
10594 !! endarticle
10595
10596 !! article
10597 Template:loop2
10598 !! text
10599 {{loop1}}
10600 !! endarticle
10601
10602 !! test
10603 Template infinite loop
10604 !! wikitext
10605 {{loop1}}
10606 !! html
10607 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10608 </p>
10609 !! end
10610
10611 !! test
10612 Template from main namespace
10613 !! wikitext
10614 {{:Main Page}}
10615 !! html
10616 <p>blah blah
10617 </p>
10618 !! end
10619
10620 !! article
10621 Template:table
10622 !! text
10623 {|
10624 | 1 || 2
10625 |-
10626 | 3 || 4
10627 |}
10628 !! endarticle
10629
10630 !! test
10631 BUG 529: Template with table, not included at beginning of line
10632 !! wikitext
10633 foo {{table}}
10634 !! html
10635 <p>foo
10636 </p>
10637 <table>
10638 <tr>
10639 <td> 1 </td>
10640 <td> 2
10641 </td></tr>
10642 <tr>
10643 <td> 3 </td>
10644 <td> 4
10645 </td></tr></table>
10646
10647 !! end
10648
10649 !! test
10650 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10651 !! wikitext
10652 foo
10653 {{table}}
10654 !! html
10655 <p>foo
10656 </p>
10657 <table>
10658 <tr>
10659 <td> 1 </td>
10660 <td> 2
10661 </td></tr>
10662 <tr>
10663 <td> 3 </td>
10664 <td> 4
10665 </td></tr></table>
10666
10667 !! end
10668
10669 !! test
10670 BUG 41: Template parameters shown as broken links
10671 !! wikitext
10672 {{{parameter}}}
10673 !! html
10674 <p>{{{parameter}}}
10675 </p>
10676 !! end
10677
10678 !! test
10679 Template with targets containing wikilinks
10680 !! wikitext
10681 {{[[foo]]}}
10682
10683 {{[[{{echo|foo}}]]}}
10684
10685 {{{{echo|[[foo}}]]}}
10686 !! html
10687 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10688 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10689 </p><p>{{[[foo}}]]
10690 </p>
10691 !! end
10692
10693 !! article
10694 Template:''
10695 !! text
10696 bar
10697 !! endarticle
10698
10699 !! test
10700 Templates: Double quotes as template target
10701 !! wikitext
10702 foo {{''}} baz
10703 !! html/php
10704 <p>foo bar baz
10705 </p>
10706 !! html/parsoid
10707 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10708 </p>
10709 !! end
10710
10711 ## This test is about making sure Parsoid's data-mw is well formed in the
10712 ## face of multiple templates with intersecting and overlapping ranges. The
10713 ## wikitext itself is wretched.
10714 !! test
10715 Templates with intersecting and overlapping ranges
10716 !! wikitext
10717 {|{{echo|
10718 <p>ha</p>}}
10719 {|{{echo|
10720 <p>ho</p>}}
10721 {{echo|{{!}}hi}}
10722 |}
10723 !! html/php+tidy
10724 <p>ha</p>
10725 <p>ho</p>
10726 <table>
10727 <tr>
10728 <td></td>
10729 </tr>
10730 <tr>
10731 <td>hi</td>
10732 </tr>
10733 </table>
10734 <table>
10735 <tr>
10736 <td></td>
10737 </tr>
10738 </table>
10739 !! html/parsoid
10740 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}]],"firstWikitextNode":"table"}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ha&lt;/p>"}},"i":0}},"\n","{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ho&lt;/p>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}}hi"}},"i":2}},"\n|}"]}'>ha</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
10741
10742 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
10743
10744 <tbody><tr><td>hi</td></tr>
10745 </tbody></table>
10746 !! end
10747
10748 !! article
10749 Template:MSGNW test
10750 !! text
10751 ''None'' of '''this''' should be
10752 * interpreted
10753 but rather passed unmodified
10754 {{test}}
10755 <gallery>
10756 File:Foobar.jpg
10757 </gallery>
10758 <!-- comment -->
10759 !! endarticle
10760
10761 # hmm, fix this or just deprecate msgnw and document its behavior?
10762 !! test
10763 msgnw keyword
10764 !! wikitext
10765 {{msgnw:MSGNW test}}
10766 !! html/php
10767 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10768 &#42; interpreted
10769 &#32;but rather passed unmodified
10770 &#123;&#123;test&#125;&#125;
10771 &#60;gallery&#62;
10772 File:Foobar.jpg
10773 &#60;/gallery&#62;
10774 &#60;!-- comment --&#62;
10775 </p>
10776 !! end
10777
10778 !! test
10779 int keyword
10780 !! wikitext
10781 {{int:youhavenewmessages|lots of money|not!}}
10782 !! html
10783 <p>You have lots of money (not!).
10784 </p>
10785 !! end
10786
10787 !! test
10788 int keyword - non-existing message
10789 !! wikitext
10790 {{int:var}}
10791 !! html
10792 <p>&lt;var&gt;
10793 </p>
10794 !! end
10795
10796 !! article
10797 Template:Includes
10798 !! text
10799 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10800 !! endarticle
10801
10802 !! test
10803 <includeonly> and <noinclude> being included
10804 !! wikitext
10805 {{Includes}}
10806 !! html
10807 <p>Foobar
10808 </p>
10809 !! end
10810
10811 !! article
10812 Template:Includes2
10813 !! text
10814 <onlyinclude>Foo</onlyinclude>bar
10815 !! endarticle
10816
10817 !! test
10818 <onlyinclude> being included
10819 !! wikitext
10820 {{Includes2}}
10821 !! html
10822 <p>Foo
10823 </p>
10824 !! end
10825
10826
10827 !! article
10828 Template:Includes3
10829 !! text
10830 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10831 !! endarticle
10832
10833 !! test
10834 <onlyinclude> and <includeonly> being included
10835 !! wikitext
10836 {{Includes3}}
10837 !! html
10838 <p>Foo
10839 </p>
10840 !! end
10841
10842 !! test
10843 <includeonly> and <noinclude> on a page
10844 !! wikitext
10845 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10846 !! html
10847 <p>Foozar
10848 </p>
10849 !! end
10850
10851 !! test
10852 Un-closed <noinclude>
10853 !! wikitext
10854 <noinclude>
10855 !! html
10856 !! end
10857
10858 !! test
10859 <onlyinclude> on a page
10860 !! wikitext
10861 <onlyinclude>Foo</onlyinclude>bar
10862 !! html
10863 <p>Foobar
10864 </p>
10865 !! end
10866
10867 !! test
10868 Un-closed <onlyinclude>
10869 !! wikitext
10870 <onlyinclude>
10871 !! html
10872 !! end
10873
10874 !!test
10875 Self-closed noinclude, includeonly, onlyinclude tags
10876 !! wikitext
10877 <noinclude />
10878 <includeonly />
10879 <onlyinclude />
10880 !! html
10881 <p><br />
10882 </p>
10883 !!end
10884
10885 !!test
10886 Unbalanced includeonly and noinclude tags
10887 !! wikitext
10888 {|
10889 |a</noinclude>
10890 |b</noinclude></noinclude>
10891 |c</noinclude></includeonly>
10892 |d</includeonly></includeonly>
10893 |}
10894 !! html
10895 <table>
10896 <tr>
10897 <td>a
10898 </td>
10899 <td>b
10900 </td>
10901 <td>c&lt;/includeonly&gt;
10902 </td>
10903 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10904 </td></tr></table>
10905
10906 !!end
10907
10908 !! article
10909 Template:Includeonly section
10910 !! text
10911 <includeonly>
10912 ==Includeonly section==
10913 </includeonly>
10914 ==Section T-1==
10915 !!endarticle
10916
10917 !! test
10918 Bug 6563: Edit link generation for section shown by <includeonly>
10919 !! wikitext
10920 {{includeonly section}}
10921 !! html
10922 <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>
10923 <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>
10924
10925 !! end
10926
10927 # Uses same input as the contents of [[Template:Includeonly section]]
10928 !! test
10929 Bug 6563: Section extraction for section shown by <includeonly>
10930 !! options
10931 section=T-2
10932 !! wikitext
10933 <includeonly>
10934 ==Includeonly section==
10935 </includeonly>
10936 ==Section T-2==
10937 !! html
10938 ==Section T-2==
10939 !! end
10940
10941 !! test
10942 Bug 6563: Edit link generation for section suppressed by <includeonly>
10943 !! wikitext
10944 <includeonly>
10945 ==Includeonly section==
10946 </includeonly>
10947 ==Section 1==
10948 !! html
10949 <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>
10950
10951 !! end
10952
10953 !! test
10954 Bug 6563: Section extraction for section suppressed by <includeonly>
10955 !! options
10956 section=1
10957 !! wikitext
10958 <includeonly>
10959 ==Includeonly section==
10960 </includeonly>
10961 ==Section 1==
10962 !! html
10963 ==Section 1==
10964 !! end
10965
10966 !! test
10967 Un-closed <includeonly>
10968 !! wikitext
10969 <includeonly>
10970 !! html
10971 !! end
10972
10973 ## We used to, but no longer wt2wt this test since the default serializer
10974 ## will normalize the include directives to serialize on their own line.
10975 ## Selser will take care of preserving formatting in scenarios where they
10976 ## intermingled with other wikitext.
10977 !! test
10978 Includes and comments at SOL
10979 !! options
10980 parsoid=wt2html,html2html
10981 !! wikitext
10982 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10983
10984 <noinclude>
10985 some
10986 </noinclude>* stuff
10987 * here
10988
10989 <includeonly>can have stuff</includeonly>=== here ===
10990
10991 !! html/php
10992 <h2><span class="mw-headline" id="hu">hu</span></h2>
10993 <p>some
10994 </p>
10995 <ul><li> stuff</li>
10996 <li> here</li></ul>
10997 <h3><span class="mw-headline" id="here">here</span></h3>
10998
10999 !! html/parsoid
11000 <!-- 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>
11001
11002 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11003 <p>some</p>
11004 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11005 <li> here</li></ul>
11006
11007 <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>
11008
11009 !! end
11010
11011 # TODO: test with DOM fragment reuse!
11012 !! test
11013 Parsoid: DOM fragment reuse
11014 !! options
11015 parsoid=wt2wt,wt2html
11016 !! wikitext
11017 a{{echo|b<table></table>c}}d
11018
11019 a{{echo|b
11020 <table></table>
11021 c}}d
11022
11023 {{echo|a
11024
11025 <table></table>
11026
11027 b}}
11028 !! html
11029 <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>
11030
11031 <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">
11032 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11033 </span><p about="#mwt2">cd</p>
11034
11035 <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">
11036
11037 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11038
11039 </span><p about="#mwt3">b</p>
11040 !! end
11041
11042 !! test
11043 Parsoid: Merge double tds (T52603)
11044 !! options
11045 parsoid
11046 !! wikitext
11047 {|
11048 |{{echo|{{!}} foo}}
11049 |}
11050 !! html
11051 <table><tbody>
11052 <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>
11053 </tbody></table>
11054 !! end
11055
11056 !! test
11057 Parsoid: Merge double tds in nested transclusion content (T52603)
11058 !! options
11059 parsoid
11060 !! wikitext
11061 {{echo|<div>}}
11062 {|
11063 |{{echo|{{!}} foo}}
11064 |}
11065 {{echo|</div>}}
11066 !! html
11067 <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}}]}'>
11068 <table><tbody>
11069 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11070 </tbody></table>
11071 </div>
11072 !! end
11073
11074 ###
11075 ### <includeonly> and <noinclude> in attributes
11076 ###
11077 !!test
11078 0. includeonly around the entire attribute
11079 !! wikitext
11080 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11081 !! html
11082 <p><span id="v2">bar</span>
11083 </p>
11084 !!end
11085
11086 !!test
11087 1. includeonly in html attr key
11088 !! wikitext
11089 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11090 !! html
11091 <p><span id="foo">bar</span>
11092 </p>
11093 !!end
11094
11095 !!test
11096 2. includeonly in html attr value
11097 !! wikitext
11098 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11099 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11100 !! html
11101 <p><span id="v1">bar</span>
11102 <span id="v1">bar</span>
11103 </p>
11104 !!end
11105
11106 !!test
11107 3. includeonly in part of an attr value
11108 !! wikitext
11109 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11110 !! html
11111 <p><span style="color:red;">bar</span>
11112 </p>
11113 !!end
11114
11115 !!test
11116 4. includeonly in table attributes
11117 !! wikitext
11118 {|
11119 |- <noinclude>
11120 |-
11121 |a
11122 </noinclude>
11123 |- <includeonly>
11124 |-
11125 |b
11126 </includeonly>
11127 |}
11128 !! html
11129 <table>
11130
11131
11132 <tr>
11133 <td>a
11134 </td></tr>
11135 </table>
11136
11137 !!end
11138
11139 ###
11140 ### Token Stream Patcher tests
11141 ###
11142 ### These tests won't always pass wt2wt and other modes because
11143 ### on serialization, the table will be output on a new line.
11144 ### For now, we are blacklisting them, and using this to test selser.
11145 ###
11146
11147 !!test
11148 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11149 !!options
11150 parsoid=wt2html,wt2wt
11151 !!wikitext
11152 {{echo|}}{| width = '100%'
11153 |foo
11154 |}
11155 !!html/parsoid
11156 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11157 <tbody><tr><td>foo</td></tr>
11158 </tbody></table>
11159 !!end
11160
11161 ## We used to, but no longer wt2wt this test since the default serializer
11162 ## will normalize the include directives to serialize on their own line.
11163 ## Selser will take care of preserving formatting in scenarios where they
11164 ## intermingled with other wikitext.
11165 !!test
11166 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11167 !!options
11168 parsoid=wt2html
11169 !!wikitext
11170 <includeonly>a</includeonly>{| {{{b}}}
11171 |c
11172 |}
11173 !!html/parsoid
11174 <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}}}":""}}'>
11175 <tbody><tr><td>c</td></tr>
11176 </tbody></table>
11177
11178 !!end
11179
11180 ###
11181 ### Testing parsing of templates where a template arg
11182 ### has the same name as the template itself.
11183 ###
11184
11185 !! article
11186 Template:quote
11187 !! text
11188 {{{quote|{{{1}}}}}}
11189 !! endarticle
11190
11191 !!test
11192 Templates: Template Name/Arg clash: 1. Use of positional param
11193 !! wikitext
11194 {{quote|foo}}
11195 !! html
11196 <p>foo
11197 </p>
11198 !!end
11199
11200 !!test
11201 Templates: Template Name/Arg clash: 2. Use of named param
11202 !! wikitext
11203 {{quote|quote=foo}}
11204 !! html
11205 <p>foo
11206 </p>
11207 !!end
11208
11209 !!test
11210 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11211 !! wikitext
11212 {{quote|quote}}
11213 !! html
11214 <p>quote
11215 </p>
11216 !!end
11217
11218 ###
11219 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11220 ###
11221
11222 !!test
11223 Templates: 1. Simple use
11224 !! wikitext
11225 {{echo|Foo}}
11226 !! html
11227 <p>Foo
11228 </p>
11229 !!end
11230
11231 !!test
11232 Templates: 2. Inside a block tag
11233 !! wikitext
11234 <div>{{echo|Foo}}</div>
11235 <blockquote>{{echo|Foo}}</blockquote>
11236 !! html
11237 <div>Foo</div>
11238 <blockquote>Foo</blockquote>
11239
11240 !! html+tidy
11241 <div>Foo</div>
11242 <blockquote>
11243 <p>Foo</p>
11244 </blockquote>
11245 !!end
11246
11247 !!test
11248 Templates: P-wrapping: 1a. Templates on consecutive lines
11249 !! wikitext
11250 {{echo|Foo}}
11251 {{echo|bar}}
11252 !! html
11253 <p>Foo
11254 bar
11255 </p>
11256 !!end
11257
11258 !!test
11259 Templates: P-wrapping: 1b. Templates on consecutive lines
11260 !! wikitext
11261 Foo
11262
11263 {{echo|bar}}
11264 {{echo|baz}}
11265 !! html
11266 <p>Foo
11267 </p><p>bar
11268 baz
11269 </p>
11270 !!end
11271
11272 !!test
11273 Templates: P-wrapping: 1c. Templates on consecutive lines
11274 !! wikitext
11275 {{echo|Foo}}
11276 {{echo|bar}} <div>baz</div>
11277 !! html
11278 <p>Foo
11279 </p>
11280 bar <div>baz</div>
11281
11282 !! html+tidy
11283 <p>Foo</p>
11284 <p>bar</p>
11285 <div>baz</div>
11286 !! end
11287
11288 !!test
11289 Templates: P-wrapping: 1d. Template preceded by comment-only line
11290 !!options
11291 parsoid
11292 !! wikitext
11293 <!-- foo -->
11294 {{echo|Bar}}
11295 !! html
11296 <!-- foo -->
11297
11298 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11299 !!end
11300
11301 !!test
11302 Templates: Inline Text: 1. Multiple template uses
11303 !! wikitext
11304 {{echo|Foo}}bar{{echo|baz}}
11305 !! html
11306 <p>Foobarbaz
11307 </p>
11308 !!end
11309
11310 !!test
11311 Templates: Inline Text: 2. Back-to-back template uses
11312 !! wikitext
11313 {{echo|Foo}}{{echo|bar}}
11314 !! html
11315 <p>Foobar
11316 </p>
11317 !!end
11318
11319 !!test
11320 Templates: Block Tags: 1. Multiple template uses
11321 !! wikitext
11322 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11323 !! html
11324 <div>Foo</div><div>bar</div><div>baz</div>
11325
11326 !!end
11327
11328 !!test
11329 Templates: Block Tags: 2. Back-to-back template uses
11330 !! wikitext
11331 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11332 !! html
11333 <div>Foo</div><div>bar</div>
11334
11335 !!end
11336
11337 # This is an edge case relating to paragraph wrapping.
11338 !!test
11339 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11340 !! wikitext
11341 {{echo|a
11342 b</p>}}
11343 !! html/parsoid
11344 <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
11345 b</p>
11346 !!end
11347
11348 !!test
11349 Templates: Links: 1. Simple example
11350 !! wikitext
11351 {{echo|[[Foo|bar]]}}
11352 !! html
11353 <p><a href="/wiki/Foo" title="Foo">bar</a>
11354 </p>
11355 !!end
11356
11357 !!test
11358 Templates: Links: 2. Generation of link href
11359 !! wikitext
11360 [[{{echo|Foo}}|bar]]
11361 !! html
11362 <p><a href="/wiki/Foo" title="Foo">bar</a>
11363 </p>
11364 !!end
11365
11366 !!test
11367 Templates: Links: 3. Generation of part of a link href
11368 !! wikitext
11369 [[Fo{{echo|o}}|bar]]
11370
11371 [[Foo{{echo|bar}}]]
11372
11373 [[Foo{{echo|bar}}baz]]
11374
11375 [[Foo{{echo|bar}}|bar]]
11376
11377 [[:Foo{{echo|bar}}]]
11378
11379 [[:Foo{{echo|bar}}|bar]]
11380 !! html
11381 <p><a href="/wiki/Foo" title="Foo">bar</a>
11382 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11383 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11384 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11385 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11386 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11387 </p>
11388 !!end
11389
11390 !!test
11391 Templates: Links: 4. Multiple templates generating link href
11392 !! wikitext
11393 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11394 !! html
11395 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11396 </p>
11397 !!end
11398
11399 !!test
11400 Templates: Links: 5. Generation of link text
11401 !! wikitext
11402 [[Foo|{{echo|bar}}]]
11403 !! html
11404 <p><a href="/wiki/Foo" title="Foo">bar</a>
11405 </p>
11406 !!end
11407
11408 !!test
11409 Templates: Links: 5. Nested templates (only outermost template should be marked)
11410 !! wikitext
11411 {{echo|[[{{echo|Foo}}|bar]]}}
11412 !! html
11413 <p><a href="/wiki/Foo" title="Foo">bar</a>
11414 </p>
11415 !!end
11416
11417 !!test
11418 Templates: HTML Tag: 1. Generation of HTML attr. key
11419 !! wikitext
11420 <div {{echo|style}}="color:red;">foo</div>
11421 !! html
11422 <div style="color:red;">foo</div>
11423
11424 !!end
11425
11426 !!test
11427 Templates: HTML Tag: 2. Generation of HTML attr. value
11428 !! wikitext
11429 <div style={{echo|'color:red;'}}>foo</div>
11430 !! html
11431 <div style="color:red;">foo</div>
11432
11433 !!end
11434
11435 !!test
11436 Templates: HTML Tag: 3. Generation of HTML attr key and value
11437 !! wikitext
11438 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11439 !! html
11440 <div style="color:red;">foo</div>
11441
11442 !!end
11443
11444 !!test
11445 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11446 !! wikitext
11447 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11448 !! html
11449 <div title="This is a long title with just one piece templated">foo</div>
11450
11451 !!end
11452
11453 !!test
11454 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11455 !! wikitext
11456 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11457 !! html
11458 <div title="This is a long title with just one piece templated">foo</div>
11459
11460 !!end
11461
11462 !!test
11463 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11464 !! wikitext
11465 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11466 !! html
11467 <div title="This is a long title with just one piece templated">foo</div>
11468
11469 !!end
11470
11471 # SSS FIXME: While it is great we added support for all this,
11472 # do we want to make this part of the spec? Maybe we want to
11473 # deprecate this kind of usage in the future?
11474 !!test
11475 Templates: HTML Tag: 7. Generation of partial attribute key string
11476 !! wikitext
11477 <div st{{echo|yle}}="color:red;">foo</div>
11478 !! html
11479 <div style="color:red;">foo</div>
11480
11481 !!end
11482
11483 !! test
11484 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11485 !! wikitext
11486 <div {{echo|1=id="v1"}}>bar</div>
11487 !! html
11488 <div id="v1">bar</div>
11489
11490 !!end
11491
11492 !! test
11493 Templates: HTML Tag: 9. Multiple template-generated attributes
11494 !! wikitext
11495 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11496 !! html
11497 <div id="v1" title="foo">bar</div>
11498
11499 !!end
11500
11501 !! test
11502 Templates: Support for templates generating attributes and content
11503 !! wikitext
11504 {| {{mixed_attr_content_template}}
11505 |-
11506 |bar
11507 |}
11508 !! html/php
11509 <table style="color:red;" title="T48811">
11510
11511 <tr>
11512 <td>foo
11513 </td></tr>
11514 <tr>
11515 <td>bar
11516 </td></tr></table>
11517
11518 !! html/parsoid
11519 <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|}"]}'>
11520 <tbody><tr>
11521 <td>foo</td></tr>
11522 <tr>
11523 <td>bar</td></tr>
11524 </tbody></table>
11525 !!end
11526
11527 !! test
11528 1. Entities and nowikis inside templated attributes should be handled correctly
11529 !! wikitext
11530 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11531 !! html/php
11532 <div style="background:#f9f9f9;">foo</div>
11533
11534 !! html/parsoid
11535 <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>
11536 !! end
11537
11538 !! test
11539 2. Entities and nowikis inside templated attributes should be handled correctly
11540 !! wikitext
11541 {|
11542 |{{table_attribs_3}}
11543 |}
11544 !! html/php
11545 <table>
11546 <tr>
11547 <td style="background:#f9f9f9;">Foo
11548 </td></tr></table>
11549
11550 !! html/parsoid
11551 <table>
11552 <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>
11553 </tbody></table>
11554 !! end
11555
11556 !! test
11557 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11558 !! wikitext
11559 {{tbl-start}}
11560 |{{table_attribs_3}}
11561 {{tbl-end}}
11562 !! html/php
11563 <table>
11564 <tr>
11565 <td style="background:#f9f9f9;">Foo
11566 </td></tr></table>
11567
11568 !! html/parsoid
11569 <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}}]}'>
11570 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11571 </tbody></table>
11572 !! end
11573
11574 # T107622
11575 !! test
11576 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11577 !! wikitext
11578 {|
11579 | {{table_attribs_6}} hi
11580 |}
11581 !! html/php
11582 <table>
11583 <tr>
11584 <td style="background: red;"> hi
11585 </td></tr></table>
11586
11587 !! html/parsoid
11588 <table>
11589 <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>
11590 </tbody></table>
11591 !! end
11592
11593 !!test
11594 Templates: HTML Tables: 1. Generating start of a HTML table
11595 !! wikitext
11596 {{echo|<table><tr><td>foo</td>}}</tr></table>
11597 !! html
11598 <table><tr><td>foo</td></tr></table>
11599
11600 !!end
11601
11602 !!test
11603 Templates: HTML Tables: 2a. Generating middle of a HTML table
11604 !! wikitext
11605 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11606 !! html
11607 <table><tr><td>foo</td></tr></table>
11608
11609 !!end
11610
11611 !!test
11612 Templates: HTML Tables: 2b. Generating middle of a HTML table
11613 !! wikitext
11614 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11615 !! html
11616 <table><tr><td>foo</td></tr></table>
11617
11618 !!end
11619
11620 !!test
11621 Templates: HTML Tables: 3. Generating end of a HTML table
11622 !! wikitext
11623 <table><tr>{{echo|<td>foo</td></tr></table>}}
11624 !! html
11625 <table><tr><td>foo</td></tr></table>
11626
11627 !!end
11628
11629 !!test
11630 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11631 !! wikitext
11632 {{echo|<table>}}<tr><td>foo</td></tr></table>
11633 !! html
11634 <table><tr><td>foo</td></tr></table>
11635
11636 !!end
11637
11638 !!test
11639 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11640 !! wikitext
11641 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11642 !! html
11643 <table><tr><td>foo</td></tr></table>
11644
11645 !!end
11646
11647 !!test
11648 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11649 !! wikitext
11650 <table><tr>{{echo|<td>}}foo</td></tr></table>
11651 !! html
11652 <table><tr><td>foo</td></tr></table>
11653
11654 !!end
11655
11656 !!test
11657 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11658 !! wikitext
11659 <table><tr><td>foo{{echo|</td>}}</tr></table>
11660 !! html
11661 <table><tr><td>foo</td></tr></table>
11662
11663 !!end
11664
11665 !!test
11666 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11667 !! wikitext
11668 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11669 !! html
11670 <table><tr><td>foo</td></tr></table>
11671
11672 !!end
11673
11674 !!test
11675 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11676 !! wikitext
11677 <table><tr><td>foo</td></tr>{{echo|</table>}}
11678 !! html
11679 <table><tr><td>foo</td></tr></table>
11680
11681 !!end
11682
11683 !!test
11684 Templates: HTML Tables: 5. Proper fostering of categories from inside
11685 !!options
11686 parsoid=wt2html,wt2wt
11687 !! wikitext
11688 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11689 <!--Two categories (Bug 50330)-->
11690 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11691 !! html
11692 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11693 <!--Two categories (Bug 50330)-->
11694 <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>
11695 !!end
11696
11697 !!test
11698 Templates: Wiki Tables: 1a. Fostering of entire template content
11699 !! wikitext
11700 {|
11701 {{echo|a}}
11702 |}
11703 !! html
11704 <table>
11705 a
11706 <tr><td></td></tr></table>
11707
11708 !! html+tidy
11709 <p>a</p>
11710 <table>
11711 <tr>
11712 <td></td>
11713 </tr>
11714 </table>
11715 !! end
11716
11717 !!test
11718 Templates: Wiki Tables: 1b. Fostering of entire template content
11719 !! wikitext
11720 {|
11721 {{echo|<div>}}
11722 foo
11723 {{echo|</div>}}
11724 |}
11725 !! html
11726 <table>
11727 <div>
11728 <p>foo
11729 </p>
11730 </div>
11731 <tr><td></td></tr></table>
11732
11733 !! html+tidy
11734 <div>
11735 <p>foo</p>
11736 </div>
11737 <table>
11738 <tr>
11739 <td></td>
11740 </tr>
11741 </table>
11742 !! end
11743
11744 !!test
11745 Templates: Wiki Tables: 2. Fostering of partial template content
11746 !! wikitext
11747 {|
11748 {{echo|a
11749 <div>b</div>}}
11750 |}
11751 !! html
11752 <table>
11753 a
11754 <div>b</div>
11755 <tr><td></td></tr></table>
11756
11757 !! html+tidy
11758 <p>a</p>
11759 <div>b</div>
11760 <table>
11761 <tr>
11762 <td></td>
11763 </tr>
11764 </table>
11765 !! end
11766
11767 !!test
11768 Templates: Wiki Tables: 3. td-content via multiple templates
11769 !! wikitext
11770 {|
11771 {{echo|{{pipe}}a}}{{echo|b}}
11772 |}
11773 !! html
11774 <table>
11775 <tr>
11776 <td>ab
11777 </td></tr></table>
11778
11779 !!end
11780
11781 !!test
11782 Templates: Wiki Tables: 4. Templated tags, no content
11783 !! wikitext
11784 {{tbl-start}}
11785 {{tbl-end}}
11786 !! html
11787 <table>
11788 <tr><td></td></tr></table>
11789
11790 !!end
11791
11792 !!test
11793 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11794 !! wikitext
11795 {{tbl-start}}
11796 |foo
11797 {{tbl-end}}
11798 !! html
11799 <table>
11800 <tr>
11801 <td>foo
11802 </td></tr></table>
11803
11804 !!end
11805
11806 !!test
11807 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11808 !! wikitext
11809 {{tbl-start}}
11810 {{!}}foo
11811 {{tbl-end}}
11812 !! html
11813 <table>
11814 <tr>
11815 <td>foo
11816 </td></tr></table>
11817
11818 !!end
11819
11820 ## This test case is very specific to Parsoid's internals
11821 ## and is hence only tested for Parsoid's code. Parsoid uses
11822 ## a <meta> marker tag for <ref> tags and they are expanded
11823 ## much later. We are verifying that this <meta> tag usage
11824 ## doesn't prevent foster parenting.
11825 !!test
11826 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11827 !!wikitext
11828 {{PartialTable}}<ref>foo</ref>
11829 |}
11830
11831 <references />
11832 !!html/parsoid
11833 <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">
11834 <tbody>
11835 </tbody></table>
11836
11837 <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>
11838 !!end
11839
11840 !! test
11841 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11842 !! wikitext
11843 {{echo|
11844 {{{!}}
11845 {{!}}-}}
11846 <onlyinclude>
11847 |foo
11848 </onlyinclude>
11849 {{!}}}
11850 !! html/parsoid
11851 <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{{!}}}"]}'>
11852 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11853 <tbody><tr>
11854
11855 <td>foo
11856 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11857 </tbody></table>
11858 !! end
11859
11860 !!test
11861 Templates: Lists: Multi-line list-items via templates
11862 !! wikitext
11863 *{{echo|a {{nonexistent|
11864 unused}}}}
11865 *{{echo|b {{nonexistent|
11866 unused}}}}
11867 !! html
11868 <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>
11869 <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>
11870
11871 !!end
11872
11873 !!test
11874 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11875 !! wikitext
11876 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11877 !! html
11878 <p><i>ab</i>c<i>d</i>e
11879 </p>
11880 !!end
11881
11882 !!test
11883 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11884 (PHP parser generates misnested html)
11885 !! wikitext
11886 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11887 !! html/parsoid
11888 <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>
11889 !!end
11890
11891 !!test
11892 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11893 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11894 !! options
11895 parsoid=wt2html,wt2wt
11896 !! wikitext
11897 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11898 !! html
11899 <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>
11900 <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>
11901 <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>
11902 !!end
11903
11904 !!test
11905 Templates: Ugly nesting: 4. Divs opened/closed across templates
11906 !! wikitext
11907 a<div>b{{echo|c</div>d}}e
11908 !! html
11909 a<div>bc</div>de
11910
11911 !! html+tidy
11912 <p>a</p>
11913 <div>bc</div>
11914 <p>de</p>
11915 !! end
11916
11917 !!test
11918 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11919 (Parsoid-centric)
11920 !! options
11921 parsoid
11922 !! wikitext
11923 {|
11924 |{{echo|foo</table>}}
11925 |bar
11926 |}
11927 !! html
11928 <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|}"]}'>
11929
11930 <tbody>
11931 <tr>
11932 <td>foo</td></tr></tbody></table><span about="#mwt1">
11933 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11934 |}</span>
11935 !!end
11936
11937 !!test
11938 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11939 (Parsoid-centric)
11940 !! options
11941 parsoid
11942 !! wikitext
11943 <table>
11944 <tr>
11945 <td>
11946 <table>
11947 <tr>
11948 <td>1. {{echo|foo </table>}}</td>
11949 <td> bar </td>
11950 <td>2. {{echo|baz </table>}}</td>
11951 </tr>
11952 <tr>
11953 <td>abc</td>
11954 </tr>
11955 </table>
11956 </td>
11957 </tr>
11958 <tr>
11959 <td>xyz</td>
11960 </tr>
11961 </table>
11962 !! html
11963 <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>"]}'>
11964 <tbody><tr>
11965 <td>
11966 <table>
11967 <tbody><tr>
11968 <td>1. foo </td></tr></tbody></table></td>
11969 <td> bar </td>
11970 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11971 </span><span about="#mwt2">
11972 </span><span about="#mwt2">
11973 </span><span about="#mwt2">abc</span><span about="#mwt2">
11974 </span><span about="#mwt2">
11975 </span><span about="#mwt2">
11976 </span><span about="#mwt2">
11977 </span><span about="#mwt2">
11978 </span><span about="#mwt2">
11979 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11980 </span><span about="#mwt2">
11981 </span>
11982 !!end
11983
11984 !! test
11985 Templates: Ugly templates: 3. newline-only template parameter
11986 !! wikitext
11987 foo {{echo|
11988 }}
11989 !! html
11990 <p>foo
11991 </p>
11992 !! end
11993
11994 # This looks like a bug: a single newline triggers p/br for some reason.
11995 !! test
11996 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11997 !! wikitext
11998 {{echo|
11999 }}
12000 !! html
12001 <p><br />
12002 </p>
12003 !! end
12004
12005 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12006 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12007 !! test
12008 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12009 !! wikitext
12010 {{echo|<table>}}
12011 {{echo|<div>foo}}
12012 {{echo|</table>}}
12013 !! html/parsoid
12014 <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
12015 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12016 </table>
12017 !! end
12018
12019 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12020 # that are "identical" and generate nesting cycles in the algorithm
12021 !! test
12022 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12023 !! wikitext
12024 {{echo|<table><tr><td><table>}}
12025 {{echo|<div>}}
12026 {{echo|</div>}}
12027 !! html/parsoid
12028 <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"}'>
12029 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12030 </table></td></tr></tbody></table>
12031 !! end
12032
12033 !! test
12034 Templates: Parameters substituted at the top-level
12035 !! wikitext
12036 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12037 !! html/php
12038 <p><i>who</i> me? <b>never!</b>
12039 </p>
12040 !! html/parsoid
12041 <p about="#mwt2" typeof="mw:Param" data-parsoid="{&quot;src&quot;:&quot;{{{foo|''who'' {{echo|me}}? '''never!'''}}}&quot;}"><i>who</i> me? <b>never!</b></p>
12042 !! end
12043
12044 !!test
12045 Parser Functions: 1. Simple example
12046 !! wikitext
12047 {{uc:foo}}
12048 !! html
12049 <p>FOO
12050 </p>
12051 !!end
12052
12053 !!test
12054 Parser Functions: 2. Nested use (only outermost should be marked up)
12055 !! wikitext
12056 {{uc:{{lc:FOO}}}}
12057 !! html
12058 <p>FOO
12059 </p>
12060 !!end
12061
12062 ###
12063 ### Pre-save transform tests
12064 ###
12065 !! test
12066 pre-save transform: subst:
12067 !! options
12068 pst
12069 !! wikitext
12070 {{subst:test}}
12071 !! html/php
12072 This is a test template
12073 !! end
12074
12075 !! test
12076 pre-save transform: normal template
12077 !! options
12078 pst
12079 !! wikitext
12080 {{test}}
12081 !! html/php
12082 {{test}}
12083 !! end
12084
12085 !! test
12086 pre-save transform: nonexistent template
12087 !! options
12088 pst
12089 !! wikitext
12090 {{thistemplatedoesnotexist}}
12091 !! html/php
12092 {{thistemplatedoesnotexist}}
12093 !! end
12094
12095 !! test
12096 pre-save transform: subst magic variables
12097 !! options
12098 pst
12099 !! wikitext
12100 {{subst:SITENAME}}
12101 !! html/php
12102 MediaWiki
12103 !! end
12104
12105 # This is bug 89, which I fixed. -- wtm
12106 !! test
12107 pre-save transform: subst: templates with parameters
12108 !! options
12109 pst
12110 !! wikitext
12111 {{subst:paramtest|param="something else"}}
12112 !! html/php
12113 This is a test template with parameter "something else"
12114 !! end
12115
12116 !! article
12117 Template:nowikitest
12118 !! text
12119 <nowiki>'''not wiki'''</nowiki>
12120 !! endarticle
12121
12122 !! test
12123 pre-save transform: nowiki in subst (bug 1188)
12124 !! options
12125 pst
12126 !! wikitext
12127 {{subst:nowikitest}}
12128 !! html/php
12129 <nowiki>'''not wiki'''</nowiki>
12130 !! end
12131
12132 !! article
12133 Template:commenttest
12134 !! text
12135 This template has <!-- a comment --> in it.
12136 !! endarticle
12137
12138 !! test
12139 pre-save transform: comment in subst (bug 1936)
12140 !! options
12141 pst
12142 !! wikitext
12143 {{subst:commenttest}}
12144 !! html/php
12145 This template has <!-- a comment --> in it.
12146 !! end
12147
12148 !! test
12149 pre-save transform: unclosed tag
12150 !! options
12151 pst noxml
12152 !! wikitext
12153 <nowiki>'''not wiki'''
12154 !! html/php
12155 <nowiki>'''not wiki'''
12156 !! end
12157
12158 !! test
12159 pre-save transform: mixed tag case
12160 !! options
12161 pst noxml
12162 !! wikitext
12163 <NOwiki>'''not wiki'''</noWIKI>
12164 !! html/php
12165 <NOwiki>'''not wiki'''</noWIKI>
12166 !! end
12167
12168 !! test
12169 pre-save transform: unclosed comment in <nowiki>
12170 !! options
12171 pst noxml
12172 !! wikitext
12173 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12174 !! html/php
12175 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12176 !!end
12177
12178 # Leading @ in this template definition works around a limitation
12179 # in parsoid's parserTests which otherwise strips the <span> from the
12180 # result (confusing it for a template wrapper)
12181 !! article
12182 Template:dangerous
12183 !!text
12184 @<span onmouseover="alert('crap')">Oh no</span>
12185 !!endarticle
12186
12187 !!test
12188 (confirming safety of fix for subst bug 1936)
12189 !! wikitext
12190 {{Template:dangerous}}
12191 !! html
12192 <p>@<span>Oh no</span>
12193 </p>
12194 !! end
12195
12196 !! test
12197 pre-save transform: comment containing gallery (bug 5024)
12198 !! options
12199 pst
12200 !! wikitext
12201 <!-- <gallery>data</gallery> -->
12202 !! html/php
12203 <!-- <gallery>data</gallery> -->
12204 !!end
12205
12206 !! test
12207 pre-save transform: comment containing extension
12208 !! options
12209 pst
12210 !! wikitext
12211 <!-- <tag>data</tag> -->
12212 !! html/php
12213 <!-- <tag>data</tag> -->
12214 !!end
12215
12216 !! test
12217 pre-save transform: comment containing nowiki
12218 !! options
12219 pst
12220 !! wikitext
12221 <!-- <nowiki>data</nowiki> -->
12222 !! html/php
12223 <!-- <nowiki>data</nowiki> -->
12224 !!end
12225
12226 !! test
12227 pre-save transform: <noinclude> in subst (bug 3298)
12228 !! options
12229 pst
12230 !! wikitext
12231 {{subst:Includes}}
12232 !! html/php
12233 Foobar
12234 !! end
12235
12236 !! test
12237 pre-save transform: <onlyinclude> in subst (bug 3298)
12238 !! options
12239 pst
12240 !! wikitext
12241 {{subst:Includes2}}
12242 !! html/php
12243 Foo
12244 !! end
12245
12246 !! article
12247 Template:SubstTest
12248 !!text
12249 {{<includeonly>subst:</includeonly>Includes}}
12250 !! endarticle
12251
12252 !! article
12253 Template:SafeSubstTest
12254 !! text
12255 {{<includeonly>safesubst:</includeonly>Includes}}
12256 !! endarticle
12257
12258 !! test
12259 bug 22297: safesubst: works during PST
12260 !! options
12261 pst
12262 !! wikitext
12263 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12264 !! html/php
12265 FoobarFoobar
12266 !! end
12267
12268 !! test
12269 bug 22297: safesubst: works during normal parse
12270 !! wikitext
12271 {{SafeSubstTest}}
12272 !! html
12273 <p>Foobar
12274 </p>
12275 !! end
12276
12277 !! test
12278 subst: does not work during normal parse
12279 !! wikitext
12280 {{SubstTest}}
12281 !! html
12282 <p>{{subst:Includes}}
12283 </p>
12284 !! end
12285
12286 !! test
12287 pre-save transform: context links ("pipe trick")
12288 !! options
12289 pst
12290 !! wikitext
12291 [[Article (context)|]]
12292 [[Bar:Article|]]
12293 [[:Bar:Article|]]
12294 [[Bar:Article (context)|]]
12295 [[:Bar:Article (context)|]]
12296 [[|Article]]
12297 [[|Article (context)]]
12298 [[Bar:X (Y) Z|]]
12299 [[:Bar:X (Y) Z|]]
12300 !! html/php
12301 [[Article (context)|Article]]
12302 [[Bar:Article|Article]]
12303 [[:Bar:Article|Article]]
12304 [[Bar:Article (context)|Article]]
12305 [[:Bar:Article (context)|Article]]
12306 [[Article]]
12307 [[Article (context)]]
12308 [[Bar:X (Y) Z|X (Y) Z]]
12309 [[:Bar:X (Y) Z|X (Y) Z]]
12310 !! end
12311
12312 !! test
12313 pre-save transform: context links ("pipe trick") with interwiki prefix
12314 !! options
12315 pst
12316 !! wikitext
12317 [[interwiki:Article|]]
12318 [[:interwiki:Article|]]
12319 [[interwiki:Bar:Article|]]
12320 [[:interwiki:Bar:Article|]]
12321 !! html/php
12322 [[interwiki:Article|Article]]
12323 [[:interwiki:Article|Article]]
12324 [[interwiki:Bar:Article|Bar:Article]]
12325 [[:interwiki:Bar:Article|Bar:Article]]
12326 !! end
12327
12328 !! test
12329 pre-save transform: context links ("pipe trick") with parens in title
12330 !! options
12331 pst title=[[Somearticle (context)]]
12332 !! wikitext
12333 [[|Article]]
12334 !! html/php
12335 [[Article (context)|Article]]
12336 !! end
12337
12338 !! test
12339 pre-save transform: context links ("pipe trick") with comma in title
12340 !! options
12341 pst title=[[Someplace, Somewhere]]
12342 !! wikitext
12343 [[|Otherplace]]
12344 [[Otherplace, Elsewhere|]]
12345 [[Otherplace, Elsewhere, Anywhere|]]
12346 !! html/php
12347 [[Otherplace, Somewhere|Otherplace]]
12348 [[Otherplace, Elsewhere|Otherplace]]
12349 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12350 !! end
12351
12352 !! test
12353 pre-save transform: context links ("pipe trick") with parens and comma
12354 !! options
12355 pst title=[[Someplace (IGNORED), Somewhere]]
12356 !! wikitext
12357 [[|Otherplace]]
12358 [[Otherplace (place), Elsewhere|]]
12359 !! html/php
12360 [[Otherplace, Somewhere|Otherplace]]
12361 [[Otherplace (place), Elsewhere|Otherplace]]
12362 !! end
12363
12364 !! test
12365 pre-save transform: context links ("pipe trick") with comma and parens
12366 !! options
12367 pst title=[[Who, me? (context)]]
12368 !! wikitext
12369 [[|Yes, you.]]
12370 [[Me, Myself, and I (1937 song)|]]
12371 !! html/php
12372 [[Yes, you. (context)|Yes, you.]]
12373 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12374 !! end
12375
12376 !! test
12377 pre-save transform: context links ("pipe trick") with namespace
12378 !! options
12379 pst title=[[Ns:Somearticle]]
12380 !! wikitext
12381 [[|Article]]
12382 !! html/php
12383 [[Ns:Article|Article]]
12384 !! end
12385
12386 !! test
12387 pre-save transform: context links ("pipe trick") with namespace and parens
12388 !! options
12389 pst title=[[Ns:Somearticle (context)]]
12390 !! wikitext
12391 [[|Article]]
12392 !! html/php
12393 [[Ns:Article (context)|Article]]
12394 !! end
12395
12396 !! test
12397 pre-save transform: context links ("pipe trick") with namespace and comma
12398 !! options
12399 pst title=[[Ns:Somearticle, Context, Whatever]]
12400 !! wikitext
12401 [[|Article]]
12402 !! html/php
12403 [[Ns:Article, Context, Whatever|Article]]
12404 !! end
12405
12406 !! test
12407 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12408 !! options
12409 pst title=[[Ns:Somearticle, Context (context)]]
12410 !! wikitext
12411 [[|Article]]
12412 !! html/php
12413 [[Ns:Article (context)|Article]]
12414 !! end
12415
12416 !! test
12417 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12418 !! options
12419 pst title=[[Ns:Somearticle (IGNORED), Context]]
12420 !! wikitext
12421 [[|Article]]
12422 !! html/php
12423 [[Ns:Article, Context|Article]]
12424 !! end
12425
12426 !! test
12427 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12428 !! options
12429 pst
12430 !! wikitext
12431 [[Article(context)|]]
12432 [[Bar:Article(context)|]]
12433 [[:Bar:Article(context)|]]
12434 [[|Article(context)]]
12435 [[Bar:X(Y)Z|]]
12436 [[:Bar:X(Y)Z|]]
12437 !! html/php
12438 [[Article(context)|Article]]
12439 [[Bar:Article(context)|Article]]
12440 [[:Bar:Article(context)|Article]]
12441 [[Article(context)]]
12442 [[Bar:X(Y)Z|X(Y)Z]]
12443 [[:Bar:X(Y)Z|X(Y)Z]]
12444 !! end
12445
12446 !! test
12447 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12448 !! options
12449 pst
12450 !! wikitext
12451 [[Article (context)|]]
12452 [[Bar:Article (context)|]]
12453 [[:Bar:Article (context)|]]
12454 [[|Article (context)]]
12455 [[Bar:X (Y) Z|]]
12456 [[:Bar:X (Y) Z|]]
12457 !! html/php
12458 [[Article (context)|Article]]
12459 [[Bar:Article (context)|Article]]
12460 [[:Bar:Article (context)|Article]]
12461 [[Article (context)]]
12462 [[Bar:X (Y) Z|X (Y) Z]]
12463 [[:Bar:X (Y) Z|X (Y) Z]]
12464 !! end
12465
12466 !! test
12467 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12468 !! options
12469 pst
12470 !! wikitext
12471 [[Article(context)|]]
12472 [[Bar:Article(context)|]]
12473 [[:Bar:Article(context)|]]
12474 [[|Article(context)]]
12475 [[Bar:X(Y)Z|]]
12476 [[:Bar:X(Y)Z|]]
12477 !! html/php
12478 [[Article(context)|Article]]
12479 [[Bar:Article(context)|Article]]
12480 [[:Bar:Article(context)|Article]]
12481 [[Article(context)]]
12482 [[Bar:X(Y)Z|X(Y)Z]]
12483 [[:Bar:X(Y)Z|X(Y)Z]]
12484 !! end
12485
12486 !! test
12487 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12488 !! options
12489 pst
12490 !! wikitext
12491 [[Article (context), context|]]
12492 [[Article (context),context|]]
12493 [[Bar:Article (context), context|]]
12494 [[Bar:Article (context),context|]]
12495 [[:Bar:Article (context), context|]]
12496 [[:Bar:Article (context),context|]]
12497 !! html/php
12498 [[Article (context), context|Article]]
12499 [[Article (context),context|Article]]
12500 [[Bar:Article (context), context|Article]]
12501 [[Bar:Article (context),context|Article]]
12502 [[:Bar:Article (context), context|Article]]
12503 [[:Bar:Article (context),context|Article]]
12504 !! end
12505
12506 !! test
12507 pre-save transform: trim trailing empty lines
12508 !! options
12509 pst
12510 !! wikitext
12511 Empty lines are trimmed
12512
12513
12514
12515
12516 !! html/php
12517 Empty lines are trimmed
12518 !! end
12519
12520 !! test
12521 pre-save transform: Signature expansion
12522 !! options
12523 pst
12524 !! wikitext
12525 * ~~~
12526 * <noinclude>~~~</noinclude>
12527 * <includeonly>~~~</includeonly>
12528 * <onlyinclude>~~~</onlyinclude>
12529 !! html/php
12530 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12531 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12532 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12533 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12534 !! end
12535
12536
12537 !! test
12538 pre-save transform: Signature expansion in nowiki tags (bug 93)
12539 !! options
12540 pst disabled
12541 !! wikitext
12542 Shall not expand:
12543
12544 <nowiki>~~~~</nowiki>
12545
12546 <includeonly><nowiki>~~~~</nowiki></includeonly>
12547
12548 <noinclude><nowiki>~~~~</nowiki></noinclude>
12549
12550 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12551
12552 {{subst:Foo}} shall be converted to FOO
12553
12554 As well as inside noinclude/onlyinclude
12555 <noinclude>{{subst:Foo}}</noinclude>
12556 <onlyinclude>{{subst:Foo}}</onlyinclude>
12557
12558 But not inside includeonly
12559 <includeonly>{{subst:Foo}}</includeonly>
12560 !! html/php
12561 Shall not expand:
12562
12563 <nowiki>~~~~</nowiki>
12564
12565 <includeonly><nowiki>~~~~</nowiki></includeonly>
12566
12567 <noinclude><nowiki>~~~~</nowiki></noinclude>
12568
12569 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12570
12571 FOO shall be converted to FOO
12572
12573 As well as inside noinclude/onlyinclude
12574 <noinclude>FOO</noinclude>
12575 <onlyinclude>FOO</onlyinclude>
12576
12577 But not inside includeonly
12578 <includeonly>{{subst:Foo}}</includeonly>
12579 !! end
12580
12581 !! test
12582 Parsoid: Recognize nowiki with trailing space in tags
12583 !! options
12584 parsoid=wt2html
12585 !! wikitext
12586 <nowiki ><div>[[foo]]</nowiki >
12587
12588 a<nowiki / >b
12589
12590 c<nowiki />d
12591
12592 e<nowiki/ >f
12593 !! html
12594 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12595 <p>ab</p>
12596 <p>cd</p>
12597 <p>ef</p>
12598 !! end
12599
12600 !! test
12601 Parsoid: Recognize nowiki with odd capitalization
12602 !! options
12603 parsoid=wt2html
12604 !! wikitext
12605 <noWikI ><div>[[foo]]</Nowiki >
12606 !! html
12607 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12608 !! end
12609
12610
12611 !! test
12612 Parsoid: Escape nowiki with trailing space in tags
12613 !! options
12614 parsoid=html2wt
12615 !! html/parsoid
12616 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12617 <p>a&lt;nowiki /&gt;b</p>
12618 <p>c&lt;nowiki/ &gt;d</p>
12619 !! wikitext
12620 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12621
12622 a&lt;nowiki /&gt;b
12623
12624 c&lt;nowiki/ &gt;d
12625 !! end
12626
12627 !! test
12628 Parsoid: Escape weird noWikI capitalizations
12629 !! options
12630 parsoid=html2wt
12631 !! html/parsoid
12632 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12633 !! wikitext
12634 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12635 !! end
12636
12637 ###
12638 ### Message transform tests
12639 ###
12640 !! test
12641 message transform: magic variables
12642 !! options
12643 msg
12644 !! wikitext
12645 {{SITENAME}}
12646 !! html
12647 MediaWiki
12648 !! end
12649
12650 !! test
12651 message transform: should not transform wiki markup
12652 !! options
12653 msg
12654 !! wikitext
12655 ''test''
12656 !! html
12657 ''test''
12658 !! end
12659
12660 !! test
12661 message transform: <noinclude> in transcluded template (bug 4926)
12662 !! options
12663 msg
12664 !! wikitext
12665 {{Includes}}
12666 !! html
12667 Foobar
12668 !! end
12669
12670 !! test
12671 message transform: <onlyinclude> in transcluded template (bug 4926)
12672 !! options
12673 msg
12674 !! wikitext
12675 {{Includes2}}
12676 !! html
12677 Foo
12678 !! end
12679
12680 !! test
12681 {{#special:}} page name, known
12682 !! options
12683 msg
12684 !! wikitext
12685 {{#special:Recentchanges}}
12686 !! html
12687 Special:RecentChanges
12688 !! end
12689
12690 !! test
12691 {{#special:}} page name with subpage, known
12692 !! options
12693 msg
12694 !! wikitext
12695 {{#special:Recentchanges/param}}
12696 !! html
12697 Special:RecentChanges/param
12698 !! end
12699
12700 !! test
12701 {{#special:}} page name, unknown
12702 !! options
12703 msg
12704 !! wikitext
12705 {{#special:foobar nonexistent}}
12706 !! html
12707 Special:Foobar nonexistent
12708 !! end
12709
12710 !! test
12711 {{#speciale:}} page name, known
12712 !! options
12713 msg
12714 !! wikitext
12715 {{#speciale:Recentchanges}}
12716 !! html
12717 Special:RecentChanges
12718 !! end
12719
12720 !! test
12721 {{#speciale:}} page name with subpage, known
12722 !! options
12723 msg
12724 !! wikitext
12725 {{#speciale:Recentchanges/param}}
12726 !! html
12727 Special:RecentChanges/param
12728 !! end
12729
12730 !! test
12731 {{#speciale:}} page name, unknown
12732 !! options
12733 msg
12734 !! wikitext
12735 {{#speciale:foobar nonexistent}}
12736 !! html
12737 Special:Foobar_nonexistent
12738 !! end
12739
12740 ###
12741 ### Images
12742 ###
12743 ### For Parsoid-specific tests, see
12744 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12745
12746 !! test
12747 Simple image
12748 !! options
12749 parsoid=wt2html,wt2wt,html2html
12750 !! wikitext
12751 [[Image:foobar.jpg]]
12752 !! html/php
12753 <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>
12754 </p>
12755 !! html/parsoid
12756 <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>
12757 !! end
12758
12759 !! test
12760 Simple image (using File: namespace, now canonical)
12761 !! wikitext
12762 [[File:Foobar.jpg]]
12763 !! html/php
12764 <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>
12765 </p>
12766 !! html/parsoid
12767 <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>
12768 !! end
12769
12770 !! test
12771 Right-aligned image
12772 !! wikitext
12773 [[File:Foobar.jpg|right]]
12774 !! html/php
12775 <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>
12776
12777 !! html/parsoid
12778 <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>
12779 !! end
12780
12781 !! test
12782 Image with caption
12783 !! wikitext
12784 [[File:Foobar.jpg|right|Caption text]]
12785 !! html/php
12786 <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>
12787
12788 !! html/parsoid
12789 <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>
12790 !! end
12791
12792 !! test
12793 Image with caption, bug 53312 #1
12794 !! wikitext
12795 [[File:Foobar.jpg|right|Caption page stuff]]
12796 !! html/php
12797 <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>
12798
12799 !! html/parsoid
12800 <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>
12801 !! end
12802
12803 !! test
12804 Image with caption, bug 53312 #2
12805 !! wikitext
12806 [[File:Foobar.jpg|right|Caption page=]]
12807 !! html/php
12808 <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>
12809
12810 !! html/parsoid
12811 <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>
12812 !! end
12813
12814 !! test
12815 Image with caption, bug 53312 #3
12816 !! wikitext
12817 [[File:Foobar.jpg|right|Caption page=stuff]]
12818 !! html/php
12819 <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>
12820
12821 !! html/parsoid
12822 <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>
12823 !! end
12824
12825 !! test
12826 Allow empty links in image captions (Bug 60753)
12827 !! options
12828 thumbsize=220
12829 !! wikitext
12830 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12831 [[]]
12832 [[Link2]]
12833 ]]
12834 !! html/php
12835 <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>
12836
12837 !! html/parsoid
12838 <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>
12839 [[]]
12840 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12841 </figcaption></figure>
12842 !! end
12843
12844 !! test
12845 Titles in unlinked images (T23454)
12846 !! wikitext
12847 [[File:Foobar.jpg|link=|stuff]]
12848 !! html/php
12849 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12850 </p>
12851 !! end
12852
12853 !! test
12854 Link with empty target
12855 !! wikitext
12856 [[]]
12857 !! html
12858 <p>[[]]
12859 </p>
12860 !! end
12861
12862 !! test
12863 Image with link trail
12864 !! wikitext
12865 Linktrails should not work for images: [[File:Foobar.jpg]]s
12866 !! html/php
12867 <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
12868 </p>
12869 !! html/parsoid
12870 <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>
12871 !! end
12872
12873 !! test
12874 Image with empty attribute
12875 !! options
12876 parsoid=wt2html,wt2wt,html2html
12877 !! wikitext
12878 [[File:Foobar.jpg|right||Caption text]]
12879 !! html/php
12880 <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>
12881
12882 !! html/parsoid
12883 <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>
12884 !! end
12885
12886 !! test
12887 1. Block image with individual attributes from templates
12888 !! wikitext
12889 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12890 !! html/php
12891 <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>
12892
12893 !! html/parsoid
12894 <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>
12895 !! end
12896
12897 !! test
12898 2. Block Image with individual attributes from templates
12899 !! wikitext
12900 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12901 !! html/php
12902 <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>
12903
12904 !! html/parsoid
12905 <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>
12906 !! end
12907
12908 !! test
12909 3. Inline image with individual attributes from templates
12910 !! wikitext
12911 [[File:Foobar.jpg|{{echo|50px}}]]
12912 !! html/php
12913 <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>
12914 </p>
12915 !! html/parsoid
12916 <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>
12917 !! end
12918
12919 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12920 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12921 !! test
12922 Image with multiple attributes from the same template
12923 !! wikitext
12924 [[File:Foobar.jpg|{{image_attribs}}]]
12925 !! html/php
12926 <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>
12927
12928 !! html/parsoid
12929 <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>
12930 !! end
12931
12932 !! test
12933 Image with link tails
12934 !! options
12935 thumbsize=220
12936 !! wikitext
12937 123[[File:Foobar.jpg]]456
12938 123[[File:Foobar.jpg|right]]456
12939 123[[File:Foobar.jpg|thumb]]456
12940 !! html/php
12941 <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
12942 </p>
12943 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
12944 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
12945
12946 !! html/php+tidy
12947 <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>
12948 <p>123</p>
12949 <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>
12950 <p>456 123</p>
12951 <div class="thumb tright">
12952 <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>
12953 <div class="thumbcaption">
12954 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12955 </div>
12956 </div>
12957 </div>
12958 <p>456</p>
12959 !! html/parsoid
12960 <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>
12961 <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>
12962 <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>
12963 !! end
12964
12965 !! test
12966 Image with multiple captions -- only last one is accepted
12967 !! wikitext
12968 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12969 !! html/php
12970 <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>
12971
12972 !! html/parsoid
12973 <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>
12974 !! end
12975
12976 !! test
12977 Image with multiple widths -- use last
12978 !! wikitext
12979 [[File:Foobar.jpg|200px|300px|caption]]
12980 !! html/php
12981 <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>
12982 </p>
12983 !! html/parsoid
12984 <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>
12985 !! end
12986
12987 !! test
12988 Image with multiple alignments -- use first (bug 48664)
12989 !! options
12990 thumbsize=220
12991 !! wikitext
12992 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12993
12994 [[File:Foobar.jpg|middle|text-top|caption]]
12995 !! html/php
12996 <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>
12997 <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>
12998 </p>
12999 !! html/parsoid
13000 <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>
13001 <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>
13002 !! end
13003
13004 !! test
13005 Image with width attribute at different positions
13006 !! wikitext
13007 [[File:Foobar.jpg|200px|right|Caption]]
13008 [[File:Foobar.jpg|right|200px|Caption]]
13009 [[File:Foobar.jpg|right|Caption|200px]]
13010 !! html/php
13011 <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>
13012 <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>
13013 <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>
13014
13015 !! html/parsoid
13016 <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>
13017 <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>
13018 <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>
13019 !! end
13020
13021 # a sad bit of backward-compatibility
13022 !! test
13023 Image with size specified with pxpx (bug 13500, 51628)
13024 !! options
13025 parsoid=wt2html,wt2wt,html2html
13026 !! wikitext
13027 [[File:Foobar.jpg|20pxpx]]
13028 [[File:Foobar.jpg|200x20pxpx]]
13029 !! html/php
13030 <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>
13031 <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>
13032 </p>
13033 !! html/parsoid
13034 <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>
13035 !! end
13036
13037 !! test
13038 Image with link parameter, wiki target
13039 !! wikitext
13040 [[File:Foobar.jpg|link=Main Page]]
13041 !! html/php
13042 <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>
13043 </p>
13044 !! html/parsoid
13045 <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>
13046 !! end
13047
13048 # parsoid bug 49293 (part 1)
13049 !! test
13050 Image with link parameter, URL target
13051 !! wikitext
13052 [[File:Foobar.jpg|link=http://example.com/]]
13053 !! html/php
13054 <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>
13055 </p>
13056 !! html/parsoid
13057 <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>
13058 !! end
13059
13060 # parsoid bug 49293 (part 2)
13061 !! test
13062 Image with link parameter, protocol-less URL target
13063 !! wikitext
13064 [[File:Foobar.jpg|link=//example.com/]]
13065 !! html/php
13066 <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>
13067 </p>
13068 !! html/parsoid
13069 <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>
13070 !! end
13071
13072 !! test
13073 Escaping non-block captions (T107435)
13074 !! options
13075 parsoid={
13076 "modes": ["wt2wt"],
13077 "changes": [
13078 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13079 ]
13080 }
13081 !! wikitext
13082 [[Image:Foobar.jpg|caption]]
13083 !! wikitext/edited
13084 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13085 !! end
13086
13087 # wgExternalLinkTarget not supported by Parsoid
13088 !! test
13089 Image with link parameter, wgExternalLinkTarget
13090 !! wikitext
13091 [[Image:foobar.jpg|link=http://example.com/]]
13092 !! config
13093 wgExternalLinkTarget='foobar'
13094 !! html/php
13095 <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>
13096 </p>
13097 !! end
13098
13099 !! test
13100 Image with link parameter, wgNoFollowLinks set to false
13101 !! wikitext
13102 [[Image:foobar.jpg|link=http://example.com/]]
13103 !! config
13104 wgNoFollowLinks=false
13105 !! html
13106 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13107 </p>
13108 !! end
13109
13110 !! test
13111 Image with link parameter, wgNoFollowDomainExceptions
13112 !! wikitext
13113 [[Image:foobar.jpg|link=http://example.com/]]
13114 !! config
13115 wgNoFollowDomainExceptions='example.com'
13116 !! html
13117 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13118 </p>
13119 !! end
13120
13121 # wgExternalLinkTarget not supported by Parsoid
13122 !! test
13123 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13124 !! wikitext
13125 [[Image:foobar.jpg|link=http://example.com/|Title]]
13126 !! config
13127 wgExternalLinkTarget='foobar'
13128 !! html/php
13129 <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>
13130 </p>
13131 !! end
13132
13133 !! test
13134 Image with empty link parameter
13135 !! wikitext
13136 [[File:Foobar.jpg|link=]]
13137 !! html/php
13138 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13139 </p>
13140 !! html/parsoid
13141 <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>
13142 !! end
13143
13144 !! test
13145 Image with link parameter (wiki target) and unnamed parameter
13146 !! wikitext
13147 [[File:Foobar.jpg|link=Main_Page|Title]]
13148 !! html/php
13149 <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>
13150 </p>
13151 !! html/parsoid
13152 <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>
13153 !! end
13154
13155 !! test
13156 Image with link parameter (URL target) and unnamed parameter
13157 !! wikitext
13158 [[File:Foobar.jpg|link=http://example.com/|Title]]
13159 !! html/php
13160 <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>
13161 </p>
13162 !! html/parsoid
13163 <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>
13164 !! end
13165
13166 !! test
13167 Thumbnail image with link parameter
13168 !! options
13169 thumbsize=220
13170 parsoid=wt2html,wt2wt,html2html
13171 !! wikitext
13172 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13173 !! html/php
13174 <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>
13175
13176 !! html/parsoid
13177 <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>
13178 !! end
13179
13180 !! test
13181 Manually-specified thumbnail image
13182 !! options
13183 thumbsize=220
13184 !! wikitext
13185 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13186 !! html/php
13187 <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>
13188
13189 !! html/parsoid
13190 <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>
13191 !! end
13192
13193 !! test
13194 Manually-specified thumbnail image with explicit link to wiki page
13195 !! options
13196 thumbsize=220
13197 parsoid=wt2html,wt2wt,html2html
13198 !! wikitext
13199 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13200 !! html/php
13201 <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>
13202
13203 !! html/parsoid
13204 <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>
13205 !! end
13206
13207 !! test
13208 Manually-specified thumbnail image with explicit link to url
13209 !! options
13210 thumbsize=220
13211 parsoid=wt2html,wt2wt,html2html
13212 !! wikitext
13213 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13214 !! html/php
13215 <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>
13216
13217 !! html/parsoid
13218 <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>
13219 !! end
13220
13221 !! test
13222 Manually-specified thumbnail image with explicit no link
13223 !! options
13224 thumbsize=220
13225 parsoid=wt2html,wt2wt,html2html
13226 !! wikitext
13227 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13228 !! html/php
13229 <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>
13230
13231 !! html/parsoid
13232 <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>
13233 !! end
13234
13235 !! test
13236 Manually-specified thumbnail image with explicit link and alt text
13237 !! options
13238 thumbsize=220
13239 parsoid=wt2html,wt2wt,html2html
13240 !! wikitext
13241 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13242 !! html/php
13243 <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>
13244
13245 !! html/parsoid
13246 <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>
13247 !! end
13248
13249 !! test
13250 Image with frame and link
13251 !! options
13252 parsoid=wt2html,wt2wt,html2html
13253 !! wikitext
13254 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13255 !! html/php
13256 <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>
13257
13258 !! html/parsoid
13259 <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>
13260 !! end
13261
13262 !! test
13263 Image with frame and link and explicit alt
13264 !! options
13265 parsoid=wt2html,wt2wt,html2html
13266 !! wikitext
13267 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13268 !! html/php
13269 <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>
13270
13271 !! html/parsoid
13272 <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>
13273 !! end
13274
13275 !! test
13276 Image with wiki markup in implicit alt
13277 !! wikitext
13278 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13279
13280 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13281 !! html/php
13282 <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>
13283 </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>
13284 </p>
13285 !! html/parsoid
13286 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"testing &lt;b data-parsoid=\"{&amp;quot;dsr&amp;quot;:[27,37,3,3]}\">bold&lt;/b> in alt"}'><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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></span></p>
13287 <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" data-parsoid='{"a":{"alt":"testing bold in alt","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt","resource":"Image:Foobar.jpg"}}'/></a></span></p>
13288 !! end
13289
13290 !! test
13291 Alt image option should handle most kinds of wikitext without barfing
13292 !! wikitext
13293 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13294 !! html/php
13295 <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>
13296
13297 !! html/parsoid
13298 <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>
13299 !! end
13300
13301 ###################
13302 # Conflicting image format options.
13303 # First option specified should 'win'.
13304 # All three cases in each test should be identical.
13305
13306 !! test
13307 Image with 'frameless' first.
13308 !! options
13309 parsoid=wt2html,wt2wt,html2html
13310 !! wikitext
13311 [[File:Foobar.jpg|frameless|caption]]
13312
13313 [[File:Foobar.jpg|frameless|frame|caption]]
13314
13315 [[File:Foobar.jpg|frameless|thumb|caption]]
13316 !! html/php
13317 <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>
13318 </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>
13319 </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>
13320 </p>
13321 !! html/parsoid
13322 <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>
13323 <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>
13324 <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>
13325 !! end
13326
13327 !! test
13328 Image with 'frame' first.
13329 !! options
13330 parsoid=wt2html,wt2wt,html2html
13331 !! wikitext
13332 [[File:Foobar.jpg|frame|caption]]
13333 [[File:Foobar.jpg|frame|frameless|caption]]
13334 [[File:Foobar.jpg|frame|thumb|caption]]
13335 !! html/php
13336 <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>
13337 <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>
13338 <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>
13339
13340 !! html/parsoid
13341 <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>
13342 <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>
13343 <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>
13344 !! end
13345
13346 !! test
13347 Image with 'thumb' first.
13348 !! options
13349 parsoid=wt2html,wt2wt,html2html
13350 !! wikitext
13351 [[File:Foobar.jpg|thumb|caption]]
13352 [[File:Foobar.jpg|thumb|frameless|caption]]
13353 [[File:Foobar.jpg|thumb|frame|caption]]
13354 !! html/php
13355 <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>
13356 <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>
13357 <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>
13358
13359 !! html/parsoid
13360 <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>
13361 <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>
13362 <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>
13363 !! end
13364
13365 ###################
13366 # Image sizing.
13367 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13368 # and https://phabricator.wikimedia.org/T64258
13369 # Foobar has actual size of 1941x220
13370 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13371 # a scalable format.
13372 # 2. Framed images always ignore size options; always render at default size.
13373 # 3. "Unspecified format" and border are the only types which can be
13374 # enlarged.
13375
13376 !! test
13377 Image: "unspecified format" and border enlarge
13378 !! options
13379 parsoid=wt2html,wt2wt,html2html
13380 !! wikitext
13381 [[File:Foobar.jpg|2000px]]
13382
13383 [[File:Foobar.jpg|border|2000px]]
13384 !! html/php
13385 <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>
13386 </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>
13387 </p>
13388 !! html/parsoid
13389 <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>
13390 <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>
13391 !! end
13392
13393 !! test
13394 Image: "unspecified format" and border reduce
13395 !! options
13396 parsoid=wt2html,wt2wt,html2html
13397 !! wikitext
13398 [[File:Foobar.jpg|1000px]]
13399
13400 [[File:Foobar.jpg|border|1000px]]
13401 !! html/php
13402 <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>
13403 </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>
13404 </p>
13405 !! html/parsoid
13406 <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>
13407 <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>
13408 !! end
13409
13410 !! test
13411 Image: thumbs reduce
13412 !! options
13413 parsoid=wt2html,wt2wt,html2html
13414 !! wikitext
13415 [[File:Foobar.jpg|thumb|50px]]
13416 !! html/php
13417 <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>
13418
13419 !! html/parsoid
13420 <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>
13421 !! end
13422
13423 !! test
13424 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13425 !! options
13426 parsoid=wt2html,wt2wt,html2html
13427 !! wikitext
13428 [[File:Foobar.jpg|thumb|2000px]]
13429
13430 [[File:Foobar.svg|thumb|2000px]]
13431 !! html/php
13432 <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>
13433 <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>
13434
13435 !! html/parsoid
13436 <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>
13437 <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>
13438 !! end
13439
13440 !! test
13441 Image: frameless can reduce in size
13442 !! options
13443 parsoid=wt2html,wt2wt,html2html
13444 !! wikitext
13445 [[File:Foobar.jpg|frameless|50px]]
13446 !! html/php
13447 <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>
13448 </p>
13449 !! html/parsoid
13450 <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>
13451 !! end
13452
13453 !! test
13454 Image: bitmap frameless can't be enlarged past original size, but vector can
13455 !! options
13456 parsoid=wt2html,wt2wt,html2html
13457 !! wikitext
13458 [[File:Foobar.jpg|frameless|2000px]]
13459
13460 [[File:Foobar.svg|frameless|2000px]]
13461 !! html/php
13462 <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>
13463 </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>
13464 </p>
13465 !! html/parsoid
13466 <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>
13467 <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>
13468 !! end
13469
13470 !! test
13471 Image: framed images are always unscaled.
13472 !! options
13473 parsoid=wt2html,wt2wt,html2html
13474 !! wikitext
13475 [[File:Foobar.jpg|frame]]
13476
13477 [[File:Foobar.jpg|frame|50px]]
13478
13479 [[File:Foobar.jpg|frame|50x50px]]
13480
13481 [[File:Foobar.jpg|frame|2000px]]
13482 !! html/php
13483 <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>
13484 <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>
13485 <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>
13486 <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>
13487
13488 !! html/parsoid
13489 <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>
13490 <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>
13491 <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>
13492 <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>
13493 !! end
13494
13495 ###################
13496
13497 !! test
13498 Link to image page- image page normally doesn't exists, hence edit link
13499 Add test with existing image page
13500 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13501 !! wikitext
13502 [[:Image:test]]
13503 !! html
13504 <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>
13505 </p>
13506 !! end
13507
13508 !! test
13509 bug 18784 Link to non-existent image page with caption should use caption as link text
13510 !! wikitext
13511 [[:Image:test|caption]]
13512 !! html
13513 <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>
13514 </p>
13515 !! end
13516
13517 !! test
13518 Frameless image caption with a free URL
13519 !! wikitext
13520 [[File:Foobar.jpg|http://example.com]]
13521 !! html/php
13522 <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>
13523 </p>
13524 !! html/parsoid
13525 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;a rel=\"mw:ExtLink\" href=\"http://example.com\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;url&amp;quot;,&amp;quot;dsr&amp;quot;:[18,36,0,0]}\">http://example.com&lt;/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>
13526 !! end
13527
13528 !! test
13529 Thumbnail image caption with a free URL
13530 !! options
13531 thumbsize=220
13532 !! wikitext
13533 [[File:Foobar.jpg|thumb|http://example.com]]
13534 !! html/php
13535 <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>
13536
13537 !! html/parsoid
13538 <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>
13539 !! end
13540
13541 !! test
13542 Thumbnail image caption with a free URL and explicit alt
13543 !! options
13544 thumbsize=220
13545 parsoid=wt2html,wt2wt,html2html
13546 !! wikitext
13547 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13548 !! html/php
13549 <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>
13550
13551 !! html/parsoid
13552 <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>
13553 !! end
13554
13555 !! test
13556 SVG thumbnails with no language set
13557 !! options
13558 !! wikitext
13559 [[File:Foobar.svg|thumb|caption]]
13560 !! html/php
13561 <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>
13562
13563 !! html/parsoid
13564 <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>
13565 !! end
13566
13567 !! test
13568 SVG thumbnails with language de
13569 !! options
13570 parsoid=wt2html,wt2wt,html2html
13571 !! wikitext
13572 [[File:Foobar.svg|thumb|caption|lang=de]]
13573 !! html/php
13574 <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>
13575
13576 !! html/parsoid
13577 <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>
13578 !! end
13579
13580 !! test
13581 SVG thumbnails with invalid language code
13582 !! options
13583 parsoid=wt2html,wt2wt,html2html
13584 !! wikitext
13585 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13586 !! html/php
13587 <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>
13588
13589 !! html/parsoid
13590 <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>
13591 !! end
13592
13593 !! test
13594 BUG 1887: A ISBN with a thumbnail
13595 !! wikitext
13596 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13597 !! html/php
13598 <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>
13599
13600 !! html/parsoid
13601 <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:WikiLink">ISBN 1235467890</a></figcaption></figure>
13602 !! end
13603
13604 !! test
13605 BUG 1887: A RFC with a thumbnail
13606 !! wikitext
13607 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13608 !! html/php
13609 <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>
13610
13611 !! html/parsoid
13612 <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>
13613 !! end
13614
13615 !! test
13616 BUG 1887: A mailto link with a thumbnail
13617 !! wikitext
13618 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13619 !! html/php
13620 <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>
13621
13622 !! html/parsoid
13623 <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>
13624 !! end
13625
13626 # Pending resolution to bug 368
13627 !! test
13628 BUG 648: Frameless image caption with a link
13629 !! wikitext
13630 [[File:Foobar.jpg|text with a [[link]] in it]]
13631 !! html/php
13632 <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>
13633 </p>
13634 !! html/parsoid
13635 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with 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;:[30,38,2,2]}\">link&lt;/a> 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>
13636 !! end
13637
13638 !! test
13639 BUG 648: Frameless image caption with a link (suffix)
13640 !! wikitext
13641 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13642 !! html/php
13643 <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>
13644 </p>
13645 !! html/parsoid
13646 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with 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;:[30,41,2,5],&amp;quot;tail&amp;quot;:&amp;quot;foo&amp;quot;}\">linkfoo&lt;/a> 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>
13647 !! end
13648
13649 !! test
13650 BUG 648: Frameless image caption with an interwiki link
13651 !! wikitext
13652 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13653 !! html/php
13654 <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>
13655 </p>
13656 !! html/parsoid
13657 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball: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;http://www.usemod.com/cgi-bin/mb.pl?Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;MeatBall:Link&amp;quot;},&amp;quot;isIW&amp;quot;:true,&amp;quot;dsr&amp;quot;:[30,47,2,2]}\">MeatBall:Link&lt;/a> 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>
13658 !! end
13659
13660 !! test
13661 BUG 648: Frameless image caption with a piped interwiki link
13662 !! wikitext
13663 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13664 !! html/php
13665 <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>
13666 </p>
13667 !! html/parsoid
13668 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;piped&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;http://www.usemod.com/cgi-bin/mb.pl?Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;MeatBall:Link&amp;quot;},&amp;quot;isIW&amp;quot;:true,&amp;quot;dsr&amp;quot;:[30,52,16,2]}\">link&lt;/a> 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>
13669 !! end
13670
13671 !! test
13672 T107474: Frameless image caption with <nowiki>
13673 !! wikitext
13674 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13675 !! html/parsoid
13676 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[18,75,8,9]}\">text with a [[MeatBall:Link|link]] in it&lt;/span>"}'><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>
13677 !! end
13678
13679 !! test
13680 Escape HTML special chars in image alt text
13681 !! wikitext
13682 [[File:Foobar.jpg|& < > "]]
13683 !! html/php
13684 <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>
13685 </p>
13686 !! html/parsoid
13687 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&amp;amp; &amp;lt; &amp;gt; \""}'><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>
13688 !! end
13689
13690 !! test
13691 BUG 499: Alt text should have &#1234;, not &amp;1234;
13692 !! wikitext
13693 [[File:Foobar.jpg|&#9792;]]
13694 !! html/php
13695 <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>
13696 </p>
13697 !! html/parsoid
13698 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;#9792;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;♀&amp;quot;,&amp;quot;dsr&amp;quot;:[18,25,null,null]}\">♀&lt;/span>"}'><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>
13699 !! end
13700
13701 !! test
13702 Broken image caption with link
13703 !! options
13704 parsoid=wt2html,wt2wt,html2html
13705 !! wikitext
13706 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13707 !! html/php
13708 <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.
13709 </p>
13710 !! html/parsoid
13711 <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>
13712 !! end
13713
13714 !! test
13715 Image caption containing another image
13716 !! wikitext
13717 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13718 !! html/php
13719 <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>
13720
13721 !! html/parsoid
13722 <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>
13723 !! end
13724
13725 !! test
13726 Image: caption containing a newline
13727 !! wikitext
13728 [[File:Foobar.jpg|This
13729 *is some text]]
13730 !! html/php
13731 <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>
13732 </p>
13733 !! html/parsoid
13734 <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>
13735 !!end
13736
13737 !!test
13738 Image: caption containing leading space
13739 (The leading space should not trigger nowiki escaping in wt2wt mode)
13740 !! wikitext
13741 [[File:Foobar.jpg|thumb| bar]]
13742 !! html/php
13743 <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>
13744
13745 !! html/parsoid
13746 <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>
13747 !!end
13748
13749 !! test
13750 Image: caption containing a table
13751 !! options
13752 parsoid=wt2html,wt2wt,html2html
13753 !! wikitext
13754 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13755 {|
13756 ! Foo !! Bar
13757 |-
13758 | Foo1 || Bar1
13759 |}
13760 and some more text.]]
13761 !! html/php
13762 <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>
13763
13764 !! html/parsoid
13765 <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
13766 <table>
13767 <tbody>
13768 <tr><th>Foo </th><th>Bar</th></tr>
13769 <tr>
13770 <td>Foo1 </td>
13771 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13772 !! end
13773
13774 !! test
13775 Bug 3090: External links other than http: in image captions
13776 !! wikitext
13777 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13778 !! html/php
13779 <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>
13780
13781 !! html/parsoid
13782 <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>
13783 !! end
13784
13785 !! test
13786 Custom class
13787 !! options
13788 parsoid=wt2html,wt2wt,html2html
13789 !! wikitext
13790 [[Image:foobar.jpg|a|class=b]]
13791 !! html/php
13792 <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>
13793 </p>
13794 !! html/parsoid
13795 <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>
13796 !! end
13797
13798 !! test
13799 Localized image handling (1).
13800 !! options
13801 parsoid=wt2html,wt2wt,html2html
13802 language=es
13803 !! wikitext
13804 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13805 !! html/php
13806 <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>
13807
13808 !! html/parsoid
13809 <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>
13810 !! end
13811
13812 !! test
13813 Localized image handling (2).
13814 !! options
13815 thumbsize=220
13816 parsoid=wt2html,wt2wt,html2html
13817 language=es
13818 !! wikitext
13819 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13820 !! html/php
13821 <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>
13822
13823 !! html/parsoid
13824 <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>
13825 !! end
13826
13827 !! test
13828 "border", "frameless" and "class" attributes on an image.
13829 !! options
13830 thumbsize=220
13831 parsoid=wt2html,wt2wt,html2html
13832 !! wikitext
13833 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13834 !! html/php
13835 <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>
13836 </p>
13837 !! html/parsoid
13838 <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>
13839 !! end
13840
13841 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13842 !! test
13843 Invalid image attributes (bug 62500)
13844 !! options
13845 thumbsize=220
13846 parsoid=wt2html,wt2wt,html2html
13847 !! wikitext
13848 [[File:Foobar.jpg|thumb|float|left|caption]]
13849
13850 [[File:Foobar.jpg|thumb|righ|caption]]
13851
13852 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13853 !! html/php
13854 <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>
13855 <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>
13856 <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>
13857
13858 !! html/parsoid
13859 <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>
13860 <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>
13861 <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>
13862 !! end
13863
13864 !! article
13865 File:Barfoo.jpg
13866 !! text
13867 #REDIRECT [[File:Barfoo.jpg]]
13868 !! endarticle
13869
13870 # FIXME: Parsoid should run this test -- but we'd need to teach the
13871 # mockAPI about the redirected Barfoo.jpg image.
13872 !! test
13873 Redirected image
13874 !! wikitext
13875 [[Image:Barfoo.jpg]]
13876 !! html/php
13877 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13878 </p>
13879 !! end
13880
13881 !! test
13882 Missing image with uploads disabled
13883 !! options
13884 wgEnableUploads=0
13885 !! wikitext
13886 [[File:Foobaz.jpg]]
13887 !! html/php
13888 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13889 </p>
13890 !! html/parsoid
13891 <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>
13892 !! end
13893
13894 # Parsoid-specific testing for images
13895 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13896 # Currently imperfect due to a flaw in the Parsoid testrunner
13897 # Work in progress
13898 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13899 # image tests.
13900
13901 !! test
13902 Parsoid-specific image handling - simple image with size and middle alignment
13903 !! wikitext
13904 [[File:Foobar.jpg|middle|50px]]
13905 !! html/parsoid
13906 <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>
13907 !! end
13908
13909 !! test
13910 Parsoid-specific image handling - simple image with size, middle alignment,
13911 non-standard namespace alias
13912 !! options
13913 parsoid=wt2wt,wt2html,html2html
13914 !! wikitext
13915 [[Image:Foobar.jpg|middle|50px]]
13916 !! html/parsoid
13917 <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>
13918 !! end
13919
13920 !! test
13921 Parsoid-specific image handling - simple image with size and middle alignment
13922 (existing content)
13923 !! wikitext
13924 [[File:Foobar.jpg|50px|middle]]
13925 !! html/parsoid
13926 <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>
13927 !! end
13928
13929 !! test
13930 Parsoid-specific image handling - simple image with size and middle alignment
13931 and non-standard namespace name
13932 !! options
13933 parsoid=wt2html,wt2wt,html2html
13934 !! wikitext
13935 [[Image:Foobar.jpg|50px|middle]]
13936 !! html/parsoid
13937 <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>
13938 !! end
13939
13940 !! test
13941 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13942 !! wikitext
13943 [[File:Foobar.jpg|500x10px|baseline|caption]]
13944 !! html/parsoid
13945 <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>
13946 !! end
13947
13948 !! test
13949 Parsoid-specific image handling - simple image with border and size spec
13950 !! wikitext
13951 [[File:Foobar.jpg|50px|border|caption]]
13952 !! html/parsoid
13953 <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>
13954 !! end
13955
13956 !! test
13957 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13958 !! wikitext
13959 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13960 !! html/parsoid
13961 <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>
13962 !! end
13963
13964 !! test
13965 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13966 (existing content)
13967 !! wikitext
13968 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13969 !! html/parsoid
13970 <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>
13971 !! end
13972
13973 !! test
13974 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13975 !! wikitext
13976 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13977 !! html/parsoid
13978 <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>
13979 !! end
13980
13981 !! test
13982 Parsoid-specific image handling - thumbnail with specific size, halign,
13983 valign, and caption (existing content)
13984 !! wikitext
13985 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13986 !! html/parsoid
13987 <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>
13988 !! end
13989
13990 !! test
13991 Parsoid-specific image handling - framed image with specific size and caption
13992 (size is ignored)
13993 !! options
13994 parsoid=wt2html,wt2wt,html2html
13995 !! wikitext
13996 [[File:Foobar.jpg|frame|500x50px|caption]]
13997 !! html/parsoid
13998 <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>
13999 !! end
14000
14001 !! test
14002 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14003 (size is ignored)
14004 !! options
14005 parsoid=wt2html,wt2wt,html2html
14006 !! wikitext
14007 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14008 !! html/parsoid
14009 <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>
14010 !! end
14011
14012 !! test
14013 Parsoid-specific image handling - frameless image with specific size, border, and caption
14014 !! wikitext
14015 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14016 !! html/parsoid
14017 <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>
14018 !! end
14019
14020 !! test
14021 Parsoid-specific image handling - simple image with a formatted caption
14022 !! wikitext
14023 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14024 !! html/parsoid
14025 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;table data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[18,81,7,8]}\">&lt;tbody data-parsoid=\"{&amp;quot;dsr&amp;quot;:[25,73,0,0]}\">&lt;tr data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[25,54,4,5]}\">&lt;td data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[29,39,4,5]}\">a&lt;/td>&lt;td data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[39,49,4,5]}\">b&lt;/td>&lt;/tr>&lt;tr data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[54,73,4,5]}\">&lt;td data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[58,68,4,5]}\">c&lt;/td>&lt;/tr>&lt;/tbody>&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>
14026 !! end
14027
14028 !! test
14029 Parsoid-specific image handling - caption with a template in it
14030 !! wikitext
14031 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14032 !! html/parsoid
14033 <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>
14034 !! end
14035
14036 !! test
14037 Parsoid-specific image handling - caption with unbalanced tags in it
14038 !! options
14039 parsoid=wt2html,wt2wt,html2html
14040 !! wikitext
14041 foo
14042 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14043 bar
14044 !! html/parsoid
14045 <p>foo</p>
14046 <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>
14047 <p>bar</p>
14048 !! end
14049
14050 !! test
14051 Parsoid-specific image handling - empty caption (1)
14052 !! options
14053 parsoid=wt2html,wt2wt
14054 !! wikitext
14055 [[File:Foobar.jpg|thumb|]]
14056 !! html/parsoid
14057 <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>
14058 !! end
14059
14060 # empty captions don't get serialized unless we're in the "round trip" case
14061 !! test
14062 Parsoid-specific image handling - empty caption (2)
14063 !! options
14064 parsoid=html2wt
14065 !! html/parsoid
14066 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14067 <a href="./File:Foobar.jpg">
14068 <img resource="./File:Foobar.jpg"
14069 src="//example.com/images/3/3a/Foobar.jpg"
14070 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14071 height="25" width="220"/>
14072 </a>
14073 <figcaption></figcaption>
14074 </figure>
14075 !! wikitext
14076 [[File:Foobar.jpg|thumb]]
14077 !! end
14078
14079 !! test
14080 Parsoid-specific image handling - whitespace caption
14081 !! wikitext
14082 [[File:Foobar.jpg|thumb| ]]
14083 !! html/parsoid
14084 <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>
14085 !! end
14086
14087 !! test
14088 Parsoid-specific image handling - lang option
14089 !! wikitext
14090 foo
14091 [[File:Foobar.svg|lang=de|caption]]
14092 bar
14093 !! html/parsoid
14094 <p>foo
14095 <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>
14096 bar</p>
14097 !! end
14098
14099 ## Edge case bugs in Parsoid from T93580
14100 !! test
14101 T93580: 1. Templated <ref> inside block images
14102 !! wikitext
14103 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14104
14105 <references />
14106 !! html/parsoid
14107 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption with templated ref: {{echo|&lt;ref>foo&lt;/ref>}}"}]}'><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/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 with templated ref: <span about="#mwt5" 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&lt;/ref>"}},"i":0}}]}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></figcaption></figure>
14108
14109 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" 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>
14110 !! end
14111
14112 !! test
14113 T93580: 2. <ref> inside inline images
14114 !! wikitext
14115 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14116
14117 <references />
14118 !! html/parsoid
14119 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[64,78,5,6]}\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;id&amp;quot;:&amp;quot;mw-reference-text-cite_note-1&amp;quot;},&amp;quot;attrs&amp;quot;:{}}\">&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=\"{&amp;quot;group&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;content&amp;quot;:&amp;quot;foo&amp;quot;,&amp;quot;hasRefInRef&amp;quot;:false,&amp;quot;dsr&amp;quot;:[64,78,5,6],&amp;quot;tmp&amp;quot;:{}}\" data-mw=\"{}\">"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14120
14121 <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" data-parsoid="{}">foo</span></li></ol>
14122 !! end
14123
14124 !! test
14125 T93580: 3. Templated <ref> inside inline images
14126 !! wikitext
14127 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14128
14129 <references />
14130 !! html/parsoid
14131 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion mw:Extension/ref\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[64,96,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;&lt;ref>{{echo|foo}}&lt;/ref>&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=\"{&amp;quot;group&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;content&amp;quot;:&amp;quot;foo&amp;quot;,&amp;quot;hasRefInRef&amp;quot;:false,&amp;quot;dsr&amp;quot;:[64,96,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;]}]],&amp;quot;tmp&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;&lt;ref>{{echo|foo}}&lt;/ref>&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14132
14133 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" 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>
14134 !! end
14135
14136 ###
14137 ### Subpages
14138 ###
14139 !! article
14140 Subpage test/subpage
14141 !! text
14142 foo
14143 !! endarticle
14144
14145 !! test
14146 Subpage link
14147 !! options
14148 subpage title=[[Subpage test]]
14149 !! wikitext
14150 [[/subpage]]
14151 !! html
14152 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14153 </p>
14154 !! end
14155
14156 !! test
14157 Subpage noslash link
14158 !! options
14159 subpage title=[[Subpage test]]
14160 !! wikitext
14161 [[/subpage/]]
14162 !! html
14163 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14164 </p>
14165 !! end
14166
14167 !! article
14168 Subpage test/1/2/subpage
14169 !! text
14170 blah
14171 !! endarticle
14172
14173 !! test
14174 Relative subpage noslash link
14175 !! options
14176 parsoid=wt2wt,wt2html,html2html
14177 subpage title=[[Subpage test/1/2/3/4]]
14178 !! wikitext
14179 [[../../subpage/]]
14180
14181 [[../../subpage]]
14182 !! html/php
14183 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14184 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14185 </p>
14186 !! html/parsoid
14187 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14188 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14189 !! end
14190
14191 !! test
14192 Parsoid: dot-slash prefixed wikilinks
14193 !! wikitext
14194 [[./foo]]
14195
14196 [[././bar]]
14197
14198 [[././baz/]]
14199 !! html/php
14200 <p>[[./foo]]
14201 </p><p>[[././bar]]
14202 </p><p>[[././baz/]]
14203 </p>
14204 !! html/parsoid
14205 <p>[[./foo]]
14206 </p><p>[[././bar]]
14207 </p><p>[[././baz/]]
14208 </p>
14209 !! end
14210
14211 !! test
14212 Render invalid page names as plain text (bug 51090)
14213 !! wikitext
14214 [[./../foo|bar]]
14215 [[foo�|bar]]
14216 [[foo/.|bar]]
14217 [[foo/..|bar]]
14218 [[foo~~~bar]]
14219 [[foo>bar]]
14220 [[foo[bar]]
14221 [[.]]
14222 [[..]]
14223 [[foo././bar]]
14224
14225 [[{{echo|./../foo}}|bar]]
14226 [[{{echo|foo/.}}|bar]]
14227 [[{{echo|foo/..}}|bar]]
14228 [[{{echo|foo~~~~bar}}]]
14229 [[{{echo|foo>bar}}]]
14230 [[{{echo|foo././bar}}]]
14231 [[{{echo|foo{bar}}]]
14232 [[{{echo|foo}bar}}]]
14233 [[{{echo|foo[bar}}]]
14234 [[{{echo|foo]bar}}]]
14235 [[{{echo|foo<bar}}]]
14236 !!html/php
14237 <p>[[./../foo|bar]]
14238 [[foo�|bar]]
14239 [[foo/.|bar]]
14240 [[foo/..|bar]]
14241 [[foo~~~bar]]
14242 [[foo&gt;bar]]
14243 [[foo[bar]]
14244 [[.]]
14245 [[..]]
14246 [[foo././bar]]
14247 </p><p>[[./../foo|bar]]
14248 [[foo/.|bar]]
14249 [[foo/..|bar]]
14250 [[foo~~~~bar]]
14251 [[foo&gt;bar]]
14252 [[foo././bar]]
14253 [[foo{bar]]
14254 [[foo}bar]]
14255 [[foo[bar]]
14256 [[foo]bar]]
14257 [[foo&lt;bar]]
14258 </p>
14259 !!html/parsoid
14260 <p>[[./../foo|bar]]
14261 [[foo�|bar]]
14262 [[foo/.|bar]]
14263 [[foo/..|bar]]
14264 [[foo~~~bar]]
14265 [[foo>bar]]
14266 [[foo[bar]]
14267 [[.]]
14268 [[..]]
14269 [[foo././bar]]</p>
14270
14271 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14272 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14273 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14274 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14275 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14276 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14277 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14278 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14279 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14280 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14281 [[<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>
14282 !!end
14283
14284 !! test
14285 Disabled subpages
14286 !! wikitext
14287 [[/subpage]]
14288 !! html
14289 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14290 </p>
14291 !! end
14292
14293 !! test
14294 BUG 561: {{/Subpage}}
14295 !! options
14296 subpage title=[[Page]]
14297 !! wikitext
14298 {{/Subpage}}
14299 !! html
14300 <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>
14301 </p>
14302 !! end
14303
14304 ###
14305 ### Categories
14306 ###
14307 !! article
14308 Category:MediaWiki User's Guide
14309 !! text
14310 blah
14311 !! endarticle
14312
14313 !! test
14314 Link to category
14315 !! wikitext
14316 [[:Category:MediaWiki User's Guide]]
14317 !! html
14318 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14319 </p>
14320 !! end
14321
14322 !! test
14323 Simple category
14324 !! options
14325 cat
14326 !! wikitext
14327 [[Category:MediaWiki User's Guide]]
14328 !! html
14329 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14330 !! end
14331
14332 !! test
14333 PAGESINCATEGORY invalid title fatal (r33546 fix)
14334 !! wikitext
14335 {{PAGESINCATEGORY:<bogus>}}
14336 !! html
14337 <p>0
14338 </p>
14339 !! end
14340
14341 !! test
14342 Category with different sort key
14343 !! options
14344 cat
14345 !! wikitext
14346 [[Category:MediaWiki User's Guide|Foo]]
14347 !! html
14348 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14349 !! end
14350
14351 !! test
14352 Category with identical sort key
14353 !! options
14354 cat
14355 !! wikitext
14356 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14357 !! html
14358 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14359 !! end
14360
14361 !! test
14362 Category with empty sort key
14363 !! options
14364 cat
14365 pst
14366 !! wikitext
14367 [[Category:MediaWiki User's Guide|]]
14368 !! html/php
14369 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14370 !! end
14371
14372 !! test
14373 Category with empty sort key and parentheses
14374 !! options
14375 cat
14376 pst
14377 !! wikitext
14378 [[Category:Foo (bar)|]]
14379 !! html/php
14380 [[Category:Foo (bar)|Foo]]
14381 !! end
14382
14383 ## We used to, but no longer wt2wt this test since the default serializer
14384 ## will normalize all categories to serialize on their own line.
14385 ## This wikitext usage is going to be fairly uncommon in production and
14386 ## selser will take care of preserving formatting in those scenarios.
14387 !! test
14388 Category with link tail
14389 !! options
14390 cat
14391 pst
14392 parsoid=wt2html
14393 !! wikitext
14394 123[[Category:Foo]]456
14395 !! html/php
14396 123[[Category:Foo]]456
14397 !! html/parsoid
14398 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14399 !! end
14400
14401 !! test
14402 Category with template
14403 !! options
14404 cat
14405 pst
14406 !! wikitext
14407 [[Category:{{echo|Foo}}]]
14408 !! html/php
14409 [[Category:{{echo|Foo}}]]
14410 !! end
14411
14412 !! test
14413 Category with template in sort key
14414 !! options
14415 cat
14416 pst
14417 !! wikitext
14418 [[Category:Foo|{{echo|Bar}}]]
14419 !! html/php
14420 [[Category:Foo|{{echo|Bar}}]]
14421 !! end
14422
14423 !! test
14424 Category with template in sort key and title
14425 !! options
14426 cat
14427 pst
14428 !! wikitext
14429 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14430 !! html/php
14431 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14432 !! end
14433
14434 ## We used to, but no longer wt2wt this test since the default serializer
14435 ## will normalize all categories to serialize on their own line.
14436 ## This wikitext usage is going to be fairly uncommon in production and
14437 ## selser will take care of preserving formatting in those scenarios.
14438 !! test
14439 Category / paragraph interactions
14440 !! options
14441 parsoid=wt2html
14442 !! wikitext
14443 Foo [[Category:Baz]] Bar
14444
14445 Foo [[Category:Baz]]
14446 Bar
14447
14448 Foo
14449 [[Category:Baz]]
14450 Bar
14451
14452 Foo
14453 [[Category:Baz]] Bar
14454
14455 Foo
14456 [[Category:Baz]]
14457 [[Category:Baz]]
14458 [[Category:Baz]]
14459 Bar
14460
14461 [[Category:Baz]]
14462 [[Category:Baz]]
14463 [[Category:Baz]]
14464
14465 [[Category:Baz]]
14466 {{echo|[[Category:Baz]]}}
14467 [[Category:Baz]]
14468 !! html/php
14469 <p>Foo Bar
14470 </p><p>Foo
14471 Bar
14472 </p><p>Foo
14473 Bar
14474 </p><p>Foo Bar
14475 </p><p>Foo
14476 Bar
14477 </p>
14478 !! html/parsoid
14479 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14480 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14481 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14482 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14483 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Baz]]"}},"i":0}}]}'/></p>
14484 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14485 !! end
14486
14487 ## We used to, but no longer wt2wt this test since the default serializer
14488 ## will normalize all categories to serialize on their own line.
14489 ## This wikitext usage is going to be fairly uncommon in production and
14490 ## selser will take care of preserving formatting in those scenarios.
14491 ##
14492 ## The whitespace on the empty line is part of the test. Please do not delete
14493 !! test
14494 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14495 !! options
14496 parsoid=wt2html
14497 !! wikitext
14498 This
14499
14500 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14501
14502 {{echo|[[Category:Foo]] and so should this!}}
14503 !! html/php
14504 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14505 </p>
14506 !! html/parsoid
14507 <p>This
14508
14509 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14510
14511 <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>
14512 !! end
14513
14514 ## Parsoid will not try to wt2wt this while preserving newlines because
14515 ## it suppresses excess newlines within list items -- and we don't want to
14516 ## introduce a special case just for categories, which is, in reality somewhat
14517 ## odd behavior -- categories are unlikely to be used in list items like this
14518 ## in top-level pages and are only likely to show up in template-generated
14519 ## list items where this RT-ing is a non-issue.
14520 ##
14521 ## The whitespace on the empty line is part of the test. Please do not delete
14522 !! test
14523 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14524 !! options
14525 parsoid=wt2html
14526 !! wikitext
14527 * This
14528
14529 [[Category:Foo]] and this should be part of the same list item
14530 * So should this
14531
14532 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14533 !! html
14534 <ul><li>This and this should be part of the same list item</li>
14535 <li>So should this and this should be part of the same list item</li></ul>
14536 !! html/parsoid
14537 <ul>
14538 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14539 <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>
14540 </ul>
14541 !! end
14542
14543 ## Newlines and categories that follow the last item of a list
14544 ## are treated differently because this (list followed by categories)
14545 ## is an extremely common pattern on wikis.
14546 !! test
14547 3. Categories and newlines: newline suppression for last list item should RT properly
14548 !! wikitext
14549 * a
14550 * b
14551
14552 [[Category:Foo]]
14553
14554 [[Category:Bar]]
14555 [[Category:Baz]]
14556 !! html/parsoid
14557 <ul><li> a</li>
14558 <li> b</li></ul>
14559
14560 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14561
14562 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14563 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14564 !! end
14565
14566 !! test
14567 4. Categories and newlines: newline suppression for last list item should RT properly
14568 !! wikitext
14569 * a
14570 **** b
14571
14572 [[Category:Foo]]
14573 !! html/parsoid
14574 <ul><li> a
14575 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14576
14577 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14578 !! end
14579
14580 ## only wt2html for this to make sure the algo only applies to the rightmost path
14581 !! test
14582 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14583 !! options
14584 parsoid=wt2html
14585 !! wikitext
14586 * a
14587 ** b
14588 [[Category:Foo]]
14589 * c
14590 ** d
14591 [[Category:Foo]]
14592 !! html/parsoid
14593 <ul><li> a
14594 <ul><li> b
14595 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14596 <li> c
14597 <ul><li> d</li></ul></li></ul>
14598 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14599 !! end
14600
14601 ## We used to, but no longer wt2wt this test since the default serializer
14602 ## will normalize all categories to serialize on their own line.
14603 ## This wikitext usage is going to be fairly uncommon in production and
14604 ## selser will take care of preserving formatting in those scenarios.
14605 !! test
14606 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14607 !! options
14608 parsoid=wt2html
14609 !! wikitext
14610 * a [[Category:Foo]]
14611 !! html/parsoid
14612 <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>
14613 !! end
14614
14615 # This test also demonstrates because of newline+category tunneling
14616 # through the list hander, template wrapping doesn't expand to the
14617 # containing list when the list item swallows the category.
14618 !! test
14619 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14620 !! wikitext
14621 * {{echo|a
14622 [[Category:Foo]]}}
14623 !! html/parsoid
14624 <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
14625 </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>
14626 !! end
14627
14628 !! test
14629 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14630 !! wikitext
14631 * a
14632
14633 {{echo|[[Category:Foo]]
14634 [[Category:Bar]]}}
14635 [[Category:Baz]]
14636 !! html/parsoid
14637 <ul><li> a</li></ul>
14638
14639 <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">
14640 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14641 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14642 !! end
14643
14644 !! test
14645 Parsoid: Serialize link to category page with colon escape
14646 !! options
14647 parsoid
14648 !! wikitext
14649
14650 [[:Category:Foo]]
14651 [[:Category:Foo|Bar]]
14652 !! html
14653 <p>
14654 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14655 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14656 </p>
14657 !! end
14658
14659 # We used to, but no longer wt2wt this test since the default serializer
14660 # will normalize all categories to serialize on their own line.
14661 # This wikitext usage is going to be fairly uncommon in production and
14662 # selser will take care of preventing whitespace insertion if this
14663 # occurs in an article.
14664 #
14665 # html2html disabled for the same reason (whitespace insertion between
14666 # x and y).
14667 #
14668 # html2wt disabled because it localizes the "Category" namespace.
14669 !! test
14670 Link prefix/suffixes aren't applied to category links
14671 !! options
14672 parsoid=wt2html
14673 language=is
14674 !! wikitext
14675 x[[Category:Foo]]y
14676 !! html/php
14677 <p>xy
14678 </p>
14679 !! html/parsoid
14680 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14681 !! end
14682
14683 !! test
14684 Parsoid: Serialize link to file page with colon escape
14685 !! options
14686 parsoid
14687 !! wikitext
14688
14689 [[:File:Foo.png]]
14690 [[:File:Foo.png|Bar]]
14691 !! html
14692 <p>
14693 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14694 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14695 </p>
14696 !! end
14697
14698 !! test
14699 Parsoid: Serialize a genuine category link without colon escape
14700 !! options
14701 parsoid
14702 !! wikitext
14703 [[Category:Foo]]
14704 [[Category:Foo|Bar]]
14705 !! html
14706 <link rel="mw:PageProp/Category" href="./Category:Foo">
14707 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14708 !! end
14709
14710 !! test
14711 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14712 !! options
14713 parsoid=html2wt
14714 !! html/parsoid
14715 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14716 !! wikitext
14717 [[Category:Toxine bactérienne]]
14718 !! end
14719
14720 !! test
14721 Parsoid: Defaultsort
14722 !! wikitext
14723 {{DEFAULTSORT:Foo}}
14724 !! html/parsoid
14725 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14726 !! end
14727
14728 !! test
14729 Parsoid: Defaultsort (template-generated)
14730 !! wikitext
14731 {{{{echo|DEFAULTSORT}}:Foo}}
14732 !! html/parsoid
14733 <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}}]}'/>
14734 !! end
14735
14736 ###
14737 ### Inter-language links
14738 ###
14739 !! test
14740 Interlanguage links
14741 !! options
14742 ill
14743 !! wikitext
14744 [[es:Alimento]]
14745 [[fr:Nourriture]]
14746 [[zh:食品]]
14747 !! html/php
14748 es:Alimento fr:Nourriture zh:食品
14749 !! html/parsoid
14750 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14751 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14752 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14753 !! end
14754
14755 !! test
14756 Duplicate interlanguage links (bug 24502)
14757 !! options
14758 ill
14759 !! wikitext
14760 [[es:1]]
14761 [[es:2]]
14762 [[fr:1]]
14763 [[fr:2]]
14764 !! html/php
14765 es:1 fr:1
14766 !! html/parsoid
14767 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14768 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14769 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14770 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14771 !! end
14772
14773 ###
14774 ### Sections
14775 ###
14776 !! test
14777 Basic section headings
14778 !! wikitext
14779 == Headline 1 ==
14780 Some text
14781
14782 ==Headline 2==
14783 More
14784 ===Smaller headline===
14785 Blah blah
14786 !! html
14787 <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>
14788 <p>Some text
14789 </p>
14790 <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>
14791 <p>More
14792 </p>
14793 <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>
14794 <p>Blah blah
14795 </p>
14796 !! end
14797
14798 !! test
14799 Section headings with TOC
14800 !! wikitext
14801 == Headline 1 ==
14802 === Subheadline 1 ===
14803 ===== Skipping a level =====
14804 ====== Skipping a level ======
14805
14806 == Headline 2 ==
14807 Some text
14808 ===Another headline===
14809 !! html
14810 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14811 <ul>
14812 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14813 <ul>
14814 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14815 <ul>
14816 <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>
14817 <ul>
14818 <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>
14819 </ul>
14820 </li>
14821 </ul>
14822 </li>
14823 </ul>
14824 </li>
14825 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14826 <ul>
14827 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14828 </ul>
14829 </li>
14830 </ul>
14831 </div>
14832
14833 <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>
14834 <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>
14835 <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>
14836 <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>
14837 <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>
14838 <p>Some text
14839 </p>
14840 <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>
14841
14842 !! end
14843
14844 !! test
14845 TOC anchors don't collide
14846 !! wikitext
14847 __FORCETOC__
14848 == Headline 2 ==
14849 == Headline ==
14850 == Headline 2 ==
14851 == Headline ==
14852 !! html/php
14853 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14854 <ul>
14855 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14856 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14857 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14858 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14859 </ul>
14860 </div>
14861
14862 <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>
14863 <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>
14864 <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>
14865 <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>
14866
14867 !! end
14868
14869 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14870 !! test
14871 Handling of sections up to level 6 and beyond
14872 !! wikitext
14873 = Level 1 Heading=
14874 == Level 2 Heading==
14875 === Level 3 Heading===
14876 ==== Level 4 Heading====
14877 ===== Level 5 Heading=====
14878 ====== Level 6 Heading======
14879 ======= Level 7 Heading=======
14880 ======== Level 8 Heading========
14881 ========= Level 9 Heading=========
14882 ========== Level 10 Heading==========
14883 !! html
14884 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14885 <ul>
14886 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14887 <ul>
14888 <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>
14889 <ul>
14890 <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>
14891 <ul>
14892 <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>
14893 <ul>
14894 <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>
14895 <ul>
14896 <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>
14897 <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>
14898 <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>
14899 <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>
14900 <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>
14901 </ul>
14902 </li>
14903 </ul>
14904 </li>
14905 </ul>
14906 </li>
14907 </ul>
14908 </li>
14909 </ul>
14910 </li>
14911 </ul>
14912 </div>
14913
14914 <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>
14915 <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>
14916 <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>
14917 <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>
14918 <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>
14919 <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>
14920 <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>
14921 <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>
14922 <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>
14923 <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>
14924
14925 !! end
14926
14927 !! test
14928 TOC regression (T11764)
14929 !! wikitext
14930 == title 1 ==
14931 === title 1.1 ===
14932 ==== title 1.1.1 ====
14933 === title 1.2 ===
14934 == title 2 ==
14935 === title 2.1 ===
14936 !! html
14937 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14938 <ul>
14939 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14940 <ul>
14941 <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>
14942 <ul>
14943 <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>
14944 </ul>
14945 </li>
14946 <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>
14947 </ul>
14948 </li>
14949 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14950 <ul>
14951 <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>
14952 </ul>
14953 </li>
14954 </ul>
14955 </div>
14956
14957 <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>
14958 <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>
14959 <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>
14960 <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>
14961 <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>
14962 <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>
14963
14964 !! end
14965
14966 !! test
14967 TOC for heading containing <span id="..."></span> (T96153)
14968 !! wikitext
14969 __FORCETOC__
14970 ==<span id="old-anchor"></span>New title==
14971 !! html/php
14972 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14973 <ul>
14974 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14975 </ul>
14976 </div>
14977
14978 <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>
14979
14980 !! end
14981
14982 !! test
14983 TOC with wgMaxTocLevel=3 (bug 6204)
14984 !! options
14985 wgMaxTocLevel=3
14986 !! wikitext
14987 == title 1 ==
14988 === title 1.1 ===
14989 ==== title 1.1.1 ====
14990 === title 1.2 ===
14991 == title 2 ==
14992 === title 2.1 ===
14993 !! html
14994 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14995 <ul>
14996 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14997 <ul>
14998 <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>
14999 <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>
15000 </ul>
15001 </li>
15002 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15003 <ul>
15004 <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>
15005 </ul>
15006 </li>
15007 </ul>
15008 </div>
15009
15010 <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>
15011 <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>
15012 <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>
15013 <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>
15014 <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>
15015 <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>
15016
15017 !! end
15018
15019 !! test
15020 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15021 !! options
15022 wgMaxTocLevel=3
15023 !! wikitext
15024 ==Section 1==
15025 ===Section 1.1===
15026 ====Section 1.1.1====
15027 ====Section 1.1.1.1====
15028 ==Section 2==
15029 !! html
15030 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15031 <ul>
15032 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15033 <ul>
15034 <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>
15035 </ul>
15036 </li>
15037 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15038 </ul>
15039 </div>
15040
15041 <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>
15042 <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>
15043 <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>
15044 <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>
15045 <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>
15046
15047 !! end
15048
15049
15050 !! test
15051 Resolving duplicate section names
15052 !! wikitext
15053 == Foo bar ==
15054 == Foo bar ==
15055 !! html
15056 <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>
15057 <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>
15058
15059 !! end
15060
15061 !! test
15062 Resolving duplicate section names with differing case (bug 10721)
15063 !! wikitext
15064 == Foo bar ==
15065 == Foo Bar ==
15066 !! html
15067 <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>
15068 <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>
15069
15070 !! end
15071
15072 !! article
15073 Template:sections
15074 !! text
15075 ===Section 1===
15076 ==Section 2==
15077 !! endarticle
15078
15079 !! test
15080 Template with sections, __NOTOC__
15081 !! wikitext
15082 __NOTOC__
15083 ==Section 0==
15084 {{sections}}
15085 ==Section 4==
15086 !! html
15087 <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>
15088 <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>
15089 <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>
15090 <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>
15091
15092 !! end
15093
15094 !! test
15095 __NOEDITSECTION__ keyword
15096 !! wikitext
15097 __NOEDITSECTION__
15098 ==Section 1==
15099 ==Section 2==
15100 !! html
15101 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15102 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15103
15104 !! end
15105
15106 !! test
15107 Link inside a section heading
15108 !! wikitext
15109 ==Section with a [[Main Page|link]] in it==
15110 !! html
15111 <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>
15112
15113 !! end
15114
15115 !! test
15116 TOC regression (T14077)
15117 !! wikitext
15118 __TOC__
15119 == title 1 ==
15120 === title 1.1 ===
15121 == title 2 ==
15122 !! html
15123 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15124 <ul>
15125 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15126 <ul>
15127 <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>
15128 </ul>
15129 </li>
15130 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15131 </ul>
15132 </div>
15133
15134 <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>
15135 <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>
15136 <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>
15137
15138 !! end
15139
15140 !! test
15141 BUG 1219 URL next to image (good)
15142 !! wikitext
15143 http://example.com [[File:Foobar.jpg]]
15144 !! html/php
15145 <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>
15146 </p>
15147 !! html/parsoid
15148 <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>
15149 !!end
15150
15151 !! test
15152 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15153 !! wikitext
15154 ===
15155 The line above must have a trailing space!
15156 === <!--
15157 --> <!-- -->
15158 But just in case it doesn't...
15159 !! html
15160 <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>
15161 <p>The line above must have a trailing space!
15162 </p>
15163 <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>
15164 <p>But just in case it doesn't...
15165 </p>
15166 !! end
15167
15168 !! test
15169 Header with special characters (bug 25462)
15170 !! wikitext
15171 The tooltips shall not show entities to the user (ie. be double escaped)
15172
15173 == text > text ==
15174 section 1
15175
15176 == text < text ==
15177 section 2
15178
15179 == text & text ==
15180 section 3
15181
15182 == text ' text ==
15183 section 4
15184
15185 == text " text ==
15186 section 5
15187 !! html
15188 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15189 </p>
15190 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15191 <ul>
15192 <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>
15193 <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>
15194 <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>
15195 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15196 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15197 </ul>
15198 </div>
15199
15200 <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>
15201 <p>section 1
15202 </p>
15203 <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>
15204 <p>section 2
15205 </p>
15206 <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>
15207 <p>section 3
15208 </p>
15209 <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>
15210 <p>section 4
15211 </p>
15212 <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>
15213 <p>section 5
15214 </p>
15215 !! end
15216
15217 !! test
15218 Header with space, plus and underscore as entity
15219 !! wikitext
15220 Id should not contain + for spaces
15221
15222 == Space between Text ==
15223 section 1
15224
15225 == Space-Entity&#32;between&#32;Text ==
15226 section 2
15227
15228 == Plus+between+Text ==
15229 section 3
15230
15231 == Plus-Entity&#43;between&#43;Text ==
15232 section 4
15233
15234 == Underscore_between_Text ==
15235 section 5
15236
15237 == Underscore-Entity&#95;between&#95;Text ==
15238 section 6
15239
15240 [[#Space between Text]]
15241 [[#Space-Entity&#32;between&#32;Text]]
15242 [[#Plus+between+Text]]
15243 [[#Plus-Entity&#43;between&#43;Text]]
15244 [[#Underscore_between_Text]]
15245 [[#Underscore-Entity&#95;between&#95;Text]]
15246 !! html
15247 <p>Id should not contain + for spaces
15248 </p>
15249 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15250 <ul>
15251 <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>
15252 <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>
15253 <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>
15254 <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>
15255 <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>
15256 <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>
15257 </ul>
15258 </div>
15259
15260 <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>
15261 <p>section 1
15262 </p>
15263 <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>
15264 <p>section 2
15265 </p>
15266 <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>
15267 <p>section 3
15268 </p>
15269 <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>
15270 <p>section 4
15271 </p>
15272 <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>
15273 <p>section 5
15274 </p>
15275 <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>
15276 <p>section 6
15277 </p><p><a href="#Space_between_Text">#Space between Text</a>
15278 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15279 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15280 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15281 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15282 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15283 </p>
15284 !! end
15285
15286 !! test
15287 Headers with excess '=' characters
15288 (Are similar tests necessary beyond the 1st level?)
15289 !! wikitext
15290 =foo==
15291 ==foo=
15292 =''italic'' heading==
15293 ==''italic'' heading=
15294 !! html
15295 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15296 <ul>
15297 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15298 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15299 <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>
15300 <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>
15301 </ul>
15302 </div>
15303
15304 <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>
15305 <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>
15306 <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>
15307 <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>
15308
15309 !! end
15310
15311 !! test
15312 HTML headers vs TOC (bug 23393)
15313 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15314 !! wikitext
15315 <h1>Header 1</h1>
15316 == Header 1.1 ==
15317 == Header 1.2 ==
15318
15319 <h1>Header 2
15320 </h1>
15321 == Header 2.1 ==
15322 == Header 2.2 ==
15323 __NOEDITSECTION__
15324 !! html
15325 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15326 <ul>
15327 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15328 <ul>
15329 <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>
15330 <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>
15331 </ul>
15332 </li>
15333 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15334 <ul>
15335 <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>
15336 <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>
15337 </ul>
15338 </li>
15339 </ul>
15340 </div>
15341
15342 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15343 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15344 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15345 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15346 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15347 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15348
15349 !! end
15350
15351 !! test
15352 Single-line or multiline-comments can follow headings
15353 !! options
15354 parsoid=wt2html,wt2wt
15355 !! wikitext
15356 ==foo==<!---->
15357 ==bar==<!--c1-->
15358 ==baz==<!--
15359 c2
15360 c3-->
15361 !! html
15362 <h2><span class="mw-headline" id="foo">foo</span></h2>
15363 <h2><span class="mw-headline" id="bar">bar</span></h2>
15364 <h2><span class="mw-headline" id="baz">baz</span></h2>
15365
15366 !! end
15367
15368 !! test
15369 BUG 1219 URL next to image (broken)
15370 !! wikitext
15371 http://example.com[[File:Foobar.jpg]]
15372 !! html/php
15373 <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>
15374 </p>
15375 !! html/parsoid
15376 <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>
15377 !!end
15378
15379 !! test
15380 Bug 1186 news: in the middle of text
15381 !! wikitext
15382 http://en.wikinews.org/wiki/Wikinews:Workplace
15383 !! html
15384 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15385 </p>
15386 !!end
15387
15388
15389 !! test
15390 Namespaced link must have a title
15391 !! wikitext
15392 [[Project:]]
15393 !! html
15394 <p>[[Project:]]
15395 </p>
15396 !!end
15397
15398 !! test
15399 Namespaced link must have a title (bad fragment version)
15400 !! wikitext
15401 [[Project:#fragment]]
15402 !! html
15403 <p>[[Project:#fragment]]
15404 </p>
15405 !!end
15406
15407
15408 ###
15409 ### HTML tags and HTML attributes
15410 ###
15411
15412 !! test
15413 div with no attributes
15414 !! wikitext
15415 <div>HTML rocks</div>
15416 !! html
15417 <div>HTML rocks</div>
15418
15419 !! end
15420
15421 !! test
15422 div with double-quoted attribute
15423 !! wikitext
15424 <div id="rock">HTML rocks</div>
15425 !! html
15426 <div id="rock">HTML rocks</div>
15427
15428 !! end
15429
15430 !! test
15431 div with single-quoted attribute
15432 !! wikitext
15433 <div id='rock'>HTML rocks</div>
15434 !! html
15435 <div id="rock">HTML rocks</div>
15436
15437 !! end
15438
15439 !! test
15440 div with unquoted attribute
15441 !! wikitext
15442 <div id=rock>HTML rocks</div>
15443 !! html
15444 <div id="rock">HTML rocks</div>
15445
15446 !! end
15447
15448 !! test
15449 div with illegal double attributes
15450 !! wikitext
15451 <div id="a" id="b">HTML rocks</div>
15452 !! html
15453 <div id="b">HTML rocks</div>
15454
15455 !!end
15456
15457 !! test
15458 div with empty attribute value, space before equals
15459 !! wikitext
15460 <div class =>HTML rocks</div>
15461 !! html
15462 <div class="">HTML rocks</div>
15463
15464 !! end
15465
15466 # FIXME: Parsoid doesn't match the html5 spec
15467 !! test
15468 div with multiple empty attribute values
15469 !! options
15470 parsoid=wt2html,html2html
15471 !! wikitext
15472 <div id= title=>HTML rocks</div>
15473 !! html/php
15474 <div id="title.3D">HTML rocks</div>
15475
15476 !! html/parsoid
15477 <div id="" title="">HTML rocks</div>
15478 !! end
15479
15480 # FIXME: Parsoid doesn't match the html5 spec
15481 !! test
15482 table with multiple empty attribute values
15483 !! options
15484 parsoid=wt2html,html2html
15485 !! wikitext
15486 {| title= id=
15487 | hi
15488 |}
15489 !! html/php
15490 <table title="id=">
15491 <tr>
15492 <td> hi
15493 </td></tr></table>
15494
15495 !! html/parsoid
15496 <table title="" id="">
15497 <tbody><tr><td> hi</td></tr>
15498 </tbody></table>
15499 !! end
15500
15501 !! test
15502 div with braces in attribute value
15503 !! wikitext
15504 <div title="{}">Foo</div>
15505 !! html/php
15506 <div title="&#123;}">Foo</div>
15507
15508 !! html/parsoid
15509 <div title="{}">Foo</div>
15510 !! end
15511
15512 !! test
15513 div with empty attribute value, no space before equals
15514 !! options
15515 parsoid=wt2html,html2html
15516 !! wikitext
15517 <div class=>HTML rocks</div>
15518 !! html/php
15519 <div class="">HTML rocks</div>
15520
15521 !! html/parsoid
15522 <div class="">HTML rocks</div>
15523 !! end
15524
15525 !! test
15526 HTML multiple attributes correction
15527 !! wikitext
15528 <p class="error" class="awesome">Awesome!</p>
15529 !! html
15530 <p class="awesome">Awesome!</p>
15531
15532 !!end
15533
15534 !! test
15535 Table multiple attributes correction
15536 !! wikitext
15537 {|
15538 !+ class="error" class="awesome"| status
15539 |}
15540 !! html
15541 <table>
15542 <tr>
15543 <th class="awesome"> status
15544 </th></tr></table>
15545
15546 !!end
15547
15548 !! test
15549 DIV IN UPPERCASE
15550 !! wikitext
15551 <DIV ID="x">HTML ROCKS</DIV>
15552 !! html
15553 <div id="x">HTML ROCKS</div>
15554
15555 !!end
15556
15557 !! test
15558 Non-ASCII pseudo-tags are rendered as text
15559 !! wikitext
15560 <khyô>
15561 !! html
15562 <p>&lt;khyô&gt;
15563 </p>
15564 !! end
15565
15566 !! test
15567 Pseudo-tag with URL 'name' renders as url link
15568 !! wikitext
15569 <http://example.com/>
15570 !! html
15571 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15572 </p>
15573 !! end
15574
15575 !! test
15576 text with amp in the middle of nowhere
15577 !! wikitext
15578 Remember AT&T?
15579 !! html
15580 <p>Remember AT&amp;T?
15581 </p>
15582 !! end
15583
15584 !! test
15585 text with character entity: eacute
15586 !! wikitext
15587 I always thought &eacute; was a cute letter.
15588 !! html
15589 <p>I always thought &#233; was a cute letter.
15590 </p>
15591 !! html+tidy
15592 <p>I always thought é was a cute letter.</p>
15593 !! end
15594
15595 !! test
15596 text with entity-escaped character entity-like string: eacute
15597 !! wikitext
15598 I always thought &amp;eacute; was a cute letter.
15599 !! html
15600 <p>I always thought &amp;eacute; was a cute letter.
15601 </p>
15602 !! end
15603
15604 !! test
15605 text with undefined character entity: xacute
15606 !! wikitext
15607 I always thought &xacute; was a cute letter.
15608 !! html
15609 <p>I always thought &amp;xacute; was a cute letter.
15610 </p>
15611 !! end
15612
15613 !! test
15614 HTML5 tags
15615 !! wikitext
15616 <data value="5">five</data>
15617 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15618 <mark>This highlighted text</mark>
15619 !! html
15620 <p><data value="5">five</data>
15621 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15622 <mark>This highlighted text</mark>
15623 </p>
15624 !! end
15625
15626 !! test
15627 HTML tag with leading space is parsed as text
15628 !! wikitext
15629 < div>foo< /div>
15630 !! html
15631 <p>&lt; div&gt;foo&lt; /div&gt;
15632 </p>
15633 !! end
15634
15635 ###
15636 ### Nesting tests (see bug 41545, 50604, 51081)
15637 ###
15638
15639 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15640 # Note that html2wt is considerably more difficult if we use <b> in
15641 # the test case, instead of <big>
15642 !! test
15643 Ensure that HTML adoption agency algorithm is properly implemented.
15644 !! wikitext
15645 <big>X<big>Y</big>Z</big>
15646 !! html
15647 <p><big>X<big>Y</big>Z</big>
15648 </p>
15649 !! end
15650
15651 # This was bug 41545 in the PHP parser.
15652 # Note that tidy doesn't handle this correctly.
15653 !! test
15654 Nesting of <kbd>
15655 !! wikitext
15656 <kbd>X<kbd>Y</kbd>Z</kbd>
15657 !! html
15658 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15659 </p>
15660 !! end
15661
15662 # The following cases were bug 51081 in the PHP parser.
15663 # Note that there are some other nestable tags (b, i, etc) which are
15664 # not covered; see bug 51081 for discussion.
15665
15666 # Note that tidy doesn't handle this correctly.
15667 !! test
15668 Nesting of <em>
15669 !! wikitext
15670 <em>X<em>Y</em>Z</em>
15671 !! html
15672 <p><em>X<em>Y</em>Z</em>
15673 </p>
15674 !! end
15675
15676 # Note that tidy doesn't handle this correctly.
15677 !! test
15678 Nesting of <strong>
15679 !! wikitext
15680 <strong>X<strong>Y</strong>Z</strong>
15681 !! html
15682 <p><strong>X<strong>Y</strong>Z</strong>
15683 </p>
15684 !! end
15685
15686 !! test
15687 Nesting of <q>
15688 !! wikitext
15689 <q>X<q>Y</q>Z</q>
15690 !! html+tidy
15691 <p><q>X<q>Y</q>Z</q></p>
15692 !! end
15693
15694 # Note that tidy doesn't handle this correctly.
15695 !! test
15696 Nesting of <ruby>
15697 !! wikitext
15698 <ruby>X<ruby>Y</ruby>Z</ruby>
15699 !! html
15700 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15701 </p>
15702 !! end
15703
15704 # Note that tidy doesn't handle this correctly.
15705 !! test
15706 Nesting of <bdo>
15707 !! wikitext
15708 <bdo>X<bdo>Y</bdo>Z</bdo>
15709 !! html
15710 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15711 </p>
15712 !! end
15713
15714
15715 ###
15716 ### Media links
15717 ###
15718
15719 !! test
15720 Media link
15721 !! wikitext
15722 [[Media:Foobar.jpg]]
15723 !! html
15724 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15725 </p>
15726 !! end
15727
15728 !! test
15729 Media link with text
15730 !! wikitext
15731 [[Media:Foobar.jpg|A neat file to look at]]
15732 !! html
15733 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15734 </p>
15735 !! end
15736
15737 # FIXME: this is still bad HTML tag nesting
15738 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15739 !! test
15740 Media link with nasty text
15741 !! wikitext
15742 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15743 !! html
15744 <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>
15745
15746 !! html+tidy
15747 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15748 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15749 !! end
15750
15751 !! test
15752 Media link to nonexistent file (bug 1702)
15753 !! wikitext
15754 [[Media:No such.jpg]]
15755 !! html
15756 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15757 </p>
15758 !! end
15759
15760 !! test
15761 Image link to nonexistent file (bug 1850 - good)
15762 !! wikitext
15763 [[File:No_such.jpg]]
15764 !! html/php
15765 <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>
15766 </p>
15767 !! html/parsoid
15768 <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>
15769 !! end
15770
15771 !! test
15772 :Image link to nonexistent file (bug 1850 - bad)
15773 !! wikitext
15774 [[:Image:No such.jpg]]
15775 !! html/php
15776 <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>
15777 </p>
15778 !! html/parsoid
15779 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15780 !! end
15781
15782
15783
15784 !! test
15785 Character reference normalization in link text (bug 1938)
15786 !! wikitext
15787 [[Main Page|this&that]]
15788 !! html
15789 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15790 </p>
15791 !!end
15792
15793 !! article
15794 אַ
15795 !! text
15796 Test for unicode normalization
15797
15798 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15799 !! endarticle
15800
15801 !! test
15802 (bug 19451) Links should refer to the normalized form.
15803 !! wikitext
15804 [[&#xFB2E;]]
15805 [[&#x5d0;&#x5b7;]]
15806 [[&#x5d0;ַ]]
15807 [[א&#x5b7;]]
15808 [[אַ]]
15809 !! html
15810 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15811 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15812 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15813 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15814 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15815 </p>
15816 !! end
15817
15818 !! test
15819 Empty attribute crash test (bug 2067)
15820 !! wikitext
15821 <font color="">foo</font>
15822 !! html
15823 <p><font color="">foo</font>
15824 </p>
15825 !! end
15826
15827 !! test
15828 Empty attribute crash test single-quotes (bug 2067)
15829 !! wikitext
15830 <font color=''>foo</font>
15831 !! html
15832 <p><font color="">foo</font>
15833 </p>
15834 !! end
15835
15836 !! test
15837 Attribute test: equals, then nothing
15838 !! wikitext
15839 <font color=>foo</font>
15840 !! html
15841 <p><font color="">foo</font>
15842 </p>
15843 !! end
15844
15845 !! test
15846 Attribute test: unquoted value
15847 !! wikitext
15848 <font color=x>foo</font>
15849 !! html
15850 <p><font color="x">foo</font>
15851 </p>
15852 !! end
15853
15854 !! test
15855 Attribute test: unquoted but illegal value (hash)
15856 !! wikitext
15857 <font color=#x>foo</font>
15858 !! html
15859 <p><font color="#x">foo</font>
15860 </p>
15861 !! end
15862
15863 # Parsoid does not serialize to empty attribute syntax,
15864 # so wt2wt and html2wt cases are skipped
15865 !! test
15866 Attribute test: no value (T54330)
15867 !! options
15868 parsoid=wt2html,html2html
15869 !! wikitext
15870 <font color>foo</font>
15871 !! html/php
15872 <p><font color="">foo</font>
15873 </p>
15874 !! html/parsoid
15875 <p><font color="">foo</font></p>
15876 !! end
15877
15878 !! test
15879 Bug 2095: link with three closing brackets
15880 !! wikitext
15881 [[Main Page]]]
15882 !! html/php
15883 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15884 </p>
15885 !! html/parsoid
15886 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15887 !! end
15888
15889 !! test
15890 Bug 2095: link with pipe and three closing brackets
15891 !! wikitext
15892 [[Main Page|link]]]
15893 !! html/php
15894 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15895 </p>
15896 !! html/parsoid
15897 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15898 !! end
15899
15900 !! test
15901 Bug 2095: link with pipe and three closing brackets, version 2
15902 !! wikitext
15903 [[Main Page|[http://example.com/]]]
15904 !! html/php
15905 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15906 </p>
15907 !! html/parsoid
15908 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15909 !! end
15910
15911
15912 ###
15913 ### Safety
15914 ###
15915
15916 !! article
15917 Template:Dangerous attribute
15918 !! text
15919 " onmouseover="alert(document.cookie)
15920 !! endarticle
15921
15922 !! article
15923 Template:Dangerous style attribute
15924 !! text
15925 border-size: expression(alert(document.cookie))
15926 !! endarticle
15927
15928 !! article
15929 Template:Div style
15930 !! text
15931 <div style="float: right; {{{1}}}">Magic div</div>
15932 !! endarticle
15933
15934 !! test
15935 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15936 !! wikitext
15937 <div title="{{test}}"></div>
15938 !! html
15939 <div title="This is a test template"></div>
15940
15941 !! end
15942
15943 # Parsoid has enough context to handle this case
15944 !! test
15945 Bug 2304: HTML attribute safety (dangerous template; 2309)
15946 !! wikitext
15947 <div title="{{dangerous attribute}}"></div>
15948 !! html/php
15949 <div title=""></div>
15950
15951 !! html/parsoid
15952 <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>
15953 !! end
15954
15955 !! test
15956 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15957 !! wikitext
15958 <div style="{{dangerous style attribute}}"></div>
15959 !! html
15960 <div style="/* insecure input */"></div>
15961
15962 !! end
15963
15964 !! test
15965 Bug 2304: HTML attribute safety (safe parameter; 2309)
15966 !! wikitext
15967 {{div style|width: 200px}}
15968 !! html
15969 <div style="float: right; width: 200px">Magic div</div>
15970
15971 !! end
15972
15973 !! test
15974 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15975 !! wikitext
15976 {{div style|width: expression(alert(document.cookie))}}
15977 !! html
15978 <div style="/* insecure input */">Magic div</div>
15979
15980 !! end
15981
15982 !! test
15983 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15984 !! wikitext
15985 {{div style|"><script>alert(document.cookie)</script>}}
15986 !! html
15987 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15988
15989 !! end
15990
15991 !! test
15992 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15993 !! wikitext
15994 {{div style|" ><script>alert(document.cookie)</script>}}
15995 !! html
15996 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15997
15998 !! end
15999
16000 !! test
16001 Bug 2304: HTML attribute safety (link)
16002 !! wikitext
16003 <div title="[[Main Page]]"></div>
16004 !! html
16005 <div title="&#91;&#91;Main Page]]"></div>
16006
16007 !! end
16008
16009 !! test
16010 Bug 2304: HTML attribute safety (italics)
16011 !! wikitext
16012 <div title="''foobar''"></div>
16013 !! html
16014 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16015
16016 !! end
16017
16018 !! test
16019 Bug 2304: HTML attribute safety (bold)
16020 !! wikitext
16021 <div title="'''foobar'''"></div>
16022 !! html
16023 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16024
16025 !! end
16026
16027
16028 !! test
16029 Bug 2304: HTML attribute safety (ISBN)
16030 !! wikitext
16031 <div title="ISBN 1234567890"></div>
16032 !! html
16033 <div title="&#73;SBN 1234567890"></div>
16034
16035 !! end
16036
16037 !! test
16038 Bug 2304: HTML attribute safety (RFC)
16039 !! wikitext
16040 <div title="RFC 1234"></div>
16041 !! html
16042 <div title="&#82;FC 1234"></div>
16043
16044 !! end
16045
16046 !! test
16047 Bug 2304: HTML attribute safety (PMID)
16048 !! wikitext
16049 <div title="PMID 1234567890"></div>
16050 !! html
16051 <div title="&#80;MID 1234567890"></div>
16052
16053 !! end
16054
16055 !! test
16056 Bug 2304: HTML attribute safety (web link)
16057 !! wikitext
16058 <div title="http://example.com/"></div>
16059 !! html
16060 <div title="http&#58;//example.com/"></div>
16061
16062 !! end
16063
16064 !! test
16065 Bug 2304: HTML attribute safety (named web link)
16066 !! wikitext
16067 <div title="[http://example.com/ link]"></div>
16068 !! html
16069 <div title="&#91;http&#58;//example.com/ link]"></div>
16070
16071 !! end
16072
16073 !! test
16074 Bug 3244: HTML attribute safety (extension; safe)
16075 !! wikitext
16076 <div style="<nowiki>background:blue</nowiki>"></div>
16077 !! html
16078 <div style="background:blue"></div>
16079
16080 !! end
16081
16082 !! test
16083 Bug 3244: HTML attribute safety (extension; unsafe)
16084 !! wikitext
16085 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16086 !! html
16087 <div style="/* insecure input */"></div>
16088
16089 !! end
16090
16091 # More MSIE fun discovered by Tom Gilder
16092
16093 !! test
16094 MSIE CSS safety test: spurious slash
16095 !! wikitext
16096 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16097 !! html
16098 <div style="/* insecure input */">evil</div>
16099
16100 !! end
16101
16102 !! test
16103 MSIE CSS safety test: hex code
16104 !! wikitext
16105 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16106 !! html
16107 <div style="/* insecure input */">evil</div>
16108
16109 !! end
16110
16111 !! test
16112 MSIE CSS safety test: comment in url
16113 !! wikitext
16114 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16115 !! html
16116 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16117
16118 !! end
16119
16120 !! test
16121 MSIE CSS safety test: comment in expression
16122 !! wikitext
16123 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16124 !! html
16125 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16126
16127 !! end
16128
16129 !! test
16130 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16131 !! wikitext
16132 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16133 !! html
16134 <p style="/* invalid control char */">A</p>
16135
16136 !! end
16137
16138 !! test
16139 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16140 !! wikitext
16141 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16142 <div style="top:EXPRESSION(alert())">B</div>
16143 !! html
16144 <p style="/* insecure input */">A</p>
16145 <div style="/* insecure input */">B</div>
16146
16147 !! end
16148
16149 !! test
16150 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16151 !! wikitext
16152 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16153 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16154 !! html
16155 <div style="/* insecure input */">A</div>
16156 <p style="/* insecure input */">B</p>
16157
16158 !! end
16159
16160 !! test
16161 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16162 !! wikitext
16163 <div style="background-image:url⁽javascript:alert())">A</div>
16164 <div style="background-image:url₍javascript:alert())">B</div>
16165 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16166 !! html
16167 <div style="/* insecure input */">A</div>
16168 <div style="/* insecure input */">B</div>
16169 <p style="/* insecure input */">C</p>
16170
16171 !! end
16172
16173 # FIXME: Parsoid fails to sanitize this! See T58846.
16174 !! test
16175 Opera -o-link CSS
16176 !! wikitext
16177 <div
16178 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;"
16179 style="-o-link:attr(title);-o-link-source:current">X</div>
16180 !! html
16181 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16182
16183 !! end
16184
16185 !! test
16186 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16187 !! wikitext
16188 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16189 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16190 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16191 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16192 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16193 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16194 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16195 !! html
16196 <p style="/* insecure input */">A</p>
16197 <p style="/* insecure input */">B</p>
16198 <p style="/* insecure input */">C</p>
16199 <p style="/* insecure input */">D</p>
16200 <p style="/* insecure input */">E</p>
16201 <p style="/* insecure input */">F</p>
16202 <p style="/* insecure input */">G</p>
16203
16204 !! end
16205
16206 !! test
16207 Table attribute legitimate extension
16208 !! wikitext
16209 {|
16210 !+ style="<nowiki>color:blue</nowiki>"| status
16211 |}
16212 !! html
16213 <table>
16214 <tr>
16215 <th style="color:blue"> status
16216 </th></tr></table>
16217
16218 !!end
16219
16220 !! test
16221 Table attribute safety
16222 !! wikitext
16223 {|
16224 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16225 |}
16226 !! html
16227 <table>
16228 <tr>
16229 <th style="/* insecure input */"> status
16230 </th></tr></table>
16231
16232 !! end
16233
16234 !! test
16235 CSS line continuation 1
16236 !! wikitext
16237 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16238 !! html
16239 <div style="/* insecure input */"></div>
16240
16241 !! end
16242
16243 !! test
16244 CSS line continuation 2
16245 !! wikitext
16246 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16247 !! html
16248 <div style="/* invalid control char */"></div>
16249
16250 !! end
16251
16252 !! article
16253 Template:Identity
16254 !! text
16255 {{{1}}}
16256 !! endarticle
16257
16258 !! test
16259 Expansion of multi-line templates in attribute values (bug 6255)
16260 !! wikitext
16261 <div style="background: {{identity|#00FF00}}">-</div>
16262 !! html
16263 <div style="background: #00FF00">-</div>
16264
16265 !! end
16266
16267
16268 !! test
16269 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16270 !! wikitext
16271 <div style="background:
16272 #00FF00">-</div>
16273 !! html/php
16274 <div style="background: #00FF00">-</div>
16275
16276 !! html/parsoid
16277 <div style="background:
16278 #00FF00">-</div>
16279 !! end
16280
16281 !! test
16282 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16283 !! wikitext
16284 <div style="background: &#10;#00FF00">-</div>
16285 !! html
16286 <div style="background: &#10;#00FF00">-</div>
16287
16288 !! end
16289
16290 !! test
16291 evil <math>-wiki-tags without Extension:Math enabled
16292 !! wikitext
16293 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16294 !! html+tidy
16295 <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>
16296 !! end
16297
16298 ###
16299 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16300 ###
16301 !! test
16302 Parser hook: empty input
16303 !! wikitext
16304 <tag></tag>
16305 !! html/php
16306 <pre>
16307 ''
16308 array (
16309 )
16310 </pre>
16311
16312 !! html/parsoid
16313 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16314 !! end
16315
16316 ## Don't expect parsoid to rt this form.
16317 !! test
16318 Parser hook: empty input using terminated empty elements
16319 !! options
16320 parsoid=wt2html,html2html
16321 !! wikitext
16322 <tag/>
16323 !! html/php
16324 <pre>
16325 NULL
16326 array (
16327 )
16328 </pre>
16329
16330 !! html/parsoid
16331 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16332 !! end
16333
16334 !! test
16335 Parser hook: empty input using terminated empty elements (space before)
16336 !! wikitext
16337 <tag />
16338 !! html/php
16339 <pre>
16340 NULL
16341 array (
16342 )
16343 </pre>
16344
16345 !! html/parsoid
16346 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16347 !! end
16348
16349 !! test
16350 Parser hook: basic input
16351 !! wikitext
16352 <tag>input</tag>
16353 !! html/php
16354 <pre>
16355 'input'
16356 array (
16357 )
16358 </pre>
16359
16360 !! html/parsoid
16361 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16362 !! end
16363
16364 ## Don't expect parsoid to rt this form.
16365 !! test
16366 Parser hook: case insensitive
16367 !! options
16368 parsoid=wt2html,html2html
16369 !! wikitext
16370 <TAG>input</TAG>
16371 !! html/php
16372 <pre>
16373 'input'
16374 array (
16375 )
16376 </pre>
16377
16378 !! html/parsoid
16379 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16380 !! end
16381
16382 ## Don't expect parsoid to rt this form.
16383 !! test
16384 Parser hook: case insensitive, redux
16385 !! options
16386 parsoid=wt2html,html2html
16387 !! wikitext
16388 <TaG>input</TAg>
16389 !! html/php
16390 <pre>
16391 'input'
16392 array (
16393 )
16394 </pre>
16395
16396 !! html/parsoid
16397 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16398 !! end
16399
16400 !! test
16401 Parser hook: nested tags
16402 !! options
16403 noxml
16404 !! wikitext
16405 <tag><tag></tag></tag>
16406 !! html/php
16407 <pre>
16408 '<tag>'
16409 array (
16410 )
16411 </pre>&lt;/tag&gt;
16412
16413 !! html/parsoid
16414 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16415 !! end
16416
16417 !! test
16418 Parser hook: basic arguments
16419 !! wikitext
16420 <tag width="200" height="100" depth="50" square=""></tag>
16421 !! html/php
16422 <pre>
16423 ''
16424 array (
16425 'width' => '200',
16426 'height' => '100',
16427 'depth' => '50',
16428 'square' => '',
16429 )
16430 </pre>
16431
16432 !! html/parsoid
16433 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16434 !! end
16435
16436 ## Don't expect parsoid to rt this form.
16437 !! test
16438 Parser hook: basic arguments, variations
16439 !! options
16440 parsoid=wt2html,html2html
16441 !! wikitext
16442 <tag width=200 height = "100" depth = '50' square></tag>
16443 !! html/php
16444 <pre>
16445 ''
16446 array (
16447 'width' => '200',
16448 'height' => '100',
16449 'depth' => '50',
16450 'square' => '',
16451 )
16452 </pre>
16453
16454 !! html/parsoid
16455 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16456 !! end
16457
16458 !! test
16459 Parser hook: argument containing a forward slash (bug 5344)
16460 !! wikitext
16461 <tag filename="/tmp/bla"></tag>
16462 !! html/php
16463 <pre>
16464 ''
16465 array (
16466 'filename' => '/tmp/bla',
16467 )
16468 </pre>
16469
16470 !! html/parsoid
16471 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16472 !! end
16473
16474 ## Don't expect parsoid to rt this form.
16475 !! test
16476 Parser hook: empty input using terminated empty elements (bug 2374)
16477 !! options
16478 parsoid=wt2html,html2html
16479 !! wikitext
16480 <tag foo=bar/>text
16481 !! html/php
16482 <pre>
16483 NULL
16484 array (
16485 'foo' => 'bar',
16486 )
16487 </pre>text
16488
16489 !! html/parsoid
16490 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16491 !! end
16492
16493 # </tag> should be output literally since there is no matching tag that begins it
16494 !! test
16495 Parser hook: basic arguments using terminated empty elements (bug 2374)
16496 !! wikitext
16497 <tag width=200 height = "100" depth = '50' square/>
16498 other stuff
16499 </tag>
16500 !! html/php
16501 <pre>
16502 NULL
16503 array (
16504 'width' => '200',
16505 'height' => '100',
16506 'depth' => '50',
16507 'square' => '',
16508 )
16509 </pre>
16510 <p>other stuff
16511 &lt;/tag&gt;
16512 </p>
16513 !! end
16514
16515 ###
16516 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16517 ###
16518
16519 !! test
16520 Parser hook: static parser hook not inside a comment
16521 !! wikitext
16522 <statictag>hello, world</statictag>
16523
16524 <statictag action="flush" />
16525 !! html/php
16526 <p><br />
16527 hello, world
16528 </p>
16529 !! html/parsoid
16530 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16531 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16532 !! end
16533
16534 !! test
16535 Parser hook: static parser hook inside a comment
16536 !! wikitext
16537 <!-- <statictag>hello, world</statictag> -->
16538 <statictag action="flush" />
16539 !! html/php
16540 <p><br />
16541 </p>
16542 !! html/parsoid
16543 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16544 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16545 !! end
16546
16547 # Nested template calls; this case was broken by Parser.php rev 1.506,
16548 # since reverted.
16549
16550 !! article
16551 Template:One-parameter
16552 !! text
16553 (My parameter is: {{{1}}})
16554 !! endarticle
16555
16556 !! article
16557 Template:Map-one-parameter
16558 !! text
16559 {{{{{1}}}|{{{2}}}}}
16560 !! endarticle
16561
16562 !! test
16563 Nested template calls
16564 !! wikitext
16565 {{Map-one-parameter|One-parameter|param}}
16566 !! html
16567 <p>(My parameter is: param)
16568 </p>
16569 !! end
16570
16571
16572 ###
16573 ### Sanitizer
16574 ###
16575
16576 # HTML+Tidy effectively strips out the empty tags completely
16577 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16578 # which Tidy would have done for the PHP parser had there been content inside it.
16579 !! test
16580 Sanitizer: Closing of open tags
16581 !! wikitext
16582 <s></s><table></table>
16583 !! html
16584 <s></s><table></table>
16585
16586 !! html/parsoid
16587 <p><s></s></p><table></table>
16588 !! end
16589
16590 !! test
16591 Sanitizer: Closing of open but not closed tags
16592 !! wikitext
16593 <s>foo
16594 !! html
16595 <p><s>foo</s>
16596 </p>
16597 !! end
16598
16599 !! test
16600 Sanitizer: Closing of closed but not open tags
16601 !! options
16602 parsoid=wt2html
16603 !! wikitext
16604 </s>
16605 !! html/php+tidy
16606 !! html/parsoid
16607 !! end
16608
16609 !! test
16610 Sanitizer: Closing of closed but not open table tags
16611 !! options
16612 parsoid=wt2html
16613 !! wikitext
16614 Table not started</td></tr></table>
16615 !! html/php+tidy
16616 <p>Table not started</p>
16617 !! html/parsoid
16618 <p>Table not started</p>
16619 !! end
16620
16621 !! test
16622 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16623 !! wikitext
16624 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16625 !! html
16626 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16627 </p>
16628 !! end
16629
16630 # In HTML5, the restrictions are that id must contain at least one character,
16631 # and must not contain any space characters.
16632 !! test
16633 Sanitizer: Validating the contents of the id attribute (bug 4515)
16634 !! options
16635 disabled
16636 !! wikitext
16637 <br id="" /><br id="a space" />
16638 !! html
16639 Something ...
16640 !! end
16641
16642 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16643 !! test
16644 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16645 !! options
16646 disabled
16647 !! wikitext
16648 <br id="foo" /><br id="foo" />
16649 !! html
16650 Something need to be done. foo-2 ?
16651 !! end
16652
16653 !! test
16654 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16655 !! wikitext
16656 <div itemscope>
16657 <meta itemprop="hello" content="world">
16658 <meta http-equiv="refresh" content="5">
16659 <meta itemprop="hello" http-equiv="refresh" content="5">
16660 <link itemprop="hello" href="{{SERVER}}">
16661 <link rel="stylesheet" href="{{SERVER}}">
16662 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16663 </div>
16664 !! html
16665 <div itemscope="">
16666 <p> <meta itemprop="hello" content="world" />
16667 &lt;meta http-equiv="refresh" content="5"&gt;
16668 <meta itemprop="hello" content="5" />
16669 </p>
16670 <link itemprop="hello" href="http&#58;//example.org" />
16671 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16672 <link itemprop="hello" href="http&#58;//example.org" />
16673 </div>
16674
16675 !! end
16676
16677 !! test
16678 Language converter: output gets cut off unexpectedly (bug 5757)
16679 !! options
16680 language=zh
16681 !! wikitext
16682 this bit is safe: }-
16683
16684 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16685
16686 then we get cut off here: }-
16687
16688 all additional text is vanished
16689 !! html
16690 <p>this bit is safe: }-
16691 </p><p>but if we add a conversion instance: xxx
16692 </p><p>then we get cut off here: }-
16693 </p><p>all additional text is vanished
16694 </p>
16695 !! end
16696
16697 !! test
16698 Self closed html pairs (bug 5487)
16699 !! options
16700 !! wikitext
16701 <center><font id="bug" />Centered text</center>
16702 <div><font id="bug2" />In div text</div>
16703 !! html
16704 <center>&lt;font id="bug" /&gt;Centered text</center>
16705 <div>&lt;font id="bug2" /&gt;In div text</div>
16706
16707 !! end
16708
16709 #
16710 #
16711 #
16712
16713 !! test
16714 Punctuation: nbsp before exclamation
16715 !! wikitext
16716 C'est grave !
16717 !! html
16718 <p>C'est grave&#160;!
16719 </p>
16720 !! end
16721
16722 !! test
16723 Punctuation: CSS !important (bug 11874)
16724 !! wikitext
16725 <div style="width:50% !important">important</div>
16726 !! html
16727 <div style="width:50% !important">important</div>
16728
16729 !!end
16730
16731 !! test
16732 Punctuation: CSS ! important (bug 11874; with space after)
16733 !! wikitext
16734 <div style="width:50% ! important">important</div>
16735 !! html
16736 <div style="width:50% ! important">important</div>
16737
16738 !!end
16739
16740 !! test
16741 HTML bullet list, closed tags (bug 5497)
16742 !! wikitext
16743 <ul>
16744 <li>One</li>
16745 <li>Two</li>
16746 </ul>
16747 !! html/php
16748 <ul>
16749 <li>One</li>
16750 <li>Two</li>
16751 </ul>
16752
16753 !! html/parsoid
16754 <ul data-parsoid='{"stx":"html"}'>
16755 <li data-parsoid='{"stx":"html"}'>One</li>
16756 <li data-parsoid='{"stx":"html"}'>Two</li>
16757 </ul>
16758
16759 !! end
16760
16761 !! test
16762 HTML bullet list, unclosed tags (bug 5497)
16763 !! wikitext
16764 <ul>
16765 <li>One
16766 <li>Two
16767 </ul>
16768 !! html/php+tidy
16769 <ul>
16770 <li>One</li>
16771 <li>Two</li>
16772 </ul>
16773 !! html/parsoid
16774 <ul data-parsoid='{"stx":"html"}'>
16775 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16776 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16777 </ul>
16778
16779 !! end
16780
16781 !! test
16782 HTML ordered list, closed tags (bug 5497)
16783 !! wikitext
16784 <ol>
16785 <li>One</li>
16786 <li>Two</li>
16787 </ol>
16788 !! html/php
16789 <ol>
16790 <li>One</li>
16791 <li>Two</li>
16792 </ol>
16793
16794 !! html/parsoid
16795 <ol data-parsoid='{"stx":"html"}'>
16796 <li data-parsoid='{"stx":"html"}'>One</li>
16797 <li data-parsoid='{"stx":"html"}'>Two</li>
16798 </ol>
16799
16800 !! end
16801
16802 !! test
16803 HTML ordered list, unclosed tags (bug 5497)
16804 !! options
16805 !! wikitext
16806 <ol>
16807 <li>One
16808 <li>Two
16809 </ol>
16810 !! html/php+tidy
16811 <ol>
16812 <li>One</li>
16813 <li>Two</li>
16814 </ol>
16815 !! html/parsoid
16816 <ol data-parsoid='{"stx":"html"}'>
16817 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16818 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16819 </ol>
16820
16821 !! end
16822
16823 !! test
16824 HTML nested bullet list, closed tags (bug 5497)
16825 !! wikitext
16826 <ul>
16827 <li>One</li>
16828 <li>Two:
16829 <ul>
16830 <li>Sub-one</li>
16831 <li>Sub-two</li>
16832 </ul>
16833 </li>
16834 </ul>
16835 !! html
16836 <ul>
16837 <li>One</li>
16838 <li>Two:
16839 <ul>
16840 <li>Sub-one</li>
16841 <li>Sub-two</li>
16842 </ul>
16843 </li>
16844 </ul>
16845
16846 !! end
16847
16848 !! test
16849 HTML nested bullet list, open tags (bug 5497)
16850 !! wikitext
16851 <ul>
16852 <li>One
16853 <li>Two:
16854 <ul>
16855 <li>Sub-one
16856 <li>Sub-two
16857 </ul>
16858 </ul>
16859 !! html/php+tidy
16860 <ul>
16861 <li>One</li>
16862 <li>Two:
16863 <ul>
16864 <li>Sub-one</li>
16865 <li>Sub-two</li>
16866 </ul>
16867 </li>
16868 </ul>
16869 !! html/parsoid
16870 <ul>
16871 <li>One
16872 </li>
16873 <li>Two:
16874 <ul>
16875 <li>Sub-one
16876 </li>
16877 <li>Sub-two
16878 </li>
16879 </ul>
16880 </li>
16881 </ul>
16882
16883 !! end
16884
16885 !! test
16886 HTML nested ordered list, closed tags (bug 5497)
16887 !! wikitext
16888 <ol>
16889 <li>One</li>
16890 <li>Two:
16891 <ol>
16892 <li>Sub-one</li>
16893 <li>Sub-two</li>
16894 </ol>
16895 </li>
16896 </ol>
16897 !! html
16898 <ol>
16899 <li>One</li>
16900 <li>Two:
16901 <ol>
16902 <li>Sub-one</li>
16903 <li>Sub-two</li>
16904 </ol>
16905 </li>
16906 </ol>
16907
16908 !! end
16909
16910 !! test
16911 HTML nested ordered list, open tags (bug 5497)
16912 !! wikitext
16913 <ol>
16914 <li>One
16915 <li>Two:
16916 <ol>
16917 <li>Sub-one
16918 <li>Sub-two
16919 </ol>
16920 </ol>
16921 !! html/php
16922 <ol>
16923 <li>One
16924 <li>Two:
16925 <ol>
16926 <li>Sub-one
16927 <li>Sub-two
16928 </ol>
16929 </ol>
16930
16931 !! html/parsoid
16932 <ol>
16933 <li>One
16934 </li>
16935 <li>Two:
16936 <ol>
16937 <li>Sub-one
16938 </li>
16939 <li>Sub-two
16940 </li>
16941 </ol>
16942 </li>
16943 </ol>
16944
16945 !! end
16946
16947 !! test
16948 HTML ordered list item with parameters oddity
16949 !! wikitext
16950 <ol><li id="fragment">One</li>
16951 </ol>
16952 !! html
16953 <ol><li id="fragment">One</li>
16954 </ol>
16955
16956 !! end
16957
16958 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16959 !!test
16960 bug 5918: autonumbering
16961 !! wikitext
16962 [http://first/] [http://second] [ftp://ftp]
16963
16964 ftp://inlineftp
16965
16966 [mailto:enclosed@mail.tld With target]
16967
16968 [mailto:enclosed@mail.tld]
16969
16970 mailto:inline@mail.tld
16971 !! html/php
16972 <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>
16973 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16974 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16975 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16976 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16977 </p>
16978 !! html/parsoid
16979 <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>
16980 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16981 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16982 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16983 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16984 !! end
16985
16986
16987 #
16988 # Security and HTML correctness
16989 # From Nick Jenkins' fuzz testing
16990 #
16991
16992 !! test
16993 Fuzz testing: Parser13
16994 !! wikitext
16995 {|
16996 | http://a|
16997 !! html
16998 <table>
16999 <tr>
17000 <td>
17001 </td>
17002 </tr>
17003 </table>
17004
17005 !! end
17006
17007 !! test
17008 Fuzz testing: Parser14
17009 !! wikitext
17010 == onmouseover= ==
17011 http://__TOC__
17012 !! html
17013 <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>
17014 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17015 <ul>
17016 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17017 </ul>
17018 </div>
17019
17020
17021 !! html+tidy
17022 <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>
17023 <p>http://</p>
17024 <div id="toc" class="toc">
17025 <div id="toctitle">
17026 <h2>Contents</h2>
17027 </div>
17028 <ul>
17029 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17030 </ul>
17031 </div>
17032 <p></p>
17033 !! end
17034
17035 !! test
17036 Fuzz testing: Parser14-table
17037 !! wikitext
17038 ==a==
17039 {| STYLE=__TOC__
17040 !! html
17041 <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>
17042 <table style="&#95;_TOC&#95;_">
17043 <tr><td></td></tr>
17044 </table>
17045
17046 !! html+tidy
17047 <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>
17048 <table style="__TOC__">
17049 <tr>
17050 <td></td>
17051 </tr>
17052 </table>
17053 !! end
17054
17055 # Known to produce bogus xml (extra </td>)
17056 !! test
17057 Fuzz testing: Parser16
17058 !! options
17059 noxml
17060 !! wikitext
17061 {|
17062 !https://||||||
17063 !! html
17064 <table>
17065 <tr>
17066 <th>https://</th>
17067 <th></th>
17068 <th></th>
17069 <th>
17070 </td>
17071 </tr>
17072 </table>
17073
17074 !! html+tidy
17075 <table>
17076 <tr>
17077 <th>https://</th>
17078 <th></th>
17079 <th></th>
17080 <th></th>
17081 </tr>
17082 </table>
17083 !! end
17084
17085 !! test
17086 Fuzz testing: Parser21
17087 !! wikitext
17088 {|
17089 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17090 |
17091 !! html
17092 <table>
17093 <tr>
17094 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17095 </th>
17096 <td>
17097 </td>
17098 </tr>
17099 </table>
17100
17101 !! end
17102
17103 !! test
17104 Fuzz testing: Parser22
17105 !! wikitext
17106 http://===r:::https://b
17107
17108 {|
17109 !! html
17110 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17111 </p>
17112 <table>
17113 <tr><td></td></tr>
17114 </table>
17115
17116 !! end
17117
17118 # Known to produce bad XML for now
17119 !! test
17120 Fuzz testing: Parser24
17121 !! options
17122 noxml
17123 !! wikitext
17124 {|
17125 {{{|
17126 <u CLASS=
17127 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17128 <br style="onmouseover='alert(document.cookie);' " />
17129
17130 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17131 |
17132 !! html
17133 <table>
17134 {{{|
17135 <u class="&#124;">}}}} &gt;
17136 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17137
17138 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17139 <tr>
17140 <td></u>
17141 </td>
17142 </tr>
17143 </table>
17144
17145 !! end
17146
17147 # Note: the current result listed for this is not what the original one was,
17148 # but the original bug was JavaScript injection, which is fixed in any case.
17149 # It's not clear that the original result listed was any more correct than the
17150 # current one. Original result:
17151 # <p>{{{|
17152 # </p>
17153 # <li class="&#124;&#124;">
17154 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17155 !!test
17156 Fuzz testing: Parser25 (bug 6055)
17157 !! wikitext
17158 {{{
17159 |
17160 <LI CLASS=||
17161 >
17162 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17163 !! html
17164 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17165 </p>
17166 !! end
17167
17168 !!test
17169 Fuzz testing: URL adjacent extension (with space, clean)
17170 !! wikitext
17171 http://example.com <nowiki>junk</nowiki>
17172 !! html/php
17173 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17174 </p>
17175 !! html/parsoid
17176 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17177 !! end
17178
17179 !!test
17180 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17181 !! wikitext
17182 http://example.com<nowiki>junk</nowiki>
17183 !! html/php
17184 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17185 </p>
17186 !! html/parsoid
17187 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17188 !! end
17189
17190 !!test
17191 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17192 !! wikitext
17193 http://example.com<pre>junk</pre>
17194 !! html/php
17195 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17196
17197 !! html/php+tidy
17198 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17199 <pre>
17200 junk
17201 </pre>
17202 !! html/parsoid
17203 <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>
17204 !!end
17205
17206 !!test
17207 Fuzz testing: image with bogus manual thumbnail
17208 !! wikitext
17209 [[Image:foobar.jpg|thumbnail= ]]
17210 !! html/php
17211 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17212
17213 !! html/parsoid
17214 <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>
17215 !!end
17216
17217 !! test
17218 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17219 !! wikitext
17220 <pre dir="&#10;"></pre>
17221 !! html
17222 <pre dir="&#10;"></pre>
17223
17224 !! end
17225
17226 !! test
17227 Parsing optional HTML elements (Bug 6171)
17228 !! options
17229 !! wikitext
17230 <table>
17231 <tr>
17232 <td> Some tabular data</td>
17233 <td> More tabular data ...
17234 <td> And yet som tabular data</td>
17235 </tr>
17236 </table>
17237 !! html
17238 <table>
17239 <tr>
17240 <td> Some tabular data</td>
17241 <td> More tabular data ...
17242 </td><td> And yet som tabular data</td>
17243 </tr>
17244 </table>
17245
17246 !! end
17247
17248 !! test
17249 Correct handling of <td>, <tr> (Bug 6171)
17250 !! options
17251 !! wikitext
17252 <table>
17253 <tr>
17254 <td> Some tabular data</td>
17255 <td> More tabular data ...</td>
17256 <td> And yet som tabular data</td>
17257 </tr>
17258 </table>
17259 !! html
17260 <table>
17261 <tr>
17262 <td> Some tabular data</td>
17263 <td> More tabular data ...</td>
17264 <td> And yet som tabular data</td>
17265 </tr>
17266 </table>
17267
17268 !! end
17269
17270
17271 !! test
17272 Parsing crashing regression (fr:JavaScript)
17273 !! wikitext
17274 </body></x>
17275 !! html
17276 <p>&lt;/body&gt;&lt;/x&gt;
17277 </p>
17278 !! end
17279
17280 !! test
17281 Inline wiki vs wiki block nesting
17282 !! wikitext
17283 '''Bold paragraph
17284
17285 New wiki paragraph
17286 !! html
17287 <p><b>Bold paragraph</b>
17288 </p><p>New wiki paragraph
17289 </p>
17290 !! end
17291
17292 # FIXME: The current php output is documented
17293 # and desired output is the parsoid target.
17294 !! test
17295 Inline HTML vs wiki block nesting
17296 !! wikitext
17297 <b>Bold paragraph
17298
17299 New wiki paragraph
17300 !! html/php
17301 <p><b>Bold paragraph
17302 </p><p>New wiki paragraph</b>
17303 </p>
17304 !! html/parsoid
17305 <p><b>Bold paragraph</b>
17306 </p><p>New wiki paragraph
17307 </p>
17308 !! end
17309
17310 # Original result was this:
17311 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17312 # </p>
17313 # While that might be marginally more intuitive, maybe, the six-apostrophe
17314 # construct is clearly pathological and the result stated here (which is what
17315 # the parser actually does) is about as reasonable as anything.
17316 !!test
17317 Mixing markup for italics and bold
17318 !! options
17319 !! wikitext
17320 '''bold''''''bold''bolditalics'''''
17321 !! html
17322 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17323 </p>
17324 !! end
17325
17326
17327 !! article
17328 Xyzzyx
17329 !! text
17330 Article for special page transclusion test
17331 !! endarticle
17332
17333 !! test
17334 Special page transclusion
17335 !! options
17336 !! wikitext
17337 {{Special:Prefixindex/Xyzzyx}}
17338 !! html
17339 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17340 </ul>
17341
17342 !! end
17343
17344 !! test
17345 Special page transclusion twice (bug 5021)
17346 !! options
17347 !! wikitext
17348 {{Special:Prefixindex/Xyzzyx}}
17349 {{Special:Prefixindex/Xyzzyx}}
17350 !! html
17351 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17352 </ul>
17353 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17354 </ul>
17355
17356 !! end
17357
17358 !! test
17359 Transclusion of default MediaWiki message
17360 !! wikitext
17361 {{MediaWiki:Mainpage}}
17362 !! html
17363 <p>Main Page
17364 </p>
17365 !! end
17366
17367 !! test
17368 Transclusion of nonexistent MediaWiki message
17369 !! wikitext
17370 {{MediaWiki:Mainpagexxx}}
17371 !! html
17372 <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>
17373 </p>
17374 !! end
17375
17376 !! test
17377 Transclusion of MediaWiki message with underscore
17378 !! wikitext
17379 {{MediaWiki:history_short}}
17380 !! html
17381 <p>History
17382 </p>
17383 !! end
17384
17385 !! test
17386 Transclusion of MediaWiki message with space
17387 !! wikitext
17388 {{MediaWiki:history short}}
17389 !! html
17390 <p>History
17391 </p>
17392 !! end
17393
17394 !! test
17395 Invalid header with following text
17396 !! wikitext
17397 = x = y
17398 !! html
17399 <p>= x = y
17400 </p>
17401 !! end
17402
17403
17404 !! test
17405 Section extraction test (section 0)
17406 !! options
17407 section=0
17408 !! wikitext
17409 start
17410 ==a==
17411 ===aa===
17412 ====aaa====
17413 ==b==
17414 ===ba===
17415 ===bb===
17416 ====bba====
17417 ===bc===
17418 ==c==
17419 ===ca===
17420 !! html/php
17421 start
17422 !! end
17423
17424 !! test
17425 Section extraction test (section 1)
17426 !! options
17427 section=1
17428 !! wikitext
17429 start
17430 ==a==
17431 ===aa===
17432 ====aaa====
17433 ==b==
17434 ===ba===
17435 ===bb===
17436 ====bba====
17437 ===bc===
17438 ==c==
17439 ===ca===
17440 !! html/php
17441 ==a==
17442 ===aa===
17443 ====aaa====
17444 !! end
17445
17446 !! test
17447 Section extraction test (section 2)
17448 !! options
17449 section=2
17450 !! wikitext
17451 start
17452 ==a==
17453 ===aa===
17454 ====aaa====
17455 ==b==
17456 ===ba===
17457 ===bb===
17458 ====bba====
17459 ===bc===
17460 ==c==
17461 ===ca===
17462 !! html/php
17463 ===aa===
17464 ====aaa====
17465 !! end
17466
17467 !! test
17468 Section extraction test (section 3)
17469 !! options
17470 section=3
17471 !! wikitext
17472 start
17473 ==a==
17474 ===aa===
17475 ====aaa====
17476 ==b==
17477 ===ba===
17478 ===bb===
17479 ====bba====
17480 ===bc===
17481 ==c==
17482 ===ca===
17483 !! html/php
17484 ====aaa====
17485 !! end
17486
17487 !! test
17488 Section extraction test (section 4)
17489 !! options
17490 section=4
17491 !! wikitext
17492 start
17493 ==a==
17494 ===aa===
17495 ====aaa====
17496 ==b==
17497 ===ba===
17498 ===bb===
17499 ====bba====
17500 ===bc===
17501 ==c==
17502 ===ca===
17503 !! html/php
17504 ==b==
17505 ===ba===
17506 ===bb===
17507 ====bba====
17508 ===bc===
17509 !! end
17510
17511 !! test
17512 Section extraction test (section 5)
17513 !! options
17514 section=5
17515 !! wikitext
17516 start
17517 ==a==
17518 ===aa===
17519 ====aaa====
17520 ==b==
17521 ===ba===
17522 ===bb===
17523 ====bba====
17524 ===bc===
17525 ==c==
17526 ===ca===
17527 !! html/php
17528 ===ba===
17529 !! end
17530
17531 !! test
17532 Section extraction test (section 6)
17533 !! options
17534 section=6
17535 !! wikitext
17536 start
17537 ==a==
17538 ===aa===
17539 ====aaa====
17540 ==b==
17541 ===ba===
17542 ===bb===
17543 ====bba====
17544 ===bc===
17545 ==c==
17546 ===ca===
17547 !! html/php
17548 ===bb===
17549 ====bba====
17550 !! end
17551
17552 !! test
17553 Section extraction test (section 7)
17554 !! options
17555 section=7
17556 !! wikitext
17557 start
17558 ==a==
17559 ===aa===
17560 ====aaa====
17561 ==b==
17562 ===ba===
17563 ===bb===
17564 ====bba====
17565 ===bc===
17566 ==c==
17567 ===ca===
17568 !! html/php
17569 ====bba====
17570 !! end
17571
17572 !! test
17573 Section extraction test (section 8)
17574 !! options
17575 section=8
17576 !! wikitext
17577 start
17578 ==a==
17579 ===aa===
17580 ====aaa====
17581 ==b==
17582 ===ba===
17583 ===bb===
17584 ====bba====
17585 ===bc===
17586 ==c==
17587 ===ca===
17588 !! html/php
17589 ===bc===
17590 !! end
17591
17592 !! test
17593 Section extraction test (section 9)
17594 !! options
17595 section=9
17596 !! wikitext
17597 start
17598 ==a==
17599 ===aa===
17600 ====aaa====
17601 ==b==
17602 ===ba===
17603 ===bb===
17604 ====bba====
17605 ===bc===
17606 ==c==
17607 ===ca===
17608 !! html/php
17609 ==c==
17610 ===ca===
17611 !! end
17612
17613 !! test
17614 Section extraction test (section 10)
17615 !! options
17616 section=10
17617 !! wikitext
17618 start
17619 ==a==
17620 ===aa===
17621 ====aaa====
17622 ==b==
17623 ===ba===
17624 ===bb===
17625 ====bba====
17626 ===bc===
17627 ==c==
17628 ===ca===
17629 !! html/php
17630 ===ca===
17631 !! end
17632
17633 !! test
17634 Section extraction test (nonexistent section 11)
17635 !! options
17636 section=11
17637 !! wikitext
17638 start
17639 ==a==
17640 ===aa===
17641 ====aaa====
17642 ==b==
17643 ===ba===
17644 ===bb===
17645 ====bba====
17646 ===bc===
17647 ==c==
17648 ===ca===
17649 !! html/php
17650 !! end
17651
17652 !! test
17653 Section extraction test with bogus heading (section 1)
17654 !! options
17655 section=1
17656 !! wikitext
17657 ==a==
17658 ==bogus== not a legal section
17659 ==b==
17660 !! html/php
17661 ==a==
17662 ==bogus== not a legal section
17663 !! end
17664
17665 !! test
17666 Section extraction test with bogus heading (section 2)
17667 !! options
17668 section=2
17669 !! wikitext
17670 ==a==
17671 ==bogus== not a legal section
17672 ==b==
17673 !! html/php
17674 ==b==
17675 !! end
17676
17677 !! test
17678 Section extraction test with comment after heading (section 1)
17679 !! options
17680 section=1
17681 !! wikitext
17682 ==a==
17683 ==b== <!-- -->
17684 ==c==
17685 !! html/php
17686 ==a==
17687 !! end
17688
17689 !! test
17690 Section extraction test with comment after heading (section 2)
17691 !! options
17692 section=2
17693 !! wikitext
17694 ==a==
17695 ==b== <!-- -->
17696 ==c==
17697 !! html/php
17698 ==b== <!-- -->
17699 !! end
17700
17701 !! test
17702 Section extraction test with bogus <nowiki> heading (section 1)
17703 !! options
17704 section=1
17705 !! wikitext
17706 ==a==
17707 ==bogus== <nowiki>not a legal section</nowiki>
17708 ==b==
17709 !! html/php
17710 ==a==
17711 ==bogus== <nowiki>not a legal section</nowiki>
17712 !! end
17713
17714 !! test
17715 Section extraction test with bogus <nowiki> heading (section 2)
17716 !! options
17717 section=2
17718 !! wikitext
17719 ==a==
17720 ==bogus== <nowiki>not a legal section</nowiki>
17721 ==b==
17722 !! html/php
17723 ==b==
17724 !! end
17725
17726 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17727 # instead of respecting commented sections
17728 !! test
17729 Section extraction prefixed by comment (section 1)
17730 !! options
17731 section=1
17732 !! wikitext
17733 <!-- -->==sec1==
17734 ==sec2==
17735 !! html/php
17736 ==sec2==
17737 !!end
17738
17739 !! test
17740 Section extraction prefixed by comment (section 2)
17741 !! options
17742 section=2
17743 !! wikitext
17744 <!-- -->==sec1==
17745 ==sec2==
17746 !! html/php
17747
17748 !!end
17749
17750 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17751 # instead of respecting HTML-style headings
17752 !! test
17753 Section extraction, mixed wiki and html (section 1)
17754 !! options
17755 section=1
17756 !! wikitext
17757 <h2>unmarked</h2>
17758 unmarked
17759 ==1==
17760 one
17761 ==2==
17762 two
17763 !! html/php
17764 ==1==
17765 one
17766 !! end
17767
17768 !! test
17769 Section extraction, mixed wiki and html (section 2)
17770 !! options
17771 section=2
17772 !! wikitext
17773 <h2>unmarked</h2>
17774 unmarked
17775 ==1==
17776 one
17777 ==2==
17778 two
17779 !! html/php
17780 ==2==
17781 two
17782 !! end
17783
17784
17785 # Formerly testing for bug 3342
17786 !! test
17787 Section extraction, heading surrounded by <noinclude>
17788 !! options
17789 section=1
17790 !! wikitext
17791 <noinclude>==unmarked==</noinclude>
17792 ==marked==
17793 !! html/php
17794 ==marked==
17795 !!end
17796
17797 # Test behavior of bug 19910
17798 !! test
17799 Sectiion with all-equals
17800 !! options
17801 section=2
17802 !! wikitext
17803 ===
17804 The line above must have a trailing space
17805 === <!--
17806 --> <!-- -->
17807 But just in case it doesn't...
17808 !! html/php
17809 === <!--
17810 --> <!-- -->
17811 But just in case it doesn't...
17812 !! end
17813
17814 !! test
17815 Section replacement test (section 0)
17816 !! options
17817 replace=0,"xxx"
17818 !! wikitext
17819 start
17820 ==a==
17821 ===aa===
17822 ====aaa====
17823 ==b==
17824 ===ba===
17825 ===bb===
17826 ====bba====
17827 ===bc===
17828 ==c==
17829 ===ca===
17830 !! html/php
17831 xxx
17832
17833 ==a==
17834 ===aa===
17835 ====aaa====
17836 ==b==
17837 ===ba===
17838 ===bb===
17839 ====bba====
17840 ===bc===
17841 ==c==
17842 ===ca===
17843 !! end
17844
17845 !! test
17846 Section replacement test (section 1)
17847 !! options
17848 replace=1,"xxx"
17849 !! wikitext
17850 start
17851 ==a==
17852 ===aa===
17853 ====aaa====
17854 ==b==
17855 ===ba===
17856 ===bb===
17857 ====bba====
17858 ===bc===
17859 ==c==
17860 ===ca===
17861 !! html/php
17862 start
17863 xxx
17864
17865 ==b==
17866 ===ba===
17867 ===bb===
17868 ====bba====
17869 ===bc===
17870 ==c==
17871 ===ca===
17872 !! end
17873
17874 !! test
17875 Section replacement test (section 2)
17876 !! options
17877 replace=2,"xxx"
17878 !! wikitext
17879 start
17880 ==a==
17881 ===aa===
17882 ====aaa====
17883 ==b==
17884 ===ba===
17885 ===bb===
17886 ====bba====
17887 ===bc===
17888 ==c==
17889 ===ca===
17890 !! html/php
17891 start
17892 ==a==
17893 xxx
17894
17895 ==b==
17896 ===ba===
17897 ===bb===
17898 ====bba====
17899 ===bc===
17900 ==c==
17901 ===ca===
17902 !! end
17903
17904 !! test
17905 Section replacement test (section 3)
17906 !! options
17907 replace=3,"xxx"
17908 !! wikitext
17909 start
17910 ==a==
17911 ===aa===
17912 ====aaa====
17913 ==b==
17914 ===ba===
17915 ===bb===
17916 ====bba====
17917 ===bc===
17918 ==c==
17919 ===ca===
17920 !! html/php
17921 start
17922 ==a==
17923 ===aa===
17924 xxx
17925
17926 ==b==
17927 ===ba===
17928 ===bb===
17929 ====bba====
17930 ===bc===
17931 ==c==
17932 ===ca===
17933 !! end
17934
17935 !! test
17936 Section replacement test (section 4)
17937 !! options
17938 replace=4,"xxx"
17939 !! wikitext
17940 start
17941 ==a==
17942 ===aa===
17943 ====aaa====
17944 ==b==
17945 ===ba===
17946 ===bb===
17947 ====bba====
17948 ===bc===
17949 ==c==
17950 ===ca===
17951 !! html/php
17952 start
17953 ==a==
17954 ===aa===
17955 ====aaa====
17956 xxx
17957
17958 ==c==
17959 ===ca===
17960 !! end
17961
17962 !! test
17963 Section replacement test (section 5)
17964 !! options
17965 replace=5,"xxx"
17966 !! wikitext
17967 start
17968 ==a==
17969 ===aa===
17970 ====aaa====
17971 ==b==
17972 ===ba===
17973 ===bb===
17974 ====bba====
17975 ===bc===
17976 ==c==
17977 ===ca===
17978 !! html/php
17979 start
17980 ==a==
17981 ===aa===
17982 ====aaa====
17983 ==b==
17984 xxx
17985
17986 ===bb===
17987 ====bba====
17988 ===bc===
17989 ==c==
17990 ===ca===
17991 !! end
17992
17993 !! test
17994 Section replacement test (section 6)
17995 !! options
17996 replace=6,"xxx"
17997 !! wikitext
17998 start
17999 ==a==
18000 ===aa===
18001 ====aaa====
18002 ==b==
18003 ===ba===
18004 ===bb===
18005 ====bba====
18006 ===bc===
18007 ==c==
18008 ===ca===
18009 !! html/php
18010 start
18011 ==a==
18012 ===aa===
18013 ====aaa====
18014 ==b==
18015 ===ba===
18016 xxx
18017
18018 ===bc===
18019 ==c==
18020 ===ca===
18021 !! end
18022
18023 !! test
18024 Section replacement test (section 7)
18025 !! options
18026 replace=7,"xxx"
18027 !! wikitext
18028 start
18029 ==a==
18030 ===aa===
18031 ====aaa====
18032 ==b==
18033 ===ba===
18034 ===bb===
18035 ====bba====
18036 ===bc===
18037 ==c==
18038 ===ca===
18039 !! html/php
18040 start
18041 ==a==
18042 ===aa===
18043 ====aaa====
18044 ==b==
18045 ===ba===
18046 ===bb===
18047 xxx
18048
18049 ===bc===
18050 ==c==
18051 ===ca===
18052 !! end
18053
18054 !! test
18055 Section replacement test (section 8)
18056 !! options
18057 replace=8,"xxx"
18058 !! wikitext
18059 start
18060 ==a==
18061 ===aa===
18062 ====aaa====
18063 ==b==
18064 ===ba===
18065 ===bb===
18066 ====bba====
18067 ===bc===
18068 ==c==
18069 ===ca===
18070 !! html/php
18071 start
18072 ==a==
18073 ===aa===
18074 ====aaa====
18075 ==b==
18076 ===ba===
18077 ===bb===
18078 ====bba====
18079 xxx
18080
18081 ==c==
18082 ===ca===
18083 !!end
18084
18085 !! test
18086 Section replacement test (section 9)
18087 !! options
18088 replace=9,"xxx"
18089 !! wikitext
18090 start
18091 ==a==
18092 ===aa===
18093 ====aaa====
18094 ==b==
18095 ===ba===
18096 ===bb===
18097 ====bba====
18098 ===bc===
18099 ==c==
18100 ===ca===
18101 !! html/php
18102 start
18103 ==a==
18104 ===aa===
18105 ====aaa====
18106 ==b==
18107 ===ba===
18108 ===bb===
18109 ====bba====
18110 ===bc===
18111 xxx
18112 !! end
18113
18114 !! test
18115 Section replacement test (section 10)
18116 !! options
18117 replace=10,"xxx"
18118 !! wikitext
18119 start
18120 ==a==
18121 ===aa===
18122 ====aaa====
18123 ==b==
18124 ===ba===
18125 ===bb===
18126 ====bba====
18127 ===bc===
18128 ==c==
18129 ===ca===
18130 !! html/php
18131 start
18132 ==a==
18133 ===aa===
18134 ====aaa====
18135 ==b==
18136 ===ba===
18137 ===bb===
18138 ====bba====
18139 ===bc===
18140 ==c==
18141 xxx
18142 !! end
18143
18144 !! test
18145 Section replacement test with initial whitespace (bug 13728)
18146 !! options
18147 replace=2,"xxx"
18148 !! wikitext
18149 Preformatted initial line
18150 ==a==
18151 ===a===
18152 !! html/php
18153 Preformatted initial line
18154 ==a==
18155 xxx
18156 !! end
18157
18158
18159 !! test
18160 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18161 !! options
18162 section=1
18163 !! wikitext
18164 ==a==
18165 a
18166 !! html/php
18167 ==a==
18168 a
18169 !! end
18170
18171 !! test
18172 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18173 !! options
18174 section=1
18175 !! wikitext
18176 ==a==
18177 a
18178 !! html/php
18179 ==a==
18180 a
18181 !! end
18182
18183
18184 !! test
18185 Section extraction, <pre> around bogus header (bug 10309)
18186 !! options
18187 noxml section=2
18188 !! wikitext
18189 == Section One ==
18190 <pre>
18191 =======
18192 </pre>
18193
18194 == Section Two ==
18195 stuff
18196 !! html/php
18197 == Section Two ==
18198 stuff
18199 !! end
18200
18201 !! test
18202 Section replacement, <pre> around bogus header (bug 10309)
18203 !! options
18204 noxml replace=2,"xxx"
18205 !! wikitext
18206 == Section One ==
18207 <pre>
18208 =======
18209 </pre>
18210
18211 == Section Two ==
18212 stuff
18213 !! html/php
18214 == Section One ==
18215 <pre>
18216 =======
18217 </pre>
18218
18219 xxx
18220 !! end
18221
18222
18223 !! test
18224 Handling of &#x0A; in URLs
18225 !! wikitext
18226 ** irc://&#x0A;a
18227 !! html/php
18228 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18229
18230 !! html/parsoid
18231 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18232 a">irc://
18233 a</a></li></ul></li></ul>
18234 !! end
18235
18236 !! test
18237 Handling of %0A in URLs
18238 !! wikitext
18239 ** irc://%0Aa
18240 !! html/php
18241 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18242
18243 !! html/parsoid
18244 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18245 !! end
18246
18247
18248 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18249 !! test
18250 5 quotes, code coverage +1 line
18251 !! options
18252 parsoid=wt2html
18253 !! wikitext
18254 '''''
18255 !! html/php
18256 !! html/parsoid
18257 <p><b><i></i></b></p>
18258 !! end
18259
18260 # same html as previous, but wikitext adjusted to match parsoid html2wt
18261 # note that wt2html and html2html will put the <i> before the <b>
18262 !! test
18263 5 quotes, code coverage +1 line w/ nowiki (1)
18264 !! options
18265 parsoid=wt2wt,html2wt
18266 !! wikitext
18267 '''''<nowiki/>'''''
18268 !! html/php
18269 <p><i></i>
18270 </p>
18271 !! html/parsoid
18272 <p><b><i></i></b></p>
18273 !! end
18274
18275 # same as previous, just swapping the <i> and <b>
18276 !! test
18277 5 quotes, code coverage +1 line w/ nowiki (2)
18278 !! wikitext
18279 '''''<nowiki/>'''''
18280 !! html/php
18281 <p><i></i>
18282 </p>
18283 !! html/parsoid
18284 <p><i><b></b></i></p>
18285 !! end
18286
18287 !! test
18288 Special:Search page linking.
18289 !! wikitext
18290 {{Special:search}}
18291 !! html
18292 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18293 </p>
18294 !! end
18295
18296 !! test
18297 {{!}} is a magic word
18298 !! wikitext
18299 {{!}} is a magic word there and {{!}} is still a magic word here
18300 | is not a magic word here but {{!}} is still a magic word here
18301 !! html/php
18302 <p>| is a magic word there and | is still a magic word here
18303 | is not a magic word here but | is still a magic word here
18304 </p>
18305 !! html/parsoid
18306 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is a magic word there and <span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is still a magic word here
18307 | is not a magic word here but <span about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is still a magic word here</p>
18308
18309 !! end
18310
18311 !! test
18312 Say the magic word
18313 !! options
18314 title=[[Parser test]]
18315 !! wikitext
18316 * {{PAGENAME}}
18317 * {{PAGENAMEE}}
18318 * {{FULLPAGENAME}}
18319 * {{FULLPAGENAMEE}}
18320 * {{BASEPAGENAME}}
18321 * {{BASEPAGENAMEE}}
18322 * {{SUBPAGENAME}}
18323 * {{SUBPAGENAMEE}}
18324 * {{ROOTPAGENAME}}
18325 * {{ROOTPAGENAMEE}}
18326 * {{TALKPAGENAME}}
18327 * {{TALKPAGENAMEE}}
18328 * {{SUBJECTPAGENAME}}
18329 * {{SUBJECTPAGENAMEE}}
18330 * {{NAMESPACEE}}
18331 * {{NAMESPACE}}
18332 * {{NAMESPACENUMBER}}
18333 * {{TALKSPACE}}
18334 * {{TALKSPACEE}}
18335 * {{SUBJECTSPACE}}
18336 * {{SUBJECTSPACEE}}
18337 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18338 !! html
18339 <ul><li> Parser test</li>
18340 <li> Parser_test</li>
18341 <li> Parser test</li>
18342 <li> Parser_test</li>
18343 <li> Parser test</li>
18344 <li> Parser_test</li>
18345 <li> Parser test</li>
18346 <li> Parser_test</li>
18347 <li> Parser test</li>
18348 <li> Parser_test</li>
18349 <li> Talk:Parser test</li>
18350 <li> Talk:Parser_test</li>
18351 <li> Parser test</li>
18352 <li> Parser_test</li>
18353 <li> </li>
18354 <li> </li>
18355 <li> 0</li>
18356 <li> Talk</li>
18357 <li> Talk</li>
18358 <li> </li>
18359 <li> </li>
18360 <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>
18361
18362 !! end
18363 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18364
18365 !! test
18366 Gallery
18367 !! wikitext
18368 <gallery>
18369 image1.png |
18370 image2.gif|||||
18371
18372 image3|
18373 image4 |300px| centre
18374 image5.svg| http://///////
18375 [[x|xx]]]]
18376 * image6
18377 </gallery>
18378 !! html
18379 <ul class="gallery mw-gallery-traditional">
18380 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18381 <div class="thumb" style="height: 150px;">Image1.png</div>
18382 <div class="gallerytext">
18383 </div>
18384 </div></li>
18385 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18386 <div class="thumb" style="height: 150px;">Image2.gif</div>
18387 <div class="gallerytext">
18388 </div>
18389 </div></li>
18390 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18391 <div class="thumb" style="height: 150px;">Image3</div>
18392 <div class="gallerytext">
18393 </div>
18394 </div></li>
18395 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18396 <div class="thumb" style="height: 150px;">Image4</div>
18397 <div class="gallerytext">
18398 <pre>centre
18399 </pre>
18400 </div>
18401 </div></li>
18402 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18403 <div class="thumb" style="height: 150px;">Image5.svg</div>
18404 <div class="gallerytext">
18405 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18406 </p>
18407 </div>
18408 </div></li>
18409 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18410 <div class="thumb" style="height: 150px;">* image6</div>
18411 <div class="gallerytext">
18412 </div>
18413 </div></li>
18414 </ul>
18415
18416 !! end
18417
18418 !! test
18419 Gallery (with options)
18420 !! wikitext
18421 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18422 File:Nonexistent.jpg|caption
18423 File:Nonexistent.jpg
18424 image:foobar.jpg|some '''caption''' [[Main Page]]
18425 image:foobar.jpg
18426 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18427 </gallery>
18428 !! html
18429 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18430 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18431 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18432 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18433 <div class="gallerytext">
18434 <p>caption
18435 </p>
18436 </div>
18437 </div></li>
18438 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18439 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18440 <div class="gallerytext">
18441 </div>
18442 </div></li>
18443 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18444 <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>
18445 <div class="gallerytext">
18446 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18447 </p>
18448 </div>
18449 </div></li>
18450 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18451 <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>
18452 <div class="gallerytext">
18453 </div>
18454 </div></li>
18455 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18456 <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>
18457 <div class="gallerytext">
18458 <p>blabla.
18459 </p>
18460 </div>
18461 </div></li>
18462 </ul>
18463
18464 !! end
18465
18466 !! test
18467 Gallery with link that has fragment
18468 !! wikitext
18469 <gallery>
18470 image:foobar.jpg|link=Main_Page
18471 image:foobar.jpg|link=Main_Page#section
18472 image:foobar.jpg|link=Main Page#section|caption
18473 </gallery>
18474 !! html
18475 <ul class="gallery mw-gallery-traditional">
18476 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18477 <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>
18478 <div class="gallerytext">
18479 </div>
18480 </div></li>
18481 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18482 <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>
18483 <div class="gallerytext">
18484 </div>
18485 </div></li>
18486 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18487 <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>
18488 <div class="gallerytext">
18489 <p>caption
18490 </p>
18491 </div>
18492 </div></li>
18493 </ul>
18494
18495 !! end
18496
18497 !! test
18498 Gallery with wikitext inside caption
18499 !! wikitext
18500 <gallery>
18501 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18502 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18503 </gallery>
18504 !! html
18505 <ul class="gallery mw-gallery-traditional">
18506 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18507 <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>
18508 <div class="gallerytext">
18509 <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>
18510 </p>
18511 </div>
18512 </div></li>
18513 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18514 <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>
18515 <div class="gallerytext">
18516 <p>This is a test template
18517 </p>
18518 </div>
18519 </div></li>
18520 </ul>
18521
18522 !! end
18523
18524 !! test
18525 gallery (with showfilename option)
18526 !! wikitext
18527 <gallery showfilename>
18528 File:Nonexistent.jpg|caption
18529 File:Nonexistent.jpg
18530 image:foobar.jpg|some '''caption''' [[Main Page]]
18531 File:Foobar.jpg
18532 </gallery>
18533 !! html
18534 <ul class="gallery mw-gallery-traditional">
18535 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18536 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18537 <div class="gallerytext">
18538 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18539 caption
18540 </p>
18541 </div>
18542 </div></li>
18543 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18544 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18545 <div class="gallerytext">
18546 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18547 </p>
18548 </div>
18549 </div></li>
18550 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18551 <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>
18552 <div class="gallerytext">
18553 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18554 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18555 </p>
18556 </div>
18557 </div></li>
18558 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18559 <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>
18560 <div class="gallerytext">
18561 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18562 </p>
18563 </div>
18564 </div></li>
18565 </ul>
18566
18567 !! end
18568
18569 !! test
18570 Gallery (with namespace-less filenames)
18571 !! wikitext
18572 <gallery>
18573 File:Nonexistent.jpg
18574 Nonexistent.jpg
18575 image:foobar.jpg
18576 foobar.jpg
18577 </gallery>
18578 !! html
18579 <ul class="gallery mw-gallery-traditional">
18580 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18581 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18582 <div class="gallerytext">
18583 </div>
18584 </div></li>
18585 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18586 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18587 <div class="gallerytext">
18588 </div>
18589 </div></li>
18590 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18591 <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>
18592 <div class="gallerytext">
18593 </div>
18594 </div></li>
18595 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18596 <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>
18597 <div class="gallerytext">
18598 </div>
18599 </div></li>
18600 </ul>
18601
18602 !! end
18603
18604 !! test
18605 HTML Hex character encoding (spells the word "JavaScript")
18606 !! options
18607 parsoid=wt2html,wt2wt,html2html
18608 !! wikitext
18609 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18610 !! html/php
18611 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18612 </p>
18613 !! html/php+tidy
18614 <p>JavaScript</p>
18615 !! html/parsoid
18616 <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>
18617 !! end
18618
18619 !! test
18620 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18621 !! wikitext
18622 &#xsee;&#XSEE;
18623 !! html/php
18624 <p>&amp;#xsee;&amp;#XSEE;
18625 </p>
18626 !! html/parsoid
18627 <p>&amp;#xsee;&amp;#XSEE;</p>
18628 !! end
18629
18630 !! test
18631 HTML Hex character encoding mixed case
18632 !! options
18633 parsoid=wt2html,wt2wt,html2html
18634 !! wikitext
18635 &#xEE;&#Xee;
18636 !! html/php
18637 <p>&#xee;&#xee;
18638 </p>
18639 !! html/php+tidy
18640 <p>îî</p>
18641 !! html/parsoid
18642 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18643 !! end
18644
18645 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18646 # Note that U+000C (form feed) is not a valid XML character, so
18647 # it is banned even though allowed in HTML5.
18648 !! test
18649 Illegal character references (T106578)
18650 !! wikitext
18651 ; Null: &#00;
18652 ; FF: &#xC;
18653 ; CR: &#xD;
18654 ; Control (low): &#8;
18655 ; Control (high): &#x7F; &#x9F;
18656 ; Surrogate: &#xD83D;&#xDCA9;
18657 ; This is an okay astral character: &#x1F4A9;
18658 !! html+tidy
18659 <dl>
18660 <dt>Null</dt>
18661 <dd>&amp;#00;</dd>
18662 <dt>FF</dt>
18663 <dd>&amp;#xC;</dd>
18664 <dt>CR</dt>
18665 <dd>&amp;#xD;</dd>
18666 <dt>Control (low)</dt>
18667 <dd>&amp;#8;</dd>
18668 <dt>Control (high)</dt>
18669 <dd>&amp;#x7F; &amp;#x9F;</dd>
18670 <dt>Surrogate</dt>
18671 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18672 <dt>This is an okay astral character</dt>
18673 <dd>💩</dd>
18674 </dl>
18675 !! end
18676
18677 !! test
18678 __FORCETOC__ override
18679 !! wikitext
18680 __NEWSECTIONLINK__
18681 __FORCETOC__
18682 !! html/php
18683 <p><br />
18684 </p>
18685 !! end
18686
18687 !! test
18688 ISBN code coverage
18689 !! wikitext
18690 ISBN 978-0-1234-56&#x20;789
18691 !! html
18692 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18693 </p>
18694 !! html+tidy
18695 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18696 !! html/parsoid
18697 <p><a href="./Special:BookSources/9780123456" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>789</p>
18698 !! end
18699
18700 !! test
18701 ISBN followed by 5 spaces
18702 !! wikitext
18703 ISBN
18704 !! html
18705 <p>ISBN
18706 </p>
18707 !! end
18708
18709 !! test
18710 Double ISBN
18711 !! wikitext
18712 ISBN ISBN 1234567890
18713 !! html/php
18714 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18715 </p>
18716 !! html/parsoid
18717 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18718 !! end
18719
18720 # Uppercase X and lowercase x as well
18721 !! test
18722 ISBN with an X
18723 !! wikitext
18724 ISBN 3-462-04561-X
18725 ISBN 3-462-04561-x
18726 ISBN 080442957X
18727 ISBN 080442957x
18728 ISBN 978080442957X
18729 ISBN 978080442957x
18730 !! html/php
18731 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18732 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18733 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18734 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18735 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18736 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18737 </p>
18738 !! html/parsoid
18739 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18740 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18741 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18742 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18743 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18744 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18745 !! end
18746
18747 !! test
18748 ISBN with empty prefix (parsoid test)
18749 !! wikitext
18750 ISBN 1234567890
18751 !! html/php
18752 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18753 </p>
18754 !! html/parsoid
18755 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18756 !! end
18757
18758 !! test
18759 Bug 22905: <abbr> followed by ISBN followed by </a>
18760 !! wikitext
18761 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18762 !! html/php
18763 <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>
18764 </p>
18765 !! html/parsoid
18766 <p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" href="http://www.example.com">example.com</a></p>
18767 !! end
18768
18769 !! test
18770 Double RFC
18771 !! wikitext
18772 RFC RFC 1234
18773 !! html
18774 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18775 </p>
18776 !! end
18777
18778 !! test
18779 Double RFC with a wiki link
18780 !! wikitext
18781 RFC [[RFC 1234]]
18782 !! html
18783 <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>
18784 </p>
18785 !! end
18786
18787 !! test
18788 RFC code coverage
18789 !! wikitext
18790 RFC 983&#x20;987
18791 !! html
18792 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18793 </p>
18794 !! html+tidy
18795 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18796 !! end
18797
18798 !! test
18799 Centre-aligned image
18800 !! wikitext
18801 [[Image:foobar.jpg|centre]]
18802 !! html
18803 <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>
18804
18805 !!end
18806
18807 !! test
18808 None-aligned image
18809 !! wikitext
18810 [[Image:foobar.jpg|none]]
18811 !! html
18812 <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>
18813
18814 !!end
18815
18816 !! test
18817 Width + Height sized image (using px) (height is ignored)
18818 !! wikitext
18819 [[Image:foobar.jpg|640x480px]]
18820 !! html
18821 <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>
18822 </p>
18823 !!end
18824
18825 !! test
18826 Width-sized image (using px, no following whitespace)
18827 !! wikitext
18828 [[Image:foobar.jpg|640px]]
18829 !! html
18830 <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>
18831 </p>
18832 !!end
18833
18834 !! test
18835 Width-sized image (using px, with following whitespace - test regression from r39467)
18836 !! wikitext
18837 [[Image:foobar.jpg|640px ]]
18838 !! html
18839 <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>
18840 </p>
18841 !!end
18842
18843 !! test
18844 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18845 !! wikitext
18846 [[Image:foobar.jpg| 640px]]
18847 !! html
18848 <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>
18849 </p>
18850 !!end
18851
18852 !! test
18853 Image with page parameter
18854 !! options
18855 djvu
18856 !! wikitext
18857 [[File:LoremIpsum.djvu|page=2]]
18858 !! html/php
18859 <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>
18860 </p>
18861 !! html/parsoid
18862 <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>
18863 !! end
18864
18865 !! test
18866 Another italics / bold test
18867 !! wikitext
18868 ''' ''x'
18869 !! html
18870 <pre>'<i> </i>x'
18871 </pre>
18872 !!end
18873
18874 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18875 !! test
18876 dt/dd/dl test
18877 !! wikitext
18878 :;;;::
18879 !! html/php
18880 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18881
18882 !! html/parsoid
18883 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18884
18885 !!end
18886
18887
18888 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18889 !! test
18890 Images with the "|" character in the comment
18891 !! wikitext
18892 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18893 !! html/php
18894 <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>
18895
18896 !! html/parsoid
18897 <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>
18898 !! end
18899
18900 !! test
18901 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18902 !! wikitext
18903 <html><script>alert(1);</script></html>
18904 !! html
18905 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18906 </p>
18907 !! end
18908
18909 !! test
18910 HTML with raw HTML ($wgRawHtml==true)
18911 !! options
18912 wgRawHtml=1
18913 !! wikitext
18914 <html><script>alert(1);</script></html>
18915 !! html
18916 <p><script>alert(1);</script>
18917 </p>
18918 !! end
18919
18920 !! test
18921 Parents of subpages, one level up
18922 !! options
18923 subpage title=[[Subpage test/L1/L2/L3]]
18924 !! wikitext
18925 [[../|L2]]
18926 !! html
18927 <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>
18928 </p>
18929 !! end
18930
18931
18932 !! test
18933 Parents of subpages, one level up, not named
18934 !! options
18935 subpage title=[[Subpage test/L1/L2/L3]]
18936 !! wikitext
18937 [[../]]
18938 !! html
18939 <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>
18940 </p>
18941 !! end
18942
18943
18944
18945 !! test
18946 Parents of subpages, two levels up
18947 !! options
18948 subpage title=[[Subpage test/L1/L2/L3]]
18949 !! wikitext
18950 [[../../|L1]]2
18951
18952 [[../../|L1]]l
18953 !! html
18954 <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
18955 </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>
18956 </p>
18957 !! end
18958
18959 !! test
18960 Parents of subpages, two levels up, without trailing slash or name.
18961 !! options
18962 subpage title=[[Subpage test/L1/L2/L3]]
18963 !! wikitext
18964 [[../..]]
18965 !! html
18966 <p>[[../..]]
18967 </p>
18968 !! end
18969
18970 !! test
18971 Parents of subpages, two levels up, with lots of extra trailing slashes.
18972 !! options
18973 subpage title=[[Subpage test/L1/L2/L3]]
18974 !! wikitext
18975 [[../../////]]
18976 !! html
18977 <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>
18978 </p>
18979 !! end
18980
18981 !! article
18982 Subpage test/L1/L2/L3Sibling
18983 !! text
18984 Sibling article
18985 !! endarticle
18986
18987 !! test
18988 Transclusion of a sibling page (one level up)
18989 !! options
18990 subpage title=[[Subpage test/L1/L2/L3]]
18991 !! wikitext
18992 {{../L3Sibling}}
18993 !! html
18994 <p>Sibling article
18995 </p>
18996 !! end
18997
18998 !! test
18999 Transclusion of a child page
19000 !! options
19001 subpage title=[[Subpage test/L1/L2]]
19002 !! wikitext
19003 {{/L3Sibling}}
19004 !! html
19005 <p>Sibling article
19006 </p>
19007 !! end
19008
19009 !! test
19010 Non-transclusion because of too many up levels
19011 !! options
19012 subpage title=[[Subpage test/L1/L2/L3]]
19013 !! wikitext
19014 {{../../../../More than parent}}
19015 !! html
19016 <p>{{../../../../More than parent}}
19017 </p>
19018 !! end
19019
19020 !! test
19021 Definition list code coverage
19022 !! wikitext
19023 ; title : def
19024 ; title : def
19025 ;title: def
19026 !! html/php
19027 <dl><dt> title &#160;</dt>
19028 <dd> def</dd>
19029 <dt> title&#160;</dt>
19030 <dd> def</dd>
19031 <dt>title</dt>
19032 <dd> def</dd></dl>
19033
19034 !! html/parsoid
19035 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19036 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19037 <dt>title</dt><dd> def</dd></dl>
19038 !! end
19039
19040 !! test
19041 Don't fall for the self-closing div
19042 !! wikitext
19043 <div>hello world</div/>
19044 !! html
19045 <div>hello world</div>
19046
19047 !! end
19048
19049 !! test
19050 MSGNW magic word
19051 !! wikitext
19052 {{MSGNW:msg}}
19053 !! html/php
19054 <p>&#91;&#91;:Template:Msg&#93;&#93;
19055 </p>
19056 !! end
19057
19058 !! test
19059 RAW magic word
19060 !! wikitext
19061 {{RAW:QUERTY}}
19062 !! html
19063 <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>
19064 </p>
19065 !! end
19066
19067 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19068 !! test
19069 Always escape literal '>' in output, not just after '<'
19070 !! wikitext
19071 ><>
19072 !! html
19073 <p>&gt;&lt;&gt;
19074 </p>
19075 !! end
19076
19077 !! test
19078 Template caching
19079 !! wikitext
19080 {{Test}}
19081 {{Test}}
19082 !! html
19083 <p>This is a test template
19084 This is a test template
19085 </p>
19086 !! end
19087
19088
19089 !! article
19090 MediaWiki:Fake
19091 !! text
19092 ==header==
19093 !! endarticle
19094
19095 !! test
19096 Inclusion of !userCanEdit() content
19097 !! wikitext
19098 {{MediaWiki:Fake}}
19099 !! html
19100 <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>
19101
19102 !! end
19103
19104
19105 !! test
19106 Out-of-order TOC heading levels
19107 !! wikitext
19108 ==2==
19109 ======6======
19110 ===3===
19111 =1=
19112 =====5=====
19113 ==2==
19114 !! html
19115 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19116 <ul>
19117 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19118 <ul>
19119 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19120 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19121 </ul>
19122 </li>
19123 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19124 <ul>
19125 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19126 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19127 </ul>
19128 </li>
19129 </ul>
19130 </div>
19131
19132 <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>
19133 <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>
19134 <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>
19135 <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>
19136 <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>
19137 <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>
19138
19139 !! end
19140
19141
19142 !! test
19143 ISBN with a dummy number
19144 !! wikitext
19145 ISBN ---
19146 !! html
19147 <p>ISBN ---
19148 </p>
19149 !! end
19150
19151
19152 !! test
19153 ISBN with space-delimited number
19154 !! wikitext
19155 ISBN 92 9017 032 8
19156 !! html
19157 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19158 </p>
19159 !! end
19160
19161
19162 !! test
19163 ISBN with multiple spaces, no number
19164 !! wikitext
19165 ISBN foo
19166 !! html
19167 <p>ISBN foo
19168 </p>
19169 !! end
19170
19171
19172 !! test
19173 ISBN length
19174 !! wikitext
19175 ISBN 123456789
19176
19177 ISBN 1234567890
19178
19179 ISBN 12345678901
19180 !! html
19181 <p>ISBN 123456789
19182 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19183 </p><p>ISBN 12345678901
19184 </p>
19185 !! end
19186
19187
19188 !! test
19189 ISBN with trailing year (bug 8110)
19190 !! wikitext
19191 ISBN 1-234-56789-0 - 2006
19192
19193 ISBN 1 234 56789 0 - 2006
19194 !! html
19195 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19196 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19197 </p>
19198 !! end
19199
19200
19201 !! test
19202 anchorencode
19203 !! wikitext
19204 {{anchorencode:foo bar©#%n}}
19205 !! html
19206 <p>foo_bar.C2.A9.23.25n
19207 </p>
19208 !! end
19209
19210 !! test
19211 anchorencode trims spaces
19212 !! wikitext
19213 {{anchorencode: __pretty__please__}}
19214 !! html
19215 <p>pretty_please
19216 </p>
19217 !! end
19218
19219 !! test
19220 anchorencode deals with links
19221 !! wikitext
19222 {{anchorencode: [[hello|world]] [[hi]]}}
19223 !! html
19224 <p>world_hi
19225 </p>
19226 !! end
19227
19228 !! test
19229 anchorencode deals with templates
19230 !! wikitext
19231 {{anchorencode: {{Foo}} }}
19232 !! html
19233 <p>FOO
19234 </p>
19235 !! end
19236
19237 !! test
19238 anchorencode encodes like the TOC generator: (bug 18431)
19239 !! wikitext
19240 === _ +:.3A%3A&&amp;]] ===
19241 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19242 __NOEDITSECTION__
19243 !! html
19244 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19245 <p>.2B:.3A.253A.26.26.5D.5D
19246 </p>
19247 !! end
19248
19249 !! test
19250 Bug 6200: blockquotes and paragraph formatting
19251 !! wikitext
19252 <blockquote>
19253 foo
19254 </blockquote>
19255
19256 bar
19257
19258 baz
19259 !! html
19260 <blockquote>
19261 <p>foo
19262 </p>
19263 </blockquote>
19264 <p>bar
19265 </p>
19266 <pre>baz
19267 </pre>
19268 !! end
19269
19270 !! test
19271 Bug 8293: Use of center tag ruins paragraph formatting
19272 !! wikitext
19273 <center>
19274 foo
19275 </center>
19276
19277 bar
19278
19279 baz
19280 !! html
19281 <center>
19282 <p>foo
19283 </p>
19284 </center>
19285 <p>bar
19286 </p>
19287 <pre>baz
19288 </pre>
19289 !! end
19290
19291 !!test
19292 Parsing of overlapping (improperly nested) inline html tags
19293 !! wikitext
19294 <span><s>x</span></s>
19295 !! html/php
19296 <p><span><s>x&lt;/span&gt;</s></span>
19297 </p>
19298 !! html/parsoid
19299 <p><span><s>x</s></span>
19300 </p>
19301 !!end
19302
19303 ###
19304 ### Language variants related tests
19305 ###
19306 !! test
19307 Self-link in language variants
19308 !! options
19309 title=[[Dunav]] language=sr
19310 !! wikitext
19311 Both [[Dunav]] and [[Дунав]] are names for this river.
19312 !! html
19313 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19314 </p>
19315 !!end
19316
19317 !! article
19318 Дуна
19319 !! text
19320 content
19321 !! endarticle
19322
19323 !! test
19324 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19325 !! options
19326 title=[[Duna]] language=sr
19327 !! wikitext
19328 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19329 !! html
19330 <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.
19331 </p>
19332 !! end
19333
19334 !! test
19335 Link to a section of a variant of this title shouldn't be parsed as self-link
19336 !! options
19337 title=[[Duna]] language=sr
19338 !! wikitext
19339 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19340 !! html
19341 <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.
19342 </p>
19343 !! end
19344
19345 !! test
19346 Link to pages in language variants
19347 !! options
19348 language=sr
19349 !! wikitext
19350 Main Page can be written as [[Маин Паге]]
19351 !! html
19352 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19353 </p>
19354 !!end
19355
19356
19357 !! test
19358 Multiple links to pages in language variants
19359 !! options
19360 language=sr
19361 !! wikitext
19362 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19363 !! html
19364 <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>.
19365 </p>
19366 !!end
19367
19368
19369 !! test
19370 Simple template in language variants
19371 !! options
19372 language=sr
19373 !! wikitext
19374 {{тест}}
19375 !! html
19376 <p>This is a test template
19377 </p>
19378 !! end
19379
19380
19381 !! test
19382 Template with explicit namespace in language variants
19383 !! options
19384 language=sr
19385 !! wikitext
19386 {{Template:тест}}
19387 !! html
19388 <p>This is a test template
19389 </p>
19390 !! end
19391
19392
19393 !! test
19394 Basic test for template parameter in language variants
19395 !! options
19396 language=sr
19397 !! wikitext
19398 {{парамтест|param=foo}}
19399 !! html
19400 <p>This is a test template with parameter foo
19401 </p>
19402 !! end
19403
19404
19405 !! test
19406 Simple category in language variants
19407 !! options
19408 language=sr cat
19409 !! wikitext
19410 [[Category:МедиаWики Усер'с Гуиде]]
19411 !! html
19412 <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>
19413 !! end
19414
19415
19416 !! article
19417 Category:分类
19418 !! text
19419 blah
19420 !! endarticle
19421
19422 !! article
19423 Category:分類
19424 !! text
19425 blah
19426 !! endarticle
19427
19428 ## We used to, but no longer wt2wt this test since the default serializer
19429 ## will normalize all categories to serialize on their own line.
19430 ## This wikitext usage is going to be fairly uncommon in production and
19431 ## selser will take care of preserving formatting in those scenarios.
19432 !! test
19433 Don't convert blue categorylinks to another variant (bug 33210)
19434 !! options
19435 cat
19436 language=zh
19437 parsoid=wt2html
19438 !! wikitext
19439 [[A]][[Category:分类]]
19440 !! html/php
19441 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19442 !! html/parsoid
19443 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19444 <link rel="mw:PageProp/Category" href="Category:分类"/>
19445 !! end
19446
19447 !! test
19448 Stripping -{}- tags (language variants)
19449 !! options
19450 language=sr
19451 !! wikitext
19452 Latin proverb: -{Ne nuntium necare}-
19453 !! html
19454 <p>Latin proverb: Ne nuntium necare
19455 </p>
19456 !! end
19457
19458
19459 !! test
19460 Prevent conversion with -{}- tags (language variants)
19461 !! options
19462 language=sr variant=sr-ec
19463 !! wikitext
19464 Latinski: -{Ne nuntium necare}-
19465 !! html
19466 <p>Латински: Ne nuntium necare
19467 </p>
19468 !! end
19469
19470
19471 !! test
19472 Prevent conversion of text with -{}- tags (language variants)
19473 !! options
19474 language=sr variant=sr-ec
19475 !! wikitext
19476 Latinski: -{Ne nuntium necare}-
19477 !! html
19478 <p>Латински: Ne nuntium necare
19479 </p>
19480 !! end
19481
19482
19483 !! test
19484 Prevent conversion of links with -{}- tags (language variants)
19485 !! options
19486 language=sr variant=sr-ec
19487 !! wikitext
19488 -{[[Main Page]]}-
19489 !! html
19490 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19491 </p>
19492 !! end
19493
19494
19495 !! test
19496 -{}- tags within headlines (within html for parserConvert())
19497 !! options
19498 language=sr variant=sr-ec
19499 !! wikitext
19500 == -{Naslov}- ==
19501 !! html
19502 <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>
19503
19504 !! end
19505
19506
19507 !! test
19508 Explicit definition of language variant alternatives
19509 !! options
19510 language=zh variant=zh-tw
19511 !! wikitext
19512 -{zh:China;zh-tw:Taiwan}-, not China
19513 !! html
19514 <p>Taiwan, not China
19515 </p>
19516 !! end
19517
19518
19519 !! test
19520 Conversion around HTML tags
19521 !! options
19522 language=sr variant=sr-ec
19523 !! wikitext
19524 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19525 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19526 !! html
19527 <p>
19528 <span title="ЛаCтин">ски</span>
19529 </p>
19530 !! end
19531
19532
19533 !! test
19534 Explicit session-wise language variant mapping (A flag and - flag)
19535 !! options
19536 language=zh variant=zh-tw
19537 !! wikitext
19538 Taiwan is not China.
19539 But -{A|zh:China;zh-tw:Taiwan}- is China,
19540 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19541 and -{China}- is China.
19542 !! html
19543 <p>Taiwan is not China.
19544 But Taiwan is Taiwan,
19545 (This should be stripped!)
19546 and China is China.
19547 </p>
19548 !! end
19549
19550 !! test
19551 Explicit session-wise language variant mapping (H flag for hide)
19552 !! options
19553 language=zh variant=zh-tw
19554 !! wikitext
19555 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19556 Taiwan is China.
19557 !! html
19558 <p>(This should be stripped!)
19559 Taiwan is Taiwan.
19560 </p>
19561 !! end
19562
19563 !! test
19564 Adding explicit conversion rule for title (T flag)
19565 !! options
19566 language=zh variant=zh-tw showtitle
19567 !! wikitext
19568 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19569 !! html
19570 Taiwan
19571 <p>Should be stripped!
19572 </p>
19573 !! end
19574
19575 !! test
19576 Testing that changing the language variant here in the tests actually works
19577 !! options
19578 language=zh variant=zh showtitle
19579 !! wikitext
19580 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19581 !! html
19582 China
19583 <p>Should be stripped!
19584 </p>
19585 !! end
19586
19587 !! test
19588 Recursive conversion of alt and title attrs shouldn't clear converter state
19589 !! options
19590 language=zh variant=zh-cn showtitle
19591 !! wikitext
19592 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19593 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19594 !! html
19595 China
19596 <p>
19597 Should be stripped<span title="Exclamation">!</span>
19598 </p>
19599 !! end
19600
19601 !! test
19602 Bug 24072: more test on conversion rule for title
19603 !! options
19604 language=zh variant=zh-tw showtitle
19605 !! wikitext
19606 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19607 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19608 !! html
19609 Taiwan
19610 <p>This should be stripped!
19611 This won't take interferes with the title rule.
19612 </p>
19613 !! end
19614
19615 !! test
19616 Partly disable title conversion if variant == main language code
19617 !! options
19618 language=zh variant=zh title=[[ZH]] showtitle
19619 !! wikitext
19620 -{T|zh-cn:CN;zh-tw:TW}-
19621 !! html
19622 ZH
19623 <p>
19624 </p>
19625 !! end
19626
19627 !! test
19628 Partly disable title conversion if variant == main language code, more
19629 !! options
19630 language=zh variant=zh title=[[ZH]] showtitle
19631 !! wikitext
19632 -{T|TW}-
19633 !! html
19634 ZH
19635 <p>
19636 </p>
19637 !! end
19638
19639 !! test
19640 Raw output of variant escape tags (R flag)
19641 !! options
19642 language=zh variant=zh-tw
19643 !! wikitext
19644 Raw: -{R|zh:China;zh-tw:Taiwan}-
19645 !! html
19646 <p>Raw: zh:China;zh-tw:Taiwan
19647 </p>
19648 !! end
19649
19650 !! test
19651 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19652 !! options
19653 language=zh variant=zh-cn
19654 !! input
19655 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19656 !! result
19657 <p>0
19658 </p>
19659 !! end
19660
19661 !! test
19662 Conversion rules from [numeric-only string] to [something else] (T48634)
19663 !! options
19664 language=zh variant=zh-cn
19665 !! input
19666 -{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
19667 !! result
19668 <p>D12345EE12345
19669 </p>
19670 !! end
19671
19672 !! test
19673 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19674 !! options
19675 language=zh variant=zh-cn
19676 !! input
19677 -{H|zh-cn:foo;zh-tw:;}-foobar
19678 !! result
19679 <p>foobar
19680 </p>
19681 !! end
19682
19683 !! test
19684 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19685 !! options
19686 language=zh variant=zh-cn
19687 !! input
19688 -{H|=>zh-cn:foo;}-foobar
19689 !! result
19690 <p>foobar
19691 </p>
19692 !! end
19693
19694 !! test
19695 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19696 !! options
19697 language=zh variant=zh-cn
19698 !! input
19699 -{H|}-foobar
19700 !! result
19701 <p>foobar
19702 </p>
19703 !! end
19704
19705 !! test
19706 Nested using of manual convert syntax
19707 !! options
19708 language=zh variant=zh-hk
19709 !! wikitext
19710 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19711 !! html
19712 <p>Nested: Hello Hong Kong!
19713 </p>
19714 !! end
19715
19716 !! test
19717 Proper conversion of text in external links
19718 !! options
19719 language=sr variant=sr-ec
19720 !! wikitext
19721 http://www.google.com
19722 gopher://www.google.com
19723 [http://www.google.com http://www.google.com]
19724 [gopher://www.google.com gopher://www.google.com]
19725 [https://www.google.com irc://www.google.com]
19726 [ftp://www.google.com www.google.com/ftp://dir]
19727 [//www.google.com www.google.com]
19728 !! html
19729 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19730 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19731 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19732 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19733 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19734 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19735 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19736 </p>
19737 !! end
19738
19739 !! test
19740 Do not convert roman numbers to language variants
19741 !! options
19742 language=sr variant=sr-ec
19743 !! wikitext
19744 Fridrih IV je car.
19745 !! html
19746 <p>Фридрих IV је цар.
19747 </p>
19748 !! end
19749
19750 !! test
19751 Unclosed language converter markup "-{"
19752 !! options
19753 language=sr
19754 !! wikitext
19755 -{T|hello
19756 !! html
19757 <p>-{T|hello
19758 </p>
19759 !! end
19760
19761 !! test
19762 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19763 !! options
19764 language=sr
19765 !! wikitext
19766 -{R|=&gt;}-
19767 !! html
19768 <p>=&gt;
19769 </p>
19770 !!end
19771
19772 !! test
19773 Don't break link parsing if language converter markup is in the caption.
19774 !! options
19775 language=sr variant=sr-ec
19776 !! wikitext
19777 [[Main Page|-{R|main page}-]]
19778 !! html
19779 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19780 </p>
19781 !! end
19782
19783 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19784 !! test
19785 Don't break image parsing if language converter markup is in the caption.
19786 !! options
19787 language=sr
19788 !! wikitext
19789 [[File:Foobar.jpg|-{R|caption}-]]
19790 !! html/parsoid
19791 <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>
19792 </p>
19793 !! end
19794
19795 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19796 !! test
19797 Don't break list handling if language converter markup is in the item.
19798 !! options
19799 language=zh variant=zh-cn
19800 !! wikitext
19801 ;-{zh-cn:AAA;zh-tw:BBB}-
19802 !! html/php
19803 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19804
19805 !! html/parsoid
19806 <dl><dt>AAA
19807 </dt></dl>
19808 !! end
19809
19810 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19811 !! test
19812 Don't break table handling if language converter markup is in the cell.
19813 !! options
19814 language=sr variant=sr-ec
19815 !! wikitext
19816 {|
19817 |-
19818 | -{R|B}-
19819 |}
19820 !! html/php
19821 <table>
19822
19823 <tr>
19824 <td>Б}-
19825 </td></tr></table>
19826
19827 !! html/parsoid
19828 <table>
19829
19830 <tr>
19831 <td> B
19832 </td></tr></table>
19833
19834 !! end
19835
19836 !! test
19837 Bug 529: Uncovered bullet
19838 !! wikitext
19839 * Foo {{bullet}}
19840 !! html
19841 <ul><li> Foo </li>
19842 <li> Bar</li></ul>
19843
19844 !! end
19845
19846 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19847 # Templates in Wikipedia rely on this behavior, as tidy has always been
19848 # enabled there. These tests are normally run *without* tidy, so specify the
19849 # full output here.
19850 # To test realistic parsing behavior, apply a tidy-like transformation to both
19851 # the expected output and your parser's output.
19852 !! test
19853 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19854 !! wikitext
19855 ******* Foo {{bullet}}
19856 !! html
19857 <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>
19858 <li> Bar</li></ul>
19859
19860 !! end
19861
19862 !! test
19863 Bug 529: Uncovered table already at line-start
19864 !! wikitext
19865 x
19866
19867 {{table}}
19868 y
19869 !! html
19870 <p>x
19871 </p>
19872 <table>
19873 <tr>
19874 <td> 1 </td>
19875 <td> 2
19876 </td></tr>
19877 <tr>
19878 <td> 3 </td>
19879 <td> 4
19880 </td></tr></table>
19881 <p>y
19882 </p>
19883 !! end
19884
19885 !! test
19886 Bug 529: Uncovered bullet in parser function result
19887 !! wikitext
19888 * Foo {{lc:{{bullet}} }}
19889 !! html
19890 <ul><li> Foo </li>
19891 <li> bar</li></ul>
19892
19893 !! end
19894
19895 !! test
19896 Bug 5678: Double-parsed template argument
19897 !! wikitext
19898 {{lc:{{{1}}}|hello}}
19899 !! html
19900 <p>{{{1}}}
19901 </p>
19902 !! end
19903
19904 !! test
19905 Bug 5678: Double-parsed template invocation
19906 !! wikitext
19907 {{lc:{{paramtest {{!}} param = hello }} }}
19908 !! html
19909 <p>{{paramtest | param = hello }}
19910 </p>
19911 !! end
19912
19913 !! test
19914 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19915 !! options
19916 language=cs
19917 title=[[Main Page]]
19918 !! wikitext
19919 {{PRVNÍVELKÉ:ěščř}}
19920 {{prvnívelké:ěščř}}
19921 {{PRVNÍMALÉ:ěščř}}
19922 {{prvnímalé:ěščř}}
19923 {{MALÁ:ěščř}}
19924 {{malá:ěščř}}
19925 {{VELKÁ:ěščř}}
19926 {{velká:ěščř}}
19927 !! html
19928 <p>Ěščř
19929 Ěščř
19930 ěščř
19931 ěščř
19932 ěščř
19933 ěščř
19934 ĚŠČŘ
19935 ĚŠČŘ
19936 </p>
19937 !! end
19938
19939 !! test
19940 Morwen/13: Unclosed link followed by heading
19941 !! wikitext
19942 [[link
19943 ==heading==
19944 !! html
19945 <p>[[link
19946 </p>
19947 <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>
19948
19949 !! end
19950
19951 !! test
19952 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19953 !! wikitext
19954 {{foo|
19955 =heading=
19956 !! html
19957 <p>{{foo|
19958 </p>
19959 <h1><span class="mw-headline" id="heading">heading</span></h1>
19960
19961 !! end
19962
19963 !! test
19964 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19965 !! wikitext
19966 {{foo|
19967 ==heading==
19968 !! html
19969 <p>{{foo|
19970 </p>
19971 <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>
19972
19973 !! end
19974
19975 !! test
19976 Tildes in comments
19977 !! options
19978 pst
19979 !! wikitext
19980 <!-- ~~~~ -->
19981 !! html/php
19982 <!-- ~~~~ -->
19983 !! end
19984
19985 !! test
19986 Paragraphs inside divs (no extra line breaks)
19987 !! wikitext
19988 <div>Line one
19989
19990 Line two</div>
19991 !! html
19992 <div>Line one
19993 Line two</div>
19994
19995 !! end
19996
19997 !! test
19998 Paragraphs inside divs (extra line break on open)
19999 !! wikitext
20000 <div>
20001 Line one
20002
20003 Line two</div>
20004 !! html
20005 <div>
20006 <p>Line one
20007 </p>
20008 Line two</div>
20009
20010 !! end
20011
20012 !! test
20013 Paragraphs inside divs (extra line break on close)
20014 !! wikitext
20015 <div>Line one
20016
20017 Line two
20018 </div>
20019 !! html
20020 <div>Line one
20021 <p>Line two
20022 </p>
20023 </div>
20024
20025 !! end
20026
20027 !! test
20028 Paragraphs inside divs (extra line break on open and close)
20029 !! wikitext
20030 <div>
20031 Line one
20032
20033 Line two
20034 </div>
20035 !! html
20036 <div>
20037 <p>Line one
20038 </p><p>Line two
20039 </p>
20040 </div>
20041
20042 !! end
20043
20044 !! test
20045 Nesting tags, paragraphs on lines which begin with <div>
20046 !! wikitext
20047 <div></div><strong>A
20048 B</strong>
20049 !! html/php+tidy
20050 <p><strong>A</strong></p>
20051 <p><strong>B</strong></p>
20052 !! html/parsoid
20053 <div></div>
20054 <p><strong>A
20055 B</strong>
20056 </p>
20057 !! end
20058
20059 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20060 !! test
20061 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20062 !! wikitext
20063 <blockquote>Line one
20064
20065 Line two</blockquote>
20066 !! html
20067 <blockquote>Line one
20068 Line two</blockquote>
20069
20070 !! html+tidy
20071 <blockquote>
20072 <p>Line one Line two</p>
20073 </blockquote>
20074 !! end
20075
20076 !! test
20077 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20078 !! wikitext
20079 <blockquote>
20080 Line one
20081
20082 Line two</blockquote>
20083 !! html
20084 <blockquote>
20085 <p>Line one
20086 </p>
20087 Line two</blockquote>
20088
20089 !! html+tidy
20090 <blockquote>
20091 <p>Line one</p>
20092 Line two</blockquote>
20093 !! end
20094
20095 !! test
20096 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20097 !! wikitext
20098 <blockquote>Line one
20099
20100 Line two
20101 </blockquote>
20102 !! html
20103 <blockquote>Line one
20104 <p>Line two
20105 </p>
20106 </blockquote>
20107
20108 !! html+tidy
20109 <blockquote>
20110 <p>Line one</p>
20111 <p>Line two</p>
20112 </blockquote>
20113 !! end
20114
20115 !! test
20116 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20117 !! wikitext
20118 <blockquote>
20119 Line one
20120
20121 Line two
20122 </blockquote>
20123 !! html
20124 <blockquote>
20125 <p>Line one
20126 </p><p>Line two
20127 </p>
20128 </blockquote>
20129
20130 !! html+tidy
20131 <blockquote>
20132 <p>Line one</p>
20133 <p>Line two</p>
20134 </blockquote>
20135 !! end
20136
20137 !! test
20138 Paragraphs inside blockquotes/divs (no extra line breaks)
20139 !! wikitext
20140 <blockquote><div>Line one
20141
20142 Line two</div></blockquote>
20143 !! html
20144 <blockquote><div>Line one
20145 Line two</div></blockquote>
20146
20147 !! end
20148
20149 !! test
20150 Paragraphs inside blockquotes/divs (extra line break on open)
20151 !! wikitext
20152 <blockquote><div>
20153 Line one
20154
20155 Line two</div></blockquote>
20156 !! html
20157 <blockquote><div>
20158 <p>Line one
20159 </p>
20160 Line two</div></blockquote>
20161
20162 !! end
20163
20164 !! test
20165 Paragraphs inside blockquotes/divs (extra line break on close)
20166 !! wikitext
20167 <blockquote><div>Line one
20168
20169 Line two
20170 </div></blockquote>
20171 !! html
20172 <blockquote><div>Line one
20173 <p>Line two
20174 </p>
20175 </div></blockquote>
20176
20177 !! end
20178
20179 !! test
20180 Paragraphs inside blockquotes/divs (extra line break on open and close)
20181 !! wikitext
20182 <blockquote><div>
20183 Line one
20184
20185 Line two
20186 </div></blockquote>
20187 !! html
20188 <blockquote><div>
20189 <p>Line one
20190 </p><p>Line two
20191 </p>
20192 </div></blockquote>
20193
20194 !! end
20195
20196 !! test
20197 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20198 !! options
20199 wgLinkHolderBatchSize=0
20200 !! wikitext
20201 [[meatball:1]]
20202 [[meatball:2]]
20203 [[meatball:3]]
20204 !! html
20205 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20206 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20207 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20208 </p>
20209 !! end
20210
20211 !! test
20212 Free external link invading image caption
20213 !! wikitext
20214 [[Image:Foobar.jpg|thumb|http://x|hello]]
20215 !! html
20216 <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>
20217
20218 !! end
20219
20220 !! test
20221 Bug 15196: localised external link numbers
20222 !! options
20223 language=fa
20224 !! wikitext
20225 [http://en.wikipedia.org/]
20226 !! html/php
20227 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20228 </p>
20229 !! html/parsoid
20230 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20231 !! end
20232
20233 !! test
20234 Multibyte character in padleft
20235 !! wikitext
20236 {{padleft:-Hello|7|Æ}}
20237 !! html
20238 <p>Æ-Hello
20239 </p>
20240 !! end
20241
20242 !! test
20243 Multibyte character in padright
20244 !! wikitext
20245 {{padright:Hello-|7|Æ}}
20246 !! html
20247 <p>Hello-Æ
20248 </p>
20249 !! end
20250
20251 !!test
20252 formatdate parser function
20253 !! wikitext
20254 {{#formatdate:2009-03-24}}
20255 !! html
20256 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20257 </p>
20258 !! end
20259
20260 !!test
20261 formatdate parser function, with default format
20262 !! wikitext
20263 {{#formatdate:2009-03-24|mdy}}
20264 !! html
20265 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20266 </p>
20267 !! end
20268
20269 !! test
20270 Spacing of numbers in formatted dates
20271 !! wikitext
20272 {{#formatdate:January 15}}
20273 !! html
20274 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20275 </p>
20276 !! end
20277
20278 !! test
20279 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
20280 !! options
20281 language=nl title=[[MediaWiki:Common.css]]
20282 !! wikitext
20283 {{#formatdate:2009-03-24|dmy}}
20284 !! html
20285 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20286 </p>
20287 !! end
20288
20289 #
20290 #
20291 #
20292
20293 #
20294 # Edit comments
20295 #
20296
20297 !! test
20298 Edit comment with link
20299 !! options
20300 comment
20301 !! wikitext
20302 I like the [[Main Page]] a lot
20303 !! html/php
20304 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20305 !!end
20306
20307 !! test
20308 Edit comment with link and link text
20309 !! options
20310 comment
20311 !! wikitext
20312 I like the [[Main Page|best pages]] a lot
20313 !! html/php
20314 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20315 !!end
20316
20317 !! test
20318 Edit comment with link and link text with suffix
20319 !! options
20320 comment
20321 !! wikitext
20322 I like the [[Main Page|best page]]s a lot
20323 !! html/php
20324 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20325 !!end
20326
20327 !! test
20328 Edit comment with section link (non-local, eg in history list)
20329 !! options
20330 comment title=[[Main Page]]
20331 !! wikitext
20332 /* External links */ removed bogus entries
20333 !! html/php
20334 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20335 !!end
20336
20337 !! test
20338 Edit comment with section link and text before it (non-local, eg in history list)
20339 !! options
20340 comment title=[[Main Page]]
20341 !! wikitext
20342 pre-comment text /* External links */ removed bogus entries
20343 !! html/php
20344 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>
20345 !!end
20346
20347 !! test
20348 Edit comment with section link (local, eg in diff view)
20349 !! options
20350 comment local title=[[Main Page]]
20351 !! wikitext
20352 /* External links */ removed bogus entries
20353 !! html/php
20354 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20355 !!end
20356
20357 !! test
20358 Edit comment with subpage link (bug 14080)
20359 !! options
20360 comment
20361 subpage
20362 title=[[Subpage test]]
20363 !! wikitext
20364 Poked at a [[/subpage]] here...
20365 !! html/php
20366 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20367 !!end
20368
20369 !! test
20370 Edit comment with subpage link and link text (bug 14080)
20371 !! options
20372 comment
20373 subpage
20374 title=[[Subpage test]]
20375 !! wikitext
20376 Poked at a [[/subpage|neat little page]] here...
20377 !! html/php
20378 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20379 !!end
20380
20381 !! test
20382 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20383 !! options
20384 comment
20385 title=[[Subpage test]]
20386 !! wikitext
20387 Poked at a [[/subpage]] here...
20388 !! html/php
20389 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...
20390 !!end
20391
20392 !! test
20393 Edit comment with bare anchor link (local, as on diff)
20394 !! options
20395 comment
20396 local
20397 title=[[Main Page]]
20398 !! wikitext
20399 [[#section]]
20400 !! html/php
20401 <a href="#section">#section</a>
20402 !! end
20403
20404 !! test
20405 Edit comment with bare anchor link (non-local, as on history)
20406 !! options
20407 comment
20408 title=[[Main Page]]
20409 !! wikitext
20410 [[#section]]
20411 !! html/php
20412 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20413 !! end
20414
20415 !! test
20416 Anchor starting with underscore
20417 !! options
20418 title=[[Foo]]
20419 !! wikitext
20420 [[#_ref|One]]
20421 !! html/php
20422 <p><a href="#_ref">One</a>
20423 </p>
20424 !! html/parsoid
20425 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20426 !! end
20427
20428 !! test
20429 Id starting with underscore
20430 !! wikitext
20431 <div id="_ref"></div>
20432 !! html/*
20433 <div id="_ref"></div>
20434
20435 !! end
20436
20437 !! test
20438 Space normalisation on autocomment (bug 22784)
20439 !! options
20440 comment
20441 title=[[Main Page]]
20442 !! wikitext
20443 /* __hello__world__ */
20444 !! html/php
20445 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20446 !! end
20447
20448 !! test
20449 percent-encoding and + signs in comments (Bug 26410)
20450 !! options
20451 comment
20452 !! wikitext
20453 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20454 !! html/php
20455 <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>
20456 !! end
20457
20458 # Parsoid doesn't support this yet: see bug 73581
20459 # but it *should* omit the 'src' attribute if the image is bad.
20460 # PHP side of tests was disabled in
20461 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20462 # because of issues in the PHP parserTests infrastructure
20463 # (but the output below is indeed what the PHP side emits)
20464 !! test
20465 Bad images - basic functionality
20466 !! wikitext
20467 [[File:Bad.jpg]]
20468 !! DISABLED/html/php
20469 !! html/parsoid
20470 <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>
20471 !! end
20472
20473 !! test
20474 Bad images - bug 16039: text after bad image disappears
20475 !! wikitext
20476 Foo bar
20477 [[File:Bad.jpg]]
20478 Bar foo
20479 !! DISABLED/html/php
20480 <p>Foo bar
20481 </p><p>Bar foo
20482 </p>
20483 !! html/parsoid
20484 <p>Foo bar
20485 <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>
20486 Bar foo</p>
20487 !! end
20488
20489 !! test
20490 Verify that displaytitle works (bug #22501) no displaytitle
20491 !! options
20492 showtitle
20493 !! config
20494 wgAllowDisplayTitle=true
20495 wgRestrictDisplayTitle=false
20496 !! wikitext
20497 this is not the the title
20498 !! html/php
20499 Parser test
20500 <p>this is not the the title
20501 </p>
20502 !! end
20503
20504 !! test
20505 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20506 !! options
20507 showtitle
20508 title=[[Screen]]
20509 !! config
20510 wgAllowDisplayTitle=true
20511 wgRestrictDisplayTitle=false
20512 !! wikitext
20513 this is not the the title
20514 {{DISPLAYTITLE:whatever}}
20515 !! html/php
20516 whatever
20517 <p>this is not the the title
20518 </p>
20519 !! end
20520
20521 !! test
20522 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20523 !! options
20524 showtitle
20525 title=[[Screen]]
20526 !! config
20527 wgAllowDisplayTitle=true
20528 wgRestrictDisplayTitle=true
20529 !! wikitext
20530 this is not the the title
20531 {{DISPLAYTITLE:whatever}}
20532 !! html/php
20533 Screen
20534 <p>this is not the the title
20535 </p>
20536 !! end
20537
20538 !! test
20539 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20540 !! options
20541 showtitle
20542 title=[[Screen]]
20543 !! config
20544 wgAllowDisplayTitle=true
20545 wgRestrictDisplayTitle=true
20546 !! wikitext
20547 this is not the the title
20548 {{DISPLAYTITLE:screen}}
20549 !! html/php
20550 screen
20551 <p>this is not the the title
20552 </p>
20553 !! end
20554
20555 !! test
20556 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20557 !! options
20558 showtitle
20559 title=[[Screen]]
20560 !! config
20561 wgAllowDisplayTitle=false
20562 !! wikitext
20563 this is not the the title
20564 {{DISPLAYTITLE:screen}}
20565 !! html/php
20566 Screen
20567 <p>this is not the the title
20568 <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>
20569 </p>
20570 !! end
20571
20572 !! test
20573 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20574 !! options
20575 showtitle
20576 title=[[Screen]]
20577 !! config
20578 wgAllowDisplayTitle=false
20579 !! wikitext
20580 this is not the the title
20581 !! html/php
20582 Screen
20583 <p>this is not the the title
20584 </p>
20585 !! end
20586
20587 !! test
20588 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20589 !! options
20590 showtitle
20591 title=[[Screen]]
20592 !! config
20593 wgAllowDisplayTitle=true
20594 wgRestrictDisplayTitle=true
20595 !! wikitext
20596 this is not the the title
20597 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20598 !! html/php
20599 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20600 <p>this is not the the title
20601 </p>
20602 !! end
20603
20604 !! test
20605 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20606 !! options
20607 showtitle
20608 title=[[Screen]]
20609 !! config
20610 wgAllowDisplayTitle=true
20611 wgRestrictDisplayTitle=true
20612 !! wikitext
20613 this is not the the title
20614 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20615 !! html/php
20616 <span style="color: red;">s</span>creen
20617 <p>this is not the the title
20618 </p>
20619 !! end
20620
20621 !! test
20622 Page status indicators: Empty name is invalid
20623 !! options
20624 showindicators
20625 !! wikitext
20626 <indicator name=" "></indicator>
20627 <indicator></indicator>
20628 !! html
20629 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20630 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20631 </p>
20632 !! end
20633
20634 !! test
20635 Page status indicators: Weird syntaxes that are okay
20636 !! options
20637 showindicators
20638 !! wikitext
20639 <indicator name="empty" />
20640 <indicator name="name"></indicator>
20641 !! html
20642 empty=
20643 name=
20644 <p><br />
20645 </p>
20646 !! end
20647
20648 !! test
20649 Page status indicators: Torture test
20650 !! options
20651 showindicators
20652 !! wikitext
20653 <indicator name="01">hello world</indicator>
20654 <indicator name="02">[[Main Page]]</indicator>
20655 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20656 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20657 <indicator name="05">* foo
20658 * bar</indicator>
20659 <indicator name="06"><nowiki>foo</nowiki></indicator>
20660 <indicator name="07"> Preformatted</indicator>
20661 <indicator name="08"><div>Broken tag</indicator>
20662 <indicator name="09">{| class=wikitable
20663 | cell
20664 |}</indicator>
20665 <indicator name="10">Two
20666
20667 paragraphs</indicator>
20668 !! html
20669 01=hello world
20670 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20671 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" />
20672 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>
20673 05=<ul><li> foo</li>
20674 <li> bar</li></ul>
20675
20676 06=foo
20677 07=<pre>Preformatted
20678 </pre>
20679 08=<div>Broken tag</div>
20680
20681 09=<table class="wikitable">
20682 <tr>
20683 <td> cell
20684 </td></tr></table>
20685
20686 10=<p>Two
20687 </p><p>paragraphs
20688 </p>
20689 <p><br />
20690 </p><p><br />
20691 </p><p><br />
20692 </p><p><br />
20693 </p><p><br />
20694 </p>
20695 !! end
20696
20697 !! test
20698 preload: check <noinclude> and <includeonly>
20699 !! options
20700 preload
20701 !! wikitext
20702 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20703 !! html/php
20704 Hello kind world.
20705 !! end
20706
20707 !! test
20708 preload: check <onlyinclude>
20709 !! options
20710 preload
20711 !! wikitext
20712 Goodbye <onlyinclude>Hello world</onlyinclude>
20713 !! html/php
20714 Hello world
20715 !! end
20716
20717 !! test
20718 preload: can pass tags through if we want to
20719 !! options
20720 preload
20721 !! wikitext
20722 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20723 !! html/php
20724 <includeonly>Hello world</includeonly>
20725 !! end
20726
20727 !! test
20728 preload: check that it doesn't try to do tricks
20729 !! options
20730 preload
20731 !! wikitext
20732 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20733 !! html/php
20734 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20735 !! end
20736
20737 !! test
20738 Play a bit with r67090 and bug 3158
20739 !! wikitext
20740 <div style="width:50% !important">&nbsp;</div>
20741 <div style="width:50%&nbsp;!important">&nbsp;</div>
20742 <div style="width:50%&#160;!important">&nbsp;</div>
20743 <div style="border : solid;">&nbsp;</div>
20744 !! html/php
20745 <div style="width:50% !important">&#160;</div>
20746 <div style="width:50% !important">&#160;</div>
20747 <div style="width:50% !important">&#160;</div>
20748 <div style="border&#160;: solid;">&#160;</div>
20749
20750 !! html/parsoid
20751 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20752 <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>
20753 <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>
20754 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20755
20756 !! end
20757
20758 !! test
20759 HTML5 data attributes
20760 !! wikitext
20761 <span data-foo="bar">Baz</span>
20762 <p data-abc-def_hij="">Quuz</p>
20763 !! html/php
20764 <p><span data-foo="bar">Baz</span>
20765 </p>
20766 <p data-abc-def_hij="">Quuz</p>
20767
20768 !! html/parsoid
20769 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
20770 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
20771 !! end
20772
20773 !! test
20774 Strip reserved data attributes
20775 !! wikitext
20776 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
20777 !! html/php
20778 <div data-ok="fred">d</div>
20779
20780 !! html/parsoid
20781 <div data-x-data-mw="foo" data-x-data-parsoid="bar" data-x-data-mw-someext="baz" data-ok="fred" data-parsoid='{"stx":"html","a":{"data-ooui":null,"data-bad:ns":null},"sa":{"data-ooui":"xyzzy","data-bad:ns":"ns"}}'>d</div>
20782 !! end
20783
20784 !! test
20785 percent-encoding and + signs in internal links (Bug 26410)
20786 !! wikitext
20787 [[User:+%]] [[Page+title%]]
20788 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20789 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20790 [[%33%45]] [[%33%45+]]
20791 !! html/php
20792 <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>
20793 <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>
20794 <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>
20795 <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>
20796 </p>
20797 !! html/parsoid
20798 <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>
20799 <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>
20800 <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":"&lt;a rel=\"mw:WikiLink\" href=\"./Bar\" title=\"Bar\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Bar&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;bar&amp;quot;},&amp;quot;dsr&amp;quot;:[94,101,2,2]}\">bar&lt;/a>"}'><a href="./File:%25+abc9"><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>
20801 <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>
20802 !! end
20803
20804 !! test
20805 Special characters in embedded file links (bug 27679)
20806 !! wikitext
20807 [[File:Contains & ampersand.jpg]]
20808 [[File:Does not exist.jpg|Title with & ampersand]]
20809 !! html/php
20810 <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>
20811 <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>
20812 </p>
20813 !! html/parsoid
20814 <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>
20815 <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;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>
20816 !! end
20817
20818 !! test
20819 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20820 !! wikitext
20821 Text&apos;s been normalized?
20822 !! html
20823 <p>Text&#39;s been normalized?
20824 </p>
20825 !! end
20826
20827 !! test
20828 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20829 !! wikitext
20830 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20831 !! html
20832 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20833 </p>
20834 !! end
20835
20836 !! test
20837 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20838 !! wikitext
20839 [http://www.example.org/ ideograms]
20840 !! html
20841 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20842 </p>
20843 !! end
20844
20845 !! test
20846 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20847 !! wikitext
20848 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20849 !! html
20850 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20851 </p>
20852 !! end
20853
20854 !! article
20855 Mediawiki:loop1
20856 !! text
20857 {{Identical|A}}
20858 !! endarticle
20859
20860 !! article
20861 Mediawiki:loop2
20862 !! text
20863 {{Identical|B}}
20864 !! endarticle
20865
20866 !! article
20867 Template:Identical
20868 !! text
20869 {{int:loop1}}
20870 {{int:loop2}}
20871 !! endarticle
20872
20873 !! test
20874 Bug 31098 Template which includes system messages which includes the template
20875 !! wikitext
20876 {{Identical}}
20877 !! html
20878 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20879 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20880 </p>
20881 !! end
20882
20883 !! test
20884 Bug31490 Turkish: ucfirst 'blah'
20885 !! options
20886 language=tr
20887 !! wikitext
20888 {{ucfirst:blah}}
20889 !! html
20890 <p>Blah
20891 </p>
20892 !! end
20893
20894 !! test
20895 Bug31490 Turkish: ucfirst 'ix'
20896 !! options
20897 language=tr
20898 !! wikitext
20899 {{ucfirst:ix}}
20900 !! html
20901 <p>İx
20902 </p>
20903 !! end
20904
20905 !! test
20906 Bug31490 Turkish: lcfirst 'BLAH'
20907 !! options
20908 language=tr
20909 !! wikitext
20910 {{lcfirst:BLAH}}
20911 !! html
20912 <p>bLAH
20913 </p>
20914 !! end
20915
20916 !! test
20917 Bug31490 Turkish: ucfırst (with a dotless i)
20918 !! options
20919 language=tr
20920 !! wikitext
20921 {{ucfırst:blah}}
20922 !! html
20923 <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>
20924 </p>
20925 !! end
20926
20927 !! test
20928 Bug31490 ucfırst (with a dotless i) with English language
20929 !! options
20930 language=en
20931 !! wikitext
20932 {{ucfırst:blah}}
20933 !! html
20934 <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>
20935 </p>
20936 !! end
20937
20938 !! test
20939 Bug 26375: TOC with italics
20940 !! options
20941 title=[[Main Page]]
20942 !! wikitext
20943 __TOC__
20944 == ''Lost'' episodes ==
20945 !! html
20946 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20947 <ul>
20948 <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>
20949 </ul>
20950 </div>
20951
20952 <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>
20953
20954 !! end
20955
20956 !! test
20957 Bug 26375: TOC with bold
20958 !! options
20959 title=[[Main Page]]
20960 !! wikitext
20961 __TOC__
20962 == '''should be bold''' then normal text ==
20963 !! html
20964 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20965 <ul>
20966 <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>
20967 </ul>
20968 </div>
20969
20970 <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>
20971
20972 !! end
20973
20974 !! test
20975 Bug 33845: Headings become cursive in TOC when they contain an image
20976 !! options
20977 title=[[Main Page]]
20978 !! wikitext
20979 __TOC__
20980 == Image [[Image:foobar.jpg]] ==
20981 !! html
20982 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20983 <ul>
20984 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20985 </ul>
20986 </div>
20987
20988 <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>
20989
20990 !! end
20991
20992 !! test
20993 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20994 !! options
20995 title=[[Main Page]]
20996 !! wikitext
20997 __TOC__
20998 == <blockquote>Quote</blockquote> ==
20999 !! html
21000 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21001 <ul>
21002 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21003 </ul>
21004 </div>
21005
21006 <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>
21007
21008 !! html+tidy
21009 <p></p>
21010 <div id="toc" class="toc">
21011 <div id="toctitle">
21012 <h2>Contents</h2>
21013 </div>
21014 <ul>
21015 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21016 </ul>
21017 </div>
21018 <p></p>
21019 <h2><span class="mw-headline" id="Quote"></span></h2>
21020 <blockquote>
21021 <p><span class="mw-headline" id="Quote">Quote</span></p>
21022 </blockquote>
21023 <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>
21024 !! end
21025
21026 !! test
21027 Unclosed tags in TOC
21028 !! options
21029 title=[[Main Page]]
21030 !! wikitext
21031 __TOC__
21032 == Proof: 2 < 3 ==
21033 <small>Hanc marginis exiguitas non caperet.</small>
21034 QED
21035 !! html
21036 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21037 <ul>
21038 <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>
21039 </ul>
21040 </div>
21041
21042 <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>
21043 <p><small>Hanc marginis exiguitas non caperet.</small>
21044 QED
21045 </p>
21046 !! end
21047
21048 !! test
21049 Multiple tags in TOC
21050 !! wikitext
21051 __TOC__
21052 == <i>Foo</i> <b>Bar</b> ==
21053
21054 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21055 !! html
21056 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21057 <ul>
21058 <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>
21059 <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>
21060 </ul>
21061 </div>
21062
21063 <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>
21064 <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>
21065
21066 !! html+tidy
21067 <p></p>
21068 <div id="toc" class="toc">
21069 <div id="toctitle">
21070 <h2>Contents</h2>
21071 </div>
21072 <ul>
21073 <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>
21074 <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>
21075 </ul>
21076 </div>
21077 <p></p>
21078 <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>
21079 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21080 <blockquote>
21081 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21082 </blockquote>
21083 <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>
21084 !! end
21085
21086 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21087 # html5 tag parsing.
21088 !! test
21089 Tags with parameters in TOC
21090 !! options
21091 parsoid=wt2html
21092 !! wikitext
21093 __TOC__
21094 == <sup class="in-h2">Hello</sup> ==
21095
21096 == <sup class="a > b">Evilbye</sup> ==
21097 !! html/php
21098 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21099 <ul>
21100 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21101 <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>
21102 </ul>
21103 </div>
21104
21105 <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>
21106 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup class="a"> 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>
21107
21108 !! html/parsoid
21109 <meta property="mw:PageProp/toc" />
21110 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21111
21112 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21113 !! end
21114
21115 !! test
21116 span tags with directionality in TOC
21117 !! wikitext
21118 __TOC__
21119 == <span dir="ltr">C++</span> ==
21120
21121 == <span dir="rtl">זבנג!</span> ==
21122
21123 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21124
21125 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21126
21127 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21128 !! html
21129 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21130 <ul>
21131 <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>
21132 <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>
21133 <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>
21134 <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>
21135 <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>
21136 </ul>
21137 </div>
21138
21139 <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>
21140 <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>
21141 <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>
21142 <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>
21143 <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>
21144
21145 !! end
21146
21147 !! test
21148 Bug 72884: bdi element in ToC
21149 !! wikitext
21150 __TOC__
21151 == <bdi>test</bdi> ==
21152 !! html
21153 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21154 <ul>
21155 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21156 </ul>
21157 </div>
21158
21159 <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>
21160
21161 !! end
21162
21163 # Note that the html output does not have the <p></p>, but the
21164 # html+tidy output *does*. This is because the empty <p></p> is
21165 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21166 !! test
21167 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21168 !! wikitext
21169 __TOC__
21170 == x ==
21171 !! html
21172 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21173 <ul>
21174 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21175 </ul>
21176 </div>
21177
21178 <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>
21179
21180 !! html+tidy
21181 <p></p>
21182 <div id="toc" class="toc">
21183 <div id="toctitle">
21184 <h2>Contents</h2>
21185 </div>
21186 <ul>
21187 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21188 </ul>
21189 </div>
21190 <p></p>
21191 <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>
21192 !! end
21193
21194 !! article
21195 MediaWiki:Bug32057
21196 !! text
21197 == {{int:headline_sample}} ==
21198 !! endarticle
21199
21200 !! test
21201 Bug 32057: Title needed when expanding <h> nodes.
21202 !! options
21203 title=[[Main Page]]
21204 !! wikitext
21205 {{int:Bug32057}}
21206 !! html
21207 <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>
21208
21209 !! end
21210
21211 !! test
21212 Strip marker in urlencode
21213 !! wikitext
21214 {{urlencode:x<nowiki/>y}}
21215 {{urlencode:x<nowiki/>y|wiki}}
21216 {{urlencode:x<nowiki/>y|path}}
21217 {{urlencode:x<pre id="one">two</pre>y}}
21218 !! html
21219 <p>xy
21220 xy
21221 xy
21222 xy
21223 </p>
21224 !! end
21225
21226 !! test
21227 Strip marker in lc
21228 !! wikitext
21229 {{lc:x<nowiki/>y}}
21230 !! html
21231 <p>xy
21232 </p>
21233 !! end
21234
21235 !! test
21236 Strip marker in uc
21237 !! wikitext
21238 {{uc:x<nowiki/>y}}
21239 !! html
21240 <p>XY
21241 </p>
21242 !! end
21243
21244 !! test
21245 Strip marker in formatNum
21246 !! wikitext
21247 {{formatnum:1<nowiki/>2}}
21248 {{formatnum:1<nowiki/>2|R}}
21249 !! html
21250 <p>12
21251 12
21252 </p>
21253 !! end
21254
21255 !! test
21256 Check noCommafy in formatNum
21257 !! options
21258 language=be-tarask
21259 !! wikitext
21260 {{formatnum:123456.78}}
21261 {{formatnum:123456.78|NOSEP}}
21262 !! html
21263 <p>123 456,78
21264 123456.78
21265 </p>
21266 !! end
21267
21268 !! test
21269 Wrong option for formatNum (bug 56199)
21270 !! wikitext
21271 {{formatnum:1,234.56|Random}}
21272 {{formatnum:1,234.56|EVERYTHING}}
21273 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21274 !! html
21275 <p>1,234.56
21276 1,234.56
21277 1,234.56
21278 </p>
21279 !! end
21280
21281 !! test
21282 Strip marker in grammar
21283 !! options
21284 language=fi
21285 !! wikitext
21286 {{grammar:elative|foo<nowiki/>bar}}
21287 !! html
21288 <p>foobarista
21289 </p>
21290 !! end
21291
21292 !! test
21293 Strip marker in padleft
21294 !! wikitext
21295 {{padleft:|2|x<nowiki/>y}}
21296 !! html
21297 <p>xy
21298 </p>
21299 !! end
21300
21301 !! test
21302 Strip marker in padright
21303 !! wikitext
21304 {{padright:|2|x<nowiki/>y}}
21305 !! html
21306 <p>xy
21307 </p>
21308 !! end
21309
21310 !! test
21311 Strip marker in anchorencode
21312 !! wikitext
21313 {{anchorencode:x<nowiki/>y}}
21314 !! html
21315 <p>xy
21316 </p>
21317 !! end
21318
21319 !! test
21320 nowiki inside link inside heading (bug 18295)
21321 !! wikitext
21322 ==[[foo|x<nowiki>y</nowiki>z]]==
21323 !! html
21324 <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>
21325
21326 !! end
21327
21328 !! test
21329 new support for bdi element (bug 31817)
21330 !! wikitext
21331 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21332 !! html
21333 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21334
21335 !!end
21336
21337 !! test
21338 Ignore pipe between table row attributes
21339 !! wikitext
21340 {|
21341 | quux
21342 |- id=foo | style='color: red'
21343 | bar
21344 |}
21345 !! html
21346 <table>
21347 <tr>
21348 <td> quux
21349 </td></tr>
21350 <tr id="foo" style="color: red">
21351 <td> bar
21352 </td></tr></table>
21353
21354 !! end
21355
21356 !!test
21357 Gallery override link with WikiLink (bug 34852)
21358 !! wikitext
21359 <gallery>
21360 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21361 </gallery>
21362 !! html
21363 <ul class="gallery mw-gallery-traditional">
21364 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21365 <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>
21366 <div class="gallerytext">
21367 <p>caption
21368 </p>
21369 </div>
21370 </div></li>
21371 </ul>
21372
21373 !! end
21374
21375 !!test
21376 Gallery override link with absolute external link (bug 34852)
21377 !! wikitext
21378 <gallery>
21379 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21380 </gallery>
21381 !! html
21382 <ul class="gallery mw-gallery-traditional">
21383 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21384 <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>
21385 <div class="gallerytext">
21386 <p>caption
21387 </p>
21388 </div>
21389 </div></li>
21390 </ul>
21391
21392 !! end
21393
21394 !!test
21395 Gallery override link with malicious javascript (bug 34852)
21396 !! wikitext
21397 <gallery>
21398 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21399 </gallery>
21400 !! html
21401 <ul class="gallery mw-gallery-traditional">
21402 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21403 <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>
21404 <div class="gallerytext">
21405 <p>caption
21406 </p>
21407 </div>
21408 </div></li>
21409 </ul>
21410
21411 !! end
21412
21413 !!test
21414 Gallery with invalid title as link (bug 43964)
21415 !! wikitext
21416 <gallery>
21417 File:foobar.jpg|link=<
21418 </gallery>
21419 !! html
21420 <ul class="gallery mw-gallery-traditional">
21421 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21422 <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>
21423 <div class="gallerytext">
21424 </div>
21425 </div></li>
21426 </ul>
21427
21428 !! end
21429
21430 !!test
21431 Language parser function
21432 !! wikitext
21433 {{#language:ar}}
21434 !! html
21435 <p>العربية
21436 </p>
21437 !! end
21438
21439 !!test
21440 Padleft and padright as substr
21441 !! wikitext
21442 {{padleft:|3|abcde}}
21443 {{padright:|3|abcde}}
21444 !! html
21445 <p>abc
21446 abc
21447 </p>
21448 !! end
21449
21450 !!test
21451 Special parser function
21452 !! wikitext
21453 {{#special:RandomPage}}
21454 {{#special:BaDtItLe}}
21455 {{#special:Foobar}}
21456 !! html
21457 <p>Special:Random
21458 Special:Badtitle
21459 Special:Foobar
21460 </p>
21461 !! end
21462
21463 !!test
21464 Bug 34939 - Case insensitive link parsing ([HttP://])
21465 !! wikitext
21466 [HttP://MediaWiki.Org/]
21467 !! html/php
21468 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21469 </p>
21470 !! html/parsoid
21471 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21472 !! end
21473
21474 !!test
21475 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21476 !! wikitext
21477 [HttP://MediaWiki.Org/ MediaWiki]
21478 !! html
21479 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21480 </p>
21481 !! end
21482
21483 !!test
21484 Bug 34939 - Case insensitive link parsing (HttP://)
21485 !! wikitext
21486 HttP://MediaWiki.Org/
21487 !! html/php
21488 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21489 </p>
21490 !! html/parsoid
21491 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21492 !! end
21493
21494 !!test
21495 Disable TOC
21496 !! options
21497 notoc
21498 !! wikitext
21499 Lead
21500 == Section 1 ==
21501 == Section 2 ==
21502 == Section 3 ==
21503 == Section 4 ==
21504 == Section 5 ==
21505 !! html
21506 <p>Lead
21507 </p>
21508
21509 <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>
21510 <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>
21511 <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>
21512 <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>
21513 <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>
21514
21515 !! end
21516
21517
21518 ###
21519 ### Parsoid-specific tests
21520 ### Parsoid-PHP parser incompatibilities
21521 ###
21522 !!test
21523 1. SOL-sensitive wikitext tokens as template-args
21524 !!options
21525 parsoid=wt2html,wt2wt
21526 !! wikitext
21527 {{echo|*a}}
21528 {{echo|#a}}
21529 {{echo|:a}}
21530 !! html
21531 <span about="#mwt1" typeof="mw:Transclusion">
21532 </span><ul about="#mwt1"><li>a</li>
21533 </ul>
21534 <span about="#mwt2" typeof="mw:Transclusion">
21535 </span><ol about="#mwt2"><li>a</li>
21536 </ol>
21537 <span about="#mwt3" typeof="mw:Transclusion">
21538 </span><dl about="#mwt3"><dd>a</dd>
21539 </dl>
21540 !!end
21541
21542 #### -----------------------------------------------------------------
21543 #### Parsoid-specific functionality tests
21544 #### -----------------------------------------------------------------
21545
21546 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21547 # We know wt2wt will fail, but we expect selser to pass.
21548 # Due to the nature of our testing, wt2wt and selser tests will enter the
21549 # blacklist and we'll catch selser regressions based on changes to the
21550 # blacklist entries for selser tests.
21551 !! test
21552 1. Bad treebuilder fixup of formatting elt is cleaned up
21553 !! options
21554 parsoid=wt2html,wt2wt
21555 !! wikitext
21556 {|
21557 |
21558 <small>
21559 [[Image:Foobar.jpg|right|Test]]
21560 </small>
21561 |}
21562 !! html/parsoid
21563 <table>
21564 <tbody><tr><td>
21565 <small>
21566 <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>
21567 </small>
21568 </td></tr>
21569 </tbody></table>
21570 !! end
21571
21572 !! test
21573 2. Bad treebuilder fixup of formatting elt is cleaned up
21574 !! options
21575 parsoid=wt2html,wt2wt
21576 !! wikitext
21577 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21578
21579 <small>[[Image:Foobar.jpg|right|300px]]</small>
21580 !! html/parsoid
21581
21582 <p><b>foo</b></p>
21583 <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>
21584 <p><b>bar</b></p>
21585 <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>
21586 !! end
21587
21588 !! test
21589 3. Bad treebuilder fixup of formatting elt is cleaned up
21590 !! options
21591 parsoid=wt2html,wt2wt
21592 !! wikitext
21593 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21594 !! html/parsoid
21595 <p><small><b>foo</b></small></p>
21596 <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>
21597 <p><small><b>bar</b></small></p>
21598 !! end
21599
21600 !! test
21601 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21602 !! options
21603 parsoid=wt2html,wt2wt
21604 !! wikitext
21605 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21606 !! html/parsoid
21607 <p><b><small></small></b></p>
21608 <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>
21609 <p></p>
21610 !! end
21611
21612 #### ----------------------------------------------------------------
21613 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21614 #### tags. Parsoid's output for these tags differs from that of the
21615 #### PHP parser.
21616 #### ----------------------------------------------------------------
21617
21618 !!test
21619 Ref: 1. ref-location should be replaced with an index span
21620 !! wikitext
21621 A <ref>foo</ref>
21622 B <ref name="x">foo</ref>
21623 C <ref name="y" />
21624 <references />
21625 !! html/parsoid
21626 <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>
21627 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>
21628 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>
21629 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21630 <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>
21631 <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>
21632 <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>
21633 </ol>
21634 !!end
21635
21636 !!test
21637 Ref: 2. ref-tags with identical names should all get the same index
21638 !! wikitext
21639 A <ref name="x">foo</ref>
21640 B <ref name="x" />
21641 <references />
21642 !! html/parsoid
21643 <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>
21644 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>
21645 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21646 <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>
21647 </ol>
21648 !!end
21649
21650 !!test
21651 Ref: 3. spaces in ref-names should be ignored
21652 !! wikitext
21653 A <ref name="x">foo</ref>
21654 B <ref name=" x " />
21655 C <ref name= x />
21656 <references />
21657 !! html/parsoid
21658 <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>
21659 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>
21660 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>
21661 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21662 <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>
21663 </ol>
21664 !!end
21665
21666 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21667 !!test
21668 Ref: 4. 'constructor' should be accepted as a valid ref-name
21669 !! wikitext
21670 A <ref name="constructor">foo</ref>
21671 <references />
21672 !! html/parsoid
21673 <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>
21674 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21675 <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>
21676 </ol>
21677 !!end
21678
21679 !!test
21680 Ref: 5. body should accept generic wikitext
21681 !! wikitext
21682 A <ref>
21683 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21684 </ref>
21685
21686 <references />
21687 !! html/parsoid
21688 <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>
21689
21690 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21691 <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>
21692 </span></li>
21693 </ol>
21694 !!end
21695
21696 !!test
21697 Ref: 6. indent-pres should not be output in ref-body
21698 !! wikitext
21699 A <ref>
21700 foo
21701 bar
21702 baz
21703 </ref>
21704
21705 <references />
21706 !! html/parsoid
21707 <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>
21708
21709 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21710 <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
21711 bar
21712 baz
21713 </span></li>
21714 </ol>
21715 !!end
21716
21717 !!test
21718 Ref: 7. No p-wrapping in ref-body
21719 !! wikitext
21720 A <ref>
21721 foo
21722
21723 bar
21724
21725
21726 baz
21727
21728
21729
21730 booz
21731 </ref>
21732
21733 <references />
21734 !! html/parsoid
21735 <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>
21736
21737 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21738 <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
21739
21740 bar
21741
21742
21743 baz
21744
21745
21746
21747 booz
21748 </span></li>
21749 </ol>
21750 !!end
21751
21752 !!test
21753 Ref: 8. transclusion wikitext has lower precedence
21754 !! wikitext
21755 A <ref> foo {{echo|</ref> B C}}
21756
21757 <references />
21758 !! html/parsoid
21759 <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>
21760 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21761 <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 {{echo|</span></li>
21762 </ol>
21763 !!end
21764
21765 !!test
21766 Ref: 9. unclosed comments should not leak out of ref-body
21767 !! wikitext
21768 A <ref> foo <!--</ref> B C
21769 <references />
21770 !! html/parsoid
21771 <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>
21772 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21773 <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>
21774 </ol>
21775 !!end
21776
21777 !!test
21778 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21779 !! wikitext
21780 A <ref> <b> foo </ref> B C
21781
21782 <references />
21783 !! html/parsoid
21784 <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>
21785
21786
21787 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21788 <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>
21789 </ol>
21790 !!end
21791
21792 !!test
21793 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21794 !! wikitext
21795 A <ref>foo</ref> B
21796 C <ref>bar</ref> D
21797 <references />
21798 !! html/parsoid
21799 <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
21800 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>
21801 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21802 <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>
21803 <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>
21804 </ol>
21805 !!end
21806
21807 !!test
21808 Ref: 12. ref-tags act as trailing newline migration barrier
21809 !! wikitext
21810 <!--the newline at the end of this line moves out of the p tag-->a
21811
21812 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21813 <ref />
21814
21815 c
21816 <references />
21817 !! html/parsoid
21818 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21819
21820
21821 <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>
21822 <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>
21823
21824 <p>c</p>
21825 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21826 <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>
21827 <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>
21828 !!end
21829
21830 !!test
21831 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21832 !! wikitext
21833 <ref>foo</ref> A
21834 <ref>bar
21835 </ref> B
21836 <references />
21837 !! html/parsoid
21838 <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
21839 <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>
21840 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21841 <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>
21842 <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
21843 </span></li>
21844 </ol>
21845 !!end
21846
21847 !!test
21848 Ref: 14. A nested ref-tag should be emitted as plain text
21849 !! wikitext
21850 <ref>foo <ref>bar</ref> baz</ref>
21851
21852 <references />
21853 !! html/parsoid
21854 <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>
21855 </p>
21856 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21857 <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>
21858 </ol>
21859 !!end
21860
21861 !!test
21862 Ref: 15. ref-tags with identical names should get identical indexes
21863 !! wikitext
21864 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21865 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21866
21867 <references />
21868 !! html/parsoid
21869 <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>
21870 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>
21871
21872 <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>
21873 </ol>
21874 !!end
21875
21876 ## We don't bother wt2wt-ing non-standard whitespace
21877 !!test
21878 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21879 !!options
21880 parsoid=wt2html
21881 !! wikitext
21882 A <ref >foo</ref >
21883
21884 <references />
21885 !! html/parsoid
21886 <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>
21887 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21888 <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>
21889 !!end
21890
21891 !!test
21892 Ref: 17. Generate valid HTML5 id/about attributes
21893 !!wikitext
21894 <ref name="a b">foo</ref>
21895
21896 <references />
21897 !!html/parsoid
21898 <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>
21899 </p>
21900
21901 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21902 <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>
21903 </ol>
21904 !!end
21905
21906 !!test
21907 Ref: 18. T58916: Extension attributes should be parsed as plain text
21908 !!wikitext
21909 <ref name="{{echo|a}}">foo</ref>
21910
21911 <references />
21912 !!html/parsoid
21913 <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>
21914 </p>
21915
21916 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21917 <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>
21918 </ol>
21919 !!end
21920
21921 !!test
21922 Ref: 19. ref-tags with identical name encodings should get identical indexes
21923 !! wikitext
21924 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21925
21926 <references />
21927 !! html/parsoid
21928 <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>
21929 </p>
21930 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21931 <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>
21932 </ol>
21933 !!end
21934
21935 !!test
21936 Ref: 20. ref-tags with identical names but different content should keep it
21937 !! wikitext
21938 A <ref name="foo">Foo one</ref>
21939 B <ref name="foo">Foo two</ref>
21940 C <ref name="foo" />
21941
21942 <references />
21943 !! html/parsoid
21944 <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>
21945 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>
21946 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>
21947
21948 <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>
21949 </ol>
21950 !!end
21951
21952 !!test
21953 References: 1. references tag without any refs should be handled properly
21954 !! wikitext
21955 <references />
21956 !! html/parsoid
21957 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21958 !!end
21959
21960 !!test
21961 References: 2. references tag with group only outputs references from that group
21962 !! wikitext
21963 A <ref group="a">foo</ref>
21964 B <ref group="b">bar</ref>
21965 C <ref>baz</ref>
21966
21967 <references group="a" />
21968 <references />
21969 <references group="b" />
21970 !! html/parsoid
21971 <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>
21972 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>
21973 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>
21974
21975 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21976 <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>
21977 </ol>
21978 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21979 <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>
21980 </ol>
21981 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21982 <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>
21983 </ol>
21984 !!end
21985
21986 !!test
21987 References: 3. ref list should be cleared after processing references
21988 !! wikitext
21989 A <ref>foo</ref>
21990
21991 <references />
21992
21993 B <ref>bar</ref>
21994
21995 <references />
21996 !! html/parsoid
21997 <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>
21998
21999 <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>
22000 </ol>
22001
22002 <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>
22003
22004 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22005 <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>
22006 </ol>
22007 !!end
22008
22009 !!test
22010 References: 4. only referenced group should be cleared after processing references
22011 !! wikitext
22012 A <ref group="a">afoo</ref>
22013 B <ref>bfoo</ref>
22014
22015 <references group="a" />
22016
22017 C <ref>cfoo</ref>
22018
22019 <references />
22020 !! html/parsoid
22021 <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>
22022 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>
22023
22024 <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>
22025 </ol>
22026
22027 <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>
22028
22029 <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>
22030 </ol>
22031 !!end
22032
22033 !!test
22034 References: 5. ref tags in references should be processed while ignoring all other content
22035 !! wikitext
22036 A <ref name="a" />
22037 B <ref name="b">bar</ref>
22038
22039 <references>
22040 <ref name="a">foo</ref>
22041 This should just get lost.
22042 </references>
22043 !! html/parsoid
22044 <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>
22045 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>
22046
22047
22048 <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>
22049 </ol>
22050 !!end
22051
22052 !!test
22053 References: 6. <references /> from a transclusion
22054 !! wikitext
22055 <ref>Foo</ref> {{echo|<references />}}
22056 !! html/parsoid
22057 <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>
22058 </ol>
22059 !!end
22060
22061 !! test
22062 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22063 !! wikitext
22064 A <ref>foo bar for a</ref>
22065 B <ref group="X" name="b" />
22066
22067 <references />
22068
22069 <references group="X">
22070 <ref name="b">foo</ref>
22071 </references>
22072 !! html/parsoid
22073 <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>
22074 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>
22075 </p>
22076
22077 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22078 <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>
22079 </ol>
22080
22081 <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"}}'>
22082 <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>
22083 </ol>
22084 !! end
22085
22086 !! test
22087 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22088 !! wikitext
22089 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22090 <references />
22091 !! html/parsoid
22092 <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>
22093 <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>
22094 </ol>
22095 !!end
22096
22097 # This test only works in wt2html now as the <references /> are always generated
22098 # unless selser is active. Once T72722 is fixed, we should add a changes test
22099 # here to ensure that unrelated changes don't add the new <references /> in
22100 # wt2wt.
22101 !! test
22102 References: 9. Generate missing references list at the end
22103 !! wikitext
22104 A <ref>foo</ref>
22105 B <ref group="inexistent">bar</ref>
22106 !! html/parsoid
22107 <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>
22108 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22109 <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>
22110 </ol>
22111 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
22112 <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>
22113 </ol>
22114 !! end
22115
22116 !! test
22117 References: 10. New <references/> shouldn't be added for unrelated edits.
22118 !! options
22119 parsoid={
22120 "modes": ["selser"],
22121 "changes": [["#x", "remove"]],
22122 "selser": "noauto"
22123 }
22124 !! wikitext
22125 Unrelated text<span id="x"> that's going to disappear</span>.
22126 A <ref>foo</ref>
22127 !! wikitext/edited
22128 Unrelated text.
22129 A <ref>foo</ref>
22130 !!end
22131
22132 !! test
22133 Entities in ref name
22134 !! wikitext
22135 <ref name="test &amp; me">hi</ref>
22136 <references />
22137 !! html/parsoid
22138 <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>
22139 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22140 <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>
22141 </ol>
22142 !! end
22143
22144 # This test is wt2html only because we're permitting the serializer to produce
22145 # dirty diffs, normalizing the unclosed references to the self-closed version.
22146 !! test
22147 Generate references for unclosed references tag
22148 !! options
22149 parsoid=wt2html
22150 !! wikitext
22151 a<ref>foo</ref>
22152
22153 <references>
22154 !! html/parsoid
22155 <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>
22156 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22157 <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>
22158 !! end
22159
22160 !! test
22161 New reference serializes on its own line
22162 !! options
22163 parsoid=wt2wt,html2wt
22164 !! wikitext
22165 foo
22166 <references />
22167 !! html/parsoid
22168 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22169 !! end
22170
22171 #### ----------------------------------------------------------------
22172 #### Parsoid-only testing of Parsoid's impl of LST
22173 #### Not implemented yet, see
22174 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22175 #### ----------------------------------------------------------------
22176
22177 !! test
22178 LST Sections: 1. Simple section start and end
22179 !! options
22180 parsoid={ "suppressErrors": true }
22181 !! wikitext
22182 <section begin="2011-05-16" />
22183 <section end="2014-04-10 (MW 1.23wmf22)" />
22184 !! html/parsoid
22185 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22186 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22187 !! end
22188
22189 #--------- Test stripping of empty nodes in template content ----------
22190 !!test
22191 Empty LI and TR nodes should be stripped from template content
22192 !!wikitext
22193 {{EmptyLITest}}
22194 {{EmptyTRTest}}
22195 !!html/parsoid
22196 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22197 <li>a</li>
22198 <li>b</li>
22199 </ul>
22200 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22201 <tbody>
22202 <tr>
22203 <td>foo</td>
22204 </tr>
22205 <tr>
22206 <td>bar</td>
22207 </tr>
22208 </tbody>
22209 </table>
22210 !!end
22211
22212 !!test
22213 Empty LI and TR nodes should not be stripped from top-level content
22214 !!wikitext
22215 * a
22216 *
22217 * b
22218 {|
22219 |-
22220 |-
22221 |foo
22222 |}
22223 !!html/parsoid
22224 <ul>
22225 <li> a</li>
22226 <li></li>
22227 <li> b</li>
22228 </ul>
22229 <table>
22230 <tbody>
22231 <tr></tr>
22232 <tr>
22233 <td>foo</td>
22234 </tr>
22235 </tbody>
22236 </table>
22237 !!end
22238
22239 !!test
22240 Empty TR nodes should not be stripped if they have any attributes set
22241 !!wikitext
22242 {{EmptyTRWithHTMLAttrTest}}
22243 !!html/parsoid
22244 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22245 <tr align="center"></tr>
22246 <tr><td>foo</td></tr>
22247 <tr align="center"></tr>
22248 <tr><td>bar</td></tr>
22249 </table>
22250 !!end
22251
22252 #### ----------------------------------------------------------------
22253 #### The following section of tests are primarily to test
22254 #### wikitext escaping capabilities of Parsoid. Given that
22255 #### escaping can be done any number of ways, the wikitext (input)
22256 #### is always adjusted to reflect how Parsoid adds nowiki
22257 #### escape tags.
22258 ####
22259 #### We are marking several tests as parsoid-only since the
22260 #### HTML in the result section is different from what the
22261 #### PHP parser generates for it.
22262 #### ----------------------------------------------------------------
22263
22264
22265 #### --------------- Headings ---------------
22266 #### 0. Unnested
22267 #### 1. Nested inside html <h1>=foo=</h1>
22268 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22269 #### 3. Nested inside html with wikitext split by html tags
22270 #### 4. No escape needed
22271 #### 5. Empty headings <h1></h1>
22272 #### 6. Heading chars in SOL context
22273 #### ----------------------------------------
22274 !! test
22275 Headings: 0. Unnested
22276 !! options
22277 parsoid=html2wt
22278 !! html/parsoid
22279 <p>=foo=</p>
22280
22281 <p> =foo=
22282 <!--cmt-->
22283 =foo=</p>
22284
22285 <p>=foo<i>a</i>=</p>
22286 !! wikitext
22287 <nowiki>=foo=</nowiki>
22288
22289 <nowiki> </nowiki>=foo=
22290 <!--cmt-->
22291 <nowiki>=foo=</nowiki>
22292
22293 =foo''a''<nowiki>=</nowiki>
22294 !!end
22295
22296 # New headings and existing headings are handled differently
22297 !! test
22298 Headings: 1. Nested inside html
22299 !! options
22300 parsoid=html2wt
22301 !! html/parsoid
22302 <h1>=foo=</h1>
22303 <h2>=foo=</h2>
22304 <h3>=foo=</h3>
22305
22306 <h1 data-parsoid=''>=foo=</h1>
22307 <h2 data-parsoid=''>=foo=</h2>
22308 <h3 data-parsoid=''>=foo=</h3>
22309 <h4 data-parsoid=''>=foo=</h4>
22310 <h5 data-parsoid=''>=foo=</h5>
22311 <h6 data-parsoid=''>=foo=</h6>
22312 !! wikitext
22313 = =foo= =
22314
22315 == =foo= ==
22316
22317 === =foo= ===
22318
22319 =<nowiki>=foo=</nowiki>=
22320 ==<nowiki>=foo=</nowiki>==
22321 ===<nowiki>=foo=</nowiki>===
22322 ====<nowiki>=foo=</nowiki>====
22323 =====<nowiki>=foo=</nowiki>=====
22324 ======<nowiki>=foo=</nowiki>======
22325
22326 !!end
22327
22328 !! test
22329 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22330 !! options
22331 parsoid=html2wt
22332 !! html/parsoid
22333 <h1>foo</h1>*bar
22334 <h1>foo</h1>=bar
22335 <h1>foo</h1>=bar=
22336 !! wikitext
22337 = foo =
22338 <nowiki>*</nowiki>bar
22339
22340 = foo =
22341 =bar
22342
22343 = foo =
22344 <nowiki>=bar=</nowiki>
22345 !!end
22346
22347 !! test
22348 Headings: 3. Nested inside html with wikitext split by html tags
22349 !! options
22350 parsoid=html2wt
22351 !! html/parsoid
22352 <h1>=<b>bold</b>foo=</h1>
22353 !! wikitext
22354 = ='''bold'''<nowiki>foo=</nowiki> =
22355 !!end
22356
22357 !! test
22358 Headings: 4a. No escaping needed (testing just h1 and h2)
22359 !! options
22360 parsoid=html2wt
22361 !! html/parsoid
22362 <h1>=foo</h1>
22363 <h1>foo=</h1>
22364 <h1> =foo= </h1>
22365 <h1>=foo= bar</h1>
22366 <h2>=foo</h2>
22367 <h2>foo=</h2>
22368 <h1>=</h1>
22369 <h1><i>=</i>foo=</h1>
22370 !! wikitext
22371 = =foo =
22372
22373 = foo= =
22374
22375 = =foo= =
22376
22377 = =foo= bar =
22378
22379 == =foo ==
22380
22381 == foo= ==
22382
22383 = = =
22384
22385 = ''=''foo= =
22386 !!end
22387
22388 !! test
22389 Headings: 4b. No escaping needed (inside p-tags)
22390 !! options
22391 parsoid=html2wt
22392 !! html/parsoid
22393 <p>===
22394 =foo= x
22395 =foo= <s></s>
22396 </p>
22397 !! wikitext
22398 ===
22399 =foo= x
22400 =foo= <s></s>
22401 !!end
22402
22403 !! test
22404 Headings: 5. Empty headings
22405 !! options
22406 parsoid=html2wt
22407 !! html/parsoid
22408 <h1 data-parsoid='{}'></h1>
22409
22410 <h2 data-parsoid='{}'></h2>
22411
22412 <h3 data-parsoid='{}'></h3>
22413
22414 <h4 data-parsoid='{}'></h4>
22415
22416 <h5 data-parsoid='{}'></h5>
22417
22418 <h6 data-parsoid='{}'></h6>
22419 !! wikitext
22420 =<nowiki/>=
22421
22422 ==<nowiki/>==
22423
22424 ===<nowiki/>===
22425
22426 ====<nowiki/>====
22427
22428 =====<nowiki/>=====
22429
22430 ======<nowiki/>======
22431 !!end
22432
22433 !! test
22434 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22435 !! options
22436 parsoid=html2wt
22437 !! html/parsoid
22438 <p>=a=</p>
22439
22440 <p>=a=</p>
22441
22442 <p>=a=</p>
22443 !! wikitext
22444 <nowiki>=a=</nowiki>
22445
22446 <nowiki>=a=</nowiki>
22447
22448 <nowiki>=a=</nowiki>
22449 !!end
22450
22451 !! test
22452 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22453 !! options
22454 parsoid=html2wt
22455 !! html/parsoid
22456 <p>=a=
22457 b</p>
22458
22459 <p>=a=
22460 b</p>
22461
22462 <p>=a=
22463 b</p>
22464 !! wikitext
22465 <nowiki>=a=</nowiki>
22466 b
22467
22468 <nowiki>=a=</nowiki>
22469 b
22470
22471 <nowiki>=a=</nowiki>
22472 b
22473 !!end
22474
22475 !! test
22476 Headings: 6c. Heading chars in SOL context (leading newline break)
22477 !! options
22478 parsoid=html2wt
22479 !! html/parsoid
22480 <p>a
22481 =b=</p>
22482 !! wikitext
22483 a
22484 <nowiki>=b=</nowiki>
22485 !!end
22486
22487 !! test
22488 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22489 !! options
22490 parsoid=html2wt
22491 !! html/parsoid
22492 <!--c0--><p>=a=</p>
22493
22494 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22495 !! wikitext
22496 <!--c0--><nowiki>=a=</nowiki>
22497
22498 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22499 !!end
22500
22501 !! test
22502 Headings: 6d. Heading chars in SOL context (No escaping needed)
22503 !! options
22504 parsoid=html2wt
22505 !! html/parsoid
22506 =a=<div>b</div>
22507 !! wikitext
22508 =a=<div>b</div>
22509 !!end
22510
22511 !! test
22512 Headings: 7. Insert a newline between new content and headings
22513 !! options
22514 parsoid=html2wt
22515 !! html/parsoid
22516 <h2>NEW</h2>
22517 <p>new</p>
22518 <h2 data-parsoid='{}'>A</h2>
22519 <p data-parsoid='{}'>a</p>
22520 !! wikitext
22521 == NEW ==
22522 new
22523
22524 ==A==
22525 a
22526
22527 !! end
22528
22529 #### --------------- Lists ---------------
22530 #### 0. Outside nests (*foo, etc.)
22531 #### 1. Nested inside html <ul><li>*foo</li></ul>
22532 #### 2. Inside definition lists
22533 #### 3. Only bullets at start should be escaped
22534 #### 4. No escapes needed
22535 #### 5. No unnecessary escapes
22536 #### 6. Escape bullets in SOL position
22537 #### 7. Escape bullets in a multi-line context
22538 #### ----------------------------------------
22539
22540 !! test
22541 Lists: 0. Outside nests
22542 !! options
22543 parsoid=html2wt
22544 !! html/parsoid
22545 <p>*foo</p>
22546
22547 <p>#foo</p>
22548
22549 <p>;Foo:bar</p>
22550 !! wikitext
22551 <nowiki>*</nowiki>foo
22552
22553 <nowiki>#</nowiki>foo
22554
22555 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22556 !!end
22557
22558 !! test
22559 Lists: 1. Nested inside html
22560 !! options
22561 parsoid=html2wt
22562 !! html/parsoid
22563 <ul><li>*foo</li></ul>
22564 <ul><li>#foo</li></ul>
22565 <ul><li>:foo</li></ul>
22566 <ul><li>;foo</li></ul>
22567 <ol><li>*foo</li></ol>
22568 <ol><li>#foo</li></ol>
22569 <ol><li>:foo</li></ol>
22570 <ol><li>;foo</li></ol>
22571
22572 !! wikitext
22573 *<nowiki>*foo</nowiki>
22574
22575 *<nowiki>#foo</nowiki>
22576
22577 *<nowiki>:foo</nowiki>
22578
22579 *<nowiki>;foo</nowiki>
22580
22581 #<nowiki>*foo</nowiki>
22582
22583 #<nowiki>#foo</nowiki>
22584
22585 #<nowiki>:foo</nowiki>
22586
22587 #<nowiki>;foo</nowiki>
22588 !!end
22589
22590 !! test
22591 Lists: 2. Inside definition lists
22592 !! options
22593 parsoid=html2wt
22594 !! html/parsoid
22595 <dl><dt>;foo</dt></dl>
22596 <dl><dt>:foo</dt></dl>
22597 <dl><dt>:foo</dt>
22598 <dd>bar</dd></dl>
22599 <dl><dd>:foo</dd></dl>
22600
22601 !! wikitext
22602 ;<nowiki>;foo</nowiki>
22603
22604 ;<nowiki>:foo</nowiki>
22605
22606 ;<nowiki>:foo</nowiki>
22607 :bar
22608
22609 :<nowiki>:foo</nowiki>
22610 !!end
22611
22612 !! test
22613 Lists: 3. Only bullets at start of text should be escaped
22614 !! options
22615 parsoid=html2wt
22616 !! html/parsoid
22617 <ul><li>*foo*bar</li></ul>
22618 <ul><li>*foo<i>it</i>*bar</li></ul>
22619
22620 !! wikitext
22621 *<nowiki>*foo*bar</nowiki>
22622
22623 *<nowiki>*foo</nowiki>''it''*bar
22624 !!end
22625
22626 !! test
22627 Lists: 4. No escapes needed
22628 !! options
22629 parsoid=html2wt
22630 !! html/parsoid
22631 <ul>
22632 <li>foo*bar
22633 </li>
22634 </ul>
22635 <ul>
22636 <li><i>foo</i>*bar
22637 </li>
22638 </ul>
22639 <ul>
22640 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22641 </li>
22642 </ul>
22643 <ul>
22644 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22645 </li>
22646 </ul>
22647 !! wikitext
22648 *foo*bar
22649
22650 *''foo''*bar
22651
22652 *[[Foo]]: bar
22653
22654 *[[Foo]]*bar
22655 !!end
22656
22657 !! test
22658 Lists: 5. No unnecessary escapes
22659 !! options
22660 parsoid=html2wt
22661 !! html/parsoid
22662 <ul><li> bar <span>[[foo]]</span></li></ul>
22663 <ul><li> =bar <span>[[foo]]</span></li></ul>
22664 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22665 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22666 <ul><li> =bar <span>foo]]</span>=</li></ul>
22667 <ul><li> <s></s>: a</li></ul>
22668 <ul><li> <i>* foo</i></li></ul>
22669
22670 !! wikitext
22671 * bar <span><nowiki>[[foo]]</nowiki></span>
22672
22673 * =bar <span><nowiki>[[foo]]</nowiki></span>
22674
22675 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22676
22677 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22678
22679 * =bar <span>foo]]</span>=
22680
22681 * <s></s>: a
22682
22683 * ''* foo''
22684 !!end
22685
22686 !! test
22687 Lists: 6. Escape bullets in SOL position
22688 !! options
22689 parsoid=html2wt
22690 !! html/parsoid
22691 <p><!--cmt-->*foo</p>
22692 !! wikitext
22693 <!--cmt--><nowiki>*</nowiki>foo
22694 !!end
22695
22696 !! test
22697 Lists: 7. Escape bullets in a multi-line context
22698 !! options
22699 parsoid=html2wt
22700 !! html/parsoid
22701 <p>a
22702 *b
22703 </p>
22704 !! wikitext
22705 a
22706 <nowiki>*</nowiki>b
22707 !!end
22708
22709 !! test
22710 Lists: 8. Escape colons only if not present in tags
22711 !! options
22712 parsoid=html2wt
22713 !! html/parsoid
22714 <dl><dt>a:b<i>c:d</i></dt></dl>
22715 !! wikitext
22716 ; <nowiki>a:b</nowiki>''c:d''
22717 !! end
22718
22719 #### --------------- HRs ---------------
22720 #### 1. Single line
22721 #### -----------------------------------
22722
22723 !! test
22724 HRs: 1. Single line
22725 !! options
22726 parsoid=html2wt
22727 !! html/parsoid
22728 <hr />----
22729 <hr />=foo=
22730 <hr />*foo
22731 !! wikitext
22732 ----<nowiki>----</nowiki>
22733 ----=foo=
22734 ----*foo
22735 !! end
22736
22737 #### --------------- Tables ---------------
22738 #### 1a. Simple example
22739 #### 1b. No escaping needed (!foo)
22740 #### 1c. No escaping needed (|foo)
22741 #### 1d. No escaping needed (|}foo)
22742 ####
22743 #### 2a. Nested in td (<td>foo|bar</td>)
22744 #### 2b. Nested in td (<td>foo||bar</td>)
22745 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22746 ####
22747 #### 3a. Nested in th (<th>foo!bar</th>)
22748 #### 3b. Nested in th (<th>foo!!bar</th>)
22749 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22750 ####
22751 #### 4a. Escape -
22752 #### 4b. Escape +
22753 #### 4c. No escaping needed
22754 #### --------------------------------------
22755
22756 !! test
22757 Tables: 1a. Simple example
22758 !! options
22759 parsoid=html2wt
22760 !! html/parsoid
22761 <p>{|
22762 |}
22763 </p>
22764 !! wikitext
22765 <nowiki>{|</nowiki>
22766 |}
22767 !! end
22768
22769 !! test
22770 Tables: 1b. No escaping needed
22771 !! options
22772 parsoid=html2wt
22773 !! html/parsoid
22774 <p>!foo
22775 </p>
22776 !! wikitext
22777 !foo
22778 !! end
22779
22780 !! test
22781 Tables: 1c. No escaping needed
22782 !! options
22783 parsoid=html2wt
22784 !! html/parsoid
22785 <p>|foo
22786 </p>
22787 !! wikitext
22788 |foo
22789 !! end
22790
22791 !! test
22792 Tables: 1d. No escaping needed
22793 !! options
22794 parsoid=html2wt
22795 !! html/parsoid
22796 <p>|}foo
22797 </p>
22798 !! wikitext
22799 |}foo
22800 !! end
22801
22802 !! test
22803 Tables: 2a. Nested in td
22804 !! options
22805 parsoid=html2wt
22806 !! html/parsoid
22807 <table><tbody><tr>
22808 <td>foo|bar</td></tr>
22809 <tr><td>x<div>a|b</div></td>
22810 </tbody></table>
22811 !! wikitext
22812 {|
22813 |<nowiki>foo|bar</nowiki>
22814 |-
22815 |x<div><nowiki>a|b</nowiki></div>
22816 |}
22817 !! html/php+tidy
22818 <table>
22819 <tr>
22820 <td>foo|bar</td>
22821 </tr>
22822 <tr>
22823 <td>x
22824 <div>a|b</div>
22825 </td>
22826 </tr>
22827 </table>
22828 !! end
22829
22830 !! test
22831 Tables: 2b. Nested in td
22832 !! options
22833 parsoid=html2wt
22834 !! html/parsoid
22835 <table><tbody><tr>
22836 <td>foo||bar</td>
22837 <td>a<i>b||c</i></td>
22838 <td>a<i><div>b||c</div></i></td>
22839 </tr></tbody></table>
22840 !! wikitext
22841 {|
22842 |<nowiki>foo||bar</nowiki>
22843 |a''<nowiki>b||c</nowiki>''
22844 |a''<div><nowiki>b||c</nowiki></div>''
22845 |}
22846 !! html/php
22847 <table>
22848 <tr>
22849 <td>foo||bar
22850 </td>
22851 <td>a<i>b||c</i>
22852 </td>
22853 <td>a<i><div>b||c</div></i>
22854 </td></tr></table>
22855
22856 !! end
22857
22858 !! test
22859 Tables: 2c. Nested in td -- no escaping needed
22860 !! options
22861 parsoid=html2wt
22862 !! html/*
22863 <table>
22864
22865 <tr>
22866 <td>foo!!bar
22867 </td></tr></table>
22868
22869 !! wikitext
22870 {|
22871
22872 |foo!!bar
22873 |}
22874 !! end
22875
22876 !! test
22877 Tables: 3a. Nested in th
22878 !! options
22879 parsoid=html2wt
22880 !! html/*
22881 <table>
22882
22883 <tr>
22884 <th>foo!bar
22885 </th></tr></table>
22886
22887 !! wikitext
22888 {|
22889
22890 !foo!bar
22891 |}
22892 !! end
22893
22894 !! test
22895 Tables: 3b. Nested in th
22896 !! options
22897 parsoid=html2wt
22898 !! html/parsoid
22899 <table><tbody>
22900 <tr><th>foo!!bar</th>
22901 <th><i>foo|bar</i></th>
22902 <th><i>foo!!bar</i></th>
22903 <th><i><span>foo!!bar</span></i></th>
22904 </tr></tbody></table>
22905 !! wikitext
22906 {|
22907 !<nowiki>foo!!bar</nowiki>
22908 !''<nowiki>foo|bar</nowiki>''
22909 !''<nowiki>foo!!bar</nowiki>''
22910 !''<span><nowiki>foo!!bar</nowiki></span>''
22911 |}
22912 !! html/php
22913 <table>
22914 <tr>
22915 <th>foo!!bar
22916 </th>
22917 <th><i>foo|bar</i>
22918 </th>
22919 <th><i>foo!!bar</i>
22920 </th>
22921 <th><i><span>foo!!bar</span></i>
22922 </th></tr></table>
22923
22924 !! end
22925
22926 !! test
22927 Tables: 3c. Nested in th
22928 !! options
22929 parsoid=html2wt
22930 !! html/parsoid
22931 <table><tbody>
22932 <tr><th>foo||bar</th>
22933 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22934 </tr></tbody></table>
22935 !! wikitext
22936 {|
22937 !<nowiki>foo||bar</nowiki>
22938 !<nowiki>foo||bar</nowiki>
22939 |}
22940 !! html/php
22941 <table>
22942 <tr>
22943 <th>foo||bar
22944 </th>
22945 <th>foo||bar
22946 </th></tr></table>
22947
22948 !! end
22949
22950 !! test
22951 Tables: 4a. Escape -
22952 !! options
22953 parsoid=html2wt
22954 !! html/*
22955 <table>
22956
22957 <tr>
22958 <th>-bar
22959 </th></tr>
22960 <tr>
22961 <td>-bar
22962 </td></tr></table>
22963
22964 !! wikitext
22965 {|
22966
22967 !-bar
22968
22969 |-
22970 |<nowiki>-bar</nowiki>
22971 |}
22972 !! end
22973
22974 !! test
22975 Tables: 4b. Escape +
22976 !! options
22977 parsoid=html2wt
22978 !! html/*
22979 <table>
22980
22981 <tr>
22982 <th>+bar
22983 </th></tr>
22984 <tr>
22985 <td>+bar
22986 </td></tr></table>
22987
22988 !! wikitext
22989 {|
22990
22991 !+bar
22992
22993 |-
22994 |<nowiki>+bar</nowiki>
22995 |}
22996 !! end
22997
22998 !! test
22999 Tables: 4c. No escaping needed
23000 !! options
23001 parsoid=html2wt
23002 !! html/parsoid
23003 <table><tbody>
23004 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23005 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23006 <tr><td>foo
23007 <p>bar|baz
23008 +bar
23009 -bar</p></td></tr>
23010 <tr><td>x
23011 <div>a|b</div></td>
23012 </tbody></table>
23013 !! wikitext
23014 {|
23015 |foo-bar
23016 |foo+bar
23017 |-
23018 |''foo''-bar
23019 |''foo''+bar
23020 |-
23021 |foo
23022 bar|baz
23023 +bar
23024 -bar
23025 |-
23026 |x
23027 <div>a|b</div>
23028 |}
23029 !! html/php
23030 <table>
23031 <tr>
23032 <td>foo-bar
23033 </td>
23034 <td>foo+bar
23035 </td></tr>
23036 <tr>
23037 <td><i>foo</i>-bar
23038 </td>
23039 <td><i>foo</i>+bar
23040 </td></tr>
23041 <tr>
23042 <td>foo
23043 <p>bar|baz
23044 +bar
23045 -bar
23046 </p>
23047 </td></tr>
23048 <tr>
23049 <td>x
23050 <div>a|b</div>
23051 </td></tr></table>
23052
23053 !! end
23054
23055 !! test
23056 Tables: 4d. No escaping needed
23057 !! options
23058 parsoid=html2wt
23059 !! html/parsoid
23060 <table>
23061 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23062 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23063 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23064 </tbody></table>
23065 !! wikitext
23066 {|
23067 |[[Foo]]-bar
23068 ||+1
23069 ||-2
23070 |}
23071 !! html/php
23072 <table>
23073 <tr>
23074 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23075 </td>
23076 <td>+1
23077 </td>
23078 <td>-2
23079 </td></tr></table>
23080
23081 !! end
23082
23083 !! test
23084 T97430: Don't emit empty nowiki pairs around marker meta tags
23085 !! options
23086 parsoid=html2wt
23087 !! html/parsoid
23088 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23089 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23090 !! wikitext
23091 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23092 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23093 !! end
23094
23095 !! test
23096 Unclosed xmlish element in table line shouldn't eat end delimiters
23097 !! options
23098 parsoid=html2wt
23099 !! html/parsoid
23100 <table>
23101 <tbody><tr><td> &lt;foo</td>
23102 <td> bar></td></tr>
23103 </tbody></table>
23104 !! wikitext
23105 {|
23106 | <foo
23107 | bar>
23108 |}
23109 !! html/php
23110 <table>
23111 <tr>
23112 <td> &lt;foo
23113 </td>
23114 <td> bar&gt;
23115 </td></tr></table>
23116
23117 !! end
23118
23119 #### --------------- Links ----------------
23120 #### 1. Quote marks in link text
23121 #### 2. Wikilinks: Escapes needed
23122 #### 3. Wikilinks: No escapes needed
23123 #### 4. Extlinks: Escapes needed
23124 #### 5. Extlinks: No escapes needed
23125 #### --------------------------------------
23126 !! test
23127 Links 1. WikiLinks: No escapes needed
23128 !! options
23129 parsoid=html2wt
23130 !! html/parsoid
23131 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23132 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23133 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23134 !! wikitext
23135 [[Foo|Foo''boo'']]
23136 [[Foo|[Foobar]]]
23137 [[Foo|x [Foobar] x]]
23138 !! html/php
23139 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23140 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23141 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23142 </p>
23143 !! end
23144
23145 !! test
23146 Links 2. WikiLinks: Escapes needed
23147 !! options
23148 parsoid=html2wt
23149 !! html/parsoid
23150 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23151 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23152 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23153 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23154 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23155 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23156 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23157 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23158 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23159 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23160 !! wikitext
23161 [[Foo|<nowiki>Foobar]</nowiki>]]
23162 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23163 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23164 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23165 [[Foo|<nowiki>|Bar</nowiki>]]
23166 [[Foo|<nowiki>]]bar</nowiki>]]
23167 [[Foo|<nowiki>[[bar</nowiki>]]
23168 [[Foo|<nowiki>x [[ y</nowiki>]]
23169 [[Foo|<nowiki>x ]] y</nowiki>]]
23170 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23171 !! html/php
23172 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23173 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23174 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23175 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23176 <a href="/wiki/Foo" title="Foo">|Bar</a>
23177 <a href="/wiki/Foo" title="Foo">]]bar</a>
23178 <a href="/wiki/Foo" title="Foo">[[bar</a>
23179 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23180 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23181 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23182 </p>
23183 !! end
23184
23185 !! test
23186 Links 3. WikiLinks: No escapes needed
23187 !! options
23188 parsoid=html2wt
23189 !! html/parsoid
23190 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23191 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23192 !! wikitext
23193 [[Foo|[Foobar]]
23194 [[Foo|foo|bar]]
23195 !! html/php
23196 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23197 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23198 </p>
23199 !! end
23200
23201 !! test
23202 Links 4. ExtLinks: Escapes needed
23203 !! options
23204 parsoid=html2wt
23205 !! html/parsoid
23206 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23207 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23208 <p>[http://google.com]</p>
23209 <p>[http://google.com google]</p>
23210 !! wikitext
23211 [http://google.com <nowiki>[google]</nowiki>]
23212 [http://google.com <nowiki>google]</nowiki>]
23213
23214 <nowiki>[http://google.com]</nowiki>
23215
23216 <nowiki>[http://google.com google]</nowiki>
23217
23218 !! html/php
23219 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23220 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23221 </p><p>[http://google.com]
23222 </p><p>[http://google.com google]
23223 </p>
23224 !! end
23225
23226 !! test
23227 Links 5. ExtLinks: No escapes needed
23228 !! options
23229 parsoid=html2wt
23230 !! html/parsoid
23231 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23232 !! wikitext
23233 [http://google.com [google]
23234 !! html/php
23235 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23236 </p>
23237 !! end
23238
23239 !! test
23240 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23241 !! options
23242 parsoid=html2wt
23243 !! html/parsoid
23244 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23245 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23246 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23247 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23248 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23249 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23250 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23251 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23252 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23253 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23254 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23255 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23256 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23257 </p>
23258 !! wikitext
23259 x<nowiki/>http://example.com<nowiki/>y
23260 http://example.com<nowiki/>?x
23261 http://example.com<nowiki/>&x
23262 http://example.com<nowiki/>'x
23263 http://example.com<nowiki/>,x
23264 http://example.com<nowiki/>.x
23265 http://example.com<nowiki/>;x
23266 http://example.com<nowiki/>:x
23267 http://example.com<nowiki/>;x
23268 http://example.com<nowiki/>!x
23269 http://example.com<nowiki/>=x
23270 http://example.com<nowiki/>(x)
23271 http://example.com(x<nowiki/>)
23272 !! end
23273
23274 !! test
23275 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23276 !! options
23277 parsoid=html2wt
23278 !! html/parsoid
23279 <p>x
23280 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23281 y
23282 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23283 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23284 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23285 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23286 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23287 </p>
23288 !! wikitext
23289 x
23290 http://example.com
23291 y
23292 "http://example.com"
23293 (http://example.com)
23294 (http://example.com) foo
23295 http://example.com,
23296 http://example.com, foo
23297 !! html/php
23298 <p>x
23299 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23300 y
23301 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23302 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23303 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23304 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23305 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23306 </p>
23307 !! end
23308
23309 !! test
23310 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23311 !! options
23312 parsoid=html2wt
23313 !! html/parsoid
23314 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23315 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23316 !! wikitext
23317 http://example.com.,;:!?\
23318 -http://example.com:
23319 !! html/php
23320 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23321 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23322 </p>
23323 !! end
23324
23325 !! test
23326 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23327 !! options
23328 parsoid=html2wt
23329 !! html/parsoid
23330 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23331 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23332 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23333 !! wikitext
23334 RFC 123<nowiki/>4
23335 RFC 123<nowiki/>y
23336 X<nowiki/>RFC 123<nowiki/>y
23337 !! end
23338
23339 !! test
23340 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23341 !! options
23342 parsoid=html2wt
23343 !! html/parsoid
23344 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23345 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23346 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23347 </p>
23348 !! wikitext
23349 RFC 123?foo
23350 RFC 123&foo
23351 -RFC 123-
23352 !! html/php
23353 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23354 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23355 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23356 </p>
23357 !! end
23358
23359 !! test
23360 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23361 !! options
23362 parsoid=html2wt
23363 !! html/parsoid
23364 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23365 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23366 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23367 !! wikitext
23368 PMID 123<nowiki/>4
23369 PMID 123<nowiki/>y
23370 X<nowiki/>PMID 123<nowiki/>y
23371 !! end
23372
23373 !! test
23374 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23375 !! options
23376 parsoid=html2wt
23377 !! html/parsoid
23378 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23379 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23380 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23381 </p>
23382 !! wikitext
23383 PMID 123?foo
23384 PMID 123&foo
23385 -PMID 123-
23386 !! html/php
23387 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23388 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23389 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23390 </p>
23391 !! end
23392
23393 !! test
23394 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23395 !! options
23396 parsoid=html2wt
23397 !! html/parsoid
23398 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23399 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23400 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23401 </p>
23402 !! wikitext
23403 ISBN 1234567890<nowiki/>1
23404 ISBN 1234567890<nowiki/>x
23405 a<nowiki/>ISBN 1234567890<nowiki/>b
23406 !! end
23407
23408 !! test
23409 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23410 !! options
23411 parsoid=html2wt
23412 !! html/parsoid
23413 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23414 !! wikitext
23415 -ISBN 1234567890's
23416 !! html/php
23417 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23418 </p>
23419 !! end
23420
23421 !! test
23422 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23423 !! options
23424 parsoid=html2wt
23425 !! html/*
23426 <p>this is not a link: http://example.com
23427 </p>
23428 !! wikitext
23429 this is not a link: <nowiki>http://example.com</nowiki>
23430 !! end
23431
23432 !! test
23433 Links 15. Link trails can't become link prefixes.
23434 !! options
23435 language=is
23436 parsoid=html2wt
23437 !! html/parsoid
23438 <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>
23439 !! wikitext
23440 [[Söfnuður]]-[[00]]
23441 !! html/php
23442 <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>
23443 </p>
23444 !! end
23445
23446 #### --------------- Quotes ---------------
23447 #### 1. Quotes inside <b> and <i>
23448 #### 2. Link fragments separated by <i> and <b> tags
23449 #### 3. Link fragments inside <i> and <b>
23450 #### 4. No escaping needed
23451 #### --------------------------------------
23452 !! test
23453 1a. Quotes inside <b> and <i>
23454 !! options
23455 parsoid=html2wt
23456 !! html/*
23457 <p><i>'foo'</i>
23458 <i>''foo''</i>
23459 <i>'''foo'''</i>
23460 <i>foo</i>'s
23461 <b>'foo'</b>
23462 <b>''foo''</b>
23463 <b>'''foo'''</b>
23464 <b>foo'<i>bar'</i>baz</b>
23465 <b>foo</b>'s
23466 '<i>foo</i>
23467 <i>foo</i>'
23468 <i>foo'</i>'
23469 '<i>foo</i>'
23470 '<b>foo</b>
23471 <b>foo</b>'
23472 '<b>foo</b>'
23473 <i>fools'<span> errand</span></i>
23474 <i><span>fool</span>'s errand</i>
23475 '<i>foo</i> bar '<i>baz</i>
23476 a|!*#-:;+-~[]{}b'<i>x</i>
23477 </p>
23478 !! wikitext
23479 ''<nowiki/>'foo'''
23480 ''<nowiki>''foo''</nowiki>''
23481 ''<nowiki>'''foo'''</nowiki>''
23482 ''foo''<nowiki/>'s
23483 '''<nowiki/>'foo''''
23484 '''<nowiki>''foo''</nowiki>'''
23485 '''<nowiki>'''foo'''</nowiki>'''
23486 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23487 '''foo'''<nowiki/>'s
23488 '''foo''
23489 ''foo''<nowiki/>'
23490 ''foo'''<nowiki/>'
23491 '''foo''<nowiki/>'
23492 ''''foo'''
23493 '''foo'''<nowiki/>'
23494 ''''foo'''<nowiki/>'
23495 ''fools'<span> errand</span>''
23496 ''<span>fool</span>'s errand''
23497 '<nowiki/>''foo'' bar '''baz''
23498 a|!*#-:;+-~[]{}b'''x''
23499 !! end
23500
23501 !! test
23502 1b. Quotes inside <b> and <i> with other tags on same line
23503 !! options
23504 parsoid=html2wt
23505 !! html/parsoid
23506 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23507 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23508 <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>
23509 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23510 '<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>
23511 '<i>foo</i> <div title="name">test</div>
23512 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23513 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23514 <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>
23515 </ol>
23516 !! wikitext
23517 '''a'' foo ''[[bar]]''
23518 ''a''' foo ''[[bar]]''
23519 ''a''' foo '''{{echo|[[bar]]}}'''
23520 [[foo]] x'''[[bar]]''
23521 '''foo'' <ref>test</ref>
23522 '''foo'' <div title="name">test</div>
23523 '''foo'' and <br> bar
23524 <references />
23525 !! end
23526
23527 !! test
23528 2. Link fragments separated by <i> and <b> tags
23529 !! options
23530 parsoid=html2wt
23531 !! html/parsoid
23532 <p>[[<i>foo</i>hello]]</p>
23533 <p>[[<b>foo</b>hello]]</p>
23534 !! wikitext
23535 [[''foo''<nowiki>hello]]</nowiki>
23536
23537 [['''foo'''<nowiki>hello]]</nowiki>
23538 !! end
23539
23540 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23541 # this is one of the shortcomings of this format
23542 !! test
23543 3. Link fragments inside <i> and <b>
23544 !! options
23545 parsoid=html2wt
23546 !! html/parsoid
23547 <p><i>[[foo</i>]]</p>
23548 <p><b>[[foo</b>]]</p>
23549 !! wikitext
23550 ''[[foo''<nowiki>]]</nowiki>
23551
23552 '''[[foo'''<nowiki>]]</nowiki>
23553 !! end
23554
23555 !! test
23556 4. No escaping needed
23557 !! options
23558 options=html2wt
23559 !! html/parsoid
23560 <p>'<span><i>bar</i></span>'
23561 '<span><b>bar</b></span>'
23562 'a:b'foo
23563 </p>
23564 !! wikitext
23565 '<span>''bar''</span>'
23566 '<span>'''bar'''</span>'
23567 'a:b'foo
23568 !! end
23569
23570 #### ----------- Paragraphs ---------------
23571 #### 1. No unnecessary escapes
23572 #### --------------------------------------
23573
23574 !! test
23575 1. No unnecessary escapes
23576 !! options
23577 parsoid=html2wt
23578 !! html/parsoid
23579 <p>bar <span>[[foo]]</span>
23580 </p><p>=bar <span>[[foo]]</span>
23581 </p><p>[[bar <span>[[foo]]</span>
23582 </p><p>]]bar <span>[[foo]]</span>
23583 </p><p>=bar <span>foo]]</span>=
23584 </p>
23585 !! wikitext
23586 bar <span><nowiki>[[foo]]</nowiki></span>
23587
23588 =bar <span><nowiki>[[foo]]</nowiki></span>
23589
23590 [[bar <span><nowiki>[[foo]]</nowiki></span>
23591
23592 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23593
23594 =bar <span>foo]]</span><nowiki>=</nowiki>
23595 !!end
23596
23597 #### ----------------------- PRE --------------------------
23598 #### 1. Leading whitespace in SOL context should be escaped
23599 #### ------------------------------------------------------
23600 !! test
23601 1. Leading whitespace in SOL context should be escaped
23602 !! options
23603 parsoid=html2wt
23604 !! html/parsoid
23605 <p> a</p>
23606
23607 <p> a</p>
23608
23609 <p> a(tab)</p>
23610
23611 <p> a
23612 <!--cmt-->
23613 a</p>
23614
23615 <p>a
23616 b</p>
23617
23618 <p>a
23619 b</p>
23620
23621 <p>a
23622 b</p>
23623 !! wikitext
23624 <nowiki> </nowiki>a
23625
23626 <nowiki> </nowiki> a
23627
23628 a(tab)
23629
23630 <nowiki> </nowiki> a
23631 <!--cmt-->
23632 <nowiki> </nowiki>a
23633
23634 a
23635 <nowiki> </nowiki>b
23636
23637 a
23638 b
23639
23640 a
23641 b
23642 !! html/php
23643 <p> a
23644 </p><p> a
23645 </p><p> a(tab)
23646 </p><p> a
23647 a
23648 </p><p>a
23649 b
23650 </p><p>a
23651 b
23652 </p><p>a
23653 b
23654 </p>
23655 !! end
23656
23657 !! test
23658 2. Leading whitespace in non-indent-pre contexts should not be escaped
23659 !! options
23660 parsoid=htm2wt
23661 !! html/parsoid
23662 <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>
23663 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23664 <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>
23665 b</span></li>
23666 </ol>
23667 !! wikitext
23668 foo <ref>''a''
23669 b</ref>
23670 <references />
23671 !! end
23672
23673 !! test
23674 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23675 !! options
23676 parsoid=html2wt
23677 !! html/parsoid
23678 <blockquote>
23679 <p>
23680 a
23681 <span>b</span>
23682 c</p>
23683 </blockquote>
23684 !! wikitext
23685 <blockquote>
23686 a
23687 <span>b</span>
23688 c
23689 </blockquote>
23690 !! end
23691
23692 !! test
23693 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23694 !! options
23695 options=html2wt
23696 !! html/parsoid
23697 <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>
23698 !! wikitext
23699 [[File:Foobar.jpg|thumb|caption]]
23700 !! end
23701
23702 !! test
23703 5. Nowiki escaping should account for indent-pres
23704 !! options
23705 parsoid=html2wt
23706 !! html/parsoid
23707 <pre>==foo==</pre>
23708 !! wikitext
23709 ==foo==
23710 !! end
23711
23712 !!test
23713 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23714 !! options
23715 parsoid=html2wt
23716 !! html/parsoid
23717 <pre>
23718 * foo
23719 * bar
23720 </pre>
23721 !! wikitext
23722 * foo
23723 * bar
23724 !! end
23725
23726 #### --------------- Behavior Switches --------------------
23727
23728 !! test
23729 1. Valid behavior switches should be escaped
23730 !! options
23731 parsoid=html2wt
23732 !! html/parsoid
23733 __TOC__
23734 <i>__TOC__</i>
23735 !! wikitext
23736 <nowiki>__TOC__</nowiki>
23737 ''<nowiki>__TOC__</nowiki>''
23738 !! end
23739
23740 !! test
23741 2. Invalid behavior switches should not be escaped
23742 !! options
23743 parsoid=html2wt
23744 !! html/parsoid
23745 __TOO__
23746 __|__
23747 !! wikitext
23748 __TOO__
23749 __|__
23750 !! end
23751
23752 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23753 !! test
23754 Behavior switches should be SOL-transparent
23755 !! options
23756 parsoid=html2wt
23757 !! html/parsoid
23758 <meta property="mw:PageProp/toc" />
23759
23760 <!-- this one's bogus -->
23761 <pre>__TOO__</pre>
23762
23763 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23764
23765 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23766 !! wikitext
23767 __TOC__
23768
23769 <!-- this one's bogus -->
23770 __TOO__
23771
23772 __TOC__ foo
23773
23774 __TOC__
23775 bar
23776 !! end
23777
23778 #### --------------- HTML tags ---------------
23779 #### 1. a tags
23780 #### 2. other tags
23781 #### 3. multi-line html tag
23782 #### 4. extension tags
23783 #### -----------------------------------------
23784 !! test
23785 1. a tags
23786 !! options
23787 parsoid=html2wt
23788 !! html/parsoid
23789 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23790 !! wikitext
23791 <a href="http://google.com">google</a>
23792 !! end
23793
23794 !! test
23795 2. other tags
23796 !! options
23797 parsoid=html2wt
23798 !! html/parsoid
23799 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23800 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23801 <li> &lt;td&gt;</li></ul>
23802
23803 !! wikitext
23804 * <nowiki><div>foo</div></nowiki>
23805 * <nowiki><div style="color:red">foo</div></nowiki>
23806 * <nowiki><td></nowiki>
23807 !! end
23808
23809 !! test
23810 3. multi-line html tag
23811 !! options
23812 parsoid=html2wt
23813 !! html/parsoid
23814 <p>&lt;div
23815 &gt;foo&lt;/div
23816 &gt;
23817 </p>
23818 !! wikitext
23819 <nowiki><div
23820 >foo</div
23821 ></nowiki>
23822 !! end
23823
23824 !! test
23825 4. extension tags
23826 !! options
23827 parsoid=html2wt
23828 !! html/parsoid
23829 <p>&lt;ref&gt;foo&lt;/ref&gt;
23830 </p><p>&lt;ref&gt;bar
23831 </p><p>baz&lt;/ref&gt;
23832 </p>
23833 !! wikitext
23834 <nowiki><ref>foo</ref></nowiki>
23835
23836 <nowiki><ref>bar</nowiki>
23837
23838 baz<nowiki></ref></nowiki>
23839 !! end
23840
23841 #### --------------- Others ---------------
23842 !! test
23843 Escaping nowikis
23844 !! options
23845 parsoid=html2wt
23846 !! html/parsoid
23847 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23848 </p>
23849 !! wikitext
23850 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23851 !! end
23852
23853 ## The quote-char in the input is necessary for triggering the bug
23854 !! test
23855 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23856 !! options
23857 parsoid=html2wt
23858 !! html/parsoid
23859 <p>foo's bar :</p>
23860 !! wikitext
23861 foo's bar :
23862 !! end
23863
23864 #----------- End of wikitext escaping tests --------------
23865
23866 !! test
23867
23868 Tag-like HTML structures are passed through as text
23869 !! wikitext
23870 <x y>
23871
23872 <x.y>
23873
23874 <x-y>
23875
23876 1>2
23877
23878 x<y
23879
23880 a>b
23881
23882 1<d e>f
23883 !! html
23884 <p>&lt;x y&gt;
23885 </p><p>&lt;x.y&gt;
23886 </p><p>&lt;x-y&gt;
23887 </p><p>1&gt;2
23888 </p><p>x&lt;y
23889 </p><p>a&gt;b
23890 </p><p>1&lt;d e&gt;f
23891 </p>
23892 !! end
23893
23894 !! test
23895 HTML tag with necessary entities in attributes
23896 !! wikitext
23897 <span title="&amp;amp;">foo</span>
23898 !! html
23899 <p><span title="&amp;amp;">foo</span>
23900 </p>
23901 !! end
23902
23903 !! test
23904 HTML tag with 'unnecessary' entity encoding in attributes
23905 !! wikitext
23906 <span title="&amp;">foo</span>
23907 !! html
23908 <p><span title="&amp;">foo</span>
23909 </p>
23910 !! end
23911
23912 !! test
23913 HTML tag with broken attribute value quoting
23914 !! options
23915 parsoid=wt2html,html2html
23916 !! wikitext
23917 <span title="Hello world>Foo</span>
23918 !! html/php
23919 <p><span title="Hello world">Foo</span>
23920 </p>
23921 !! html/parsoid
23922 <p><span title="Hello world">Foo</span></p>
23923 !! end
23924
23925 !! test
23926 Self-closed tag with broken attribute value quoting
23927 !! options
23928 parsoid=wt2html,html2html
23929 !! wikitext
23930 <div title="Hello world />Foo
23931 !! html/php+tidy
23932 <div title="Hello world"></div>
23933 <p>Foo</p>
23934 !! html/parsoid
23935 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
23936 !! end
23937
23938 !! test
23939 Table with broken attribute value quoting
23940 !! options
23941 parsoid=wt2html,html2html
23942 !! wikitext
23943 {|
23944 | title="Hello world|Foo
23945 |}
23946 !! html/php
23947 <table>
23948 <tr>
23949 <td title="Hello world">Foo
23950 </td></tr></table>
23951
23952 !! html/parsoid
23953 <table>
23954 <tr>
23955 <td title="Hello world">Foo
23956 </td></tr></table>
23957
23958 !! end
23959
23960 !! test
23961 Table with broken attribute value quoting on consecutive lines
23962 !! options
23963 parsoid=wt2html,html2html
23964 !! wikitext
23965 {|
23966 | title="Hello world|Foo
23967 | style="color:red|Bar
23968 |}
23969 !! html/php
23970 <table>
23971 <tr>
23972 <td title="Hello world">Foo
23973 </td>
23974 <td style="color:red">Bar
23975 </td></tr></table>
23976
23977 !! html/parsoid
23978 <table><tbody>
23979 <tr>
23980 <td title="Hello world">Foo
23981 </td><td style="color: red">Bar
23982 </td></tr></tbody></table>
23983
23984 !! end
23985
23986 !! test
23987 2. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23988 !! options
23989 parsoid
23990 !! wikitext
23991 {{}}
23992 !! html
23993 {{}}
23994 !! end
23995
23996 !! test
23997 1. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23998 !! options
23999 parsoid
24000 !! wikitext
24001 }}{{
24002 !! html
24003 }}{{
24004 !! end
24005
24006 !!test
24007 Accept empty td cell attribute
24008 !! wikitext
24009 {|
24010 | align="center" | foo || |
24011 |}
24012 !! html
24013 <table>
24014 <tr>
24015 <td align="center"> foo </td>
24016 <td>
24017 </td></tr></table>
24018
24019 !!end
24020
24021 !!test
24022 Non-empty attributes in th-cells
24023 !! wikitext
24024 {|
24025 ! Foo !! style="color: red" | Bar
24026 |}
24027 !! html
24028 <table>
24029 <tr>
24030 <th> Foo </th>
24031 <th style="color: red"> Bar
24032 </th></tr></table>
24033
24034 !!end
24035
24036 !!test
24037 Accept empty attributes in th-cells
24038 !! wikitext
24039 {|
24040 !| foo !!| bar
24041 |}
24042 !! html
24043 <table>
24044 <tr>
24045 <th> foo </th>
24046 <th> bar
24047 </th></tr></table>
24048
24049 !!end
24050
24051 !!test
24052 Empty table rows go away
24053 !! wikitext
24054 {|
24055 | Hello
24056 | there
24057 |- class="foo"
24058 |-
24059 |}
24060 !! html
24061 <table>
24062 <tr>
24063 <td> Hello
24064 </td>
24065 <td> there
24066 </td></tr>
24067
24068 </table>
24069
24070 !! end
24071
24072 ###
24073 ### Parsoid-centric tests for testing RTing of inter-element separators
24074 ### Edge cases not tested by existing parser tests and specific to
24075 ### Parsoid-specific serialization strategies.
24076 ###
24077
24078 !!test
24079 RT-ed inter-element separators should be valid separators
24080 !! wikitext
24081 {|
24082 |- [[foo]]
24083 |}
24084 !! html/php
24085 <table>
24086
24087 </table>
24088
24089 !! html/parsoid
24090 <table>
24091 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24092 </tbody></table>
24093 !!end
24094
24095 # Parsoid-only since PHP parser relies on Tidy for correct output
24096 !!test
24097 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24098 !!options
24099 parsoid
24100 !! wikitext
24101 {|
24102 |<small>foo
24103 bar
24104 |}
24105
24106 {|
24107 |<small>foo<small>
24108 |}
24109 !! html
24110 <table>
24111 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24112 <p>bar</p></small></td></tr>
24113 </tbody></table>
24114
24115 <table>
24116 <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>
24117 </tbody></table>
24118 !!end
24119
24120 # Note that the "style" attribute is really a template parameter here.
24121 # The = would have to be {{=}} if you wanted the literal.
24122 !!test
24123 Empty TD followed by TD with tpl-generated attribute
24124 !! wikitext
24125 {|
24126 |-
24127 |
24128 |{{echo|style='color:red'}}|foo
24129 |}
24130 !! html
24131 <table>
24132
24133 <tr>
24134 <td>
24135 </td>
24136 <td>foo
24137 </td></tr></table>
24138
24139 !!end
24140
24141 !!test
24142 Indented table with an empty td
24143 !! wikitext
24144 {|
24145 |-
24146 |
24147 |foo
24148 |}
24149 !! html
24150 <table>
24151
24152 <tr>
24153 <td>
24154 </td>
24155 <td>foo
24156 </td></tr></table>
24157
24158 !!end
24159
24160 ## We have some newline diffs RT-ing this edge case
24161 ## and it is not important enough -- we seem to be emitting
24162 ## at most 2 newlines after a </tr> and this is unrelated to
24163 ## the issue from T85627 that this is testing.
24164 !!test
24165 Indented table with blank lines in between (T85627)
24166 !! options
24167 parsoid=wt2html
24168 !! wikitext
24169 {|
24170 |foo
24171
24172
24173 |}
24174 !! html
24175 <table>
24176
24177 <tr>
24178 <td>foo
24179 </td></tr></table>
24180
24181 !!end
24182
24183 !!test
24184 Indented block & table
24185 !! wikitext
24186 <div>foo</div>
24187 {|
24188 |foo
24189 |}
24190 !! html/php
24191 <div>foo</div>
24192 <table>
24193 <tr>
24194 <td>foo
24195 </td></tr></table>
24196
24197 !! html/parsoid
24198 <div data-parsoid='{"stx":"html"}'>foo</div>
24199 <table><tbody>
24200 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24201 </tbody></table>
24202 !!end
24203
24204 !! test
24205 Indent and comment before table row
24206 !! wikitext
24207 {|
24208 <!--hi-->|-
24209 | there
24210 |}
24211 !! html/php
24212 <table>
24213
24214 <tr>
24215 <td> there
24216 </td></tr></table>
24217
24218 !! html/parsoid
24219 <table>
24220 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24221 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24222 </tbody></table>
24223 !! end
24224
24225 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24226 !!test
24227 Empty TR followed by a template-generated TR
24228 !!options
24229 parsoid
24230 !! wikitext
24231 {|
24232 |-
24233 {{echo|<tr><td>foo</td></tr>}}
24234 |}
24235 !! html
24236 <table>
24237 <tbody>
24238 <tr></tr>
24239 <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}}]}'>
24240 <td>foo</td></tr>
24241 </tbody></table>
24242 !!end
24243
24244 ## PHP and parsoid output differ for this, and since this is primarily
24245 ## for testing Parsoid's serializer, marking this Parsoid only
24246 !!test
24247 Empty TR followed by mixed-ws-comment line should RT correctly
24248 !!options
24249 parsoid
24250 !! wikitext
24251 {|
24252 |-
24253 <!--c-->
24254 |-
24255 <!--c--> <!--d-->
24256 |}
24257 !! html
24258 <table>
24259 <tbody>
24260 <tr></tr>
24261 <!--c-->
24262 <tr>
24263 <!--c--> </tr><!--d-->
24264 </tbody></table>
24265
24266 !!end
24267
24268 !!test
24269 Multi-line image caption generated by templates with/without trailing newlines
24270 !! wikitext
24271 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24272 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24273 !! html/parsoid
24274 <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>
24275 <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>
24276 !!end
24277
24278 !! test
24279 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24280 !! options
24281 parsoid=html2wt
24282 !! html/parsoid
24283 <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>
24284
24285 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24286 !! wikitext
24287 <includeonly>foo</includeonly>
24288 new para
24289
24290 [[Category:Foo]]
24291
24292 = new heading =
24293 !! end
24294
24295 ## PHP emits broken html for this, and since this is primarily
24296 ## a Parsoid serializer test, marking this Parsoid only
24297 !!test
24298 Improperly nested inline or quotes tags with whitespace in between
24299 !! wikitext
24300 <span> <s>x</span> </s>
24301 ''' ''x''' ''
24302 !! html/parsoid
24303 <p><span> <s>x</s></span><s> </s>
24304 <b> <i>x</i></b><i> </i>
24305 </p>
24306 !!end
24307
24308 !!test
24309 Encapsulate protected attributes from wt
24310 !! wikitext
24311 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24312 !! html/parsoid
24313 <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>
24314 </body>
24315 !!end
24316
24317 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24318 ## Having nested or stray pre tags results in the attempt to add duplicates,
24319 ## causing an assertion fail. This test tries to prevent that situation.
24320 !!test
24321 Ensure ParagraphWrapper can deal with stray closing pre tags
24322 !!options
24323 parsoid=wt2html
24324 !! wikitext
24325 plain text</pre>
24326 !! html/parsoid
24327 plain text
24328 !!end
24329
24330 !!test
24331 1. Ensure fostered text content is wrapped in element nodes
24332 !!options
24333 parsoid=wt2html
24334 !! wikitext
24335 <table>hi</table><table>ho</table>
24336 !! html/parsoid
24337 <p>hi</p>
24338 <table></table>
24339 <p>ho</p>
24340 <table></table>
24341 !!end
24342
24343 !!test
24344 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24345 !!options
24346 parsoid=wt2html,wt2wt
24347 !! wikitext
24348 <table>
24349 <tr> || ||
24350 <td> a
24351 </table>
24352 !! html/parsoid
24353 <p> || ||
24354 </p><table>
24355 <tbody><tr><td> a</td></tr>
24356 </tbody></table>
24357 !!end
24358
24359 !!test
24360 Encapsulation properly handles null DSR information from foster box
24361 !!options
24362 parsoid=wt2html,wt2wt
24363 !! wikitext
24364 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24365 !! html/parsoid
24366 <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>
24367 !!end
24368
24369 !!test
24370 1. Encapsulate foster-parented transclusion content
24371 !!options
24372 parsoid=wt2wt,wt2html
24373 !! wikitext
24374 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24375 !! html/parsoid
24376 <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>
24377 <tbody>
24378 <tr>
24379 <td>bar</td>
24380 </tr>
24381 </tbody>
24382 </table>
24383 !!end
24384
24385 !!test
24386 2. Encapsulate foster-parented transclusion content
24387 !!options
24388 parsoid=wt2wt,wt2html
24389 !! wikitext
24390 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24391 !! html/parsoid
24392 <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>
24393 <table>
24394 <tbody>
24395 <tr>
24396 <td>bar</td>
24397 </tr>
24398 </tbody>
24399 </table>
24400 !!end
24401
24402 !!test
24403 3. Encapsulate foster-parented transclusion content
24404 !!options
24405 parsoid=wt2wt,wt2html
24406 !! wikitext
24407 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24408 !! html/parsoid
24409 <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;]}">
24410 <p>foo</p>
24411 </div>
24412 <table>
24413 <tbody>
24414 <tr>
24415 <td>bar</td>
24416 </tr>
24417 </tbody>
24418 </table>
24419 !!end
24420
24421 !!test
24422 4. Encapsulate foster-parented transclusion content
24423 !!options
24424 parsoid=wt2wt,wt2html
24425 !! wikitext
24426 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24427 !! html/parsoid
24428 <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;]}">
24429 <p>foo</p>
24430 </div>
24431 <table>
24432 <tbody>
24433 <tr>
24434 <td>bar</td>
24435 </tr>
24436 </tbody>
24437 </table>
24438 !!end
24439
24440 !!test
24441 5. Encapsulate foster-parented transclusion content
24442 !!options
24443 parsoid=wt2wt,wt2html
24444 !! wikitext
24445 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24446 !! html/parsoid
24447 <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>
24448 <table>
24449 <tbody>
24450 <tr>
24451 <td>
24452 <div>
24453 <p>foo</p>
24454 </div>
24455 </td>
24456 </tr>
24457 </tbody>
24458 </table>
24459 !!end
24460
24461 !!test
24462 6. Encapsulate foster-parented transclusion content
24463 !!options
24464 parsoid=wt2wt,wt2html
24465 !! wikitext
24466 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24467 !! html/parsoid
24468 <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>
24469 <table>
24470 <tbody>
24471 <tr>
24472 <td>
24473 <div>
24474 <p>foo</p>
24475 </div>
24476 </td>
24477 </tr>
24478 </tbody>
24479 </table>
24480 <p>ok</p>
24481 !!end
24482
24483 !!test
24484 7. Encapsulate foster-parented transclusion content
24485 !!options
24486 parsoid=wt2wt,wt2html
24487 !! wikitext
24488 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24489 !! html/parsoid
24490 <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>
24491 <table>
24492 <tbody>
24493 <tr>
24494 <td>bar</td>
24495 </tr>
24496 </tbody>
24497 </table>
24498 !!end
24499
24500 # Note that the wt is broken on purpose: the = should be {{=}} if you
24501 # don't want it to be a template parameter key.
24502 !!test
24503 8. Encapsulate foster-parented transclusion content
24504 !!options
24505 parsoid=wt2wt,wt2html
24506 !! wikitext
24507 {{echo|a
24508 }}{|{{echo|style='color:red'}}
24509 |-
24510 |b
24511 |}
24512 !! html/parsoid
24513 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24514 <span> </span>
24515 <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>
24516 <table>
24517 <tbody>
24518 <tr>
24519 <td>b</td>
24520 </tr>
24521 </tbody>
24522 </table>
24523 !!end
24524
24525 !!test
24526 9. Encapsulate foster-parented transclusion content
24527 !!options
24528 parsoid=wt2wt,wt2html
24529 !! wikitext
24530 <table>{{echo|hi</table>hello}}
24531 !! html/parsoid
24532 <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>
24533 !!end
24534
24535 !!test
24536 Table in fosterable position
24537 !!options
24538 parsoid=wt2html,wt2wt
24539 !! wikitext
24540 {{OpenTable}}
24541 <div>
24542 {|
24543 |}
24544 </div>
24545 |}
24546 !! html/parsoid
24547 <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">
24548 </span>
24549 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24550
24551 <table>
24552 </table>
24553 !!end
24554
24555 # Parsoid only for bug 64747
24556 !! test
24557 Properly encapsulate empty-content transclusions in fosterable positions
24558 !! wikitext
24559 <table>
24560 {{#if:|
24561 <td>foo</td>
24562 }}
24563 </table>
24564 !! html/parsoid
24565 <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":["","","",""]}]]}'>
24566
24567 </table>
24568 !! end
24569
24570 !! test
24571 Always encapsulate foster box when template range is expanded to table
24572 !! options
24573 parsoid=wt2wt
24574 !! wikitext
24575 {|
24576 hello
24577 {{OpenTable}}
24578 |}
24579 !! html/parsoid
24580
24581 !! end
24582
24583 !!test
24584 Support <object> element with .data attribute
24585 !!options
24586 parsoid=html2wt
24587 !! html/parsoid
24588 <object data="test.swf"></object>
24589 !! wikitext
24590 <object data="test.swf"></object>
24591 !!end
24592
24593 !! test
24594 Don't block XML namespace declaration
24595 !! wikitext
24596 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24597 !! html/php
24598 <p><span>MediaWiki</span>
24599 </p>
24600 !! html/parsoid
24601 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24602 !! end
24603
24604 # -----------------------------------------------------------------
24605 # The following section of tests are primarily to spec requirements
24606 # around serialization of new/edited content.
24607 #
24608 # All these tests are marked Parsoid html2wt and html2html only
24609 # ----------------------------------------------------------------
24610
24611 # 'mi' is a localinterwiki prefix as well as a language
24612 !! test
24613 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24614 !! options
24615 parsoid=html2wt
24616 !! html/parsoid
24617 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24618 !! wikitext
24619 [[Foo]]
24620 !! end
24621
24622 # See T93839
24623 !! test
24624 New wikilinks should be serialized properly
24625 !! options
24626 parsoid=html2wt
24627 !! html/parsoid
24628 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24629 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24630 !! wikitext
24631 [[Foo]]
24632 [[Foo]]
24633 !! end
24634
24635 !! test
24636 New wiki links (href variations)
24637 !! options
24638 parsoid=html2wt
24639 !! html/parsoid
24640 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24641 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24642 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24643 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24644 !! wikitext
24645 [[Foo_bar]]
24646 [[Foo_bar]]
24647 [[Foo_bar]]
24648 [[Toxine bactérienne]]
24649 !! end
24650
24651 !! test
24652 New wiki links (content string variations)
24653 !! options
24654 parsoid=html2wt
24655 !! html/parsoid
24656 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24657 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24658 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24659 !! wikitext
24660 [[Foo_bar]]
24661 [[Foo bar]]
24662 [[Foo_bar|./Foo_bar]]
24663 !! end
24664
24665 !! test
24666 New category links (href variations)
24667 !! options
24668 parsoid=html2wt
24669 !! html/parsoid
24670 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24671 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24672 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24673 !! wikitext
24674 [[Category:Toxine bactérienne]]
24675 [[Category:Toxine bactérienne]]
24676 [[Category:Toxine bactérienne]]
24677 !! end
24678
24679 !! test
24680 New sol transparent links don't need indent-pre nowiki protection
24681 !! options
24682 parsoid=html2wt
24683 language=de
24684 !! html/parsoid
24685 <link rel="mw:PageProp/redirect" href="./Main_Page">
24686 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24687 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24688 !! wikitext
24689 #WEITERLEITUNG [[Main Page]]
24690 <!-- this is good --> [[Category:Good]]
24691 <!-- this is great --> [[Kategorie:Great]]
24692 !! end
24693
24694 !! test
24695 New interlanguage links (href variations)
24696 !! options
24697 parsoid=html2wt
24698 !! html/parsoid
24699 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24700 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24701 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24702 !! wikitext
24703 [[es:Toxine bactérienne]]
24704 [[es:Toxine_bactérienne]]
24705 [[es:Toxine_bactérienne]]
24706 !! end
24707
24708 !! test
24709 Image: Modifying size of an image (1)
24710 !! options
24711 parsoid={
24712 "modes": ["wt2wt"],
24713 "changes": [
24714 ["img[height]", "attr", "height", "22"],
24715 ["img[width]", "attr", "width", "200"]
24716 ]
24717 }
24718 !! wikitext
24719 [[Image:Foobar.jpg|230x230px]]
24720 !! wikitext/edited
24721 [[Image:Foobar.jpg|200x200px]]
24722 !!end
24723
24724 !! test
24725 Image: Modifying size of an image (2)
24726 !! options
24727 parsoid={
24728 "modes": ["wt2wt"],
24729 "changes": [
24730 ["img[height]", "attr", "height", "100"],
24731 ["img[width]", "attr", "width", "500"]
24732 ]
24733 }
24734 !! wikitext
24735 [[Image:Foobar.jpg|230x230px]]
24736 !! wikitext/edited
24737 [[Image:Foobar.jpg|500x500px]]
24738 !!end
24739
24740 # Change in size is ignored so long as class='mw-default-size'
24741 !! test
24742 Image: Modifying size of an image (3)
24743 !! options
24744 parsoid={
24745 "modes": ["wt2wt"],
24746 "changes": [
24747 ["figure[class]", "removeClass", "mw-default-size"],
24748 ["figure img", "attr", "height", "19"],
24749 ["figure img", "attr", "width", "170"]
24750 ]
24751 }
24752 !! wikitext
24753 [[Image:Foobar.jpg|thumb]]
24754 !! wikitext/edited
24755 [[Image:Foobar.jpg|thumb|170x170px]]
24756 !!end
24757
24758 !! test
24759 Image: Modifying alignment of an image (bug 48665)
24760 !! options
24761 parsoid={
24762 "modes": ["wt2wt"],
24763 "changes": [
24764 ["figure[class]", "removeClass", "mw-halign-right"],
24765 ["figure[class]", "addClass", "mw-halign-left"]
24766 ]
24767 }
24768 !! wikitext
24769 [[Image:Foobar.jpg|thumb|caption|right]]
24770 !! wikitext/edited
24771 [[Image:Foobar.jpg|thumb|caption|left]]
24772 !! end
24773
24774 !! test
24775 Image: Modifying mw-default-size of an frameless image (bug 62805)
24776 !! options
24777 parsoid={
24778 "modes": ["wt2wt"],
24779 "changes": [
24780 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24781 ]
24782 }
24783 !! wikitext
24784 [[Image:Foobar.jpg|frameless|right]]
24785 !! wikitext/edited
24786 [[Image:Foobar.jpg|frameless|right|220x220px]]
24787 !! end
24788
24789 !! test
24790 Image: Modifying valign of an image (bug 49221)
24791 !! options
24792 parsoid={
24793 "modes": ["wt2wt"],
24794 "changes": [
24795 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24796 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24797 ]
24798 }
24799 !! wikitext
24800 [[File:Foobar.jpg|20px|middle]]
24801 !! wikitext/edited
24802 [[File:Foobar.jpg|20px|text-top]]
24803 !! end
24804
24805 !! test
24806 Image: Modifying alt attribute of an image (bug 56400)
24807 !! options
24808 parsoid={
24809 "modes": ["wt2wt"],
24810 "changes": [
24811 ["img[alt]", "attr", "alt", "some alternate edited text"]
24812 ]
24813 }
24814 !! wikitext
24815 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24816 !! wikitext/edited
24817 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24818 !!end
24819
24820 !! test
24821 Image: Modifying caption of an image
24822 !! options
24823 parsoid={
24824 "modes": ["wt2wt"],
24825 "changes": [
24826 ["figcaption", "text", "new caption"]
24827 ]
24828 }
24829 !! wikitext
24830 [[Image:Foobar.jpg|thumb|original caption]]
24831 !! wikitext/edited
24832 [[Image:Foobar.jpg|thumb|new caption]]
24833 !!end
24834
24835 !! test
24836 Image: empty alt attribute (bug 48924)
24837 !! options
24838 parsoid
24839 !! wikitext
24840 [[File:Foobar.jpg|thumb|alt=|bar]]
24841 !! html
24842 <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>
24843 !! end
24844
24845 !! test
24846 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24847 !! options
24848 parsoid=html2wt
24849 language=ar
24850 disabled
24851 !! html/parsoid
24852 <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>
24853 !! wikitext
24854 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24855 !! end
24856
24857 !! test
24858 Image: Block level image should have \n before and after
24859 !! wikitext
24860 123
24861 [[File:Foobar.jpg|right|thumb|150x150px]]
24862 456
24863 !! html/parsoid
24864 <p>123</p>
24865 <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>
24866 <p>456</p>
24867 !!end
24868
24869 !! test
24870 Image: New block level image should have \n before and after (existing content)
24871 !! wikitext
24872 123
24873 [[File:Foobar.jpg|right|thumb|150x150px]]
24874 456
24875 !! html/parsoid
24876 <p>123</p>
24877 <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>
24878 <p>456</p>
24879 !!end
24880
24881 !! test
24882 Image: upright option (parsoid)
24883 !! wikitext
24884 [[File:Foobar.jpg|thumb|upright|caption]]
24885 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24886 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24887 !! html/parsoid
24888 <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>
24889 <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>
24890 <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>
24891 !!end
24892
24893 !! test
24894 Image: upright option is ignored on inline and frame images (parsoid)
24895 !! wikitext
24896 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24897 !! html/parsoid
24898 <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>
24899 !!end
24900
24901 !! test
24902 Image: from basic HTML (1)
24903 !! options
24904 parsoid=html2wt
24905 !! html/parsoid
24906 <span typeof="mw:Image">
24907 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24908 </span>
24909 !! wikitext
24910 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24911 !! end
24912
24913 !! test
24914 Image: from basic HTML (2)
24915 !! options
24916 parsoid=html2wt
24917 !! html/parsoid
24918 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24919 !! wikitext
24920 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24921 !! end
24922
24923 !! test
24924 Image: from basic HTML (3)
24925 !! options
24926 parsoid=html2wt
24927 !! html/parsoid
24928 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24929 !! wikitext
24930 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24931 !! end
24932
24933 !! test
24934 Image: from basic HTML (4)
24935 !! options
24936 parsoid=html2wt
24937 !! html/parsoid
24938 <img src="./File:Foobar.jpg">
24939 !! wikitext
24940 [[File:Foobar.jpg|link=]]
24941 !! end
24942
24943 !! test
24944 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24945 !! options
24946 parsoid=html2wt
24947 !! html/parsoid
24948 <ul>
24949 <li><p>foo</p></li>
24950 </ul>
24951 !! wikitext
24952 * foo
24953 !! end
24954
24955 !! test
24956 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24957 !! options
24958 parsoid=html2wt
24959 !! html/parsoid
24960 <ul> <li>foo</li></ul>
24961 !! wikitext
24962 * foo
24963 !! end
24964
24965 !! test
24966 Don't strip leading whitespace when handling indent-pre suppressing tags
24967 !! options
24968 parsoid=html2wt
24969 !! html/parsoid
24970 <table>
24971 <tr><td> indented row</td></tr>
24972 </table>
24973 <blockquote><p>
24974 <b>This is very bold of you!</b>
24975 </p>
24976 <table><tr><td>
24977 indented cell (no pre-wrapping!)
24978 </td></tr></table>
24979 </blockquote>
24980 <p>foo</p>
24981 <div>bar</div>
24982 !! wikitext
24983 {|
24984 | indented row
24985 |}
24986 <blockquote>
24987 '''This is very bold of you!'''
24988
24989 {|
24990 |
24991 indented cell (no pre-wrapping!)
24992 |}
24993 </blockquote>
24994 foo
24995 <div>bar</div>
24996 !! end
24997
24998 !! test
24999 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25000 !! options
25001 parsoid=html2wt
25002 !! html/parsoid
25003 <p>foo</p>
25004 <span>bar</span>
25005
25006 <span>foo2
25007 </span>bar2
25008
25009 <div>foo</div>
25010 <span>bar</span>
25011
25012 <div>
25013 <span>foo</span>
25014 </div>
25015 !! wikitext
25016 foo
25017
25018 <span>bar</span>
25019
25020 <span>foo2
25021 <nowiki> </nowiki></span>bar2
25022
25023 <div>foo</div>
25024 <nowiki> </nowiki><span>bar</span>
25025
25026 <div>
25027 <nowiki> </nowiki><span>foo</span>
25028 </div>
25029 !! end
25030
25031 !! test
25032 Lists: Dont insert newlines in a serialized list item.
25033 !! options
25034 parsoid=html2wt
25035 !! html/parsoid
25036 <ul><li>a<br>b</li><li>c</li></ul>
25037 !! wikitext
25038 * a<br>b
25039 * c
25040 !! end
25041
25042 !! test
25043 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25044 !! options
25045 parsoid={
25046 "modes": ["html2wt"],
25047 "scrubWikitext": false
25048 }
25049 !! html/parsoid
25050 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25051 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25052
25053 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25054 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25055
25056 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25057
25058 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25059 !! wikitext
25060 == hello there [[Category:A1]] ==
25061
25062 == [[Category:A2]] hi pal ==
25063
25064 == <!--foo--> [[Category:A3]] how goes it ==
25065
25066 == it goes well [[Category:A4]] <!--bar--> ==
25067
25068 ==howdy [[Category:A5]]==
25069
25070 == __TOC__ ok ==
25071 !! end
25072
25073 !! test
25074 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25075 !! options
25076 parsoid={
25077 "modes": ["html2wt"],
25078 "scrubWikitext": true
25079 }
25080 !! html/parsoid
25081 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25082 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25083
25084 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25085 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25086
25087 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25088 !! wikitext
25089 == hello there ==
25090 [[Category:A1]]
25091 [[Category:A2]]
25092
25093 == hi pal ==
25094
25095 <!--foo--> [[Category:A3]]
25096
25097 == how goes it ==
25098
25099 == it goes well ==
25100 [[Category:A4]] <!--bar-->
25101
25102 __TOC__
25103
25104 == ok ==
25105 !! end
25106
25107 !! test
25108 Headings: Don't hoist metas that come from templates
25109 !! options
25110 parsoid={
25111 "modes": ["html2wt"],
25112 "scrubWikitext": true
25113 }
25114 !! html/parsoid
25115 <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>
25116 !! wikitext
25117 == {{echo|foo [[Category:Foo]]}} ==
25118 !! end
25119
25120 !! test
25121 Headings: Category in ref isn't hoisted
25122 !! options
25123 parsoid={
25124 "modes": ["html2wt"],
25125 "scrubWikitext": true
25126 }
25127 !! html/parsoid
25128 <h2> 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> </h2>
25129
25130 <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>
25131 !! wikitext
25132 == foo <ref>bar
25133 [[Category:Baz]] </ref> ==
25134
25135 <references />
25136 !! end
25137
25138 !! test
25139 Parsoid: Serialize positional parameters with = in them as named parameter
25140 !! options
25141 parsoid=html2wt
25142 !! html/parsoid
25143 <p about="#mwt1" typeof="mw:Transclusion"
25144 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25145
25146 <p about="#mwt1" typeof="mw:Transclusion"
25147 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25148
25149 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25150 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25151 <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>
25152 !! wikitext
25153 {{echo|1 = f=oo}}
25154
25155 {{echo|1 = f=oo|2 = bar}}
25156
25157 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25158 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25159 {{echo|<nowiki>f=oo</nowiki>|bar}}
25160 !! end
25161
25162 !! test
25163 Parsoid: Serialize positional parameters with = in extlink as named parameter
25164 !! options
25165 parsoid=html2wt
25166 !! html/parsoid
25167 <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>
25168 !! wikitext
25169 {{echo|1 = http://stuff?is=ok}}
25170 !! end
25171
25172 !! test
25173 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25174 !! options
25175 parsoid=html2wt
25176 !! html/parsoid
25177 <div>a<p>b</p></div>
25178 <div>a
25179 <p>b</p></div>
25180 <div>
25181 a
25182 <p>b</p></div>
25183 !! wikitext
25184 <div>a
25185 b
25186 </div>
25187 <div>a
25188 b
25189 </div>
25190 <div>
25191 a
25192
25193 b
25194 </div>
25195 !! end
25196
25197 !! test
25198 Substrings resembling wikitext in hrefs should not get nowiki escapes
25199 !! options
25200 parsoid=html2wt
25201 !! html/parsoid
25202 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25203 !! wikitext
25204 [[Foo''bar''baz]]
25205 !! end
25206
25207 !! test
25208 Enforce single-line context in the serializer
25209 !! options
25210 parsoid=html2wt
25211 !! html/parsoid
25212 <h2>testing
25213 123</h2>
25214
25215 <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">
25216 </span><span about="#mwt1">you</span> </h2>
25217
25218 <h2> 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> </h2>
25219
25220 <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
25221 there</span></li></ol>
25222
25223 <ul><li>asd
25224 sdf</li></ul>
25225
25226 <ul><li>foo
25227 bar
25228 baz</li>
25229 <li>foo <b>bar</b>
25230 baz</li></ul>
25231
25232 <dl><dt>hi
25233 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25234 ho</dd></dl>
25235
25236 <dl><dd> <table>
25237 <tbody><tr><td> ha
25238 ha
25239 ha</td></tr>
25240 </tbody></table></dd></dl>
25241 !! wikitext
25242 == testing 123 ==
25243
25244 == hi {{bogus|there
25245 you}} ==
25246
25247 == foo <ref>hello
25248 there</ref> ==
25249
25250 <references />
25251
25252 * asd sdf
25253
25254 * foo bar baz
25255 * foo '''bar''' baz
25256
25257 ; hi ho : hi ho
25258
25259 : {|
25260 | ha
25261 ha
25262 ha
25263 |}
25264 !! end
25265
25266 !! test
25267 Serialize new placeholder space without spans
25268 !! options
25269 parsoid=html2wt
25270 !! html/parsoid
25271 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25272
25273 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25274
25275 <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>
25276 !! wikitext
25277 foo : bar
25278
25279 foo : bar
25280
25281 <ref>foo : bar</ref>ok
25282 !! end
25283
25284
25285 #-----------------------
25286 # Tag minimization tests
25287 #-----------------------
25288
25289 !! test
25290 1. I/B quote minimization: wikitext-only tags should be combined
25291 !! options
25292 parsoid=html2wt
25293 !! html/parsoid
25294 <p><i>A</i><i>B</i></p>
25295 <p><b>A</b><b>B</b></p>
25296 <p><i>A</i><b><i>B</i></b></p>
25297 <p><b>A</b><i><b>B</b></i></p>
25298 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25299 <p><i><b>A</b></i><i><b>B</b></i></p>
25300 <p><i><b>A</b></i><b><i>B</i></b></p>
25301 <p><b><i>A</i></b><i><b>B</b></i></p>
25302 !! wikitext
25303 ''AB''
25304
25305 '''AB'''
25306
25307 ''A'''B'''''
25308
25309 '''A''B'''''
25310
25311 '''A''BC''D'''
25312
25313 '''''AB'''''
25314
25315 '''''AB'''''
25316
25317 '''''AB'''''
25318 !! end
25319
25320 !! test
25321 2. I/B quote minimization: wikitext and html tags should not be combined
25322 !! options
25323 parsoid=html2wt
25324 !! html/parsoid
25325 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25326 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25327 !! wikitext
25328 ''A''<i>B</i>
25329
25330 ''A''<nowiki/>'''<i>B</i>'''
25331 !! end
25332
25333 !! test
25334 3. I/B quote minimization: templated content stops minimization
25335 !! options
25336 parsoid=html2wt
25337 !! html/parsoid
25338 <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>
25339 <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>
25340 !! wikitext
25341 ''A''{{echo|''B''}}
25342
25343 ''A''{{echo|'''''B'''''}}
25344 !! end
25345
25346 !! test
25347 4. I/B quote minimization: new content should be mimimized with adjacent old content
25348 !! options
25349 parsoid=html2wt
25350 !! html/parsoid
25351 <p><i>A</i><i>B</i></p>
25352 <p><b>A</b><b>B</b></p>
25353 <p><i>A</i><b><i>B</i></b></p>
25354 !! wikitext
25355 ''AB''
25356
25357 '''AB'''
25358
25359 ''A'''B'''''
25360 !! end
25361
25362 !! test
25363 5a. Merge adjacent quote nodes if they've been edited
25364 !! options
25365 parsoid={
25366 "modes": ["wt2wt", "selser"],
25367 "changes": [
25368 ["p", "contents", "remove", ":contains('b')"]
25369 ]
25370 }
25371 !! wikitext
25372 ''a''b''c''
25373 !! wikitext/edited
25374 ''ac''
25375 !! end
25376
25377 !! test
25378 5b. Merge adjacent quote nodes if they've been edited
25379 !! options
25380 parsoid={
25381 "modes": ["wt2wt", "selser"],
25382 "changes": [
25383 ["#x", "remove"]
25384 ]
25385 }
25386 !! wikitext
25387 ''a''<span id="x">b</span>''c''
25388 !! wikitext/edited
25389 ''ac''
25390 !! end
25391
25392 !! test
25393 1. Merge adjacent link nodes as long as at least one element is new
25394 !! options
25395 parsoid={
25396 "modes": ["html2wt"],
25397 "scrubWikitext": true
25398 }
25399 !! html/parsoid
25400 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25401 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25402 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25403 !! wikitext
25404 [[Football]]
25405 [[Football]]
25406 [[Football|Foot]][[Football|ball]]
25407 !! end
25408
25409 !! test
25410 2. Merge adjacent link nodes and enable additional normalizations
25411 !! options
25412 parsoid={
25413 "modes": ["html2wt"],
25414 "scrubWikitext": true
25415 }
25416 !! html/parsoid
25417 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25418 !! wikitext
25419 [[Football|''Football'']]
25420 !! end
25421
25422 !! test
25423 3. Don't merge adjacent link nodes if scrubWikitext is false
25424 !! options
25425 parsoid={
25426 "modes": ["html2wt"],
25427 "scrubWikitext": false
25428 }
25429 !! html/parsoid
25430 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25431 !! wikitext
25432 [[Football|Foot]][[Football|ball]]
25433 !! end
25434
25435 #------------------------------
25436 # End of tag minimization tests
25437 #------------------------------
25438
25439 !!test
25440 Bug 54262: New entities
25441 !! options
25442 parsoid=html2wt
25443 !! html/parsoid
25444 <span typeof="mw:Entity">&nbsp;</span>
25445 !! wikitext
25446 &nbsp;
25447 !! end
25448
25449 ## Note that there is no wikitext output for 'unknownproperty' ##
25450 ## Unknown magic words are silently dropped ##
25451
25452 !! test
25453 Magic words
25454 !! options
25455 parsoid=html2wt
25456 !! html/parsoid
25457 <meta property='mw:PageProp/toc' />
25458 <meta property='mw:PageProp/notoc' />
25459 <meta property='mw:PageProp/forcetoc' />
25460 <meta property='mw:PageProp/index' />
25461 <meta property='mw:PageProp/noindex' />
25462 <meta property='mw:PageProp/nogallery' />
25463 <meta property='mw:PageProp/noeditsection' />
25464 <meta property='mw:PageProp/notitleconvert' />
25465 <meta property='mw:PageProp/nocontentconvert' />
25466 <meta property='mw:PageProp/unknownproperty' />
25467 !! wikitext
25468 __TOC__
25469 __NOTOC__
25470 __FORCETOC__
25471 __INDEX__
25472 __NOINDEX__
25473 __NOGALLERY__
25474 __NOEDITSECTION__
25475 __NOTITLECONVERT__
25476 __NOCONTENTCONVERT__
25477 !! end
25478
25479 !! test
25480 Consecutive <pre>s should not get merged
25481 !! options
25482 parsoid=html2wt,html2html
25483 !! html/parsoid
25484 <pre>a</pre><pre>b</pre>
25485
25486 <pre>c
25487 </pre><pre>
25488 d</pre>
25489
25490 <pre>e
25491
25492 </pre><pre>
25493
25494 f</pre>
25495 !! wikitext
25496 a
25497
25498 b
25499
25500 c
25501
25502 d
25503
25504 e
25505
25506
25507
25508 f
25509 !! end
25510
25511 !! test
25512 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25513 !! options
25514 parsoid=html2wt
25515 !! html/parsoid
25516 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25517 !! wikitext
25518 [[Special:BookSources/1234567890|ISBN 1234567895]]
25519 !! end
25520
25521 !! test
25522 Edited RFC links not serializable as RFC links should serialize as extlinks
25523 !! options
25524 parsoid=html2wt
25525 !! html/parsoid
25526 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25527 !! wikitext
25528 [//tools.ietf.org/html/rfc123 New RFC]
25529 !! end
25530
25531 !! test
25532 Edited PMID links not serializable as PMID links should serialize as extlinks
25533 !! options
25534 parsoid=html2wt
25535 !! html/parsoid
25536 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25537 !! wikitext
25538 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25539 !! end
25540
25541 !! test
25542 WTS of autolinks with trailing/surrounding context
25543 !! options
25544 parsoid=html2wt
25545 !! html/parsoid
25546 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25547 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25548 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25549 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25550 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25551 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25552 !! wikitext
25553 http://cscott.net'''foo'''
25554
25555 http://cscott.net<b>foo</b>
25556
25557 '''http://cscott.net'''
25558
25559 '''http://cscott.net '''
25560
25561 '''http://cscott.net<nowiki/>x'''
25562
25563 http://cscott.net<nowiki/>x
25564 !! end
25565
25566 !! test
25567 WTS of autolinks with nowikis (round-trip)
25568 !! wikitext
25569 x<nowiki/>http://cscott.net<nowiki/>x
25570 !! html/parsoid
25571 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25572 !! end
25573
25574 # this is the "easy" test because it leaves in place all the
25575 # data-parsoid information indicating this is an autolink
25576 !! test
25577 WTS of autolinks with escapes (editing)
25578 !! options
25579 parsoid={
25580 "modes": ["wt2wt"],
25581 "changes": [
25582 [ "meta", "remove" ]
25583 ]
25584 }
25585 !! wikitext
25586 x<nowiki/>http://cscott.net<nowiki/>x
25587 !! wikitext/edited
25588 x<nowiki/>http://cscott.net<nowiki/>x
25589 !! end
25590
25591 !! test
25592 WTS of edited autolink-like text (T103364)
25593 !! options
25594 parsoid={
25595 "modes": ["wt2wt"],
25596 "changes": [
25597 [ "span[typeof]", "removeAttr", "typeof" ]
25598 ]
25599 }
25600 !! wikitext
25601 Not a link: <nowiki>http://example.com</nowiki>.
25602 !! wikitext/edited
25603 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25604 !! end
25605
25606 !! test
25607 WTS of newly-authored autolink-like text (T103364)
25608 !! options
25609 parsoid=html2wt
25610 !! html/parsoid
25611 <p>http://example.com is not a link.</p>
25612 !! wikitext
25613 <nowiki>http://example.com</nowiki> is not a link.
25614 !! end
25615
25616 !! test
25617 WTS of autolink-like text after an autolink (T108563)
25618 !! options
25619 parsoid=html2wt
25620 !! html/parsoid
25621 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25622 !! wikitext
25623 http://example.com <nowiki>http://example.com</nowiki> is not a link.
25624 !! end
25625
25626 !! test
25627 Magic links inside links (not autolinked)
25628 !! wikitext
25629 [[Foo|http://example.com]]
25630 [[Foo|RFC 1234]]
25631 [[Foo|PMID 1234]]
25632 [[Foo|ISBN 123456789x]]
25633
25634 [http://foo.com http://example.com]
25635 [http://foo.com RFC 1234]
25636 [http://foo.com PMID 1234]
25637 [http://foo.com ISBN 123456789x]
25638 !! html+tidy
25639 <p><a href="/wiki/Foo" title="Foo">http://example.com</a> <a href="/wiki/Foo" title="Foo">RFC 1234</a> <a href="/wiki/Foo" title="Foo">PMID 1234</a> <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a></p>
25640 <p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a> <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a> <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a> <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
25641 !! html/parsoid
25642 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25643 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25644 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25645 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25646
25647 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25648 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25649 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25650 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25651 !! end
25652
25653 !! test
25654 Magic links inside image captions (autolinked)
25655 !! wikitext
25656 [[File:Foobar.jpg|thumb|http://example.com]]
25657 [[File:Foobar.jpg|thumb|RFC 1234]]
25658 [[File:Foobar.jpg|thumb|PMID 1234]]
25659 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25660 !! html+tidy
25661 <div class="thumb tright">
25662 <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>
25663 <div class="thumbcaption">
25664 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25665 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25666 </div>
25667 </div>
25668 <div class="thumb tright">
25669 <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>
25670 <div class="thumbcaption">
25671 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25672 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25673 </div>
25674 </div>
25675 <div class="thumb tright">
25676 <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>
25677 <div class="thumbcaption">
25678 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25679 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25680 </div>
25681 </div>
25682 <div class="thumb tright">
25683 <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>
25684 <div class="thumbcaption">
25685 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25686 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25687 </div>
25688 </div>
25689 !! html/parsoid
25690 <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>
25691 <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="//tools.ietf.org/html/rfc1234" rel="mw:ExtLink">RFC 1234</a></figcaption></figure>
25692 <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="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></figcaption></figure>
25693 <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/123456789X" rel="mw:WikiLink">ISBN 123456789x</a></figcaption></figure>
25694 !! end
25695
25696 !! test
25697 WTS of magic word text (T109371)
25698 !! options
25699 parsoid=html2wt
25700 !! html/parsoid
25701 <p>RFC 1234</p>
25702 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25703 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25704 !! wikitext
25705 <nowiki>RFC 1234</nowiki>
25706
25707 [http://foo.com RFC 1234]
25708
25709 [[Foo|RFC 1234]]
25710 !! end
25711
25712 !! test
25713 Edited Redirect link should emit a non-piped wikitext link
25714 !! options
25715 parsoid=html2wt
25716 !! html/parsoid
25717 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25718 !! wikitext
25719 #REDIRECT [[Bar]]
25720 !! end
25721
25722 !! test
25723 T75121: Infer extension name from typeOf if data-mw is not present
25724 !! options
25725 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25726 !! html/parsoid
25727 <div typeOf="mw:Extension/foo"></div>
25728 !! wikitext
25729 <foo />
25730 !! end
25731
25732 # Note that the <p> wrapping isn't present in PHP parser output
25733 # The important thing for this test is that P-wrapping doesn't
25734 # interfere with the <nowiki> protection for leading - in <td>
25735 # (which isn't necessary for <th>).
25736 !! test
25737 T88318: p-wrapped dash in table.
25738 !! options
25739 parsoid=html2wt,wt2wt
25740 !! html/parsoid
25741 <table><tbody>
25742 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25743 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25744 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25745 </tbody></table>
25746 !! wikitext
25747 {|
25748 !-
25749 !-
25750 |-
25751 |<nowiki>-</nowiki>
25752 |<nowiki>- </nowiki>
25753 |-
25754 |<small>-</small>
25755 |<br>
25756 -
25757 |<br>
25758 -
25759 |}
25760 !! html/php+tidy
25761 <table>
25762 <tr>
25763 <th>-</th>
25764 <th>-</th>
25765 </tr>
25766 <tr>
25767 <td>-</td>
25768 <td>-</td>
25769 </tr>
25770 <tr>
25771 <td><small>-</small></td>
25772 <td><br />
25773 <p>-</p>
25774 </td>
25775 <td><br />
25776 <p>-</p>
25777 </td>
25778 </tr>
25779 </table>
25780 !! end
25781
25782 !! test
25783 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25784 !! options
25785 parsoid=html2wt
25786 !! html/parsoid
25787 <table id='mwAb'>
25788 <td id='mwAc'>foo</td>
25789 <td id='serialize-this'>bar</td>
25790 </table>
25791 !! wikitext
25792 {|
25793 |foo
25794 | id="serialize-this" |bar
25795 |}
25796 !! end
25797
25798 !! test
25799 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25800 !! options
25801 parsoid=html2wt
25802 !! html/parsoid
25803 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25804 !! wikitext
25805 <div id="hello">ok</div>
25806 !! end
25807
25808 !! test
25809 WTS change modes
25810 !! options
25811 parsoid={
25812 "modes": ["wt2wt"],
25813 "changes": [
25814 [ "#xyz", "before", "<b>before</b> stuff " ],
25815 [ "#xyz", "after", " stuff <i>after</i>" ],
25816 [ "#xyz", "html", "x <b>y</b> z" ]
25817 ]
25818 }
25819 !! wikitext
25820 <span id="xyz">hello</span>
25821 !! wikitext/edited
25822 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25823 !! end
25824
25825 !! test
25826 Never serialize a-tag as html, regardless of what data-parsoid has to say
25827 !! options
25828 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25829 !! html/parsoid
25830 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25831 !! wikitext
25832 [[Foo]]
25833 !! end
25834
25835 ## SSS FIXME: This is broken output nevertheless.
25836 ## What might be a reasonable non-broken output for this?
25837 ## This is an edge case unlikely to be seen in production
25838 ## that I am not wasting more time on this right now.
25839 !! test
25840 Never serialize a-tag as html, no matter what attributes it has
25841 !! options
25842 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25843 !! html/parsoid
25844 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25845 !! wikitext
25846 [http://boo.org http://boohoo.org]
25847 !! end
25848
25849 # Misnested is an indication that selser can reuse the source but these have
25850 # shown to sneak through on occasion. See T101768.
25851 # The original wikitext here is: [http://test.com [[one]] two three]
25852 !! test
25853 Strip span tags added to mark misnested links
25854 !! options
25855 parsoid=html2wt
25856 !! html/parsoid
25857 <p data-parsoid='{}'><a rel="mw:ExtLink" href="http://test.com" data-parsoid='{"targetOff":17,"contentOffsets":[17,34]}'></a><a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"simple","a":{"href":"./One"},"sa":{"href":"one"},"misnested":true}'>one</a><span data-parsoid='{"misnested":true}'> two three</span></p>
25858 !! wikitext
25859 [http://test.com][[one]] two three
25860 !! end
25861
25862 !! test
25863 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
25864 !! options
25865 parsoid=html2wt
25866 !! html/parsoid
25867 <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"}},"i":0}}]}'>a</span><table about="#mwt2" typeof="mw:Transclusion mw:ExpandedAttrs" data-parsoid='{"a":{"{{echo|c\n{{!}}d\n}}":null},"sa":{"{{echo|c\n{{!}}d\n}}":""},"firstWikitextNode":"table","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c\n{{!}}d\n"}},"i":0}},"\n|}"]}'>
25868 <tbody><tr><td>d
25869 </td></tr>
25870 </tbody></table>
25871 !! wikitext
25872 {{echo|a}}
25873 {|{{echo|c
25874 {{!}}d
25875 }}
25876 |}
25877 !! end
25878
25879 ## This test verifies the presence and computation of this attribute indirectly
25880 ## by making an edit and ensuring that the serialization is correct (which it would be
25881 ## only if firstWikitextNode is properly set).
25882 !! test
25883 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
25884 !! options
25885 parsoid= {
25886 "modes": ["wt2wt"],
25887 "changes": [
25888 [ "div#x", "remove" ],
25889 [ "div", "before", "<div>new</div>" ]
25890 ]
25891 }
25892 !! wikitext
25893 <div id="x">foo</div>
25894 {|
25895 {{echo|<div>boo</div>
25896 {{!}}b}}
25897 |c
25898 |}
25899 !! wikitext/edited
25900
25901 <div>new</div>
25902 {|
25903 {{echo|<div>boo</div>
25904 {{!}}b}}
25905 |c
25906 |}
25907 !! end
25908
25909 # --------------------------------------------
25910 # Tests spec'ing wikitext serialization norms |
25911 # --------------------------------------------
25912
25913 !! test
25914 1. Categories should always be serialized on their own line
25915 !! options
25916 parsoid=html2wt
25917 !! html/parsoid
25918 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
25919 !! wikitext
25920 foo
25921 [[Category:Foo]]
25922 bar
25923 !! end
25924
25925 !! test
25926 2. Categories that are part of templates should not introduce a line break
25927 !! wikitext
25928 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
25929 !! html/parsoid
25930 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;span>bar&lt;/span> [[Category:baz]]"}},"i":0}}]}'>bar</span><span about="#mwt1"> </span><link rel="mw:PageProp/Category" href="./Category:Baz" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:baz"}}'/> bar</p>
25931 !! end
25932
25933 # Careful while editing these next 2 tests. There are \u200f characters
25934 # before and after the <link> tags in the HTML and following some
25935 # of the categories in wikitext
25936 # Do not remove these characters in edits.
25937 #
25938 # As part of the serialization, these bidi characters will get stripped.
25939 !! test
25940 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
25941 !! options
25942 parsoid={
25943 "modes": ["html2wt"],
25944 "scrubWikitext": true
25945 }
25946 !! html/parsoid
25947 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
25948 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
25949 !! wikitext
25950 [[קטגוריה:טקסים]]
25951 [[קטגוריה: שיטות משפט]]
25952 !! end
25953
25954 !! test
25955 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
25956 !! options
25957 parsoid={
25958 "modes": ["html2wt"],
25959 "scrubWikitext": true
25960 }
25961 !! html/parsoid
25962 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
25963 !! wikitext
25964 [[קטגוריה:טקסים]]
25965 ‏y
25966 !! end
25967
25968 !! test
25969 Lists: Add space after bullets
25970 !! options
25971 parsoid=html2wt
25972 !! html/parsoid
25973 <ul>
25974 <li>foo</li>
25975 <li> bar</li>
25976 <li><span> baz</span></li>
25977 </ul>
25978 !! wikitext
25979 * foo
25980 * bar
25981 * <span> baz</span>
25982 !! end
25983
25984 !! test
25985 1. Headings: Add space before/after == (T53744)
25986 !! options
25987 parsoid=html2wt
25988 !! html/parsoid
25989 <h2>foo</h2>
25990 <h2> bar</h2>
25991 <h2>baz </h2>
25992 <h2><span> baz</span></h2>
25993 !! wikitext
25994 == foo ==
25995
25996 == bar ==
25997
25998 == baz ==
25999
26000 == <span> baz</span> ==
26001 !! end
26002
26003 !! test
26004 2. Headings: Add space before/after == even after hoisted content
26005 !! options
26006 parsoid={
26007 "modes": ["html2wt"],
26008 "scrubWikitext": true
26009 }
26010 !! html/parsoid
26011 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26012 !! wikitext
26013 [[Category:A2]]
26014
26015 == ok ==
26016 !! end
26017
26018 !! test
26019 1. Headings: suppress newly created empty headings
26020 !! options
26021 parsoid={
26022 "modes": ["html2wt"],
26023 "scrubWikitext": true
26024 }
26025 !! html/parsoid
26026 <h2></h2>
26027 !! wikitext
26028 !! end
26029
26030 !! test
26031 2. Headings: don't suppress empty headings if scrubWikitext is false
26032 !! options
26033 parsoid=html2wt
26034 !! html/parsoid
26035 <h2></h2>
26036 !! wikitext
26037 ==<nowiki/>==
26038 !! end
26039
26040 !! test
26041 3. Headings: suppress empty headings on edits
26042 !! options
26043 parsoid={
26044 "modes": ["selser"],
26045 "scrubWikitext": true,
26046 "changes": [
26047 [ "#x", "remove"]
26048 ]
26049 }
26050 !! wikitext
26051 ==<span id="x">foo</span>==
26052 !! wikitext/edited
26053 !! end
26054
26055 !! test
26056 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26057 !! options
26058 parsoid={
26059 "modes": ["html2wt"],
26060 "scrubWikitext": true
26061 }
26062 !! html/parsoid
26063 <h2>foo<br/>bar</h2>
26064 <h2>foo <span><br/>bar</span> baz</h2>
26065 !! wikitext
26066 == foo bar ==
26067
26068 == foo <span> bar</span> baz ==
26069 !! end
26070
26071 !! test
26072 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26073 !! options
26074 parsoid={
26075 "modes": ["html2wt"],
26076 "scrubWikitext": false
26077 }
26078 !! html/parsoid
26079 <h2>foo<br/>bar</h2>
26080 !! wikitext
26081 == foo<br> bar ==
26082 !! end
26083
26084 !! test
26085 1. WT Quote Tags: suppress newly created empty style tags
26086 !! options
26087 parsoid={
26088 "modes": ["html2wt"],
26089 "scrubWikitext": true
26090 }
26091 !! html/parsoid
26092 <i></i><b></b>
26093 !! wikitext
26094 !! end
26095
26096 !! test
26097 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26098 !! options
26099 parsoid=html2wt
26100 !! html/parsoid
26101 <i></i><b></b>
26102 !! wikitext
26103 ''<nowiki/>'''''<nowiki/>'''
26104 !! end
26105
26106 !! test
26107 3. WT Quote Tags: suppress empty style tags on edits
26108 !! options
26109 parsoid={
26110 "modes": ["selser"],
26111 "scrubWikitext": true,
26112 "changes": [
26113 [ "#x", "remove"]
26114 ]
26115 }
26116 !! wikitext
26117 '''<span id="x">foo</span>'''
26118 !! wikitext/edited
26119 !! end
26120
26121 !! test
26122 1. Anchors: suppress newly created empty anchors
26123 !! options
26124 parsoid={
26125 "modes": ["html2wt"],
26126 "scrubWikitext": true
26127 }
26128 !! html/parsoid
26129 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26130 !! wikitext
26131 !! end
26132
26133 !! test
26134 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26135 !! options
26136 parsoid={
26137 "modes": ["html2wt"],
26138 "scrubWikitext": false
26139 }
26140 !! html/parsoid
26141 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26142 !! wikitext
26143 [[Test|<nowiki/>]]
26144 !! end
26145
26146 !! test
26147 3. Anchors: suppress empty anchors on edits
26148 !! options
26149 parsoid={
26150 "modes": ["selser"],
26151 "scrubWikitext": true,
26152 "changes": [
26153 [ "#x", "remove"]
26154 ]
26155 }
26156 !! wikitext
26157 [[Test|<span id="x">foo</span>]]
26158 !! wikitext/edited
26159 !! end
26160
26161 !! test
26162 3a. Anchors: do not suppress numbered extlinks
26163 !! options
26164 parsoid={
26165 "modes": ["wt2wt"],
26166 "scrubWikitext": true
26167 }
26168 !! wikitext
26169 [http://foo.com]
26170 !! html/parsoid
26171 <a rel="mw:ExtLink" href="http://foo.com"></a>
26172 !! end
26173
26174 !! test
26175 3b. Anchors: do not suppress numbered extlinks
26176 !! options
26177 parsoid={
26178 "modes": ["wt2wt"],
26179 "scrubWikitext": true,
26180 "changes": [
26181 [ "#x", "remove"]
26182 ]
26183 }
26184 !! wikitext
26185 [http://foo.com <span id="x">foo</span>]
26186 !! wikitext/edited
26187 [http://foo.com]
26188 !! end
26189
26190 !!test
26191 Normalizations should be restricted to edited content
26192 !!options
26193 parsoid={
26194 "modes": ["selser"],
26195 "scrubWikitext": true,
26196 "changes": [
26197 [ "h1", "before", "<i></i>"]
26198 ]
26199 }
26200 !!wikitext
26201 a
26202 = =
26203 b
26204 !!wikitext/edited
26205 a
26206 = =
26207 b
26208 !!end
26209
26210 !! test
26211 1. Multiple normalizations (html2wt)
26212 !! options
26213 parsoid={
26214 "modes": ["html2wt"],
26215 "scrubWikitext": true
26216 }
26217 !! html
26218 <h2><i></i></h2>
26219 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26220 </a><b><i></i></b>x</p>
26221 !! wikitext
26222
26223 [[foo]]
26224 x
26225
26226 !! end
26227
26228 !! test
26229 2. Multiple normalizations (selser)
26230 !! options
26231 parsoid={
26232 "modes": ["selser"],
26233 "scrubWikitext": true,
26234 "changes": [
26235 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26236 ]
26237 }
26238 !! wikitext
26239 <span id="x">foo</span>
26240 !! wikitext/edited
26241 <span id="x">foo</span>
26242
26243 x
26244 !! end
26245
26246 !! test
26247 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26248 !! options
26249 parsoid={
26250 "modes": ["html2wt"],
26251 "scrubWikitext": true
26252 }
26253 !! html/parsoid
26254 <p> hi</p>
26255 <p> hello</p>
26256 !! wikitext
26257 hi
26258
26259 hello
26260 !! end
26261
26262 !! test
26263 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26264 !! options
26265 parsoid=html2wt
26266 !! html/parsoid
26267 <p> hi</p>
26268 <p> hello</p>
26269 !! wikitext
26270 <nowiki> </nowiki>hi
26271
26272 <nowiki> </nowiki> hello
26273 !! end
26274
26275 !! test
26276 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26277 !! options
26278 parsoid={
26279 "modes": ["html2wt"],
26280 "scrubWikitext": true
26281 }
26282 !! html/parsoid
26283 <p>Foo
26284 bar
26285 baz</p>
26286
26287 <table><tr><td>Foo
26288 bar
26289 baz bang</td></tr></table>
26290
26291 <p><!--boo--> foo
26292 bar</p>
26293
26294 <p> foo
26295 bar<span>boo</span></p>
26296 !! wikitext
26297 Foo
26298 bar
26299 baz
26300
26301 {|
26302 |Foo
26303 bar
26304 baz bang
26305 |}
26306
26307 <!--boo-->foo
26308 bar
26309
26310 foo
26311 bar<span>boo</span>
26312 !! end
26313
26314 !! test
26315 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26316 !! options
26317 parsoid={
26318 "modes": ["selser"],
26319 "scrubWikitext": true,
26320 "changes": [
26321 [ "p", "html", " a\n b" ]
26322 ]
26323 }
26324 !! wikitext
26325 xyz
26326 !! wikitext/edited
26327 a
26328 b
26329 !! end
26330
26331 !! test
26332 1. New links that end in spaces
26333 !! options
26334 parsoid={
26335 "modes": ["html2wt"],
26336 "scrubWikitext": false
26337 }
26338 !! html/parsoid
26339 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26340 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26341 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26342 !! wikitext
26343 [[Berlin ]]<nowiki/>is the capital of Germany.
26344
26345 [[Foo ]]'''bar'''
26346
26347 [[Boston ]] is a city.
26348 !! end
26349
26350 !! test
26351 2. New links that end in spaces
26352 !! options
26353 parsoid={
26354 "modes": ["html2wt"],
26355 "scrubWikitext": true
26356 }
26357 !! html/parsoid
26358 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26359 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26360 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26361 !! wikitext
26362 [[Berlin]] is the capital of Germany.
26363
26364 [[Foo]] '''bar'''
26365
26366 [[Boston]] is a city.
26367 !! end
26368
26369 !! test
26370 1. Table cells with escapable prefixes
26371 !! options
26372 parsoid={
26373 "modes": ["html2wt"],
26374 "scrubWikitext": false
26375 }
26376 !! html
26377 <table>
26378 <tr><td>a</td></tr>
26379 <tr><td>-</td></tr>
26380 <tr><td>+</td></tr>
26381 </table>
26382 !! wikitext
26383 {|
26384 |a
26385 |-
26386 |<nowiki>-</nowiki>
26387 |-
26388 |<nowiki>+</nowiki>
26389 |}
26390 !! end
26391
26392 !! test
26393 2. Table cells with escapable prefixes
26394 !! options
26395 parsoid={
26396 "modes": ["html2wt"],
26397 "scrubWikitext": true
26398 }
26399 !! html
26400 <table>
26401 <tr><td>a</td></tr>
26402 <tr><td>-</td></tr>
26403 <tr><td>+</td></tr>
26404 </table>
26405 !! wikitext
26406 {|
26407 |a
26408 |-
26409 | -
26410 |-
26411 | +
26412 |}
26413 !! end
26414
26415 !! test
26416 3a. Table cells with escapable prefixes after edits
26417 !! options
26418 parsoid={
26419 "modes": ["selser"],
26420 "scrubWikitext": true,
26421 "changes": [
26422 [ "table tbody tr:first-child td:first-child", "remove"]
26423 ]
26424 }
26425 !! wikitext
26426 {|
26427 |a||-
26428 |}
26429 !! wikitext/edited
26430 {|
26431 | -
26432 |}
26433 !! end
26434
26435 !! test
26436 3b. Table cells with escapable prefixes after edits
26437 !! options
26438 parsoid={
26439 "modes": ["selser"],
26440 "scrubWikitext": true,
26441 "changes": [
26442 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26443 [ "#x", "remove" ]
26444 ]
26445 }
26446 !! wikitext
26447 {|
26448 |pqr
26449 |<span id="x">foo</span>+
26450 |}
26451 !! wikitext/edited
26452 {|
26453 | -
26454 | +
26455 |}
26456 !! end
26457
26458 # FIXME: This test will fail because
26459 # normalization doesn't realize that the id attribute
26460 # will eliminate the escapable scenario
26461 !! test
26462 4a. Table cells without escapable prefixes after edits
26463 !! options
26464 parsoid={
26465 "modes": ["selser"],
26466 "scrubWikitext": true,
26467 "changes": [
26468 [ "#x", "html", "-" ]
26469 ]
26470 }
26471 !! wikitext
26472 {|
26473 | id="x" |abcd
26474 |}
26475 !! wikitext/edited
26476 {|
26477 | id="x" |-
26478 |}
26479 !! end
26480
26481 ## This tests normalizer's ability to discriminate between
26482 ## cells having identical content.
26483 !! test
26484 4b. Table cells without escapable prefixes after edits
26485 !! options
26486 parsoid={
26487 "modes": ["selser"],
26488 "scrubWikitext": true,
26489 "changes": [
26490 [ "td", "html", "-" ]
26491 ]
26492 }
26493 !! wikitext
26494 {|
26495 |a||b
26496 |}
26497 !! wikitext/edited
26498 {|
26499 | -||-
26500 |}
26501 !! end
26502
26503 ## This tests normalizer's ability to not be tripped by
26504 ## comments (and whitespace)
26505 !! test
26506 4c. Table cells without escapable prefixes after edits
26507 !! options
26508 parsoid={
26509 "modes": ["selser"],
26510 "scrubWikitext": true,
26511 "changes": [
26512 [ "table tbody tr td:first-child", "remove" ]
26513 ]
26514 }
26515 !! wikitext
26516 {|
26517 |-
26518 <!--foo--> |a||-
26519 |}
26520 !! wikitext/edited
26521 {|
26522 |-
26523 <!--foo--> | -
26524 |}
26525 !! end
26526
26527 ## This tests normalizer's ability to handle HTML cells
26528 !! test
26529 4d. Table cells without escapable prefixes after edits
26530 !! options
26531 parsoid={
26532 "modes": ["selser"],
26533 "scrubWikitext": true,
26534 "changes": [
26535 [ "td", "html", "-" ]
26536 ]
26537 }
26538 !! wikitext
26539 <table>
26540 <tr><td>a</td></tr>
26541 </table>
26542 !! wikitext/edited
26543 <table>
26544 <tr><td>-</td></tr>
26545 </table>
26546 !! end
26547
26548 ## T111151 Remove font elements without attributes
26549 !! test
26550 5a. font tags without attributes should be dropped in scrubWikitext mode
26551 !! options
26552 parsoid={
26553 "modes": ["html2wt"],
26554 "scrubWikitext": true
26555 }
26556 !! html
26557 <font>foo</font>
26558 <font><font>bar</font></font>
26559 <font class="x">boo</font>
26560 !! wikitext
26561 foo
26562 bar
26563 <font class="x">boo</font>
26564 !! end
26565
26566 !! test
26567 5b. font tags should not be dropped without scrubWikitext being enabled
26568 !! options
26569 parsoid={
26570 "modes": ["html2wt"],
26571 "scrubWikitext": false
26572 }
26573 !! html
26574 <font>foo</font>
26575 !! wikitext
26576 <font>foo</font>
26577 !! end
26578
26579 !! test
26580 Escape nowiki DOM elements
26581 !! options
26582 parsoid=html2wt
26583 !! html/parsoid
26584 <nowiki><i>foo</i></nowiki>
26585 !! wikitext
26586 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26587 !! end
26588
26589 # This is meant to be an interim fix while we go about figuring out
26590 # how to not introduce these trailing <nowiki/>s in the first place.
26591 !! test
26592 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
26593 !! options
26594 parsoid=html2wt
26595 !! html/parsoid
26596 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
26597 y</p>
26598 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,23,null,null],"pi":[[{"k":"1","named":true,"spc":["\n"," "," ",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
26599 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,24,null,null],"pi":[[{"k":"1","named":true,"spc":["\n"," "," ","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
26600 !! wikitext
26601 x
26602 y
26603
26604 {{echo|
26605 1 = <nowiki/>}}
26606
26607 {{echo|
26608 1 = <nowiki/>
26609 }}
26610 !! end
26611
26612 # ---------------------------------------------------
26613 # End of tests spec'ing wikitext serialization norms |
26614 # ---------------------------------------------------
26615
26616 # T104032
26617 !! test
26618 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
26619 !! options
26620 parsoid=html2wt
26621 !! html/parsoid
26622 a<p>b</p>
26623 <b>c</b><p>d</p>
26624 <table><tr>
26625 <td>a<p>b</p></td>
26626 <td><b>c</b><p>d</p></td>
26627 </tr></table>
26628 !! wikitext
26629 a
26630
26631 b
26632
26633 '''c'''
26634
26635 d
26636 {|
26637 |a
26638 b
26639 |'''c'''
26640 d
26641 |}
26642 !! end
26643
26644 # -----------------------------------------------------------------
26645 # End of section for Parsoid-only html2wt tests for serialization
26646 # of new content
26647 # -----------------------------------------------------------------
26648
26649 # -----------------------------------------------------------------
26650 # The following section of tests are primarily to spec behavior of
26651 # the selective serializer. All these tests have manual selser
26652 # changes. The automated selser changes for all tests handle the
26653 # wide variation of changes, but these tests here capture specs
26654 # deterministically.
26655 # ----------------------------------------------------------------
26656
26657 ## T90517
26658 !! test
26659 Selser: New comments should not be lost
26660 !! options
26661 parsoid={
26662 "modes": ["selser"],
26663 "changes": [
26664 [ "#a", "after", "<!--c1-->" ],
26665 [ "#b", "before", "<!--c2-->" ]
26666 ]
26667 }
26668 !! wikitext
26669 <span id="a">a</span>
26670
26671 <span id="b">b</span>
26672 !! wikitext/edited
26673 <span id="a">a</span><!--c1-->
26674
26675 <!--c2--><span id="b">b</span>
26676 !! end
26677
26678 ## T89383
26679 !! test
26680 Selser: Check for validity of DSR before using it
26681 !! options
26682 parsoid={
26683 "modes": ["selser"],
26684 "changes": [
26685 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26686 ]
26687 }
26688 !! wikitext
26689 <span id="a">a</span>
26690 !! wikitext/edited
26691 {{DISPLAYTITLE:foo}}
26692 <span id="a">a</span>
26693 !! end
26694
26695 !! test
26696 1. DOMDiff: Changes to <ref> content should be looked up using id
26697 !! options
26698 parsoid={
26699 "modes": ["selser"],
26700 "changes": [
26701 ["#X", "after", "bar"],
26702 ["#Y", "after", "baz"]
26703 ]
26704 }
26705 !! wikitext
26706 X <ref><span id="X">foo</span></ref>
26707 Y <ref name="a" />
26708 <references>
26709 <ref name="a"><span id="Y">foo</span></ref>
26710 </references>
26711 !! wikitext/edited
26712 X <ref><span id="X">foo</span>bar</ref>
26713 Y <ref name="a" />
26714 <references>
26715 <ref name="a"><span id="Y">foo</span>baz</ref>
26716 </references>
26717 !! end
26718
26719 !! test
26720 2. DOMDiff: Changes to <ref> content should be looked up using id
26721 !! options
26722 parsoid={
26723 "modes": ["selser"],
26724 "changes": [
26725 ["#Z", "after", "bar"]
26726 ]
26727 }
26728 !! wikitext
26729 A <ref>foo bar for a</ref>
26730 B <ref group="X" name="b" />
26731
26732 <references />
26733
26734 <references group="X">
26735 <ref name="b"><span id="Z">foo</span></ref>
26736 </references>
26737 !! wikitext/edited
26738 A <ref>foo bar for a</ref>
26739 B <ref group="X" name="b" />
26740
26741 <references />
26742
26743 <references group="X">
26744 <ref name="b"><span id="Z">foo</span>bar</ref>
26745 </references>
26746 !! end
26747
26748 !! test
26749 Empty LI (T49673)
26750 !! wikitext
26751 * a
26752 *
26753 *
26754 * b
26755 !! html/php+tidy
26756 <ul>
26757 <li>a</li>
26758 <li class="mw-empty-li"></li>
26759 <li class="mw-empty-li"></li>
26760 <li>b</li>
26761 </ul>
26762 !! end