Set context on RedirectSpecialPage in MediaWiki.php
[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 !! test
2524 Handle broken pre-like tags (bug 64025)
2525 !! options
2526 parsoid=wt2html
2527 !! wikitext
2528 {{echo|<pre <pre>x</pre>}}
2529
2530 <table><pre </table>
2531 !! html/php
2532 <pre>x</pre>
2533 <table>&lt;pre </table>
2534
2535 !! html/php+tidy
2536 <pre>
2537 x
2538 </pre>
2539 <p>&lt;pre</p>
2540 !! html/parsoid
2541 <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>
2542
2543
2544 <p>&lt;pre </p>
2545
2546 <table></table>
2547 !! end
2548
2549 !! test
2550 Parsoid: handle pre with space after attribute
2551 !! options
2552 parsoid=wt2html
2553 !! wikitext
2554 <pre style="width:50%;" >{{echo|foo}}</pre>
2555 !! html/php
2556 <pre style="width:50%;">{{echo|foo}}</pre>
2557
2558 !! html/parsoid
2559 <pre style="width:50%;">{{echo|foo}}</pre>
2560 !! end
2561
2562 # TODO / maybe: fix wt2wt for this
2563 !! test
2564 Parsoid: Don't paragraph-wrap fosterable content
2565 !! options
2566 parsoid=wt2html
2567 !! wikitext
2568 {|
2569 <td></td>
2570 <td></td>
2571
2572
2573
2574 |}
2575 !! html
2576 <table>
2577
2578 <tbody>
2579 <tr>
2580 <td></td>
2581
2582 <td></td></tr>
2583
2584
2585
2586 </tbody></table>
2587 !! end
2588
2589 !! test
2590 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2591 !! options
2592 parsoid=wt2html
2593 !! wikitext
2594 {|
2595 <td>
2596 <td>
2597 </td>
2598
2599
2600
2601 |}
2602 !! html
2603 <table>
2604
2605 <tbody>
2606 <tr>
2607 <td></td>
2608
2609 <td>
2610 </td></tr>
2611
2612
2613
2614 </tbody></table>
2615 !! end
2616
2617
2618 #--------------------------------------------------------------------
2619 # Transclusion parameter whitespace stripping tests
2620 # Behavior is different for positional and named parameters
2621 #--------------------------------------------------------------------
2622 !! test
2623 Templates: Strip leading and trailing whitespace from named-param values
2624 !! wikitext
2625 {{echo|1= a }}
2626
2627 {{echo|1= {{echo|b}} }}
2628
2629 {{echo| 1 =
2630 c }}
2631
2632 {{echo| 1 =
2633 * d
2634 }}
2635 !! html
2636 <p>a
2637 </p><p>b
2638 </p><p>c
2639 </p>
2640 <ul><li> d</li></ul>
2641
2642 !! end
2643
2644 !! test
2645 Templates: Don't strip whitespace from positional-param values
2646 !! wikitext
2647 {{echo|a }}
2648
2649 {{echo|{{echo|b}} }}
2650
2651 {{echo| c
2652 }}
2653
2654 {{echo| {{echo|d}}
2655 }}
2656
2657 {{echo|
2658 e}}
2659
2660 {{echo|
2661 * f}}
2662
2663 {{echo|
2664 }}g
2665 !! html
2666 <p>a
2667 </p><p>b
2668 </p>
2669 <pre>c
2670 </pre>
2671 <p><br />
2672 </p>
2673 <pre>d
2674 </pre>
2675 <p><br />
2676 </p>
2677 <pre>e
2678 </pre>
2679 <p><br />
2680 </p>
2681 <ul><li> f</li></ul>
2682 <p><br />
2683 </p>
2684 <pre>g
2685 </pre>
2686 !! end
2687
2688 !! test
2689 Templates: Handle empty comment-and-ws-only lines correctly
2690 !! wikitext
2691 {{echo|foo
2692 <!--should be ignored-->
2693 <!--should be ignored as well-->
2694 bar}}
2695 !! html
2696 <p>foo
2697 bar
2698 </p>
2699 !! end
2700
2701 !! test
2702 Templates: Handle comments in the target
2703 !! wikitext
2704 {{echo
2705 <!-- should be ignored -->
2706 |foo}}
2707
2708 {{echo<!-- should be ignored -->
2709 |foo}}
2710
2711 {{echo<!-- should be ignored -->|foo}}
2712
2713 {{<!-- should be ignored -->echo|foo}}
2714 !!html/parsoid
2715 <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>
2716
2717 <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>
2718
2719 <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>
2720
2721 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2722 !!end
2723
2724 !! test
2725 Templates: Handle comments in parameter names (bug 67657)
2726 !! wikitext
2727 {{echo|1
2728 <!-- should be ignored -->
2729 =foo}}
2730
2731 {{echo|
2732 <!-- should be ignored -->
2733 1 = foo}}
2734
2735 {{echo|1<!-- should be ignored --> = foo}}
2736
2737 {{echo|<!-- should be ignored -->1 = foo}}
2738 !!html/parsoid
2739 <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>
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 -->\n1"}}},"i":0}}]}'>foo</p>
2742
2743 <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>
2744
2745 <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>
2746 !!end
2747
2748 !! test
2749 Templates: Other wikitext in parameter names (bug 67657)
2750 !! wikitext
2751 {{echo|''1''=foo}}
2752 !!html/parsoid
2753 <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>
2754 !!html/php
2755 <p>{{{1}}}
2756 </p>
2757 !!end
2758
2759 #--------------------------------------------------------------------
2760 # Transclusion parameter escaping tests
2761 #--------------------------------------------------------------------
2762 !! test
2763 Templates: Parsoid parameter escaping test 1
2764 !! wikitext
2765 {{echo|[foo]|{{echo|[bar]}}}}
2766 !! html/php+tidy
2767 <p>[foo]</p>
2768 !! html/parsoid
2769 <p about="#mwt1" typeof="mw:Transclusion"
2770 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2771 !! end
2772
2773 !! test
2774 Parsoid: Pipes in external links in template parameter
2775 !! wikitext
2776 {{echo|[{{echo|http://example.com}} link]}}
2777 !! html/php+tidy
2778 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2779 !! html/parsoid
2780 <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>
2781 !! end
2782
2783 !! test
2784 Parsoid: pipe in transclusion parameter
2785 !! wikitext
2786 {{echo|http://foo.com/a&#124;b}}
2787 !! html/php+tidy
2788 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2789 !! html/parsoid
2790 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2791 typeof="mw:Transclusion"
2792 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>
2793 !! end
2794
2795 !! test
2796 Parsoid: Pipe in external link target and content in template parameter
2797 !! options
2798 parsoid=html2wt,wt2wt
2799 !! wikitext
2800 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2801 !! html/php+tidy
2802 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2803 !! html/parsoid
2804 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2805 typeof="mw:Transclusion"
2806 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2807 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2808 !! end
2809
2810 !! test
2811 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2812 !! options
2813 parsoid
2814 !! wikitext
2815 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2816 !! html
2817 <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>
2818 !! end
2819
2820 !! test
2821 Templates: Don't escape already nowiki-escaped text in template parameters
2822 !! options
2823 parsoid=html2wt,wt2wt
2824 !! wikitext
2825 {{echo|foo<nowiki>|</nowiki>bar}}
2826 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2827 {{echo|<nowiki></nowiki>}}
2828 !! html/php+tidy
2829 <p>foo|bar &lt;div&gt;</p>
2830 !! html/parsoid
2831 <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>
2832 <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>
2833 <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>
2834 </p>
2835 !! end
2836
2837 ## Bug 52824
2838 !! test
2839 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2840 !! options
2841 parsoid=html2wt,wt2wt
2842 !! wikitext
2843 {{echo|{{echo|1=bar}}}}
2844 !! html/php+tidy
2845 <p>bar</p>
2846 !! html/parsoid
2847 <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>
2848 !! end
2849
2850 ## Bug 56733
2851 !! test
2852 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2853 !! wikitext
2854 {{echo|a : b}}
2855 !! html/php+tidy
2856 <p>a&#160;: b</p>
2857 !! html/parsoid
2858 <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>
2859 !! end
2860
2861 ## Bug T73412
2862 !! test
2863 Templates: Preserve blank parameter names
2864 !! wikitext
2865 {{echo|=foo}}
2866 !! html/php+tidy
2867 <p>{{{1}}}</p>
2868 !! html/parsoid
2869 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2870 !! end
2871
2872 !! test
2873 Templates: Preserve blank parameter names in other positions
2874 !! wikitext
2875 {{blank_param|bar|=foo}}
2876 !! html/php+tidy
2877 <p>bar foo</p>
2878 !! html/parsoid
2879 <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
2880 foo</p>
2881 !! end
2882
2883 ###
2884 ### Parsoid-centric tests for testing RT edge cases for pre
2885 ###
2886
2887 !!test
2888 1a. Indent-Pre and Comments
2889 !! wikitext
2890 a
2891 <!--a-->
2892 c
2893 !! html
2894 <pre>a
2895 </pre>
2896 <p>c
2897 </p>
2898 !!end
2899
2900 !!test
2901 1b. Indent-Pre and Comments
2902 !! wikitext
2903 a
2904 <!--a-->
2905 c
2906 !! html
2907 <pre>a
2908 </pre>
2909 <p>c
2910 </p>
2911 !!end
2912
2913 !!test
2914 1c. Indent-Pre and Comments
2915 !! wikitext
2916 <!--a--> a
2917
2918 <!--a--> a
2919 !! html
2920 <pre> a
2921 </pre>
2922 <pre> a
2923 </pre>
2924 !!end
2925
2926 !!test
2927 1d. Indent-Pre and Comments
2928 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2929 !! wikitext
2930 <!--a--> a
2931
2932 <!--b-->b
2933 !! html
2934 <pre>a
2935 </pre>
2936 <pre>b
2937 </pre>
2938 !!end
2939
2940 !!test
2941 2a. Indent-Pre and tables
2942 !! wikitext
2943 {|
2944 |-
2945 !h1!!h2
2946 |foo||bar
2947 |}
2948 !! html
2949 <table>
2950
2951 <tr>
2952 <th>h1</th>
2953 <th>h2
2954 </th>
2955 <td>foo</td>
2956 <td>bar
2957 </td></tr></table>
2958
2959 !!end
2960
2961 !!test
2962 2b. Indent-Pre and tables
2963 !! wikitext
2964 {|
2965 |-
2966 |foo
2967 |}
2968 !! html
2969 <table>
2970
2971 <tr>
2972 <td>foo
2973 </td></tr></table>
2974
2975 !!end
2976
2977 !!test
2978 2c. Indent-Pre and tables (bug 42252)
2979 !! wikitext
2980 {|
2981 |+ foo
2982 ! | bar
2983 |}
2984 !! html
2985 <table>
2986 <caption> foo
2987 </caption>
2988 <tr>
2989 <th> bar
2990 </th></tr></table>
2991
2992 !!end
2993
2994 !!test
2995 2d. Indent-Pre and tables
2996 !! wikitext
2997 a
2998 {|
2999 | b
3000 |}
3001 !! html/php
3002 <pre>a
3003 </pre>
3004 <table>
3005 <tr>
3006 <td> b
3007 </td></tr></table>
3008
3009 !! html/parsoid
3010 <pre>a</pre>
3011 <table>
3012 <tbody><tr><td> b</td></tr>
3013 </tbody></table>
3014 !!end
3015
3016 !!test
3017 2e. Indent-Pre and table-line syntax
3018 !! wikitext
3019 a
3020 | b
3021 | c
3022 !! html/php
3023 <pre>a
3024 | b
3025 | c
3026 </pre>
3027 !!end
3028
3029 !!test
3030 2f. Indent-pre started by table-line syntax
3031 !! wikitext
3032 a
3033 | b
3034 | c
3035 !! html/php
3036 <p>a
3037 </p>
3038 <pre>| b
3039 | c
3040 </pre>
3041 !! html/parsoid
3042 <p>a</p>
3043 <pre>
3044 | b
3045 | c</pre>
3046 !!end
3047
3048 !!test
3049 3a. Indent-Pre and block tags (single-line html)
3050 !! wikitext
3051 a <p> foo </p>
3052 b <div> foo </div>
3053 c <blockquote> foo </blockquote>
3054 <span> foo </span>
3055 !! html
3056 a <p> foo </p>
3057 b <div> foo </div>
3058 c <blockquote> foo </blockquote>
3059 <pre><span> foo </span>
3060 </pre>
3061 !! html/parsoid
3062 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3063 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3064 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3065 <pre><span> foo </span>
3066 </pre>
3067 !! html+tidy
3068 <p>a</p>
3069 <p>foo</p>
3070 <p>b</p>
3071 <div>foo</div>
3072 <p>c</p>
3073 <blockquote>
3074 <p>foo</p>
3075 </blockquote>
3076 <pre>
3077 <span> foo </span>
3078 </pre>
3079 !! end
3080
3081 !!test
3082 3b. Indent-Pre and block tags (multi-line html)
3083 !! wikitext
3084 a <span>foo</span>
3085 b <div> foo </div>
3086 !! html
3087 <pre>a <span>foo</span>
3088 </pre>
3089 b <div> foo </div>
3090
3091 !! html/parsoid
3092 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3093 b <div data-parsoid='{"stx":"html"}'> foo </div>
3094 !! html+tidy
3095 <pre>
3096 a <span>foo</span>
3097 </pre>
3098 <p>b</p>
3099 <div>foo</div>
3100 !!end
3101
3102 !!test
3103 3c. Indent-Pre and block tags (pre-content on separate line)
3104 !! wikitext
3105 <p>
3106 foo
3107 </p>
3108
3109 <div>
3110 foo
3111 </div>
3112
3113 <center>
3114 foo
3115 </center>
3116
3117 <blockquote>
3118 foo
3119 </blockquote>
3120
3121 <blockquote>
3122 <pre>
3123 foo
3124 </pre>
3125 </blockquote>
3126
3127 <table><tr><td>
3128 foo
3129 </td></tr></table>
3130
3131 <ul><li>
3132 foo
3133 </li></ul>
3134
3135 !! html
3136 <p>
3137 foo
3138 </p>
3139 <div>
3140 <pre>foo
3141 </pre>
3142 </div>
3143 <center>
3144 <pre>foo
3145 </pre>
3146 </center>
3147 <blockquote>
3148 <p> foo
3149 </p>
3150 </blockquote>
3151 <blockquote>
3152 <pre>
3153 foo
3154 </pre>
3155 </blockquote>
3156 <table><tr><td>
3157 <pre>foo
3158 </pre>
3159 </td></tr></table>
3160 <ul><li>
3161 foo
3162 </li></ul>
3163
3164 !!end
3165
3166 !!test
3167 4. Indent-Pre and extension tags
3168 !! wikitext
3169 a <gallery>
3170 File:foobar.jpg
3171 </gallery>
3172 !! html
3173 a <ul class="gallery mw-gallery-traditional">
3174 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3175 <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>
3176 <div class="gallerytext">
3177 </div>
3178 </div></li>
3179 </ul>
3180
3181 !! html+tidy
3182 <p>a</p>
3183 <ul class="gallery mw-gallery-traditional">
3184 <li class="gallerybox" style="width: 155px">
3185 <div style="width: 155px">
3186 <div class="thumb" style="width: 150px;">
3187 <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>
3188 </div>
3189 <div class="gallerytext"></div>
3190 </div>
3191 </li>
3192 </ul>
3193 !!end
3194
3195 !! test
3196 Table wikitext syntax outside wiki-tables
3197 !! wikitext
3198 a
3199 ! not a table heading
3200 |- not a table row
3201 | not a table cell
3202 | class="foo bar" | baz
3203 b
3204 |}
3205 |-
3206 c
3207 !! html
3208 <p>a
3209 ! not a table heading
3210 |- not a table row
3211 | not a table cell
3212 | class="foo bar" | baz
3213 b
3214 |}
3215 |-
3216 c
3217 </p>
3218 !! end
3219
3220 !!test
3221 Render paragraphs when indent-pre is suppressed in blocklevels
3222 !! wikitext
3223 <blockquote>
3224 foo
3225
3226 bar
3227 </blockquote>
3228 !! html
3229 <blockquote>
3230 <p> foo
3231 </p><p> bar
3232 </p>
3233 </blockquote>
3234
3235 !!end
3236
3237 !!test
3238 4. Multiple spaces at start-of-line
3239 !! wikitext
3240 <p> foo </p>
3241 foo
3242 {|
3243 |foo
3244 |}
3245 !! html
3246 <p> foo </p>
3247 <pre> foo
3248 </pre>
3249 <table>
3250 <tr>
3251 <td>foo
3252 </td></tr></table>
3253
3254 !!end
3255
3256 ## NOTE: the leading white-space chars on empty line are significant
3257 !! test
3258 5a. White-space in indent-pre
3259 !! wikitext
3260 a<br />
3261
3262 b
3263 !! html
3264 <pre>a<br />
3265
3266 b
3267 </pre>
3268 !! end
3269
3270 ## NOTE: the leading white-space chars on empty line are significant
3271 !! test
3272 5b. White-space in indent-pre
3273 !! wikitext
3274 a
3275
3276 b
3277
3278
3279 c
3280 !! html
3281 <pre>a
3282
3283 b
3284
3285
3286 c
3287 </pre>
3288 !! end
3289
3290 !! test
3291 5c. White-space in indent-pre
3292 !! wikitext
3293 ''a''
3294 ''b''
3295 ''c''
3296 !! html
3297 <pre><i>a</i>
3298 <i>b</i>
3299 <i>c</i>
3300 </pre>
3301 !! end
3302
3303 !! test
3304 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3305 !! wikitext
3306 a
3307
3308 <!-- continue -->
3309 b
3310
3311 c
3312
3313 d
3314 !! html
3315 <pre>a
3316
3317 b
3318 </pre>
3319 <pre>c
3320
3321 </pre>
3322 <p>d
3323 </p>
3324 !! end
3325
3326 !! test
3327 7a. Indent-pre and category links
3328 !! options
3329 parsoid=wt2html,wt2wt
3330 !! wikitext
3331 [[Category:foo]] <!-- No pre-wrapping -->
3332 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3333 !! html/php+tidy
3334 !! html/parsoid
3335 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3336 <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 -->
3337 !! end
3338
3339 ## We used to, but no longer wt2wt this test since the default serializer
3340 ## will normalize all categories to serialize on their own line.
3341 ## This wikitext usage is going to be fairly uncommon in production and
3342 ## selser will take care of preserving formatting in those scenarios.
3343 !! test
3344 7b. Indent-pre and category links
3345 !! options
3346 parsoid=wt2html
3347 !! wikitext
3348 [[Category:foo]] a
3349 [[Category:foo]] {{echo|b}}
3350 !! html/parsoid
3351 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3352 <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>
3353 !! end
3354
3355 !! test
3356 Indent-Pre: Newlines in comments shouldn't affect sol state
3357 !! wikitext
3358 a <!--
3359 foo
3360 --> b
3361 !! html/php+tidy
3362 <p>a b</p>
3363 !! html/parsoid
3364 <p>a <!--
3365 foo
3366 --> b</p>
3367 !! end
3368
3369 ###
3370 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3371 ###
3372
3373 !!test
3374 HTML-pre: 1. embedded newlines
3375 !! wikitext
3376 <pre>foo</pre>
3377
3378 <pre>
3379 foo
3380 </pre>
3381
3382 <pre>
3383
3384 foo
3385 </pre>
3386
3387 <pre>
3388
3389
3390 foo
3391 </pre>
3392 !! html/php+tidy
3393 <pre>
3394 foo
3395 </pre>
3396 <pre>
3397 foo
3398 </pre>
3399 <pre>
3400
3401 foo
3402 </pre>
3403 <pre>
3404
3405
3406 foo
3407 </pre>
3408 !! html/parsoid
3409 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3410
3411 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3412 foo
3413 </pre>
3414
3415 <pre data-parsoid='{"stx":"html"}'>
3416
3417 foo
3418 </pre>
3419
3420 <pre data-parsoid='{"stx":"html"}'>
3421
3422
3423 foo
3424 </pre>
3425 !!end
3426
3427 !! test
3428 HTML-pre: big spaces
3429 !! wikitext
3430 <pre>
3431
3432
3433
3434
3435 haha
3436
3437
3438
3439
3440 haha
3441
3442
3443
3444
3445 </pre>
3446 !! html/php+tidy
3447 <pre>
3448
3449
3450
3451
3452 haha
3453
3454
3455
3456
3457 haha
3458
3459
3460
3461
3462 </pre>
3463 !! html/parsoid
3464 <pre data-parsoid='{"stx":"html"}'>
3465
3466
3467
3468
3469 haha
3470
3471
3472
3473
3474 haha
3475
3476
3477
3478
3479 </pre>
3480 !! end
3481
3482 !!test
3483 HTML-pre: 2: indented text
3484 !! wikitext
3485 <pre>
3486 foo
3487 </pre>
3488 !! html
3489 <pre>
3490 foo
3491 </pre>
3492
3493 !!end
3494
3495 !!test
3496 HTML-pre: 3: other wikitext
3497 !! wikitext
3498 <pre>
3499 * foo
3500 # bar
3501 = no-h =
3502 '' no-italic ''
3503 [[ NoLink ]]
3504 </pre>
3505 !! html/php
3506 <pre>
3507 * foo
3508 # bar
3509 = no-h =
3510 '' no-italic ''
3511 [[ NoLink ]]
3512 </pre>
3513
3514 !! html/parsoid
3515 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3516 # bar
3517 = no-h =
3518 '' no-italic ''
3519 [[ NoLink ]]
3520 </pre>
3521 !!end
3522
3523 ###
3524 ### Definition lists
3525 ###
3526 !! test
3527 Simple definition
3528 !! wikitext
3529 ; name : Definition
3530 !! html
3531 <dl><dt> name&#160;</dt>
3532 <dd> Definition</dd></dl>
3533
3534 !! end
3535
3536 !! test
3537 Definition list for indentation only
3538 !! wikitext
3539 : Indented text
3540 !! html
3541 <dl><dd> Indented text</dd></dl>
3542
3543 !! end
3544
3545 !! test
3546 Definition list with no space
3547 !! wikitext
3548 ;name:Definition
3549 !! html
3550 <dl><dt>name</dt>
3551 <dd>Definition</dd></dl>
3552
3553 !!end
3554
3555 !! test
3556 Definition list with URL link
3557 !! wikitext
3558 ; http://example.com/ : definition
3559 !! html
3560 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3561 <dd> definition</dd></dl>
3562
3563 !! end
3564
3565 !! test
3566 Definition list with bracketed URL link
3567 !! wikitext
3568 ;[http://www.example.com/ Example]:Something about it
3569 !! html
3570 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3571 <dd>Something about it</dd></dl>
3572
3573 !! end
3574
3575 !! test
3576 Definition list with wikilink containing colon
3577 !! wikitext
3578 ; [[Help:FAQ]]: The least-read page on Wikipedia
3579 !! html
3580 <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>
3581 <dd> The least-read page on Wikipedia</dd></dl>
3582
3583 !! end
3584
3585 # At Brion's and JeLuF's insistence... :)
3586 !! test
3587 Definition list with news link containing colon
3588 !! wikitext
3589 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3590 !! html/php
3591 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3592 <dd> This isn't even a real newsgroup!</dd></dl>
3593
3594 !! html/parsoid
3595 <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>
3596 !! end
3597
3598 !! test
3599 Malformed definition list with colon
3600 !! wikitext
3601 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3602 !! html
3603 <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>
3604
3605 !! end
3606
3607 !! test
3608 Definition lists: colon in external link text
3609 !! wikitext
3610 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3611 !! html
3612 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3613 <dd> OK, I made that up</dd></dl>
3614
3615 !! end
3616
3617 !! test
3618 Definition lists: colon in HTML attribute
3619 !! wikitext
3620 ;<b style="display: inline">bold</b>
3621 !! html
3622 <dl><dt><b style="display: inline">bold</b></dt></dl>
3623
3624 !! end
3625
3626 !! test
3627 Definition lists: self-closed tag
3628 !! wikitext
3629 ;one<br/>two : two-line fun
3630 !! html
3631 <dl><dt>one<br />two&#160;</dt>
3632 <dd> two-line fun</dd></dl>
3633
3634 !! end
3635
3636 !! test
3637 Bug 11748: Literal closing tags
3638 !! wikitext
3639 <dl>
3640 <dt>test 1</dt>
3641 <dd>test test test test test</dd>
3642 <dt>test 2</dt>
3643 <dd>test test test test test</dd>
3644 </dl>
3645 !! html
3646 <dl>
3647 <dt>test 1</dt>
3648 <dd>test test test test test</dd>
3649 <dt>test 2</dt>
3650 <dd>test test test test test</dd>
3651 </dl>
3652
3653 !! end
3654
3655 !! test
3656 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3657 !! wikitext
3658 <ul><li>
3659 ; term : description
3660 * unordered
3661 </li></ul>
3662 !! html
3663 <ul><li>
3664 <dl><dt> term&#160;</dt>
3665 <dd> description</dd></dl>
3666 <ul><li> unordered</li></ul>
3667 </li></ul>
3668
3669 !! end
3670
3671 !! test
3672
3673 Definition list with empty definition and following paragraph
3674 !! wikitext
3675 ; term:
3676 Paragraph text
3677 !! html
3678 <dl><dt> term</dt>
3679 <dd></dd></dl>
3680 <p>Paragraph text
3681 </p>
3682 !! end
3683
3684 !! test
3685 Nested definition lists using html syntax
3686 !! wikitext
3687 <dl><dt>x</dt>
3688 <dd>a</dd>
3689 <dd>b</dd></dl>
3690
3691 !! end
3692
3693 !! test
3694 Definition Lists: No nesting: Multiple dd's
3695 !! wikitext
3696 ;x
3697 :a
3698 :b
3699 !! html
3700 <dl><dt>x</dt>
3701 <dd>a</dd>
3702 <dd>b</dd></dl>
3703
3704 !! end
3705
3706 !! test
3707 Definition Lists: Indentation: Regular
3708 !! wikitext
3709 :i1
3710 ::i2
3711 :::i3
3712 !! html
3713 <dl><dd>i1
3714 <dl><dd>i2
3715 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3716
3717 !! end
3718
3719 !! test
3720 Definition Lists: Indentation: Missing 1st level
3721 !! wikitext
3722 ::i2
3723 :::i3
3724 !! html
3725 <dl><dd><dl><dd>i2
3726 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3727
3728 !! end
3729
3730 !! test
3731 Definition Lists: Indentation: Multi-level indent
3732 !! wikitext
3733 :::i3
3734 !! html
3735 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3736
3737 !! end
3738
3739 !! test
3740 Definition Lists: Hacky use to indent tables
3741 !! wikitext
3742 ::{|
3743 |foo
3744 |bar
3745 |}
3746 this text
3747 should be left alone
3748 !! html
3749 <dl><dd><dl><dd><table>
3750 <tr>
3751 <td>foo
3752 </td>
3753 <td>bar
3754 </td></tr></table></dd></dl></dd></dl>
3755 <p>this text
3756 should be left alone
3757 </p>
3758 !! end
3759
3760 !! test
3761 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3762 !! wikitext
3763 <!-- foo -->
3764 ::{|
3765 |foo
3766 |bar
3767 |}<!-- bar -->
3768 this text
3769 should be left alone
3770 !! html/parsoid
3771 <!-- foo -->
3772 <dl><dd><dl><dd><table><tr>
3773 <td>foo</td>
3774 <td>bar</td>
3775 </tr></table><!-- bar --></dd></dl></dd></dl>
3776 <p>this text
3777 should be left alone</p>
3778 !! end
3779
3780 !! test
3781 Definition Lists: Hacky use to indent tables, with comment before table
3782 !! wikitext
3783 ::<!-- foo -->{|
3784 |foo
3785 |}
3786 !! html/parsoid
3787 <dl><dd><dl><dd><!-- foo --><table><tr>
3788 <td>foo</td>
3789 </tr></table></dd></dl></dd></dl>
3790 !! end
3791
3792 # The trailing whitespace in this test is to catch a regression in
3793 # Parsoid after T54473.
3794 !! test
3795 Definition Lists: Hacky use to indent tables (WS-insensitive)
3796 !! wikitext
3797 : {|
3798 |a
3799 |}
3800 !! html/php
3801 <dl><dd><table>
3802 <tr>
3803 <td>a
3804 </td></tr></table></dd></dl>
3805
3806 !! html/parsoid
3807 <dl><dd> <table>
3808 <tbody><tr><td>a</td></tr>
3809 </tbody></table> </dd></dl>
3810 !! end
3811
3812 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3813 ## as an empty dt item. It also ignores all but the last ";" when followed
3814 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3815 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3816 ## ";"s.
3817 ##
3818 ## Ex: ";;t2 ::d2" is transformed into:
3819 ##
3820 ## <dl>
3821 ## <dt>t2 </dt>
3822 ## <dd>
3823 ## <dl>
3824 ## <dt></dt>
3825 ## <dd>d2</dd>
3826 ## </dl>
3827 ## </dd>
3828 ## </dl>
3829 ##
3830 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3831 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3832 ##
3833 ## <dl>
3834 ## <dt>
3835 ## <dl>
3836 ## <dt>t2 </dt>
3837 ## <dd>:d2</dd>
3838 ## </dl>
3839 ## </dt>
3840 ## </dl>
3841 ##
3842 ## All Parsoid only definition list tests have this difference.
3843 ##
3844 ## See also: https://phabricator.wikimedia.org/T8569
3845 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3846
3847 !! test
3848 Table / list interaction: indented table with lists in table contents
3849 !! wikitext
3850 :{|
3851 |-
3852 | a
3853 * b
3854 |-
3855 | c
3856 * d
3857 |}
3858 !! html
3859 <dl><dd><table>
3860
3861 <tr>
3862 <td> a
3863 <ul><li> b</li></ul>
3864 </td></tr>
3865 <tr>
3866 <td> c
3867 <ul><li> d</li></ul>
3868 </td></tr></table></dd></dl>
3869
3870 !! end
3871
3872 !!test
3873 Table / list interaction: lists nested in tables nested in indented lists
3874 !! wikitext
3875 :{|
3876 |
3877 :a
3878 :b
3879 |
3880 *c
3881 *d
3882 |}
3883
3884 *e
3885 *f
3886 !! html
3887 <dl><dd><table>
3888 <tr>
3889 <td>
3890 <dl><dd>a</dd>
3891 <dd>b</dd></dl>
3892 </td>
3893 <td>
3894 <ul><li>c</li>
3895 <li>d</li></ul>
3896 </td></tr></table></dd></dl>
3897 <ul><li>e</li>
3898 <li>f</li></ul>
3899
3900 !!end
3901
3902 !! test
3903 Definition Lists: Nesting: Multi-level (Parsoid only)
3904 !! options
3905 parsoid
3906 !! wikitext
3907 ;t1 :d1
3908 ;;t2 ::d2
3909 ;;;t3 :::d3
3910 !! html
3911 <dl>
3912 <dt>t1 </dt>
3913 <dd>d1</dd>
3914 <dt>
3915 <dl>
3916 <dt>t2 </dt>
3917 <dd>:d2</dd>
3918 <dt>
3919 <dl>
3920 <dt>t3 </dt>
3921 <dd>::d3</dd>
3922 </dl>
3923 </dt>
3924 </dl>
3925 </dt>
3926 </dl>
3927
3928
3929 !! end
3930
3931
3932 !! test
3933 Definition Lists: Nesting: Test 2 (Parsoid only)
3934 !! wikitext
3935 ;t1
3936 ::d2
3937 !! html/php+tidy
3938 <dl>
3939 <dt>t1</dt>
3940 <dd>
3941 <dl>
3942 <dd>d2</dd>
3943 </dl>
3944 </dd>
3945 </dl>
3946 !! html/parsoid
3947 <dl>
3948 <dt>t1</dt>
3949 <dd>
3950 <dl>
3951 <dd>d2</dd>
3952 </dl>
3953 </dd>
3954 </dl>
3955
3956 !! end
3957
3958
3959 !! test
3960 Definition Lists: Nesting: Test 3 (Parsoid only)
3961 !! wikitext
3962 :;t1
3963 ::::d2
3964 !! html/php+tidy
3965 <dl>
3966 <dd>
3967 <dl>
3968 <dt>t1</dt>
3969 <dd>
3970 <dl>
3971 <dd>
3972 <dl>
3973 <dd>d2</dd>
3974 </dl>
3975 </dd>
3976 </dl>
3977 </dd>
3978 </dl>
3979 </dd>
3980 </dl>
3981 !! html/parsoid
3982 <dl>
3983 <dd>
3984 <dl>
3985 <dt>t1</dt>
3986 <dd>
3987 <dl>
3988 <dd>
3989 <dl>
3990 <dd>d2</dd>
3991 </dl>
3992 </dd>
3993 </dl>
3994 </dd>
3995 </dl>
3996 </dd>
3997 </dl>
3998
3999 !! end
4000
4001
4002 !! test
4003 Definition Lists: Nesting: Test 4
4004 !! wikitext
4005 ::;t3
4006 :::d3
4007 !! html
4008 <dl><dd><dl><dd><dl><dt>t3</dt>
4009 <dd>d3</dd></dl></dd></dl></dd></dl>
4010
4011 !! end
4012
4013
4014 ## The Parsoid team believes the following three test exposes a
4015 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4016 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4017 ## It also exposes a "misfeature" in tidy, which doesn't like
4018 ## <dl> tags with a single <dt> child; it converts the <dt> into
4019 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4020 !! test
4021 Definition Lists: Mixed Lists: Test 1
4022 !! wikitext
4023 :;* foo
4024 ::* bar
4025 :; baz
4026 !! html/php
4027 <dl><dd><dl><dt><ul><li> foo</li>
4028 <li> bar</li></ul></dt></dl>
4029 <dl><dt> baz</dt></dl></dd></dl>
4030
4031 !! html/php+tidy
4032 <dl>
4033 <dd>
4034 <dl>
4035 <dd>
4036 <ul>
4037 <li>foo</li>
4038 <li>bar</li>
4039 </ul>
4040 </dd>
4041 </dl>
4042 <dl>
4043 <dt>baz</dt>
4044 </dl>
4045 </dd>
4046 </dl>
4047 !! html/parsoid
4048 <dl>
4049 <dd><dl>
4050 <dt><ul>
4051 <li> foo
4052 </li>
4053 </ul></dt>
4054 <dd><ul>
4055 <li> bar
4056 </li>
4057 </ul></dd>
4058 <dt> baz</dt>
4059 </dl></dd>
4060 </dl>
4061 !! end
4062
4063 !! test
4064 Definition Lists: Mixed Lists: Test 2
4065 !! wikitext
4066 *: d1
4067 *: d2
4068 !! html
4069 <ul><li><dl><dd> d1</dd>
4070 <dd> d2</dd></dl></li></ul>
4071
4072 !! end
4073
4074
4075 !! test
4076 Definition Lists: Mixed Lists: Test 3
4077 !! wikitext
4078 *::: d1
4079 *::: d2
4080 !! html
4081 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4082 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4083
4084 !! end
4085
4086
4087 !! test
4088 Definition Lists: Mixed Lists: Test 4
4089 !! wikitext
4090 *;d1 :d2
4091 *;d3 :d4
4092 !! html
4093 <ul><li><dl><dt>d1&#160;</dt>
4094 <dd>d2</dd>
4095 <dt>d3&#160;</dt>
4096 <dd>d4</dd></dl></li></ul>
4097
4098 !! end
4099
4100
4101 !! test
4102 Definition Lists: Mixed Lists: Test 5
4103 !! wikitext
4104 *:d1
4105 *:: d2
4106 !! html
4107 <ul><li><dl><dd>d1
4108 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4109
4110 !! end
4111
4112
4113 !! test
4114 Definition Lists: Mixed Lists: Test 6
4115 !! wikitext
4116 #*:d1
4117 #*::: d3
4118 !! html
4119 <ol><li><ul><li><dl><dd>d1
4120 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4121
4122 !! end
4123
4124
4125 !! test
4126 Definition Lists: Mixed Lists: Test 7
4127 !! wikitext
4128 :* d1
4129 :* d2
4130 !! html
4131 <dl><dd><ul><li> d1</li>
4132 <li> d2</li></ul></dd></dl>
4133
4134 !! end
4135
4136
4137 !! test
4138 Definition Lists: Mixed Lists: Test 8
4139 !! wikitext
4140 :* d1
4141 ::* d2
4142 !! html
4143 <dl><dd><ul><li> d1</li></ul>
4144 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4145
4146 !! end
4147
4148
4149 !! test
4150 Definition Lists: Mixed Lists: Test 9
4151 !! wikitext
4152 *;foo :bar
4153 !! html
4154 <ul><li><dl><dt>foo&#160;</dt>
4155 <dd>bar</dd></dl></li></ul>
4156
4157 !! end
4158
4159
4160 !! test
4161 Definition Lists: Mixed Lists: Test 10
4162 !! wikitext
4163 *#;foo :bar
4164 !! html
4165 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4166 <dd>bar</dd></dl></li></ol></li></ul>
4167
4168 !! end
4169
4170 # The Parsoid team disagrees with the PHP parser's seemingly-random
4171 # rules regarding dd/dt on the next two tests. Parsoid is more
4172 # consistent, and recognizes the shared nesting and keeps the
4173 # still-open tags around until the nesting is complete.
4174 # (And tidy again converts <dt> to <dd> before 'bar'.)
4175
4176 !! test
4177 Definition Lists: Mixed Lists: Test 11
4178 !! wikitext
4179 *#*#;*;;foo :bar
4180 *#*#;boo :baz
4181 !! html/php
4182 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4183 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4184 <dl><dt>boo&#160;</dt>
4185 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4186
4187 !! html/php+tidy
4188 <ul>
4189 <li>
4190 <ol>
4191 <li>
4192 <ul>
4193 <li>
4194 <ol>
4195 <li>
4196 <dl>
4197 <dt>foo&#160;</dt>
4198 <dd>
4199 <ul>
4200 <li>
4201 <dl>
4202 <dd>
4203 <dl>
4204 <dt>bar</dt>
4205 </dl>
4206 </dd>
4207 </dl>
4208 </li>
4209 </ul>
4210 </dd>
4211 </dl>
4212 <dl>
4213 <dt>boo&#160;</dt>
4214 <dd>baz</dd>
4215 </dl>
4216 </li>
4217 </ol>
4218 </li>
4219 </ul>
4220 </li>
4221 </ol>
4222 </li>
4223 </ul>
4224 !! html/parsoid
4225 <ul>
4226 <li>
4227 <ol>
4228 <li>
4229 <ul>
4230 <li>
4231 <ol>
4232 <li>
4233 <dl>
4234 <dt>
4235 <ul>
4236 <li>
4237 <dl>
4238 <dt>
4239 <dl>
4240 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4241 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4242 </dl></dt>
4243 </dl></li>
4244 </ul></dt>
4245 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4246 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4247 </dl></li>
4248 </ol></li>
4249 </ul></li>
4250 </ol></li>
4251 </ul>
4252 !! end
4253
4254
4255 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4256 # From whitelist:
4257 # * The test is wrong, there are two colons where there should be :;
4258 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4259 !! test
4260 Definition Lists: Weird Ones: Test 1
4261 !! wikitext
4262 *#;*::;; foo : bar (who uses this?)
4263 !! html/php
4264 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4265 <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>
4266
4267 !! html/php+tidy
4268 <ul>
4269 <li>
4270 <ol>
4271 <li>
4272 <dl>
4273 <dt>foo&#160;</dt>
4274 <dd>
4275 <ul>
4276 <li>
4277 <dl>
4278 <dd>
4279 <dl>
4280 <dd>
4281 <dl>
4282 <dd>
4283 <dl>
4284 <dt>bar (who uses this?)</dt>
4285 </dl>
4286 </dd>
4287 </dl>
4288 </dd>
4289 </dl>
4290 </dd>
4291 </dl>
4292 </li>
4293 </ul>
4294 </dd>
4295 </dl>
4296 </li>
4297 </ol>
4298 </li>
4299 </ul>
4300 !! html/parsoid
4301 <ul>
4302 <li>
4303 <ol>
4304 <li>
4305 <dl>
4306 <dt>
4307 <ul>
4308 <li>
4309 <dl>
4310 <dd>
4311 <dl>
4312 <dd>
4313 <dl>
4314 <dt>
4315 <dl>
4316 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4317 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4318 </dl></dt>
4319 </dl></dd>
4320 </dl></dd>
4321 </dl></li>
4322 </ul></dt>
4323 </dl></li>
4324 </ol></li>
4325 </ul>
4326 !! end
4327
4328 !! test
4329 Definition Lists: colons occurring in tags
4330 !! wikitext
4331 ;a:b
4332 ;'''a:b'''
4333 ;<i>a:b</i>
4334 ;<span>a:b</span>
4335 ;<div>a:b</div>
4336 ;<div>a
4337 :b</div>
4338 ;{{echo|a:b}}
4339 ;{{echo|''a:b''}}
4340 ;;;''a:b''
4341 !! html+tidy
4342 <dl>
4343 <dt>a</dt>
4344 <dd>b</dd>
4345 <dt><b>a:b</b></dt>
4346 <dt><i>a:b</i></dt>
4347 <dt><span>a:b</span></dt>
4348 <dd>
4349 <div>a:b</div>
4350 </dd>
4351 <dd>
4352 <div>a
4353 <dl>
4354 <dd>b</dd>
4355 </dl>
4356 </div>
4357 </dd>
4358 <dt>a</dt>
4359 <dd>b</dd>
4360 <dt><i>a:b</i></dt>
4361 </dl>
4362 <dl>
4363 <dd>
4364 <dl>
4365 <dd>
4366 <dl>
4367 <dt><i>a:b</i></dt>
4368 </dl>
4369 </dd>
4370 </dl>
4371 </dd>
4372 </dl>
4373 !! html/parsoid
4374 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4375 <dt><b>a:b</b></dt>
4376 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4377 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4378 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4379 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4380 <dd>b</dd>
4381 <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>
4382 <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>
4383 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4384 !! end
4385
4386 !! test
4387 Definition Lists: colons and tables 1
4388 !! wikitext
4389 :{|
4390 | x
4391 |}
4392 :{|
4393 | y
4394 |}
4395 !! html
4396 <dl><dd><table>
4397 <tr>
4398 <td> x
4399 </td></tr></table></dd></dl>
4400 <dl><dd><table>
4401 <tr>
4402 <td> y
4403 </td></tr></table></dd></dl>
4404
4405 !! end
4406
4407 # Parsoid's output (as documented below) differs from php's in this case.
4408 # This is probably a bug. If we fixup parsoid to match php's output, the
4409 # above test should pass and the below test case can be removed. It is
4410 # unclear which output is more desirable.
4411
4412 !! test
4413 Definition Lists: colons and tables 2
4414 !! wikitext
4415 :{|
4416 | x
4417 |}
4418 :{|
4419 | y
4420 |}
4421 !! html/parsoid
4422 <dl><dd><table>
4423 <tr>
4424 <td> x
4425 </td></tr></table></dd>
4426 <dd><table>
4427 <tr>
4428 <td> y
4429 </td></tr></table></dd></dl>
4430 !! end
4431
4432 !! test
4433 Definition Lists: template interaction
4434 !! wikitext
4435 ::{{definition_list}}
4436
4437 :one
4438 ::{{definition_list}}
4439 :::two
4440 :::three
4441 ::four
4442 !! html/parsoid
4443 <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">
4444 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4445
4446 <dl><dd data-parsoid='{}'>one
4447 <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">
4448 </span><dd about="#mwt2">two
4449 <dl><dd>two</dd>
4450 <dd>three</dd></dl></dd>
4451 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4452 !! end
4453
4454
4455 ###
4456 ### External links
4457 ###
4458 !! test
4459 External links: non-bracketed
4460 !! wikitext
4461 Non-bracketed: http://example.com
4462 !! html
4463 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4464 </p>
4465 !! end
4466
4467 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4468 !! test
4469 External links: numbered
4470 !! wikitext
4471 Numbered: [http://example.com]
4472 Numbered: [http://example.net]
4473 Numbered: [http://example.com]
4474 !! html/php
4475 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4476 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4477 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4478 </p>
4479 !! html/parsoid
4480 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4481 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4482 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4483 !!end
4484
4485 !! test
4486 External links: specified text
4487 !! wikitext
4488 Specified text: [http://example.com link]
4489 !! html
4490 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4491 </p>
4492 !!end
4493
4494 !! test
4495 External links: trail
4496 !! wikitext
4497 Linktrails should not work for external links: [http://example.com link]s
4498 !! html
4499 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4500 </p>
4501 !! end
4502
4503 !! test
4504 External links: dollar sign in URL
4505 !! wikitext
4506 http://example.com/1$2345
4507 !! html
4508 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4509 </p>
4510 !! end
4511
4512 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4513 !! test
4514 External links: dollar sign in URL (autonumber)
4515 !! wikitext
4516 [http://example.com/1$2345]
4517 !! html/php
4518 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4519 </p>
4520 !! html/parsoid
4521 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4522 !!end
4523
4524 !! test
4525 External links: open square bracket forbidden in URL (bug 4377)
4526 !! options
4527 parsoid=wt2html,wt2wt,html2html
4528 !! wikitext
4529 http://example.com/1[2345
4530 !! html/php
4531 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4532 </p>
4533 !! html/parsoid
4534 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4535 !! end
4536
4537 !! test
4538 External links: open square bracket forbidden in URL (named) (bug 4377)
4539 !! options
4540 parsoid=wt2html,html2html
4541 !! wikitext
4542 [http://example.com/1[2345]
4543 !! html/php
4544 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4545 </p>
4546 !! html/parsoid
4547 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4548 !!end
4549
4550 # parsoid adds a space before the link name
4551 !! test
4552 External links: open square bracket forbidden in URL (named) (bug 4377)
4553 Parsoid variant.
4554 !! wikitext
4555 [http://example.com/1 [2345]
4556 !! html
4557 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4558 </p>
4559 !!end
4560
4561 !! test
4562 External links: nowiki in URL link text (bug 6230)
4563 !! wikitext
4564 [http://example.com/ <nowiki>''example site''</nowiki>]
4565 !! html
4566 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4567 </p>
4568 !! end
4569
4570 !! test
4571 External links: newline forbidden in text (bug 6230 regression check)
4572 !! wikitext
4573 [http://example.com/ first
4574 second]
4575 !! html
4576 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4577 second]
4578 </p>
4579 !!end
4580
4581 !! test
4582 External links: Pipe char between url and text
4583 !! wikitext
4584 [http://example.com | link]
4585 !! html
4586 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4587 </p>
4588 !!end
4589
4590 !! test
4591 External links: protocol-relative URL in brackets
4592 !! wikitext
4593 [//example.com/ Test]
4594 !! html
4595 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4596 </p>
4597 !! end
4598
4599 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4600 !! test
4601 External links: protocol-relative URL in brackets without text
4602 !! wikitext
4603 [//example.com]
4604 !! html/php
4605 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4606 </p>
4607 !! html/parsoid
4608 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4609 !! end
4610
4611 !! test
4612 External links: protocol-relative URL in free text is left alone
4613 !! wikitext
4614 //example.com/Foo
4615 !! html
4616 <p>//example.com/Foo
4617 </p>
4618 !!end
4619
4620 !! test
4621 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4622 !! wikitext
4623 foo//example.com/Foo
4624 !! html
4625 <p>foo//example.com/Foo
4626 </p>
4627 !! end
4628
4629 !! test
4630 External links: with no contents
4631 !! wikitext
4632 [http://en.wikipedia.org/wiki/Foo]
4633
4634 [[wikipedia:Foo|Bar]]
4635
4636 [[wikipedia:Foo|<span>Bar</span>]]
4637 !! html/php
4638 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4639 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4640 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4641 </p>
4642 !! html/parsoid
4643 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4644 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4645 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4646 !! end
4647
4648 !! test
4649 External links: Free with trailing punctuation
4650 !! wikitext
4651 http://example.com,
4652 http://example.com;
4653 http://example.com\
4654 http://example.com.
4655 http://example.com:
4656 http://example.com!
4657 http://example.com?
4658 http://example.com)
4659 http://example.com/url_with_(brackets)
4660 (http://example.com/url_without_brackets)
4661 http://example.com/url_with_entity&amp;
4662 http://example.com/url_with_entity&#x26;
4663 http://example.com/url_with_entity&#038;
4664 http://example.com/url_with_entity&nbsp;
4665 http://example.com/url_with_entity&#xA0;
4666 http://example.com/url_with_entity&#160;
4667 http://example.com/url_with_entity&lt;
4668 http://example.com/url_with_entity&#x3C;
4669 http://example.com/url_with_entity&#60;
4670 !! html/php
4671 <p><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">http://example.com</a>:
4676 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4677 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4678 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4679 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4680 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4681 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4682 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4683 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4684 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4685 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4686 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4687 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4688 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4689 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4690 </p>
4691 !! html/parsoid
4692 <p><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">http://example.com</a>:
4697 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4698 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4699 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4700 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4701 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4702 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4703 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4704 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
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;nbsp;","srcContent":" "}'> </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;#xA0;","srcContent":" "}'> </span>
4707 <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>
4708 <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>
4709 <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>
4710 <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>
4711 !! end
4712
4713 !! test
4714 External links: tricky Parsoid html2html case
4715 !! options
4716 parsoid=wt2html,wt2wt,html2html
4717 !! wikitext
4718 http://example.com/url_with_entity&amp;amp;
4719 !! html/php
4720 <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>;
4721 </p>
4722 !! html/parsoid
4723 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4724 !! end
4725
4726 !! test
4727 External links: Free with trailing quotes (T113666)
4728 !! wikitext
4729 '''News:''' Stuff here
4730
4731 news:'a'b''c''d e
4732 !! html/php
4733 <p><b>News:</b> Stuff here
4734 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4735 </p>
4736 !! html/parsoid
4737 <p><b>News:</b> Stuff here</p>
4738 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4739 !! end
4740
4741 !! test
4742 External links: Lone protocols are never linked (T105697)
4743 !! wikitext
4744 http://
4745 http://;
4746 (http://)
4747 bitcoin:
4748 bitcoin:;
4749 (bitcoin:)
4750 !! html
4751 <p>http://
4752 http://;
4753 (http://)
4754 bitcoin:
4755 bitcoin:;
4756 (bitcoin:)
4757 </p>
4758 !! end
4759
4760 !! test
4761 External links: No preceding word characters allowed (bug 65278)
4762 !! wikitext
4763 NOPEhttp://example.com
4764 N0http://example.com
4765 ok:http://example.com
4766 ok-http://example.com
4767 !! html
4768 <p>NOPEhttp://example.com
4769 N0http://example.com
4770 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4771 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4772 </p>
4773 !! end
4774
4775 !! test
4776 External image
4777 !! wikitext
4778 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4779 !! html
4780 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4781 </p>
4782 !! end
4783
4784 !! test
4785 External image from https
4786 !! wikitext
4787 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4788 !! html
4789 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4790 </p>
4791 !! end
4792
4793 !! test
4794 External image (when not allowed)
4795 !! options
4796 wgAllowExternalImages=0
4797 !! wikitext
4798 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4799 !! html
4800 <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>
4801 </p>
4802 !! end
4803
4804 !! test
4805 Link to non-http image, no img tag
4806 !! wikitext
4807 Link to non-http image, no img tag: ftp://example.com/test.jpg
4808 !! html
4809 <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>
4810 </p>
4811 !! end
4812
4813 !! test
4814 External links: terminating separator
4815 !! wikitext
4816 Terminating separator: http://example.com/thing,
4817 !! html
4818 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4819 </p>
4820 !! end
4821
4822 !! test
4823 External links: intervening separator
4824 !! wikitext
4825 Intervening separator: http://example.com/1,2,3
4826 !! html
4827 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4828 </p>
4829 !! end
4830
4831 !! test
4832 External links: old bug with URL in query
4833 !! wikitext
4834 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4835 !! html
4836 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4837 </p>
4838 !! end
4839
4840 !! test
4841 External links: old URL-in-URL bug, mixed protocols
4842 !! wikitext
4843 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4844 !! html
4845 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4846 </p>
4847 !!end
4848
4849 !! test
4850 External links: URL in text
4851 !! wikitext
4852 URL in text: [http://example.com http://example.com]
4853 !! html
4854 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4855 </p>
4856 !! end
4857
4858 !! test
4859 External links: Clickable images
4860 !! wikitext
4861 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4862 !! html/php
4863 <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>
4864 </p>
4865 !! html/parsoid
4866 <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>
4867 !! end
4868
4869 !! test
4870 External links: raw ampersand
4871 !! wikitext
4872 Old &amp; use: http://x&y
4873 !! html
4874 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4875 </p>
4876 !! end
4877
4878 !! test
4879 External links: encoded ampersand
4880 !! wikitext
4881 Old &amp; use: http://x&amp;y
4882 !! html/php
4883 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4884 </p>
4885 !! html/parsoid
4886 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4887 !! end
4888
4889 !! test
4890 External links: encoded equals (bug 6102)
4891 !! wikitext
4892 http://example.com/?foo&#61;bar
4893 !! html/php
4894 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4895 </p>
4896 !! html/parsoid
4897 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4898 !! end
4899
4900 ##
4901 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4902 ## does it number them. As discussed in bug 53505, we can identify
4903 ## autonumbered links via CSS.
4904 ##
4905
4906 !! test
4907 External links: [raw ampersand]
4908 !! wikitext
4909 Old &amp; use: [http://x&y]
4910 !! html/php
4911 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4912 </p>
4913 !! html/parsoid
4914 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4915 !! end
4916
4917 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4918 # mode will return the [raw ampersand] wikitext
4919 !! test
4920 External links: [encoded ampersand]
4921 !! options
4922 parsoid=wt2html,wt2wt,html2html
4923 !! wikitext
4924 Old &amp; use: [http://x&amp;y]
4925 !! html/php
4926 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4927 </p>
4928 !! html/parsoid
4929 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4930 !! end
4931
4932 !! test
4933 External links: [raw equals]
4934 !! wikitext
4935 [http://example.com/?foo=bar]
4936 !! html/php
4937 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4938 </p>
4939 !! html/parsoid
4940 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4941 !! end
4942
4943 # note that parsoid html is identical to [raw equals] case; so html2wt
4944 # mode will return the [raw equals] wikitext
4945 !! test
4946 External links: [encoded equals] (bug 6102)
4947 !! options
4948 parsoid=wt2html,wt2wt,html2html
4949 !! wikitext
4950 [http://example.com/?foo&#61;bar]
4951 !! html/php
4952 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4953 </p>
4954 !! html/parsoid
4955 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4956 !! end
4957
4958 # xxx parsoid strips the IDN character, so the round-trip tests will
4959 # obviously fail and are disabled. --cscott
4960 !! test
4961 External links: [IDN ignored character reference in hostname; strip it right off]
4962 !! options
4963 parsoid=wt2html,wt2wt,html2html
4964 !! wikitext
4965 [http://e&zwnj;xample.com/]
4966 !! html/php
4967 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4968 </p>
4969 !! html/parsoid
4970 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4971 !! end
4972
4973 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4974 # Where an external link could easily circumvent the sanitization of the text of
4975 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4976 # test demands a higher standard. That's a bit strange.
4977 #
4978 # Example:
4979 #
4980 # http://e‌xample.com -> [http://example.com|http://example.com]
4981 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4982 #
4983 # The first example is sanitized, but the second is not. Any security benefits
4984 # from this production are trivial to circumvent. Either remove this test and
4985 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4986 # the test accordingly.
4987 #
4988 # All our love,
4989 # The Parsoid team.
4990 # xxx parsoid strips the IDN character, so the round-trip tests will
4991 # obviously fail and are disabled. --cscott
4992 !! test
4993 External links: IDN ignored character reference in hostname; strip it right off
4994 !! options
4995 parsoid=wt2html,html2html
4996 !! wikitext
4997 http://e&zwnj;xample.com/
4998 !! html/php
4999 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5000 </p>
5001 !! html/parsoid
5002 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5003 !! end
5004
5005 !! test
5006 External links: www.jpeg.org (bug 554)
5007 !! wikitext
5008 http://www.jpeg.org
5009 !! html
5010 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5011 </p>
5012 !! end
5013
5014 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5015 !! test
5016 External links: URL within URL (original bug 2)
5017 !! wikitext
5018 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5019 !! html/php
5020 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5021 </p>
5022 !! html/parsoid
5023 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5024 !! end
5025
5026 !! test
5027 BUG 361: URL inside bracketed URL
5028 !! wikitext
5029 [http://www.example.com/foo http://www.example.com/bar]
5030 !! html
5031 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5032 </p>
5033 !! end
5034
5035 !! test
5036 BUG 361: URL within URL, not bracketed
5037 !! wikitext
5038 http://www.example.com/foo?=http://www.example.com/bar
5039 !! html
5040 <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>
5041 </p>
5042 !! end
5043
5044 !! test
5045 BUG 289: ">"-token in URL-tail
5046 !! wikitext
5047 http://www.example.com/<hello>
5048 !! html
5049 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5050 </p>
5051 !!end
5052
5053 !! test
5054 BUG 289: literal ">"-token in URL-tail
5055 !! wikitext
5056 http://www.example.com/<b>html</b>
5057 !! html/php
5058 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5059 </p>
5060 !! html/parsoid
5061 <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>
5062 !! end
5063
5064 !! test
5065 BUG 289: ">"-token in bracketed URL
5066 !! wikitext
5067 [http://www.example.com/<hello> stuff]
5068 !! html
5069 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5070 </p>
5071 !!end
5072
5073 !! test
5074 BUG 289: literal ">"-token in bracketed URL
5075 !! wikitext
5076 [http://www.example.com/<b>html</b> stuff]
5077 !! html
5078 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5079 </p>
5080 !!end
5081
5082 !! test
5083 BUG 289: literal double quote at end of URL
5084 !! wikitext
5085 http://www.example.com/"hello"
5086 !! html
5087 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5088 </p>
5089 !!end
5090
5091 !! test
5092 BUG 289: literal double quote in bracketed URL
5093 !! wikitext
5094 [http://www.example.com/"hello" stuff]
5095 !! html
5096 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5097 </p>
5098 !!end
5099
5100 !! test
5101 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5102 !! wikitext
5103 [http://www.example.com test]
5104 !! html
5105 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5106 </p>
5107 !! end
5108
5109 !! test
5110 External links: link text with spaces
5111 !! wikitext
5112 [http://www.example.com a b c]
5113 [http://www.example.com ''a'' ''b'']
5114 !! html
5115 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5116 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5117 </p>
5118 !! end
5119
5120 !! test
5121 External links: wiki links within external link (Bug 3695)
5122 !! options
5123 parsoid=wt2html,html2html
5124 !! wikitext
5125 [http://example.com [[wikilink]] embedded in ext link]
5126 !! html/php
5127 <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>
5128 </p>
5129 !! html/parsoid
5130 <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>
5131 !! end
5132
5133 !! test
5134 BUG 787: Links with one slash after the url protocol are invalid
5135 !! wikitext
5136 http:/example.com
5137
5138 [http:/example.com title]
5139 !! html
5140 <p>http:/example.com
5141 </p><p>[http:/example.com title]
5142 </p>
5143 !! end
5144
5145 !! test
5146 Bracketed external links with template-generated invalid target
5147 !! wikitext
5148 [{{echo|http:/example.com}} title]
5149 !! html
5150 <p>[http:/example.com title]
5151 </p>
5152 !! end
5153
5154 !! test
5155 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5156 !! wikitext
5157 ''[http://example.com text'']
5158 [http://example.com '''text]'''
5159 ''Something [http://example.com in italic'']
5160 ''Something [http://example.com mixed''''', even bold]'''
5161 '''''Now [http://example.com both''''']
5162 !! html
5163 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5164 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5165 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5166 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5167 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5168 </p>
5169 !! end
5170
5171
5172 !! test
5173 Bug 4781: %26 in URL
5174 !! wikitext
5175 http://www.example.com/?title=AT%26T
5176 !! html/php
5177 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5178 </p>
5179 !! html/parsoid
5180 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5181 !! end
5182
5183 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5184 # % is actually legal in HTML5. Any change in output would need testing though.
5185 !! test
5186 Bug 4781, 5267: %25 in URL
5187 !! wikitext
5188 http://www.example.com/?title=100%25_Bran
5189 !! html/php
5190 <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>
5191 </p>
5192 !! html/parsoid
5193 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5194 !! end
5195
5196 !! test
5197 Bug 4781, 5267: %28, %29 in URL
5198 !! wikitext
5199 http://www.example.com/?title=Ben-Hur_%281959_film%29
5200 !! html/php
5201 <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>
5202 </p>
5203 !! html/parsoid
5204 <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>
5205 !! end
5206
5207
5208 !! test
5209 Bug 4781: %26 in autonumber URL
5210 !! wikitext
5211 [http://www.example.com/?title=AT%26T]
5212 !! html/php
5213 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5214 </p>
5215 !! html/parsoid
5216 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5217 !! end
5218
5219 !! test
5220 Bug 4781, 5267: %26 in autonumber URL
5221 !! wikitext
5222 [http://www.example.com/?title=100%25_Bran]
5223 !! html/php
5224 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5225 </p>
5226 !! html/parsoid
5227 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5228 !! end
5229
5230 !! test
5231 Bug 4781, 5267: %28, %29 in autonumber URL
5232 !! wikitext
5233 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5234 !! html/php
5235 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5236 </p>
5237 !! html/parsoid
5238 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5239 !! end
5240
5241
5242 !! test
5243 Bug 4781: %26 in bracketed URL
5244 !! wikitext
5245 [http://www.example.com/?title=AT%26T link]
5246 !! html/php
5247 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5248 </p>
5249 !! html/parsoid
5250 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5251 !! end
5252
5253 !! test
5254 Bug 4781, 5267: %25 in bracketed URL
5255 !! wikitext
5256 [http://www.example.com/?title=100%25_Bran link]
5257 !! html
5258 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5259 </p>
5260 !! end
5261
5262 !! test
5263 Bug 4781, 5267: %28, %29 in bracketed URL
5264 !! wikitext
5265 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5266 !! html/php
5267 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5268 </p>
5269 !! html/parsoid
5270 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5271 !! end
5272
5273 !! test
5274 External link containing a period in the anchor. (bug 63947)
5275 !! wikitext
5276 [//foo.org/bar#baz. bang]
5277
5278 [//foo.org/bar. bang]
5279 !! html/php
5280 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5281 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5282 </p>
5283 !! html/parsoid
5284 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5285 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5286 !! end
5287
5288 !! test
5289 External link containing a single quote. (bug 63947)
5290 !! wikitext
5291 [//foo.org/bar'baz]
5292
5293 [//foo.org/bar'baz bang]
5294 !! html/php
5295 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5296 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5297 </p>
5298 !! html/parsoid
5299 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5300 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5301 !! end
5302
5303 !! test
5304 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5305 !! wikitext
5306 Some [http://example.com/ pretty ''italics'' and stuff]!
5307 !! html
5308 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5309 </p>
5310 !! end
5311
5312 !! test
5313 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5314 !! wikitext
5315 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5316 !! html
5317 <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>
5318 </p>
5319 !! end
5320
5321 !! test
5322 External link containing double-single-quotes with no space separating the url from text in italics
5323 !! wikitext
5324 [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]].]
5325 !! html/php
5326 <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>
5327 </p>
5328 !! html/php+tidy
5329 <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>
5330 !! html/parsoid
5331 <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>
5332 !! end
5333
5334 !! test
5335 External link with comments in link text
5336 !! wikitext
5337 [http://www.google.com Google <!-- comment -->]
5338 !! html/php
5339 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5340 </p>
5341 !! html/parsoid
5342 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5343 !! end
5344
5345 !! test
5346 External link to bare IPv4 address
5347 !! wikitext
5348 [http://192.168.0.1 Link]
5349 !! html/php
5350 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5351 </p>
5352 !! html/parsoid
5353 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5354 !! end
5355
5356 !! test
5357 URL-encoding in URL functions (single parameter)
5358 !! wikitext
5359 {{localurl:Some page|amp=&}}
5360 !! html
5361 <p>/index.php?title=Some_page&amp;amp=&amp;
5362 </p>
5363 !! end
5364
5365 !! test
5366 URL-encoding in URL functions (multiple parameters)
5367 !! wikitext
5368 {{localurl:Some page|q=?&amp=&}}
5369 !! html
5370 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5371 </p>
5372 !! end
5373
5374 !! test
5375 Brackets in urls
5376 !! wikitext
5377 http://example.com/index.php?foozoid%5B%5D=bar
5378
5379 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5380 !! html/php
5381 <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>
5382 </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>
5383 </p>
5384 !! html/parsoid
5385 <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>
5386
5387 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5388 !! end
5389
5390 !! test
5391 IPv6 urls, autolink format (T23261)
5392 !! wikitext
5393 http://[2404:130:0:1000::187:2]/index.php
5394
5395 Examples from RFC 2373, section 2.2:
5396 * http://[1080::8:800:200C:417A]/unicast
5397 * http://[FF01::101]/multicast
5398 * http://[::1]/loopback
5399 * http://[::]/unspecified
5400 * http://[::13.1.68.3]/ipv4compat
5401 * http://[::FFFF:129.144.52.38]/ipv4compat
5402
5403 Examples from RFC 2732, section 2:
5404 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5405 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5406 * http://[3ffe:2a00:100:7031::1]
5407 * http://[1080::8:800:200C:417A]/foo
5408 * http://[::192.9.5.5]/ipng
5409 * http://[::FFFF:129.144.52.38]:80/index.html
5410 * http://[2010:836B:4179::836B:4179]
5411
5412 !! html/php
5413 <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>
5414 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5415 </p>
5416 <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>
5417 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5418 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5419 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5420 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5421 <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>
5422 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5423 </p>
5424 <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>
5425 <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>
5426 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5427 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5428 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5429 <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>
5430 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5431
5432 !! html/parsoid
5433 <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>
5434
5435 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5436 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5437 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5438 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5439 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5440 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5441 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5442
5443 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5444 <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>
5445 <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>
5446 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5447 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5448 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5449 <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>
5450 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5451 !! end
5452
5453 !! test
5454 IPv6 urls, bracketed format (T23261)
5455 !! wikitext
5456 [http://[2404:130:0:1000::187:2]/index.php test]
5457
5458 Examples from RFC 2373, section 2.2:
5459 * [http://[1080::8:800:200C:417A] unicast]
5460 * [http://[FF01::101] multicast]
5461 * [http://[::1]/ loopback]
5462 * [http://[::] unspecified]
5463 * [http://[::13.1.68.3] ipv4compat]
5464 * [http://[::FFFF:129.144.52.38] ipv4compat]
5465
5466 Examples from RFC 2732, section 2:
5467 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5468 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5469 * [http://[3ffe:2a00:100:7031::1] 3]
5470 * [http://[1080::8:800:200C:417A]/foo 4]
5471 * [http://[::192.9.5.5]/ipng 5]
5472 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5473 * [http://[2010:836B:4179::836B:4179] 7]
5474
5475 !! html/php
5476 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5477 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5478 </p>
5479 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5480 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5481 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5482 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5483 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5484 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5485 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5486 </p>
5487 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5488 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5489 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5490 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5491 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5492 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5493 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5494
5495 !! html/parsoid
5496 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5497
5498 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5499 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5500 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5501 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5502 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5503 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5504 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5505
5506 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5507 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5508 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5509 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5510 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5511 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5512 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5513 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5514 !! end
5515
5516 !! test
5517 Non-extlinks in brackets
5518 !! wikitext
5519 [foo]
5520 [foo bar]
5521 [foo ''bar'']
5522 [fool's] errand
5523 [fool's errand]
5524 [{{echo|foo}}]
5525 [{{echo|foo}} bar]
5526 [{{echo|foo}} ''bar'']
5527 [{{echo|foo}}l's] errand
5528 [{{echo|foo}}l's errand]
5529 [url={{echo|foo}}]
5530 [url=http://example.com]
5531 [http:// bare protocols don't count]
5532 !! html/php
5533 <p>[foo]
5534 [foo bar]
5535 [foo <i>bar</i>]
5536 [fool's] errand
5537 [fool's errand]
5538 [foo]
5539 [foo bar]
5540 [foo <i>bar</i>]
5541 [fool's] errand
5542 [fool's errand]
5543 [url=foo]
5544 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5545 [http:// bare protocols don't count]
5546 </p>
5547 !! html/parsoid
5548 <p>[foo]
5549 [foo bar]
5550 [foo <i>bar</i>]
5551 [fool's] errand
5552 [fool's errand]
5553 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5554 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5555 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5556 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5557 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5558 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5559 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5560 [http:// bare protocols don't count]</p>
5561 !! end
5562
5563 !! test
5564 Percent encoding in external links
5565 !! wikitext
5566 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5567 !! html/php
5568 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5569 </p>
5570 !! html/parsoid
5571 <p><a rel="mw:ExtLink"
5572 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5573 !! end
5574
5575 !! test
5576 Use url link syntax for links where the content is equal the link target
5577 !! wikitext
5578 http://example.com
5579 !! html/php
5580 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5581 </p>
5582 !! html/parsoid
5583 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5584 !! end
5585
5586 !! test
5587 Parenthesis in external links, especially URL links
5588 !! wikitext
5589 http://example.com)
5590
5591 http://example.com/test)
5592
5593 http://example.com/(test)
5594
5595 http://example.com/((test)
5596
5597 (http://example.com/(test))
5598
5599 (http://example.com/(test)))))
5600
5601 http://example.com/a)b
5602
5603 [http://example.com) foo]
5604 !! html/php
5605 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</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/(test)">http://example.com/(test)</a>
5608 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5609 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5610 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5611 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5612 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5613 </p>
5614 !! html/parsoid
5615 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</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/(test)">http://example.com/(test)</a></p>
5618 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5619 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5620 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5621 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5622 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5623 !! end
5624
5625 !! test
5626 Parenthesis in external links, w/ transclusion or comment
5627 !! wikitext
5628 (http://example.com/{{echo|hi}})
5629
5630 (http://example.com<!-- hi -->)
5631 !! html/php
5632 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5633 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5634 </p>
5635 !! html/parsoid
5636 <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>
5637
5638 <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>
5639 !! end
5640
5641 !! test
5642 Serialize <a> tags with invalid link targets as plain text
5643 !! options
5644 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5645 !! html/parsoid
5646 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5647 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5648 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5649 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5650 !! wikitext
5651 text
5652 <nowiki>*</nowiki>text
5653 <nowiki>[[foo]]</nowiki>
5654 <nowiki>*a [[foo]]</nowiki>
5655 !! end
5656
5657 !! test
5658 mw:ExtLink -vs- mw:WikiLink (T94723)
5659 !! options
5660 parsoid=html2wt
5661 !! html/parsoid
5662 <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>
5663 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5664 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5665 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5666 <p>
5667 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5668 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5669 </p>
5670 !! wikitext
5671 [[Foo|Bar]]
5672 [[Foo|Bar]]
5673 [[wikipedia:Foo|Bar]]
5674 [[wikipedia:Foo|Bar]]
5675
5676 [[wikipedia:European_Robin|European Robin]]
5677 [[wikipedia:European_Robin|European Robin]]
5678 !! end
5679
5680 !! test
5681 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5682 !! options
5683 parsoid=wt2wt
5684 !! wikitext
5685 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5686 !! html/parsoid
5687 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5688 !! end
5689
5690
5691 ###
5692 ### Quotes
5693 ###
5694
5695 !! test
5696 Quotes
5697 !! wikitext
5698 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5699
5700 Normal text. '''''Bold italic text.''''' Normal text.
5701 !! html
5702 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5703 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5704 </p>
5705 !! end
5706
5707
5708 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5709 # parser strips. The wikitext contains just the first half of the bold
5710 # quote pair.
5711 !! test
5712 Unclosed and unmatched quotes
5713 !! wikitext
5714 '''''Bold italic text '''with bold deactivated''' in between.'''''
5715
5716 '''''Bold italic text ''with italic deactivated'' in between.'''''
5717
5718 '''Bold text..
5719
5720 ..spanning two paragraphs (should not work).'''
5721
5722 '''Bold tag left open
5723
5724 ''Italic tag left open
5725
5726 Normal text.
5727
5728 <!-- Unmatching number of opening, closing tags: -->
5729 '''This year''''s election ''should'' beat '''last year''''s.
5730
5731 ''Tom'''s car is bigger than ''Susan'''s.
5732
5733 Plain ''italic'''s plain
5734 !! html/php
5735 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5736 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5737 </p><p><b>Bold text..</b>
5738 </p><p>..spanning two paragraphs (should not work).
5739 </p><p><b>Bold tag left open</b>
5740 </p><p><i>Italic tag left open</i>
5741 </p><p>Normal text.
5742 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5743 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5744 </p><p>Plain <i>italic'</i>s plain
5745 </p>
5746 !! html/parsoid
5747 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5748 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5749 </p><p><b>Bold text..</b>
5750 </p><p>..spanning two paragraphs (should not work).<b></b>
5751 </p><p><b>Bold tag left open</b>
5752 </p><p><i>Italic tag left open</i>
5753 </p><p>Normal text.
5754 </p>
5755 <!-- Unmatching number of opening, closing tags: -->
5756 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5757 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5758 </p><p>Plain <i>italic'</i>s plain
5759 </p>
5760 !! end
5761
5762 ###
5763 ### Tables
5764 ###
5765 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5766 ###
5767
5768 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5769 # is the bare minimum required by the spec, see:
5770 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5771 # Parsoid team replies: empty table tags are legal in HTML5
5772 !! test
5773 A table with no data.
5774 !! options
5775 parsoid=wt2html
5776 !! wikitext
5777 {||}
5778 !! html/php
5779
5780 !! html/parsoid
5781 <table></table>
5782
5783 !! end
5784
5785 !! test
5786 A table with stray table end tags on start tag line (wt2html)
5787 !! options
5788 parsoid=wt2html
5789 !! wikitext
5790 {|style="color: red;"|}
5791
5792 {|style="color: red;" |}
5793 |foo
5794 |}
5795
5796 {|style="color: red;"|} id="foo"
5797 |foo
5798 |}
5799
5800 {|style="color: red;" |} id="foo"
5801 |foo
5802 |}
5803 !! html
5804 <table style="color: red;"></table>
5805
5806 <table style="color: red;">
5807 <tbody><tr>
5808 <td>foo</td>
5809 </tr></tbody>
5810 </table>
5811
5812 <table style="color: red;" id="foo">
5813 <tbody><tr>
5814 <td>foo</td>
5815 </tr></tbody>
5816 </table>
5817
5818 <table style="color: red;" id="foo">
5819 <tbody><tr>
5820 <td>foo</td>
5821 </tr></tbody>
5822 </table>
5823
5824 !! end
5825
5826 !! test
5827 A table with no data (take 2)
5828 !! wikitext
5829 {|
5830 |}
5831 !! html/parsoid
5832 <table></table>
5833 !! end
5834
5835 # A table with nothing but a caption is invalid XHTML, we might want to render
5836 # this as <p>caption</p>
5837 # Parsoid team replies: table with only a caption is legal in HTML5
5838 !! test
5839 A table with nothing but a caption
5840 !! wikitext
5841 {|
5842 |+ caption
5843 |}
5844 !! html/php
5845 <table>
5846 <caption> caption
5847 </caption><tr><td></td></tr></table>
5848
5849 !! html/parsoid
5850 <table><caption> caption</caption></table>
5851 !! end
5852
5853 !! test
5854 A table with caption with default-spaced attributes and a table row
5855 !! wikitext
5856 {|
5857 |+ style="color: red;" | caption1
5858 |-
5859 | foo
5860 |}
5861 !! html
5862 <table>
5863 <caption style="color: red;"> caption1
5864 </caption>
5865 <tr>
5866 <td> foo
5867 </td></tr></table>
5868
5869 !! end
5870
5871 !! test
5872 A table with captions with non-default spaced attributes and a table row
5873 !! wikitext
5874 {|
5875 |+style="color: red;"|caption2
5876 |+ style="color: red;"| caption3
5877 |-
5878 | foo
5879 |}
5880 !! html
5881 <table>
5882 <caption style="color: red;">caption2
5883 </caption>
5884 <caption style="color: red;"> caption3
5885 </caption>
5886 <tr>
5887 <td> foo
5888 </td></tr></table>
5889
5890 !! end
5891
5892 !! test
5893 Table td-cell syntax variations
5894 !! wikitext
5895 {|
5896 | foo bar foo | baz
5897 | foo bar foo || baz
5898 | style='color:red;' | baz
5899 | style='color:red;' || baz
5900 |}
5901 !! html
5902 <table>
5903 <tr>
5904 <td> baz
5905 </td>
5906 <td> foo bar foo </td>
5907 <td> baz
5908 </td>
5909 <td style="color:red;"> baz
5910 </td>
5911 <td> style='color:red;' </td>
5912 <td> baz
5913 </td></tr></table>
5914
5915 !! end
5916
5917 !! test
5918 Simple table
5919 !! wikitext
5920 {|
5921 | 1 || 2
5922 |-
5923 | 3 || 4
5924 |}
5925 !! html
5926 <table>
5927 <tr>
5928 <td> 1 </td>
5929 <td> 2
5930 </td></tr>
5931 <tr>
5932 <td> 3 </td>
5933 <td> 4
5934 </td></tr></table>
5935
5936 !! end
5937
5938 !! test
5939 Simple table but with multiple dashes for row wikitext
5940 !! wikitext
5941 {|
5942 | foo
5943 |-----
5944 | bar
5945 |}
5946 !! html
5947 <table>
5948 <tr>
5949 <td> foo
5950 </td></tr>
5951 <tr>
5952 <td> bar
5953 </td></tr></table>
5954
5955 !! end
5956
5957 !! test
5958 Multiplication table
5959 !! wikitext
5960 {| border="1" cellpadding="2"
5961 |+Multiplication table
5962 |-
5963 ! &times; !! 1 !! 2 !! 3
5964 |-
5965 ! 1
5966 | 1 || 2 || 3
5967 |-
5968 ! 2
5969 | 2 || 4 || 6
5970 |-
5971 ! 3
5972 | 3 || 6 || 9
5973 |-
5974 ! 4
5975 | 4 || 8 || 12
5976 |-
5977 ! 5
5978 | 5 || 10 || 15
5979 |}
5980 !! html
5981 <table border="1" cellpadding="2">
5982 <caption>Multiplication table
5983 </caption>
5984 <tr>
5985 <th> &#215; </th>
5986 <th> 1 </th>
5987 <th> 2 </th>
5988 <th> 3
5989 </th></tr>
5990 <tr>
5991 <th> 1
5992 </th>
5993 <td> 1 </td>
5994 <td> 2 </td>
5995 <td> 3
5996 </td></tr>
5997 <tr>
5998 <th> 2
5999 </th>
6000 <td> 2 </td>
6001 <td> 4 </td>
6002 <td> 6
6003 </td></tr>
6004 <tr>
6005 <th> 3
6006 </th>
6007 <td> 3 </td>
6008 <td> 6 </td>
6009 <td> 9
6010 </td></tr>
6011 <tr>
6012 <th> 4
6013 </th>
6014 <td> 4 </td>
6015 <td> 8 </td>
6016 <td> 12
6017 </td></tr>
6018 <tr>
6019 <th> 5
6020 </th>
6021 <td> 5 </td>
6022 <td> 10 </td>
6023 <td> 15
6024 </td></tr></table>
6025
6026 !! end
6027
6028 !! test
6029 Accept "||" in table headings
6030 !! wikitext
6031 {|
6032 !h1 || h2
6033 |}
6034 !! html
6035 <table>
6036 <tr>
6037 <th>h1 </th>
6038 <th> h2
6039 </th></tr></table>
6040
6041 !! end
6042
6043 !! test
6044 Accept "!!" in table data
6045 !! wikitext
6046 {|
6047 | Foo!! ||
6048 |}
6049 !! html
6050 <table>
6051 <tr>
6052 <td> Foo!! </td>
6053 <td>
6054 </td></tr></table>
6055
6056 !! html/parsoid
6057 <table>
6058 <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>
6059 </tbody></table>
6060 !! end
6061
6062 !! test
6063 Accept "||" in indented table headings
6064 !! wikitext
6065 :{|
6066 !h1 || h2
6067 |}
6068 !! html
6069 <dl><dd><table>
6070 <tr>
6071 <th>h1 </th>
6072 <th> h2
6073 </th></tr></table></dd></dl>
6074
6075 !! end
6076
6077 !! test
6078 Accept "!!" in templates
6079 !! wikitext
6080 {|
6081 !a {{echo|b!!c}}
6082 |}
6083 !! html/php
6084 <table>
6085 <tr>
6086 <th>a b</th>
6087 <th>c
6088 </th></tr></table>
6089
6090 !! html/parsoid
6091 <table>
6092 <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>
6093 !! end
6094
6095 !! test
6096 Accept "!!" in table headings after newline
6097 !! wikitext
6098 {|
6099 !a
6100 b!!c
6101 |}
6102 !! html/php
6103 <table>
6104 <tr>
6105 <th>a
6106 <p>b!!c
6107 </p>
6108 </th></tr></table>
6109
6110 !! html/parsoid
6111 <table>
6112 <tbody><tr><th>a
6113 <p>b!!c</p></th></tr>
6114 </tbody></table>
6115 !! end
6116
6117 !! test
6118 Accept "!!" in table data of mixed wikitext / html syntax
6119 !! wikitext
6120 {|
6121 !a
6122 <tr><td>b!!c</td></tr>
6123 |}
6124 !! html+tidy
6125 <table>
6126 <tr>
6127 <th>a</th>
6128 </tr>
6129 <tr>
6130 <td>b!!c</td>
6131 </tr>
6132 </table>
6133 !! html/parsoid
6134 <table>
6135 <tbody><tr><th>a</th></tr>
6136 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6137 </tbody></table>
6138 !! end
6139
6140 !! test
6141 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6142 !! wikitext
6143 {|
6144 !| h1
6145 || a
6146 |}
6147 !! html
6148 <table>
6149 <tr>
6150 <th> h1
6151 </th>
6152 <td> a
6153 </td></tr></table>
6154
6155 !! end
6156
6157 !!test
6158 Accept "| !" at start of line in tables (ignore !-attribute)
6159 !! wikitext
6160 {|
6161 |-
6162 | !style="color:red" | bar
6163 |}
6164 !! html
6165 <table>
6166
6167 <tr>
6168 <td> bar
6169 </td></tr></table>
6170
6171 !!end
6172
6173 !!test
6174 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 +/-
6175 !! wikitext
6176 {|
6177 |-
6178 |style='color:red;'|+1
6179 |style='color:blue;'|-1
6180 |-
6181 | 1 || 2 || 3
6182 | 1 ||+2 ||-3
6183 |-
6184 | +1
6185 | -1
6186 |}
6187 !! html
6188 <table>
6189
6190 <tr>
6191 <td style="color:red;">+1
6192 </td>
6193 <td style="color:blue;">-1
6194 </td></tr>
6195 <tr>
6196 <td> 1 </td>
6197 <td> 2 </td>
6198 <td> 3
6199 </td>
6200 <td> 1 </td>
6201 <td>+2 </td>
6202 <td>-3
6203 </td></tr>
6204 <tr>
6205 <td> +1
6206 </td>
6207 <td> -1
6208 </td></tr></table>
6209
6210 !!end
6211
6212 !! test
6213 Table rowspan
6214 !! wikitext
6215 {| border=1
6216 | Cell 1, row 1
6217 |rowspan=2| Cell 2, row 1 (and 2)
6218 | Cell 3, row 1
6219 |-
6220 | Cell 1, row 2
6221 | Cell 3, row 2
6222 |}
6223 !! html
6224 <table border="1">
6225 <tr>
6226 <td> Cell 1, row 1
6227 </td>
6228 <td rowspan="2"> Cell 2, row 1 (and 2)
6229 </td>
6230 <td> Cell 3, row 1
6231 </td></tr>
6232 <tr>
6233 <td> Cell 1, row 2
6234 </td>
6235 <td> Cell 3, row 2
6236 </td></tr></table>
6237
6238 !! end
6239
6240 !! test
6241 Nested table
6242 !! wikitext
6243 {| border=1
6244 | &alpha;
6245 |
6246 {| bgcolor=#ABCDEF border=2
6247 |nested
6248 |-
6249 |table
6250 |}
6251 |the original table again
6252 |}
6253 !! html
6254 <table border="1">
6255 <tr>
6256 <td> &#945;
6257 </td>
6258 <td>
6259 <table bgcolor="#ABCDEF" border="2">
6260 <tr>
6261 <td>nested
6262 </td></tr>
6263 <tr>
6264 <td>table
6265 </td></tr></table>
6266 </td>
6267 <td>the original table again
6268 </td></tr></table>
6269
6270 !! end
6271
6272 !! test
6273 Invalid attributes in table cell (bug 1830)
6274 !! wikitext
6275 {|
6276 |Cell:|broken
6277 |}
6278 !! html
6279 <table>
6280 <tr>
6281 <td>broken
6282 </td></tr></table>
6283
6284 !! end
6285
6286 !! test
6287 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6288 !! wikitext
6289 {|
6290 | title="foo" |bar
6291 | title="foo<nowiki>|</nowiki>" |bar
6292 | title="foo<nowiki>|</nowiki>" bar
6293 |}
6294 !! html/php
6295 <table>
6296 <tr>
6297 <td title="foo">bar
6298 </td>
6299 <td title="foo&#124;">bar
6300 </td>
6301 <td> title="foo|" bar
6302 </td></tr></table>
6303
6304 !! html/parsoid
6305 <table>
6306 <tbody><tr><td title="foo">bar</td>
6307 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6308 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6309 </tbody></table>
6310 !! end
6311
6312 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6313 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6314 # *2wt modes will fail.
6315 !! test
6316 Table security: embedded pipes
6317 !! options
6318 parsoid=wt2html,html2html
6319 !! wikitext
6320 {|
6321 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6322 !! html/php
6323 <table>
6324 <tr>
6325 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6326 <td>]" onmouseover="alert(document.cookie)"&gt;test
6327 </td>
6328 </tr>
6329 </table>
6330
6331 !! html/parsoid
6332 <table><tbody>
6333 <tr>
6334 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6335 !! end
6336
6337 !! test
6338 ! and || in element attributes should not be parsed as <th>/<td>
6339 !! wikitext
6340 {|
6341 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6342 |}
6343 !! html/php
6344 <table>
6345 <tr>
6346 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6347 </td></tr></table>
6348
6349 !! html/parsoid
6350 <table>
6351 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6352 </tbody></table>
6353 !! end
6354
6355 # FIXME: The output seems broken. Filed as T110268.
6356 !! test
6357 ! and || in td attributes should not be parsed as <th>/<td>
6358 !! options
6359 parsoid=wt2html
6360 !! wikitext
6361 {|
6362 | style="color: red !important;" data-contrived="put this here ||" | foo
6363 |}
6364 !! html/php
6365 <table>
6366 <tr>
6367 <td> style="color: red !important;" data-contrived="put this here </td>
6368 <td> foo
6369 </td></tr></table>
6370
6371 !! html/parsoid
6372 <table>
6373 <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>
6374 </tbody></table>
6375 !! end
6376
6377 !! test
6378 Indented table markup mixed with indented pre content (proposed in bug 6200)
6379 !! wikitext
6380 <table>
6381 <tr>
6382 <td>
6383 Text that should be rendered preformatted
6384 </td>
6385 </tr>
6386 </table>
6387 !! html
6388 <table>
6389 <tr>
6390 <td>
6391 <pre>Text that should be rendered preformatted
6392 </pre>
6393 </td>
6394 </tr>
6395 </table>
6396
6397 !! end
6398
6399 !! test
6400 1. Template-generated table cell attributes and cell content
6401 !! wikitext
6402 {|
6403 |{{table_attribs}}
6404 | {{table_attribs}}
6405 || {{table_attribs_5}}
6406 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6407 |align=center {{table_attribs}}
6408 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6409 |}
6410 !! html
6411 <table>
6412 <tr>
6413 <td style="color:red;">Foo
6414 </td>
6415 <td style="color:red;">Foo
6416 </td>
6417 <td> style="color:red;"</td>
6418 <td>Bar
6419 </td>
6420 <td style="color:red;">Foo
6421 </td>
6422 <td align="center" style="color:red;">Foo
6423 </td>
6424 <td align="center" style="color:red;">Foo
6425 </td></tr></table>
6426
6427 !! end
6428
6429 !! test
6430 2. Template-generated table cell attributes and cell content
6431 !! wikitext
6432 {|
6433 |{{table_attribs_2}}
6434 |}
6435 !! html/php
6436 <table>
6437 <tr>
6438 <td style="color:red;">Foo
6439 </td>
6440 <td>Bar</td>
6441 <td>Baz
6442 </td></tr></table>
6443
6444 !! html/parsoid
6445 <table>
6446 <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>
6447 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6448 </tbody></table>
6449 !! end
6450
6451 !! test
6452 3. Template-generated table cell attributes and cell content
6453 !! wikitext
6454 {|
6455 !align=center {{table_header_cells}}
6456 |-
6457 |align=center {{table_cells}}
6458 |}
6459 !! html/php
6460 <table>
6461 <tr>
6462 <th align="center" style="color:red;">Foo</th>
6463 <th style="color:red;"><i>Bar</i></th>
6464 <th style="color:brown;"><i>Foo</i> and Baz
6465 </th></tr>
6466 <tr>
6467 <td align="center" style="color:red;">Foo</td>
6468 <td style="color:red;"><i>Bar</i></td>
6469 <td style="color:brown;"><i>Foo</i> and Baz
6470 </td></tr></table>
6471
6472 !! html/parsoid
6473 <table>
6474 <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>
6475 <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>
6476 </tbody></table>
6477 !! end
6478
6479 !! test
6480 4. Template-generated table cell attributes and cell content inside a templated table
6481 !! wikitext
6482 {{tbl-start}}
6483 !align=center {{table_header_cells}}
6484 |-
6485 |align=center {{table_cells}}
6486 {{tbl-end}}
6487 !! html/php
6488 <table>
6489 <tr>
6490 <th align="center" style="color:red;">Foo</th>
6491 <th style="color:red;"><i>Bar</i></th>
6492 <th style="color:brown;"><i>Foo</i> and Baz
6493 </th></tr>
6494 <tr>
6495 <td align="center" style="color:red;">Foo</td>
6496 <td style="color:red;"><i>Bar</i></td>
6497 <td style="color:brown;"><i>Foo</i> and Baz
6498 </td></tr></table>
6499
6500 !! html/parsoid
6501 <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}}]}'>
6502 <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>
6503 <tr>
6504 <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>
6505 </tbody></table>
6506 !! end
6507
6508 ## Edge case fix to prevent future regressions
6509 !! test
6510 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6511 !! wikitext
6512 {|
6513 |{{table_attribs_7}}
6514 |}
6515 <references />
6516 !! html/parsoid
6517 <table>
6518 <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>
6519 </tbody></table>
6520 <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>
6521 !! end
6522
6523 !! test
6524 Table with row followed by newlines and table heading
6525 !! wikitext
6526 {|
6527 |-
6528
6529 ! foo
6530 |}
6531 !! html
6532 <table>
6533
6534
6535 <tr>
6536 <th> foo
6537 </th></tr></table>
6538
6539 !! end
6540
6541 !! test
6542 Table with empty line following the start tag
6543 !! wikitext
6544 {|
6545
6546 |-
6547 | foo
6548 |}
6549 !! html
6550 <table>
6551
6552
6553 <tr>
6554 <td> foo
6555 </td></tr></table>
6556
6557 !! end
6558
6559 # FIXME: Preserve the attribute properly (with an empty string as value) in
6560 # the PHP parser. Parsoid implements the behavior below.
6561 !! test
6562 Table attributes with empty value
6563 !! wikitext
6564 {|
6565 | style=| hello
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 <p>/
9808 </p>
9809 !! end
9810
9811 !! test
9812 Magic Word: {{STYLEPATH}}
9813 !! wikitext
9814 {{STYLEPATH}}
9815 !! html
9816 <p>/skins
9817 </p>
9818 !! end
9819
9820 !! test
9821 Magic Word: {{SERVER}}
9822 !! wikitext
9823 {{SERVER}}
9824 !! html
9825 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9826 </p>
9827 !! end
9828
9829 !! test
9830 Magic Word: {{SERVERNAME}}
9831 !! wikitext
9832 {{SERVERNAME}}
9833 !! html
9834 <p>example.org
9835 </p>
9836 !! end
9837
9838 !! test
9839 Magic Word: {{SITENAME}}
9840 !! wikitext
9841 {{SITENAME}}
9842 !! html
9843 <p>MediaWiki
9844 </p>
9845 !! end
9846
9847 !! test
9848 Case-sensitive magic words, when cased differently, should just be template transclusions
9849 !! wikitext
9850 {{CurrentMonth}}
9851 {{currentday}}
9852 {{cURreNTweEK}}
9853 {{currentHour}}
9854 !! html
9855 <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>
9856 <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>
9857 <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>
9858 <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>
9859 </p>
9860 !! end
9861
9862 !! test
9863 Case-insensitive magic words should still work with weird casing.
9864 !! wikitext
9865 {{sErVeRNaMe}}
9866 {{LCFirst:AOEU}}
9867 {{ucFIRST:aoeu}}
9868 {{SERver}}
9869 !! html
9870 <p>example.org
9871 aOEU
9872 Aoeu
9873 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9874 </p>
9875 !! end
9876
9877 # From plwiki:PLOS_ONE
9878 !! test
9879 Parsoid: Page property magic word with magic word contents
9880 !! wikitext
9881 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9882 !! html/parsoid
9883 <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>"}]]}'/>
9884 !! end
9885
9886 !! test
9887 Parsoid: Template-generated DISPLAYTITLE
9888 !! wikitext
9889 {{{{echo|DISPLAYTITLE}}:Foo}}
9890 !! html/parsoid
9891 <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}}]}'/>
9892 !! end
9893
9894 !! test
9895 Namespace 1 {{ns:1}}
9896 !! wikitext
9897 {{ns:1}}
9898 !! html
9899 <p>Talk
9900 </p>
9901 !! end
9902
9903 !! test
9904 Namespace 1 {{ns:01}}
9905 !! wikitext
9906 {{ns:01}}
9907 !! html
9908 <p>Talk
9909 </p>
9910 !! end
9911
9912 !! test
9913 Namespace 0 {{ns:0}} (bug 4783)
9914 !! wikitext
9915 {{ns:0}}
9916 !! html
9917
9918 !! end
9919
9920 !! test
9921 Namespace 0 {{ns:00}} (bug 4783)
9922 !! wikitext
9923 {{ns:00}}
9924 !! html
9925
9926 !! end
9927
9928 !! test
9929 Namespace -1 {{ns:-1}}
9930 !! wikitext
9931 {{ns:-1}}
9932 !! html
9933 <p>Special
9934 </p>
9935 !! end
9936
9937 !! test
9938 Namespace User {{ns:User}}
9939 !! wikitext
9940 {{ns:User}}
9941 !! html
9942 <p>User
9943 </p>
9944 !! end
9945
9946 !! test
9947 Namespace User talk {{ns:User_talk}}
9948 !! wikitext
9949 {{ns:User_talk}}
9950 !! html
9951 <p>User talk
9952 </p>
9953 !! end
9954
9955 !! test
9956 Namespace User talk {{ns:uSeR tAlK}}
9957 !! wikitext
9958 {{ns:uSeR tAlK}}
9959 !! html
9960 <p>User talk
9961 </p>
9962 !! end
9963
9964 !! test
9965 Namespace File {{ns:File}}
9966 !! wikitext
9967 {{ns:File}}
9968 !! html
9969 <p>File
9970 </p>
9971 !! end
9972
9973 !! test
9974 Namespace File {{ns:Image}}
9975 !! wikitext
9976 {{ns:Image}}
9977 !! html
9978 <p>File
9979 </p>
9980 !! end
9981
9982 !! test
9983 Namespace (lang=de) Benutzer {{ns:User}}
9984 !! options
9985 language=de
9986 !! wikitext
9987 {{ns:User}}
9988 !! html
9989 <p>Benutzer
9990 </p>
9991 !! end
9992
9993 !! test
9994 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9995 !! options
9996 language=de
9997 !! wikitext
9998 {{ns:3}}
9999 !! html
10000 <p>Benutzer Diskussion
10001 </p>
10002 !! end
10003
10004
10005 !! test
10006 Urlencode
10007 !! wikitext
10008 {{urlencode:hi world?!}}
10009 {{urlencode:hi world?!|WIKI}}
10010 {{urlencode:hi world?!|PATH}}
10011 {{urlencode:hi world?!|QUERY}}
10012 !! html
10013 <p>hi+world%3F%21
10014 hi_world%3F!
10015 hi%20world%3F%21
10016 hi+world%3F%21
10017 </p>
10018 !! end
10019
10020 !! test
10021 Magic Word: prioritize type info over data-parsoid
10022 !! options
10023 parsoid=html2wt
10024 !! html/parsoid
10025 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10026 !! wikitext
10027 __FORCETOC__
10028 !! end
10029
10030 !! test
10031 Magic Word: serialize on separate line (parsoid)
10032 !! options
10033 parsoid=wt2wt,html2wt
10034 !! wikitext
10035 foo
10036 __NOTOC__
10037 bar
10038 !! html/parsoid
10039 foo<meta property="mw:PageProp/notoc"/>bar
10040 !! end
10041
10042 !! test
10043 Magic Word: rt non-english wikis
10044 !! options
10045 parsoid=wt2wt
10046 language=de
10047 !! wikitext
10048 __NOEDITSECTION__
10049 !! html/parsoid
10050 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10051 !! end
10052
10053 !!test
10054 __proto__ is treated as normal wikitext (T105997)
10055 !!wikitext
10056 __proto__
10057 !!html
10058 <p>__proto__
10059 </p>
10060 !!end
10061
10062 ###
10063 ### Magic links
10064 ###
10065 !! test
10066 Magic links: internal link to RFC (bug 479)
10067 !! wikitext
10068 [[RFC 123]]
10069 !! html/php
10070 <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>
10071 </p>
10072 !! html/parsoid
10073 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10074 !! end
10075
10076 !! test
10077 Magic links: RFC (bug 479)
10078 !! wikitext
10079 RFC 822
10080 !! html/php
10081 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10082 </p>
10083 !! html/parsoid
10084 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10085 !! end
10086
10087 !! test
10088 Magic links: RFC (bug 65278)
10089 !! wikitext
10090 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10091 !! html/php
10092 <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.
10093 </p>
10094 !! html/parsoid
10095 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10096 !! end
10097
10098 !! test
10099 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10100 !! wikitext
10101 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10102 RFC
10103 822
10104 !! html/php
10105 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10106 RFC
10107 822
10108 </p>
10109 !! html/parsoid
10110 <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>
10111 RFC
10112 822</p>
10113 !! end
10114
10115 !! test
10116 Magic links: ISBN (bug 1937)
10117 !! wikitext
10118 ISBN 0-306-40615-2
10119 !! html/php
10120 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10121 </p>
10122 !! html/parsoid
10123 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10124 !! end
10125
10126 !! test
10127 Magic links: ISBN (bug 65278)
10128 !! wikitext
10129 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10130 !! html/php
10131 <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.
10132 </p>
10133 !! html/parsoid
10134 <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>
10135 !! end
10136
10137 !! test
10138 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10139 !! wikitext
10140 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10141 ISBN
10142 9780316098113
10143 ISBN 978
10144 0316098113
10145 !! html/php
10146 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10147 ISBN
10148 9780316098113
10149 ISBN 978
10150 0316098113
10151 </p>
10152 !! html/parsoid
10153 <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>
10154 ISBN
10155 9780316098113
10156 ISBN 978
10157 0316098113</p>
10158 !! end
10159
10160 !! test
10161 Magic links: PMID incorrectly converts space to underscore
10162 !! wikitext
10163 PMID 1234
10164 !! html/php
10165 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10166 </p>
10167 !! html/parsoid
10168 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10169 !! end
10170
10171 !! test
10172 Magic links: PMID (bug 65278)
10173 !! wikitext
10174 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10175 !! html/php
10176 <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.
10177 </p>
10178 !! html/parsoid
10179 <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>
10180 !! end
10181
10182 !! test
10183 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10184 !! wikitext
10185 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10186 PMID
10187 1234
10188 !! html/php
10189 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10190 PMID
10191 1234
10192 </p>
10193 !! html/parsoid
10194 <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>
10195 PMID
10196 1234</p>
10197 !! end
10198
10199 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10200 # since these are ExtLinkText, not MagicLinkText
10201 !! test
10202 Magic links: use appropriate serialization for "almost" magic links.
10203 !! wikitext
10204 X[[Special:BookSources/0978739256|foo]]
10205
10206 X[//tools.ietf.org/html/rfc1234 foo]
10207 !! html/php
10208 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10209 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10210 </p>
10211 !! html/parsoid
10212 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10213 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10214 !! end
10215
10216 ###
10217 ### Templates
10218 ####
10219
10220 !! test
10221 Nonexistent template
10222 !! wikitext
10223 {{thistemplatedoesnotexist}}
10224 !! html
10225 <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>
10226 </p>
10227 !! end
10228
10229 !! test
10230 Template with invalid target containing tags
10231 !! wikitext
10232 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10233 !! html
10234 <p>{{a<b>b</b>|foo|a=b|a = b}}
10235 </p>
10236 !! end
10237
10238 !! test
10239 Template with invalid target containing unclosed tag
10240 !! wikitext
10241 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10242 !! html
10243 <p>{{a<b>|foo|a=b|a = b}}</b>
10244 </p>
10245 !! end
10246
10247 !! test
10248 Template with invalid target containing wikilink
10249 !! wikitext
10250 {{[[Main Page]]}}
10251 !! html/php
10252 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10253 </p>
10254 !! html/parsoid
10255 <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>
10256 !! end
10257
10258 !! test
10259 Template with just whitespace in it, bug #68421
10260 !! wikitext
10261 {{echo|{{ }}}}
10262 !! html/parsoid
10263 <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>
10264 !! end
10265
10266 !! article
10267 Template:test
10268 !! text
10269 This is a test template
10270 !! endarticle
10271
10272 !! test
10273 Simple template
10274 !! wikitext
10275 {{test}}
10276 !! html
10277 <p>This is a test template
10278 </p>
10279 !! end
10280
10281 !! test
10282 Template with explicit namespace
10283 !! wikitext
10284 {{Template:test}}
10285 !! html
10286 <p>This is a test template
10287 </p>
10288 !! end
10289
10290
10291 !! article
10292 Template:paramtest
10293 !! text
10294 This is a test template with parameter {{{param}}}
10295 !! endarticle
10296
10297 !! test
10298 Template parameter
10299 !! wikitext
10300 {{paramtest|param=foo}}
10301 !! html
10302 <p>This is a test template with parameter foo
10303 </p>
10304 !! end
10305
10306 !! article
10307 Template:paramtestnum
10308 !! text
10309 [[{{{1}}}|{{{2}}}]]
10310 !! endarticle
10311
10312 !! test
10313 Template unnamed parameter
10314 !! wikitext
10315 {{paramtestnum|Main Page|the main page}}
10316 !! html
10317 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10318 </p>
10319 !! end
10320
10321 !! article
10322 Template:templatesimple
10323 !! text
10324 (test)
10325 !! endarticle
10326
10327 !! article
10328 Template:templateredirect
10329 !! text
10330 #redirect [[Template:templatesimple]]
10331 !! endarticle
10332
10333 !! article
10334 Template:templateasargtestnum
10335 !! text
10336 {{{{{1}}}}}
10337 !! endarticle
10338
10339 !! article
10340 Template:templateasargtest
10341 !! text
10342 {{template{{{templ}}}}}
10343 !! endarticle
10344
10345 !! article
10346 Template:templateasargtest2
10347 !! text
10348 {{{{{templ}}}}}
10349 !! endarticle
10350
10351 !! test
10352 Template with template name as unnamed argument
10353 !! wikitext
10354 {{templateasargtestnum|templatesimple}}
10355 !! html
10356 <p>(test)
10357 </p>
10358 !! end
10359
10360 !! test
10361 Template with template name as argument
10362 !! wikitext
10363 {{templateasargtest|templ=simple}}
10364 !! html
10365 <p>(test)
10366 </p>
10367 !! end
10368
10369 !! test
10370 Template with template name as argument (2)
10371 !! wikitext
10372 {{templateasargtest2|templ=templatesimple}}
10373 !! html
10374 <p>(test)
10375 </p>
10376 !! end
10377
10378 !! article
10379 Template:templateasargtestdefault
10380 !! text
10381 {{{{{templ|templatesimple}}}}}
10382 !! endarticle
10383
10384 !! article
10385 Template:templa
10386 !! text
10387 '''templ'''
10388 !! endarticle
10389
10390 !! test
10391 Template with default value
10392 !! wikitext
10393 {{templateasargtestdefault}}
10394 !! html
10395 <p>(test)
10396 </p>
10397 !! end
10398
10399 !! test
10400 Template with default value (value set)
10401 !! wikitext
10402 {{templateasargtestdefault|templ=templa}}
10403 !! html
10404 <p><b>templ</b>
10405 </p>
10406 !! end
10407
10408 !! test
10409 Template redirect
10410 !! wikitext
10411 {{templateredirect}}
10412 !! html/php
10413 <p>(test)
10414 </p>
10415 !! html/parsoid
10416 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10417 !! end
10418
10419 !! test
10420 Template with argument in separate line
10421 !! wikitext
10422 {{ templateasargtest |
10423 templ = simple }}
10424 !! html
10425 <p>(test)
10426 </p>
10427 !! end
10428
10429 !! test
10430 Template with complex template as argument
10431 !! wikitext
10432 {{paramtest|
10433 param ={{ templateasargtest |
10434 templ = simple }}}}
10435 !! html
10436 <p>This is a test template with parameter (test)
10437 </p>
10438 !! end
10439
10440 !! test
10441 Template with thumb image (with link in description)
10442 !! wikitext
10443 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10444 !! html/php
10445 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>
10446
10447 !! html+tidy
10448 <p>This is a test template with parameter</p>
10449 <div class="thumb tright">
10450 <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>
10451 <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>
10452 </div>
10453 </div>
10454 !! html/parsoid
10455 <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>
10456 !! end
10457
10458 !! article
10459 Template:complextemplate
10460 !! text
10461 {{{1}}} {{paramtest|
10462 param ={{{param}}}}}
10463 !! endarticle
10464
10465 !! test
10466 Template with complex arguments
10467 !! wikitext
10468 {{complextemplate|
10469 param ={{ templateasargtest |
10470 templ = simple }}|[[Template:complextemplate|link]]}}
10471 !! html
10472 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10473 </p>
10474 !! end
10475
10476 !! test
10477 BUG 553: link with two variables in a piped link
10478 !! wikitext
10479 {|
10480 |[[{{{1}}}|{{{2}}}]]
10481 |}
10482 !! html/php
10483 <table>
10484 <tr>
10485 <td>[[{{{1}}}|{{{2}}}]]
10486 </td></tr></table>
10487
10488 !! html/parsoid
10489 <table>
10490 <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>
10491 !! end
10492
10493 # See: T2553
10494 !! test
10495 Abort table cell attribute parsing on wikilink
10496 !! wikitext
10497 {|
10498 | testing [[one|two]] | three || four
10499 | testing one two | three || four
10500 |}
10501 !! html/php
10502 <table>
10503 <tr>
10504 <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>
10505 <td> four
10506 </td>
10507 <td> three </td>
10508 <td> four
10509 </td></tr></table>
10510
10511 !! html/parsoid
10512 <table>
10513 <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>
10514 <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>
10515 </tbody></table>
10516 !! end
10517
10518 !! test
10519 Don't abort table cell attribute parsing if wikilink is found in template arg
10520 !! wikitext
10521 {|
10522 | Test {{#tag:ref|One two "[[three]]" four}}
10523 |}
10524 !! html/parsoid
10525 <table>
10526 <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>
10527 </tbody></table>
10528 !! end
10529
10530 !! test
10531 Magic variable as template parameter
10532 !! wikitext
10533 {{paramtest|param={{SITENAME}}}}
10534 !! html
10535 <p>This is a test template with parameter MediaWiki
10536 </p>
10537 !! end
10538
10539 !! article
10540 Template:linktest
10541 !! text
10542 [[{{{param}}}|link]]
10543 !! endarticle
10544
10545 !! test
10546 Template parameter as link source
10547 !! wikitext
10548 {{linktest|param=Main Page}}
10549 !! html
10550 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10551 </p>
10552 !! end
10553
10554 !!article
10555 Template:paramtest2
10556 !! text
10557 including another template, {{paramtest|param={{{arg}}}}}
10558 !! endarticle
10559
10560 !! test
10561 Template passing argument to another template
10562 !! wikitext
10563 {{paramtest2|arg='hmm'}}
10564 !! html
10565 <p>including another template, This is a test template with parameter 'hmm'
10566 </p>
10567 !! end
10568
10569 !! article
10570 Template:Linktest2
10571 !! text
10572 Main Page
10573 !! endarticle
10574
10575 !! test
10576 Template as link source
10577 !! wikitext
10578 [[{{linktest2}}]]
10579
10580 [[{{linktest2}}|Main Page]]
10581
10582 [[{{linktest2}}]]Page
10583 !! html
10584 <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>
10586 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10587 </p>
10588 !! end
10589
10590
10591 !! article
10592 Template:loop1
10593 !! text
10594 {{loop2}}
10595 !! endarticle
10596
10597 !! article
10598 Template:loop2
10599 !! text
10600 {{loop1}}
10601 !! endarticle
10602
10603 !! test
10604 Template infinite loop
10605 !! wikitext
10606 {{loop1}}
10607 !! html
10608 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10609 </p>
10610 !! end
10611
10612 !! test
10613 Template from main namespace
10614 !! wikitext
10615 {{:Main Page}}
10616 !! html
10617 <p>blah blah
10618 </p>
10619 !! end
10620
10621 !! article
10622 Template:table
10623 !! text
10624 {|
10625 | 1 || 2
10626 |-
10627 | 3 || 4
10628 |}
10629 !! endarticle
10630
10631 !! test
10632 BUG 529: Template with table, not included at beginning of line
10633 !! wikitext
10634 foo {{table}}
10635 !! html
10636 <p>foo
10637 </p>
10638 <table>
10639 <tr>
10640 <td> 1 </td>
10641 <td> 2
10642 </td></tr>
10643 <tr>
10644 <td> 3 </td>
10645 <td> 4
10646 </td></tr></table>
10647
10648 !! end
10649
10650 !! test
10651 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10652 !! wikitext
10653 foo
10654 {{table}}
10655 !! html
10656 <p>foo
10657 </p>
10658 <table>
10659 <tr>
10660 <td> 1 </td>
10661 <td> 2
10662 </td></tr>
10663 <tr>
10664 <td> 3 </td>
10665 <td> 4
10666 </td></tr></table>
10667
10668 !! end
10669
10670 !! test
10671 BUG 41: Template parameters shown as broken links
10672 !! wikitext
10673 {{{parameter}}}
10674 !! html
10675 <p>{{{parameter}}}
10676 </p>
10677 !! end
10678
10679 !! test
10680 Template with targets containing wikilinks
10681 !! wikitext
10682 {{[[foo]]}}
10683
10684 {{[[{{echo|foo}}]]}}
10685
10686 {{{{echo|[[foo}}]]}}
10687 !! html
10688 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10689 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10690 </p><p>{{[[foo}}]]
10691 </p>
10692 !! end
10693
10694 !! article
10695 Template:''
10696 !! text
10697 bar
10698 !! endarticle
10699
10700 !! test
10701 Templates: Double quotes as template target
10702 !! wikitext
10703 foo {{''}} baz
10704 !! html/php
10705 <p>foo bar baz
10706 </p>
10707 !! html/parsoid
10708 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10709 </p>
10710 !! end
10711
10712 ## This test is about making sure Parsoid's data-mw is well formed in the
10713 ## face of multiple templates with intersecting and overlapping ranges. The
10714 ## wikitext itself is wretched.
10715 !! test
10716 Templates with intersecting and overlapping ranges
10717 !! wikitext
10718 {|{{echo|
10719 <p>ha</p>}}
10720 {|{{echo|
10721 <p>ho</p>}}
10722 {{echo|{{!}}hi}}
10723 |}
10724 !! html/php+tidy
10725 <p>ha</p>
10726 <p>ho</p>
10727 <table>
10728 <tr>
10729 <td></td>
10730 </tr>
10731 <tr>
10732 <td>hi</td>
10733 </tr>
10734 </table>
10735 <table>
10736 <tr>
10737 <td></td>
10738 </tr>
10739 </table>
10740 !! html/parsoid
10741 <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":""}]]}'>
10742
10743 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
10744
10745 <tbody><tr><td>hi</td></tr>
10746 </tbody></table>
10747 !! end
10748
10749 !! article
10750 Template:MSGNW test
10751 !! text
10752 ''None'' of '''this''' should be
10753 * interpreted
10754 but rather passed unmodified
10755 {{test}}
10756 <gallery>
10757 File:Foobar.jpg
10758 </gallery>
10759 <!-- comment -->
10760 !! endarticle
10761
10762 # hmm, fix this or just deprecate msgnw and document its behavior?
10763 !! test
10764 msgnw keyword
10765 !! wikitext
10766 {{msgnw:MSGNW test}}
10767 !! html/php
10768 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10769 &#42; interpreted
10770 &#32;but rather passed unmodified
10771 &#123;&#123;test&#125;&#125;
10772 &#60;gallery&#62;
10773 File:Foobar.jpg
10774 &#60;/gallery&#62;
10775 &#60;!-- comment --&#62;
10776 </p>
10777 !! end
10778
10779 !! test
10780 int keyword
10781 !! wikitext
10782 {{int:youhavenewmessages|lots of money|not!}}
10783 !! html
10784 <p>You have lots of money (not!).
10785 </p>
10786 !! end
10787
10788 !! test
10789 int keyword - non-existing message
10790 !! wikitext
10791 {{int:var}}
10792 !! html
10793 <p>&lt;var&gt;
10794 </p>
10795 !! end
10796
10797 !! article
10798 Template:Includes
10799 !! text
10800 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10801 !! endarticle
10802
10803 !! test
10804 <includeonly> and <noinclude> being included
10805 !! wikitext
10806 {{Includes}}
10807 !! html
10808 <p>Foobar
10809 </p>
10810 !! end
10811
10812 !! article
10813 Template:Includes2
10814 !! text
10815 <onlyinclude>Foo</onlyinclude>bar
10816 !! endarticle
10817
10818 !! test
10819 <onlyinclude> being included
10820 !! wikitext
10821 {{Includes2}}
10822 !! html
10823 <p>Foo
10824 </p>
10825 !! end
10826
10827
10828 !! article
10829 Template:Includes3
10830 !! text
10831 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10832 !! endarticle
10833
10834 !! test
10835 <onlyinclude> and <includeonly> being included
10836 !! wikitext
10837 {{Includes3}}
10838 !! html
10839 <p>Foo
10840 </p>
10841 !! end
10842
10843 !! test
10844 <includeonly> and <noinclude> on a page
10845 !! wikitext
10846 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10847 !! html
10848 <p>Foozar
10849 </p>
10850 !! end
10851
10852 !! test
10853 Un-closed <noinclude>
10854 !! wikitext
10855 <noinclude>
10856 !! html
10857 !! end
10858
10859 !! test
10860 <onlyinclude> on a page
10861 !! wikitext
10862 <onlyinclude>Foo</onlyinclude>bar
10863 !! html
10864 <p>Foobar
10865 </p>
10866 !! end
10867
10868 !! test
10869 Un-closed <onlyinclude>
10870 !! wikitext
10871 <onlyinclude>
10872 !! html
10873 !! end
10874
10875 !!test
10876 Self-closed noinclude, includeonly, onlyinclude tags
10877 !! wikitext
10878 <noinclude />
10879 <includeonly />
10880 <onlyinclude />
10881 !! html
10882 <p><br />
10883 </p>
10884 !!end
10885
10886 !!test
10887 Unbalanced includeonly and noinclude tags
10888 !! wikitext
10889 {|
10890 |a</noinclude>
10891 |b</noinclude></noinclude>
10892 |c</noinclude></includeonly>
10893 |d</includeonly></includeonly>
10894 |}
10895 !! html
10896 <table>
10897 <tr>
10898 <td>a
10899 </td>
10900 <td>b
10901 </td>
10902 <td>c&lt;/includeonly&gt;
10903 </td>
10904 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10905 </td></tr></table>
10906
10907 !!end
10908
10909 !! article
10910 Template:Includeonly section
10911 !! text
10912 <includeonly>
10913 ==Includeonly section==
10914 </includeonly>
10915 ==Section T-1==
10916 !!endarticle
10917
10918 !! test
10919 Bug 6563: Edit link generation for section shown by <includeonly>
10920 !! wikitext
10921 {{includeonly section}}
10922 !! html
10923 <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>
10924 <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>
10925
10926 !! end
10927
10928 # Uses same input as the contents of [[Template:Includeonly section]]
10929 !! test
10930 Bug 6563: Section extraction for section shown by <includeonly>
10931 !! options
10932 section=T-2
10933 !! wikitext
10934 <includeonly>
10935 ==Includeonly section==
10936 </includeonly>
10937 ==Section T-2==
10938 !! html
10939 ==Section T-2==
10940 !! end
10941
10942 !! test
10943 Bug 6563: Edit link generation for section suppressed by <includeonly>
10944 !! wikitext
10945 <includeonly>
10946 ==Includeonly section==
10947 </includeonly>
10948 ==Section 1==
10949 !! html
10950 <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>
10951
10952 !! end
10953
10954 !! test
10955 Bug 6563: Section extraction for section suppressed by <includeonly>
10956 !! options
10957 section=1
10958 !! wikitext
10959 <includeonly>
10960 ==Includeonly section==
10961 </includeonly>
10962 ==Section 1==
10963 !! html
10964 ==Section 1==
10965 !! end
10966
10967 !! test
10968 Un-closed <includeonly>
10969 !! wikitext
10970 <includeonly>
10971 !! html
10972 <p>&lt;includeonly&gt;
10973 </p>
10974 !! end
10975
10976 ## We used to, but no longer wt2wt this test since the default serializer
10977 ## will normalize the include directives to serialize on their own line.
10978 ## Selser will take care of preserving formatting in scenarios where they
10979 ## intermingled with other wikitext.
10980 !! test
10981 Includes and comments at SOL
10982 !! options
10983 parsoid=wt2html,html2html
10984 !! wikitext
10985 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10986
10987 <noinclude>
10988 some
10989 </noinclude>* stuff
10990 * here
10991
10992 <includeonly>can have stuff</includeonly>=== here ===
10993
10994 !! html/php
10995 <h2><span class="mw-headline" id="hu">hu</span></h2>
10996 <p>some
10997 </p>
10998 <ul><li> stuff</li>
10999 <li> here</li></ul>
11000 <h3><span class="mw-headline" id="here">here</span></h3>
11001
11002 !! html/parsoid
11003 <!-- 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>
11004
11005 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11006 <p>some</p>
11007 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11008 <li> here</li></ul>
11009
11010 <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>
11011
11012 !! end
11013
11014 # TODO: test with DOM fragment reuse!
11015 !! test
11016 Parsoid: DOM fragment reuse
11017 !! options
11018 parsoid=wt2wt,wt2html
11019 !! wikitext
11020 a{{echo|b<table></table>c}}d
11021
11022 a{{echo|b
11023 <table></table>
11024 c}}d
11025
11026 {{echo|a
11027
11028 <table></table>
11029
11030 b}}
11031 !! html
11032 <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>
11033
11034 <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">
11035 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11036 </span><p about="#mwt2">cd</p>
11037
11038 <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">
11039
11040 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11041
11042 </span><p about="#mwt3">b</p>
11043 !! end
11044
11045 !! test
11046 Parsoid: Merge double tds (T52603)
11047 !! options
11048 parsoid
11049 !! wikitext
11050 {|
11051 |{{echo|{{!}} foo}}
11052 |}
11053 !! html
11054 <table><tbody>
11055 <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>
11056 </tbody></table>
11057 !! end
11058
11059 !! test
11060 Parsoid: Merge double tds in nested transclusion content (T52603)
11061 !! options
11062 parsoid
11063 !! wikitext
11064 {{echo|<div>}}
11065 {|
11066 |{{echo|{{!}} foo}}
11067 |}
11068 {{echo|</div>}}
11069 !! html
11070 <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}}]}'>
11071 <table><tbody>
11072 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11073 </tbody></table>
11074 </div>
11075 !! end
11076
11077 ###
11078 ### <includeonly> and <noinclude> in attributes
11079 ###
11080 !!test
11081 0. includeonly around the entire attribute
11082 !! wikitext
11083 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11084 !! html
11085 <p><span id="v2">bar</span>
11086 </p>
11087 !!end
11088
11089 !!test
11090 1. includeonly in html attr key
11091 !! wikitext
11092 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11093 !! html
11094 <p><span id="foo">bar</span>
11095 </p>
11096 !!end
11097
11098 !!test
11099 2. includeonly in html attr value
11100 !! wikitext
11101 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11102 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11103 !! html
11104 <p><span id="v1">bar</span>
11105 <span id="v1">bar</span>
11106 </p>
11107 !!end
11108
11109 !!test
11110 3. includeonly in part of an attr value
11111 !! wikitext
11112 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11113 !! html
11114 <p><span style="color:red;">bar</span>
11115 </p>
11116 !!end
11117
11118 !!test
11119 4. includeonly in table attributes
11120 !! wikitext
11121 {|
11122 |- <noinclude>
11123 |-
11124 |a
11125 </noinclude>
11126 |- <includeonly>
11127 |-
11128 |b
11129 </includeonly>
11130 |}
11131 !! html
11132 <table>
11133
11134
11135 <tr>
11136 <td>a
11137 </td></tr>
11138 </table>
11139
11140 !!end
11141
11142 ###
11143 ### Token Stream Patcher tests
11144 ###
11145 ### These tests won't always pass wt2wt and other modes because
11146 ### on serialization, the table will be output on a new line.
11147 ### For now, we are blacklisting them, and using this to test selser.
11148 ###
11149
11150 !!test
11151 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11152 !!options
11153 parsoid=wt2html,wt2wt
11154 !!wikitext
11155 {{echo|}}{| width = '100%'
11156 |foo
11157 |}
11158 !!html/parsoid
11159 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11160 <tbody><tr><td>foo</td></tr>
11161 </tbody></table>
11162 !!end
11163
11164 ## We used to, but no longer wt2wt this test since the default serializer
11165 ## will normalize the include directives to serialize on their own line.
11166 ## Selser will take care of preserving formatting in scenarios where they
11167 ## intermingled with other wikitext.
11168 !!test
11169 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11170 !!options
11171 parsoid=wt2html
11172 !!wikitext
11173 <includeonly>a</includeonly>{| {{{b}}}
11174 |c
11175 |}
11176 !!html/parsoid
11177 <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}}}":""}}'>
11178 <tbody><tr><td>c</td></tr>
11179 </tbody></table>
11180
11181 !!end
11182
11183 ###
11184 ### Testing parsing of templates where a template arg
11185 ### has the same name as the template itself.
11186 ###
11187
11188 !! article
11189 Template:quote
11190 !! text
11191 {{{quote|{{{1}}}}}}
11192 !! endarticle
11193
11194 !!test
11195 Templates: Template Name/Arg clash: 1. Use of positional param
11196 !! wikitext
11197 {{quote|foo}}
11198 !! html
11199 <p>foo
11200 </p>
11201 !!end
11202
11203 !!test
11204 Templates: Template Name/Arg clash: 2. Use of named param
11205 !! wikitext
11206 {{quote|quote=foo}}
11207 !! html
11208 <p>foo
11209 </p>
11210 !!end
11211
11212 !!test
11213 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11214 !! wikitext
11215 {{quote|quote}}
11216 !! html
11217 <p>quote
11218 </p>
11219 !!end
11220
11221 ###
11222 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11223 ###
11224
11225 !!test
11226 Templates: 1. Simple use
11227 !! wikitext
11228 {{echo|Foo}}
11229 !! html
11230 <p>Foo
11231 </p>
11232 !!end
11233
11234 !!test
11235 Templates: 2. Inside a block tag
11236 !! wikitext
11237 <div>{{echo|Foo}}</div>
11238 <blockquote>{{echo|Foo}}</blockquote>
11239 !! html
11240 <div>Foo</div>
11241 <blockquote>Foo</blockquote>
11242
11243 !! html+tidy
11244 <div>Foo</div>
11245 <blockquote>
11246 <p>Foo</p>
11247 </blockquote>
11248 !!end
11249
11250 !!test
11251 Templates: P-wrapping: 1a. Templates on consecutive lines
11252 !! wikitext
11253 {{echo|Foo}}
11254 {{echo|bar}}
11255 !! html
11256 <p>Foo
11257 bar
11258 </p>
11259 !!end
11260
11261 !!test
11262 Templates: P-wrapping: 1b. Templates on consecutive lines
11263 !! wikitext
11264 Foo
11265
11266 {{echo|bar}}
11267 {{echo|baz}}
11268 !! html
11269 <p>Foo
11270 </p><p>bar
11271 baz
11272 </p>
11273 !!end
11274
11275 !!test
11276 Templates: P-wrapping: 1c. Templates on consecutive lines
11277 !! wikitext
11278 {{echo|Foo}}
11279 {{echo|bar}} <div>baz</div>
11280 !! html
11281 <p>Foo
11282 </p>
11283 bar <div>baz</div>
11284
11285 !! html+tidy
11286 <p>Foo</p>
11287 <p>bar</p>
11288 <div>baz</div>
11289 !! end
11290
11291 !!test
11292 Templates: P-wrapping: 1d. Template preceded by comment-only line
11293 !!options
11294 parsoid
11295 !! wikitext
11296 <!-- foo -->
11297 {{echo|Bar}}
11298 !! html
11299 <!-- foo -->
11300
11301 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11302 !!end
11303
11304 !!test
11305 Templates: Inline Text: 1. Multiple template uses
11306 !! wikitext
11307 {{echo|Foo}}bar{{echo|baz}}
11308 !! html
11309 <p>Foobarbaz
11310 </p>
11311 !!end
11312
11313 !!test
11314 Templates: Inline Text: 2. Back-to-back template uses
11315 !! wikitext
11316 {{echo|Foo}}{{echo|bar}}
11317 !! html
11318 <p>Foobar
11319 </p>
11320 !!end
11321
11322 !!test
11323 Templates: Block Tags: 1. Multiple template uses
11324 !! wikitext
11325 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11326 !! html
11327 <div>Foo</div><div>bar</div><div>baz</div>
11328
11329 !!end
11330
11331 !!test
11332 Templates: Block Tags: 2. Back-to-back template uses
11333 !! wikitext
11334 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11335 !! html
11336 <div>Foo</div><div>bar</div>
11337
11338 !!end
11339
11340 # This is an edge case relating to paragraph wrapping.
11341 !!test
11342 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11343 !! wikitext
11344 {{echo|a
11345 b</p>}}
11346 !! html/parsoid
11347 <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
11348 b</p>
11349 !!end
11350
11351 !!test
11352 Templates: Links: 1. Simple example
11353 !! wikitext
11354 {{echo|[[Foo|bar]]}}
11355 !! html
11356 <p><a href="/wiki/Foo" title="Foo">bar</a>
11357 </p>
11358 !!end
11359
11360 !!test
11361 Templates: Links: 2. Generation of link href
11362 !! wikitext
11363 [[{{echo|Foo}}|bar]]
11364 !! html
11365 <p><a href="/wiki/Foo" title="Foo">bar</a>
11366 </p>
11367 !!end
11368
11369 !!test
11370 Templates: Links: 3. Generation of part of a link href
11371 !! wikitext
11372 [[Fo{{echo|o}}|bar]]
11373
11374 [[Foo{{echo|bar}}]]
11375
11376 [[Foo{{echo|bar}}baz]]
11377
11378 [[Foo{{echo|bar}}|bar]]
11379
11380 [[:Foo{{echo|bar}}]]
11381
11382 [[:Foo{{echo|bar}}|bar]]
11383 !! html
11384 <p><a href="/wiki/Foo" title="Foo">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=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11387 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11388 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11389 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11390 </p>
11391 !!end
11392
11393 !!test
11394 Templates: Links: 4. Multiple templates generating link href
11395 !! wikitext
11396 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11397 !! html
11398 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11399 </p>
11400 !!end
11401
11402 !!test
11403 Templates: Links: 5. Generation of link text
11404 !! wikitext
11405 [[Foo|{{echo|bar}}]]
11406 !! html
11407 <p><a href="/wiki/Foo" title="Foo">bar</a>
11408 </p>
11409 !!end
11410
11411 !!test
11412 Templates: Links: 5. Nested templates (only outermost template should be marked)
11413 !! wikitext
11414 {{echo|[[{{echo|Foo}}|bar]]}}
11415 !! html
11416 <p><a href="/wiki/Foo" title="Foo">bar</a>
11417 </p>
11418 !!end
11419
11420 !!test
11421 Templates: HTML Tag: 1. Generation of HTML attr. key
11422 !! wikitext
11423 <div {{echo|style}}="color:red;">foo</div>
11424 !! html
11425 <div style="color:red;">foo</div>
11426
11427 !!end
11428
11429 !!test
11430 Templates: HTML Tag: 2. Generation of HTML attr. value
11431 !! wikitext
11432 <div style={{echo|'color:red;'}}>foo</div>
11433 !! html
11434 <div style="color:red;">foo</div>
11435
11436 !!end
11437
11438 !!test
11439 Templates: HTML Tag: 3. Generation of HTML attr key and value
11440 !! wikitext
11441 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11442 !! html
11443 <div style="color:red;">foo</div>
11444
11445 !!end
11446
11447 !!test
11448 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11449 !! wikitext
11450 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11451 !! html
11452 <div title="This is a long title with just one piece templated">foo</div>
11453
11454 !!end
11455
11456 !!test
11457 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11458 !! wikitext
11459 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11460 !! html
11461 <div title="This is a long title with just one piece templated">foo</div>
11462
11463 !!end
11464
11465 !!test
11466 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11467 !! wikitext
11468 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11469 !! html
11470 <div title="This is a long title with just one piece templated">foo</div>
11471
11472 !!end
11473
11474 # SSS FIXME: While it is great we added support for all this,
11475 # do we want to make this part of the spec? Maybe we want to
11476 # deprecate this kind of usage in the future?
11477 !!test
11478 Templates: HTML Tag: 7. Generation of partial attribute key string
11479 !! wikitext
11480 <div st{{echo|yle}}="color:red;">foo</div>
11481 !! html
11482 <div style="color:red;">foo</div>
11483
11484 !!end
11485
11486 !! test
11487 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11488 !! wikitext
11489 <div {{echo|1=id="v1"}}>bar</div>
11490 !! html
11491 <div id="v1">bar</div>
11492
11493 !!end
11494
11495 !! test
11496 Templates: HTML Tag: 9. Multiple template-generated attributes
11497 !! wikitext
11498 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11499 !! html
11500 <div id="v1" title="foo">bar</div>
11501
11502 !!end
11503
11504 !! test
11505 Templates: Support for templates generating attributes and content
11506 !! wikitext
11507 {| {{mixed_attr_content_template}}
11508 |-
11509 |bar
11510 |}
11511 !! html/php
11512 <table style="color:red;" title="T48811">
11513
11514 <tr>
11515 <td>foo
11516 </td></tr>
11517 <tr>
11518 <td>bar
11519 </td></tr></table>
11520
11521 !! html/parsoid
11522 <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|}"]}'>
11523 <tbody><tr>
11524 <td>foo</td></tr>
11525 <tr>
11526 <td>bar</td></tr>
11527 </tbody></table>
11528 !!end
11529
11530 !! test
11531 1. Entities and nowikis inside templated attributes should be handled correctly
11532 !! wikitext
11533 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11534 !! html/php
11535 <div style="background:#f9f9f9;">foo</div>
11536
11537 !! html/parsoid
11538 <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>
11539 !! end
11540
11541 !! test
11542 2. Entities and nowikis inside templated attributes should be handled correctly
11543 !! wikitext
11544 {|
11545 |{{table_attribs_3}}
11546 |}
11547 !! html/php
11548 <table>
11549 <tr>
11550 <td style="background:#f9f9f9;">Foo
11551 </td></tr></table>
11552
11553 !! html/parsoid
11554 <table>
11555 <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>
11556 </tbody></table>
11557 !! end
11558
11559 !! test
11560 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11561 !! wikitext
11562 {{tbl-start}}
11563 |{{table_attribs_3}}
11564 {{tbl-end}}
11565 !! html/php
11566 <table>
11567 <tr>
11568 <td style="background:#f9f9f9;">Foo
11569 </td></tr></table>
11570
11571 !! html/parsoid
11572 <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}}]}'>
11573 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11574 </tbody></table>
11575 !! end
11576
11577 # T107622
11578 !! test
11579 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11580 !! wikitext
11581 {|
11582 | {{table_attribs_6}} hi
11583 |}
11584 !! html/php
11585 <table>
11586 <tr>
11587 <td style="background: red;"> hi
11588 </td></tr></table>
11589
11590 !! html/parsoid
11591 <table>
11592 <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>
11593 </tbody></table>
11594 !! end
11595
11596 !!test
11597 Templates: HTML Tables: 1. Generating start of a HTML table
11598 !! wikitext
11599 {{echo|<table><tr><td>foo</td>}}</tr></table>
11600 !! html
11601 <table><tr><td>foo</td></tr></table>
11602
11603 !!end
11604
11605 !!test
11606 Templates: HTML Tables: 2a. Generating middle of a HTML table
11607 !! wikitext
11608 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11609 !! html
11610 <table><tr><td>foo</td></tr></table>
11611
11612 !!end
11613
11614 !!test
11615 Templates: HTML Tables: 2b. Generating middle of a HTML table
11616 !! wikitext
11617 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11618 !! html
11619 <table><tr><td>foo</td></tr></table>
11620
11621 !!end
11622
11623 !!test
11624 Templates: HTML Tables: 3. Generating end of a HTML table
11625 !! wikitext
11626 <table><tr>{{echo|<td>foo</td></tr></table>}}
11627 !! html
11628 <table><tr><td>foo</td></tr></table>
11629
11630 !!end
11631
11632 !!test
11633 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11634 !! wikitext
11635 {{echo|<table>}}<tr><td>foo</td></tr></table>
11636 !! html
11637 <table><tr><td>foo</td></tr></table>
11638
11639 !!end
11640
11641 !!test
11642 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11643 !! wikitext
11644 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11645 !! html
11646 <table><tr><td>foo</td></tr></table>
11647
11648 !!end
11649
11650 !!test
11651 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11652 !! wikitext
11653 <table><tr>{{echo|<td>}}foo</td></tr></table>
11654 !! html
11655 <table><tr><td>foo</td></tr></table>
11656
11657 !!end
11658
11659 !!test
11660 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11661 !! wikitext
11662 <table><tr><td>foo{{echo|</td>}}</tr></table>
11663 !! html
11664 <table><tr><td>foo</td></tr></table>
11665
11666 !!end
11667
11668 !!test
11669 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11670 !! wikitext
11671 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11672 !! html
11673 <table><tr><td>foo</td></tr></table>
11674
11675 !!end
11676
11677 !!test
11678 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11679 !! wikitext
11680 <table><tr><td>foo</td></tr>{{echo|</table>}}
11681 !! html
11682 <table><tr><td>foo</td></tr></table>
11683
11684 !!end
11685
11686 !!test
11687 Templates: HTML Tables: 5. Proper fostering of categories from inside
11688 !!options
11689 parsoid=wt2html,wt2wt
11690 !! wikitext
11691 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11692 <!--Two categories (Bug 50330)-->
11693 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11694 !! html
11695 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11696 <!--Two categories (Bug 50330)-->
11697 <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>
11698 !!end
11699
11700 !!test
11701 Templates: Wiki Tables: 1a. Fostering of entire template content
11702 !! wikitext
11703 {|
11704 {{echo|a}}
11705 |}
11706 !! html
11707 <table>
11708 a
11709 <tr><td></td></tr></table>
11710
11711 !! html+tidy
11712 <p>a</p>
11713 <table>
11714 <tr>
11715 <td></td>
11716 </tr>
11717 </table>
11718 !! end
11719
11720 !!test
11721 Templates: Wiki Tables: 1b. Fostering of entire template content
11722 !! wikitext
11723 {|
11724 {{echo|<div>}}
11725 foo
11726 {{echo|</div>}}
11727 |}
11728 !! html
11729 <table>
11730 <div>
11731 <p>foo
11732 </p>
11733 </div>
11734 <tr><td></td></tr></table>
11735
11736 !! html+tidy
11737 <div>
11738 <p>foo</p>
11739 </div>
11740 <table>
11741 <tr>
11742 <td></td>
11743 </tr>
11744 </table>
11745 !! end
11746
11747 !!test
11748 Templates: Wiki Tables: 2. Fostering of partial template content
11749 !! wikitext
11750 {|
11751 {{echo|a
11752 <div>b</div>}}
11753 |}
11754 !! html
11755 <table>
11756 a
11757 <div>b</div>
11758 <tr><td></td></tr></table>
11759
11760 !! html+tidy
11761 <p>a</p>
11762 <div>b</div>
11763 <table>
11764 <tr>
11765 <td></td>
11766 </tr>
11767 </table>
11768 !! end
11769
11770 !!test
11771 Templates: Wiki Tables: 3. td-content via multiple templates
11772 !! wikitext
11773 {|
11774 {{echo|{{pipe}}a}}{{echo|b}}
11775 |}
11776 !! html
11777 <table>
11778 <tr>
11779 <td>ab
11780 </td></tr></table>
11781
11782 !!end
11783
11784 !!test
11785 Templates: Wiki Tables: 4. Templated tags, no content
11786 !! wikitext
11787 {{tbl-start}}
11788 {{tbl-end}}
11789 !! html
11790 <table>
11791 <tr><td></td></tr></table>
11792
11793 !!end
11794
11795 !!test
11796 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11797 !! wikitext
11798 {{tbl-start}}
11799 |foo
11800 {{tbl-end}}
11801 !! html
11802 <table>
11803 <tr>
11804 <td>foo
11805 </td></tr></table>
11806
11807 !!end
11808
11809 !!test
11810 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11811 !! wikitext
11812 {{tbl-start}}
11813 {{!}}foo
11814 {{tbl-end}}
11815 !! html
11816 <table>
11817 <tr>
11818 <td>foo
11819 </td></tr></table>
11820
11821 !!end
11822
11823 ## This test case is very specific to Parsoid's internals
11824 ## and is hence only tested for Parsoid's code. Parsoid uses
11825 ## a <meta> marker tag for <ref> tags and they are expanded
11826 ## much later. We are verifying that this <meta> tag usage
11827 ## doesn't prevent foster parenting.
11828 !!test
11829 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11830 !!wikitext
11831 {{PartialTable}}<ref>foo</ref>
11832 |}
11833
11834 <references />
11835 !!html/parsoid
11836 <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">
11837 <tbody>
11838 </tbody></table>
11839
11840 <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>
11841 !!end
11842
11843 !! test
11844 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11845 !! wikitext
11846 {{echo|
11847 {{{!}}
11848 {{!}}-}}
11849 <onlyinclude>
11850 |foo
11851 </onlyinclude>
11852 {{!}}}
11853 !! html/parsoid
11854 <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{{!}}}"]}'>
11855 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11856 <tbody><tr>
11857
11858 <td>foo
11859 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11860 </tbody></table>
11861 !! end
11862
11863 !!test
11864 Templates: Lists: Multi-line list-items via templates
11865 !! wikitext
11866 *{{echo|a {{nonexistent|
11867 unused}}}}
11868 *{{echo|b {{nonexistent|
11869 unused}}}}
11870 !! html
11871 <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>
11872 <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>
11873
11874 !!end
11875
11876 !!test
11877 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11878 !! wikitext
11879 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11880 !! html
11881 <p><i>ab</i>c<i>d</i>e
11882 </p>
11883 !!end
11884
11885 !!test
11886 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11887 (PHP parser generates misnested html)
11888 !! wikitext
11889 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11890 !! html/parsoid
11891 <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>
11892 !!end
11893
11894 !!test
11895 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11896 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11897 !! options
11898 parsoid=wt2html,wt2wt
11899 !! wikitext
11900 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11901 !! html
11902 <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>
11903 <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>
11904 <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>
11905 !!end
11906
11907 !!test
11908 Templates: Ugly nesting: 4. Divs opened/closed across templates
11909 !! wikitext
11910 a<div>b{{echo|c</div>d}}e
11911 !! html
11912 a<div>bc</div>de
11913
11914 !! html+tidy
11915 <p>a</p>
11916 <div>bc</div>
11917 <p>de</p>
11918 !! end
11919
11920 !!test
11921 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11922 (Parsoid-centric)
11923 !! options
11924 parsoid
11925 !! wikitext
11926 {|
11927 |{{echo|foo</table>}}
11928 |bar
11929 |}
11930 !! html
11931 <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|}"]}'>
11932
11933 <tbody>
11934 <tr>
11935 <td>foo</td></tr></tbody></table><span about="#mwt1">
11936 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11937 |}</span>
11938 !!end
11939
11940 !!test
11941 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11942 (Parsoid-centric)
11943 !! options
11944 parsoid
11945 !! wikitext
11946 <table>
11947 <tr>
11948 <td>
11949 <table>
11950 <tr>
11951 <td>1. {{echo|foo </table>}}</td>
11952 <td> bar </td>
11953 <td>2. {{echo|baz </table>}}</td>
11954 </tr>
11955 <tr>
11956 <td>abc</td>
11957 </tr>
11958 </table>
11959 </td>
11960 </tr>
11961 <tr>
11962 <td>xyz</td>
11963 </tr>
11964 </table>
11965 !! html
11966 <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>"]}'>
11967 <tbody><tr>
11968 <td>
11969 <table>
11970 <tbody><tr>
11971 <td>1. foo </td></tr></tbody></table></td>
11972 <td> bar </td>
11973 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11974 </span><span about="#mwt2">
11975 </span><span about="#mwt2">
11976 </span><span about="#mwt2">abc</span><span about="#mwt2">
11977 </span><span about="#mwt2">
11978 </span><span about="#mwt2">
11979 </span><span about="#mwt2">
11980 </span><span about="#mwt2">
11981 </span><span about="#mwt2">
11982 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11983 </span><span about="#mwt2">
11984 </span>
11985 !!end
11986
11987 !! test
11988 Templates: Ugly templates: 3. newline-only template parameter
11989 !! wikitext
11990 foo {{echo|
11991 }}
11992 !! html
11993 <p>foo
11994 </p>
11995 !! end
11996
11997 # This looks like a bug: a single newline triggers p/br for some reason.
11998 !! test
11999 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12000 !! wikitext
12001 {{echo|
12002 }}
12003 !! html
12004 <p><br />
12005 </p>
12006 !! end
12007
12008 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12009 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12010 !! test
12011 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12012 !! wikitext
12013 {{echo|<table>}}
12014 {{echo|<div>foo}}
12015 {{echo|</table>}}
12016 !! html/parsoid
12017 <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
12018 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12019 </table>
12020 !! end
12021
12022 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12023 # that are "identical" and generate nesting cycles in the algorithm
12024 !! test
12025 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12026 !! wikitext
12027 {{echo|<table><tr><td><table>}}
12028 {{echo|<div>}}
12029 {{echo|</div>}}
12030 !! html/parsoid
12031 <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"}'>
12032 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12033 </table></td></tr></tbody></table>
12034 !! end
12035
12036 !! test
12037 Templates: Parameters substituted at the top-level
12038 !! wikitext
12039 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12040 !! html/php
12041 <p><i>who</i> me? <b>never!</b>
12042 </p>
12043 !! html/parsoid
12044 <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>
12045 !! end
12046
12047 !!test
12048 Parser Functions: 1. Simple example
12049 !! wikitext
12050 {{uc:foo}}
12051 !! html
12052 <p>FOO
12053 </p>
12054 !!end
12055
12056 !!test
12057 Parser Functions: 2. Nested use (only outermost should be marked up)
12058 !! wikitext
12059 {{uc:{{lc:FOO}}}}
12060 !! html
12061 <p>FOO
12062 </p>
12063 !!end
12064
12065 ###
12066 ### Pre-save transform tests
12067 ###
12068 !! test
12069 pre-save transform: subst:
12070 !! options
12071 pst
12072 !! wikitext
12073 {{subst:test}}
12074 !! html/php
12075 This is a test template
12076 !! end
12077
12078 !! test
12079 pre-save transform: normal template
12080 !! options
12081 pst
12082 !! wikitext
12083 {{test}}
12084 !! html/php
12085 {{test}}
12086 !! end
12087
12088 !! test
12089 pre-save transform: nonexistent template
12090 !! options
12091 pst
12092 !! wikitext
12093 {{thistemplatedoesnotexist}}
12094 !! html/php
12095 {{thistemplatedoesnotexist}}
12096 !! end
12097
12098 !! test
12099 pre-save transform: subst magic variables
12100 !! options
12101 pst
12102 !! wikitext
12103 {{subst:SITENAME}}
12104 !! html/php
12105 MediaWiki
12106 !! end
12107
12108 # This is bug 89, which I fixed. -- wtm
12109 !! test
12110 pre-save transform: subst: templates with parameters
12111 !! options
12112 pst
12113 !! wikitext
12114 {{subst:paramtest|param="something else"}}
12115 !! html/php
12116 This is a test template with parameter "something else"
12117 !! end
12118
12119 !! article
12120 Template:nowikitest
12121 !! text
12122 <nowiki>'''not wiki'''</nowiki>
12123 !! endarticle
12124
12125 !! test
12126 pre-save transform: nowiki in subst (bug 1188)
12127 !! options
12128 pst
12129 !! wikitext
12130 {{subst:nowikitest}}
12131 !! html/php
12132 <nowiki>'''not wiki'''</nowiki>
12133 !! end
12134
12135 !! article
12136 Template:commenttest
12137 !! text
12138 This template has <!-- a comment --> in it.
12139 !! endarticle
12140
12141 !! test
12142 pre-save transform: comment in subst (bug 1936)
12143 !! options
12144 pst
12145 !! wikitext
12146 {{subst:commenttest}}
12147 !! html/php
12148 This template has <!-- a comment --> in it.
12149 !! end
12150
12151 !! test
12152 pre-save transform: unclosed tag
12153 !! options
12154 pst noxml
12155 !! wikitext
12156 <nowiki>'''not wiki'''
12157 !! html/php
12158 <nowiki>'''not wiki'''
12159 !! end
12160
12161 !! test
12162 pre-save transform: mixed tag case
12163 !! options
12164 pst noxml
12165 !! wikitext
12166 <NOwiki>'''not wiki'''</noWIKI>
12167 !! html/php
12168 <NOwiki>'''not wiki'''</noWIKI>
12169 !! end
12170
12171 !! test
12172 pre-save transform: unclosed comment in <nowiki>
12173 !! options
12174 pst noxml
12175 !! wikitext
12176 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12177 !! html/php
12178 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12179 !!end
12180
12181 # Leading @ in this template definition works around a limitation
12182 # in parsoid's parserTests which otherwise strips the <span> from the
12183 # result (confusing it for a template wrapper)
12184 !! article
12185 Template:dangerous
12186 !!text
12187 @<span onmouseover="alert('crap')">Oh no</span>
12188 !!endarticle
12189
12190 !!test
12191 (confirming safety of fix for subst bug 1936)
12192 !! wikitext
12193 {{Template:dangerous}}
12194 !! html
12195 <p>@<span>Oh no</span>
12196 </p>
12197 !! end
12198
12199 !! test
12200 pre-save transform: comment containing gallery (bug 5024)
12201 !! options
12202 pst
12203 !! wikitext
12204 <!-- <gallery>data</gallery> -->
12205 !! html/php
12206 <!-- <gallery>data</gallery> -->
12207 !!end
12208
12209 !! test
12210 pre-save transform: comment containing extension
12211 !! options
12212 pst
12213 !! wikitext
12214 <!-- <tag>data</tag> -->
12215 !! html/php
12216 <!-- <tag>data</tag> -->
12217 !!end
12218
12219 !! test
12220 pre-save transform: comment containing nowiki
12221 !! options
12222 pst
12223 !! wikitext
12224 <!-- <nowiki>data</nowiki> -->
12225 !! html/php
12226 <!-- <nowiki>data</nowiki> -->
12227 !!end
12228
12229 !! test
12230 pre-save transform: <noinclude> in subst (bug 3298)
12231 !! options
12232 pst
12233 !! wikitext
12234 {{subst:Includes}}
12235 !! html/php
12236 Foobar
12237 !! end
12238
12239 !! test
12240 pre-save transform: <onlyinclude> in subst (bug 3298)
12241 !! options
12242 pst
12243 !! wikitext
12244 {{subst:Includes2}}
12245 !! html/php
12246 Foo
12247 !! end
12248
12249 !! article
12250 Template:SubstTest
12251 !!text
12252 {{<includeonly>subst:</includeonly>Includes}}
12253 !! endarticle
12254
12255 !! article
12256 Template:SafeSubstTest
12257 !! text
12258 {{<includeonly>safesubst:</includeonly>Includes}}
12259 !! endarticle
12260
12261 !! test
12262 bug 22297: safesubst: works during PST
12263 !! options
12264 pst
12265 !! wikitext
12266 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12267 !! html/php
12268 FoobarFoobar
12269 !! end
12270
12271 !! test
12272 bug 22297: safesubst: works during normal parse
12273 !! wikitext
12274 {{SafeSubstTest}}
12275 !! html
12276 <p>Foobar
12277 </p>
12278 !! end
12279
12280 !! test
12281 subst: does not work during normal parse
12282 !! wikitext
12283 {{SubstTest}}
12284 !! html
12285 <p>{{subst:Includes}}
12286 </p>
12287 !! end
12288
12289 !! test
12290 pre-save transform: context links ("pipe trick")
12291 !! options
12292 pst
12293 !! wikitext
12294 [[Article (context)|]]
12295 [[Bar:Article|]]
12296 [[:Bar:Article|]]
12297 [[Bar:Article (context)|]]
12298 [[:Bar:Article (context)|]]
12299 [[|Article]]
12300 [[|Article (context)]]
12301 [[Bar:X (Y) Z|]]
12302 [[:Bar:X (Y) Z|]]
12303 !! html/php
12304 [[Article (context)|Article]]
12305 [[Bar:Article|Article]]
12306 [[:Bar:Article|Article]]
12307 [[Bar:Article (context)|Article]]
12308 [[:Bar:Article (context)|Article]]
12309 [[Article]]
12310 [[Article (context)]]
12311 [[Bar:X (Y) Z|X (Y) Z]]
12312 [[:Bar:X (Y) Z|X (Y) Z]]
12313 !! end
12314
12315 !! test
12316 pre-save transform: context links ("pipe trick") with interwiki prefix
12317 !! options
12318 pst
12319 !! wikitext
12320 [[interwiki:Article|]]
12321 [[:interwiki:Article|]]
12322 [[interwiki:Bar:Article|]]
12323 [[:interwiki:Bar:Article|]]
12324 !! html/php
12325 [[interwiki:Article|Article]]
12326 [[:interwiki:Article|Article]]
12327 [[interwiki:Bar:Article|Bar:Article]]
12328 [[:interwiki:Bar:Article|Bar:Article]]
12329 !! end
12330
12331 !! test
12332 pre-save transform: context links ("pipe trick") with parens in title
12333 !! options
12334 pst title=[[Somearticle (context)]]
12335 !! wikitext
12336 [[|Article]]
12337 !! html/php
12338 [[Article (context)|Article]]
12339 !! end
12340
12341 !! test
12342 pre-save transform: context links ("pipe trick") with comma in title
12343 !! options
12344 pst title=[[Someplace, Somewhere]]
12345 !! wikitext
12346 [[|Otherplace]]
12347 [[Otherplace, Elsewhere|]]
12348 [[Otherplace, Elsewhere, Anywhere|]]
12349 !! html/php
12350 [[Otherplace, Somewhere|Otherplace]]
12351 [[Otherplace, Elsewhere|Otherplace]]
12352 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12353 !! end
12354
12355 !! test
12356 pre-save transform: context links ("pipe trick") with parens and comma
12357 !! options
12358 pst title=[[Someplace (IGNORED), Somewhere]]
12359 !! wikitext
12360 [[|Otherplace]]
12361 [[Otherplace (place), Elsewhere|]]
12362 !! html/php
12363 [[Otherplace, Somewhere|Otherplace]]
12364 [[Otherplace (place), Elsewhere|Otherplace]]
12365 !! end
12366
12367 !! test
12368 pre-save transform: context links ("pipe trick") with comma and parens
12369 !! options
12370 pst title=[[Who, me? (context)]]
12371 !! wikitext
12372 [[|Yes, you.]]
12373 [[Me, Myself, and I (1937 song)|]]
12374 !! html/php
12375 [[Yes, you. (context)|Yes, you.]]
12376 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12377 !! end
12378
12379 !! test
12380 pre-save transform: context links ("pipe trick") with namespace
12381 !! options
12382 pst title=[[Ns:Somearticle]]
12383 !! wikitext
12384 [[|Article]]
12385 !! html/php
12386 [[Ns:Article|Article]]
12387 !! end
12388
12389 !! test
12390 pre-save transform: context links ("pipe trick") with namespace and parens
12391 !! options
12392 pst title=[[Ns:Somearticle (context)]]
12393 !! wikitext
12394 [[|Article]]
12395 !! html/php
12396 [[Ns:Article (context)|Article]]
12397 !! end
12398
12399 !! test
12400 pre-save transform: context links ("pipe trick") with namespace and comma
12401 !! options
12402 pst title=[[Ns:Somearticle, Context, Whatever]]
12403 !! wikitext
12404 [[|Article]]
12405 !! html/php
12406 [[Ns:Article, Context, Whatever|Article]]
12407 !! end
12408
12409 !! test
12410 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12411 !! options
12412 pst title=[[Ns:Somearticle, Context (context)]]
12413 !! wikitext
12414 [[|Article]]
12415 !! html/php
12416 [[Ns:Article (context)|Article]]
12417 !! end
12418
12419 !! test
12420 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12421 !! options
12422 pst title=[[Ns:Somearticle (IGNORED), Context]]
12423 !! wikitext
12424 [[|Article]]
12425 !! html/php
12426 [[Ns:Article, Context|Article]]
12427 !! end
12428
12429 !! test
12430 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12431 !! options
12432 pst
12433 !! wikitext
12434 [[Article(context)|]]
12435 [[Bar:Article(context)|]]
12436 [[:Bar:Article(context)|]]
12437 [[|Article(context)]]
12438 [[Bar:X(Y)Z|]]
12439 [[:Bar:X(Y)Z|]]
12440 !! html/php
12441 [[Article(context)|Article]]
12442 [[Bar:Article(context)|Article]]
12443 [[:Bar:Article(context)|Article]]
12444 [[Article(context)]]
12445 [[Bar:X(Y)Z|X(Y)Z]]
12446 [[:Bar:X(Y)Z|X(Y)Z]]
12447 !! end
12448
12449 !! test
12450 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12451 !! options
12452 pst
12453 !! wikitext
12454 [[Article (context)|]]
12455 [[Bar:Article (context)|]]
12456 [[:Bar:Article (context)|]]
12457 [[|Article (context)]]
12458 [[Bar:X (Y) Z|]]
12459 [[:Bar:X (Y) Z|]]
12460 !! html/php
12461 [[Article (context)|Article]]
12462 [[Bar:Article (context)|Article]]
12463 [[:Bar:Article (context)|Article]]
12464 [[Article (context)]]
12465 [[Bar:X (Y) Z|X (Y) Z]]
12466 [[:Bar:X (Y) Z|X (Y) Z]]
12467 !! end
12468
12469 !! test
12470 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12471 !! options
12472 pst
12473 !! wikitext
12474 [[Article(context)|]]
12475 [[Bar:Article(context)|]]
12476 [[:Bar:Article(context)|]]
12477 [[|Article(context)]]
12478 [[Bar:X(Y)Z|]]
12479 [[:Bar:X(Y)Z|]]
12480 !! html/php
12481 [[Article(context)|Article]]
12482 [[Bar:Article(context)|Article]]
12483 [[:Bar:Article(context)|Article]]
12484 [[Article(context)]]
12485 [[Bar:X(Y)Z|X(Y)Z]]
12486 [[:Bar:X(Y)Z|X(Y)Z]]
12487 !! end
12488
12489 !! test
12490 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12491 !! options
12492 pst
12493 !! wikitext
12494 [[Article (context), context|]]
12495 [[Article (context),context|]]
12496 [[Bar:Article (context), context|]]
12497 [[Bar:Article (context),context|]]
12498 [[:Bar:Article (context), context|]]
12499 [[:Bar:Article (context),context|]]
12500 !! html/php
12501 [[Article (context), context|Article]]
12502 [[Article (context),context|Article]]
12503 [[Bar:Article (context), context|Article]]
12504 [[Bar:Article (context),context|Article]]
12505 [[:Bar:Article (context), context|Article]]
12506 [[:Bar:Article (context),context|Article]]
12507 !! end
12508
12509 !! test
12510 pre-save transform: trim trailing empty lines
12511 !! options
12512 pst
12513 !! wikitext
12514 Empty lines are trimmed
12515
12516
12517
12518
12519 !! html/php
12520 Empty lines are trimmed
12521 !! end
12522
12523 !! test
12524 pre-save transform: Signature expansion
12525 !! options
12526 pst
12527 !! wikitext
12528 * ~~~
12529 * <noinclude>~~~</noinclude>
12530 * <includeonly>~~~</includeonly>
12531 * <onlyinclude>~~~</onlyinclude>
12532 !! html/php
12533 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12534 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12535 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12536 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12537 !! end
12538
12539
12540 !! test
12541 pre-save transform: Signature expansion in nowiki tags (bug 93)
12542 !! options
12543 pst disabled
12544 !! wikitext
12545 Shall not expand:
12546
12547 <nowiki>~~~~</nowiki>
12548
12549 <includeonly><nowiki>~~~~</nowiki></includeonly>
12550
12551 <noinclude><nowiki>~~~~</nowiki></noinclude>
12552
12553 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12554
12555 {{subst:Foo}} shall be converted to FOO
12556
12557 As well as inside noinclude/onlyinclude
12558 <noinclude>{{subst:Foo}}</noinclude>
12559 <onlyinclude>{{subst:Foo}}</onlyinclude>
12560
12561 But not inside includeonly
12562 <includeonly>{{subst:Foo}}</includeonly>
12563 !! html/php
12564 Shall not expand:
12565
12566 <nowiki>~~~~</nowiki>
12567
12568 <includeonly><nowiki>~~~~</nowiki></includeonly>
12569
12570 <noinclude><nowiki>~~~~</nowiki></noinclude>
12571
12572 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12573
12574 FOO shall be converted to FOO
12575
12576 As well as inside noinclude/onlyinclude
12577 <noinclude>FOO</noinclude>
12578 <onlyinclude>FOO</onlyinclude>
12579
12580 But not inside includeonly
12581 <includeonly>{{subst:Foo}}</includeonly>
12582 !! end
12583
12584 !! test
12585 Parsoid: Recognize nowiki with trailing space in tags
12586 !! options
12587 parsoid=wt2html
12588 !! wikitext
12589 <nowiki ><div>[[foo]]</nowiki >
12590
12591 a<nowiki / >b
12592
12593 c<nowiki />d
12594
12595 e<nowiki/ >f
12596 !! html
12597 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12598 <p>ab</p>
12599 <p>cd</p>
12600 <p>ef</p>
12601 !! end
12602
12603 !! test
12604 Parsoid: Recognize nowiki with odd capitalization
12605 !! options
12606 parsoid=wt2html
12607 !! wikitext
12608 <noWikI ><div>[[foo]]</Nowiki >
12609 !! html
12610 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12611 !! end
12612
12613
12614 !! test
12615 Parsoid: Escape nowiki with trailing space in tags
12616 !! options
12617 parsoid=html2wt
12618 !! html/parsoid
12619 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12620 <p>a&lt;nowiki /&gt;b</p>
12621 <p>c&lt;nowiki/ &gt;d</p>
12622 !! wikitext
12623 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12624
12625 a&lt;nowiki /&gt;b
12626
12627 c&lt;nowiki/ &gt;d
12628 !! end
12629
12630 !! test
12631 Parsoid: Escape weird noWikI capitalizations
12632 !! options
12633 parsoid=html2wt
12634 !! html/parsoid
12635 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12636 !! wikitext
12637 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12638 !! end
12639
12640 ###
12641 ### Message transform tests
12642 ###
12643 !! test
12644 message transform: magic variables
12645 !! options
12646 msg
12647 !! wikitext
12648 {{SITENAME}}
12649 !! html
12650 MediaWiki
12651 !! end
12652
12653 !! test
12654 message transform: should not transform wiki markup
12655 !! options
12656 msg
12657 !! wikitext
12658 ''test''
12659 !! html
12660 ''test''
12661 !! end
12662
12663 !! test
12664 message transform: <noinclude> in transcluded template (bug 4926)
12665 !! options
12666 msg
12667 !! wikitext
12668 {{Includes}}
12669 !! html
12670 Foobar
12671 !! end
12672
12673 !! test
12674 message transform: <onlyinclude> in transcluded template (bug 4926)
12675 !! options
12676 msg
12677 !! wikitext
12678 {{Includes2}}
12679 !! html
12680 Foo
12681 !! end
12682
12683 !! test
12684 {{#special:}} page name, known
12685 !! options
12686 msg
12687 !! wikitext
12688 {{#special:Recentchanges}}
12689 !! html
12690 Special:RecentChanges
12691 !! end
12692
12693 !! test
12694 {{#special:}} page name with subpage, known
12695 !! options
12696 msg
12697 !! wikitext
12698 {{#special:Recentchanges/param}}
12699 !! html
12700 Special:RecentChanges/param
12701 !! end
12702
12703 !! test
12704 {{#special:}} page name, unknown
12705 !! options
12706 msg
12707 !! wikitext
12708 {{#special:foobar nonexistent}}
12709 !! html
12710 Special:Foobar nonexistent
12711 !! end
12712
12713 !! test
12714 {{#speciale:}} page name, known
12715 !! options
12716 msg
12717 !! wikitext
12718 {{#speciale:Recentchanges}}
12719 !! html
12720 Special:RecentChanges
12721 !! end
12722
12723 !! test
12724 {{#speciale:}} page name with subpage, known
12725 !! options
12726 msg
12727 !! wikitext
12728 {{#speciale:Recentchanges/param}}
12729 !! html
12730 Special:RecentChanges/param
12731 !! end
12732
12733 !! test
12734 {{#speciale:}} page name, unknown
12735 !! options
12736 msg
12737 !! wikitext
12738 {{#speciale:foobar nonexistent}}
12739 !! html
12740 Special:Foobar_nonexistent
12741 !! end
12742
12743 ###
12744 ### Images
12745 ###
12746 ### For Parsoid-specific tests, see
12747 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12748
12749 !! test
12750 Simple image
12751 !! options
12752 parsoid=wt2html,wt2wt,html2html
12753 !! wikitext
12754 [[Image:foobar.jpg]]
12755 !! html/php
12756 <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>
12757 </p>
12758 !! html/parsoid
12759 <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>
12760 !! end
12761
12762 !! test
12763 Simple image (using File: namespace, now canonical)
12764 !! wikitext
12765 [[File:Foobar.jpg]]
12766 !! html/php
12767 <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>
12768 </p>
12769 !! html/parsoid
12770 <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>
12771 !! end
12772
12773 !! test
12774 Right-aligned image
12775 !! wikitext
12776 [[File:Foobar.jpg|right]]
12777 !! html/php
12778 <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>
12779
12780 !! html/parsoid
12781 <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>
12782 !! end
12783
12784 !! test
12785 Image with caption
12786 !! wikitext
12787 [[File:Foobar.jpg|right|Caption text]]
12788 !! html/php
12789 <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>
12790
12791 !! html/parsoid
12792 <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>
12793 !! end
12794
12795 !! test
12796 Image with caption, bug 53312 #1
12797 !! wikitext
12798 [[File:Foobar.jpg|right|Caption page stuff]]
12799 !! html/php
12800 <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>
12801
12802 !! html/parsoid
12803 <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>
12804 !! end
12805
12806 !! test
12807 Image with caption, bug 53312 #2
12808 !! wikitext
12809 [[File:Foobar.jpg|right|Caption page=]]
12810 !! html/php
12811 <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>
12812
12813 !! html/parsoid
12814 <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>
12815 !! end
12816
12817 !! test
12818 Image with caption, bug 53312 #3
12819 !! wikitext
12820 [[File:Foobar.jpg|right|Caption page=stuff]]
12821 !! html/php
12822 <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>
12823
12824 !! html/parsoid
12825 <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>
12826 !! end
12827
12828 !! test
12829 Allow empty links in image captions (Bug 60753)
12830 !! options
12831 thumbsize=220
12832 !! wikitext
12833 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12834 [[]]
12835 [[Link2]]
12836 ]]
12837 !! html/php
12838 <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>
12839
12840 !! html/parsoid
12841 <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>
12842 [[]]
12843 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12844 </figcaption></figure>
12845 !! end
12846
12847 !! test
12848 Titles in unlinked images (T23454)
12849 !! wikitext
12850 [[File:Foobar.jpg|link=|stuff]]
12851 !! html/php
12852 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12853 </p>
12854 !! end
12855
12856 !! test
12857 Link with empty target
12858 !! wikitext
12859 [[]]
12860 !! html
12861 <p>[[]]
12862 </p>
12863 !! end
12864
12865 !! test
12866 Image with link trail
12867 !! wikitext
12868 Linktrails should not work for images: [[File:Foobar.jpg]]s
12869 !! html/php
12870 <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
12871 </p>
12872 !! html/parsoid
12873 <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>
12874 !! end
12875
12876 !! test
12877 Image with empty attribute
12878 !! options
12879 parsoid=wt2html,wt2wt,html2html
12880 !! wikitext
12881 [[File:Foobar.jpg|right||Caption text]]
12882 !! html/php
12883 <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>
12884
12885 !! html/parsoid
12886 <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>
12887 !! end
12888
12889 !! test
12890 1. Block image with individual attributes from templates
12891 !! wikitext
12892 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12893 !! html/php
12894 <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>
12895
12896 !! html/parsoid
12897 <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>
12898 !! end
12899
12900 !! test
12901 2. Block Image with individual attributes from templates
12902 !! wikitext
12903 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12904 !! html/php
12905 <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>
12906
12907 !! html/parsoid
12908 <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>
12909 !! end
12910
12911 !! test
12912 3. Inline image with individual attributes from templates
12913 !! wikitext
12914 [[File:Foobar.jpg|{{echo|50px}}]]
12915 !! html/php
12916 <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>
12917 </p>
12918 !! html/parsoid
12919 <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>
12920 !! end
12921
12922 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12923 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12924 !! test
12925 Image with multiple attributes from the same template
12926 !! wikitext
12927 [[File:Foobar.jpg|{{image_attribs}}]]
12928 !! html/php
12929 <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>
12930
12931 !! html/parsoid
12932 <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>
12933 !! end
12934
12935 !! test
12936 Image with link tails
12937 !! options
12938 thumbsize=220
12939 !! wikitext
12940 123[[File:Foobar.jpg]]456
12941 123[[File:Foobar.jpg|right]]456
12942 123[[File:Foobar.jpg|thumb]]456
12943 !! html/php
12944 <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
12945 </p>
12946 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
12947 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
12948
12949 !! html/php+tidy
12950 <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>
12951 <p>123</p>
12952 <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>
12953 <p>456 123</p>
12954 <div class="thumb tright">
12955 <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>
12956 <div class="thumbcaption">
12957 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12958 </div>
12959 </div>
12960 </div>
12961 <p>456</p>
12962 !! html/parsoid
12963 <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>
12964 <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>
12965 <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>
12966 !! end
12967
12968 !! test
12969 Image with multiple captions -- only last one is accepted
12970 !! wikitext
12971 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12972 !! html/php
12973 <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>
12974
12975 !! html/parsoid
12976 <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>
12977 !! end
12978
12979 !! test
12980 Image with multiple widths -- use last
12981 !! wikitext
12982 [[File:Foobar.jpg|200px|300px|caption]]
12983 !! html/php
12984 <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>
12985 </p>
12986 !! html/parsoid
12987 <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>
12988 !! end
12989
12990 !! test
12991 Image with multiple alignments -- use first (bug 48664)
12992 !! options
12993 thumbsize=220
12994 !! wikitext
12995 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12996
12997 [[File:Foobar.jpg|middle|text-top|caption]]
12998 !! html/php
12999 <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>
13000 <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>
13001 </p>
13002 !! html/parsoid
13003 <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>
13004 <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>
13005 !! end
13006
13007 !! test
13008 Image with width attribute at different positions
13009 !! wikitext
13010 [[File:Foobar.jpg|200px|right|Caption]]
13011 [[File:Foobar.jpg|right|200px|Caption]]
13012 [[File:Foobar.jpg|right|Caption|200px]]
13013 !! html/php
13014 <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>
13015 <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>
13016 <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>
13017
13018 !! html/parsoid
13019 <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>
13020 <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>
13021 <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>
13022 !! end
13023
13024 # a sad bit of backward-compatibility
13025 !! test
13026 Image with size specified with pxpx (bug 13500, 51628)
13027 !! options
13028 parsoid=wt2html,wt2wt,html2html
13029 !! wikitext
13030 [[File:Foobar.jpg|20pxpx]]
13031 [[File:Foobar.jpg|200x20pxpx]]
13032 !! html/php
13033 <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>
13034 <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>
13035 </p>
13036 !! html/parsoid
13037 <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>
13038 !! end
13039
13040 !! test
13041 Image with link parameter, wiki target
13042 !! wikitext
13043 [[File:Foobar.jpg|link=Main Page]]
13044 !! html/php
13045 <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>
13046 </p>
13047 !! html/parsoid
13048 <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>
13049 !! end
13050
13051 # parsoid bug 49293 (part 1)
13052 !! test
13053 Image with link parameter, URL target
13054 !! wikitext
13055 [[File:Foobar.jpg|link=http://example.com/]]
13056 !! html/php
13057 <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>
13058 </p>
13059 !! html/parsoid
13060 <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>
13061 !! end
13062
13063 # parsoid bug 49293 (part 2)
13064 !! test
13065 Image with link parameter, protocol-less URL target
13066 !! wikitext
13067 [[File:Foobar.jpg|link=//example.com/]]
13068 !! html/php
13069 <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>
13070 </p>
13071 !! html/parsoid
13072 <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>
13073 !! end
13074
13075 !! test
13076 Escaping non-block captions (T107435)
13077 !! options
13078 parsoid={
13079 "modes": ["wt2wt"],
13080 "changes": [
13081 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13082 ]
13083 }
13084 !! wikitext
13085 [[Image:Foobar.jpg|caption]]
13086 !! wikitext/edited
13087 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13088 !! end
13089
13090 # wgExternalLinkTarget not supported by Parsoid
13091 !! test
13092 Image with link parameter, wgExternalLinkTarget
13093 !! wikitext
13094 [[Image:foobar.jpg|link=http://example.com/]]
13095 !! config
13096 wgExternalLinkTarget='foobar'
13097 !! html/php
13098 <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>
13099 </p>
13100 !! end
13101
13102 !! test
13103 Image with link parameter, wgNoFollowLinks set to false
13104 !! wikitext
13105 [[Image:foobar.jpg|link=http://example.com/]]
13106 !! config
13107 wgNoFollowLinks=false
13108 !! html
13109 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13110 </p>
13111 !! end
13112
13113 !! test
13114 Image with link parameter, wgNoFollowDomainExceptions
13115 !! wikitext
13116 [[Image:foobar.jpg|link=http://example.com/]]
13117 !! config
13118 wgNoFollowDomainExceptions='example.com'
13119 !! html
13120 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13121 </p>
13122 !! end
13123
13124 # wgExternalLinkTarget not supported by Parsoid
13125 !! test
13126 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13127 !! wikitext
13128 [[Image:foobar.jpg|link=http://example.com/|Title]]
13129 !! config
13130 wgExternalLinkTarget='foobar'
13131 !! html/php
13132 <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>
13133 </p>
13134 !! end
13135
13136 !! test
13137 Image with empty link parameter
13138 !! wikitext
13139 [[File:Foobar.jpg|link=]]
13140 !! html/php
13141 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13142 </p>
13143 !! html/parsoid
13144 <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>
13145 !! end
13146
13147 !! test
13148 Image with link parameter (wiki target) and unnamed parameter
13149 !! wikitext
13150 [[File:Foobar.jpg|link=Main_Page|Title]]
13151 !! html/php
13152 <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>
13153 </p>
13154 !! html/parsoid
13155 <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>
13156 !! end
13157
13158 !! test
13159 Image with link parameter (URL target) and unnamed parameter
13160 !! wikitext
13161 [[File:Foobar.jpg|link=http://example.com/|Title]]
13162 !! html/php
13163 <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>
13164 </p>
13165 !! html/parsoid
13166 <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>
13167 !! end
13168
13169 !! test
13170 Thumbnail image with link parameter
13171 !! options
13172 thumbsize=220
13173 parsoid=wt2html,wt2wt,html2html
13174 !! wikitext
13175 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13176 !! html/php
13177 <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>
13178
13179 !! html/parsoid
13180 <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>
13181 !! end
13182
13183 !! test
13184 Manually-specified thumbnail image
13185 !! options
13186 thumbsize=220
13187 !! wikitext
13188 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13189 !! html/php
13190 <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>
13191
13192 !! html/parsoid
13193 <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>
13194 !! end
13195
13196 !! test
13197 Manually-specified thumbnail image with explicit link to wiki page
13198 !! options
13199 thumbsize=220
13200 parsoid=wt2html,wt2wt,html2html
13201 !! wikitext
13202 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13203 !! html/php
13204 <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>
13205
13206 !! html/parsoid
13207 <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>
13208 !! end
13209
13210 !! test
13211 Manually-specified thumbnail image with explicit link to url
13212 !! options
13213 thumbsize=220
13214 parsoid=wt2html,wt2wt,html2html
13215 !! wikitext
13216 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13217 !! html/php
13218 <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>
13219
13220 !! html/parsoid
13221 <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>
13222 !! end
13223
13224 !! test
13225 Manually-specified thumbnail image with explicit no link
13226 !! options
13227 thumbsize=220
13228 parsoid=wt2html,wt2wt,html2html
13229 !! wikitext
13230 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13231 !! html/php
13232 <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>
13233
13234 !! html/parsoid
13235 <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>
13236 !! end
13237
13238 !! test
13239 Manually-specified thumbnail image with explicit link and alt text
13240 !! options
13241 thumbsize=220
13242 parsoid=wt2html,wt2wt,html2html
13243 !! wikitext
13244 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13245 !! html/php
13246 <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>
13247
13248 !! html/parsoid
13249 <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>
13250 !! end
13251
13252 !! test
13253 Image with frame and link
13254 !! options
13255 parsoid=wt2html,wt2wt,html2html
13256 !! wikitext
13257 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13258 !! html/php
13259 <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>
13260
13261 !! html/parsoid
13262 <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>
13263 !! end
13264
13265 !! test
13266 Image with frame and link and explicit alt
13267 !! options
13268 parsoid=wt2html,wt2wt,html2html
13269 !! wikitext
13270 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13271 !! html/php
13272 <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>
13273
13274 !! html/parsoid
13275 <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>
13276 !! end
13277
13278 !! test
13279 Image with wiki markup in implicit alt
13280 !! wikitext
13281 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13282
13283 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13284 !! html/php
13285 <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>
13286 </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>
13287 </p>
13288 !! html/parsoid
13289 <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>
13290 <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>
13291 !! end
13292
13293 !! test
13294 Alt image option should handle most kinds of wikitext without barfing
13295 !! wikitext
13296 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13297 !! html/php
13298 <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>
13299
13300 !! html/parsoid
13301 <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>
13302 !! end
13303
13304 ###################
13305 # Conflicting image format options.
13306 # First option specified should 'win'.
13307 # All three cases in each test should be identical.
13308
13309 !! test
13310 Image with 'frameless' first.
13311 !! options
13312 parsoid=wt2html,wt2wt,html2html
13313 !! wikitext
13314 [[File:Foobar.jpg|frameless|caption]]
13315
13316 [[File:Foobar.jpg|frameless|frame|caption]]
13317
13318 [[File:Foobar.jpg|frameless|thumb|caption]]
13319 !! html/php
13320 <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>
13321 </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>
13322 </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>
13323 </p>
13324 !! html/parsoid
13325 <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>
13326 <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>
13327 <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>
13328 !! end
13329
13330 !! test
13331 Image with 'frame' first.
13332 !! options
13333 parsoid=wt2html,wt2wt,html2html
13334 !! wikitext
13335 [[File:Foobar.jpg|frame|caption]]
13336 [[File:Foobar.jpg|frame|frameless|caption]]
13337 [[File:Foobar.jpg|frame|thumb|caption]]
13338 !! html/php
13339 <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>
13340 <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>
13341 <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>
13342
13343 !! html/parsoid
13344 <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>
13345 <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>
13346 <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>
13347 !! end
13348
13349 !! test
13350 Image with 'thumb' first.
13351 !! options
13352 parsoid=wt2html,wt2wt,html2html
13353 !! wikitext
13354 [[File:Foobar.jpg|thumb|caption]]
13355 [[File:Foobar.jpg|thumb|frameless|caption]]
13356 [[File:Foobar.jpg|thumb|frame|caption]]
13357 !! html/php
13358 <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>
13359 <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>
13360 <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>
13361
13362 !! html/parsoid
13363 <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>
13364 <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>
13365 <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>
13366 !! end
13367
13368 ###################
13369 # Image sizing.
13370 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13371 # and https://phabricator.wikimedia.org/T64258
13372 # Foobar has actual size of 1941x220
13373 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13374 # a scalable format.
13375 # 2. Framed images always ignore size options; always render at default size.
13376 # 3. "Unspecified format" and border are the only types which can be
13377 # enlarged.
13378
13379 !! test
13380 Image: "unspecified format" and border enlarge
13381 !! options
13382 parsoid=wt2html,wt2wt,html2html
13383 !! wikitext
13384 [[File:Foobar.jpg|2000px]]
13385
13386 [[File:Foobar.jpg|border|2000px]]
13387 !! html/php
13388 <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>
13389 </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>
13390 </p>
13391 !! html/parsoid
13392 <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>
13393 <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>
13394 !! end
13395
13396 !! test
13397 Image: "unspecified format" and border reduce
13398 !! options
13399 parsoid=wt2html,wt2wt,html2html
13400 !! wikitext
13401 [[File:Foobar.jpg|1000px]]
13402
13403 [[File:Foobar.jpg|border|1000px]]
13404 !! html/php
13405 <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>
13406 </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>
13407 </p>
13408 !! html/parsoid
13409 <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>
13410 <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>
13411 !! end
13412
13413 !! test
13414 Image: thumbs reduce
13415 !! options
13416 parsoid=wt2html,wt2wt,html2html
13417 !! wikitext
13418 [[File:Foobar.jpg|thumb|50px]]
13419 !! html/php
13420 <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>
13421
13422 !! html/parsoid
13423 <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>
13424 !! end
13425
13426 !! test
13427 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13428 !! options
13429 parsoid=wt2html,wt2wt,html2html
13430 !! wikitext
13431 [[File:Foobar.jpg|thumb|2000px]]
13432
13433 [[File:Foobar.svg|thumb|2000px]]
13434 !! html/php
13435 <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>
13436 <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>
13437
13438 !! html/parsoid
13439 <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>
13440 <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>
13441 !! end
13442
13443 !! test
13444 Image: frameless can reduce in size
13445 !! options
13446 parsoid=wt2html,wt2wt,html2html
13447 !! wikitext
13448 [[File:Foobar.jpg|frameless|50px]]
13449 !! html/php
13450 <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>
13451 </p>
13452 !! html/parsoid
13453 <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>
13454 !! end
13455
13456 !! test
13457 Image: bitmap frameless can't be enlarged past original size, but vector can
13458 !! options
13459 parsoid=wt2html,wt2wt,html2html
13460 !! wikitext
13461 [[File:Foobar.jpg|frameless|2000px]]
13462
13463 [[File:Foobar.svg|frameless|2000px]]
13464 !! html/php
13465 <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>
13466 </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>
13467 </p>
13468 !! html/parsoid
13469 <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>
13470 <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>
13471 !! end
13472
13473 !! test
13474 Image: framed images are always unscaled.
13475 !! options
13476 parsoid=wt2html,wt2wt,html2html
13477 !! wikitext
13478 [[File:Foobar.jpg|frame]]
13479
13480 [[File:Foobar.jpg|frame|50px]]
13481
13482 [[File:Foobar.jpg|frame|50x50px]]
13483
13484 [[File:Foobar.jpg|frame|2000px]]
13485 !! html/php
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 <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>
13488 <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>
13489 <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>
13490
13491 !! html/parsoid
13492 <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>
13493 <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>
13494 <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>
13495 <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>
13496 !! end
13497
13498 ###################
13499
13500 !! test
13501 Link to image page- image page normally doesn't exists, hence edit link
13502 Add test with existing image page
13503 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13504 !! wikitext
13505 [[:Image:test]]
13506 !! html
13507 <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>
13508 </p>
13509 !! end
13510
13511 !! test
13512 bug 18784 Link to non-existent image page with caption should use caption as link text
13513 !! wikitext
13514 [[:Image:test|caption]]
13515 !! html
13516 <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>
13517 </p>
13518 !! end
13519
13520 !! test
13521 Frameless image caption with a free URL
13522 !! wikitext
13523 [[File:Foobar.jpg|http://example.com]]
13524 !! html/php
13525 <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>
13526 </p>
13527 !! html/parsoid
13528 <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>
13529 !! end
13530
13531 !! test
13532 Thumbnail image caption with a free URL
13533 !! options
13534 thumbsize=220
13535 !! wikitext
13536 [[File:Foobar.jpg|thumb|http://example.com]]
13537 !! html/php
13538 <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>
13539
13540 !! html/parsoid
13541 <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>
13542 !! end
13543
13544 !! test
13545 Thumbnail image caption with a free URL and explicit alt
13546 !! options
13547 thumbsize=220
13548 parsoid=wt2html,wt2wt,html2html
13549 !! wikitext
13550 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13551 !! html/php
13552 <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>
13553
13554 !! html/parsoid
13555 <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>
13556 !! end
13557
13558 !! test
13559 SVG thumbnails with no language set
13560 !! options
13561 !! wikitext
13562 [[File:Foobar.svg|thumb|caption]]
13563 !! html/php
13564 <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>
13565
13566 !! html/parsoid
13567 <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>
13568 !! end
13569
13570 !! test
13571 SVG thumbnails with language de
13572 !! options
13573 parsoid=wt2html,wt2wt,html2html
13574 !! wikitext
13575 [[File:Foobar.svg|thumb|caption|lang=de]]
13576 !! html/php
13577 <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>
13578
13579 !! html/parsoid
13580 <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>
13581 !! end
13582
13583 !! test
13584 SVG thumbnails with invalid language code
13585 !! options
13586 parsoid=wt2html,wt2wt,html2html
13587 !! wikitext
13588 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13589 !! html/php
13590 <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>
13591
13592 !! html/parsoid
13593 <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>
13594 !! end
13595
13596 !! test
13597 BUG 1887: A ISBN with a thumbnail
13598 !! wikitext
13599 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13600 !! html/php
13601 <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>
13602
13603 !! html/parsoid
13604 <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>
13605 !! end
13606
13607 !! test
13608 BUG 1887: A RFC with a thumbnail
13609 !! wikitext
13610 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13611 !! html/php
13612 <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>
13613
13614 !! html/parsoid
13615 <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>
13616 !! end
13617
13618 !! test
13619 BUG 1887: A mailto link with a thumbnail
13620 !! wikitext
13621 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13622 !! html/php
13623 <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>
13624
13625 !! html/parsoid
13626 <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>
13627 !! end
13628
13629 # Pending resolution to bug 368
13630 !! test
13631 BUG 648: Frameless image caption with a link
13632 !! wikitext
13633 [[File:Foobar.jpg|text with a [[link]] in it]]
13634 !! html/php
13635 <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>
13636 </p>
13637 !! html/parsoid
13638 <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>
13639 !! end
13640
13641 !! test
13642 BUG 648: Frameless image caption with a link (suffix)
13643 !! wikitext
13644 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13645 !! html/php
13646 <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>
13647 </p>
13648 !! html/parsoid
13649 <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>
13650 !! end
13651
13652 !! test
13653 BUG 648: Frameless image caption with an interwiki link
13654 !! wikitext
13655 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13656 !! html/php
13657 <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>
13658 </p>
13659 !! html/parsoid
13660 <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>
13661 !! end
13662
13663 !! test
13664 BUG 648: Frameless image caption with a piped interwiki link
13665 !! wikitext
13666 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13667 !! html/php
13668 <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>
13669 </p>
13670 !! html/parsoid
13671 <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>
13672 !! end
13673
13674 !! test
13675 T107474: Frameless image caption with <nowiki>
13676 !! wikitext
13677 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13678 !! html/parsoid
13679 <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>
13680 !! end
13681
13682 !! test
13683 Escape HTML special chars in image alt text
13684 !! wikitext
13685 [[File:Foobar.jpg|& < > "]]
13686 !! html/php
13687 <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>
13688 </p>
13689 !! html/parsoid
13690 <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>
13691 !! end
13692
13693 !! test
13694 BUG 499: Alt text should have &#1234;, not &amp;1234;
13695 !! wikitext
13696 [[File:Foobar.jpg|&#9792;]]
13697 !! html/php
13698 <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>
13699 </p>
13700 !! html/parsoid
13701 <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>
13702 !! end
13703
13704 !! test
13705 Broken image caption with link
13706 !! options
13707 parsoid=wt2html,wt2wt,html2html
13708 !! wikitext
13709 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13710 !! html/php
13711 <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.
13712 </p>
13713 !! html/parsoid
13714 <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>
13715 !! end
13716
13717 !! test
13718 Image caption containing another image
13719 !! wikitext
13720 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13721 !! html/php
13722 <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>
13723
13724 !! html/parsoid
13725 <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>
13726 !! end
13727
13728 !! test
13729 Image: caption containing a newline
13730 !! wikitext
13731 [[File:Foobar.jpg|This
13732 *is some text]]
13733 !! html/php
13734 <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>
13735 </p>
13736 !! html/parsoid
13737 <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>
13738 !!end
13739
13740 !!test
13741 Image: caption containing leading space
13742 (The leading space should not trigger nowiki escaping in wt2wt mode)
13743 !! wikitext
13744 [[File:Foobar.jpg|thumb| bar]]
13745 !! html/php
13746 <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>
13747
13748 !! html/parsoid
13749 <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>
13750 !!end
13751
13752 !! test
13753 Image: caption containing a table
13754 !! options
13755 parsoid=wt2html,wt2wt,html2html
13756 !! wikitext
13757 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13758 {|
13759 ! Foo !! Bar
13760 |-
13761 | Foo1 || Bar1
13762 |}
13763 and some more text.]]
13764 !! html/php
13765 <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>
13766
13767 !! html/parsoid
13768 <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
13769 <table>
13770 <tbody>
13771 <tr><th>Foo </th><th>Bar</th></tr>
13772 <tr>
13773 <td>Foo1 </td>
13774 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13775 !! end
13776
13777 !! test
13778 Bug 3090: External links other than http: in image captions
13779 !! wikitext
13780 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13781 !! html/php
13782 <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>
13783
13784 !! html/parsoid
13785 <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>
13786 !! end
13787
13788 !! test
13789 Custom class
13790 !! options
13791 parsoid=wt2html,wt2wt,html2html
13792 !! wikitext
13793 [[Image:foobar.jpg|a|class=b]]
13794 !! html/php
13795 <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>
13796 </p>
13797 !! html/parsoid
13798 <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>
13799 !! end
13800
13801 !! test
13802 Localized image handling (1).
13803 !! options
13804 parsoid=wt2html,wt2wt,html2html
13805 language=es
13806 !! wikitext
13807 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13808 !! html/php
13809 <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>
13810
13811 !! html/parsoid
13812 <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>
13813 !! end
13814
13815 !! test
13816 Localized image handling (2).
13817 !! options
13818 thumbsize=220
13819 parsoid=wt2html,wt2wt,html2html
13820 language=es
13821 !! wikitext
13822 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13823 !! html/php
13824 <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>
13825
13826 !! html/parsoid
13827 <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>
13828 !! end
13829
13830 !! test
13831 "border", "frameless" and "class" attributes on an image.
13832 !! options
13833 thumbsize=220
13834 parsoid=wt2html,wt2wt,html2html
13835 !! wikitext
13836 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13837 !! html/php
13838 <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>
13839 </p>
13840 !! html/parsoid
13841 <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>
13842 !! end
13843
13844 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13845 !! test
13846 Invalid image attributes (bug 62500)
13847 !! options
13848 thumbsize=220
13849 parsoid=wt2html,wt2wt,html2html
13850 !! wikitext
13851 [[File:Foobar.jpg|thumb|float|left|caption]]
13852
13853 [[File:Foobar.jpg|thumb|righ|caption]]
13854
13855 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13856 !! html/php
13857 <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>
13858 <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>
13859 <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>
13860
13861 !! html/parsoid
13862 <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>
13863 <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>
13864 <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>
13865 !! end
13866
13867 !! article
13868 File:Barfoo.jpg
13869 !! text
13870 #REDIRECT [[File:Barfoo.jpg]]
13871 !! endarticle
13872
13873 # FIXME: Parsoid should run this test -- but we'd need to teach the
13874 # mockAPI about the redirected Barfoo.jpg image.
13875 !! test
13876 Redirected image
13877 !! wikitext
13878 [[Image:Barfoo.jpg]]
13879 !! html/php
13880 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13881 </p>
13882 !! end
13883
13884 !! test
13885 Missing image with uploads disabled
13886 !! options
13887 wgEnableUploads=0
13888 !! wikitext
13889 [[File:Foobaz.jpg]]
13890 !! html/php
13891 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13892 </p>
13893 !! html/parsoid
13894 <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>
13895 !! end
13896
13897 # Parsoid-specific testing for images
13898 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13899 # Currently imperfect due to a flaw in the Parsoid testrunner
13900 # Work in progress
13901 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13902 # image tests.
13903
13904 !! test
13905 Parsoid-specific image handling - simple image with size and middle alignment
13906 !! wikitext
13907 [[File:Foobar.jpg|middle|50px]]
13908 !! html/parsoid
13909 <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>
13910 !! end
13911
13912 !! test
13913 Parsoid-specific image handling - simple image with size, middle alignment,
13914 non-standard namespace alias
13915 !! options
13916 parsoid=wt2wt,wt2html,html2html
13917 !! wikitext
13918 [[Image:Foobar.jpg|middle|50px]]
13919 !! html/parsoid
13920 <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>
13921 !! end
13922
13923 !! test
13924 Parsoid-specific image handling - simple image with size and middle alignment
13925 (existing content)
13926 !! wikitext
13927 [[File:Foobar.jpg|50px|middle]]
13928 !! html/parsoid
13929 <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>
13930 !! end
13931
13932 !! test
13933 Parsoid-specific image handling - simple image with size and middle alignment
13934 and non-standard namespace name
13935 !! options
13936 parsoid=wt2html,wt2wt,html2html
13937 !! wikitext
13938 [[Image:Foobar.jpg|50px|middle]]
13939 !! html/parsoid
13940 <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>
13941 !! end
13942
13943 !! test
13944 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13945 !! wikitext
13946 [[File:Foobar.jpg|500x10px|baseline|caption]]
13947 !! html/parsoid
13948 <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>
13949 !! end
13950
13951 !! test
13952 Parsoid-specific image handling - simple image with border and size spec
13953 !! wikitext
13954 [[File:Foobar.jpg|50px|border|caption]]
13955 !! html/parsoid
13956 <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>
13957 !! end
13958
13959 !! test
13960 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13961 !! wikitext
13962 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13963 !! html/parsoid
13964 <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>
13965 !! end
13966
13967 !! test
13968 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13969 (existing content)
13970 !! wikitext
13971 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13972 !! html/parsoid
13973 <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>
13974 !! end
13975
13976 !! test
13977 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13978 !! wikitext
13979 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13980 !! html/parsoid
13981 <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>
13982 !! end
13983
13984 !! test
13985 Parsoid-specific image handling - thumbnail with specific size, halign,
13986 valign, and caption (existing content)
13987 !! wikitext
13988 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13989 !! html/parsoid
13990 <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>
13991 !! end
13992
13993 !! test
13994 Parsoid-specific image handling - framed image with specific size and caption
13995 (size is ignored)
13996 !! options
13997 parsoid=wt2html,wt2wt,html2html
13998 !! wikitext
13999 [[File:Foobar.jpg|frame|500x50px|caption]]
14000 !! html/parsoid
14001 <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>
14002 !! end
14003
14004 !! test
14005 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14006 (size is ignored)
14007 !! options
14008 parsoid=wt2html,wt2wt,html2html
14009 !! wikitext
14010 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14011 !! html/parsoid
14012 <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>
14013 !! end
14014
14015 !! test
14016 Parsoid-specific image handling - frameless image with specific size, border, and caption
14017 !! wikitext
14018 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14019 !! html/parsoid
14020 <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>
14021 !! end
14022
14023 !! test
14024 Parsoid-specific image handling - simple image with a formatted caption
14025 !! wikitext
14026 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14027 !! html/parsoid
14028 <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>
14029 !! end
14030
14031 !! test
14032 Parsoid-specific image handling - caption with a template in it
14033 !! wikitext
14034 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14035 !! html/parsoid
14036 <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>
14037 !! end
14038
14039 !! test
14040 Parsoid-specific image handling - caption with unbalanced tags in it
14041 !! options
14042 parsoid=wt2html,wt2wt,html2html
14043 !! wikitext
14044 foo
14045 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14046 bar
14047 !! html/parsoid
14048 <p>foo</p>
14049 <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>
14050 <p>bar</p>
14051 !! end
14052
14053 !! test
14054 Parsoid-specific image handling - empty caption (1)
14055 !! options
14056 parsoid=wt2html,wt2wt
14057 !! wikitext
14058 [[File:Foobar.jpg|thumb|]]
14059 !! html/parsoid
14060 <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>
14061 !! end
14062
14063 # empty captions don't get serialized unless we're in the "round trip" case
14064 !! test
14065 Parsoid-specific image handling - empty caption (2)
14066 !! options
14067 parsoid=html2wt
14068 !! html/parsoid
14069 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14070 <a href="./File:Foobar.jpg">
14071 <img resource="./File:Foobar.jpg"
14072 src="//example.com/images/3/3a/Foobar.jpg"
14073 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14074 height="25" width="220"/>
14075 </a>
14076 <figcaption></figcaption>
14077 </figure>
14078 !! wikitext
14079 [[File:Foobar.jpg|thumb]]
14080 !! end
14081
14082 !! test
14083 Parsoid-specific image handling - whitespace caption
14084 !! wikitext
14085 [[File:Foobar.jpg|thumb| ]]
14086 !! html/parsoid
14087 <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>
14088 !! end
14089
14090 !! test
14091 Parsoid-specific image handling - lang option
14092 !! wikitext
14093 foo
14094 [[File:Foobar.svg|lang=de|caption]]
14095 bar
14096 !! html/parsoid
14097 <p>foo
14098 <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>
14099 bar</p>
14100 !! end
14101
14102 ## Edge case bugs in Parsoid from T93580
14103 !! test
14104 T93580: 1. Templated <ref> inside block images
14105 !! wikitext
14106 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14107
14108 <references />
14109 !! html/parsoid
14110 <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>
14111
14112 <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>
14113 !! end
14114
14115 !! test
14116 T93580: 2. <ref> inside inline images
14117 !! wikitext
14118 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14119
14120 <references />
14121 !! html/parsoid
14122 <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>
14123
14124 <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>
14125 !! end
14126
14127 !! test
14128 T93580: 3. Templated <ref> inside inline images
14129 !! wikitext
14130 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14131
14132 <references />
14133 !! html/parsoid
14134 <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>
14135
14136 <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>
14137 !! end
14138
14139 ###
14140 ### Subpages
14141 ###
14142 !! article
14143 Subpage test/subpage
14144 !! text
14145 foo
14146 !! endarticle
14147
14148 !! test
14149 Subpage link
14150 !! options
14151 subpage title=[[Subpage test]]
14152 !! wikitext
14153 [[/subpage]]
14154 !! html
14155 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14156 </p>
14157 !! end
14158
14159 !! test
14160 Subpage noslash link
14161 !! options
14162 subpage title=[[Subpage test]]
14163 !! wikitext
14164 [[/subpage/]]
14165 !! html
14166 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14167 </p>
14168 !! end
14169
14170 !! article
14171 Subpage test/1/2/subpage
14172 !! text
14173 blah
14174 !! endarticle
14175
14176 !! test
14177 Relative subpage noslash link
14178 !! options
14179 parsoid=wt2wt,wt2html,html2html
14180 subpage title=[[Subpage test/1/2/3/4]]
14181 !! wikitext
14182 [[../../subpage/]]
14183
14184 [[../../subpage]]
14185 !! html/php
14186 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14187 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14188 </p>
14189 !! html/parsoid
14190 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14191 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14192 !! end
14193
14194 !! test
14195 Parsoid: dot-slash prefixed wikilinks
14196 !! wikitext
14197 [[./foo]]
14198
14199 [[././bar]]
14200
14201 [[././baz/]]
14202 !! html/php
14203 <p>[[./foo]]
14204 </p><p>[[././bar]]
14205 </p><p>[[././baz/]]
14206 </p>
14207 !! html/parsoid
14208 <p>[[./foo]]
14209 </p><p>[[././bar]]
14210 </p><p>[[././baz/]]
14211 </p>
14212 !! end
14213
14214 !! test
14215 Render invalid page names as plain text (bug 51090)
14216 !! wikitext
14217 [[./../foo|bar]]
14218 [[foo�|bar]]
14219 [[foo/.|bar]]
14220 [[foo/..|bar]]
14221 [[foo~~~bar]]
14222 [[foo>bar]]
14223 [[foo[bar]]
14224 [[.]]
14225 [[..]]
14226 [[foo././bar]]
14227
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 [[{{echo|foo[bar}}]]
14237 [[{{echo|foo]bar}}]]
14238 [[{{echo|foo<bar}}]]
14239 !!html/php
14240 <p>[[./../foo|bar]]
14241 [[foo�|bar]]
14242 [[foo/.|bar]]
14243 [[foo/..|bar]]
14244 [[foo~~~bar]]
14245 [[foo&gt;bar]]
14246 [[foo[bar]]
14247 [[.]]
14248 [[..]]
14249 [[foo././bar]]
14250 </p><p>[[./../foo|bar]]
14251 [[foo/.|bar]]
14252 [[foo/..|bar]]
14253 [[foo~~~~bar]]
14254 [[foo&gt;bar]]
14255 [[foo././bar]]
14256 [[foo{bar]]
14257 [[foo}bar]]
14258 [[foo[bar]]
14259 [[foo]bar]]
14260 [[foo&lt;bar]]
14261 </p>
14262 !!html/parsoid
14263 <p>[[./../foo|bar]]
14264 [[foo�|bar]]
14265 [[foo/.|bar]]
14266 [[foo/..|bar]]
14267 [[foo~~~bar]]
14268 [[foo>bar]]
14269 [[foo[bar]]
14270 [[.]]
14271 [[..]]
14272 [[foo././bar]]</p>
14273
14274 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14275 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14276 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
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}bar"}},"i":0}}]}'>foo}bar</span>]]
14282 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14283 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14284 [[<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>
14285 !!end
14286
14287 !! test
14288 Disabled subpages
14289 !! wikitext
14290 [[/subpage]]
14291 !! html
14292 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14293 </p>
14294 !! end
14295
14296 !! test
14297 BUG 561: {{/Subpage}}
14298 !! options
14299 subpage title=[[Page]]
14300 !! wikitext
14301 {{/Subpage}}
14302 !! html
14303 <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>
14304 </p>
14305 !! end
14306
14307 ###
14308 ### Categories
14309 ###
14310 !! article
14311 Category:MediaWiki User's Guide
14312 !! text
14313 blah
14314 !! endarticle
14315
14316 !! test
14317 Link to category
14318 !! wikitext
14319 [[:Category:MediaWiki User's Guide]]
14320 !! html
14321 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14322 </p>
14323 !! end
14324
14325 !! test
14326 Simple category
14327 !! options
14328 cat
14329 !! wikitext
14330 [[Category:MediaWiki User's Guide]]
14331 !! html
14332 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14333 !! end
14334
14335 !! test
14336 PAGESINCATEGORY invalid title fatal (r33546 fix)
14337 !! wikitext
14338 {{PAGESINCATEGORY:<bogus>}}
14339 !! html
14340 <p>0
14341 </p>
14342 !! end
14343
14344 !! test
14345 Category with different sort key
14346 !! options
14347 cat
14348 !! wikitext
14349 [[Category:MediaWiki User's Guide|Foo]]
14350 !! html
14351 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14352 !! end
14353
14354 !! test
14355 Category with identical sort key
14356 !! options
14357 cat
14358 !! wikitext
14359 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14360 !! html
14361 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14362 !! end
14363
14364 !! test
14365 Category with empty sort key
14366 !! options
14367 cat
14368 pst
14369 !! wikitext
14370 [[Category:MediaWiki User's Guide|]]
14371 !! html/php
14372 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14373 !! end
14374
14375 !! test
14376 Category with empty sort key and parentheses
14377 !! options
14378 cat
14379 pst
14380 !! wikitext
14381 [[Category:Foo (bar)|]]
14382 !! html/php
14383 [[Category:Foo (bar)|Foo]]
14384 !! end
14385
14386 ## We used to, but no longer wt2wt this test since the default serializer
14387 ## will normalize all categories to serialize on their own line.
14388 ## This wikitext usage is going to be fairly uncommon in production and
14389 ## selser will take care of preserving formatting in those scenarios.
14390 !! test
14391 Category with link tail
14392 !! options
14393 cat
14394 pst
14395 parsoid=wt2html
14396 !! wikitext
14397 123[[Category:Foo]]456
14398 !! html/php
14399 123[[Category:Foo]]456
14400 !! html/parsoid
14401 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14402 !! end
14403
14404 !! test
14405 Category with template
14406 !! options
14407 cat
14408 pst
14409 !! wikitext
14410 [[Category:{{echo|Foo}}]]
14411 !! html/php
14412 [[Category:{{echo|Foo}}]]
14413 !! end
14414
14415 !! test
14416 Category with template in sort key
14417 !! options
14418 cat
14419 pst
14420 !! wikitext
14421 [[Category:Foo|{{echo|Bar}}]]
14422 !! html/php
14423 [[Category:Foo|{{echo|Bar}}]]
14424 !! end
14425
14426 !! test
14427 Category with template in sort key and title
14428 !! options
14429 cat
14430 pst
14431 !! wikitext
14432 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14433 !! html/php
14434 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14435 !! end
14436
14437 ## We used to, but no longer wt2wt this test since the default serializer
14438 ## will normalize all categories to serialize on their own line.
14439 ## This wikitext usage is going to be fairly uncommon in production and
14440 ## selser will take care of preserving formatting in those scenarios.
14441 !! test
14442 Category / paragraph interactions
14443 !! options
14444 parsoid=wt2html
14445 !! wikitext
14446 Foo [[Category:Baz]] Bar
14447
14448 Foo [[Category:Baz]]
14449 Bar
14450
14451 Foo
14452 [[Category:Baz]]
14453 Bar
14454
14455 Foo
14456 [[Category:Baz]] Bar
14457
14458 Foo
14459 [[Category:Baz]]
14460 [[Category:Baz]]
14461 [[Category:Baz]]
14462 Bar
14463
14464 [[Category:Baz]]
14465 [[Category:Baz]]
14466 [[Category:Baz]]
14467
14468 [[Category:Baz]]
14469 {{echo|[[Category:Baz]]}}
14470 [[Category:Baz]]
14471 !! html/php
14472 <p>Foo Bar
14473 </p><p>Foo
14474 Bar
14475 </p><p>Foo
14476 Bar
14477 </p><p>Foo Bar
14478 </p><p>Foo
14479 Bar
14480 </p>
14481 !! html/parsoid
14482 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14483 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14484 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14485 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14486 <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>
14487 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14488 !! end
14489
14490 ## We used to, but no longer wt2wt this test since the default serializer
14491 ## will normalize all categories to serialize on their own line.
14492 ## This wikitext usage is going to be fairly uncommon in production and
14493 ## selser will take care of preserving formatting in those scenarios.
14494 ##
14495 ## The whitespace on the empty line is part of the test. Please do not delete
14496 !! test
14497 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14498 !! options
14499 parsoid=wt2html
14500 !! wikitext
14501 This
14502
14503 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14504
14505 {{echo|[[Category:Foo]] and so should this!}}
14506 !! html/php
14507 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14508 </p>
14509 !! html/parsoid
14510 <p>This
14511
14512 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14513
14514 <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>
14515 !! end
14516
14517 ## Parsoid will not try to wt2wt this while preserving newlines because
14518 ## it suppresses excess newlines within list items -- and we don't want to
14519 ## introduce a special case just for categories, which is, in reality somewhat
14520 ## odd behavior -- categories are unlikely to be used in list items like this
14521 ## in top-level pages and are only likely to show up in template-generated
14522 ## list items where this RT-ing is a non-issue.
14523 ##
14524 ## The whitespace on the empty line is part of the test. Please do not delete
14525 !! test
14526 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14527 !! options
14528 parsoid=wt2html
14529 !! wikitext
14530 * This
14531
14532 [[Category:Foo]] and this should be part of the same list item
14533 * So should this
14534
14535 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14536 !! html
14537 <ul><li>This and this should be part of the same list item</li>
14538 <li>So should this and this should be part of the same list item</li></ul>
14539 !! html/parsoid
14540 <ul>
14541 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14542 <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>
14543 </ul>
14544 !! end
14545
14546 ## Newlines and categories that follow the last item of a list
14547 ## are treated differently because this (list followed by categories)
14548 ## is an extremely common pattern on wikis.
14549 !! test
14550 3. Categories and newlines: newline suppression for last list item should RT properly
14551 !! wikitext
14552 * a
14553 * b
14554
14555 [[Category:Foo]]
14556
14557 [[Category:Bar]]
14558 [[Category:Baz]]
14559 !! html/parsoid
14560 <ul><li> a</li>
14561 <li> b</li></ul>
14562
14563 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14564
14565 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14566 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14567 !! end
14568
14569 !! test
14570 4. Categories and newlines: newline suppression for last list item should RT properly
14571 !! wikitext
14572 * a
14573 **** b
14574
14575 [[Category:Foo]]
14576 !! html/parsoid
14577 <ul><li> a
14578 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14579
14580 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14581 !! end
14582
14583 ## only wt2html for this to make sure the algo only applies to the rightmost path
14584 !! test
14585 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14586 !! options
14587 parsoid=wt2html
14588 !! wikitext
14589 * a
14590 ** b
14591 [[Category:Foo]]
14592 * c
14593 ** d
14594 [[Category:Foo]]
14595 !! html/parsoid
14596 <ul><li> a
14597 <ul><li> b
14598 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14599 <li> c
14600 <ul><li> d</li></ul></li></ul>
14601 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14602 !! end
14603
14604 ## We used to, but no longer wt2wt this test since the default serializer
14605 ## will normalize all categories to serialize on their own line.
14606 ## This wikitext usage is going to be fairly uncommon in production and
14607 ## selser will take care of preserving formatting in those scenarios.
14608 !! test
14609 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14610 !! options
14611 parsoid=wt2html
14612 !! wikitext
14613 * a [[Category:Foo]]
14614 !! html/parsoid
14615 <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>
14616 !! end
14617
14618 # This test also demonstrates because of newline+category tunneling
14619 # through the list hander, template wrapping doesn't expand to the
14620 # containing list when the list item swallows the category.
14621 !! test
14622 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14623 !! wikitext
14624 * {{echo|a
14625 [[Category:Foo]]}}
14626 !! html/parsoid
14627 <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
14628 </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>
14629 !! end
14630
14631 !! test
14632 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14633 !! wikitext
14634 * a
14635
14636 {{echo|[[Category:Foo]]
14637 [[Category:Bar]]}}
14638 [[Category:Baz]]
14639 !! html/parsoid
14640 <ul><li> a</li></ul>
14641
14642 <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">
14643 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14644 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14645 !! end
14646
14647 !! test
14648 Parsoid: Serialize link to category page with colon escape
14649 !! options
14650 parsoid
14651 !! wikitext
14652
14653 [[:Category:Foo]]
14654 [[:Category:Foo|Bar]]
14655 !! html
14656 <p>
14657 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14658 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14659 </p>
14660 !! end
14661
14662 # We used to, but no longer wt2wt this test since the default serializer
14663 # will normalize all categories to serialize on their own line.
14664 # This wikitext usage is going to be fairly uncommon in production and
14665 # selser will take care of preventing whitespace insertion if this
14666 # occurs in an article.
14667 #
14668 # html2html disabled for the same reason (whitespace insertion between
14669 # x and y).
14670 #
14671 # html2wt disabled because it localizes the "Category" namespace.
14672 !! test
14673 Link prefix/suffixes aren't applied to category links
14674 !! options
14675 parsoid=wt2html
14676 language=is
14677 !! wikitext
14678 x[[Category:Foo]]y
14679 !! html/php
14680 <p>xy
14681 </p>
14682 !! html/parsoid
14683 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14684 !! end
14685
14686 !! test
14687 Parsoid: Serialize link to file page with colon escape
14688 !! options
14689 parsoid
14690 !! wikitext
14691
14692 [[:File:Foo.png]]
14693 [[:File:Foo.png|Bar]]
14694 !! html
14695 <p>
14696 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14697 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14698 </p>
14699 !! end
14700
14701 !! test
14702 Parsoid: Serialize a genuine category link without colon escape
14703 !! options
14704 parsoid
14705 !! wikitext
14706 [[Category:Foo]]
14707 [[Category:Foo|Bar]]
14708 !! html
14709 <link rel="mw:PageProp/Category" href="./Category:Foo">
14710 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14711 !! end
14712
14713 !! test
14714 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14715 !! options
14716 parsoid=html2wt
14717 !! html/parsoid
14718 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14719 !! wikitext
14720 [[Category:Toxine bactérienne]]
14721 !! end
14722
14723 !! test
14724 Parsoid: Defaultsort
14725 !! wikitext
14726 {{DEFAULTSORT:Foo}}
14727 !! html/parsoid
14728 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14729 !! end
14730
14731 !! test
14732 Parsoid: Defaultsort (template-generated)
14733 !! wikitext
14734 {{{{echo|DEFAULTSORT}}:Foo}}
14735 !! html/parsoid
14736 <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}}]}'/>
14737 !! end
14738
14739 ###
14740 ### Inter-language links
14741 ###
14742 !! test
14743 Interlanguage links
14744 !! options
14745 ill
14746 !! wikitext
14747 [[es:Alimento]]
14748 [[fr:Nourriture]]
14749 [[zh:食品]]
14750 !! html/php
14751 es:Alimento fr:Nourriture zh:食品
14752 !! html/parsoid
14753 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14754 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14755 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14756 !! end
14757
14758 !! test
14759 Duplicate interlanguage links (bug 24502)
14760 !! options
14761 ill
14762 !! wikitext
14763 [[es:1]]
14764 [[es:2]]
14765 [[fr:1]]
14766 [[fr:2]]
14767 !! html/php
14768 es:1 fr:1
14769 !! html/parsoid
14770 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14771 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14772 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14773 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14774 !! end
14775
14776 ###
14777 ### Sections
14778 ###
14779 !! test
14780 Basic section headings
14781 !! wikitext
14782 == Headline 1 ==
14783 Some text
14784
14785 ==Headline 2==
14786 More
14787 ===Smaller headline===
14788 Blah blah
14789 !! html
14790 <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>
14791 <p>Some text
14792 </p>
14793 <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>
14794 <p>More
14795 </p>
14796 <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>
14797 <p>Blah blah
14798 </p>
14799 !! end
14800
14801 !! test
14802 Section headings with TOC
14803 !! wikitext
14804 == Headline 1 ==
14805 === Subheadline 1 ===
14806 ===== Skipping a level =====
14807 ====== Skipping a level ======
14808
14809 == Headline 2 ==
14810 Some text
14811 ===Another headline===
14812 !! html
14813 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14814 <ul>
14815 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14816 <ul>
14817 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14818 <ul>
14819 <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>
14820 <ul>
14821 <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>
14822 </ul>
14823 </li>
14824 </ul>
14825 </li>
14826 </ul>
14827 </li>
14828 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14829 <ul>
14830 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14831 </ul>
14832 </li>
14833 </ul>
14834 </div>
14835
14836 <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>
14837 <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>
14838 <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>
14839 <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>
14840 <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>
14841 <p>Some text
14842 </p>
14843 <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>
14844
14845 !! end
14846
14847 !! test
14848 TOC anchors don't collide
14849 !! wikitext
14850 __FORCETOC__
14851 == Headline 2 ==
14852 == Headline ==
14853 == Headline 2 ==
14854 == Headline ==
14855 !! html/php
14856 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14857 <ul>
14858 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14859 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14860 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14861 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14862 </ul>
14863 </div>
14864
14865 <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>
14866 <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>
14867 <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>
14868 <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>
14869
14870 !! end
14871
14872 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14873 !! test
14874 Handling of sections up to level 6 and beyond
14875 !! wikitext
14876 = Level 1 Heading=
14877 == Level 2 Heading==
14878 === Level 3 Heading===
14879 ==== Level 4 Heading====
14880 ===== Level 5 Heading=====
14881 ====== Level 6 Heading======
14882 ======= Level 7 Heading=======
14883 ======== Level 8 Heading========
14884 ========= Level 9 Heading=========
14885 ========== Level 10 Heading==========
14886 !! html
14887 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14888 <ul>
14889 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14890 <ul>
14891 <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>
14892 <ul>
14893 <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>
14894 <ul>
14895 <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>
14896 <ul>
14897 <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>
14898 <ul>
14899 <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>
14900 <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>
14901 <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>
14902 <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>
14903 <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>
14904 </ul>
14905 </li>
14906 </ul>
14907 </li>
14908 </ul>
14909 </li>
14910 </ul>
14911 </li>
14912 </ul>
14913 </li>
14914 </ul>
14915 </div>
14916
14917 <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>
14918 <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>
14919 <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>
14920 <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>
14921 <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>
14922 <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>
14923 <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>
14924 <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>
14925 <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>
14926 <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>
14927
14928 !! end
14929
14930 !! test
14931 TOC regression (T11764)
14932 !! wikitext
14933 == title 1 ==
14934 === title 1.1 ===
14935 ==== title 1.1.1 ====
14936 === title 1.2 ===
14937 == title 2 ==
14938 === title 2.1 ===
14939 !! html
14940 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14941 <ul>
14942 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14943 <ul>
14944 <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>
14945 <ul>
14946 <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>
14947 </ul>
14948 </li>
14949 <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>
14950 </ul>
14951 </li>
14952 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14953 <ul>
14954 <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>
14955 </ul>
14956 </li>
14957 </ul>
14958 </div>
14959
14960 <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>
14961 <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>
14962 <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>
14963 <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>
14964 <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>
14965 <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>
14966
14967 !! end
14968
14969 !! test
14970 TOC for heading containing <span id="..."></span> (T96153)
14971 !! wikitext
14972 __FORCETOC__
14973 ==<span id="old-anchor"></span>New title==
14974 !! html/php
14975 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14976 <ul>
14977 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14978 </ul>
14979 </div>
14980
14981 <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>
14982
14983 !! end
14984
14985 !! test
14986 TOC with wgMaxTocLevel=3 (bug 6204)
14987 !! options
14988 wgMaxTocLevel=3
14989 !! wikitext
14990 == title 1 ==
14991 === title 1.1 ===
14992 ==== title 1.1.1 ====
14993 === title 1.2 ===
14994 == title 2 ==
14995 === title 2.1 ===
14996 !! html
14997 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14998 <ul>
14999 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15000 <ul>
15001 <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>
15002 <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>
15003 </ul>
15004 </li>
15005 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15006 <ul>
15007 <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>
15008 </ul>
15009 </li>
15010 </ul>
15011 </div>
15012
15013 <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>
15014 <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>
15015 <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>
15016 <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>
15017 <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>
15018 <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>
15019
15020 !! end
15021
15022 !! test
15023 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15024 !! options
15025 wgMaxTocLevel=3
15026 !! wikitext
15027 ==Section 1==
15028 ===Section 1.1===
15029 ====Section 1.1.1====
15030 ====Section 1.1.1.1====
15031 ==Section 2==
15032 !! html
15033 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15034 <ul>
15035 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15036 <ul>
15037 <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>
15038 </ul>
15039 </li>
15040 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15041 </ul>
15042 </div>
15043
15044 <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>
15045 <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>
15046 <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>
15047 <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>
15048 <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>
15049
15050 !! end
15051
15052
15053 !! test
15054 Resolving duplicate section names
15055 !! wikitext
15056 == Foo bar ==
15057 == Foo bar ==
15058 !! html
15059 <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>
15060 <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>
15061
15062 !! end
15063
15064 !! test
15065 Resolving duplicate section names with differing case (bug 10721)
15066 !! wikitext
15067 == Foo bar ==
15068 == Foo Bar ==
15069 !! html
15070 <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>
15071 <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>
15072
15073 !! end
15074
15075 !! article
15076 Template:sections
15077 !! text
15078 ===Section 1===
15079 ==Section 2==
15080 !! endarticle
15081
15082 !! test
15083 Template with sections, __NOTOC__
15084 !! wikitext
15085 __NOTOC__
15086 ==Section 0==
15087 {{sections}}
15088 ==Section 4==
15089 !! html
15090 <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>
15091 <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>
15092 <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>
15093 <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>
15094
15095 !! end
15096
15097 !! test
15098 __NOEDITSECTION__ keyword
15099 !! wikitext
15100 __NOEDITSECTION__
15101 ==Section 1==
15102 ==Section 2==
15103 !! html
15104 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15105 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15106
15107 !! end
15108
15109 !! test
15110 Link inside a section heading
15111 !! wikitext
15112 ==Section with a [[Main Page|link]] in it==
15113 !! html
15114 <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>
15115
15116 !! end
15117
15118 !! test
15119 TOC regression (T14077)
15120 !! wikitext
15121 __TOC__
15122 == title 1 ==
15123 === title 1.1 ===
15124 == title 2 ==
15125 !! html
15126 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15127 <ul>
15128 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15129 <ul>
15130 <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>
15131 </ul>
15132 </li>
15133 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15134 </ul>
15135 </div>
15136
15137 <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>
15138 <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>
15139 <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>
15140
15141 !! end
15142
15143 !! test
15144 BUG 1219 URL next to image (good)
15145 !! wikitext
15146 http://example.com [[File:Foobar.jpg]]
15147 !! html/php
15148 <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>
15149 </p>
15150 !! html/parsoid
15151 <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>
15152 !!end
15153
15154 !! test
15155 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15156 !! wikitext
15157 ===
15158 The line above must have a trailing space!
15159 === <!--
15160 --> <!-- -->
15161 But just in case it doesn't...
15162 !! html
15163 <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>
15164 <p>The line above must have a trailing space!
15165 </p>
15166 <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>
15167 <p>But just in case it doesn't...
15168 </p>
15169 !! end
15170
15171 !! test
15172 Header with special characters (bug 25462)
15173 !! wikitext
15174 The tooltips shall not show entities to the user (ie. be double escaped)
15175
15176 == text > text ==
15177 section 1
15178
15179 == text < text ==
15180 section 2
15181
15182 == text & text ==
15183 section 3
15184
15185 == text ' text ==
15186 section 4
15187
15188 == text " text ==
15189 section 5
15190 !! html
15191 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15192 </p>
15193 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15194 <ul>
15195 <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>
15196 <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>
15197 <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>
15198 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15199 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15200 </ul>
15201 </div>
15202
15203 <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>
15204 <p>section 1
15205 </p>
15206 <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>
15207 <p>section 2
15208 </p>
15209 <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>
15210 <p>section 3
15211 </p>
15212 <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>
15213 <p>section 4
15214 </p>
15215 <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>
15216 <p>section 5
15217 </p>
15218 !! end
15219
15220 !! test
15221 Header with space, plus and underscore as entity
15222 !! wikitext
15223 Id should not contain + for spaces
15224
15225 == Space between Text ==
15226 section 1
15227
15228 == Space-Entity&#32;between&#32;Text ==
15229 section 2
15230
15231 == Plus+between+Text ==
15232 section 3
15233
15234 == Plus-Entity&#43;between&#43;Text ==
15235 section 4
15236
15237 == Underscore_between_Text ==
15238 section 5
15239
15240 == Underscore-Entity&#95;between&#95;Text ==
15241 section 6
15242
15243 [[#Space between Text]]
15244 [[#Space-Entity&#32;between&#32;Text]]
15245 [[#Plus+between+Text]]
15246 [[#Plus-Entity&#43;between&#43;Text]]
15247 [[#Underscore_between_Text]]
15248 [[#Underscore-Entity&#95;between&#95;Text]]
15249 !! html
15250 <p>Id should not contain + for spaces
15251 </p>
15252 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15253 <ul>
15254 <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>
15255 <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>
15256 <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>
15257 <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>
15258 <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>
15259 <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>
15260 </ul>
15261 </div>
15262
15263 <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>
15264 <p>section 1
15265 </p>
15266 <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>
15267 <p>section 2
15268 </p>
15269 <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>
15270 <p>section 3
15271 </p>
15272 <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>
15273 <p>section 4
15274 </p>
15275 <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>
15276 <p>section 5
15277 </p>
15278 <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>
15279 <p>section 6
15280 </p><p><a href="#Space_between_Text">#Space between Text</a>
15281 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15282 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15283 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15284 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15285 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15286 </p>
15287 !! end
15288
15289 !! test
15290 Headers with excess '=' characters
15291 (Are similar tests necessary beyond the 1st level?)
15292 !! wikitext
15293 =foo==
15294 ==foo=
15295 =''italic'' heading==
15296 ==''italic'' heading=
15297 !! html
15298 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15299 <ul>
15300 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15301 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15302 <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>
15303 <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>
15304 </ul>
15305 </div>
15306
15307 <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>
15308 <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>
15309 <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>
15310 <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>
15311
15312 !! end
15313
15314 !! test
15315 HTML headers vs TOC (bug 23393)
15316 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15317 !! wikitext
15318 <h1>Header 1</h1>
15319 == Header 1.1 ==
15320 == Header 1.2 ==
15321
15322 <h1>Header 2
15323 </h1>
15324 == Header 2.1 ==
15325 == Header 2.2 ==
15326 __NOEDITSECTION__
15327 !! html
15328 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15329 <ul>
15330 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15331 <ul>
15332 <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>
15333 <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>
15334 </ul>
15335 </li>
15336 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15337 <ul>
15338 <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>
15339 <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>
15340 </ul>
15341 </li>
15342 </ul>
15343 </div>
15344
15345 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15346 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15347 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15348 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15349 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15350 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15351
15352 !! end
15353
15354 !! test
15355 Single-line or multiline-comments can follow headings
15356 !! options
15357 parsoid=wt2html,wt2wt
15358 !! wikitext
15359 ==foo==<!---->
15360 ==bar==<!--c1-->
15361 ==baz==<!--
15362 c2
15363 c3-->
15364 !! html
15365 <h2><span class="mw-headline" id="foo">foo</span></h2>
15366 <h2><span class="mw-headline" id="bar">bar</span></h2>
15367 <h2><span class="mw-headline" id="baz">baz</span></h2>
15368
15369 !! end
15370
15371 !! test
15372 BUG 1219 URL next to image (broken)
15373 !! wikitext
15374 http://example.com[[File:Foobar.jpg]]
15375 !! html/php
15376 <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>
15377 </p>
15378 !! html/parsoid
15379 <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>
15380 !!end
15381
15382 !! test
15383 Bug 1186 news: in the middle of text
15384 !! wikitext
15385 http://en.wikinews.org/wiki/Wikinews:Workplace
15386 !! html
15387 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15388 </p>
15389 !!end
15390
15391
15392 !! test
15393 Namespaced link must have a title
15394 !! wikitext
15395 [[Project:]]
15396 !! html
15397 <p>[[Project:]]
15398 </p>
15399 !!end
15400
15401 !! test
15402 Namespaced link must have a title (bad fragment version)
15403 !! wikitext
15404 [[Project:#fragment]]
15405 !! html
15406 <p>[[Project:#fragment]]
15407 </p>
15408 !!end
15409
15410
15411 ###
15412 ### HTML tags and HTML attributes
15413 ###
15414
15415 !! test
15416 div with no attributes
15417 !! wikitext
15418 <div>HTML rocks</div>
15419 !! html
15420 <div>HTML rocks</div>
15421
15422 !! end
15423
15424 !! test
15425 div with double-quoted attribute
15426 !! wikitext
15427 <div id="rock">HTML rocks</div>
15428 !! html
15429 <div id="rock">HTML rocks</div>
15430
15431 !! end
15432
15433 !! test
15434 div with single-quoted attribute
15435 !! wikitext
15436 <div id='rock'>HTML rocks</div>
15437 !! html
15438 <div id="rock">HTML rocks</div>
15439
15440 !! end
15441
15442 !! test
15443 div with unquoted attribute
15444 !! wikitext
15445 <div id=rock>HTML rocks</div>
15446 !! html
15447 <div id="rock">HTML rocks</div>
15448
15449 !! end
15450
15451 !! test
15452 div with illegal double attributes
15453 !! wikitext
15454 <div id="a" id="b">HTML rocks</div>
15455 !! html
15456 <div id="b">HTML rocks</div>
15457
15458 !!end
15459
15460 # FIXME: produce empty string instead of "class" in the PHP parser, following
15461 # the HTML5 spec.
15462 !! test
15463 div with empty attribute value, space before equals
15464 !! options
15465 parsoid
15466 !! wikitext
15467 <div class =>HTML rocks</div>
15468 !! html
15469 <div class="">HTML rocks</div>
15470
15471 !! end
15472
15473 !! test
15474 div with multiple empty attribute values
15475 !! options
15476 parsoid
15477 !! wikitext
15478 <div id= title=>HTML rocks</div>
15479 !! html
15480 <div id="" title="">HTML rocks</div>
15481
15482 !! end
15483
15484 !! test
15485 table with multiple empty attribute values
15486 !! options
15487 parsoid
15488 !! wikitext
15489 {| title= id=
15490 | hi
15491 |}
15492 !! html
15493 <table title="" id="">
15494 <tbody><tr><td> hi</td></tr>
15495 </tbody></table>
15496 !! end
15497
15498 !! test
15499 div with braces in attribute value
15500 !! wikitext
15501 <div title="{}">Foo</div>
15502 !! html/php
15503 <div title="&#123;}">Foo</div>
15504
15505 !! html/parsoid
15506 <div title="{}">Foo</div>
15507 !! end
15508
15509 # This it very inconsistent in the PHP parser: it returns
15510 # class="class" if there is a space between the name and the equal sign (see
15511 # 'div with empty attribute value, space before equals'), but strips the
15512 # attribute completely if the space is missing. We hope that not much content
15513 # depends on this, so are implementing the behavior below in Parsoid for
15514 # consistencies' sake.
15515 # FIXME: fix this behavior in the PHP parser?
15516 !! test
15517 div with empty attribute value, no space before equals
15518 !! options
15519 parsoid=wt2html,html2html
15520 !! wikitext
15521 <div class=>HTML rocks</div>
15522 !! html/php
15523 <div>HTML rocks</div>
15524
15525 !! html/parsoid
15526 <div class="">HTML rocks</div>
15527 !! end
15528
15529 !! test
15530 HTML multiple attributes correction
15531 !! wikitext
15532 <p class="error" class="awesome">Awesome!</p>
15533 !! html
15534 <p class="awesome">Awesome!</p>
15535
15536 !!end
15537
15538 !! test
15539 Table multiple attributes correction
15540 !! wikitext
15541 {|
15542 !+ class="error" class="awesome"| status
15543 |}
15544 !! html
15545 <table>
15546 <tr>
15547 <th class="awesome"> status
15548 </th></tr></table>
15549
15550 !!end
15551
15552 !! test
15553 DIV IN UPPERCASE
15554 !! wikitext
15555 <DIV ID="x">HTML ROCKS</DIV>
15556 !! html
15557 <div id="x">HTML ROCKS</div>
15558
15559 !!end
15560
15561 !! test
15562 Non-ASCII pseudo-tags are rendered as text
15563 !! wikitext
15564 <khyô>
15565 !! html
15566 <p>&lt;khyô&gt;
15567 </p>
15568 !! end
15569
15570 !! test
15571 Pseudo-tag with URL 'name' renders as url link
15572 !! wikitext
15573 <http://example.com/>
15574 !! html
15575 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15576 </p>
15577 !! end
15578
15579 !! test
15580 text with amp in the middle of nowhere
15581 !! wikitext
15582 Remember AT&T?
15583 !! html
15584 <p>Remember AT&amp;T?
15585 </p>
15586 !! end
15587
15588 !! test
15589 text with character entity: eacute
15590 !! wikitext
15591 I always thought &eacute; was a cute letter.
15592 !! html
15593 <p>I always thought &#233; was a cute letter.
15594 </p>
15595 !! html+tidy
15596 <p>I always thought é was a cute letter.</p>
15597 !! end
15598
15599 !! test
15600 text with entity-escaped character entity-like string: eacute
15601 !! wikitext
15602 I always thought &amp;eacute; was a cute letter.
15603 !! html
15604 <p>I always thought &amp;eacute; was a cute letter.
15605 </p>
15606 !! end
15607
15608 !! test
15609 text with undefined character entity: xacute
15610 !! wikitext
15611 I always thought &xacute; was a cute letter.
15612 !! html
15613 <p>I always thought &amp;xacute; was a cute letter.
15614 </p>
15615 !! end
15616
15617 !! test
15618 HTML5 tags
15619 !! wikitext
15620 <data value="5">five</data>
15621 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15622 <mark>This highlighted text</mark>
15623 !! html
15624 <p><data value="5">five</data>
15625 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15626 <mark>This highlighted text</mark>
15627 </p>
15628 !! end
15629
15630 !! test
15631 HTML tag with leading space is parsed as text
15632 !! wikitext
15633 < div>foo< /div>
15634 !! html
15635 <p>&lt; div&gt;foo&lt; /div&gt;
15636 </p>
15637 !! end
15638
15639 ###
15640 ### Nesting tests (see bug 41545, 50604, 51081)
15641 ###
15642
15643 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15644 # Note that html2wt is considerably more difficult if we use <b> in
15645 # the test case, instead of <big>
15646 !! test
15647 Ensure that HTML adoption agency algorithm is properly implemented.
15648 !! wikitext
15649 <big>X<big>Y</big>Z</big>
15650 !! html
15651 <p><big>X<big>Y</big>Z</big>
15652 </p>
15653 !! end
15654
15655 # This was bug 41545 in the PHP parser.
15656 # Note that tidy doesn't handle this correctly.
15657 !! test
15658 Nesting of <kbd>
15659 !! wikitext
15660 <kbd>X<kbd>Y</kbd>Z</kbd>
15661 !! html
15662 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15663 </p>
15664 !! end
15665
15666 # The following cases were bug 51081 in the PHP parser.
15667 # Note that there are some other nestable tags (b, i, etc) which are
15668 # not covered; see bug 51081 for discussion.
15669
15670 # Note that tidy doesn't handle this correctly.
15671 !! test
15672 Nesting of <em>
15673 !! wikitext
15674 <em>X<em>Y</em>Z</em>
15675 !! html
15676 <p><em>X<em>Y</em>Z</em>
15677 </p>
15678 !! end
15679
15680 # Note that tidy doesn't handle this correctly.
15681 !! test
15682 Nesting of <strong>
15683 !! wikitext
15684 <strong>X<strong>Y</strong>Z</strong>
15685 !! html
15686 <p><strong>X<strong>Y</strong>Z</strong>
15687 </p>
15688 !! end
15689
15690 !! test
15691 Nesting of <q>
15692 !! wikitext
15693 <q>X<q>Y</q>Z</q>
15694 !! html+tidy
15695 <p><q>X<q>Y</q>Z</q></p>
15696 !! end
15697
15698 # Note that tidy doesn't handle this correctly.
15699 !! test
15700 Nesting of <ruby>
15701 !! wikitext
15702 <ruby>X<ruby>Y</ruby>Z</ruby>
15703 !! html
15704 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15705 </p>
15706 !! end
15707
15708 # Note that tidy doesn't handle this correctly.
15709 !! test
15710 Nesting of <bdo>
15711 !! wikitext
15712 <bdo>X<bdo>Y</bdo>Z</bdo>
15713 !! html
15714 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15715 </p>
15716 !! end
15717
15718
15719 ###
15720 ### Media links
15721 ###
15722
15723 !! test
15724 Media link
15725 !! wikitext
15726 [[Media:Foobar.jpg]]
15727 !! html
15728 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15729 </p>
15730 !! end
15731
15732 !! test
15733 Media link with text
15734 !! wikitext
15735 [[Media:Foobar.jpg|A neat file to look at]]
15736 !! html
15737 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15738 </p>
15739 !! end
15740
15741 # FIXME: this is still bad HTML tag nesting
15742 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15743 !! test
15744 Media link with nasty text
15745 !! wikitext
15746 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15747 !! html
15748 <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>
15749
15750 !! html+tidy
15751 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15752 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15753 !! end
15754
15755 !! test
15756 Media link to nonexistent file (bug 1702)
15757 !! wikitext
15758 [[Media:No such.jpg]]
15759 !! html
15760 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15761 </p>
15762 !! end
15763
15764 !! test
15765 Image link to nonexistent file (bug 1850 - good)
15766 !! wikitext
15767 [[File:No_such.jpg]]
15768 !! html/php
15769 <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>
15770 </p>
15771 !! html/parsoid
15772 <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>
15773 !! end
15774
15775 !! test
15776 :Image link to nonexistent file (bug 1850 - bad)
15777 !! wikitext
15778 [[:Image:No such.jpg]]
15779 !! html/php
15780 <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>
15781 </p>
15782 !! html/parsoid
15783 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15784 !! end
15785
15786
15787
15788 !! test
15789 Character reference normalization in link text (bug 1938)
15790 !! wikitext
15791 [[Main Page|this&that]]
15792 !! html
15793 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15794 </p>
15795 !!end
15796
15797 !! article
15798 אַ
15799 !! text
15800 Test for unicode normalization
15801
15802 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15803 !! endarticle
15804
15805 !! test
15806 (bug 19451) Links should refer to the normalized form.
15807 !! wikitext
15808 [[&#xFB2E;]]
15809 [[&#x5d0;&#x5b7;]]
15810 [[&#x5d0;ַ]]
15811 [[א&#x5b7;]]
15812 [[אַ]]
15813 !! html
15814 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15815 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15816 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15817 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15818 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15819 </p>
15820 !! end
15821
15822 !! test
15823 Empty attribute crash test (bug 2067)
15824 !! wikitext
15825 <font color="">foo</font>
15826 !! html
15827 <p><font color="">foo</font>
15828 </p>
15829 !! end
15830
15831 !! test
15832 Empty attribute crash test single-quotes (bug 2067)
15833 !! wikitext
15834 <font color=''>foo</font>
15835 !! html
15836 <p><font color="">foo</font>
15837 </p>
15838 !! end
15839
15840 !! test
15841 Attribute test: equals, then nothing
15842 !! wikitext
15843 <font color=>foo</font>
15844 !! html
15845 <p><font>foo</font>
15846 </p>
15847 !! end
15848
15849 !! test
15850 Attribute test: unquoted value
15851 !! wikitext
15852 <font color=x>foo</font>
15853 !! html
15854 <p><font color="x">foo</font>
15855 </p>
15856 !! end
15857
15858 !! test
15859 Attribute test: unquoted but illegal value (hash)
15860 !! wikitext
15861 <font color=#x>foo</font>
15862 !! html
15863 <p><font color="#x">foo</font>
15864 </p>
15865 !! end
15866
15867 # Parsoid does not serialize to empty attribute syntax,
15868 # so wt2wt and html2wt cases are skipped
15869 !! test
15870 Attribute test: no value (T54330)
15871 !! options
15872 parsoid=wt2html,html2html
15873 !! wikitext
15874 <font color>foo</font>
15875 !! html/php
15876 <p><font color="">foo</font>
15877 </p>
15878 !! html/parsoid
15879 <p><font color="">foo</font></p>
15880 !! end
15881
15882 !! test
15883 Bug 2095: link with three closing brackets
15884 !! wikitext
15885 [[Main Page]]]
15886 !! html/php
15887 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15888 </p>
15889 !! html/parsoid
15890 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15891 !! end
15892
15893 !! test
15894 Bug 2095: link with pipe and three closing brackets
15895 !! wikitext
15896 [[Main Page|link]]]
15897 !! html/php
15898 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15899 </p>
15900 !! html/parsoid
15901 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15902 !! end
15903
15904 !! test
15905 Bug 2095: link with pipe and three closing brackets, version 2
15906 !! wikitext
15907 [[Main Page|[http://example.com/]]]
15908 !! html/php
15909 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15910 </p>
15911 !! html/parsoid
15912 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15913 !! end
15914
15915
15916 ###
15917 ### Safety
15918 ###
15919
15920 !! article
15921 Template:Dangerous attribute
15922 !! text
15923 " onmouseover="alert(document.cookie)
15924 !! endarticle
15925
15926 !! article
15927 Template:Dangerous style attribute
15928 !! text
15929 border-size: expression(alert(document.cookie))
15930 !! endarticle
15931
15932 !! article
15933 Template:Div style
15934 !! text
15935 <div style="float: right; {{{1}}}">Magic div</div>
15936 !! endarticle
15937
15938 !! test
15939 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15940 !! wikitext
15941 <div title="{{test}}"></div>
15942 !! html
15943 <div title="This is a test template"></div>
15944
15945 !! end
15946
15947 # Parsoid has enough context to handle this case
15948 !! test
15949 Bug 2304: HTML attribute safety (dangerous template; 2309)
15950 !! wikitext
15951 <div title="{{dangerous attribute}}"></div>
15952 !! html/php
15953 <div title=""></div>
15954
15955 !! html/parsoid
15956 <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>
15957 !! end
15958
15959 !! test
15960 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15961 !! wikitext
15962 <div style="{{dangerous style attribute}}"></div>
15963 !! html
15964 <div style="/* insecure input */"></div>
15965
15966 !! end
15967
15968 !! test
15969 Bug 2304: HTML attribute safety (safe parameter; 2309)
15970 !! wikitext
15971 {{div style|width: 200px}}
15972 !! html
15973 <div style="float: right; width: 200px">Magic div</div>
15974
15975 !! end
15976
15977 !! test
15978 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15979 !! wikitext
15980 {{div style|width: expression(alert(document.cookie))}}
15981 !! html
15982 <div style="/* insecure input */">Magic div</div>
15983
15984 !! end
15985
15986 !! test
15987 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15988 !! wikitext
15989 {{div style|"><script>alert(document.cookie)</script>}}
15990 !! html
15991 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15992
15993 !! end
15994
15995 !! test
15996 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15997 !! wikitext
15998 {{div style|" ><script>alert(document.cookie)</script>}}
15999 !! html
16000 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16001
16002 !! end
16003
16004 !! test
16005 Bug 2304: HTML attribute safety (link)
16006 !! wikitext
16007 <div title="[[Main Page]]"></div>
16008 !! html
16009 <div title="&#91;&#91;Main Page]]"></div>
16010
16011 !! end
16012
16013 !! test
16014 Bug 2304: HTML attribute safety (italics)
16015 !! wikitext
16016 <div title="''foobar''"></div>
16017 !! html
16018 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16019
16020 !! end
16021
16022 !! test
16023 Bug 2304: HTML attribute safety (bold)
16024 !! wikitext
16025 <div title="'''foobar'''"></div>
16026 !! html
16027 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16028
16029 !! end
16030
16031
16032 !! test
16033 Bug 2304: HTML attribute safety (ISBN)
16034 !! wikitext
16035 <div title="ISBN 1234567890"></div>
16036 !! html
16037 <div title="&#73;SBN 1234567890"></div>
16038
16039 !! end
16040
16041 !! test
16042 Bug 2304: HTML attribute safety (RFC)
16043 !! wikitext
16044 <div title="RFC 1234"></div>
16045 !! html
16046 <div title="&#82;FC 1234"></div>
16047
16048 !! end
16049
16050 !! test
16051 Bug 2304: HTML attribute safety (PMID)
16052 !! wikitext
16053 <div title="PMID 1234567890"></div>
16054 !! html
16055 <div title="&#80;MID 1234567890"></div>
16056
16057 !! end
16058
16059 !! test
16060 Bug 2304: HTML attribute safety (web link)
16061 !! wikitext
16062 <div title="http://example.com/"></div>
16063 !! html
16064 <div title="http&#58;//example.com/"></div>
16065
16066 !! end
16067
16068 !! test
16069 Bug 2304: HTML attribute safety (named web link)
16070 !! wikitext
16071 <div title="[http://example.com/ link]"></div>
16072 !! html
16073 <div title="&#91;http&#58;//example.com/ link]"></div>
16074
16075 !! end
16076
16077 !! test
16078 Bug 3244: HTML attribute safety (extension; safe)
16079 !! wikitext
16080 <div style="<nowiki>background:blue</nowiki>"></div>
16081 !! html
16082 <div style="background:blue"></div>
16083
16084 !! end
16085
16086 !! test
16087 Bug 3244: HTML attribute safety (extension; unsafe)
16088 !! wikitext
16089 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16090 !! html
16091 <div style="/* insecure input */"></div>
16092
16093 !! end
16094
16095 # More MSIE fun discovered by Tom Gilder
16096
16097 !! test
16098 MSIE CSS safety test: spurious slash
16099 !! wikitext
16100 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16101 !! html
16102 <div style="/* insecure input */">evil</div>
16103
16104 !! end
16105
16106 !! test
16107 MSIE CSS safety test: hex code
16108 !! wikitext
16109 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16110 !! html
16111 <div style="/* insecure input */">evil</div>
16112
16113 !! end
16114
16115 !! test
16116 MSIE CSS safety test: comment in url
16117 !! wikitext
16118 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16119 !! html
16120 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16121
16122 !! end
16123
16124 !! test
16125 MSIE CSS safety test: comment in expression
16126 !! wikitext
16127 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16128 !! html
16129 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16130
16131 !! end
16132
16133 !! test
16134 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16135 !! wikitext
16136 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16137 !! html
16138 <p style="/* invalid control char */">A</p>
16139
16140 !! end
16141
16142 !! test
16143 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16144 !! wikitext
16145 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16146 <div style="top:EXPRESSION(alert())">B</div>
16147 !! html
16148 <p style="/* insecure input */">A</p>
16149 <div style="/* insecure input */">B</div>
16150
16151 !! end
16152
16153 !! test
16154 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16155 !! wikitext
16156 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16157 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16158 !! html
16159 <div style="/* insecure input */">A</div>
16160 <p style="/* insecure input */">B</p>
16161
16162 !! end
16163
16164 !! test
16165 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16166 !! wikitext
16167 <div style="background-image:url⁽javascript:alert())">A</div>
16168 <div style="background-image:url₍javascript:alert())">B</div>
16169 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16170 !! html
16171 <div style="/* insecure input */">A</div>
16172 <div style="/* insecure input */">B</div>
16173 <p style="/* insecure input */">C</p>
16174
16175 !! end
16176
16177 # FIXME: Parsoid fails to sanitize this! See T58846.
16178 !! test
16179 Opera -o-link CSS
16180 !! wikitext
16181 <div
16182 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;"
16183 style="-o-link:attr(title);-o-link-source:current">X</div>
16184 !! html
16185 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16186
16187 !! end
16188
16189 !! test
16190 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16191 !! wikitext
16192 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16193 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16194 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16195 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16196 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16197 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16198 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16199 !! html
16200 <p style="/* insecure input */">A</p>
16201 <p style="/* insecure input */">B</p>
16202 <p style="/* insecure input */">C</p>
16203 <p style="/* insecure input */">D</p>
16204 <p style="/* insecure input */">E</p>
16205 <p style="/* insecure input */">F</p>
16206 <p style="/* insecure input */">G</p>
16207
16208 !! end
16209
16210 !! test
16211 Table attribute legitimate extension
16212 !! wikitext
16213 {|
16214 !+ style="<nowiki>color:blue</nowiki>"| status
16215 |}
16216 !! html
16217 <table>
16218 <tr>
16219 <th style="color:blue"> status
16220 </th></tr></table>
16221
16222 !!end
16223
16224 !! test
16225 Table attribute safety
16226 !! wikitext
16227 {|
16228 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16229 |}
16230 !! html
16231 <table>
16232 <tr>
16233 <th style="/* insecure input */"> status
16234 </th></tr></table>
16235
16236 !! end
16237
16238 !! test
16239 CSS line continuation 1
16240 !! wikitext
16241 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16242 !! html
16243 <div style="/* insecure input */"></div>
16244
16245 !! end
16246
16247 !! test
16248 CSS line continuation 2
16249 !! wikitext
16250 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16251 !! html
16252 <div style="/* invalid control char */"></div>
16253
16254 !! end
16255
16256 !! article
16257 Template:Identity
16258 !! text
16259 {{{1}}}
16260 !! endarticle
16261
16262 !! test
16263 Expansion of multi-line templates in attribute values (bug 6255)
16264 !! wikitext
16265 <div style="background: {{identity|#00FF00}}">-</div>
16266 !! html
16267 <div style="background: #00FF00">-</div>
16268
16269 !! end
16270
16271
16272 !! test
16273 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16274 !! wikitext
16275 <div style="background:
16276 #00FF00">-</div>
16277 !! html/php
16278 <div style="background: #00FF00">-</div>
16279
16280 !! html/parsoid
16281 <div style="background:
16282 #00FF00">-</div>
16283 !! end
16284
16285 !! test
16286 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16287 !! wikitext
16288 <div style="background: &#10;#00FF00">-</div>
16289 !! html
16290 <div style="background: &#10;#00FF00">-</div>
16291
16292 !! end
16293
16294 !! test
16295 evil <math>-wiki-tags without Extension:Math enabled
16296 !! wikitext
16297 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16298 !! html+tidy
16299 <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>
16300 !! end
16301
16302 ###
16303 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16304 ###
16305 !! test
16306 Parser hook: empty input
16307 !! wikitext
16308 <tag></tag>
16309 !! html/php
16310 <pre>
16311 ''
16312 array (
16313 )
16314 </pre>
16315
16316 !! html/parsoid
16317 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16318 !! end
16319
16320 ## Don't expect parsoid to rt this form.
16321 !! test
16322 Parser hook: empty input using terminated empty elements
16323 !! options
16324 parsoid=wt2html,html2html
16325 !! wikitext
16326 <tag/>
16327 !! html/php
16328 <pre>
16329 NULL
16330 array (
16331 )
16332 </pre>
16333
16334 !! html/parsoid
16335 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16336 !! end
16337
16338 !! test
16339 Parser hook: empty input using terminated empty elements (space before)
16340 !! wikitext
16341 <tag />
16342 !! html/php
16343 <pre>
16344 NULL
16345 array (
16346 )
16347 </pre>
16348
16349 !! html/parsoid
16350 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16351 !! end
16352
16353 !! test
16354 Parser hook: basic input
16355 !! wikitext
16356 <tag>input</tag>
16357 !! html/php
16358 <pre>
16359 'input'
16360 array (
16361 )
16362 </pre>
16363
16364 !! html/parsoid
16365 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16366 !! end
16367
16368 ## Don't expect parsoid to rt this form.
16369 !! test
16370 Parser hook: case insensitive
16371 !! options
16372 parsoid=wt2html,html2html
16373 !! wikitext
16374 <TAG>input</TAG>
16375 !! html/php
16376 <pre>
16377 'input'
16378 array (
16379 )
16380 </pre>
16381
16382 !! html/parsoid
16383 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16384 !! end
16385
16386 ## Don't expect parsoid to rt this form.
16387 !! test
16388 Parser hook: case insensitive, redux
16389 !! options
16390 parsoid=wt2html,html2html
16391 !! wikitext
16392 <TaG>input</TAg>
16393 !! html/php
16394 <pre>
16395 'input'
16396 array (
16397 )
16398 </pre>
16399
16400 !! html/parsoid
16401 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16402 !! end
16403
16404 !! test
16405 Parser hook: nested tags
16406 !! options
16407 noxml
16408 !! wikitext
16409 <tag><tag></tag></tag>
16410 !! html/php
16411 <pre>
16412 '<tag>'
16413 array (
16414 )
16415 </pre>&lt;/tag&gt;
16416
16417 !! html/parsoid
16418 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16419 !! end
16420
16421 !! test
16422 Parser hook: basic arguments
16423 !! wikitext
16424 <tag width="200" height="100" depth="50" square=""></tag>
16425 !! html/php
16426 <pre>
16427 ''
16428 array (
16429 'width' => '200',
16430 'height' => '100',
16431 'depth' => '50',
16432 'square' => '',
16433 )
16434 </pre>
16435
16436 !! html/parsoid
16437 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16438 !! end
16439
16440 ## Don't expect parsoid to rt this form.
16441 !! test
16442 Parser hook: basic arguments, variations
16443 !! options
16444 parsoid=wt2html,html2html
16445 !! wikitext
16446 <tag width=200 height = "100" depth = '50' square></tag>
16447 !! html/php
16448 <pre>
16449 ''
16450 array (
16451 'width' => '200',
16452 'height' => '100',
16453 'depth' => '50',
16454 'square' => '',
16455 )
16456 </pre>
16457
16458 !! html/parsoid
16459 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16460 !! end
16461
16462 !! test
16463 Parser hook: argument containing a forward slash (bug 5344)
16464 !! wikitext
16465 <tag filename="/tmp/bla"></tag>
16466 !! html/php
16467 <pre>
16468 ''
16469 array (
16470 'filename' => '/tmp/bla',
16471 )
16472 </pre>
16473
16474 !! html/parsoid
16475 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16476 !! end
16477
16478 ## Don't expect parsoid to rt this form.
16479 !! test
16480 Parser hook: empty input using terminated empty elements (bug 2374)
16481 !! options
16482 parsoid=wt2html,html2html
16483 !! wikitext
16484 <tag foo=bar/>text
16485 !! html/php
16486 <pre>
16487 NULL
16488 array (
16489 'foo' => 'bar',
16490 )
16491 </pre>text
16492
16493 !! html/parsoid
16494 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16495 !! end
16496
16497 # </tag> should be output literally since there is no matching tag that begins it
16498 !! test
16499 Parser hook: basic arguments using terminated empty elements (bug 2374)
16500 !! wikitext
16501 <tag width=200 height = "100" depth = '50' square/>
16502 other stuff
16503 </tag>
16504 !! html/php
16505 <pre>
16506 NULL
16507 array (
16508 'width' => '200',
16509 'height' => '100',
16510 'depth' => '50',
16511 'square' => '',
16512 )
16513 </pre>
16514 <p>other stuff
16515 &lt;/tag&gt;
16516 </p>
16517 !! end
16518
16519 ###
16520 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16521 ###
16522
16523 !! test
16524 Parser hook: static parser hook not inside a comment
16525 !! wikitext
16526 <statictag>hello, world</statictag>
16527
16528 <statictag action="flush" />
16529 !! html/php
16530 <p><br />
16531 hello, world
16532 </p>
16533 !! html/parsoid
16534 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16535 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16536 !! end
16537
16538 !! test
16539 Parser hook: static parser hook inside a comment
16540 !! wikitext
16541 <!-- <statictag>hello, world</statictag> -->
16542 <statictag action="flush" />
16543 !! html/php
16544 <p><br />
16545 </p>
16546 !! html/parsoid
16547 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16548 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16549 !! end
16550
16551 # Nested template calls; this case was broken by Parser.php rev 1.506,
16552 # since reverted.
16553
16554 !! article
16555 Template:One-parameter
16556 !! text
16557 (My parameter is: {{{1}}})
16558 !! endarticle
16559
16560 !! article
16561 Template:Map-one-parameter
16562 !! text
16563 {{{{{1}}}|{{{2}}}}}
16564 !! endarticle
16565
16566 !! test
16567 Nested template calls
16568 !! wikitext
16569 {{Map-one-parameter|One-parameter|param}}
16570 !! html
16571 <p>(My parameter is: param)
16572 </p>
16573 !! end
16574
16575
16576 ###
16577 ### Sanitizer
16578 ###
16579
16580 # HTML+Tidy effectively strips out the empty tags completely
16581 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16582 # which Tidy would have done for the PHP parser had there been content inside it.
16583 !! test
16584 Sanitizer: Closing of open tags
16585 !! wikitext
16586 <s></s><table></table>
16587 !! html
16588 <s></s><table></table>
16589
16590 !! html/parsoid
16591 <p><s></s></p><table></table>
16592 !! end
16593
16594 !! test
16595 Sanitizer: Closing of open but not closed tags
16596 !! wikitext
16597 <s>foo
16598 !! html
16599 <p><s>foo</s>
16600 </p>
16601 !! end
16602
16603 !! test
16604 Sanitizer: Closing of closed but not open tags
16605 !! options
16606 parsoid=wt2html
16607 !! wikitext
16608 </s>
16609 !! html/php+tidy
16610 !! html/parsoid
16611 !! end
16612
16613 !! test
16614 Sanitizer: Closing of closed but not open table tags
16615 !! options
16616 parsoid=wt2html
16617 !! wikitext
16618 Table not started</td></tr></table>
16619 !! html/php+tidy
16620 <p>Table not started</p>
16621 !! html/parsoid
16622 <p>Table not started</p>
16623 !! end
16624
16625 !! test
16626 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16627 !! wikitext
16628 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16629 !! html
16630 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16631 </p>
16632 !! end
16633
16634 # In HTML5, the restrictions are that id must contain at least one character,
16635 # and must not contain any space characters.
16636 !! test
16637 Sanitizer: Validating the contents of the id attribute (bug 4515)
16638 !! options
16639 disabled
16640 !! wikitext
16641 <br id="" /><br id="a space" />
16642 !! html
16643 Something ...
16644 !! end
16645
16646 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16647 !! test
16648 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16649 !! options
16650 disabled
16651 !! wikitext
16652 <br id="foo" /><br id="foo" />
16653 !! html
16654 Something need to be done. foo-2 ?
16655 !! end
16656
16657 !! test
16658 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16659 !! wikitext
16660 <div itemscope>
16661 <meta itemprop="hello" content="world">
16662 <meta http-equiv="refresh" content="5">
16663 <meta itemprop="hello" http-equiv="refresh" content="5">
16664 <link itemprop="hello" href="{{SERVER}}">
16665 <link rel="stylesheet" href="{{SERVER}}">
16666 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16667 </div>
16668 !! html
16669 <div itemscope="">
16670 <p> <meta itemprop="hello" content="world" />
16671 &lt;meta http-equiv="refresh" content="5"&gt;
16672 <meta itemprop="hello" content="5" />
16673 </p>
16674 <link itemprop="hello" href="http&#58;//example.org" />
16675 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16676 <link itemprop="hello" href="http&#58;//example.org" />
16677 </div>
16678
16679 !! end
16680
16681 !! test
16682 Language converter: output gets cut off unexpectedly (bug 5757)
16683 !! options
16684 language=zh
16685 !! wikitext
16686 this bit is safe: }-
16687
16688 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16689
16690 then we get cut off here: }-
16691
16692 all additional text is vanished
16693 !! html
16694 <p>this bit is safe: }-
16695 </p><p>but if we add a conversion instance: xxx
16696 </p><p>then we get cut off here: }-
16697 </p><p>all additional text is vanished
16698 </p>
16699 !! end
16700
16701 !! test
16702 Self closed html pairs (bug 5487)
16703 !! options
16704 !! wikitext
16705 <center><font id="bug" />Centered text</center>
16706 <div><font id="bug2" />In div text</div>
16707 !! html
16708 <center>&lt;font id="bug" /&gt;Centered text</center>
16709 <div>&lt;font id="bug2" /&gt;In div text</div>
16710
16711 !! end
16712
16713 #
16714 #
16715 #
16716
16717 !! test
16718 Punctuation: nbsp before exclamation
16719 !! wikitext
16720 C'est grave !
16721 !! html
16722 <p>C'est grave&#160;!
16723 </p>
16724 !! end
16725
16726 !! test
16727 Punctuation: CSS !important (bug 11874)
16728 !! wikitext
16729 <div style="width:50% !important">important</div>
16730 !! html
16731 <div style="width:50% !important">important</div>
16732
16733 !!end
16734
16735 !! test
16736 Punctuation: CSS ! important (bug 11874; with space after)
16737 !! wikitext
16738 <div style="width:50% ! important">important</div>
16739 !! html
16740 <div style="width:50% ! important">important</div>
16741
16742 !!end
16743
16744 !! test
16745 HTML bullet list, closed tags (bug 5497)
16746 !! wikitext
16747 <ul>
16748 <li>One</li>
16749 <li>Two</li>
16750 </ul>
16751 !! html/php
16752 <ul>
16753 <li>One</li>
16754 <li>Two</li>
16755 </ul>
16756
16757 !! html/parsoid
16758 <ul data-parsoid='{"stx":"html"}'>
16759 <li data-parsoid='{"stx":"html"}'>One</li>
16760 <li data-parsoid='{"stx":"html"}'>Two</li>
16761 </ul>
16762
16763 !! end
16764
16765 !! test
16766 HTML bullet list, unclosed tags (bug 5497)
16767 !! wikitext
16768 <ul>
16769 <li>One
16770 <li>Two
16771 </ul>
16772 !! html/php+tidy
16773 <ul>
16774 <li>One</li>
16775 <li>Two</li>
16776 </ul>
16777 !! html/parsoid
16778 <ul data-parsoid='{"stx":"html"}'>
16779 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16780 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16781 </ul>
16782
16783 !! end
16784
16785 !! test
16786 HTML ordered list, closed tags (bug 5497)
16787 !! wikitext
16788 <ol>
16789 <li>One</li>
16790 <li>Two</li>
16791 </ol>
16792 !! html/php
16793 <ol>
16794 <li>One</li>
16795 <li>Two</li>
16796 </ol>
16797
16798 !! html/parsoid
16799 <ol data-parsoid='{"stx":"html"}'>
16800 <li data-parsoid='{"stx":"html"}'>One</li>
16801 <li data-parsoid='{"stx":"html"}'>Two</li>
16802 </ol>
16803
16804 !! end
16805
16806 !! test
16807 HTML ordered list, unclosed tags (bug 5497)
16808 !! options
16809 !! wikitext
16810 <ol>
16811 <li>One
16812 <li>Two
16813 </ol>
16814 !! html/php+tidy
16815 <ol>
16816 <li>One</li>
16817 <li>Two</li>
16818 </ol>
16819 !! html/parsoid
16820 <ol data-parsoid='{"stx":"html"}'>
16821 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16822 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16823 </ol>
16824
16825 !! end
16826
16827 !! test
16828 HTML nested bullet list, closed tags (bug 5497)
16829 !! wikitext
16830 <ul>
16831 <li>One</li>
16832 <li>Two:
16833 <ul>
16834 <li>Sub-one</li>
16835 <li>Sub-two</li>
16836 </ul>
16837 </li>
16838 </ul>
16839 !! html
16840 <ul>
16841 <li>One</li>
16842 <li>Two:
16843 <ul>
16844 <li>Sub-one</li>
16845 <li>Sub-two</li>
16846 </ul>
16847 </li>
16848 </ul>
16849
16850 !! end
16851
16852 !! test
16853 HTML nested bullet list, open tags (bug 5497)
16854 !! wikitext
16855 <ul>
16856 <li>One
16857 <li>Two:
16858 <ul>
16859 <li>Sub-one
16860 <li>Sub-two
16861 </ul>
16862 </ul>
16863 !! html/php+tidy
16864 <ul>
16865 <li>One</li>
16866 <li>Two:
16867 <ul>
16868 <li>Sub-one</li>
16869 <li>Sub-two</li>
16870 </ul>
16871 </li>
16872 </ul>
16873 !! html/parsoid
16874 <ul>
16875 <li>One
16876 </li>
16877 <li>Two:
16878 <ul>
16879 <li>Sub-one
16880 </li>
16881 <li>Sub-two
16882 </li>
16883 </ul>
16884 </li>
16885 </ul>
16886
16887 !! end
16888
16889 !! test
16890 HTML nested ordered list, closed tags (bug 5497)
16891 !! wikitext
16892 <ol>
16893 <li>One</li>
16894 <li>Two:
16895 <ol>
16896 <li>Sub-one</li>
16897 <li>Sub-two</li>
16898 </ol>
16899 </li>
16900 </ol>
16901 !! html
16902 <ol>
16903 <li>One</li>
16904 <li>Two:
16905 <ol>
16906 <li>Sub-one</li>
16907 <li>Sub-two</li>
16908 </ol>
16909 </li>
16910 </ol>
16911
16912 !! end
16913
16914 !! test
16915 HTML nested ordered list, open tags (bug 5497)
16916 !! wikitext
16917 <ol>
16918 <li>One
16919 <li>Two:
16920 <ol>
16921 <li>Sub-one
16922 <li>Sub-two
16923 </ol>
16924 </ol>
16925 !! html/php
16926 <ol>
16927 <li>One
16928 <li>Two:
16929 <ol>
16930 <li>Sub-one
16931 <li>Sub-two
16932 </ol>
16933 </ol>
16934
16935 !! html/parsoid
16936 <ol>
16937 <li>One
16938 </li>
16939 <li>Two:
16940 <ol>
16941 <li>Sub-one
16942 </li>
16943 <li>Sub-two
16944 </li>
16945 </ol>
16946 </li>
16947 </ol>
16948
16949 !! end
16950
16951 !! test
16952 HTML ordered list item with parameters oddity
16953 !! wikitext
16954 <ol><li id="fragment">One</li>
16955 </ol>
16956 !! html
16957 <ol><li id="fragment">One</li>
16958 </ol>
16959
16960 !! end
16961
16962 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16963 !!test
16964 bug 5918: autonumbering
16965 !! wikitext
16966 [http://first/] [http://second] [ftp://ftp]
16967
16968 ftp://inlineftp
16969
16970 [mailto:enclosed@mail.tld With target]
16971
16972 [mailto:enclosed@mail.tld]
16973
16974 mailto:inline@mail.tld
16975 !! html/php
16976 <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>
16977 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16978 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16979 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16980 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16981 </p>
16982 !! html/parsoid
16983 <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>
16984 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16985 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16986 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16987 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16988 !! end
16989
16990
16991 #
16992 # Security and HTML correctness
16993 # From Nick Jenkins' fuzz testing
16994 #
16995
16996 !! test
16997 Fuzz testing: Parser13
16998 !! wikitext
16999 {|
17000 | http://a|
17001 !! html
17002 <table>
17003 <tr>
17004 <td>
17005 </td>
17006 </tr>
17007 </table>
17008
17009 !! end
17010
17011 !! test
17012 Fuzz testing: Parser14
17013 !! wikitext
17014 == onmouseover= ==
17015 http://__TOC__
17016 !! html
17017 <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>
17018 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17019 <ul>
17020 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17021 </ul>
17022 </div>
17023
17024
17025 !! html+tidy
17026 <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>
17027 <p>http://</p>
17028 <div id="toc" class="toc">
17029 <div id="toctitle">
17030 <h2>Contents</h2>
17031 </div>
17032 <ul>
17033 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17034 </ul>
17035 </div>
17036 <p></p>
17037 !! end
17038
17039 !! test
17040 Fuzz testing: Parser14-table
17041 !! wikitext
17042 ==a==
17043 {| STYLE=__TOC__
17044 !! html
17045 <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>
17046 <table style="&#95;_TOC&#95;_">
17047 <tr><td></td></tr>
17048 </table>
17049
17050 !! html+tidy
17051 <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>
17052 <table style="__TOC__">
17053 <tr>
17054 <td></td>
17055 </tr>
17056 </table>
17057 !! end
17058
17059 # Known to produce bogus xml (extra </td>)
17060 !! test
17061 Fuzz testing: Parser16
17062 !! options
17063 noxml
17064 !! wikitext
17065 {|
17066 !https://||||||
17067 !! html
17068 <table>
17069 <tr>
17070 <th>https://</th>
17071 <th></th>
17072 <th></th>
17073 <th>
17074 </td>
17075 </tr>
17076 </table>
17077
17078 !! html+tidy
17079 <table>
17080 <tr>
17081 <th>https://</th>
17082 <th></th>
17083 <th></th>
17084 <th></th>
17085 </tr>
17086 </table>
17087 !! end
17088
17089 !! test
17090 Fuzz testing: Parser21
17091 !! wikitext
17092 {|
17093 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17094 |
17095 !! html
17096 <table>
17097 <tr>
17098 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17099 </th>
17100 <td>
17101 </td>
17102 </tr>
17103 </table>
17104
17105 !! end
17106
17107 !! test
17108 Fuzz testing: Parser22
17109 !! wikitext
17110 http://===r:::https://b
17111
17112 {|
17113 !! html
17114 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17115 </p>
17116 <table>
17117 <tr><td></td></tr>
17118 </table>
17119
17120 !! end
17121
17122 # Known to produce bad XML for now
17123 !! test
17124 Fuzz testing: Parser24
17125 !! options
17126 noxml
17127 !! wikitext
17128 {|
17129 {{{|
17130 <u CLASS=
17131 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17132 <br style="onmouseover='alert(document.cookie);' " />
17133
17134 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17135 |
17136 !! html
17137 <table>
17138 {{{|
17139 <u class="&#124;">}}}} &gt;
17140 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17141
17142 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17143 <tr>
17144 <td></u>
17145 </td>
17146 </tr>
17147 </table>
17148
17149 !! end
17150
17151 # Note: the current result listed for this is not what the original one was,
17152 # but the original bug was JavaScript injection, which is fixed in any case.
17153 # It's not clear that the original result listed was any more correct than the
17154 # current one. Original result:
17155 # <p>{{{|
17156 # </p>
17157 # <li class="&#124;&#124;">
17158 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17159 !!test
17160 Fuzz testing: Parser25 (bug 6055)
17161 !! wikitext
17162 {{{
17163 |
17164 <LI CLASS=||
17165 >
17166 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17167 !! html
17168 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17169 </p>
17170 !! end
17171
17172 !!test
17173 Fuzz testing: URL adjacent extension (with space, clean)
17174 !! wikitext
17175 http://example.com <nowiki>junk</nowiki>
17176 !! html/php
17177 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17178 </p>
17179 !! html/parsoid
17180 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17181 !! end
17182
17183 !!test
17184 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17185 !! wikitext
17186 http://example.com<nowiki>junk</nowiki>
17187 !! html/php
17188 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17189 </p>
17190 !! html/parsoid
17191 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17192 !! end
17193
17194 !!test
17195 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17196 !! wikitext
17197 http://example.com<pre>junk</pre>
17198 !! html/php
17199 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17200
17201 !! html/php+tidy
17202 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17203 <pre>
17204 junk
17205 </pre>
17206 !! html/parsoid
17207 <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>
17208 !!end
17209
17210 !!test
17211 Fuzz testing: image with bogus manual thumbnail
17212 !! wikitext
17213 [[Image:foobar.jpg|thumbnail= ]]
17214 !! html/php
17215 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17216
17217 !! html/parsoid
17218 <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>
17219 !!end
17220
17221 !! test
17222 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17223 !! wikitext
17224 <pre dir="&#10;"></pre>
17225 !! html
17226 <pre dir="&#10;"></pre>
17227
17228 !! end
17229
17230 !! test
17231 Parsing optional HTML elements (Bug 6171)
17232 !! options
17233 !! wikitext
17234 <table>
17235 <tr>
17236 <td> Some tabular data</td>
17237 <td> More tabular data ...
17238 <td> And yet som tabular data</td>
17239 </tr>
17240 </table>
17241 !! html
17242 <table>
17243 <tr>
17244 <td> Some tabular data</td>
17245 <td> More tabular data ...
17246 </td><td> And yet som tabular data</td>
17247 </tr>
17248 </table>
17249
17250 !! end
17251
17252 !! test
17253 Correct handling of <td>, <tr> (Bug 6171)
17254 !! options
17255 !! wikitext
17256 <table>
17257 <tr>
17258 <td> Some tabular data</td>
17259 <td> More tabular data ...</td>
17260 <td> And yet som tabular data</td>
17261 </tr>
17262 </table>
17263 !! html
17264 <table>
17265 <tr>
17266 <td> Some tabular data</td>
17267 <td> More tabular data ...</td>
17268 <td> And yet som tabular data</td>
17269 </tr>
17270 </table>
17271
17272 !! end
17273
17274
17275 !! test
17276 Parsing crashing regression (fr:JavaScript)
17277 !! wikitext
17278 </body></x>
17279 !! html
17280 <p>&lt;/body&gt;&lt;/x&gt;
17281 </p>
17282 !! end
17283
17284 !! test
17285 Inline wiki vs wiki block nesting
17286 !! wikitext
17287 '''Bold paragraph
17288
17289 New wiki paragraph
17290 !! html
17291 <p><b>Bold paragraph</b>
17292 </p><p>New wiki paragraph
17293 </p>
17294 !! end
17295
17296 # FIXME: The current php output is documented
17297 # and desired output is the parsoid target.
17298 !! test
17299 Inline HTML vs wiki block nesting
17300 !! wikitext
17301 <b>Bold paragraph
17302
17303 New wiki paragraph
17304 !! html/php
17305 <p><b>Bold paragraph
17306 </p><p>New wiki paragraph</b>
17307 </p>
17308 !! html/parsoid
17309 <p><b>Bold paragraph</b>
17310 </p><p>New wiki paragraph
17311 </p>
17312 !! end
17313
17314 # Original result was this:
17315 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17316 # </p>
17317 # While that might be marginally more intuitive, maybe, the six-apostrophe
17318 # construct is clearly pathological and the result stated here (which is what
17319 # the parser actually does) is about as reasonable as anything.
17320 !!test
17321 Mixing markup for italics and bold
17322 !! options
17323 !! wikitext
17324 '''bold''''''bold''bolditalics'''''
17325 !! html
17326 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17327 </p>
17328 !! end
17329
17330
17331 !! article
17332 Xyzzyx
17333 !! text
17334 Article for special page transclusion test
17335 !! endarticle
17336
17337 !! test
17338 Special page transclusion
17339 !! options
17340 !! wikitext
17341 {{Special:Prefixindex/Xyzzyx}}
17342 !! html
17343 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17344 </ul>
17345
17346 !! end
17347
17348 !! test
17349 Special page transclusion twice (bug 5021)
17350 !! options
17351 !! wikitext
17352 {{Special:Prefixindex/Xyzzyx}}
17353 {{Special:Prefixindex/Xyzzyx}}
17354 !! html
17355 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17356 </ul>
17357 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17358 </ul>
17359
17360 !! end
17361
17362 !! test
17363 Transclusion of default MediaWiki message
17364 !! wikitext
17365 {{MediaWiki:Mainpage}}
17366 !! html
17367 <p>Main Page
17368 </p>
17369 !! end
17370
17371 !! test
17372 Transclusion of nonexistent MediaWiki message
17373 !! wikitext
17374 {{MediaWiki:Mainpagexxx}}
17375 !! html
17376 <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>
17377 </p>
17378 !! end
17379
17380 !! test
17381 Transclusion of MediaWiki message with underscore
17382 !! wikitext
17383 {{MediaWiki:history_short}}
17384 !! html
17385 <p>History
17386 </p>
17387 !! end
17388
17389 !! test
17390 Transclusion of MediaWiki message with space
17391 !! wikitext
17392 {{MediaWiki:history short}}
17393 !! html
17394 <p>History
17395 </p>
17396 !! end
17397
17398 !! test
17399 Invalid header with following text
17400 !! wikitext
17401 = x = y
17402 !! html
17403 <p>= x = y
17404 </p>
17405 !! end
17406
17407
17408 !! test
17409 Section extraction test (section 0)
17410 !! options
17411 section=0
17412 !! wikitext
17413 start
17414 ==a==
17415 ===aa===
17416 ====aaa====
17417 ==b==
17418 ===ba===
17419 ===bb===
17420 ====bba====
17421 ===bc===
17422 ==c==
17423 ===ca===
17424 !! html/php
17425 start
17426 !! end
17427
17428 !! test
17429 Section extraction test (section 1)
17430 !! options
17431 section=1
17432 !! wikitext
17433 start
17434 ==a==
17435 ===aa===
17436 ====aaa====
17437 ==b==
17438 ===ba===
17439 ===bb===
17440 ====bba====
17441 ===bc===
17442 ==c==
17443 ===ca===
17444 !! html/php
17445 ==a==
17446 ===aa===
17447 ====aaa====
17448 !! end
17449
17450 !! test
17451 Section extraction test (section 2)
17452 !! options
17453 section=2
17454 !! wikitext
17455 start
17456 ==a==
17457 ===aa===
17458 ====aaa====
17459 ==b==
17460 ===ba===
17461 ===bb===
17462 ====bba====
17463 ===bc===
17464 ==c==
17465 ===ca===
17466 !! html/php
17467 ===aa===
17468 ====aaa====
17469 !! end
17470
17471 !! test
17472 Section extraction test (section 3)
17473 !! options
17474 section=3
17475 !! wikitext
17476 start
17477 ==a==
17478 ===aa===
17479 ====aaa====
17480 ==b==
17481 ===ba===
17482 ===bb===
17483 ====bba====
17484 ===bc===
17485 ==c==
17486 ===ca===
17487 !! html/php
17488 ====aaa====
17489 !! end
17490
17491 !! test
17492 Section extraction test (section 4)
17493 !! options
17494 section=4
17495 !! wikitext
17496 start
17497 ==a==
17498 ===aa===
17499 ====aaa====
17500 ==b==
17501 ===ba===
17502 ===bb===
17503 ====bba====
17504 ===bc===
17505 ==c==
17506 ===ca===
17507 !! html/php
17508 ==b==
17509 ===ba===
17510 ===bb===
17511 ====bba====
17512 ===bc===
17513 !! end
17514
17515 !! test
17516 Section extraction test (section 5)
17517 !! options
17518 section=5
17519 !! wikitext
17520 start
17521 ==a==
17522 ===aa===
17523 ====aaa====
17524 ==b==
17525 ===ba===
17526 ===bb===
17527 ====bba====
17528 ===bc===
17529 ==c==
17530 ===ca===
17531 !! html/php
17532 ===ba===
17533 !! end
17534
17535 !! test
17536 Section extraction test (section 6)
17537 !! options
17538 section=6
17539 !! wikitext
17540 start
17541 ==a==
17542 ===aa===
17543 ====aaa====
17544 ==b==
17545 ===ba===
17546 ===bb===
17547 ====bba====
17548 ===bc===
17549 ==c==
17550 ===ca===
17551 !! html/php
17552 ===bb===
17553 ====bba====
17554 !! end
17555
17556 !! test
17557 Section extraction test (section 7)
17558 !! options
17559 section=7
17560 !! wikitext
17561 start
17562 ==a==
17563 ===aa===
17564 ====aaa====
17565 ==b==
17566 ===ba===
17567 ===bb===
17568 ====bba====
17569 ===bc===
17570 ==c==
17571 ===ca===
17572 !! html/php
17573 ====bba====
17574 !! end
17575
17576 !! test
17577 Section extraction test (section 8)
17578 !! options
17579 section=8
17580 !! wikitext
17581 start
17582 ==a==
17583 ===aa===
17584 ====aaa====
17585 ==b==
17586 ===ba===
17587 ===bb===
17588 ====bba====
17589 ===bc===
17590 ==c==
17591 ===ca===
17592 !! html/php
17593 ===bc===
17594 !! end
17595
17596 !! test
17597 Section extraction test (section 9)
17598 !! options
17599 section=9
17600 !! wikitext
17601 start
17602 ==a==
17603 ===aa===
17604 ====aaa====
17605 ==b==
17606 ===ba===
17607 ===bb===
17608 ====bba====
17609 ===bc===
17610 ==c==
17611 ===ca===
17612 !! html/php
17613 ==c==
17614 ===ca===
17615 !! end
17616
17617 !! test
17618 Section extraction test (section 10)
17619 !! options
17620 section=10
17621 !! wikitext
17622 start
17623 ==a==
17624 ===aa===
17625 ====aaa====
17626 ==b==
17627 ===ba===
17628 ===bb===
17629 ====bba====
17630 ===bc===
17631 ==c==
17632 ===ca===
17633 !! html/php
17634 ===ca===
17635 !! end
17636
17637 !! test
17638 Section extraction test (nonexistent section 11)
17639 !! options
17640 section=11
17641 !! wikitext
17642 start
17643 ==a==
17644 ===aa===
17645 ====aaa====
17646 ==b==
17647 ===ba===
17648 ===bb===
17649 ====bba====
17650 ===bc===
17651 ==c==
17652 ===ca===
17653 !! html/php
17654 !! end
17655
17656 !! test
17657 Section extraction test with bogus heading (section 1)
17658 !! options
17659 section=1
17660 !! wikitext
17661 ==a==
17662 ==bogus== not a legal section
17663 ==b==
17664 !! html/php
17665 ==a==
17666 ==bogus== not a legal section
17667 !! end
17668
17669 !! test
17670 Section extraction test with bogus heading (section 2)
17671 !! options
17672 section=2
17673 !! wikitext
17674 ==a==
17675 ==bogus== not a legal section
17676 ==b==
17677 !! html/php
17678 ==b==
17679 !! end
17680
17681 !! test
17682 Section extraction test with comment after heading (section 1)
17683 !! options
17684 section=1
17685 !! wikitext
17686 ==a==
17687 ==b== <!-- -->
17688 ==c==
17689 !! html/php
17690 ==a==
17691 !! end
17692
17693 !! test
17694 Section extraction test with comment after heading (section 2)
17695 !! options
17696 section=2
17697 !! wikitext
17698 ==a==
17699 ==b== <!-- -->
17700 ==c==
17701 !! html/php
17702 ==b== <!-- -->
17703 !! end
17704
17705 !! test
17706 Section extraction test with bogus <nowiki> heading (section 1)
17707 !! options
17708 section=1
17709 !! wikitext
17710 ==a==
17711 ==bogus== <nowiki>not a legal section</nowiki>
17712 ==b==
17713 !! html/php
17714 ==a==
17715 ==bogus== <nowiki>not a legal section</nowiki>
17716 !! end
17717
17718 !! test
17719 Section extraction test with bogus <nowiki> heading (section 2)
17720 !! options
17721 section=2
17722 !! wikitext
17723 ==a==
17724 ==bogus== <nowiki>not a legal section</nowiki>
17725 ==b==
17726 !! html/php
17727 ==b==
17728 !! end
17729
17730 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17731 # instead of respecting commented sections
17732 !! test
17733 Section extraction prefixed by comment (section 1)
17734 !! options
17735 section=1
17736 !! wikitext
17737 <!-- -->==sec1==
17738 ==sec2==
17739 !! html/php
17740 ==sec2==
17741 !!end
17742
17743 !! test
17744 Section extraction prefixed by comment (section 2)
17745 !! options
17746 section=2
17747 !! wikitext
17748 <!-- -->==sec1==
17749 ==sec2==
17750 !! html/php
17751
17752 !!end
17753
17754 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17755 # instead of respecting HTML-style headings
17756 !! test
17757 Section extraction, mixed wiki and html (section 1)
17758 !! options
17759 section=1
17760 !! wikitext
17761 <h2>unmarked</h2>
17762 unmarked
17763 ==1==
17764 one
17765 ==2==
17766 two
17767 !! html/php
17768 ==1==
17769 one
17770 !! end
17771
17772 !! test
17773 Section extraction, mixed wiki and html (section 2)
17774 !! options
17775 section=2
17776 !! wikitext
17777 <h2>unmarked</h2>
17778 unmarked
17779 ==1==
17780 one
17781 ==2==
17782 two
17783 !! html/php
17784 ==2==
17785 two
17786 !! end
17787
17788
17789 # Formerly testing for bug 3342
17790 !! test
17791 Section extraction, heading surrounded by <noinclude>
17792 !! options
17793 section=1
17794 !! wikitext
17795 <noinclude>==unmarked==</noinclude>
17796 ==marked==
17797 !! html/php
17798 ==marked==
17799 !!end
17800
17801 # Test behavior of bug 19910
17802 !! test
17803 Sectiion with all-equals
17804 !! options
17805 section=2
17806 !! wikitext
17807 ===
17808 The line above must have a trailing space
17809 === <!--
17810 --> <!-- -->
17811 But just in case it doesn't...
17812 !! html/php
17813 === <!--
17814 --> <!-- -->
17815 But just in case it doesn't...
17816 !! end
17817
17818 !! test
17819 Section replacement test (section 0)
17820 !! options
17821 replace=0,"xxx"
17822 !! wikitext
17823 start
17824 ==a==
17825 ===aa===
17826 ====aaa====
17827 ==b==
17828 ===ba===
17829 ===bb===
17830 ====bba====
17831 ===bc===
17832 ==c==
17833 ===ca===
17834 !! html/php
17835 xxx
17836
17837 ==a==
17838 ===aa===
17839 ====aaa====
17840 ==b==
17841 ===ba===
17842 ===bb===
17843 ====bba====
17844 ===bc===
17845 ==c==
17846 ===ca===
17847 !! end
17848
17849 !! test
17850 Section replacement test (section 1)
17851 !! options
17852 replace=1,"xxx"
17853 !! wikitext
17854 start
17855 ==a==
17856 ===aa===
17857 ====aaa====
17858 ==b==
17859 ===ba===
17860 ===bb===
17861 ====bba====
17862 ===bc===
17863 ==c==
17864 ===ca===
17865 !! html/php
17866 start
17867 xxx
17868
17869 ==b==
17870 ===ba===
17871 ===bb===
17872 ====bba====
17873 ===bc===
17874 ==c==
17875 ===ca===
17876 !! end
17877
17878 !! test
17879 Section replacement test (section 2)
17880 !! options
17881 replace=2,"xxx"
17882 !! wikitext
17883 start
17884 ==a==
17885 ===aa===
17886 ====aaa====
17887 ==b==
17888 ===ba===
17889 ===bb===
17890 ====bba====
17891 ===bc===
17892 ==c==
17893 ===ca===
17894 !! html/php
17895 start
17896 ==a==
17897 xxx
17898
17899 ==b==
17900 ===ba===
17901 ===bb===
17902 ====bba====
17903 ===bc===
17904 ==c==
17905 ===ca===
17906 !! end
17907
17908 !! test
17909 Section replacement test (section 3)
17910 !! options
17911 replace=3,"xxx"
17912 !! wikitext
17913 start
17914 ==a==
17915 ===aa===
17916 ====aaa====
17917 ==b==
17918 ===ba===
17919 ===bb===
17920 ====bba====
17921 ===bc===
17922 ==c==
17923 ===ca===
17924 !! html/php
17925 start
17926 ==a==
17927 ===aa===
17928 xxx
17929
17930 ==b==
17931 ===ba===
17932 ===bb===
17933 ====bba====
17934 ===bc===
17935 ==c==
17936 ===ca===
17937 !! end
17938
17939 !! test
17940 Section replacement test (section 4)
17941 !! options
17942 replace=4,"xxx"
17943 !! wikitext
17944 start
17945 ==a==
17946 ===aa===
17947 ====aaa====
17948 ==b==
17949 ===ba===
17950 ===bb===
17951 ====bba====
17952 ===bc===
17953 ==c==
17954 ===ca===
17955 !! html/php
17956 start
17957 ==a==
17958 ===aa===
17959 ====aaa====
17960 xxx
17961
17962 ==c==
17963 ===ca===
17964 !! end
17965
17966 !! test
17967 Section replacement test (section 5)
17968 !! options
17969 replace=5,"xxx"
17970 !! wikitext
17971 start
17972 ==a==
17973 ===aa===
17974 ====aaa====
17975 ==b==
17976 ===ba===
17977 ===bb===
17978 ====bba====
17979 ===bc===
17980 ==c==
17981 ===ca===
17982 !! html/php
17983 start
17984 ==a==
17985 ===aa===
17986 ====aaa====
17987 ==b==
17988 xxx
17989
17990 ===bb===
17991 ====bba====
17992 ===bc===
17993 ==c==
17994 ===ca===
17995 !! end
17996
17997 !! test
17998 Section replacement test (section 6)
17999 !! options
18000 replace=6,"xxx"
18001 !! wikitext
18002 start
18003 ==a==
18004 ===aa===
18005 ====aaa====
18006 ==b==
18007 ===ba===
18008 ===bb===
18009 ====bba====
18010 ===bc===
18011 ==c==
18012 ===ca===
18013 !! html/php
18014 start
18015 ==a==
18016 ===aa===
18017 ====aaa====
18018 ==b==
18019 ===ba===
18020 xxx
18021
18022 ===bc===
18023 ==c==
18024 ===ca===
18025 !! end
18026
18027 !! test
18028 Section replacement test (section 7)
18029 !! options
18030 replace=7,"xxx"
18031 !! wikitext
18032 start
18033 ==a==
18034 ===aa===
18035 ====aaa====
18036 ==b==
18037 ===ba===
18038 ===bb===
18039 ====bba====
18040 ===bc===
18041 ==c==
18042 ===ca===
18043 !! html/php
18044 start
18045 ==a==
18046 ===aa===
18047 ====aaa====
18048 ==b==
18049 ===ba===
18050 ===bb===
18051 xxx
18052
18053 ===bc===
18054 ==c==
18055 ===ca===
18056 !! end
18057
18058 !! test
18059 Section replacement test (section 8)
18060 !! options
18061 replace=8,"xxx"
18062 !! wikitext
18063 start
18064 ==a==
18065 ===aa===
18066 ====aaa====
18067 ==b==
18068 ===ba===
18069 ===bb===
18070 ====bba====
18071 ===bc===
18072 ==c==
18073 ===ca===
18074 !! html/php
18075 start
18076 ==a==
18077 ===aa===
18078 ====aaa====
18079 ==b==
18080 ===ba===
18081 ===bb===
18082 ====bba====
18083 xxx
18084
18085 ==c==
18086 ===ca===
18087 !!end
18088
18089 !! test
18090 Section replacement test (section 9)
18091 !! options
18092 replace=9,"xxx"
18093 !! wikitext
18094 start
18095 ==a==
18096 ===aa===
18097 ====aaa====
18098 ==b==
18099 ===ba===
18100 ===bb===
18101 ====bba====
18102 ===bc===
18103 ==c==
18104 ===ca===
18105 !! html/php
18106 start
18107 ==a==
18108 ===aa===
18109 ====aaa====
18110 ==b==
18111 ===ba===
18112 ===bb===
18113 ====bba====
18114 ===bc===
18115 xxx
18116 !! end
18117
18118 !! test
18119 Section replacement test (section 10)
18120 !! options
18121 replace=10,"xxx"
18122 !! wikitext
18123 start
18124 ==a==
18125 ===aa===
18126 ====aaa====
18127 ==b==
18128 ===ba===
18129 ===bb===
18130 ====bba====
18131 ===bc===
18132 ==c==
18133 ===ca===
18134 !! html/php
18135 start
18136 ==a==
18137 ===aa===
18138 ====aaa====
18139 ==b==
18140 ===ba===
18141 ===bb===
18142 ====bba====
18143 ===bc===
18144 ==c==
18145 xxx
18146 !! end
18147
18148 !! test
18149 Section replacement test with initial whitespace (bug 13728)
18150 !! options
18151 replace=2,"xxx"
18152 !! wikitext
18153 Preformatted initial line
18154 ==a==
18155 ===a===
18156 !! html/php
18157 Preformatted initial line
18158 ==a==
18159 xxx
18160 !! end
18161
18162
18163 !! test
18164 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18165 !! options
18166 section=1
18167 !! wikitext
18168 ==a==
18169 a
18170 !! html/php
18171 ==a==
18172 a
18173 !! end
18174
18175 !! test
18176 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18177 !! options
18178 section=1
18179 !! wikitext
18180 ==a==
18181 a
18182 !! html/php
18183 ==a==
18184 a
18185 !! end
18186
18187
18188 !! test
18189 Section extraction, <pre> around bogus header (bug 10309)
18190 !! options
18191 noxml section=2
18192 !! wikitext
18193 == Section One ==
18194 <pre>
18195 =======
18196 </pre>
18197
18198 == Section Two ==
18199 stuff
18200 !! html/php
18201 == Section Two ==
18202 stuff
18203 !! end
18204
18205 !! test
18206 Section replacement, <pre> around bogus header (bug 10309)
18207 !! options
18208 noxml replace=2,"xxx"
18209 !! wikitext
18210 == Section One ==
18211 <pre>
18212 =======
18213 </pre>
18214
18215 == Section Two ==
18216 stuff
18217 !! html/php
18218 == Section One ==
18219 <pre>
18220 =======
18221 </pre>
18222
18223 xxx
18224 !! end
18225
18226
18227 !! test
18228 Handling of &#x0A; in URLs
18229 !! wikitext
18230 ** irc://&#x0A;a
18231 !! html/php
18232 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18233
18234 !! html/parsoid
18235 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18236 a">irc://
18237 a</a></li></ul></li></ul>
18238 !! end
18239
18240 !! test
18241 Handling of %0A in URLs
18242 !! wikitext
18243 ** irc://%0Aa
18244 !! html/php
18245 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18246
18247 !! html/parsoid
18248 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18249 !! end
18250
18251
18252 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18253 !! test
18254 5 quotes, code coverage +1 line
18255 !! options
18256 parsoid=wt2html
18257 !! wikitext
18258 '''''
18259 !! html/php
18260 !! html/parsoid
18261 <p><b><i></i></b></p>
18262 !! end
18263
18264 # same html as previous, but wikitext adjusted to match parsoid html2wt
18265 # note that wt2html and html2html will put the <i> before the <b>
18266 !! test
18267 5 quotes, code coverage +1 line w/ nowiki (1)
18268 !! options
18269 parsoid=wt2wt,html2wt
18270 !! wikitext
18271 '''''<nowiki/>'''''
18272 !! html/php
18273 <p><i></i>
18274 </p>
18275 !! html/parsoid
18276 <p><b><i></i></b></p>
18277 !! end
18278
18279 # same as previous, just swapping the <i> and <b>
18280 !! test
18281 5 quotes, code coverage +1 line w/ nowiki (2)
18282 !! wikitext
18283 '''''<nowiki/>'''''
18284 !! html/php
18285 <p><i></i>
18286 </p>
18287 !! html/parsoid
18288 <p><i><b></b></i></p>
18289 !! end
18290
18291 !! test
18292 Special:Search page linking.
18293 !! wikitext
18294 {{Special:search}}
18295 !! html
18296 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18297 </p>
18298 !! end
18299
18300 !! test
18301 {{!}} is a magic word
18302 !! wikitext
18303 {{!}} is a magic word there and {{!}} is still a magic word here
18304 | is not a magic word here but {{!}} is still a magic word here
18305 !! html/php
18306 <p>| is a magic word there and | is still a magic word here
18307 | is not a magic word here but | is still a magic word here
18308 </p>
18309 !! html/parsoid
18310 <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
18311 | 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>
18312
18313 !! end
18314
18315 !! test
18316 Say the magic word
18317 !! options
18318 title=[[Parser test]]
18319 !! wikitext
18320 * {{PAGENAME}}
18321 * {{PAGENAMEE}}
18322 * {{FULLPAGENAME}}
18323 * {{FULLPAGENAMEE}}
18324 * {{BASEPAGENAME}}
18325 * {{BASEPAGENAMEE}}
18326 * {{SUBPAGENAME}}
18327 * {{SUBPAGENAMEE}}
18328 * {{ROOTPAGENAME}}
18329 * {{ROOTPAGENAMEE}}
18330 * {{TALKPAGENAME}}
18331 * {{TALKPAGENAMEE}}
18332 * {{SUBJECTPAGENAME}}
18333 * {{SUBJECTPAGENAMEE}}
18334 * {{NAMESPACEE}}
18335 * {{NAMESPACE}}
18336 * {{NAMESPACENUMBER}}
18337 * {{TALKSPACE}}
18338 * {{TALKSPACEE}}
18339 * {{SUBJECTSPACE}}
18340 * {{SUBJECTSPACEE}}
18341 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18342 !! html
18343 <ul><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> Parser test</li>
18350 <li> Parser_test</li>
18351 <li> Parser test</li>
18352 <li> Parser_test</li>
18353 <li> Talk:Parser test</li>
18354 <li> Talk:Parser_test</li>
18355 <li> Parser test</li>
18356 <li> Parser_test</li>
18357 <li> </li>
18358 <li> </li>
18359 <li> 0</li>
18360 <li> Talk</li>
18361 <li> Talk</li>
18362 <li> </li>
18363 <li> </li>
18364 <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>
18365
18366 !! end
18367 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18368
18369 !! test
18370 Gallery
18371 !! wikitext
18372 <gallery>
18373 image1.png |
18374 image2.gif|||||
18375
18376 image3|
18377 image4 |300px| centre
18378 image5.svg| http://///////
18379 [[x|xx]]]]
18380 * image6
18381 </gallery>
18382 !! html
18383 <ul class="gallery mw-gallery-traditional">
18384 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18385 <div class="thumb" style="height: 150px;">Image1.png</div>
18386 <div class="gallerytext">
18387 </div>
18388 </div></li>
18389 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18390 <div class="thumb" style="height: 150px;">Image2.gif</div>
18391 <div class="gallerytext">
18392 </div>
18393 </div></li>
18394 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18395 <div class="thumb" style="height: 150px;">Image3</div>
18396 <div class="gallerytext">
18397 </div>
18398 </div></li>
18399 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18400 <div class="thumb" style="height: 150px;">Image4</div>
18401 <div class="gallerytext">
18402 <pre>centre
18403 </pre>
18404 </div>
18405 </div></li>
18406 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18407 <div class="thumb" style="height: 150px;">Image5.svg</div>
18408 <div class="gallerytext">
18409 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18410 </p>
18411 </div>
18412 </div></li>
18413 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18414 <div class="thumb" style="height: 150px;">* image6</div>
18415 <div class="gallerytext">
18416 </div>
18417 </div></li>
18418 </ul>
18419
18420 !! end
18421
18422 !! test
18423 Gallery (with options)
18424 !! wikitext
18425 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18426 File:Nonexistent.jpg|caption
18427 File:Nonexistent.jpg
18428 image:foobar.jpg|some '''caption''' [[Main Page]]
18429 image:foobar.jpg
18430 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18431 </gallery>
18432 !! html
18433 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18434 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18435 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18436 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18437 <div class="gallerytext">
18438 <p>caption
18439 </p>
18440 </div>
18441 </div></li>
18442 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18443 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18444 <div class="gallerytext">
18445 </div>
18446 </div></li>
18447 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18448 <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>
18449 <div class="gallerytext">
18450 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18451 </p>
18452 </div>
18453 </div></li>
18454 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18455 <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>
18456 <div class="gallerytext">
18457 </div>
18458 </div></li>
18459 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18460 <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>
18461 <div class="gallerytext">
18462 <p>blabla.
18463 </p>
18464 </div>
18465 </div></li>
18466 </ul>
18467
18468 !! end
18469
18470 !! test
18471 Gallery with link that has fragment
18472 !! wikitext
18473 <gallery>
18474 image:foobar.jpg|link=Main_Page
18475 image:foobar.jpg|link=Main_Page#section
18476 image:foobar.jpg|link=Main Page#section|caption
18477 </gallery>
18478 !! html
18479 <ul class="gallery mw-gallery-traditional">
18480 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18481 <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>
18482 <div class="gallerytext">
18483 </div>
18484 </div></li>
18485 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18486 <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>
18487 <div class="gallerytext">
18488 </div>
18489 </div></li>
18490 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18491 <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>
18492 <div class="gallerytext">
18493 <p>caption
18494 </p>
18495 </div>
18496 </div></li>
18497 </ul>
18498
18499 !! end
18500
18501 !! test
18502 Gallery with wikitext inside caption
18503 !! wikitext
18504 <gallery>
18505 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18506 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18507 </gallery>
18508 !! html
18509 <ul class="gallery mw-gallery-traditional">
18510 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18511 <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>
18512 <div class="gallerytext">
18513 <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>
18514 </p>
18515 </div>
18516 </div></li>
18517 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18518 <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>
18519 <div class="gallerytext">
18520 <p>This is a test template
18521 </p>
18522 </div>
18523 </div></li>
18524 </ul>
18525
18526 !! end
18527
18528 !! test
18529 gallery (with showfilename option)
18530 !! wikitext
18531 <gallery showfilename>
18532 File:Nonexistent.jpg|caption
18533 File:Nonexistent.jpg
18534 image:foobar.jpg|some '''caption''' [[Main Page]]
18535 File:Foobar.jpg
18536 </gallery>
18537 !! html
18538 <ul class="gallery mw-gallery-traditional">
18539 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18540 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18541 <div class="gallerytext">
18542 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18543 caption
18544 </p>
18545 </div>
18546 </div></li>
18547 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18548 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18549 <div class="gallerytext">
18550 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18551 </p>
18552 </div>
18553 </div></li>
18554 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18555 <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>
18556 <div class="gallerytext">
18557 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18558 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18559 </p>
18560 </div>
18561 </div></li>
18562 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18563 <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>
18564 <div class="gallerytext">
18565 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18566 </p>
18567 </div>
18568 </div></li>
18569 </ul>
18570
18571 !! end
18572
18573 !! test
18574 Gallery (with namespace-less filenames)
18575 !! wikitext
18576 <gallery>
18577 File:Nonexistent.jpg
18578 Nonexistent.jpg
18579 image:foobar.jpg
18580 foobar.jpg
18581 </gallery>
18582 !! html
18583 <ul class="gallery mw-gallery-traditional">
18584 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18585 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18586 <div class="gallerytext">
18587 </div>
18588 </div></li>
18589 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18590 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18591 <div class="gallerytext">
18592 </div>
18593 </div></li>
18594 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18595 <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>
18596 <div class="gallerytext">
18597 </div>
18598 </div></li>
18599 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18600 <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>
18601 <div class="gallerytext">
18602 </div>
18603 </div></li>
18604 </ul>
18605
18606 !! end
18607
18608 !! test
18609 HTML Hex character encoding (spells the word "JavaScript")
18610 !! options
18611 parsoid=wt2html,wt2wt,html2html
18612 !! wikitext
18613 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18614 !! html/php
18615 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18616 </p>
18617 !! html/php+tidy
18618 <p>JavaScript</p>
18619 !! html/parsoid
18620 <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>
18621 !! end
18622
18623 !! test
18624 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18625 !! wikitext
18626 &#xsee;&#XSEE;
18627 !! html/php
18628 <p>&amp;#xsee;&amp;#XSEE;
18629 </p>
18630 !! html/parsoid
18631 <p>&amp;#xsee;&amp;#XSEE;</p>
18632 !! end
18633
18634 !! test
18635 HTML Hex character encoding mixed case
18636 !! options
18637 parsoid=wt2html,wt2wt,html2html
18638 !! wikitext
18639 &#xEE;&#Xee;
18640 !! html/php
18641 <p>&#xee;&#xee;
18642 </p>
18643 !! html/php+tidy
18644 <p>îî</p>
18645 !! html/parsoid
18646 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18647 !! end
18648
18649 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18650 # Note that U+000C (form feed) is not a valid XML character, so
18651 # it is banned even though allowed in HTML5.
18652 !! test
18653 Illegal character references (T106578)
18654 !! wikitext
18655 ; Null: &#00;
18656 ; FF: &#xC;
18657 ; CR: &#xD;
18658 ; Control (low): &#8;
18659 ; Control (high): &#x7F; &#x9F;
18660 ; Surrogate: &#xD83D;&#xDCA9;
18661 ; This is an okay astral character: &#x1F4A9;
18662 !! html+tidy
18663 <dl>
18664 <dt>Null</dt>
18665 <dd>&amp;#00;</dd>
18666 <dt>FF</dt>
18667 <dd>&amp;#xC;</dd>
18668 <dt>CR</dt>
18669 <dd>&amp;#xD;</dd>
18670 <dt>Control (low)</dt>
18671 <dd>&amp;#8;</dd>
18672 <dt>Control (high)</dt>
18673 <dd>&amp;#x7F; &amp;#x9F;</dd>
18674 <dt>Surrogate</dt>
18675 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18676 <dt>This is an okay astral character</dt>
18677 <dd>💩</dd>
18678 </dl>
18679 !! end
18680
18681 !! test
18682 __FORCETOC__ override
18683 !! wikitext
18684 __NEWSECTIONLINK__
18685 __FORCETOC__
18686 !! html/php
18687 <p><br />
18688 </p>
18689 !! end
18690
18691 !! test
18692 ISBN code coverage
18693 !! wikitext
18694 ISBN 978-0-1234-56&#x20;789
18695 !! html
18696 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18697 </p>
18698 !! html+tidy
18699 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18700 !! html/parsoid
18701 <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>
18702 !! end
18703
18704 !! test
18705 ISBN followed by 5 spaces
18706 !! wikitext
18707 ISBN
18708 !! html
18709 <p>ISBN
18710 </p>
18711 !! end
18712
18713 !! test
18714 Double ISBN
18715 !! wikitext
18716 ISBN ISBN 1234567890
18717 !! html/php
18718 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18719 </p>
18720 !! html/parsoid
18721 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18722 !! end
18723
18724 # Uppercase X and lowercase x as well
18725 !! test
18726 ISBN with an X
18727 !! wikitext
18728 ISBN 3-462-04561-X
18729 ISBN 3-462-04561-x
18730 ISBN 080442957X
18731 ISBN 080442957x
18732 ISBN 978080442957X
18733 ISBN 978080442957x
18734 !! html/php
18735 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18736 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18737 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18738 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18739 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18740 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18741 </p>
18742 !! html/parsoid
18743 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18744 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18745 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18746 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18747 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18748 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18749 !! end
18750
18751 !! test
18752 ISBN with empty prefix (parsoid test)
18753 !! wikitext
18754 ISBN 1234567890
18755 !! html/php
18756 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18757 </p>
18758 !! html/parsoid
18759 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18760 !! end
18761
18762 !! test
18763 Bug 22905: <abbr> followed by ISBN followed by </a>
18764 !! wikitext
18765 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18766 !! html/php
18767 <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>
18768 </p>
18769 !! html/parsoid
18770 <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>
18771 !! end
18772
18773 !! test
18774 Double RFC
18775 !! wikitext
18776 RFC RFC 1234
18777 !! html
18778 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18779 </p>
18780 !! end
18781
18782 !! test
18783 Double RFC with a wiki link
18784 !! wikitext
18785 RFC [[RFC 1234]]
18786 !! html
18787 <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>
18788 </p>
18789 !! end
18790
18791 !! test
18792 RFC code coverage
18793 !! wikitext
18794 RFC 983&#x20;987
18795 !! html
18796 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18797 </p>
18798 !! html+tidy
18799 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18800 !! end
18801
18802 !! test
18803 Centre-aligned image
18804 !! wikitext
18805 [[Image:foobar.jpg|centre]]
18806 !! html
18807 <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>
18808
18809 !!end
18810
18811 !! test
18812 None-aligned image
18813 !! wikitext
18814 [[Image:foobar.jpg|none]]
18815 !! html
18816 <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>
18817
18818 !!end
18819
18820 !! test
18821 Width + Height sized image (using px) (height is ignored)
18822 !! wikitext
18823 [[Image:foobar.jpg|640x480px]]
18824 !! html
18825 <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>
18826 </p>
18827 !!end
18828
18829 !! test
18830 Width-sized image (using px, no following whitespace)
18831 !! wikitext
18832 [[Image:foobar.jpg|640px]]
18833 !! html
18834 <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>
18835 </p>
18836 !!end
18837
18838 !! test
18839 Width-sized image (using px, with following whitespace - test regression from r39467)
18840 !! wikitext
18841 [[Image:foobar.jpg|640px ]]
18842 !! html
18843 <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>
18844 </p>
18845 !!end
18846
18847 !! test
18848 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18849 !! wikitext
18850 [[Image:foobar.jpg| 640px]]
18851 !! html
18852 <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>
18853 </p>
18854 !!end
18855
18856 !! test
18857 Image with page parameter
18858 !! options
18859 djvu
18860 !! wikitext
18861 [[File:LoremIpsum.djvu|page=2]]
18862 !! html/php
18863 <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>
18864 </p>
18865 !! html/parsoid
18866 <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>
18867 !! end
18868
18869 !! test
18870 Another italics / bold test
18871 !! wikitext
18872 ''' ''x'
18873 !! html
18874 <pre>'<i> </i>x'
18875 </pre>
18876 !!end
18877
18878 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18879 !! test
18880 dt/dd/dl test
18881 !! wikitext
18882 :;;;::
18883 !! html/php
18884 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18885
18886 !! html/parsoid
18887 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18888
18889 !!end
18890
18891
18892 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18893 !! test
18894 Images with the "|" character in the comment
18895 !! wikitext
18896 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18897 !! html/php
18898 <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>
18899
18900 !! html/parsoid
18901 <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>
18902 !! end
18903
18904 !! test
18905 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18906 !! wikitext
18907 <html><script>alert(1);</script></html>
18908 !! html
18909 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18910 </p>
18911 !! end
18912
18913 !! test
18914 HTML with raw HTML ($wgRawHtml==true)
18915 !! options
18916 wgRawHtml=1
18917 !! wikitext
18918 <html><script>alert(1);</script></html>
18919 !! html
18920 <p><script>alert(1);</script>
18921 </p>
18922 !! end
18923
18924 !! test
18925 Parents of subpages, one level up
18926 !! options
18927 subpage title=[[Subpage test/L1/L2/L3]]
18928 !! wikitext
18929 [[../|L2]]
18930 !! html
18931 <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>
18932 </p>
18933 !! end
18934
18935
18936 !! test
18937 Parents of subpages, one level up, not named
18938 !! options
18939 subpage title=[[Subpage test/L1/L2/L3]]
18940 !! wikitext
18941 [[../]]
18942 !! html
18943 <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>
18944 </p>
18945 !! end
18946
18947
18948
18949 !! test
18950 Parents of subpages, two levels up
18951 !! options
18952 subpage title=[[Subpage test/L1/L2/L3]]
18953 !! wikitext
18954 [[../../|L1]]2
18955
18956 [[../../|L1]]l
18957 !! html
18958 <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
18959 </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>
18960 </p>
18961 !! end
18962
18963 !! test
18964 Parents of subpages, two levels up, without trailing slash or name.
18965 !! options
18966 subpage title=[[Subpage test/L1/L2/L3]]
18967 !! wikitext
18968 [[../..]]
18969 !! html
18970 <p>[[../..]]
18971 </p>
18972 !! end
18973
18974 !! test
18975 Parents of subpages, two levels up, with lots of extra trailing slashes.
18976 !! options
18977 subpage title=[[Subpage test/L1/L2/L3]]
18978 !! wikitext
18979 [[../../////]]
18980 !! html
18981 <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>
18982 </p>
18983 !! end
18984
18985 !! article
18986 Subpage test/L1/L2/L3Sibling
18987 !! text
18988 Sibling article
18989 !! endarticle
18990
18991 !! test
18992 Transclusion of a sibling page (one level up)
18993 !! options
18994 subpage title=[[Subpage test/L1/L2/L3]]
18995 !! wikitext
18996 {{../L3Sibling}}
18997 !! html
18998 <p>Sibling article
18999 </p>
19000 !! end
19001
19002 !! test
19003 Transclusion of a child page
19004 !! options
19005 subpage title=[[Subpage test/L1/L2]]
19006 !! wikitext
19007 {{/L3Sibling}}
19008 !! html
19009 <p>Sibling article
19010 </p>
19011 !! end
19012
19013 !! test
19014 Non-transclusion because of too many up levels
19015 !! options
19016 subpage title=[[Subpage test/L1/L2/L3]]
19017 !! wikitext
19018 {{../../../../More than parent}}
19019 !! html
19020 <p>{{../../../../More than parent}}
19021 </p>
19022 !! end
19023
19024 !! test
19025 Definition list code coverage
19026 !! wikitext
19027 ; title : def
19028 ; title : def
19029 ;title: def
19030 !! html/php
19031 <dl><dt> title &#160;</dt>
19032 <dd> def</dd>
19033 <dt> title&#160;</dt>
19034 <dd> def</dd>
19035 <dt>title</dt>
19036 <dd> def</dd></dl>
19037
19038 !! html/parsoid
19039 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19040 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19041 <dt>title</dt><dd> def</dd></dl>
19042 !! end
19043
19044 !! test
19045 Don't fall for the self-closing div
19046 !! wikitext
19047 <div>hello world</div/>
19048 !! html
19049 <div>hello world</div>
19050
19051 !! end
19052
19053 !! test
19054 MSGNW magic word
19055 !! wikitext
19056 {{MSGNW:msg}}
19057 !! html/php
19058 <p>&#91;&#91;:Template:Msg&#93;&#93;
19059 </p>
19060 !! end
19061
19062 !! test
19063 RAW magic word
19064 !! wikitext
19065 {{RAW:QUERTY}}
19066 !! html
19067 <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>
19068 </p>
19069 !! end
19070
19071 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19072 !! test
19073 Always escape literal '>' in output, not just after '<'
19074 !! wikitext
19075 ><>
19076 !! html
19077 <p>&gt;&lt;&gt;
19078 </p>
19079 !! end
19080
19081 !! test
19082 Template caching
19083 !! wikitext
19084 {{Test}}
19085 {{Test}}
19086 !! html
19087 <p>This is a test template
19088 This is a test template
19089 </p>
19090 !! end
19091
19092
19093 !! article
19094 MediaWiki:Fake
19095 !! text
19096 ==header==
19097 !! endarticle
19098
19099 !! test
19100 Inclusion of !userCanEdit() content
19101 !! wikitext
19102 {{MediaWiki:Fake}}
19103 !! html
19104 <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>
19105
19106 !! end
19107
19108
19109 !! test
19110 Out-of-order TOC heading levels
19111 !! wikitext
19112 ==2==
19113 ======6======
19114 ===3===
19115 =1=
19116 =====5=====
19117 ==2==
19118 !! html
19119 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19120 <ul>
19121 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19122 <ul>
19123 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19124 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19125 </ul>
19126 </li>
19127 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19128 <ul>
19129 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19130 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19131 </ul>
19132 </li>
19133 </ul>
19134 </div>
19135
19136 <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>
19137 <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>
19138 <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>
19139 <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>
19140 <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>
19141 <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>
19142
19143 !! end
19144
19145
19146 !! test
19147 ISBN with a dummy number
19148 !! wikitext
19149 ISBN ---
19150 !! html
19151 <p>ISBN ---
19152 </p>
19153 !! end
19154
19155
19156 !! test
19157 ISBN with space-delimited number
19158 !! wikitext
19159 ISBN 92 9017 032 8
19160 !! html
19161 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19162 </p>
19163 !! end
19164
19165
19166 !! test
19167 ISBN with multiple spaces, no number
19168 !! wikitext
19169 ISBN foo
19170 !! html
19171 <p>ISBN foo
19172 </p>
19173 !! end
19174
19175
19176 !! test
19177 ISBN length
19178 !! wikitext
19179 ISBN 123456789
19180
19181 ISBN 1234567890
19182
19183 ISBN 12345678901
19184 !! html
19185 <p>ISBN 123456789
19186 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19187 </p><p>ISBN 12345678901
19188 </p>
19189 !! end
19190
19191
19192 !! test
19193 ISBN with trailing year (bug 8110)
19194 !! wikitext
19195 ISBN 1-234-56789-0 - 2006
19196
19197 ISBN 1 234 56789 0 - 2006
19198 !! html
19199 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19200 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19201 </p>
19202 !! end
19203
19204
19205 !! test
19206 anchorencode
19207 !! wikitext
19208 {{anchorencode:foo bar©#%n}}
19209 !! html
19210 <p>foo_bar.C2.A9.23.25n
19211 </p>
19212 !! end
19213
19214 !! test
19215 anchorencode trims spaces
19216 !! wikitext
19217 {{anchorencode: __pretty__please__}}
19218 !! html
19219 <p>pretty_please
19220 </p>
19221 !! end
19222
19223 !! test
19224 anchorencode deals with links
19225 !! wikitext
19226 {{anchorencode: [[hello|world]] [[hi]]}}
19227 !! html
19228 <p>world_hi
19229 </p>
19230 !! end
19231
19232 !! test
19233 anchorencode deals with templates
19234 !! wikitext
19235 {{anchorencode: {{Foo}} }}
19236 !! html
19237 <p>FOO
19238 </p>
19239 !! end
19240
19241 !! test
19242 anchorencode encodes like the TOC generator: (bug 18431)
19243 !! wikitext
19244 === _ +:.3A%3A&&amp;]] ===
19245 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19246 __NOEDITSECTION__
19247 !! html
19248 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19249 <p>.2B:.3A.253A.26.26.5D.5D
19250 </p>
19251 !! end
19252
19253 !! test
19254 Bug 6200: blockquotes and paragraph formatting
19255 !! wikitext
19256 <blockquote>
19257 foo
19258 </blockquote>
19259
19260 bar
19261
19262 baz
19263 !! html
19264 <blockquote>
19265 <p>foo
19266 </p>
19267 </blockquote>
19268 <p>bar
19269 </p>
19270 <pre>baz
19271 </pre>
19272 !! end
19273
19274 !! test
19275 Bug 8293: Use of center tag ruins paragraph formatting
19276 !! wikitext
19277 <center>
19278 foo
19279 </center>
19280
19281 bar
19282
19283 baz
19284 !! html
19285 <center>
19286 <p>foo
19287 </p>
19288 </center>
19289 <p>bar
19290 </p>
19291 <pre>baz
19292 </pre>
19293 !! end
19294
19295 !!test
19296 Parsing of overlapping (improperly nested) inline html tags
19297 !! wikitext
19298 <span><s>x</span></s>
19299 !! html/php
19300 <p><span><s>x&lt;/span&gt;</s></span>
19301 </p>
19302 !! html/parsoid
19303 <p><span><s>x</s></span>
19304 </p>
19305 !!end
19306
19307 ###
19308 ### Language variants related tests
19309 ###
19310 !! test
19311 Self-link in language variants
19312 !! options
19313 title=[[Dunav]] language=sr
19314 !! wikitext
19315 Both [[Dunav]] and [[Дунав]] are names for this river.
19316 !! html
19317 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19318 </p>
19319 !!end
19320
19321 !! article
19322 Дуна
19323 !! text
19324 content
19325 !! endarticle
19326
19327 !! test
19328 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19329 !! options
19330 title=[[Duna]] language=sr
19331 !! wikitext
19332 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19333 !! html
19334 <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.
19335 </p>
19336 !! end
19337
19338 !! test
19339 Link to a section of a variant of this title shouldn't be parsed as self-link
19340 !! options
19341 title=[[Duna]] language=sr
19342 !! wikitext
19343 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19344 !! html
19345 <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.
19346 </p>
19347 !! end
19348
19349 !! test
19350 Link to pages in language variants
19351 !! options
19352 language=sr
19353 !! wikitext
19354 Main Page can be written as [[Маин Паге]]
19355 !! html
19356 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19357 </p>
19358 !!end
19359
19360
19361 !! test
19362 Multiple links to pages in language variants
19363 !! options
19364 language=sr
19365 !! wikitext
19366 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19367 !! html
19368 <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>.
19369 </p>
19370 !!end
19371
19372
19373 !! test
19374 Simple template in language variants
19375 !! options
19376 language=sr
19377 !! wikitext
19378 {{тест}}
19379 !! html
19380 <p>This is a test template
19381 </p>
19382 !! end
19383
19384
19385 !! test
19386 Template with explicit namespace in language variants
19387 !! options
19388 language=sr
19389 !! wikitext
19390 {{Template:тест}}
19391 !! html
19392 <p>This is a test template
19393 </p>
19394 !! end
19395
19396
19397 !! test
19398 Basic test for template parameter in language variants
19399 !! options
19400 language=sr
19401 !! wikitext
19402 {{парамтест|param=foo}}
19403 !! html
19404 <p>This is a test template with parameter foo
19405 </p>
19406 !! end
19407
19408
19409 !! test
19410 Simple category in language variants
19411 !! options
19412 language=sr cat
19413 !! wikitext
19414 [[Category:МедиаWики Усер'с Гуиде]]
19415 !! html
19416 <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>
19417 !! end
19418
19419
19420 !! article
19421 Category:分类
19422 !! text
19423 blah
19424 !! endarticle
19425
19426 !! article
19427 Category:分類
19428 !! text
19429 blah
19430 !! endarticle
19431
19432 ## We used to, but no longer wt2wt this test since the default serializer
19433 ## will normalize all categories to serialize on their own line.
19434 ## This wikitext usage is going to be fairly uncommon in production and
19435 ## selser will take care of preserving formatting in those scenarios.
19436 !! test
19437 Don't convert blue categorylinks to another variant (bug 33210)
19438 !! options
19439 cat
19440 language=zh
19441 parsoid=wt2html
19442 !! wikitext
19443 [[A]][[Category:分类]]
19444 !! html/php
19445 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19446 !! html/parsoid
19447 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19448 <link rel="mw:PageProp/Category" href="Category:分类"/>
19449 !! end
19450
19451 !! test
19452 Stripping -{}- tags (language variants)
19453 !! options
19454 language=sr
19455 !! wikitext
19456 Latin proverb: -{Ne nuntium necare}-
19457 !! html
19458 <p>Latin proverb: Ne nuntium necare
19459 </p>
19460 !! end
19461
19462
19463 !! test
19464 Prevent conversion with -{}- tags (language variants)
19465 !! options
19466 language=sr variant=sr-ec
19467 !! wikitext
19468 Latinski: -{Ne nuntium necare}-
19469 !! html
19470 <p>Латински: Ne nuntium necare
19471 </p>
19472 !! end
19473
19474
19475 !! test
19476 Prevent conversion of text with -{}- tags (language variants)
19477 !! options
19478 language=sr variant=sr-ec
19479 !! wikitext
19480 Latinski: -{Ne nuntium necare}-
19481 !! html
19482 <p>Латински: Ne nuntium necare
19483 </p>
19484 !! end
19485
19486
19487 !! test
19488 Prevent conversion of links with -{}- tags (language variants)
19489 !! options
19490 language=sr variant=sr-ec
19491 !! wikitext
19492 -{[[Main Page]]}-
19493 !! html
19494 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19495 </p>
19496 !! end
19497
19498
19499 !! test
19500 -{}- tags within headlines (within html for parserConvert())
19501 !! options
19502 language=sr variant=sr-ec
19503 !! wikitext
19504 == -{Naslov}- ==
19505 !! html
19506 <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>
19507
19508 !! end
19509
19510
19511 !! test
19512 Explicit definition of language variant alternatives
19513 !! options
19514 language=zh variant=zh-tw
19515 !! wikitext
19516 -{zh:China;zh-tw:Taiwan}-, not China
19517 !! html
19518 <p>Taiwan, not China
19519 </p>
19520 !! end
19521
19522
19523 !! test
19524 Conversion around HTML tags
19525 !! options
19526 language=sr variant=sr-ec
19527 !! wikitext
19528 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19529 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19530 !! html
19531 <p>
19532 <span title="ЛаCтин">ски</span>
19533 </p>
19534 !! end
19535
19536
19537 !! test
19538 Explicit session-wise language variant mapping (A flag and - flag)
19539 !! options
19540 language=zh variant=zh-tw
19541 !! wikitext
19542 Taiwan is not China.
19543 But -{A|zh:China;zh-tw:Taiwan}- is China,
19544 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19545 and -{China}- is China.
19546 !! html
19547 <p>Taiwan is not China.
19548 But Taiwan is Taiwan,
19549 (This should be stripped!)
19550 and China is China.
19551 </p>
19552 !! end
19553
19554 !! test
19555 Explicit session-wise language variant mapping (H flag for hide)
19556 !! options
19557 language=zh variant=zh-tw
19558 !! wikitext
19559 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19560 Taiwan is China.
19561 !! html
19562 <p>(This should be stripped!)
19563 Taiwan is Taiwan.
19564 </p>
19565 !! end
19566
19567 !! test
19568 Adding explicit conversion rule for title (T flag)
19569 !! options
19570 language=zh variant=zh-tw showtitle
19571 !! wikitext
19572 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19573 !! html
19574 Taiwan
19575 <p>Should be stripped!
19576 </p>
19577 !! end
19578
19579 !! test
19580 Testing that changing the language variant here in the tests actually works
19581 !! options
19582 language=zh variant=zh showtitle
19583 !! wikitext
19584 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19585 !! html
19586 China
19587 <p>Should be stripped!
19588 </p>
19589 !! end
19590
19591 !! test
19592 Recursive conversion of alt and title attrs shouldn't clear converter state
19593 !! options
19594 language=zh variant=zh-cn showtitle
19595 !! wikitext
19596 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19597 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19598 !! html
19599 China
19600 <p>
19601 Should be stripped<span title="Exclamation">!</span>
19602 </p>
19603 !! end
19604
19605 !! test
19606 Bug 24072: more test on conversion rule for title
19607 !! options
19608 language=zh variant=zh-tw showtitle
19609 !! wikitext
19610 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19611 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19612 !! html
19613 Taiwan
19614 <p>This should be stripped!
19615 This won't take interferes with the title rule.
19616 </p>
19617 !! end
19618
19619 !! test
19620 Partly disable title conversion if variant == main language code
19621 !! options
19622 language=zh variant=zh title=[[ZH]] showtitle
19623 !! wikitext
19624 -{T|zh-cn:CN;zh-tw:TW}-
19625 !! html
19626 ZH
19627 <p>
19628 </p>
19629 !! end
19630
19631 !! test
19632 Partly disable title conversion if variant == main language code, more
19633 !! options
19634 language=zh variant=zh title=[[ZH]] showtitle
19635 !! wikitext
19636 -{T|TW}-
19637 !! html
19638 ZH
19639 <p>
19640 </p>
19641 !! end
19642
19643 !! test
19644 Raw output of variant escape tags (R flag)
19645 !! options
19646 language=zh variant=zh-tw
19647 !! wikitext
19648 Raw: -{R|zh:China;zh-tw:Taiwan}-
19649 !! html
19650 <p>Raw: zh:China;zh-tw:Taiwan
19651 </p>
19652 !! end
19653
19654 !! test
19655 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19656 !! options
19657 language=zh variant=zh-cn
19658 !! input
19659 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19660 !! result
19661 <p>0
19662 </p>
19663 !! end
19664
19665 !! test
19666 Conversion rules from [numeric-only string] to [something else] (T48634)
19667 !! options
19668 language=zh variant=zh-cn
19669 !! input
19670 -{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
19671 !! result
19672 <p>D12345EE12345
19673 </p>
19674 !! end
19675
19676 !! test
19677 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19678 !! options
19679 language=zh variant=zh-cn
19680 !! input
19681 -{H|zh-cn:foo;zh-tw:;}-foobar
19682 !! result
19683 <p>foobar
19684 </p>
19685 !! end
19686
19687 !! test
19688 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19689 !! options
19690 language=zh variant=zh-cn
19691 !! input
19692 -{H|=>zh-cn:foo;}-foobar
19693 !! result
19694 <p>foobar
19695 </p>
19696 !! end
19697
19698 !! test
19699 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19700 !! options
19701 language=zh variant=zh-cn
19702 !! input
19703 -{H|}-foobar
19704 !! result
19705 <p>foobar
19706 </p>
19707 !! end
19708
19709 !! test
19710 Nested using of manual convert syntax
19711 !! options
19712 language=zh variant=zh-hk
19713 !! wikitext
19714 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19715 !! html
19716 <p>Nested: Hello Hong Kong!
19717 </p>
19718 !! end
19719
19720 !! test
19721 Proper conversion of text in external links
19722 !! options
19723 language=sr variant=sr-ec
19724 !! wikitext
19725 http://www.google.com
19726 gopher://www.google.com
19727 [http://www.google.com http://www.google.com]
19728 [gopher://www.google.com gopher://www.google.com]
19729 [https://www.google.com irc://www.google.com]
19730 [ftp://www.google.com www.google.com/ftp://dir]
19731 [//www.google.com www.google.com]
19732 !! html
19733 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19734 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19735 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19736 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19737 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19738 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19739 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19740 </p>
19741 !! end
19742
19743 !! test
19744 Do not convert roman numbers to language variants
19745 !! options
19746 language=sr variant=sr-ec
19747 !! wikitext
19748 Fridrih IV je car.
19749 !! html
19750 <p>Фридрих IV је цар.
19751 </p>
19752 !! end
19753
19754 !! test
19755 Unclosed language converter markup "-{"
19756 !! options
19757 language=sr
19758 !! wikitext
19759 -{T|hello
19760 !! html
19761 <p>-{T|hello
19762 </p>
19763 !! end
19764
19765 !! test
19766 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19767 !! options
19768 language=sr
19769 !! wikitext
19770 -{R|=&gt;}-
19771 !! html
19772 <p>=&gt;
19773 </p>
19774 !!end
19775
19776 !! test
19777 Don't break link parsing if language converter markup is in the caption.
19778 !! options
19779 language=sr variant=sr-ec
19780 !! wikitext
19781 [[Main Page|-{R|main page}-]]
19782 !! html
19783 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19784 </p>
19785 !! end
19786
19787 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19788 !! test
19789 Don't break image parsing if language converter markup is in the caption.
19790 !! options
19791 language=sr
19792 !! wikitext
19793 [[File:Foobar.jpg|-{R|caption}-]]
19794 !! html/parsoid
19795 <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>
19796 </p>
19797 !! end
19798
19799 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19800 !! test
19801 Don't break list handling if language converter markup is in the item.
19802 !! options
19803 language=zh variant=zh-cn
19804 !! wikitext
19805 ;-{zh-cn:AAA;zh-tw:BBB}-
19806 !! html/php
19807 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19808
19809 !! html/parsoid
19810 <dl><dt>AAA
19811 </dt></dl>
19812 !! end
19813
19814 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19815 !! test
19816 Don't break table handling if language converter markup is in the cell.
19817 !! options
19818 language=sr variant=sr-ec
19819 !! wikitext
19820 {|
19821 |-
19822 | -{R|B}-
19823 |}
19824 !! html/php
19825 <table>
19826
19827 <tr>
19828 <td>Б}-
19829 </td></tr></table>
19830
19831 !! html/parsoid
19832 <table>
19833
19834 <tr>
19835 <td> B
19836 </td></tr></table>
19837
19838 !! end
19839
19840 !! test
19841 Bug 529: Uncovered bullet
19842 !! wikitext
19843 * Foo {{bullet}}
19844 !! html
19845 <ul><li> Foo </li>
19846 <li> Bar</li></ul>
19847
19848 !! end
19849
19850 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19851 # Templates in Wikipedia rely on this behavior, as tidy has always been
19852 # enabled there. These tests are normally run *without* tidy, so specify the
19853 # full output here.
19854 # To test realistic parsing behavior, apply a tidy-like transformation to both
19855 # the expected output and your parser's output.
19856 !! test
19857 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19858 !! wikitext
19859 ******* Foo {{bullet}}
19860 !! html
19861 <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>
19862 <li> Bar</li></ul>
19863
19864 !! end
19865
19866 !! test
19867 Bug 529: Uncovered table already at line-start
19868 !! wikitext
19869 x
19870
19871 {{table}}
19872 y
19873 !! html
19874 <p>x
19875 </p>
19876 <table>
19877 <tr>
19878 <td> 1 </td>
19879 <td> 2
19880 </td></tr>
19881 <tr>
19882 <td> 3 </td>
19883 <td> 4
19884 </td></tr></table>
19885 <p>y
19886 </p>
19887 !! end
19888
19889 !! test
19890 Bug 529: Uncovered bullet in parser function result
19891 !! wikitext
19892 * Foo {{lc:{{bullet}} }}
19893 !! html
19894 <ul><li> Foo </li>
19895 <li> bar</li></ul>
19896
19897 !! end
19898
19899 !! test
19900 Bug 5678: Double-parsed template argument
19901 !! wikitext
19902 {{lc:{{{1}}}|hello}}
19903 !! html
19904 <p>{{{1}}}
19905 </p>
19906 !! end
19907
19908 !! test
19909 Bug 5678: Double-parsed template invocation
19910 !! wikitext
19911 {{lc:{{paramtest {{!}} param = hello }} }}
19912 !! html
19913 <p>{{paramtest | param = hello }}
19914 </p>
19915 !! end
19916
19917 !! test
19918 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19919 !! options
19920 language=cs
19921 title=[[Main Page]]
19922 !! wikitext
19923 {{PRVNÍVELKÉ:ěščř}}
19924 {{prvnívelké:ěščř}}
19925 {{PRVNÍMALÉ:ěščř}}
19926 {{prvnímalé:ěščř}}
19927 {{MALÁ:ěščř}}
19928 {{malá:ěščř}}
19929 {{VELKÁ:ěščř}}
19930 {{velká:ěščř}}
19931 !! html
19932 <p>Ěščř
19933 Ěščř
19934 ěščř
19935 ěščř
19936 ěščř
19937 ěščř
19938 ĚŠČŘ
19939 ĚŠČŘ
19940 </p>
19941 !! end
19942
19943 !! test
19944 Morwen/13: Unclosed link followed by heading
19945 !! wikitext
19946 [[link
19947 ==heading==
19948 !! html
19949 <p>[[link
19950 </p>
19951 <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>
19952
19953 !! end
19954
19955 !! test
19956 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19957 !! wikitext
19958 {{foo|
19959 =heading=
19960 !! html
19961 <p>{{foo|
19962 </p>
19963 <h1><span class="mw-headline" id="heading">heading</span></h1>
19964
19965 !! end
19966
19967 !! test
19968 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19969 !! wikitext
19970 {{foo|
19971 ==heading==
19972 !! html
19973 <p>{{foo|
19974 </p>
19975 <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>
19976
19977 !! end
19978
19979 !! test
19980 Tildes in comments
19981 !! options
19982 pst
19983 !! wikitext
19984 <!-- ~~~~ -->
19985 !! html/php
19986 <!-- ~~~~ -->
19987 !! end
19988
19989 !! test
19990 Paragraphs inside divs (no extra line breaks)
19991 !! wikitext
19992 <div>Line one
19993
19994 Line two</div>
19995 !! html
19996 <div>Line one
19997 Line two</div>
19998
19999 !! end
20000
20001 !! test
20002 Paragraphs inside divs (extra line break on open)
20003 !! wikitext
20004 <div>
20005 Line one
20006
20007 Line two</div>
20008 !! html
20009 <div>
20010 <p>Line one
20011 </p>
20012 Line two</div>
20013
20014 !! end
20015
20016 !! test
20017 Paragraphs inside divs (extra line break on close)
20018 !! wikitext
20019 <div>Line one
20020
20021 Line two
20022 </div>
20023 !! html
20024 <div>Line one
20025 <p>Line two
20026 </p>
20027 </div>
20028
20029 !! end
20030
20031 !! test
20032 Paragraphs inside divs (extra line break on open and close)
20033 !! wikitext
20034 <div>
20035 Line one
20036
20037 Line two
20038 </div>
20039 !! html
20040 <div>
20041 <p>Line one
20042 </p><p>Line two
20043 </p>
20044 </div>
20045
20046 !! end
20047
20048 !! test
20049 Nesting tags, paragraphs on lines which begin with <div>
20050 !! wikitext
20051 <div></div><strong>A
20052 B</strong>
20053 !! html/php+tidy
20054 <p><strong>A</strong></p>
20055 <p><strong>B</strong></p>
20056 !! html/parsoid
20057 <div></div>
20058 <p><strong>A
20059 B</strong>
20060 </p>
20061 !! end
20062
20063 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20064 !! test
20065 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20066 !! wikitext
20067 <blockquote>Line one
20068
20069 Line two</blockquote>
20070 !! html
20071 <blockquote>Line one
20072 Line two</blockquote>
20073
20074 !! html+tidy
20075 <blockquote>
20076 <p>Line one Line two</p>
20077 </blockquote>
20078 !! end
20079
20080 !! test
20081 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20082 !! wikitext
20083 <blockquote>
20084 Line one
20085
20086 Line two</blockquote>
20087 !! html
20088 <blockquote>
20089 <p>Line one
20090 </p>
20091 Line two</blockquote>
20092
20093 !! html+tidy
20094 <blockquote>
20095 <p>Line one</p>
20096 Line two</blockquote>
20097 !! end
20098
20099 !! test
20100 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20101 !! wikitext
20102 <blockquote>Line one
20103
20104 Line two
20105 </blockquote>
20106 !! html
20107 <blockquote>Line one
20108 <p>Line two
20109 </p>
20110 </blockquote>
20111
20112 !! html+tidy
20113 <blockquote>
20114 <p>Line one</p>
20115 <p>Line two</p>
20116 </blockquote>
20117 !! end
20118
20119 !! test
20120 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20121 !! wikitext
20122 <blockquote>
20123 Line one
20124
20125 Line two
20126 </blockquote>
20127 !! html
20128 <blockquote>
20129 <p>Line one
20130 </p><p>Line two
20131 </p>
20132 </blockquote>
20133
20134 !! html+tidy
20135 <blockquote>
20136 <p>Line one</p>
20137 <p>Line two</p>
20138 </blockquote>
20139 !! end
20140
20141 !! test
20142 Paragraphs inside blockquotes/divs (no extra line breaks)
20143 !! wikitext
20144 <blockquote><div>Line one
20145
20146 Line two</div></blockquote>
20147 !! html
20148 <blockquote><div>Line one
20149 Line two</div></blockquote>
20150
20151 !! end
20152
20153 !! test
20154 Paragraphs inside blockquotes/divs (extra line break on open)
20155 !! wikitext
20156 <blockquote><div>
20157 Line one
20158
20159 Line two</div></blockquote>
20160 !! html
20161 <blockquote><div>
20162 <p>Line one
20163 </p>
20164 Line two</div></blockquote>
20165
20166 !! end
20167
20168 !! test
20169 Paragraphs inside blockquotes/divs (extra line break on close)
20170 !! wikitext
20171 <blockquote><div>Line one
20172
20173 Line two
20174 </div></blockquote>
20175 !! html
20176 <blockquote><div>Line one
20177 <p>Line two
20178 </p>
20179 </div></blockquote>
20180
20181 !! end
20182
20183 !! test
20184 Paragraphs inside blockquotes/divs (extra line break on open and close)
20185 !! wikitext
20186 <blockquote><div>
20187 Line one
20188
20189 Line two
20190 </div></blockquote>
20191 !! html
20192 <blockquote><div>
20193 <p>Line one
20194 </p><p>Line two
20195 </p>
20196 </div></blockquote>
20197
20198 !! end
20199
20200 !! test
20201 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20202 !! options
20203 wgLinkHolderBatchSize=0
20204 !! wikitext
20205 [[meatball:1]]
20206 [[meatball:2]]
20207 [[meatball:3]]
20208 !! html
20209 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20210 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20211 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20212 </p>
20213 !! end
20214
20215 !! test
20216 Free external link invading image caption
20217 !! wikitext
20218 [[Image:Foobar.jpg|thumb|http://x|hello]]
20219 !! html
20220 <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>
20221
20222 !! end
20223
20224 !! test
20225 Bug 15196: localised external link numbers
20226 !! options
20227 language=fa
20228 !! wikitext
20229 [http://en.wikipedia.org/]
20230 !! html/php
20231 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20232 </p>
20233 !! html/parsoid
20234 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20235 !! end
20236
20237 !! test
20238 Multibyte character in padleft
20239 !! wikitext
20240 {{padleft:-Hello|7|Æ}}
20241 !! html
20242 <p>Æ-Hello
20243 </p>
20244 !! end
20245
20246 !! test
20247 Multibyte character in padright
20248 !! wikitext
20249 {{padright:Hello-|7|Æ}}
20250 !! html
20251 <p>Hello-Æ
20252 </p>
20253 !! end
20254
20255 !!test
20256 formatdate parser function
20257 !! wikitext
20258 {{#formatdate:2009-03-24}}
20259 !! html
20260 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20261 </p>
20262 !! end
20263
20264 !!test
20265 formatdate parser function, with default format
20266 !! wikitext
20267 {{#formatdate:2009-03-24|mdy}}
20268 !! html
20269 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20270 </p>
20271 !! end
20272
20273 !! test
20274 Spacing of numbers in formatted dates
20275 !! wikitext
20276 {{#formatdate:January 15}}
20277 !! html
20278 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20279 </p>
20280 !! end
20281
20282 !! test
20283 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
20284 !! options
20285 language=nl title=[[MediaWiki:Common.css]]
20286 !! wikitext
20287 {{#formatdate:2009-03-24|dmy}}
20288 !! html
20289 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20290 </p>
20291 !! end
20292
20293 #
20294 #
20295 #
20296
20297 #
20298 # Edit comments
20299 #
20300
20301 !! test
20302 Edit comment with link
20303 !! options
20304 comment
20305 !! wikitext
20306 I like the [[Main Page]] a lot
20307 !! html/php
20308 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20309 !!end
20310
20311 !! test
20312 Edit comment with link and link text
20313 !! options
20314 comment
20315 !! wikitext
20316 I like the [[Main Page|best pages]] a lot
20317 !! html/php
20318 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20319 !!end
20320
20321 !! test
20322 Edit comment with link and link text with suffix
20323 !! options
20324 comment
20325 !! wikitext
20326 I like the [[Main Page|best page]]s a lot
20327 !! html/php
20328 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20329 !!end
20330
20331 !! test
20332 Edit comment with section link (non-local, eg in history list)
20333 !! options
20334 comment title=[[Main Page]]
20335 !! wikitext
20336 /* External links */ removed bogus entries
20337 !! html/php
20338 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20339 !!end
20340
20341 !! test
20342 Edit comment with section link and text before it (non-local, eg in history list)
20343 !! options
20344 comment title=[[Main Page]]
20345 !! wikitext
20346 pre-comment text /* External links */ removed bogus entries
20347 !! html/php
20348 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>
20349 !!end
20350
20351 !! test
20352 Edit comment with section link (local, eg in diff view)
20353 !! options
20354 comment local title=[[Main Page]]
20355 !! wikitext
20356 /* External links */ removed bogus entries
20357 !! html/php
20358 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20359 !!end
20360
20361 !! test
20362 Edit comment with subpage link (bug 14080)
20363 !! options
20364 comment
20365 subpage
20366 title=[[Subpage test]]
20367 !! wikitext
20368 Poked at a [[/subpage]] here...
20369 !! html/php
20370 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20371 !!end
20372
20373 !! test
20374 Edit comment with subpage link and link text (bug 14080)
20375 !! options
20376 comment
20377 subpage
20378 title=[[Subpage test]]
20379 !! wikitext
20380 Poked at a [[/subpage|neat little page]] here...
20381 !! html/php
20382 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20383 !!end
20384
20385 !! test
20386 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20387 !! options
20388 comment
20389 title=[[Subpage test]]
20390 !! wikitext
20391 Poked at a [[/subpage]] here...
20392 !! html/php
20393 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...
20394 !!end
20395
20396 !! test
20397 Edit comment with bare anchor link (local, as on diff)
20398 !! options
20399 comment
20400 local
20401 title=[[Main Page]]
20402 !! wikitext
20403 [[#section]]
20404 !! html/php
20405 <a href="#section">#section</a>
20406 !! end
20407
20408 !! test
20409 Edit comment with bare anchor link (non-local, as on history)
20410 !! options
20411 comment
20412 title=[[Main Page]]
20413 !! wikitext
20414 [[#section]]
20415 !! html/php
20416 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20417 !! end
20418
20419 !! test
20420 Anchor starting with underscore
20421 !! options
20422 title=[[Foo]]
20423 !! wikitext
20424 [[#_ref|One]]
20425 !! html/php
20426 <p><a href="#_ref">One</a>
20427 </p>
20428 !! html/parsoid
20429 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20430 !! end
20431
20432 !! test
20433 Id starting with underscore
20434 !! wikitext
20435 <div id="_ref"></div>
20436 !! html/*
20437 <div id="_ref"></div>
20438
20439 !! end
20440
20441 !! test
20442 Space normalisation on autocomment (bug 22784)
20443 !! options
20444 comment
20445 title=[[Main Page]]
20446 !! wikitext
20447 /* __hello__world__ */
20448 !! html/php
20449 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20450 !! end
20451
20452 !! test
20453 percent-encoding and + signs in comments (Bug 26410)
20454 !! options
20455 comment
20456 !! wikitext
20457 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20458 !! html/php
20459 <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>
20460 !! end
20461
20462 # Parsoid doesn't support this yet: see bug 73581
20463 # but it *should* omit the 'src' attribute if the image is bad.
20464 # PHP side of tests was disabled in
20465 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20466 # because of issues in the PHP parserTests infrastructure
20467 # (but the output below is indeed what the PHP side emits)
20468 !! test
20469 Bad images - basic functionality
20470 !! wikitext
20471 [[File:Bad.jpg]]
20472 !! DISABLED/html/php
20473 !! html/parsoid
20474 <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>
20475 !! end
20476
20477 !! test
20478 Bad images - bug 16039: text after bad image disappears
20479 !! wikitext
20480 Foo bar
20481 [[File:Bad.jpg]]
20482 Bar foo
20483 !! DISABLED/html/php
20484 <p>Foo bar
20485 </p><p>Bar foo
20486 </p>
20487 !! html/parsoid
20488 <p>Foo bar
20489 <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>
20490 Bar foo</p>
20491 !! end
20492
20493 !! test
20494 Verify that displaytitle works (bug #22501) no displaytitle
20495 !! options
20496 showtitle
20497 !! config
20498 wgAllowDisplayTitle=true
20499 wgRestrictDisplayTitle=false
20500 !! wikitext
20501 this is not the the title
20502 !! html/php
20503 Parser test
20504 <p>this is not the the title
20505 </p>
20506 !! end
20507
20508 !! test
20509 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20510 !! options
20511 showtitle
20512 title=[[Screen]]
20513 !! config
20514 wgAllowDisplayTitle=true
20515 wgRestrictDisplayTitle=false
20516 !! wikitext
20517 this is not the the title
20518 {{DISPLAYTITLE:whatever}}
20519 !! html/php
20520 whatever
20521 <p>this is not the the title
20522 </p>
20523 !! end
20524
20525 !! test
20526 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20527 !! options
20528 showtitle
20529 title=[[Screen]]
20530 !! config
20531 wgAllowDisplayTitle=true
20532 wgRestrictDisplayTitle=true
20533 !! wikitext
20534 this is not the the title
20535 {{DISPLAYTITLE:whatever}}
20536 !! html/php
20537 Screen
20538 <p>this is not the the title
20539 </p>
20540 !! end
20541
20542 !! test
20543 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20544 !! options
20545 showtitle
20546 title=[[Screen]]
20547 !! config
20548 wgAllowDisplayTitle=true
20549 wgRestrictDisplayTitle=true
20550 !! wikitext
20551 this is not the the title
20552 {{DISPLAYTITLE:screen}}
20553 !! html/php
20554 screen
20555 <p>this is not the the title
20556 </p>
20557 !! end
20558
20559 !! test
20560 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20561 !! options
20562 showtitle
20563 title=[[Screen]]
20564 !! config
20565 wgAllowDisplayTitle=false
20566 !! wikitext
20567 this is not the the title
20568 {{DISPLAYTITLE:screen}}
20569 !! html/php
20570 Screen
20571 <p>this is not the the title
20572 <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>
20573 </p>
20574 !! end
20575
20576 !! test
20577 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20578 !! options
20579 showtitle
20580 title=[[Screen]]
20581 !! config
20582 wgAllowDisplayTitle=false
20583 !! wikitext
20584 this is not the the title
20585 !! html/php
20586 Screen
20587 <p>this is not the the title
20588 </p>
20589 !! end
20590
20591 !! test
20592 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20593 !! options
20594 showtitle
20595 title=[[Screen]]
20596 !! config
20597 wgAllowDisplayTitle=true
20598 wgRestrictDisplayTitle=true
20599 !! wikitext
20600 this is not the the title
20601 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20602 !! html/php
20603 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20604 <p>this is not the the title
20605 </p>
20606 !! end
20607
20608 !! test
20609 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20610 !! options
20611 showtitle
20612 title=[[Screen]]
20613 !! config
20614 wgAllowDisplayTitle=true
20615 wgRestrictDisplayTitle=true
20616 !! wikitext
20617 this is not the the title
20618 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20619 !! html/php
20620 <span style="color: red;">s</span>creen
20621 <p>this is not the the title
20622 </p>
20623 !! end
20624
20625 !! test
20626 Page status indicators: Empty name is invalid
20627 !! options
20628 showindicators
20629 !! wikitext
20630 <indicator name=" "></indicator>
20631 <indicator></indicator>
20632 !! html
20633 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20634 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20635 </p>
20636 !! end
20637
20638 !! test
20639 Page status indicators: Weird syntaxes that are okay
20640 !! options
20641 showindicators
20642 !! wikitext
20643 <indicator name="empty" />
20644 <indicator name="name"></indicator>
20645 !! html
20646 empty=
20647 name=
20648 <p><br />
20649 </p>
20650 !! end
20651
20652 !! test
20653 Page status indicators: Torture test
20654 !! options
20655 showindicators
20656 !! wikitext
20657 <indicator name="01">hello world</indicator>
20658 <indicator name="02">[[Main Page]]</indicator>
20659 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20660 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20661 <indicator name="05">* foo
20662 * bar</indicator>
20663 <indicator name="06"><nowiki>foo</nowiki></indicator>
20664 <indicator name="07"> Preformatted</indicator>
20665 <indicator name="08"><div>Broken tag</indicator>
20666 <indicator name="09">{| class=wikitable
20667 | cell
20668 |}</indicator>
20669 <indicator name="10">Two
20670
20671 paragraphs</indicator>
20672 !! html
20673 01=hello world
20674 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20675 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" />
20676 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>
20677 05=<ul><li> foo</li>
20678 <li> bar</li></ul>
20679
20680 06=foo
20681 07=<pre>Preformatted
20682 </pre>
20683 08=<div>Broken tag</div>
20684
20685 09=<table class="wikitable">
20686 <tr>
20687 <td> cell
20688 </td></tr></table>
20689
20690 10=<p>Two
20691 </p><p>paragraphs
20692 </p>
20693 <p><br />
20694 </p><p><br />
20695 </p><p><br />
20696 </p><p><br />
20697 </p><p><br />
20698 </p>
20699 !! end
20700
20701 !! test
20702 preload: check <noinclude> and <includeonly>
20703 !! options
20704 preload
20705 !! wikitext
20706 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20707 !! html/php
20708 Hello kind world.
20709 !! end
20710
20711 !! test
20712 preload: check <onlyinclude>
20713 !! options
20714 preload
20715 !! wikitext
20716 Goodbye <onlyinclude>Hello world</onlyinclude>
20717 !! html/php
20718 Hello world
20719 !! end
20720
20721 !! test
20722 preload: can pass tags through if we want to
20723 !! options
20724 preload
20725 !! wikitext
20726 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20727 !! html/php
20728 <includeonly>Hello world</includeonly>
20729 !! end
20730
20731 !! test
20732 preload: check that it doesn't try to do tricks
20733 !! options
20734 preload
20735 !! wikitext
20736 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20737 !! html/php
20738 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20739 !! end
20740
20741 !! test
20742 Play a bit with r67090 and bug 3158
20743 !! wikitext
20744 <div style="width:50% !important">&nbsp;</div>
20745 <div style="width:50%&nbsp;!important">&nbsp;</div>
20746 <div style="width:50%&#160;!important">&nbsp;</div>
20747 <div style="border : solid;">&nbsp;</div>
20748 !! html/php
20749 <div style="width:50% !important">&#160;</div>
20750 <div style="width:50% !important">&#160;</div>
20751 <div style="width:50% !important">&#160;</div>
20752 <div style="border&#160;: solid;">&#160;</div>
20753
20754 !! html/parsoid
20755 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20756 <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>
20757 <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>
20758 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20759
20760 !! end
20761
20762 !! test
20763 HTML5 data attributes
20764 !! wikitext
20765 <span data-foo="bar">Baz</span>
20766 <p data-abc-def_hij="">Quuz</p>
20767 !! html/php
20768 <p><span data-foo="bar">Baz</span>
20769 </p>
20770 <p data-abc-def_hij="">Quuz</p>
20771
20772 !! html/parsoid
20773 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
20774 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
20775 !! end
20776
20777 !! test
20778 Strip reserved data attributes
20779 !! wikitext
20780 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
20781 !! html/php
20782 <div data-ok="fred">d</div>
20783
20784 !! html/parsoid
20785 <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>
20786 !! end
20787
20788 !! test
20789 percent-encoding and + signs in internal links (Bug 26410)
20790 !! wikitext
20791 [[User:+%]] [[Page+title%]]
20792 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20793 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20794 [[%33%45]] [[%33%45+]]
20795 !! html/php
20796 <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>
20797 <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>
20798 <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>
20799 <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>
20800 </p>
20801 !! html/parsoid
20802 <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>
20803 <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>
20804 <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>
20805 <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>
20806 !! end
20807
20808 !! test
20809 Special characters in embedded file links (bug 27679)
20810 !! wikitext
20811 [[File:Contains & ampersand.jpg]]
20812 [[File:Does not exist.jpg|Title with & ampersand]]
20813 !! html/php
20814 <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>
20815 <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>
20816 </p>
20817 !! html/parsoid
20818 <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>
20819 <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>
20820 !! end
20821
20822 !! test
20823 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20824 !! wikitext
20825 Text&apos;s been normalized?
20826 !! html
20827 <p>Text&#39;s been normalized?
20828 </p>
20829 !! end
20830
20831 !! test
20832 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20833 !! wikitext
20834 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20835 !! html
20836 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20837 </p>
20838 !! end
20839
20840 !! test
20841 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20842 !! wikitext
20843 [http://www.example.org/ ideograms]
20844 !! html
20845 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20846 </p>
20847 !! end
20848
20849 !! test
20850 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20851 !! wikitext
20852 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20853 !! html
20854 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20855 </p>
20856 !! end
20857
20858 !! article
20859 Mediawiki:loop1
20860 !! text
20861 {{Identical|A}}
20862 !! endarticle
20863
20864 !! article
20865 Mediawiki:loop2
20866 !! text
20867 {{Identical|B}}
20868 !! endarticle
20869
20870 !! article
20871 Template:Identical
20872 !! text
20873 {{int:loop1}}
20874 {{int:loop2}}
20875 !! endarticle
20876
20877 !! test
20878 Bug 31098 Template which includes system messages which includes the template
20879 !! wikitext
20880 {{Identical}}
20881 !! html
20882 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20883 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20884 </p>
20885 !! end
20886
20887 !! test
20888 Bug31490 Turkish: ucfirst 'blah'
20889 !! options
20890 language=tr
20891 !! wikitext
20892 {{ucfirst:blah}}
20893 !! html
20894 <p>Blah
20895 </p>
20896 !! end
20897
20898 !! test
20899 Bug31490 Turkish: ucfirst 'ix'
20900 !! options
20901 language=tr
20902 !! wikitext
20903 {{ucfirst:ix}}
20904 !! html
20905 <p>İx
20906 </p>
20907 !! end
20908
20909 !! test
20910 Bug31490 Turkish: lcfirst 'BLAH'
20911 !! options
20912 language=tr
20913 !! wikitext
20914 {{lcfirst:BLAH}}
20915 !! html
20916 <p>bLAH
20917 </p>
20918 !! end
20919
20920 !! test
20921 Bug31490 Turkish: ucfırst (with a dotless i)
20922 !! options
20923 language=tr
20924 !! wikitext
20925 {{ucfırst:blah}}
20926 !! html
20927 <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>
20928 </p>
20929 !! end
20930
20931 !! test
20932 Bug31490 ucfırst (with a dotless i) with English language
20933 !! options
20934 language=en
20935 !! wikitext
20936 {{ucfırst:blah}}
20937 !! html
20938 <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>
20939 </p>
20940 !! end
20941
20942 !! test
20943 Bug 26375: TOC with italics
20944 !! options
20945 title=[[Main Page]]
20946 !! wikitext
20947 __TOC__
20948 == ''Lost'' episodes ==
20949 !! html
20950 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20951 <ul>
20952 <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>
20953 </ul>
20954 </div>
20955
20956 <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>
20957
20958 !! end
20959
20960 !! test
20961 Bug 26375: TOC with bold
20962 !! options
20963 title=[[Main Page]]
20964 !! wikitext
20965 __TOC__
20966 == '''should be bold''' then normal text ==
20967 !! html
20968 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20969 <ul>
20970 <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>
20971 </ul>
20972 </div>
20973
20974 <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>
20975
20976 !! end
20977
20978 !! test
20979 Bug 33845: Headings become cursive in TOC when they contain an image
20980 !! options
20981 title=[[Main Page]]
20982 !! wikitext
20983 __TOC__
20984 == Image [[Image:foobar.jpg]] ==
20985 !! html
20986 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20987 <ul>
20988 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20989 </ul>
20990 </div>
20991
20992 <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>
20993
20994 !! end
20995
20996 !! test
20997 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20998 !! options
20999 title=[[Main Page]]
21000 !! wikitext
21001 __TOC__
21002 == <blockquote>Quote</blockquote> ==
21003 !! html
21004 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21005 <ul>
21006 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21007 </ul>
21008 </div>
21009
21010 <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>
21011
21012 !! html+tidy
21013 <p></p>
21014 <div id="toc" class="toc">
21015 <div id="toctitle">
21016 <h2>Contents</h2>
21017 </div>
21018 <ul>
21019 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21020 </ul>
21021 </div>
21022 <p></p>
21023 <h2><span class="mw-headline" id="Quote"></span></h2>
21024 <blockquote>
21025 <p><span class="mw-headline" id="Quote">Quote</span></p>
21026 </blockquote>
21027 <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>
21028 !! end
21029
21030 !! test
21031 Unclosed tags in TOC
21032 !! options
21033 title=[[Main Page]]
21034 !! wikitext
21035 __TOC__
21036 == Proof: 2 < 3 ==
21037 <small>Hanc marginis exiguitas non caperet.</small>
21038 QED
21039 !! html
21040 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21041 <ul>
21042 <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>
21043 </ul>
21044 </div>
21045
21046 <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>
21047 <p><small>Hanc marginis exiguitas non caperet.</small>
21048 QED
21049 </p>
21050 !! end
21051
21052 !! test
21053 Multiple tags in TOC
21054 !! wikitext
21055 __TOC__
21056 == <i>Foo</i> <b>Bar</b> ==
21057
21058 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21059 !! html
21060 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21061 <ul>
21062 <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>
21063 <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>
21064 </ul>
21065 </div>
21066
21067 <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>
21068 <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>
21069
21070 !! html+tidy
21071 <p></p>
21072 <div id="toc" class="toc">
21073 <div id="toctitle">
21074 <h2>Contents</h2>
21075 </div>
21076 <ul>
21077 <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>
21078 <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>
21079 </ul>
21080 </div>
21081 <p></p>
21082 <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>
21083 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21084 <blockquote>
21085 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21086 </blockquote>
21087 <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>
21088 !! end
21089
21090 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21091 # html5 tag parsing.
21092 !! test
21093 Tags with parameters in TOC
21094 !! options
21095 parsoid=wt2html
21096 !! wikitext
21097 __TOC__
21098 == <sup class="in-h2">Hello</sup> ==
21099
21100 == <sup class="a > b">Evilbye</sup> ==
21101 !! html/php
21102 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21103 <ul>
21104 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21105 <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>
21106 </ul>
21107 </div>
21108
21109 <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>
21110 <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>
21111
21112 !! html/parsoid
21113 <meta property="mw:PageProp/toc" />
21114 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21115
21116 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21117 !! end
21118
21119 !! test
21120 span tags with directionality in TOC
21121 !! wikitext
21122 __TOC__
21123 == <span dir="ltr">C++</span> ==
21124
21125 == <span dir="rtl">זבנג!</span> ==
21126
21127 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21128
21129 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21130
21131 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21132 !! html
21133 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21134 <ul>
21135 <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>
21136 <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>
21137 <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>
21138 <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>
21139 <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>
21140 </ul>
21141 </div>
21142
21143 <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>
21144 <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>
21145 <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>
21146 <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>
21147 <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>
21148
21149 !! end
21150
21151 !! test
21152 Bug 72884: bdi element in ToC
21153 !! wikitext
21154 __TOC__
21155 == <bdi>test</bdi> ==
21156 !! html
21157 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21158 <ul>
21159 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21160 </ul>
21161 </div>
21162
21163 <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>
21164
21165 !! end
21166
21167 # Note that the html output does not have the <p></p>, but the
21168 # html+tidy output *does*. This is because the empty <p></p> is
21169 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21170 !! test
21171 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21172 !! wikitext
21173 __TOC__
21174 == x ==
21175 !! html
21176 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21177 <ul>
21178 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21179 </ul>
21180 </div>
21181
21182 <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>
21183
21184 !! html+tidy
21185 <p></p>
21186 <div id="toc" class="toc">
21187 <div id="toctitle">
21188 <h2>Contents</h2>
21189 </div>
21190 <ul>
21191 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21192 </ul>
21193 </div>
21194 <p></p>
21195 <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>
21196 !! end
21197
21198 !! article
21199 MediaWiki:Bug32057
21200 !! text
21201 == {{int:headline_sample}} ==
21202 !! endarticle
21203
21204 !! test
21205 Bug 32057: Title needed when expanding <h> nodes.
21206 !! options
21207 title=[[Main Page]]
21208 !! wikitext
21209 {{int:Bug32057}}
21210 !! html
21211 <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>
21212
21213 !! end
21214
21215 !! test
21216 Strip marker in urlencode
21217 !! wikitext
21218 {{urlencode:x<nowiki/>y}}
21219 {{urlencode:x<nowiki/>y|wiki}}
21220 {{urlencode:x<nowiki/>y|path}}
21221 {{urlencode:x<pre id="one">two</pre>y}}
21222 !! html
21223 <p>xy
21224 xy
21225 xy
21226 xy
21227 </p>
21228 !! end
21229
21230 !! test
21231 Strip marker in lc
21232 !! wikitext
21233 {{lc:x<nowiki/>y}}
21234 !! html
21235 <p>xy
21236 </p>
21237 !! end
21238
21239 !! test
21240 Strip marker in uc
21241 !! wikitext
21242 {{uc:x<nowiki/>y}}
21243 !! html
21244 <p>XY
21245 </p>
21246 !! end
21247
21248 !! test
21249 Strip marker in formatNum
21250 !! wikitext
21251 {{formatnum:1<nowiki/>2}}
21252 {{formatnum:1<nowiki/>2|R}}
21253 !! html
21254 <p>12
21255 12
21256 </p>
21257 !! end
21258
21259 !! test
21260 Check noCommafy in formatNum
21261 !! options
21262 language=be-tarask
21263 !! wikitext
21264 {{formatnum:123456.78}}
21265 {{formatnum:123456.78|NOSEP}}
21266 !! html
21267 <p>123 456,78
21268 123456.78
21269 </p>
21270 !! end
21271
21272 !! test
21273 Wrong option for formatNum (bug 56199)
21274 !! wikitext
21275 {{formatnum:1,234.56|Random}}
21276 {{formatnum:1,234.56|EVERYTHING}}
21277 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21278 !! html
21279 <p>1,234.56
21280 1,234.56
21281 1,234.56
21282 </p>
21283 !! end
21284
21285 !! test
21286 Strip marker in grammar
21287 !! options
21288 language=fi
21289 !! wikitext
21290 {{grammar:elative|foo<nowiki/>bar}}
21291 !! html
21292 <p>foobarista
21293 </p>
21294 !! end
21295
21296 !! test
21297 Strip marker in padleft
21298 !! wikitext
21299 {{padleft:|2|x<nowiki/>y}}
21300 !! html
21301 <p>xy
21302 </p>
21303 !! end
21304
21305 !! test
21306 Strip marker in padright
21307 !! wikitext
21308 {{padright:|2|x<nowiki/>y}}
21309 !! html
21310 <p>xy
21311 </p>
21312 !! end
21313
21314 !! test
21315 Strip marker in anchorencode
21316 !! wikitext
21317 {{anchorencode:x<nowiki/>y}}
21318 !! html
21319 <p>xy
21320 </p>
21321 !! end
21322
21323 !! test
21324 nowiki inside link inside heading (bug 18295)
21325 !! wikitext
21326 ==[[foo|x<nowiki>y</nowiki>z]]==
21327 !! html
21328 <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>
21329
21330 !! end
21331
21332 !! test
21333 new support for bdi element (bug 31817)
21334 !! wikitext
21335 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21336 !! html
21337 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21338
21339 !!end
21340
21341 !! test
21342 Ignore pipe between table row attributes
21343 !! wikitext
21344 {|
21345 | quux
21346 |- id=foo | style='color: red'
21347 | bar
21348 |}
21349 !! html
21350 <table>
21351 <tr>
21352 <td> quux
21353 </td></tr>
21354 <tr id="foo" style="color: red">
21355 <td> bar
21356 </td></tr></table>
21357
21358 !! end
21359
21360 !!test
21361 Gallery override link with WikiLink (bug 34852)
21362 !! wikitext
21363 <gallery>
21364 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21365 </gallery>
21366 !! html
21367 <ul class="gallery mw-gallery-traditional">
21368 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21369 <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>
21370 <div class="gallerytext">
21371 <p>caption
21372 </p>
21373 </div>
21374 </div></li>
21375 </ul>
21376
21377 !! end
21378
21379 !!test
21380 Gallery override link with absolute external link (bug 34852)
21381 !! wikitext
21382 <gallery>
21383 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21384 </gallery>
21385 !! html
21386 <ul class="gallery mw-gallery-traditional">
21387 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21388 <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>
21389 <div class="gallerytext">
21390 <p>caption
21391 </p>
21392 </div>
21393 </div></li>
21394 </ul>
21395
21396 !! end
21397
21398 !!test
21399 Gallery override link with malicious javascript (bug 34852)
21400 !! wikitext
21401 <gallery>
21402 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21403 </gallery>
21404 !! html
21405 <ul class="gallery mw-gallery-traditional">
21406 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21407 <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>
21408 <div class="gallerytext">
21409 <p>caption
21410 </p>
21411 </div>
21412 </div></li>
21413 </ul>
21414
21415 !! end
21416
21417 !!test
21418 Gallery with invalid title as link (bug 43964)
21419 !! wikitext
21420 <gallery>
21421 File:foobar.jpg|link=<
21422 </gallery>
21423 !! html
21424 <ul class="gallery mw-gallery-traditional">
21425 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21426 <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>
21427 <div class="gallerytext">
21428 </div>
21429 </div></li>
21430 </ul>
21431
21432 !! end
21433
21434 !!test
21435 Language parser function
21436 !! wikitext
21437 {{#language:ar}}
21438 !! html
21439 <p>العربية
21440 </p>
21441 !! end
21442
21443 !!test
21444 Padleft and padright as substr
21445 !! wikitext
21446 {{padleft:|3|abcde}}
21447 {{padright:|3|abcde}}
21448 !! html
21449 <p>abc
21450 abc
21451 </p>
21452 !! end
21453
21454 !!test
21455 Special parser function
21456 !! wikitext
21457 {{#special:RandomPage}}
21458 {{#special:BaDtItLe}}
21459 {{#special:Foobar}}
21460 !! html
21461 <p>Special:Random
21462 Special:Badtitle
21463 Special:Foobar
21464 </p>
21465 !! end
21466
21467 !!test
21468 Bug 34939 - Case insensitive link parsing ([HttP://])
21469 !! wikitext
21470 [HttP://MediaWiki.Org/]
21471 !! html/php
21472 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21473 </p>
21474 !! html/parsoid
21475 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21476 !! end
21477
21478 !!test
21479 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21480 !! wikitext
21481 [HttP://MediaWiki.Org/ MediaWiki]
21482 !! html
21483 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21484 </p>
21485 !! end
21486
21487 !!test
21488 Bug 34939 - Case insensitive link parsing (HttP://)
21489 !! wikitext
21490 HttP://MediaWiki.Org/
21491 !! html/php
21492 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21493 </p>
21494 !! html/parsoid
21495 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21496 !! end
21497
21498 !!test
21499 Disable TOC
21500 !! options
21501 notoc
21502 !! wikitext
21503 Lead
21504 == Section 1 ==
21505 == Section 2 ==
21506 == Section 3 ==
21507 == Section 4 ==
21508 == Section 5 ==
21509 !! html
21510 <p>Lead
21511 </p>
21512
21513 <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>
21514 <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>
21515 <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>
21516 <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>
21517 <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>
21518
21519 !! end
21520
21521
21522 ###
21523 ### Parsoid-specific tests
21524 ### Parsoid-PHP parser incompatibilities
21525 ###
21526 !!test
21527 1. SOL-sensitive wikitext tokens as template-args
21528 !!options
21529 parsoid=wt2html,wt2wt
21530 !! wikitext
21531 {{echo|*a}}
21532 {{echo|#a}}
21533 {{echo|:a}}
21534 !! html
21535 <span about="#mwt1" typeof="mw:Transclusion">
21536 </span><ul about="#mwt1"><li>a</li>
21537 </ul>
21538 <span about="#mwt2" typeof="mw:Transclusion">
21539 </span><ol about="#mwt2"><li>a</li>
21540 </ol>
21541 <span about="#mwt3" typeof="mw:Transclusion">
21542 </span><dl about="#mwt3"><dd>a</dd>
21543 </dl>
21544 !!end
21545
21546 #### -----------------------------------------------------------------
21547 #### Parsoid-specific functionality tests
21548 #### -----------------------------------------------------------------
21549
21550 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21551 # We know wt2wt will fail, but we expect selser to pass.
21552 # Due to the nature of our testing, wt2wt and selser tests will enter the
21553 # blacklist and we'll catch selser regressions based on changes to the
21554 # blacklist entries for selser tests.
21555 !! test
21556 1. Bad treebuilder fixup of formatting elt is cleaned up
21557 !! options
21558 parsoid=wt2html,wt2wt
21559 !! wikitext
21560 {|
21561 |
21562 <small>
21563 [[Image:Foobar.jpg|right|Test]]
21564 </small>
21565 |}
21566 !! html/parsoid
21567 <table>
21568 <tbody><tr><td>
21569 <small>
21570 <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>
21571 </small>
21572 </td></tr>
21573 </tbody></table>
21574 !! end
21575
21576 !! test
21577 2. Bad treebuilder fixup of formatting elt is cleaned up
21578 !! options
21579 parsoid=wt2html,wt2wt
21580 !! wikitext
21581 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21582
21583 <small>[[Image:Foobar.jpg|right|300px]]</small>
21584 !! html/parsoid
21585
21586 <p><b>foo</b></p>
21587 <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>
21588 <p><b>bar</b></p>
21589 <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>
21590 !! end
21591
21592 !! test
21593 3. Bad treebuilder fixup of formatting elt is cleaned up
21594 !! options
21595 parsoid=wt2html,wt2wt
21596 !! wikitext
21597 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21598 !! html/parsoid
21599 <p><small><b>foo</b></small></p>
21600 <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>
21601 <p><small><b>bar</b></small></p>
21602 !! end
21603
21604 !! test
21605 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21606 !! options
21607 parsoid=wt2html,wt2wt
21608 !! wikitext
21609 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21610 !! html/parsoid
21611 <p><b><small></small></b></p>
21612 <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>
21613 <p></p>
21614 !! end
21615
21616 #### ----------------------------------------------------------------
21617 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21618 #### tags. Parsoid's output for these tags differs from that of the
21619 #### PHP parser.
21620 #### ----------------------------------------------------------------
21621
21622 !!test
21623 Ref: 1. ref-location should be replaced with an index span
21624 !! wikitext
21625 A <ref>foo</ref>
21626 B <ref name="x">foo</ref>
21627 C <ref name="y" />
21628 <references />
21629 !! html/parsoid
21630 <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>
21631 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>
21632 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>
21633 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21634 <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>
21635 <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>
21636 <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>
21637 </ol>
21638 !!end
21639
21640 !!test
21641 Ref: 2. ref-tags with identical names should all get the same index
21642 !! wikitext
21643 A <ref name="x">foo</ref>
21644 B <ref name="x" />
21645 <references />
21646 !! html/parsoid
21647 <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>
21648 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>
21649 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21650 <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>
21651 </ol>
21652 !!end
21653
21654 !!test
21655 Ref: 3. spaces in ref-names should be ignored
21656 !! wikitext
21657 A <ref name="x">foo</ref>
21658 B <ref name=" x " />
21659 C <ref name= x />
21660 <references />
21661 !! html/parsoid
21662 <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>
21663 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>
21664 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>
21665 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21666 <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>
21667 </ol>
21668 !!end
21669
21670 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21671 !!test
21672 Ref: 4. 'constructor' should be accepted as a valid ref-name
21673 !! wikitext
21674 A <ref name="constructor">foo</ref>
21675 <references />
21676 !! html/parsoid
21677 <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>
21678 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21679 <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>
21680 </ol>
21681 !!end
21682
21683 !!test
21684 Ref: 5. body should accept generic wikitext
21685 !! wikitext
21686 A <ref>
21687 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21688 </ref>
21689
21690 <references />
21691 !! html/parsoid
21692 <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>
21693
21694 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21695 <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>
21696 </span></li>
21697 </ol>
21698 !!end
21699
21700 !!test
21701 Ref: 6. indent-pres should not be output in ref-body
21702 !! wikitext
21703 A <ref>
21704 foo
21705 bar
21706 baz
21707 </ref>
21708
21709 <references />
21710 !! html/parsoid
21711 <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>
21712
21713 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21714 <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
21715 bar
21716 baz
21717 </span></li>
21718 </ol>
21719 !!end
21720
21721 !!test
21722 Ref: 7. No p-wrapping in ref-body
21723 !! wikitext
21724 A <ref>
21725 foo
21726
21727 bar
21728
21729
21730 baz
21731
21732
21733
21734 booz
21735 </ref>
21736
21737 <references />
21738 !! html/parsoid
21739 <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>
21740
21741 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21742 <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
21743
21744 bar
21745
21746
21747 baz
21748
21749
21750
21751 booz
21752 </span></li>
21753 </ol>
21754 !!end
21755
21756 !!test
21757 Ref: 8. transclusion wikitext has lower precedence
21758 !! wikitext
21759 A <ref> foo {{echo|</ref> B C}}
21760
21761 <references />
21762 !! html/parsoid
21763 <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>
21764 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21765 <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>
21766 </ol>
21767 !!end
21768
21769 !!test
21770 Ref: 9. unclosed comments should not leak out of ref-body
21771 !! wikitext
21772 A <ref> foo <!--</ref> B C
21773 <references />
21774 !! html/parsoid
21775 <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>
21776 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21777 <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>
21778 </ol>
21779 !!end
21780
21781 !!test
21782 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21783 !! wikitext
21784 A <ref> <b> foo </ref> B C
21785
21786 <references />
21787 !! html/parsoid
21788 <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>
21789
21790
21791 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21792 <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>
21793 </ol>
21794 !!end
21795
21796 !!test
21797 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21798 !! wikitext
21799 A <ref>foo</ref> B
21800 C <ref>bar</ref> D
21801 <references />
21802 !! html/parsoid
21803 <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
21804 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>
21805 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21806 <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>
21807 <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>
21808 </ol>
21809 !!end
21810
21811 !!test
21812 Ref: 12. ref-tags act as trailing newline migration barrier
21813 !! wikitext
21814 <!--the newline at the end of this line moves out of the p tag-->a
21815
21816 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21817 <ref />
21818
21819 c
21820 <references />
21821 !! html/parsoid
21822 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21823
21824
21825 <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>
21826 <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>
21827
21828 <p>c</p>
21829 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21830 <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>
21831 <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>
21832 !!end
21833
21834 !!test
21835 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21836 !! wikitext
21837 <ref>foo</ref> A
21838 <ref>bar
21839 </ref> B
21840 <references />
21841 !! html/parsoid
21842 <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
21843 <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>
21844 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21845 <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>
21846 <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
21847 </span></li>
21848 </ol>
21849 !!end
21850
21851 !!test
21852 Ref: 14. A nested ref-tag should be emitted as plain text
21853 !! wikitext
21854 <ref>foo <ref>bar</ref> baz</ref>
21855
21856 <references />
21857 !! html/parsoid
21858 <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>
21859 </p>
21860 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21861 <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>
21862 </ol>
21863 !!end
21864
21865 !!test
21866 Ref: 15. ref-tags with identical names should get identical indexes
21867 !! wikitext
21868 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21869 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21870
21871 <references />
21872 !! html/parsoid
21873 <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>
21874 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>
21875
21876 <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>
21877 </ol>
21878 !!end
21879
21880 ## We don't bother wt2wt-ing non-standard whitespace
21881 !!test
21882 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21883 !!options
21884 parsoid=wt2html
21885 !! wikitext
21886 A <ref >foo</ref >
21887
21888 <references />
21889 !! html/parsoid
21890 <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>
21891 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21892 <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>
21893 !!end
21894
21895 !!test
21896 Ref: 17. Generate valid HTML5 id/about attributes
21897 !!wikitext
21898 <ref name="a b">foo</ref>
21899
21900 <references />
21901 !!html/parsoid
21902 <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>
21903 </p>
21904
21905 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21906 <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>
21907 </ol>
21908 !!end
21909
21910 !!test
21911 Ref: 18. T58916: Extension attributes should be parsed as plain text
21912 !!wikitext
21913 <ref name="{{echo|a}}">foo</ref>
21914
21915 <references />
21916 !!html/parsoid
21917 <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>
21918 </p>
21919
21920 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21921 <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>
21922 </ol>
21923 !!end
21924
21925 !!test
21926 Ref: 19. ref-tags with identical name encodings should get identical indexes
21927 !! wikitext
21928 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21929
21930 <references />
21931 !! html/parsoid
21932 <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>
21933 </p>
21934 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21935 <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>
21936 </ol>
21937 !!end
21938
21939 !!test
21940 Ref: 20. ref-tags with identical names but different content should keep it
21941 !! wikitext
21942 A <ref name="foo">Foo one</ref>
21943 B <ref name="foo">Foo two</ref>
21944 C <ref name="foo" />
21945
21946 <references />
21947 !! html/parsoid
21948 <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>
21949 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>
21950 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>
21951
21952 <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>
21953 </ol>
21954 !!end
21955
21956 !!test
21957 References: 1. references tag without any refs should be handled properly
21958 !! wikitext
21959 <references />
21960 !! html/parsoid
21961 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21962 !!end
21963
21964 !!test
21965 References: 2. references tag with group only outputs references from that group
21966 !! wikitext
21967 A <ref group="a">foo</ref>
21968 B <ref group="b">bar</ref>
21969 C <ref>baz</ref>
21970
21971 <references group="a" />
21972 <references />
21973 <references group="b" />
21974 !! html/parsoid
21975 <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>
21976 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>
21977 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>
21978
21979 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21980 <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>
21981 </ol>
21982 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21983 <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>
21984 </ol>
21985 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21986 <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>
21987 </ol>
21988 !!end
21989
21990 !!test
21991 References: 3. ref list should be cleared after processing references
21992 !! wikitext
21993 A <ref>foo</ref>
21994
21995 <references />
21996
21997 B <ref>bar</ref>
21998
21999 <references />
22000 !! html/parsoid
22001 <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>
22002
22003 <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>
22004 </ol>
22005
22006 <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>
22007
22008 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22009 <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>
22010 </ol>
22011 !!end
22012
22013 !!test
22014 References: 4. only referenced group should be cleared after processing references
22015 !! wikitext
22016 A <ref group="a">afoo</ref>
22017 B <ref>bfoo</ref>
22018
22019 <references group="a" />
22020
22021 C <ref>cfoo</ref>
22022
22023 <references />
22024 !! html/parsoid
22025 <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>
22026 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>
22027
22028 <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>
22029 </ol>
22030
22031 <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>
22032
22033 <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>
22034 </ol>
22035 !!end
22036
22037 !!test
22038 References: 5. ref tags in references should be processed while ignoring all other content
22039 !! wikitext
22040 A <ref name="a" />
22041 B <ref name="b">bar</ref>
22042
22043 <references>
22044 <ref name="a">foo</ref>
22045 This should just get lost.
22046 </references>
22047 !! html/parsoid
22048 <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>
22049 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>
22050
22051
22052 <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>
22053 </ol>
22054 !!end
22055
22056 !!test
22057 References: 6. <references /> from a transclusion
22058 !! wikitext
22059 <ref>Foo</ref> {{echo|<references />}}
22060 !! html/parsoid
22061 <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>
22062 </ol>
22063 !!end
22064
22065 !! test
22066 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22067 !! wikitext
22068 A <ref>foo bar for a</ref>
22069 B <ref group="X" name="b" />
22070
22071 <references />
22072
22073 <references group="X">
22074 <ref name="b">foo</ref>
22075 </references>
22076 !! html/parsoid
22077 <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>
22078 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>
22079 </p>
22080
22081 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22082 <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>
22083 </ol>
22084
22085 <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"}}'>
22086 <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>
22087 </ol>
22088 !! end
22089
22090 !! test
22091 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22092 !! wikitext
22093 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22094 <references />
22095 !! html/parsoid
22096 <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>
22097 <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>
22098 </ol>
22099 !!end
22100
22101 # This test only works in wt2html now as the <references /> are always generated
22102 # unless selser is active. Once T72722 is fixed, we should add a changes test
22103 # here to ensure that unrelated changes don't add the new <references /> in
22104 # wt2wt.
22105 !! test
22106 References: 9. Generate missing references list at the end
22107 !! wikitext
22108 A <ref>foo</ref>
22109 B <ref group="inexistent">bar</ref>
22110 !! html/parsoid
22111 <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>
22112 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22113 <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>
22114 </ol>
22115 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
22116 <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>
22117 </ol>
22118 !! end
22119
22120 !! test
22121 References: 10. New <references/> shouldn't be added for unrelated edits.
22122 !! options
22123 parsoid={
22124 "modes": ["selser"],
22125 "changes": [["#x", "remove"]],
22126 "selser": "noauto"
22127 }
22128 !! wikitext
22129 Unrelated text<span id="x"> that's going to disappear</span>.
22130 A <ref>foo</ref>
22131 !! wikitext/edited
22132 Unrelated text.
22133 A <ref>foo</ref>
22134 !!end
22135
22136 !! test
22137 Entities in ref name
22138 !! wikitext
22139 <ref name="test &amp; me">hi</ref>
22140 <references />
22141 !! html/parsoid
22142 <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>
22143 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22144 <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>
22145 </ol>
22146 !! end
22147
22148 # This test is wt2html only because we're permitting the serializer to produce
22149 # dirty diffs, normalizing the unclosed references to the self-closed version.
22150 !! test
22151 Generate references for unclosed references tag
22152 !! options
22153 parsoid=wt2html
22154 !! wikitext
22155 a<ref>foo</ref>
22156
22157 <references>
22158 !! html/parsoid
22159 <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>
22160 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22161 <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>
22162 !! end
22163
22164 !! test
22165 New reference serializes on its own line
22166 !! options
22167 parsoid=wt2wt,html2wt
22168 !! wikitext
22169 foo
22170 <references />
22171 !! html/parsoid
22172 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22173 !! end
22174
22175 #### ----------------------------------------------------------------
22176 #### Parsoid-only testing of Parsoid's impl of LST
22177 #### Not implemented yet, see
22178 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22179 #### ----------------------------------------------------------------
22180
22181 !! test
22182 LST Sections: 1. Simple section start and end
22183 !! options
22184 parsoid={ "suppressErrors": true }
22185 !! wikitext
22186 <section begin="2011-05-16" />
22187 <section end="2014-04-10 (MW 1.23wmf22)" />
22188 !! html/parsoid
22189 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22190 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22191 !! end
22192
22193 #--------- Test stripping of empty nodes in template content ----------
22194 !!test
22195 Empty LI and TR nodes should be stripped from template content
22196 !!wikitext
22197 {{EmptyLITest}}
22198 {{EmptyTRTest}}
22199 !!html/parsoid
22200 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22201 <li>a</li>
22202 <li>b</li>
22203 </ul>
22204 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22205 <tbody>
22206 <tr>
22207 <td>foo</td>
22208 </tr>
22209 <tr>
22210 <td>bar</td>
22211 </tr>
22212 </tbody>
22213 </table>
22214 !!end
22215
22216 !!test
22217 Empty LI and TR nodes should not be stripped from top-level content
22218 !!wikitext
22219 * a
22220 *
22221 * b
22222 {|
22223 |-
22224 |-
22225 |foo
22226 |}
22227 !!html/parsoid
22228 <ul>
22229 <li> a</li>
22230 <li></li>
22231 <li> b</li>
22232 </ul>
22233 <table>
22234 <tbody>
22235 <tr></tr>
22236 <tr>
22237 <td>foo</td>
22238 </tr>
22239 </tbody>
22240 </table>
22241 !!end
22242
22243 !!test
22244 Empty TR nodes should not be stripped if they have any attributes set
22245 !!wikitext
22246 {{EmptyTRWithHTMLAttrTest}}
22247 !!html/parsoid
22248 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22249 <tr align="center"></tr>
22250 <tr><td>foo</td></tr>
22251 <tr align="center"></tr>
22252 <tr><td>bar</td></tr>
22253 </table>
22254 !!end
22255
22256 #### ----------------------------------------------------------------
22257 #### The following section of tests are primarily to test
22258 #### wikitext escaping capabilities of Parsoid. Given that
22259 #### escaping can be done any number of ways, the wikitext (input)
22260 #### is always adjusted to reflect how Parsoid adds nowiki
22261 #### escape tags.
22262 ####
22263 #### We are marking several tests as parsoid-only since the
22264 #### HTML in the result section is different from what the
22265 #### PHP parser generates for it.
22266 #### ----------------------------------------------------------------
22267
22268
22269 #### --------------- Headings ---------------
22270 #### 0. Unnested
22271 #### 1. Nested inside html <h1>=foo=</h1>
22272 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22273 #### 3. Nested inside html with wikitext split by html tags
22274 #### 4. No escape needed
22275 #### 5. Empty headings <h1></h1>
22276 #### 6. Heading chars in SOL context
22277 #### ----------------------------------------
22278 !! test
22279 Headings: 0. Unnested
22280 !! options
22281 parsoid=html2wt
22282 !! html/parsoid
22283 <p>=foo=</p>
22284
22285 <p> =foo=
22286 <!--cmt-->
22287 =foo=</p>
22288
22289 <p>=foo<i>a</i>=</p>
22290 !! wikitext
22291 <nowiki>=foo=</nowiki>
22292
22293 <nowiki> </nowiki>=foo=
22294 <!--cmt-->
22295 <nowiki>=foo=</nowiki>
22296
22297 =foo''a''<nowiki>=</nowiki>
22298 !!end
22299
22300 # New headings and existing headings are handled differently
22301 !! test
22302 Headings: 1. Nested inside html
22303 !! options
22304 parsoid=html2wt
22305 !! html/parsoid
22306 <h1>=foo=</h1>
22307 <h2>=foo=</h2>
22308 <h3>=foo=</h3>
22309
22310 <h1 data-parsoid=''>=foo=</h1>
22311 <h2 data-parsoid=''>=foo=</h2>
22312 <h3 data-parsoid=''>=foo=</h3>
22313 <h4 data-parsoid=''>=foo=</h4>
22314 <h5 data-parsoid=''>=foo=</h5>
22315 <h6 data-parsoid=''>=foo=</h6>
22316 !! wikitext
22317 = =foo= =
22318
22319 == =foo= ==
22320
22321 === =foo= ===
22322
22323 =<nowiki>=foo=</nowiki>=
22324 ==<nowiki>=foo=</nowiki>==
22325 ===<nowiki>=foo=</nowiki>===
22326 ====<nowiki>=foo=</nowiki>====
22327 =====<nowiki>=foo=</nowiki>=====
22328 ======<nowiki>=foo=</nowiki>======
22329
22330 !!end
22331
22332 !! test
22333 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22334 !! options
22335 parsoid=html2wt
22336 !! html/parsoid
22337 <h1>foo</h1>*bar
22338 <h1>foo</h1>=bar
22339 <h1>foo</h1>=bar=
22340 !! wikitext
22341 = foo =
22342 <nowiki>*</nowiki>bar
22343
22344 = foo =
22345 =bar
22346
22347 = foo =
22348 <nowiki>=bar=</nowiki>
22349 !!end
22350
22351 !! test
22352 Headings: 3. Nested inside html with wikitext split by html tags
22353 !! options
22354 parsoid=html2wt
22355 !! html/parsoid
22356 <h1>=<b>bold</b>foo=</h1>
22357 !! wikitext
22358 = ='''bold'''<nowiki>foo=</nowiki> =
22359 !!end
22360
22361 !! test
22362 Headings: 4a. No escaping needed (testing just h1 and h2)
22363 !! options
22364 parsoid=html2wt
22365 !! html/parsoid
22366 <h1>=foo</h1>
22367 <h1>foo=</h1>
22368 <h1> =foo= </h1>
22369 <h1>=foo= bar</h1>
22370 <h2>=foo</h2>
22371 <h2>foo=</h2>
22372 <h1>=</h1>
22373 <h1><i>=</i>foo=</h1>
22374 !! wikitext
22375 = =foo =
22376
22377 = foo= =
22378
22379 = =foo= =
22380
22381 = =foo= bar =
22382
22383 == =foo ==
22384
22385 == foo= ==
22386
22387 = = =
22388
22389 = ''=''foo= =
22390 !!end
22391
22392 !! test
22393 Headings: 4b. No escaping needed (inside p-tags)
22394 !! options
22395 parsoid=html2wt
22396 !! html/parsoid
22397 <p>===
22398 =foo= x
22399 =foo= <s></s>
22400 </p>
22401 !! wikitext
22402 ===
22403 =foo= x
22404 =foo= <s></s>
22405 !!end
22406
22407 !! test
22408 Headings: 5. Empty headings
22409 !! options
22410 parsoid=html2wt
22411 !! html/parsoid
22412 <h1 data-parsoid='{}'></h1>
22413
22414 <h2 data-parsoid='{}'></h2>
22415
22416 <h3 data-parsoid='{}'></h3>
22417
22418 <h4 data-parsoid='{}'></h4>
22419
22420 <h5 data-parsoid='{}'></h5>
22421
22422 <h6 data-parsoid='{}'></h6>
22423 !! wikitext
22424 =<nowiki/>=
22425
22426 ==<nowiki/>==
22427
22428 ===<nowiki/>===
22429
22430 ====<nowiki/>====
22431
22432 =====<nowiki/>=====
22433
22434 ======<nowiki/>======
22435 !!end
22436
22437 !! test
22438 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22439 !! options
22440 parsoid=html2wt
22441 !! html/parsoid
22442 <p>=a=</p>
22443
22444 <p>=a=</p>
22445
22446 <p>=a=</p>
22447 !! wikitext
22448 <nowiki>=a=</nowiki>
22449
22450 <nowiki>=a=</nowiki>
22451
22452 <nowiki>=a=</nowiki>
22453 !!end
22454
22455 !! test
22456 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22457 !! options
22458 parsoid=html2wt
22459 !! html/parsoid
22460 <p>=a=
22461 b</p>
22462
22463 <p>=a=
22464 b</p>
22465
22466 <p>=a=
22467 b</p>
22468 !! wikitext
22469 <nowiki>=a=</nowiki>
22470 b
22471
22472 <nowiki>=a=</nowiki>
22473 b
22474
22475 <nowiki>=a=</nowiki>
22476 b
22477 !!end
22478
22479 !! test
22480 Headings: 6c. Heading chars in SOL context (leading newline break)
22481 !! options
22482 parsoid=html2wt
22483 !! html/parsoid
22484 <p>a
22485 =b=</p>
22486 !! wikitext
22487 a
22488 <nowiki>=b=</nowiki>
22489 !!end
22490
22491 !! test
22492 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22493 !! options
22494 parsoid=html2wt
22495 !! html/parsoid
22496 <!--c0--><p>=a=</p>
22497
22498 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22499 !! wikitext
22500 <!--c0--><nowiki>=a=</nowiki>
22501
22502 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22503 !!end
22504
22505 !! test
22506 Headings: 6d. Heading chars in SOL context (No escaping needed)
22507 !! options
22508 parsoid=html2wt
22509 !! html/parsoid
22510 =a=<div>b</div>
22511 !! wikitext
22512 =a=<div>b</div>
22513 !!end
22514
22515 !! test
22516 Headings: 7. Insert a newline between new content and headings
22517 !! options
22518 parsoid=html2wt
22519 !! html/parsoid
22520 <h2>NEW</h2>
22521 <p>new</p>
22522 <h2 data-parsoid='{}'>A</h2>
22523 <p data-parsoid='{}'>a</p>
22524 !! wikitext
22525 == NEW ==
22526 new
22527
22528 ==A==
22529 a
22530
22531 !! end
22532
22533 #### --------------- Lists ---------------
22534 #### 0. Outside nests (*foo, etc.)
22535 #### 1. Nested inside html <ul><li>*foo</li></ul>
22536 #### 2. Inside definition lists
22537 #### 3. Only bullets at start should be escaped
22538 #### 4. No escapes needed
22539 #### 5. No unnecessary escapes
22540 #### 6. Escape bullets in SOL position
22541 #### 7. Escape bullets in a multi-line context
22542 #### ----------------------------------------
22543
22544 !! test
22545 Lists: 0. Outside nests
22546 !! options
22547 parsoid=html2wt
22548 !! html/parsoid
22549 <p>*foo</p>
22550
22551 <p>#foo</p>
22552
22553 <p>;Foo:bar</p>
22554 !! wikitext
22555 <nowiki>*</nowiki>foo
22556
22557 <nowiki>#</nowiki>foo
22558
22559 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22560 !!end
22561
22562 !! test
22563 Lists: 1. Nested inside html
22564 !! options
22565 parsoid=html2wt
22566 !! html/parsoid
22567 <ul><li>*foo</li></ul>
22568 <ul><li>#foo</li></ul>
22569 <ul><li>:foo</li></ul>
22570 <ul><li>;foo</li></ul>
22571 <ol><li>*foo</li></ol>
22572 <ol><li>#foo</li></ol>
22573 <ol><li>:foo</li></ol>
22574 <ol><li>;foo</li></ol>
22575
22576 !! wikitext
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
22589 #<nowiki>:foo</nowiki>
22590
22591 #<nowiki>;foo</nowiki>
22592 !!end
22593
22594 !! test
22595 Lists: 2. Inside definition lists
22596 !! options
22597 parsoid=html2wt
22598 !! html/parsoid
22599 <dl><dt>;foo</dt></dl>
22600 <dl><dt>:foo</dt></dl>
22601 <dl><dt>:foo</dt>
22602 <dd>bar</dd></dl>
22603 <dl><dd>:foo</dd></dl>
22604
22605 !! wikitext
22606 ;<nowiki>;foo</nowiki>
22607
22608 ;<nowiki>:foo</nowiki>
22609
22610 ;<nowiki>:foo</nowiki>
22611 :bar
22612
22613 :<nowiki>:foo</nowiki>
22614 !!end
22615
22616 !! test
22617 Lists: 3. Only bullets at start of text should be escaped
22618 !! options
22619 parsoid=html2wt
22620 !! html/parsoid
22621 <ul><li>*foo*bar</li></ul>
22622 <ul><li>*foo<i>it</i>*bar</li></ul>
22623
22624 !! wikitext
22625 *<nowiki>*foo*bar</nowiki>
22626
22627 *<nowiki>*foo</nowiki>''it''*bar
22628 !!end
22629
22630 !! test
22631 Lists: 4. No escapes needed
22632 !! options
22633 parsoid=html2wt
22634 !! html/parsoid
22635 <ul>
22636 <li>foo*bar
22637 </li>
22638 </ul>
22639 <ul>
22640 <li><i>foo</i>*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 <ul>
22648 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22649 </li>
22650 </ul>
22651 !! wikitext
22652 *foo*bar
22653
22654 *''foo''*bar
22655
22656 *[[Foo]]: bar
22657
22658 *[[Foo]]*bar
22659 !!end
22660
22661 !! test
22662 Lists: 5. No unnecessary escapes
22663 !! options
22664 parsoid=html2wt
22665 !! html/parsoid
22666 <ul><li> bar <span>[[foo]]</span></li></ul>
22667 <ul><li> =bar <span>[[foo]]</span></li></ul>
22668 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22669 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22670 <ul><li> =bar <span>foo]]</span>=</li></ul>
22671 <ul><li> <s></s>: a</li></ul>
22672 <ul><li> <i>* foo</i></li></ul>
22673
22674 !! wikitext
22675 * bar <span><nowiki>[[foo]]</nowiki></span>
22676
22677 * =bar <span><nowiki>[[foo]]</nowiki></span>
22678
22679 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22680
22681 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22682
22683 * =bar <span>foo]]</span>=
22684
22685 * <s></s>: a
22686
22687 * ''* foo''
22688 !!end
22689
22690 !! test
22691 Lists: 6. Escape bullets in SOL position
22692 !! options
22693 parsoid=html2wt
22694 !! html/parsoid
22695 <p><!--cmt-->*foo</p>
22696 !! wikitext
22697 <!--cmt--><nowiki>*</nowiki>foo
22698 !!end
22699
22700 !! test
22701 Lists: 7. Escape bullets in a multi-line context
22702 !! options
22703 parsoid=html2wt
22704 !! html/parsoid
22705 <p>a
22706 *b
22707 </p>
22708 !! wikitext
22709 a
22710 <nowiki>*</nowiki>b
22711 !!end
22712
22713 !! test
22714 Lists: 8. Escape colons only if not present in tags
22715 !! options
22716 parsoid=html2wt
22717 !! html/parsoid
22718 <dl><dt>a:b<i>c:d</i></dt></dl>
22719 !! wikitext
22720 ; <nowiki>a:b</nowiki>''c:d''
22721 !! end
22722
22723 #### --------------- HRs ---------------
22724 #### 1. Single line
22725 #### -----------------------------------
22726
22727 !! test
22728 HRs: 1. Single line
22729 !! options
22730 parsoid=html2wt
22731 !! html/parsoid
22732 <hr />----
22733 <hr />=foo=
22734 <hr />*foo
22735 !! wikitext
22736 ----<nowiki>----</nowiki>
22737 ----=foo=
22738 ----*foo
22739 !! end
22740
22741 #### --------------- Tables ---------------
22742 #### 1a. Simple example
22743 #### 1b. No escaping needed (!foo)
22744 #### 1c. No escaping needed (|foo)
22745 #### 1d. No escaping needed (|}foo)
22746 ####
22747 #### 2a. Nested in td (<td>foo|bar</td>)
22748 #### 2b. Nested in td (<td>foo||bar</td>)
22749 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22750 ####
22751 #### 3a. Nested in th (<th>foo!bar</th>)
22752 #### 3b. Nested in th (<th>foo!!bar</th>)
22753 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22754 ####
22755 #### 4a. Escape -
22756 #### 4b. Escape +
22757 #### 4c. No escaping needed
22758 #### --------------------------------------
22759
22760 !! test
22761 Tables: 1a. Simple example
22762 !! options
22763 parsoid=html2wt
22764 !! html/parsoid
22765 <p>{|
22766 |}
22767 </p>
22768 !! wikitext
22769 <nowiki>{|</nowiki>
22770 |}
22771 !! end
22772
22773 !! test
22774 Tables: 1b. No escaping needed
22775 !! options
22776 parsoid=html2wt
22777 !! html/parsoid
22778 <p>!foo
22779 </p>
22780 !! wikitext
22781 !foo
22782 !! end
22783
22784 !! test
22785 Tables: 1c. No escaping needed
22786 !! options
22787 parsoid=html2wt
22788 !! html/parsoid
22789 <p>|foo
22790 </p>
22791 !! wikitext
22792 |foo
22793 !! end
22794
22795 !! test
22796 Tables: 1d. No escaping needed
22797 !! options
22798 parsoid=html2wt
22799 !! html/parsoid
22800 <p>|}foo
22801 </p>
22802 !! wikitext
22803 |}foo
22804 !! end
22805
22806 !! test
22807 Tables: 2a. Nested in td
22808 !! options
22809 parsoid=html2wt
22810 !! html/parsoid
22811 <table><tbody><tr>
22812 <td>foo|bar</td></tr>
22813 <tr><td>x<div>a|b</div></td>
22814 </tbody></table>
22815 !! wikitext
22816 {|
22817 |<nowiki>foo|bar</nowiki>
22818 |-
22819 |x<div><nowiki>a|b</nowiki></div>
22820 |}
22821 !! html/php+tidy
22822 <table>
22823 <tr>
22824 <td>foo|bar</td>
22825 </tr>
22826 <tr>
22827 <td>x
22828 <div>a|b</div>
22829 </td>
22830 </tr>
22831 </table>
22832 !! end
22833
22834 !! test
22835 Tables: 2b. Nested in td
22836 !! options
22837 parsoid=html2wt
22838 !! html/parsoid
22839 <table><tbody><tr>
22840 <td>foo||bar</td>
22841 <td>a<i>b||c</i></td>
22842 <td>a<i><div>b||c</div></i></td>
22843 </tr></tbody></table>
22844 !! wikitext
22845 {|
22846 |<nowiki>foo||bar</nowiki>
22847 |a''<nowiki>b||c</nowiki>''
22848 |a''<div><nowiki>b||c</nowiki></div>''
22849 |}
22850 !! html/php
22851 <table>
22852 <tr>
22853 <td>foo||bar
22854 </td>
22855 <td>a<i>b||c</i>
22856 </td>
22857 <td>a<i><div>b||c</div></i>
22858 </td></tr></table>
22859
22860 !! end
22861
22862 !! test
22863 Tables: 2c. Nested in td -- no escaping needed
22864 !! options
22865 parsoid=html2wt
22866 !! html/*
22867 <table>
22868
22869 <tr>
22870 <td>foo!!bar
22871 </td></tr></table>
22872
22873 !! wikitext
22874 {|
22875
22876 |foo!!bar
22877 |}
22878 !! end
22879
22880 !! test
22881 Tables: 3a. Nested in th
22882 !! options
22883 parsoid=html2wt
22884 !! html/*
22885 <table>
22886
22887 <tr>
22888 <th>foo!bar
22889 </th></tr></table>
22890
22891 !! wikitext
22892 {|
22893
22894 !foo!bar
22895 |}
22896 !! end
22897
22898 !! test
22899 Tables: 3b. Nested in th
22900 !! options
22901 parsoid=html2wt
22902 !! html/parsoid
22903 <table><tbody>
22904 <tr><th>foo!!bar</th>
22905 <th><i>foo|bar</i></th>
22906 <th><i>foo!!bar</i></th>
22907 <th><i><span>foo!!bar</span></i></th>
22908 </tr></tbody></table>
22909 !! wikitext
22910 {|
22911 !<nowiki>foo!!bar</nowiki>
22912 !''<nowiki>foo|bar</nowiki>''
22913 !''<nowiki>foo!!bar</nowiki>''
22914 !''<span><nowiki>foo!!bar</nowiki></span>''
22915 |}
22916 !! html/php
22917 <table>
22918 <tr>
22919 <th>foo!!bar
22920 </th>
22921 <th><i>foo|bar</i>
22922 </th>
22923 <th><i>foo!!bar</i>
22924 </th>
22925 <th><i><span>foo!!bar</span></i>
22926 </th></tr></table>
22927
22928 !! end
22929
22930 !! test
22931 Tables: 3c. Nested in th
22932 !! options
22933 parsoid=html2wt
22934 !! html/parsoid
22935 <table><tbody>
22936 <tr><th>foo||bar</th>
22937 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22938 </tr></tbody></table>
22939 !! wikitext
22940 {|
22941 !<nowiki>foo||bar</nowiki>
22942 !<nowiki>foo||bar</nowiki>
22943 |}
22944 !! html/php
22945 <table>
22946 <tr>
22947 <th>foo||bar
22948 </th>
22949 <th>foo||bar
22950 </th></tr></table>
22951
22952 !! end
22953
22954 !! test
22955 Tables: 4a. Escape -
22956 !! options
22957 parsoid=html2wt
22958 !! html/*
22959 <table>
22960
22961 <tr>
22962 <th>-bar
22963 </th></tr>
22964 <tr>
22965 <td>-bar
22966 </td></tr></table>
22967
22968 !! wikitext
22969 {|
22970
22971 !-bar
22972
22973 |-
22974 |<nowiki>-bar</nowiki>
22975 |}
22976 !! end
22977
22978 !! test
22979 Tables: 4b. Escape +
22980 !! options
22981 parsoid=html2wt
22982 !! html/*
22983 <table>
22984
22985 <tr>
22986 <th>+bar
22987 </th></tr>
22988 <tr>
22989 <td>+bar
22990 </td></tr></table>
22991
22992 !! wikitext
22993 {|
22994
22995 !+bar
22996
22997 |-
22998 |<nowiki>+bar</nowiki>
22999 |}
23000 !! end
23001
23002 !! test
23003 Tables: 4c. No escaping needed
23004 !! options
23005 parsoid=html2wt
23006 !! html/parsoid
23007 <table><tbody>
23008 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23009 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23010 <tr><td>foo
23011 <p>bar|baz
23012 +bar
23013 -bar</p></td></tr>
23014 <tr><td>x
23015 <div>a|b</div></td>
23016 </tbody></table>
23017 !! wikitext
23018 {|
23019 |foo-bar
23020 |foo+bar
23021 |-
23022 |''foo''-bar
23023 |''foo''+bar
23024 |-
23025 |foo
23026 bar|baz
23027 +bar
23028 -bar
23029 |-
23030 |x
23031 <div>a|b</div>
23032 |}
23033 !! html/php
23034 <table>
23035 <tr>
23036 <td>foo-bar
23037 </td>
23038 <td>foo+bar
23039 </td></tr>
23040 <tr>
23041 <td><i>foo</i>-bar
23042 </td>
23043 <td><i>foo</i>+bar
23044 </td></tr>
23045 <tr>
23046 <td>foo
23047 <p>bar|baz
23048 +bar
23049 -bar
23050 </p>
23051 </td></tr>
23052 <tr>
23053 <td>x
23054 <div>a|b</div>
23055 </td></tr></table>
23056
23057 !! end
23058
23059 !! test
23060 Tables: 4d. No escaping needed
23061 !! options
23062 parsoid=html2wt
23063 !! html/parsoid
23064 <table>
23065 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23066 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23067 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23068 </tbody></table>
23069 !! wikitext
23070 {|
23071 |[[Foo]]-bar
23072 ||+1
23073 ||-2
23074 |}
23075 !! html/php
23076 <table>
23077 <tr>
23078 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23079 </td>
23080 <td>+1
23081 </td>
23082 <td>-2
23083 </td></tr></table>
23084
23085 !! end
23086
23087 !! test
23088 T97430: Don't emit empty nowiki pairs around marker meta tags
23089 !! options
23090 parsoid=html2wt
23091 !! html/parsoid
23092 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23093 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23094 !! wikitext
23095 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23096 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23097 !! end
23098
23099 !! test
23100 Unclosed xmlish element in table line shouldn't eat end delimiters
23101 !! options
23102 parsoid=html2wt
23103 !! html/parsoid
23104 <table>
23105 <tbody><tr><td> &lt;foo</td>
23106 <td> bar></td></tr>
23107 </tbody></table>
23108 !! wikitext
23109 {|
23110 | <foo
23111 | bar>
23112 |}
23113 !! html/php
23114 <table>
23115 <tr>
23116 <td> &lt;foo
23117 </td>
23118 <td> bar&gt;
23119 </td></tr></table>
23120
23121 !! end
23122
23123 #### --------------- Links ----------------
23124 #### 1. Quote marks in link text
23125 #### 2. Wikilinks: Escapes needed
23126 #### 3. Wikilinks: No escapes needed
23127 #### 4. Extlinks: Escapes needed
23128 #### 5. Extlinks: No escapes needed
23129 #### --------------------------------------
23130 !! test
23131 Links 1. WikiLinks: No escapes needed
23132 !! options
23133 parsoid=html2wt
23134 !! html/parsoid
23135 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23136 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23137 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23138 !! wikitext
23139 [[Foo|Foo''boo'']]
23140 [[Foo|[Foobar]]]
23141 [[Foo|x [Foobar] x]]
23142 !! html/php
23143 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23144 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23145 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23146 </p>
23147 !! end
23148
23149 !! test
23150 Links 2. WikiLinks: Escapes needed
23151 !! options
23152 parsoid=html2wt
23153 !! html/parsoid
23154 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23155 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23156 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23157 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23158 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23159 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23160 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23161 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23162 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23163 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23164 !! wikitext
23165 [[Foo|<nowiki>Foobar]</nowiki>]]
23166 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23167 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23168 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23169 [[Foo|<nowiki>|Bar</nowiki>]]
23170 [[Foo|<nowiki>]]bar</nowiki>]]
23171 [[Foo|<nowiki>[[bar</nowiki>]]
23172 [[Foo|<nowiki>x [[ y</nowiki>]]
23173 [[Foo|<nowiki>x ]] y</nowiki>]]
23174 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23175 !! html/php
23176 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23177 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23178 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23179 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23180 <a href="/wiki/Foo" title="Foo">|Bar</a>
23181 <a href="/wiki/Foo" title="Foo">]]bar</a>
23182 <a href="/wiki/Foo" title="Foo">[[bar</a>
23183 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23184 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23185 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23186 </p>
23187 !! end
23188
23189 !! test
23190 Links 3. WikiLinks: No escapes needed
23191 !! options
23192 parsoid=html2wt
23193 !! html/parsoid
23194 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23195 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23196 !! wikitext
23197 [[Foo|[Foobar]]
23198 [[Foo|foo|bar]]
23199 !! html/php
23200 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23201 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23202 </p>
23203 !! end
23204
23205 !! test
23206 Links 4. ExtLinks: Escapes needed
23207 !! options
23208 parsoid=html2wt
23209 !! html/parsoid
23210 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23211 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23212 <p>[http://google.com]</p>
23213 <p>[http://google.com google]</p>
23214 !! wikitext
23215 [http://google.com <nowiki>[google]</nowiki>]
23216 [http://google.com <nowiki>google]</nowiki>]
23217
23218 <nowiki>[http://google.com]</nowiki>
23219
23220 <nowiki>[http://google.com google]</nowiki>
23221
23222 !! html/php
23223 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23224 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23225 </p><p>[http://google.com]
23226 </p><p>[http://google.com google]
23227 </p>
23228 !! end
23229
23230 !! test
23231 Links 5. ExtLinks: No escapes needed
23232 !! options
23233 parsoid=html2wt
23234 !! html/parsoid
23235 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23236 !! wikitext
23237 [http://google.com [google]
23238 !! html/php
23239 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23240 </p>
23241 !! end
23242
23243 !! test
23244 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23245 !! options
23246 parsoid=html2wt
23247 !! html/parsoid
23248 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
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>&amp;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" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23257 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23258 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23259 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23260 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23261 </p>
23262 !! wikitext
23263 x<nowiki/>http://example.com<nowiki/>y
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<nowiki/>;x
23272 http://example.com<nowiki/>!x
23273 http://example.com<nowiki/>=x
23274 http://example.com<nowiki/>(x)
23275 http://example.com(x<nowiki/>)
23276 !! end
23277
23278 !! test
23279 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23280 !! options
23281 parsoid=html2wt
23282 !! html/parsoid
23283 <p>x
23284 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23285 y
23286 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23287 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23288 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23289 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23290 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23291 </p>
23292 !! wikitext
23293 x
23294 http://example.com
23295 y
23296 "http://example.com"
23297 (http://example.com)
23298 (http://example.com) foo
23299 http://example.com,
23300 http://example.com, foo
23301 !! html/php
23302 <p>x
23303 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23304 y
23305 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23306 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23307 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23308 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23309 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23310 </p>
23311 !! end
23312
23313 !! test
23314 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23315 !! options
23316 parsoid=html2wt
23317 !! html/parsoid
23318 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23319 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23320 !! wikitext
23321 http://example.com.,;:!?\
23322 -http://example.com:
23323 !! html/php
23324 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23325 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23326 </p>
23327 !! end
23328
23329 !! test
23330 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23331 !! options
23332 parsoid=html2wt
23333 !! html/parsoid
23334 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23335 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23336 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23337 !! wikitext
23338 RFC 123<nowiki/>4
23339 RFC 123<nowiki/>y
23340 X<nowiki/>RFC 123<nowiki/>y
23341 !! end
23342
23343 !! test
23344 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23345 !! options
23346 parsoid=html2wt
23347 !! html/parsoid
23348 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23349 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23350 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23351 </p>
23352 !! wikitext
23353 RFC 123?foo
23354 RFC 123&foo
23355 -RFC 123-
23356 !! html/php
23357 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23358 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23359 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23360 </p>
23361 !! end
23362
23363 !! test
23364 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23365 !! options
23366 parsoid=html2wt
23367 !! html/parsoid
23368 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23369 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23370 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23371 !! wikitext
23372 PMID 123<nowiki/>4
23373 PMID 123<nowiki/>y
23374 X<nowiki/>PMID 123<nowiki/>y
23375 !! end
23376
23377 !! test
23378 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23379 !! options
23380 parsoid=html2wt
23381 !! html/parsoid
23382 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23383 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23384 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23385 </p>
23386 !! wikitext
23387 PMID 123?foo
23388 PMID 123&foo
23389 -PMID 123-
23390 !! html/php
23391 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23392 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23393 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23394 </p>
23395 !! end
23396
23397 !! test
23398 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23399 !! options
23400 parsoid=html2wt
23401 !! html/parsoid
23402 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23403 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23404 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23405 </p>
23406 !! wikitext
23407 ISBN 1234567890<nowiki/>1
23408 ISBN 1234567890<nowiki/>x
23409 a<nowiki/>ISBN 1234567890<nowiki/>b
23410 !! end
23411
23412 !! test
23413 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23414 !! options
23415 parsoid=html2wt
23416 !! html/parsoid
23417 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23418 !! wikitext
23419 -ISBN 1234567890's
23420 !! html/php
23421 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23422 </p>
23423 !! end
23424
23425 !! test
23426 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23427 !! options
23428 parsoid=html2wt
23429 !! html/*
23430 <p>this is not a link: http://example.com
23431 </p>
23432 !! wikitext
23433 this is not a link: <nowiki>http://example.com</nowiki>
23434 !! end
23435
23436 !! test
23437 Links 15. Link trails can't become link prefixes.
23438 !! options
23439 language=is
23440 parsoid=html2wt
23441 !! html/parsoid
23442 <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>
23443 !! wikitext
23444 [[Söfnuður]]-[[00]]
23445 !! html/php
23446 <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>
23447 </p>
23448 !! end
23449
23450 #### --------------- Quotes ---------------
23451 #### 1. Quotes inside <b> and <i>
23452 #### 2. Link fragments separated by <i> and <b> tags
23453 #### 3. Link fragments inside <i> and <b>
23454 #### 4. No escaping needed
23455 #### --------------------------------------
23456 !! test
23457 1a. Quotes inside <b> and <i>
23458 !! options
23459 parsoid=html2wt
23460 !! html/*
23461 <p><i>'foo'</i>
23462 <i>''foo''</i>
23463 <i>'''foo'''</i>
23464 <i>foo</i>'s
23465 <b>'foo'</b>
23466 <b>''foo''</b>
23467 <b>'''foo'''</b>
23468 <b>foo'<i>bar'</i>baz</b>
23469 <b>foo</b>'s
23470 '<i>foo</i>
23471 <i>foo</i>'
23472 <i>foo'</i>'
23473 '<i>foo</i>'
23474 '<b>foo</b>
23475 <b>foo</b>'
23476 '<b>foo</b>'
23477 <i>fools'<span> errand</span></i>
23478 <i><span>fool</span>'s errand</i>
23479 '<i>foo</i> bar '<i>baz</i>
23480 a|!*#-:;+-~[]{}b'<i>x</i>
23481 </p>
23482 !! wikitext
23483 ''<nowiki/>'foo'''
23484 ''<nowiki>''foo''</nowiki>''
23485 ''<nowiki>'''foo'''</nowiki>''
23486 ''foo''<nowiki/>'s
23487 '''<nowiki/>'foo''''
23488 '''<nowiki>''foo''</nowiki>'''
23489 '''<nowiki>'''foo'''</nowiki>'''
23490 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23491 '''foo'''<nowiki/>'s
23492 '''foo''
23493 ''foo''<nowiki/>'
23494 ''foo'''<nowiki/>'
23495 '''foo''<nowiki/>'
23496 ''''foo'''
23497 '''foo'''<nowiki/>'
23498 ''''foo'''<nowiki/>'
23499 ''fools'<span> errand</span>''
23500 ''<span>fool</span>'s errand''
23501 '<nowiki/>''foo'' bar '''baz''
23502 a|!*#-:;+-~[]{}b'''x''
23503 !! end
23504
23505 !! test
23506 1b. Quotes inside <b> and <i> with other tags on same line
23507 !! options
23508 parsoid=html2wt
23509 !! html/parsoid
23510 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23511 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23512 <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>
23513 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23514 '<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>
23515 '<i>foo</i> <div title="name">test</div>
23516 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23517 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23518 <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>
23519 </ol>
23520 !! wikitext
23521 '''a'' foo ''[[bar]]''
23522 ''a''' foo ''[[bar]]''
23523 ''a''' foo '''{{echo|[[bar]]}}'''
23524 [[foo]] x'''[[bar]]''
23525 '''foo'' <ref>test</ref>
23526 '''foo'' <div title="name">test</div>
23527 '''foo'' and <br> bar
23528 <references />
23529 !! end
23530
23531 !! test
23532 2. Link fragments separated by <i> and <b> tags
23533 !! options
23534 parsoid=html2wt
23535 !! html/parsoid
23536 <p>[[<i>foo</i>hello]]</p>
23537 <p>[[<b>foo</b>hello]]</p>
23538 !! wikitext
23539 [[''foo''<nowiki>hello]]</nowiki>
23540
23541 [['''foo'''<nowiki>hello]]</nowiki>
23542 !! end
23543
23544 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23545 # this is one of the shortcomings of this format
23546 !! test
23547 3. Link fragments inside <i> and <b>
23548 !! options
23549 parsoid=html2wt
23550 !! html/parsoid
23551 <p><i>[[foo</i>]]</p>
23552 <p><b>[[foo</b>]]</p>
23553 !! wikitext
23554 ''[[foo''<nowiki>]]</nowiki>
23555
23556 '''[[foo'''<nowiki>]]</nowiki>
23557 !! end
23558
23559 !! test
23560 4. No escaping needed
23561 !! options
23562 options=html2wt
23563 !! html/parsoid
23564 <p>'<span><i>bar</i></span>'
23565 '<span><b>bar</b></span>'
23566 'a:b'foo
23567 </p>
23568 !! wikitext
23569 '<span>''bar''</span>'
23570 '<span>'''bar'''</span>'
23571 'a:b'foo
23572 !! end
23573
23574 #### ----------- Paragraphs ---------------
23575 #### 1. No unnecessary escapes
23576 #### --------------------------------------
23577
23578 !! test
23579 1. No unnecessary escapes
23580 !! options
23581 parsoid=html2wt
23582 !! html/parsoid
23583 <p>bar <span>[[foo]]</span>
23584 </p><p>=bar <span>[[foo]]</span>
23585 </p><p>[[bar <span>[[foo]]</span>
23586 </p><p>]]bar <span>[[foo]]</span>
23587 </p><p>=bar <span>foo]]</span>=
23588 </p>
23589 !! wikitext
23590 bar <span><nowiki>[[foo]]</nowiki></span>
23591
23592 =bar <span><nowiki>[[foo]]</nowiki></span>
23593
23594 [[bar <span><nowiki>[[foo]]</nowiki></span>
23595
23596 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23597
23598 =bar <span>foo]]</span><nowiki>=</nowiki>
23599 !!end
23600
23601 #### ----------------------- PRE --------------------------
23602 #### 1. Leading whitespace in SOL context should be escaped
23603 #### ------------------------------------------------------
23604 !! test
23605 1. Leading whitespace in SOL context should be escaped
23606 !! options
23607 parsoid=html2wt
23608 !! html/parsoid
23609 <p> a</p>
23610
23611 <p> a</p>
23612
23613 <p> a(tab)</p>
23614
23615 <p> a
23616 <!--cmt-->
23617 a</p>
23618
23619 <p>a
23620 b</p>
23621
23622 <p>a
23623 b</p>
23624
23625 <p>a
23626 b</p>
23627 !! wikitext
23628 <nowiki> </nowiki>a
23629
23630 <nowiki> </nowiki> a
23631
23632 a(tab)
23633
23634 <nowiki> </nowiki> a
23635 <!--cmt-->
23636 <nowiki> </nowiki>a
23637
23638 a
23639 <nowiki> </nowiki>b
23640
23641 a
23642 b
23643
23644 a
23645 b
23646 !! html/php
23647 <p> a
23648 </p><p> a
23649 </p><p> a(tab)
23650 </p><p> a
23651 a
23652 </p><p>a
23653 b
23654 </p><p>a
23655 b
23656 </p><p>a
23657 b
23658 </p>
23659 !! end
23660
23661 !! test
23662 2. Leading whitespace in non-indent-pre contexts should not be escaped
23663 !! options
23664 parsoid=htm2wt
23665 !! html/parsoid
23666 <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>
23667 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23668 <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>
23669 b</span></li>
23670 </ol>
23671 !! wikitext
23672 foo <ref>''a''
23673 b</ref>
23674 <references />
23675 !! end
23676
23677 !! test
23678 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23679 !! options
23680 parsoid=html2wt
23681 !! html/parsoid
23682 <blockquote>
23683 <p>
23684 a
23685 <span>b</span>
23686 c</p>
23687 </blockquote>
23688 !! wikitext
23689 <blockquote>
23690 a
23691 <span>b</span>
23692 c
23693 </blockquote>
23694 !! end
23695
23696 !! test
23697 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23698 !! options
23699 options=html2wt
23700 !! html/parsoid
23701 <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>
23702 !! wikitext
23703 [[File:Foobar.jpg|thumb|caption]]
23704 !! end
23705
23706 !! test
23707 5. Nowiki escaping should account for indent-pres
23708 !! options
23709 parsoid=html2wt
23710 !! html/parsoid
23711 <pre>==foo==</pre>
23712 !! wikitext
23713 ==foo==
23714 !! end
23715
23716 !!test
23717 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23718 !! options
23719 parsoid=html2wt
23720 !! html/parsoid
23721 <pre>
23722 * foo
23723 * bar
23724 </pre>
23725 !! wikitext
23726 * foo
23727 * bar
23728 !! end
23729
23730 #### --------------- Behavior Switches --------------------
23731
23732 !! test
23733 1. Valid behavior switches should be escaped
23734 !! options
23735 parsoid=html2wt
23736 !! html/parsoid
23737 __TOC__
23738 <i>__TOC__</i>
23739 !! wikitext
23740 <nowiki>__TOC__</nowiki>
23741 ''<nowiki>__TOC__</nowiki>''
23742 !! end
23743
23744 !! test
23745 2. Invalid behavior switches should not be escaped
23746 !! options
23747 parsoid=html2wt
23748 !! html/parsoid
23749 __TOO__
23750 __|__
23751 !! wikitext
23752 __TOO__
23753 __|__
23754 !! end
23755
23756 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23757 !! test
23758 Behavior switches should be SOL-transparent
23759 !! options
23760 parsoid=html2wt
23761 !! html/parsoid
23762 <meta property="mw:PageProp/toc" />
23763
23764 <!-- this one's bogus -->
23765 <pre>__TOO__</pre>
23766
23767 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23768
23769 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23770 !! wikitext
23771 __TOC__
23772
23773 <!-- this one's bogus -->
23774 __TOO__
23775
23776 __TOC__ foo
23777
23778 __TOC__
23779 bar
23780 !! end
23781
23782 #### --------------- HTML tags ---------------
23783 #### 1. a tags
23784 #### 2. other tags
23785 #### 3. multi-line html tag
23786 #### 4. extension tags
23787 #### -----------------------------------------
23788 !! test
23789 1. a tags
23790 !! options
23791 parsoid=html2wt
23792 !! html/parsoid
23793 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23794 !! wikitext
23795 <a href="http://google.com">google</a>
23796 !! end
23797
23798 !! test
23799 2. other tags
23800 !! options
23801 parsoid=html2wt
23802 !! html/parsoid
23803 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23804 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23805 <li> &lt;td&gt;</li></ul>
23806
23807 !! wikitext
23808 * <nowiki><div>foo</div></nowiki>
23809 * <nowiki><div style="color:red">foo</div></nowiki>
23810 * <nowiki><td></nowiki>
23811 !! end
23812
23813 !! test
23814 3. multi-line html tag
23815 !! options
23816 parsoid=html2wt
23817 !! html/parsoid
23818 <p>&lt;div
23819 &gt;foo&lt;/div
23820 &gt;
23821 </p>
23822 !! wikitext
23823 <nowiki><div
23824 >foo</div
23825 ></nowiki>
23826 !! end
23827
23828 !! test
23829 4. extension tags
23830 !! options
23831 parsoid=html2wt
23832 !! html/parsoid
23833 <p>&lt;ref&gt;foo&lt;/ref&gt;
23834 </p><p>&lt;ref&gt;bar
23835 </p><p>baz&lt;/ref&gt;
23836 </p>
23837 !! wikitext
23838 <nowiki><ref>foo</ref></nowiki>
23839
23840 <nowiki><ref>bar</nowiki>
23841
23842 baz<nowiki></ref></nowiki>
23843 !! end
23844
23845 #### --------------- Others ---------------
23846 !! test
23847 Escaping nowikis
23848 !! options
23849 parsoid=html2wt
23850 !! html/parsoid
23851 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23852 </p>
23853 !! wikitext
23854 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23855 !! end
23856
23857 ## The quote-char in the input is necessary for triggering the bug
23858 !! test
23859 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23860 !! options
23861 parsoid=html2wt
23862 !! html/parsoid
23863 <p>foo's bar :</p>
23864 !! wikitext
23865 foo's bar :
23866 !! end
23867
23868 #----------- End of wikitext escaping tests --------------
23869
23870 !! test
23871
23872 Tag-like HTML structures are passed through as text
23873 !! wikitext
23874 <x y>
23875
23876 <x.y>
23877
23878 <x-y>
23879
23880 1>2
23881
23882 x<y
23883
23884 a>b
23885
23886 1<d e>f
23887 !! html
23888 <p>&lt;x y&gt;
23889 </p><p>&lt;x.y&gt;
23890 </p><p>&lt;x-y&gt;
23891 </p><p>1&gt;2
23892 </p><p>x&lt;y
23893 </p><p>a&gt;b
23894 </p><p>1&lt;d e&gt;f
23895 </p>
23896 !! end
23897
23898 !! test
23899 HTML tag with necessary entities in attributes
23900 !! wikitext
23901 <span title="&amp;amp;">foo</span>
23902 !! html
23903 <p><span title="&amp;amp;">foo</span>
23904 </p>
23905 !! end
23906
23907 !! test
23908 HTML tag with 'unnecessary' entity encoding in attributes
23909 !! wikitext
23910 <span title="&amp;">foo</span>
23911 !! html
23912 <p><span title="&amp;">foo</span>
23913 </p>
23914 !! end
23915
23916 !! test
23917 HTML tag with broken attribute value quoting
23918 !! wikitext
23919 <span title="Hello world>Foo</span>
23920 !! html/php
23921 <p><span title="Hello world">Foo</span>
23922 </p>
23923 !! html/parsoid
23924 <p><span title="Hello world">Foo</span>
23925 </p>
23926 !! end
23927
23928 !! test
23929 Self-closed tag with broken attribute value quoting
23930 !! options
23931 parsoid=wt2html,html2html
23932 !! wikitext
23933 <div title="Hello world />Foo
23934 !! html/php+tidy
23935 <div title="Hello world"></div>
23936 <p>Foo</p>
23937 !! html/parsoid
23938 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
23939 !! end
23940
23941 !! test
23942 Table with broken attribute value quoting
23943 !! wikitext
23944 {|
23945 | title="Hello world|Foo
23946 |}
23947 !! html/php
23948 <table>
23949 <tr>
23950 <td title="Hello world">Foo
23951 </td></tr></table>
23952
23953 !! html/parsoid
23954 <table>
23955 <tr>
23956 <td title="Hello world">Foo
23957 </td></tr></table>
23958
23959 !! end
23960
23961 !! test
23962 Table with broken attribute value quoting on consecutive lines
23963 !! wikitext
23964 {|
23965 | title="Hello world|Foo
23966 | style="color:red|Bar
23967 |}
23968 !! html/php
23969 <table>
23970 <tr>
23971 <td title="Hello world">Foo
23972 </td>
23973 <td style="color:red">Bar
23974 </td></tr></table>
23975
23976 !! html/parsoid
23977 <table><tbody>
23978 <tr>
23979 <td title="Hello world">Foo
23980 </td><td style="color: red">Bar
23981 </td></tr></tbody></table>
23982
23983 !! end
23984
23985 !! test
23986 2. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23987 !! options
23988 parsoid
23989 !! wikitext
23990 {{}}
23991 !! html
23992 {{}}
23993 !! end
23994
23995 !! test
23996 1. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23997 !! options
23998 parsoid
23999 !! wikitext
24000 }}{{
24001 !! html
24002 }}{{
24003 !! end
24004
24005 !!test
24006 Accept empty td cell attribute
24007 !! wikitext
24008 {|
24009 | align="center" | foo || |
24010 |}
24011 !! html
24012 <table>
24013 <tr>
24014 <td align="center"> foo </td>
24015 <td>
24016 </td></tr></table>
24017
24018 !!end
24019
24020 !!test
24021 Non-empty attributes in th-cells
24022 !! wikitext
24023 {|
24024 ! Foo !! style="color: red" | Bar
24025 |}
24026 !! html
24027 <table>
24028 <tr>
24029 <th> Foo </th>
24030 <th style="color: red"> Bar
24031 </th></tr></table>
24032
24033 !!end
24034
24035 !!test
24036 Accept empty attributes in th-cells
24037 !! wikitext
24038 {|
24039 !| foo !!| bar
24040 |}
24041 !! html
24042 <table>
24043 <tr>
24044 <th> foo </th>
24045 <th> bar
24046 </th></tr></table>
24047
24048 !!end
24049
24050 !!test
24051 Empty table rows go away
24052 !! wikitext
24053 {|
24054 | Hello
24055 | there
24056 |- class="foo"
24057 |-
24058 |}
24059 !! html
24060 <table>
24061 <tr>
24062 <td> Hello
24063 </td>
24064 <td> there
24065 </td></tr>
24066
24067 </table>
24068
24069 !! end
24070
24071 ###
24072 ### Parsoid-centric tests for testing RTing of inter-element separators
24073 ### Edge cases not tested by existing parser tests and specific to
24074 ### Parsoid-specific serialization strategies.
24075 ###
24076
24077 !!test
24078 RT-ed inter-element separators should be valid separators
24079 !! wikitext
24080 {|
24081 |- [[foo]]
24082 |}
24083 !! html/php
24084 <table>
24085
24086 </table>
24087
24088 !! html/parsoid
24089 <table>
24090 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24091 </tbody></table>
24092 !!end
24093
24094 # Parsoid-only since PHP parser relies on Tidy for correct output
24095 !!test
24096 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24097 !!options
24098 parsoid
24099 !! wikitext
24100 {|
24101 |<small>foo
24102 bar
24103 |}
24104
24105 {|
24106 |<small>foo<small>
24107 |}
24108 !! html
24109 <table>
24110 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24111 <p>bar</p></small></td></tr>
24112 </tbody></table>
24113
24114 <table>
24115 <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>
24116 </tbody></table>
24117 !!end
24118
24119 # Note that the "style" attribute is really a template parameter here.
24120 # The = would have to be {{=}} if you wanted the literal.
24121 !!test
24122 Empty TD followed by TD with tpl-generated attribute
24123 !! wikitext
24124 {|
24125 |-
24126 |
24127 |{{echo|style='color:red'}}|foo
24128 |}
24129 !! html
24130 <table>
24131
24132 <tr>
24133 <td>
24134 </td>
24135 <td>foo
24136 </td></tr></table>
24137
24138 !!end
24139
24140 !!test
24141 Indented table with an empty td
24142 !! wikitext
24143 {|
24144 |-
24145 |
24146 |foo
24147 |}
24148 !! html
24149 <table>
24150
24151 <tr>
24152 <td>
24153 </td>
24154 <td>foo
24155 </td></tr></table>
24156
24157 !!end
24158
24159 ## We have some newline diffs RT-ing this edge case
24160 ## and it is not important enough -- we seem to be emitting
24161 ## at most 2 newlines after a </tr> and this is unrelated to
24162 ## the issue from T85627 that this is testing.
24163 !!test
24164 Indented table with blank lines in between (T85627)
24165 !! options
24166 parsoid=wt2html
24167 !! wikitext
24168 {|
24169 |foo
24170
24171
24172 |}
24173 !! html
24174 <table>
24175
24176 <tr>
24177 <td>foo
24178 </td></tr></table>
24179
24180 !!end
24181
24182 !!test
24183 Indented block & table
24184 !! wikitext
24185 <div>foo</div>
24186 {|
24187 |foo
24188 |}
24189 !! html/php
24190 <div>foo</div>
24191 <table>
24192 <tr>
24193 <td>foo
24194 </td></tr></table>
24195
24196 !! html/parsoid
24197 <div data-parsoid='{"stx":"html"}'>foo</div>
24198 <table><tbody>
24199 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24200 </tbody></table>
24201 !!end
24202
24203 !! test
24204 Indent and comment before table row
24205 !! wikitext
24206 {|
24207 <!--hi-->|-
24208 | there
24209 |}
24210 !! html/php
24211 <table>
24212
24213 <tr>
24214 <td> there
24215 </td></tr></table>
24216
24217 !! html/parsoid
24218 <table>
24219 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24220 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24221 </tbody></table>
24222 !! end
24223
24224 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24225 !!test
24226 Empty TR followed by a template-generated TR
24227 !!options
24228 parsoid
24229 !! wikitext
24230 {|
24231 |-
24232 {{echo|<tr><td>foo</td></tr>}}
24233 |}
24234 !! html
24235 <table>
24236 <tbody>
24237 <tr></tr>
24238 <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}}]}'>
24239 <td>foo</td></tr>
24240 </tbody></table>
24241 !!end
24242
24243 ## PHP and parsoid output differ for this, and since this is primarily
24244 ## for testing Parsoid's serializer, marking this Parsoid only
24245 !!test
24246 Empty TR followed by mixed-ws-comment line should RT correctly
24247 !!options
24248 parsoid
24249 !! wikitext
24250 {|
24251 |-
24252 <!--c-->
24253 |-
24254 <!--c--> <!--d-->
24255 |}
24256 !! html
24257 <table>
24258 <tbody>
24259 <tr></tr>
24260 <!--c-->
24261 <tr>
24262 <!--c--> </tr><!--d-->
24263 </tbody></table>
24264
24265 !!end
24266
24267 !!test
24268 Multi-line image caption generated by templates with/without trailing newlines
24269 !! wikitext
24270 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24271 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24272 !! html/parsoid
24273 <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>
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="#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>
24275 !!end
24276
24277 !! test
24278 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24279 !! options
24280 parsoid=html2wt
24281 !! html/parsoid
24282 <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>
24283
24284 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24285 !! wikitext
24286 <includeonly>foo</includeonly>
24287 new para
24288
24289 [[Category:Foo]]
24290
24291 = new heading =
24292 !! end
24293
24294 ## PHP emits broken html for this, and since this is primarily
24295 ## a Parsoid serializer test, marking this Parsoid only
24296 !!test
24297 Improperly nested inline or quotes tags with whitespace in between
24298 !! wikitext
24299 <span> <s>x</span> </s>
24300 ''' ''x''' ''
24301 !! html/parsoid
24302 <p><span> <s>x</s></span><s> </s>
24303 <b> <i>x</i></b><i> </i>
24304 </p>
24305 !!end
24306
24307 !!test
24308 Encapsulate protected attributes from wt
24309 !! wikitext
24310 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24311 !! html/parsoid
24312 <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>
24313 </body>
24314 !!end
24315
24316 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24317 ## Having nested or stray pre tags results in the attempt to add duplicates,
24318 ## causing an assertion fail. This test tries to prevent that situation.
24319 !!test
24320 Ensure ParagraphWrapper can deal with stray closing pre tags
24321 !!options
24322 parsoid=wt2html
24323 !! wikitext
24324 plain text</pre>
24325 !! html/parsoid
24326 plain text
24327 !!end
24328
24329 !!test
24330 1. Ensure fostered text content is wrapped in element nodes
24331 !!options
24332 parsoid=wt2html
24333 !! wikitext
24334 <table>hi</table><table>ho</table>
24335 !! html/parsoid
24336 <p>hi</p>
24337 <table></table>
24338 <p>ho</p>
24339 <table></table>
24340 !!end
24341
24342 !!test
24343 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24344 !!options
24345 parsoid=wt2html,wt2wt
24346 !! wikitext
24347 <table>
24348 <tr> || ||
24349 <td> a
24350 </table>
24351 !! html/parsoid
24352 <p> || ||
24353 </p><table>
24354 <tbody><tr><td> a</td></tr>
24355 </tbody></table>
24356 !!end
24357
24358 !!test
24359 Encapsulation properly handles null DSR information from foster box
24360 !!options
24361 parsoid=wt2html,wt2wt
24362 !! wikitext
24363 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24364 !! html/parsoid
24365 <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>
24366 !!end
24367
24368 !!test
24369 1. Encapsulate foster-parented transclusion content
24370 !!options
24371 parsoid=wt2wt,wt2html
24372 !! wikitext
24373 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24374 !! html/parsoid
24375 <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>
24376 <tbody>
24377 <tr>
24378 <td>bar</td>
24379 </tr>
24380 </tbody>
24381 </table>
24382 !!end
24383
24384 !!test
24385 2. Encapsulate foster-parented transclusion content
24386 !!options
24387 parsoid=wt2wt,wt2html
24388 !! wikitext
24389 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24390 !! html/parsoid
24391 <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>
24392 <table>
24393 <tbody>
24394 <tr>
24395 <td>bar</td>
24396 </tr>
24397 </tbody>
24398 </table>
24399 !!end
24400
24401 !!test
24402 3. Encapsulate foster-parented transclusion content
24403 !!options
24404 parsoid=wt2wt,wt2html
24405 !! wikitext
24406 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24407 !! html/parsoid
24408 <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;]}">
24409 <p>foo</p>
24410 </div>
24411 <table>
24412 <tbody>
24413 <tr>
24414 <td>bar</td>
24415 </tr>
24416 </tbody>
24417 </table>
24418 !!end
24419
24420 !!test
24421 4. Encapsulate foster-parented transclusion content
24422 !!options
24423 parsoid=wt2wt,wt2html
24424 !! wikitext
24425 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24426 !! html/parsoid
24427 <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;]}">
24428 <p>foo</p>
24429 </div>
24430 <table>
24431 <tbody>
24432 <tr>
24433 <td>bar</td>
24434 </tr>
24435 </tbody>
24436 </table>
24437 !!end
24438
24439 !!test
24440 5. Encapsulate foster-parented transclusion content
24441 !!options
24442 parsoid=wt2wt,wt2html
24443 !! wikitext
24444 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24445 !! html/parsoid
24446 <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>
24447 <table>
24448 <tbody>
24449 <tr>
24450 <td>
24451 <div>
24452 <p>foo</p>
24453 </div>
24454 </td>
24455 </tr>
24456 </tbody>
24457 </table>
24458 !!end
24459
24460 !!test
24461 6. Encapsulate foster-parented transclusion content
24462 !!options
24463 parsoid=wt2wt,wt2html
24464 !! wikitext
24465 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24466 !! html/parsoid
24467 <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>
24468 <table>
24469 <tbody>
24470 <tr>
24471 <td>
24472 <div>
24473 <p>foo</p>
24474 </div>
24475 </td>
24476 </tr>
24477 </tbody>
24478 </table>
24479 <p>ok</p>
24480 !!end
24481
24482 !!test
24483 7. Encapsulate foster-parented transclusion content
24484 !!options
24485 parsoid=wt2wt,wt2html
24486 !! wikitext
24487 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24488 !! html/parsoid
24489 <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>
24490 <table>
24491 <tbody>
24492 <tr>
24493 <td>bar</td>
24494 </tr>
24495 </tbody>
24496 </table>
24497 !!end
24498
24499 # Note that the wt is broken on purpose: the = should be {{=}} if you
24500 # don't want it to be a template parameter key.
24501 !!test
24502 8. Encapsulate foster-parented transclusion content
24503 !!options
24504 parsoid=wt2wt,wt2html
24505 !! wikitext
24506 {{echo|a
24507 }}{|{{echo|style='color:red'}}
24508 |-
24509 |b
24510 |}
24511 !! html/parsoid
24512 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24513 <span> </span>
24514 <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>
24515 <table>
24516 <tbody>
24517 <tr>
24518 <td>b</td>
24519 </tr>
24520 </tbody>
24521 </table>
24522 !!end
24523
24524 !!test
24525 9. Encapsulate foster-parented transclusion content
24526 !!options
24527 parsoid=wt2wt,wt2html
24528 !! wikitext
24529 <table>{{echo|hi</table>hello}}
24530 !! html/parsoid
24531 <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>
24532 !!end
24533
24534 !!test
24535 Table in fosterable position
24536 !!options
24537 parsoid=wt2html,wt2wt
24538 !! wikitext
24539 {{OpenTable}}
24540 <div>
24541 {|
24542 |}
24543 </div>
24544 |}
24545 !! html/parsoid
24546 <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">
24547 </span>
24548 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24549
24550 <table>
24551 </table>
24552 !!end
24553
24554 # Parsoid only for bug 64747
24555 !! test
24556 Properly encapsulate empty-content transclusions in fosterable positions
24557 !! wikitext
24558 <table>
24559 {{#if:|
24560 <td>foo</td>
24561 }}
24562 </table>
24563 !! html/parsoid
24564 <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":["","","",""]}]]}'>
24565
24566 </table>
24567 !! end
24568
24569 !! test
24570 Always encapsulate foster box when template range is expanded to table
24571 !! options
24572 parsoid=wt2wt
24573 !! wikitext
24574 {|
24575 hello
24576 {{OpenTable}}
24577 |}
24578 !! html/parsoid
24579
24580 !! end
24581
24582 !!test
24583 Support <object> element with .data attribute
24584 !!options
24585 parsoid=html2wt
24586 !! html/parsoid
24587 <object data="test.swf"></object>
24588 !! wikitext
24589 <object data="test.swf"></object>
24590 !!end
24591
24592 !! test
24593 Don't block XML namespace declaration
24594 !! wikitext
24595 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24596 !! html/php
24597 <p><span>MediaWiki</span>
24598 </p>
24599 !! html/parsoid
24600 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24601 !! end
24602
24603 # -----------------------------------------------------------------
24604 # The following section of tests are primarily to spec requirements
24605 # around serialization of new/edited content.
24606 #
24607 # All these tests are marked Parsoid html2wt and html2html only
24608 # ----------------------------------------------------------------
24609
24610 # 'mi' is a localinterwiki prefix as well as a language
24611 !! test
24612 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24613 !! options
24614 parsoid=html2wt
24615 !! html/parsoid
24616 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24617 !! wikitext
24618 [[Foo]]
24619 !! end
24620
24621 # See T93839
24622 !! test
24623 New wikilinks should be serialized properly
24624 !! options
24625 parsoid=html2wt
24626 !! html/parsoid
24627 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24628 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24629 !! wikitext
24630 [[Foo]]
24631 [[Foo]]
24632 !! end
24633
24634 !! test
24635 New wiki links (href variations)
24636 !! options
24637 parsoid=html2wt
24638 !! html/parsoid
24639 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
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="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24643 !! wikitext
24644 [[Foo_bar]]
24645 [[Foo_bar]]
24646 [[Foo_bar]]
24647 [[Toxine bactérienne]]
24648 !! end
24649
24650 !! test
24651 New wiki links (content string variations)
24652 !! options
24653 parsoid=html2wt
24654 !! html/parsoid
24655 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24656 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24657 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24658 !! wikitext
24659 [[Foo_bar]]
24660 [[Foo bar]]
24661 [[Foo_bar|./Foo_bar]]
24662 !! end
24663
24664 !! test
24665 New category links (href variations)
24666 !! options
24667 parsoid=html2wt
24668 !! html/parsoid
24669 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24670 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24671 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24672 !! wikitext
24673 [[Category:Toxine bactérienne]]
24674 [[Category:Toxine bactérienne]]
24675 [[Category:Toxine bactérienne]]
24676 !! end
24677
24678 !! test
24679 New sol transparent links don't need indent-pre nowiki protection
24680 !! options
24681 parsoid=html2wt
24682 language=de
24683 !! html/parsoid
24684 <link rel="mw:PageProp/redirect" href="./Main_Page">
24685 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24686 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24687 !! wikitext
24688 #WEITERLEITUNG [[Main Page]]
24689 <!-- this is good --> [[Category:Good]]
24690 <!-- this is great --> [[Kategorie:Great]]
24691 !! end
24692
24693 !! test
24694 New interlanguage links (href variations)
24695 !! options
24696 parsoid=html2wt
24697 !! html/parsoid
24698 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
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%C3%A9rienne" />
24701 !! wikitext
24702 [[es:Toxine bactérienne]]
24703 [[es:Toxine_bactérienne]]
24704 [[es:Toxine_bactérienne]]
24705 !! end
24706
24707 !! test
24708 Image: Modifying size of an image (1)
24709 !! options
24710 parsoid={
24711 "modes": ["wt2wt"],
24712 "changes": [
24713 ["img[height]", "attr", "height", "22"],
24714 ["img[width]", "attr", "width", "200"]
24715 ]
24716 }
24717 !! wikitext
24718 [[Image:Foobar.jpg|230x230px]]
24719 !! wikitext/edited
24720 [[Image:Foobar.jpg|200x200px]]
24721 !!end
24722
24723 !! test
24724 Image: Modifying size of an image (2)
24725 !! options
24726 parsoid={
24727 "modes": ["wt2wt"],
24728 "changes": [
24729 ["img[height]", "attr", "height", "100"],
24730 ["img[width]", "attr", "width", "500"]
24731 ]
24732 }
24733 !! wikitext
24734 [[Image:Foobar.jpg|230x230px]]
24735 !! wikitext/edited
24736 [[Image:Foobar.jpg|500x500px]]
24737 !!end
24738
24739 # Change in size is ignored so long as class='mw-default-size'
24740 !! test
24741 Image: Modifying size of an image (3)
24742 !! options
24743 parsoid={
24744 "modes": ["wt2wt"],
24745 "changes": [
24746 ["figure[class]", "removeClass", "mw-default-size"],
24747 ["figure img", "attr", "height", "19"],
24748 ["figure img", "attr", "width", "170"]
24749 ]
24750 }
24751 !! wikitext
24752 [[Image:Foobar.jpg|thumb]]
24753 !! wikitext/edited
24754 [[Image:Foobar.jpg|thumb|170x170px]]
24755 !!end
24756
24757 !! test
24758 Image: Modifying alignment of an image (bug 48665)
24759 !! options
24760 parsoid={
24761 "modes": ["wt2wt"],
24762 "changes": [
24763 ["figure[class]", "removeClass", "mw-halign-right"],
24764 ["figure[class]", "addClass", "mw-halign-left"]
24765 ]
24766 }
24767 !! wikitext
24768 [[Image:Foobar.jpg|thumb|caption|right]]
24769 !! wikitext/edited
24770 [[Image:Foobar.jpg|thumb|caption|left]]
24771 !! end
24772
24773 !! test
24774 Image: Modifying mw-default-size of an frameless image (bug 62805)
24775 !! options
24776 parsoid={
24777 "modes": ["wt2wt"],
24778 "changes": [
24779 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24780 ]
24781 }
24782 !! wikitext
24783 [[Image:Foobar.jpg|frameless|right]]
24784 !! wikitext/edited
24785 [[Image:Foobar.jpg|frameless|right|220x220px]]
24786 !! end
24787
24788 !! test
24789 Image: Modifying valign of an image (bug 49221)
24790 !! options
24791 parsoid={
24792 "modes": ["wt2wt"],
24793 "changes": [
24794 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24795 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24796 ]
24797 }
24798 !! wikitext
24799 [[File:Foobar.jpg|20px|middle]]
24800 !! wikitext/edited
24801 [[File:Foobar.jpg|20px|text-top]]
24802 !! end
24803
24804 !! test
24805 Image: Modifying alt attribute of an image (bug 56400)
24806 !! options
24807 parsoid={
24808 "modes": ["wt2wt"],
24809 "changes": [
24810 ["img[alt]", "attr", "alt", "some alternate edited text"]
24811 ]
24812 }
24813 !! wikitext
24814 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24815 !! wikitext/edited
24816 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24817 !!end
24818
24819 !! test
24820 Image: Modifying caption of an image
24821 !! options
24822 parsoid={
24823 "modes": ["wt2wt"],
24824 "changes": [
24825 ["figcaption", "text", "new caption"]
24826 ]
24827 }
24828 !! wikitext
24829 [[Image:Foobar.jpg|thumb|original caption]]
24830 !! wikitext/edited
24831 [[Image:Foobar.jpg|thumb|new caption]]
24832 !!end
24833
24834 !! test
24835 Image: empty alt attribute (bug 48924)
24836 !! options
24837 parsoid
24838 !! wikitext
24839 [[File:Foobar.jpg|thumb|alt=|bar]]
24840 !! html
24841 <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>
24842 !! end
24843
24844 !! test
24845 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24846 !! options
24847 parsoid=html2wt
24848 language=ar
24849 disabled
24850 !! html/parsoid
24851 <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>
24852 !! wikitext
24853 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24854 !! end
24855
24856 !! test
24857 Image: Block level image should have \n before and after
24858 !! wikitext
24859 123
24860 [[File:Foobar.jpg|right|thumb|150x150px]]
24861 456
24862 !! html/parsoid
24863 <p>123</p>
24864 <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>
24865 <p>456</p>
24866 !!end
24867
24868 !! test
24869 Image: New block level image should have \n before and after (existing content)
24870 !! wikitext
24871 123
24872 [[File:Foobar.jpg|right|thumb|150x150px]]
24873 456
24874 !! html/parsoid
24875 <p>123</p>
24876 <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>
24877 <p>456</p>
24878 !!end
24879
24880 !! test
24881 Image: upright option (parsoid)
24882 !! wikitext
24883 [[File:Foobar.jpg|thumb|upright|caption]]
24884 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24885 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24886 !! html/parsoid
24887 <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>
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/110px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="12" width="110"/></a><figcaption>caption</figcaption></figure>
24889 <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>
24890 !!end
24891
24892 !! test
24893 Image: upright option is ignored on inline and frame images (parsoid)
24894 !! wikitext
24895 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24896 !! html/parsoid
24897 <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>
24898 !!end
24899
24900 !! test
24901 Image: from basic HTML (1)
24902 !! options
24903 parsoid=html2wt
24904 !! html/parsoid
24905 <span typeof="mw:Image">
24906 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24907 </span>
24908 !! wikitext
24909 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24910 !! end
24911
24912 !! test
24913 Image: from basic HTML (2)
24914 !! options
24915 parsoid=html2wt
24916 !! html/parsoid
24917 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24918 !! wikitext
24919 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24920 !! end
24921
24922 !! test
24923 Image: from basic HTML (3)
24924 !! options
24925 parsoid=html2wt
24926 !! html/parsoid
24927 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24928 !! wikitext
24929 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24930 !! end
24931
24932 !! test
24933 Image: from basic HTML (4)
24934 !! options
24935 parsoid=html2wt
24936 !! html/parsoid
24937 <img src="./File:Foobar.jpg">
24938 !! wikitext
24939 [[File:Foobar.jpg|link=]]
24940 !! end
24941
24942 !! test
24943 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24944 !! options
24945 parsoid=html2wt
24946 !! html/parsoid
24947 <ul>
24948 <li><p>foo</p></li>
24949 </ul>
24950 !! wikitext
24951 * foo
24952 !! end
24953
24954 !! test
24955 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24956 !! options
24957 parsoid=html2wt
24958 !! html/parsoid
24959 <ul> <li>foo</li></ul>
24960 !! wikitext
24961 * foo
24962 !! end
24963
24964 !! test
24965 Don't strip leading whitespace when handling indent-pre suppressing tags
24966 !! options
24967 parsoid=html2wt
24968 !! html/parsoid
24969 <table>
24970 <tr><td> indented row</td></tr>
24971 </table>
24972 <blockquote><p>
24973 <b>This is very bold of you!</b>
24974 </p>
24975 <table><tr><td>
24976 indented cell (no pre-wrapping!)
24977 </td></tr></table>
24978 </blockquote>
24979 <p>foo</p>
24980 <div>bar</div>
24981 !! wikitext
24982 {|
24983 | indented row
24984 |}
24985 <blockquote>
24986 '''This is very bold of you!'''
24987
24988 {|
24989 |
24990 indented cell (no pre-wrapping!)
24991 |}
24992 </blockquote>
24993 foo
24994 <div>bar</div>
24995 !! end
24996
24997 !! test
24998 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24999 !! options
25000 parsoid=html2wt
25001 !! html/parsoid
25002 <p>foo</p>
25003 <span>bar</span>
25004
25005 <span>foo2
25006 </span>bar2
25007
25008 <div>foo</div>
25009 <span>bar</span>
25010
25011 <div>
25012 <span>foo</span>
25013 </div>
25014 !! wikitext
25015 foo
25016
25017 <span>bar</span>
25018
25019 <span>foo2
25020 <nowiki> </nowiki></span>bar2
25021
25022 <div>foo</div>
25023 <nowiki> </nowiki><span>bar</span>
25024
25025 <div>
25026 <nowiki> </nowiki><span>foo</span>
25027 </div>
25028 !! end
25029
25030 !! test
25031 Lists: Dont insert newlines in a serialized list item.
25032 !! options
25033 parsoid=html2wt
25034 !! html/parsoid
25035 <ul><li>a<br>b</li><li>c</li></ul>
25036 !! wikitext
25037 * a<br>b
25038 * c
25039 !! end
25040
25041 !! test
25042 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25043 !! options
25044 parsoid={
25045 "modes": ["html2wt"],
25046 "scrubWikitext": false
25047 }
25048 !! html/parsoid
25049 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25050 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25051
25052 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25053 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25054
25055 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25056
25057 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25058 !! wikitext
25059 == hello there [[Category:A1]] ==
25060
25061 == [[Category:A2]] hi pal ==
25062
25063 == <!--foo--> [[Category:A3]] how goes it ==
25064
25065 == it goes well [[Category:A4]] <!--bar--> ==
25066
25067 ==howdy [[Category:A5]]==
25068
25069 == __TOC__ ok ==
25070 !! end
25071
25072 !! test
25073 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25074 !! options
25075 parsoid={
25076 "modes": ["html2wt"],
25077 "scrubWikitext": true
25078 }
25079 !! html/parsoid
25080 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25081 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25082
25083 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25084 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25085
25086 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25087 !! wikitext
25088 == hello there ==
25089 [[Category:A1]]
25090 [[Category:A2]]
25091
25092 == hi pal ==
25093
25094 <!--foo--> [[Category:A3]]
25095
25096 == how goes it ==
25097
25098 == it goes well ==
25099 [[Category:A4]] <!--bar-->
25100
25101 __TOC__
25102
25103 == ok ==
25104 !! end
25105
25106 !! test
25107 Headings: Don't hoist metas that come from templates
25108 !! options
25109 parsoid={
25110 "modes": ["html2wt"],
25111 "scrubWikitext": true
25112 }
25113 !! html/parsoid
25114 <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>
25115 !! wikitext
25116 == {{echo|foo [[Category:Foo]]}} ==
25117 !! end
25118
25119 !! test
25120 Headings: Category in ref isn't hoisted
25121 !! options
25122 parsoid={
25123 "modes": ["html2wt"],
25124 "scrubWikitext": true
25125 }
25126 !! html/parsoid
25127 <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>
25128
25129 <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>
25130 !! wikitext
25131 == foo <ref>bar
25132 [[Category:Baz]] </ref> ==
25133
25134 <references />
25135 !! end
25136
25137 !! test
25138 Parsoid: Serialize positional parameters with = in them as named parameter
25139 !! options
25140 parsoid=html2wt
25141 !! html/parsoid
25142 <p about="#mwt1" typeof="mw:Transclusion"
25143 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25144
25145 <p about="#mwt1" typeof="mw:Transclusion"
25146 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25147
25148 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25149 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25150 <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>
25151 !! wikitext
25152 {{echo|1 = f=oo}}
25153
25154 {{echo|1 = f=oo|2 = bar}}
25155
25156 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25157 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25158 {{echo|<nowiki>f=oo</nowiki>|bar}}
25159 !! end
25160
25161 !! test
25162 Parsoid: Serialize positional parameters with = in extlink as named parameter
25163 !! options
25164 parsoid=html2wt
25165 !! html/parsoid
25166 <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>
25167 !! wikitext
25168 {{echo|1 = http://stuff?is=ok}}
25169 !! end
25170
25171 !! test
25172 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25173 !! options
25174 parsoid=html2wt
25175 !! html/parsoid
25176 <div>a<p>b</p></div>
25177 <div>a
25178 <p>b</p></div>
25179 <div>
25180 a
25181 <p>b</p></div>
25182 !! wikitext
25183 <div>a
25184 b
25185 </div>
25186 <div>a
25187 b
25188 </div>
25189 <div>
25190 a
25191
25192 b
25193 </div>
25194 !! end
25195
25196 !! test
25197 Substrings resembling wikitext in hrefs should not get nowiki escapes
25198 !! options
25199 parsoid=html2wt
25200 !! html/parsoid
25201 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25202 !! wikitext
25203 [[Foo''bar''baz]]
25204 !! end
25205
25206 !! test
25207 Enforce single-line context in the serializer
25208 !! options
25209 parsoid=html2wt
25210 !! html/parsoid
25211 <h2>testing
25212 123</h2>
25213
25214 <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">
25215 </span><span about="#mwt1">you</span> </h2>
25216
25217 <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>
25218
25219 <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
25220 there</span></li></ol>
25221
25222 <ul><li>asd
25223 sdf</li></ul>
25224
25225 <ul><li>foo
25226 bar
25227 baz</li>
25228 <li>foo <b>bar</b>
25229 baz</li></ul>
25230
25231 <dl><dt>hi
25232 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25233 ho</dd></dl>
25234
25235 <dl><dd> <table>
25236 <tbody><tr><td> ha
25237 ha
25238 ha</td></tr>
25239 </tbody></table></dd></dl>
25240 !! wikitext
25241 == testing 123 ==
25242
25243 == hi {{bogus|there
25244 you}} ==
25245
25246 == foo <ref>hello
25247 there</ref> ==
25248
25249 <references />
25250
25251 * asd sdf
25252
25253 * foo bar baz
25254 * foo '''bar''' baz
25255
25256 ; hi ho : hi ho
25257
25258 : {|
25259 | ha
25260 ha
25261 ha
25262 |}
25263 !! end
25264
25265 !! test
25266 Serialize new placeholder space without spans
25267 !! options
25268 parsoid=html2wt
25269 !! html/parsoid
25270 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25271
25272 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25273
25274 <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>
25275 !! wikitext
25276 foo : bar
25277
25278 foo : bar
25279
25280 <ref>foo : bar</ref>ok
25281 !! end
25282
25283
25284 #-----------------------
25285 # Tag minimization tests
25286 #-----------------------
25287
25288 !! test
25289 1. I/B quote minimization: wikitext-only tags should be combined
25290 !! options
25291 parsoid=html2wt
25292 !! html/parsoid
25293 <p><i>A</i><i>B</i></p>
25294 <p><b>A</b><b>B</b></p>
25295 <p><i>A</i><b><i>B</i></b></p>
25296 <p><b>A</b><i><b>B</b></i></p>
25297 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25298 <p><i><b>A</b></i><i><b>B</b></i></p>
25299 <p><i><b>A</b></i><b><i>B</i></b></p>
25300 <p><b><i>A</i></b><i><b>B</b></i></p>
25301 !! wikitext
25302 ''AB''
25303
25304 '''AB'''
25305
25306 ''A'''B'''''
25307
25308 '''A''B'''''
25309
25310 '''A''BC''D'''
25311
25312 '''''AB'''''
25313
25314 '''''AB'''''
25315
25316 '''''AB'''''
25317 !! end
25318
25319 !! test
25320 2. I/B quote minimization: wikitext and html tags should not be combined
25321 !! options
25322 parsoid=html2wt
25323 !! html/parsoid
25324 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25325 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25326 !! wikitext
25327 ''A''<i>B</i>
25328
25329 ''A''<nowiki/>'''<i>B</i>'''
25330 !! end
25331
25332 !! test
25333 3. I/B quote minimization: templated content stops minimization
25334 !! options
25335 parsoid=html2wt
25336 !! html/parsoid
25337 <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>
25338 <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>
25339 !! wikitext
25340 ''A''{{echo|''B''}}
25341
25342 ''A''{{echo|'''''B'''''}}
25343 !! end
25344
25345 !! test
25346 4. I/B quote minimization: new content should be mimimized with adjacent old content
25347 !! options
25348 parsoid=html2wt
25349 !! html/parsoid
25350 <p><i>A</i><i>B</i></p>
25351 <p><b>A</b><b>B</b></p>
25352 <p><i>A</i><b><i>B</i></b></p>
25353 !! wikitext
25354 ''AB''
25355
25356 '''AB'''
25357
25358 ''A'''B'''''
25359 !! end
25360
25361 !! test
25362 5a. Merge adjacent quote nodes if they've been edited
25363 !! options
25364 parsoid={
25365 "modes": ["wt2wt", "selser"],
25366 "changes": [
25367 ["p", "contents", "remove", ":contains('b')"]
25368 ]
25369 }
25370 !! wikitext
25371 ''a''b''c''
25372 !! wikitext/edited
25373 ''ac''
25374 !! end
25375
25376 !! test
25377 5b. Merge adjacent quote nodes if they've been edited
25378 !! options
25379 parsoid={
25380 "modes": ["wt2wt", "selser"],
25381 "changes": [
25382 ["#x", "remove"]
25383 ]
25384 }
25385 !! wikitext
25386 ''a''<span id="x">b</span>''c''
25387 !! wikitext/edited
25388 ''ac''
25389 !! end
25390
25391 !! test
25392 1. Merge adjacent link nodes as long as at least one element is new
25393 !! options
25394 parsoid={
25395 "modes": ["html2wt"],
25396 "scrubWikitext": true
25397 }
25398 !! html/parsoid
25399 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25400 <a data-parsoid="{}" 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 data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25402 !! wikitext
25403 [[Football]]
25404 [[Football]]
25405 [[Football|Foot]][[Football|ball]]
25406 !! end
25407
25408 !! test
25409 2. Merge adjacent link nodes and enable additional normalizations
25410 !! options
25411 parsoid={
25412 "modes": ["html2wt"],
25413 "scrubWikitext": true
25414 }
25415 !! html/parsoid
25416 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25417 !! wikitext
25418 [[Football|''Football'']]
25419 !! end
25420
25421 !! test
25422 3. Don't merge adjacent link nodes if scrubWikitext is false
25423 !! options
25424 parsoid={
25425 "modes": ["html2wt"],
25426 "scrubWikitext": false
25427 }
25428 !! html/parsoid
25429 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25430 !! wikitext
25431 [[Football|Foot]][[Football|ball]]
25432 !! end
25433
25434 #------------------------------
25435 # End of tag minimization tests
25436 #------------------------------
25437
25438 !!test
25439 Bug 54262: New entities
25440 !! options
25441 parsoid=html2wt
25442 !! html/parsoid
25443 <span typeof="mw:Entity">&nbsp;</span>
25444 !! wikitext
25445 &nbsp;
25446 !! end
25447
25448 ## Note that there is no wikitext output for 'unknownproperty' ##
25449 ## Unknown magic words are silently dropped ##
25450
25451 !! test
25452 Magic words
25453 !! options
25454 parsoid=html2wt
25455 !! html/parsoid
25456 <meta property='mw:PageProp/toc' />
25457 <meta property='mw:PageProp/notoc' />
25458 <meta property='mw:PageProp/forcetoc' />
25459 <meta property='mw:PageProp/index' />
25460 <meta property='mw:PageProp/noindex' />
25461 <meta property='mw:PageProp/nogallery' />
25462 <meta property='mw:PageProp/noeditsection' />
25463 <meta property='mw:PageProp/notitleconvert' />
25464 <meta property='mw:PageProp/nocontentconvert' />
25465 <meta property='mw:PageProp/unknownproperty' />
25466 !! wikitext
25467 __TOC__
25468 __NOTOC__
25469 __FORCETOC__
25470 __INDEX__
25471 __NOINDEX__
25472 __NOGALLERY__
25473 __NOEDITSECTION__
25474 __NOTITLECONVERT__
25475 __NOCONTENTCONVERT__
25476 !! end
25477
25478 !! test
25479 Consecutive <pre>s should not get merged
25480 !! options
25481 parsoid=html2wt,html2html
25482 !! html/parsoid
25483 <pre>a</pre><pre>b</pre>
25484
25485 <pre>c
25486 </pre><pre>
25487 d</pre>
25488
25489 <pre>e
25490
25491 </pre><pre>
25492
25493 f</pre>
25494 !! wikitext
25495 a
25496
25497 b
25498
25499 c
25500
25501 d
25502
25503 e
25504
25505
25506
25507 f
25508 !! end
25509
25510 !! test
25511 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25512 !! options
25513 parsoid=html2wt
25514 !! html/parsoid
25515 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25516 !! wikitext
25517 [[Special:BookSources/1234567890|ISBN 1234567895]]
25518 !! end
25519
25520 !! test
25521 Edited RFC links not serializable as RFC links should serialize as extlinks
25522 !! options
25523 parsoid=html2wt
25524 !! html/parsoid
25525 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25526 !! wikitext
25527 [//tools.ietf.org/html/rfc123 New RFC]
25528 !! end
25529
25530 !! test
25531 Edited PMID links not serializable as PMID links should serialize as extlinks
25532 !! options
25533 parsoid=html2wt
25534 !! html/parsoid
25535 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25536 !! wikitext
25537 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25538 !! end
25539
25540 !! test
25541 WTS of autolinks with trailing/surrounding context
25542 !! options
25543 parsoid=html2wt
25544 !! html/parsoid
25545 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25546 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25547 <p><b><a href="http://cscott.net">http://cscott.net</a></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>x</b></p>
25550 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25551 !! wikitext
25552 http://cscott.net'''foo'''
25553
25554 http://cscott.net<b>foo</b>
25555
25556 '''http://cscott.net'''
25557
25558 '''http://cscott.net '''
25559
25560 '''http://cscott.net<nowiki/>x'''
25561
25562 http://cscott.net<nowiki/>x
25563 !! end
25564
25565 !! test
25566 WTS of autolinks with nowikis (round-trip)
25567 !! wikitext
25568 x<nowiki/>http://cscott.net<nowiki/>x
25569 !! html/parsoid
25570 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25571 !! end
25572
25573 # this is the "easy" test because it leaves in place all the
25574 # data-parsoid information indicating this is an autolink
25575 !! test
25576 WTS of autolinks with escapes (editing)
25577 !! options
25578 parsoid={
25579 "modes": ["wt2wt"],
25580 "changes": [
25581 [ "meta", "remove" ]
25582 ]
25583 }
25584 !! wikitext
25585 x<nowiki/>http://cscott.net<nowiki/>x
25586 !! wikitext/edited
25587 x<nowiki/>http://cscott.net<nowiki/>x
25588 !! end
25589
25590 !! test
25591 WTS of edited autolink-like text (T103364)
25592 !! options
25593 parsoid={
25594 "modes": ["wt2wt"],
25595 "changes": [
25596 [ "span[typeof]", "removeAttr", "typeof" ]
25597 ]
25598 }
25599 !! wikitext
25600 Not a link: <nowiki>http://example.com</nowiki>.
25601 !! wikitext/edited
25602 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25603 !! end
25604
25605 !! test
25606 WTS of newly-authored autolink-like text (T103364)
25607 !! options
25608 parsoid=html2wt
25609 !! html/parsoid
25610 <p>http://example.com is not a link.</p>
25611 !! wikitext
25612 <nowiki>http://example.com</nowiki> is not a link.
25613 !! end
25614
25615 !! test
25616 WTS of autolink-like text after an autolink (T108563)
25617 !! options
25618 parsoid=html2wt
25619 !! html/parsoid
25620 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25621 !! wikitext
25622 http://example.com <nowiki>http://example.com</nowiki> is not a link.
25623 !! end
25624
25625 !! test
25626 Magic links inside links (not autolinked)
25627 !! wikitext
25628 [[Foo|http://example.com]]
25629 [[Foo|RFC 1234]]
25630 [[Foo|PMID 1234]]
25631 [[Foo|ISBN 123456789x]]
25632
25633 [http://foo.com http://example.com]
25634 [http://foo.com RFC 1234]
25635 [http://foo.com PMID 1234]
25636 [http://foo.com ISBN 123456789x]
25637 !! html+tidy
25638 <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>
25639 <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>
25640 !! html/parsoid
25641 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25642 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25643 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25644 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25645
25646 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25647 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25648 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25649 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25650 !! end
25651
25652 !! test
25653 Magic links inside image captions (autolinked)
25654 !! wikitext
25655 [[File:Foobar.jpg|thumb|http://example.com]]
25656 [[File:Foobar.jpg|thumb|RFC 1234]]
25657 [[File:Foobar.jpg|thumb|PMID 1234]]
25658 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25659 !! html+tidy
25660 <div class="thumb tright">
25661 <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>
25662 <div class="thumbcaption">
25663 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25664 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25665 </div>
25666 </div>
25667 <div class="thumb tright">
25668 <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>
25669 <div class="thumbcaption">
25670 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25671 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25672 </div>
25673 </div>
25674 <div class="thumb tright">
25675 <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>
25676 <div class="thumbcaption">
25677 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25678 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25679 </div>
25680 </div>
25681 <div class="thumb tright">
25682 <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>
25683 <div class="thumbcaption">
25684 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25685 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25686 </div>
25687 </div>
25688 !! html/parsoid
25689 <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>
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 href="//tools.ietf.org/html/rfc1234" rel="mw:ExtLink">RFC 1234</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="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 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="./Special:BookSources/123456789X" rel="mw:WikiLink">ISBN 123456789x</a></figcaption></figure>
25693 !! end
25694
25695 !! test
25696 WTS of magic word text (T109371)
25697 !! options
25698 parsoid=html2wt
25699 !! html/parsoid
25700 <p>RFC 1234</p>
25701 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25702 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25703 !! wikitext
25704 <nowiki>RFC 1234</nowiki>
25705
25706 [http://foo.com RFC 1234]
25707
25708 [[Foo|RFC 1234]]
25709 !! end
25710
25711 !! test
25712 Edited Redirect link should emit a non-piped wikitext link
25713 !! options
25714 parsoid=html2wt
25715 !! html/parsoid
25716 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25717 !! wikitext
25718 #REDIRECT [[Bar]]
25719 !! end
25720
25721 !! test
25722 T75121: Infer extension name from typeOf if data-mw is not present
25723 !! options
25724 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25725 !! html/parsoid
25726 <div typeOf="mw:Extension/foo"></div>
25727 !! wikitext
25728 <foo />
25729 !! end
25730
25731 # Note that the <p> wrapping isn't present in PHP parser output
25732 # The important thing for this test is that P-wrapping doesn't
25733 # interfere with the <nowiki> protection for leading - in <td>
25734 # (which isn't necessary for <th>).
25735 !! test
25736 T88318: p-wrapped dash in table.
25737 !! options
25738 parsoid=html2wt,wt2wt
25739 !! html/parsoid
25740 <table><tbody>
25741 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25742 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25743 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25744 </tbody></table>
25745 !! wikitext
25746 {|
25747 !-
25748 !-
25749 |-
25750 |<nowiki>-</nowiki>
25751 |<nowiki>- </nowiki>
25752 |-
25753 |<small>-</small>
25754 |<br>
25755 -
25756 |<br>
25757 -
25758 |}
25759 !! html/php+tidy
25760 <table>
25761 <tr>
25762 <th>-</th>
25763 <th>-</th>
25764 </tr>
25765 <tr>
25766 <td>-</td>
25767 <td>-</td>
25768 </tr>
25769 <tr>
25770 <td><small>-</small></td>
25771 <td><br />
25772 <p>-</p>
25773 </td>
25774 <td><br />
25775 <p>-</p>
25776 </td>
25777 </tr>
25778 </table>
25779 !! end
25780
25781 !! test
25782 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25783 !! options
25784 parsoid=html2wt
25785 !! html/parsoid
25786 <table id='mwAb'>
25787 <td id='mwAc'>foo</td>
25788 <td id='serialize-this'>bar</td>
25789 </table>
25790 !! wikitext
25791 {|
25792 |foo
25793 | id="serialize-this" |bar
25794 |}
25795 !! end
25796
25797 !! test
25798 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25799 !! options
25800 parsoid=html2wt
25801 !! html/parsoid
25802 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25803 !! wikitext
25804 <div id="hello">ok</div>
25805 !! end
25806
25807 !! test
25808 WTS change modes
25809 !! options
25810 parsoid={
25811 "modes": ["wt2wt"],
25812 "changes": [
25813 [ "#xyz", "before", "<b>before</b> stuff " ],
25814 [ "#xyz", "after", " stuff <i>after</i>" ],
25815 [ "#xyz", "html", "x <b>y</b> z" ]
25816 ]
25817 }
25818 !! wikitext
25819 <span id="xyz">hello</span>
25820 !! wikitext/edited
25821 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25822 !! end
25823
25824 !! test
25825 Never serialize a-tag as html, regardless of what data-parsoid has to say
25826 !! options
25827 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25828 !! html/parsoid
25829 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25830 !! wikitext
25831 [[Foo]]
25832 !! end
25833
25834 ## SSS FIXME: This is broken output nevertheless.
25835 ## What might be a reasonable non-broken output for this?
25836 ## This is an edge case unlikely to be seen in production
25837 ## that I am not wasting more time on this right now.
25838 !! test
25839 Never serialize a-tag as html, no matter what attributes it has
25840 !! options
25841 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25842 !! html/parsoid
25843 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25844 !! wikitext
25845 [http://boo.org http://boohoo.org]
25846 !! end
25847
25848 # Misnested is an indication that selser can reuse the source but these have
25849 # shown to sneak through on occasion. See T101768.
25850 # The original wikitext here is: [http://test.com [[one]] two three]
25851 !! test
25852 Strip span tags added to mark misnested links
25853 !! options
25854 parsoid=html2wt
25855 !! html/parsoid
25856 <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>
25857 !! wikitext
25858 [http://test.com][[one]] two three
25859 !! end
25860
25861 !! test
25862 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
25863 !! options
25864 parsoid=html2wt
25865 !! html/parsoid
25866 <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|}"]}'>
25867 <tbody><tr><td>d
25868 </td></tr>
25869 </tbody></table>
25870 !! wikitext
25871 {{echo|a}}
25872 {|{{echo|c
25873 {{!}}d
25874 }}
25875 |}
25876 !! end
25877
25878 ## This test verifies the presence and computation of this attribute indirectly
25879 ## by making an edit and ensuring that the serialization is correct (which it would be
25880 ## only if firstWikitextNode is properly set).
25881 !! test
25882 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
25883 !! options
25884 parsoid= {
25885 "modes": ["wt2wt"],
25886 "changes": [
25887 [ "div#x", "remove" ],
25888 [ "div", "before", "<div>new</div>" ]
25889 ]
25890 }
25891 !! wikitext
25892 <div id="x">foo</div>
25893 {|
25894 {{echo|<div>boo</div>
25895 {{!}}b}}
25896 |c
25897 |}
25898 !! wikitext/edited
25899
25900 <div>new</div>
25901 {|
25902 {{echo|<div>boo</div>
25903 {{!}}b}}
25904 |c
25905 |}
25906 !! end
25907
25908 # --------------------------------------------
25909 # Tests spec'ing wikitext serialization norms |
25910 # --------------------------------------------
25911
25912 !! test
25913 1. Categories should always be serialized on their own line
25914 !! options
25915 parsoid=html2wt
25916 !! html/parsoid
25917 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
25918 !! wikitext
25919 foo
25920 [[Category:Foo]]
25921 bar
25922 !! end
25923
25924 !! test
25925 2. Categories that are part of templates should not introduce a line break
25926 !! wikitext
25927 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
25928 !! html/parsoid
25929 <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>
25930 !! end
25931
25932 # Careful while editing these next 2 tests. There are \u200f characters
25933 # before and after the <link> tags in the HTML and following some
25934 # of the categories in wikitext
25935 # Do not remove these characters in edits.
25936 #
25937 # As part of the serialization, these bidi characters will get stripped.
25938 !! test
25939 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
25940 !! options
25941 parsoid={
25942 "modes": ["html2wt"],
25943 "scrubWikitext": true
25944 }
25945 !! html/parsoid
25946 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
25947 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
25948 !! wikitext
25949 [[קטגוריה:טקסים]]
25950 [[קטגוריה: שיטות משפט]]
25951 !! end
25952
25953 !! test
25954 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
25955 !! options
25956 parsoid={
25957 "modes": ["html2wt"],
25958 "scrubWikitext": true
25959 }
25960 !! html/parsoid
25961 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
25962 !! wikitext
25963 [[קטגוריה:טקסים]]
25964 ‏y
25965 !! end
25966
25967 !! test
25968 Lists: Add space after bullets
25969 !! options
25970 parsoid=html2wt
25971 !! html/parsoid
25972 <ul>
25973 <li>foo</li>
25974 <li> bar</li>
25975 <li><span> baz</span></li>
25976 </ul>
25977 !! wikitext
25978 * foo
25979 * bar
25980 * <span> baz</span>
25981 !! end
25982
25983 !! test
25984 1. Headings: Add space before/after == (T53744)
25985 !! options
25986 parsoid=html2wt
25987 !! html/parsoid
25988 <h2>foo</h2>
25989 <h2> bar</h2>
25990 <h2>baz </h2>
25991 <h2><span> baz</span></h2>
25992 !! wikitext
25993 == foo ==
25994
25995 == bar ==
25996
25997 == baz ==
25998
25999 == <span> baz</span> ==
26000 !! end
26001
26002 !! test
26003 2. Headings: Add space before/after == even after hoisted content
26004 !! options
26005 parsoid={
26006 "modes": ["html2wt"],
26007 "scrubWikitext": true
26008 }
26009 !! html/parsoid
26010 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26011 !! wikitext
26012 [[Category:A2]]
26013
26014 == ok ==
26015 !! end
26016
26017 !! test
26018 1. Headings: suppress newly created empty headings
26019 !! options
26020 parsoid={
26021 "modes": ["html2wt"],
26022 "scrubWikitext": true
26023 }
26024 !! html/parsoid
26025 <h2></h2>
26026 !! wikitext
26027 !! end
26028
26029 !! test
26030 2. Headings: don't suppress empty headings if scrubWikitext is false
26031 !! options
26032 parsoid=html2wt
26033 !! html/parsoid
26034 <h2></h2>
26035 !! wikitext
26036 ==<nowiki/>==
26037 !! end
26038
26039 !! test
26040 3. Headings: suppress empty headings on edits
26041 !! options
26042 parsoid={
26043 "modes": ["selser"],
26044 "scrubWikitext": true,
26045 "changes": [
26046 [ "#x", "remove"]
26047 ]
26048 }
26049 !! wikitext
26050 ==<span id="x">foo</span>==
26051 !! wikitext/edited
26052 !! end
26053
26054 !! test
26055 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26056 !! options
26057 parsoid={
26058 "modes": ["html2wt"],
26059 "scrubWikitext": true
26060 }
26061 !! html/parsoid
26062 <h2>foo<br/>bar</h2>
26063 <h2>foo <span><br/>bar</span> baz</h2>
26064 !! wikitext
26065 == foo bar ==
26066
26067 == foo <span> bar</span> baz ==
26068 !! end
26069
26070 !! test
26071 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26072 !! options
26073 parsoid={
26074 "modes": ["html2wt"],
26075 "scrubWikitext": false
26076 }
26077 !! html/parsoid
26078 <h2>foo<br/>bar</h2>
26079 !! wikitext
26080 == foo<br> bar ==
26081 !! end
26082
26083 !! test
26084 1. WT Quote Tags: suppress newly created empty style tags
26085 !! options
26086 parsoid={
26087 "modes": ["html2wt"],
26088 "scrubWikitext": true
26089 }
26090 !! html/parsoid
26091 <i></i><b></b>
26092 !! wikitext
26093 !! end
26094
26095 !! test
26096 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26097 !! options
26098 parsoid=html2wt
26099 !! html/parsoid
26100 <i></i><b></b>
26101 !! wikitext
26102 ''<nowiki/>'''''<nowiki/>'''
26103 !! end
26104
26105 !! test
26106 3. WT Quote Tags: suppress empty style tags on edits
26107 !! options
26108 parsoid={
26109 "modes": ["selser"],
26110 "scrubWikitext": true,
26111 "changes": [
26112 [ "#x", "remove"]
26113 ]
26114 }
26115 !! wikitext
26116 '''<span id="x">foo</span>'''
26117 !! wikitext/edited
26118 !! end
26119
26120 !! test
26121 1. Anchors: suppress newly created empty anchors
26122 !! options
26123 parsoid={
26124 "modes": ["html2wt"],
26125 "scrubWikitext": true
26126 }
26127 !! html/parsoid
26128 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26129 !! wikitext
26130 !! end
26131
26132 !! test
26133 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26134 !! options
26135 parsoid={
26136 "modes": ["html2wt"],
26137 "scrubWikitext": false
26138 }
26139 !! html/parsoid
26140 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26141 !! wikitext
26142 [[Test|<nowiki/>]]
26143 !! end
26144
26145 !! test
26146 3. Anchors: suppress empty anchors on edits
26147 !! options
26148 parsoid={
26149 "modes": ["selser"],
26150 "scrubWikitext": true,
26151 "changes": [
26152 [ "#x", "remove"]
26153 ]
26154 }
26155 !! wikitext
26156 [[Test|<span id="x">foo</span>]]
26157 !! wikitext/edited
26158 !! end
26159
26160 !! test
26161 3a. Anchors: do not suppress numbered extlinks
26162 !! options
26163 parsoid={
26164 "modes": ["wt2wt"],
26165 "scrubWikitext": true
26166 }
26167 !! wikitext
26168 [http://foo.com]
26169 !! html/parsoid
26170 <a rel="mw:ExtLink" href="http://foo.com"></a>
26171 !! end
26172
26173 !! test
26174 3b. Anchors: do not suppress numbered extlinks
26175 !! options
26176 parsoid={
26177 "modes": ["wt2wt"],
26178 "scrubWikitext": true,
26179 "changes": [
26180 [ "#x", "remove"]
26181 ]
26182 }
26183 !! wikitext
26184 [http://foo.com <span id="x">foo</span>]
26185 !! wikitext/edited
26186 [http://foo.com]
26187 !! end
26188
26189 !!test
26190 Normalizations should be restricted to edited content
26191 !!options
26192 parsoid={
26193 "modes": ["selser"],
26194 "scrubWikitext": true,
26195 "changes": [
26196 [ "h1", "before", "<i></i>"]
26197 ]
26198 }
26199 !!wikitext
26200 a
26201 = =
26202 b
26203 !!wikitext/edited
26204 a
26205 = =
26206 b
26207 !!end
26208
26209 !! test
26210 1. Multiple normalizations (html2wt)
26211 !! options
26212 parsoid={
26213 "modes": ["html2wt"],
26214 "scrubWikitext": true
26215 }
26216 !! html
26217 <h2><i></i></h2>
26218 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26219 </a><b><i></i></b>x</p>
26220 !! wikitext
26221
26222 [[foo]]
26223 x
26224
26225 !! end
26226
26227 !! test
26228 2. Multiple normalizations (selser)
26229 !! options
26230 parsoid={
26231 "modes": ["selser"],
26232 "scrubWikitext": true,
26233 "changes": [
26234 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26235 ]
26236 }
26237 !! wikitext
26238 <span id="x">foo</span>
26239 !! wikitext/edited
26240 <span id="x">foo</span>
26241
26242 x
26243 !! end
26244
26245 !! test
26246 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26247 !! options
26248 parsoid={
26249 "modes": ["html2wt"],
26250 "scrubWikitext": true
26251 }
26252 !! html/parsoid
26253 <p> hi</p>
26254 <p> hello</p>
26255 !! wikitext
26256 hi
26257
26258 hello
26259 !! end
26260
26261 !! test
26262 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26263 !! options
26264 parsoid=html2wt
26265 !! html/parsoid
26266 <p> hi</p>
26267 <p> hello</p>
26268 !! wikitext
26269 <nowiki> </nowiki>hi
26270
26271 <nowiki> </nowiki> hello
26272 !! end
26273
26274 !! test
26275 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26276 !! options
26277 parsoid={
26278 "modes": ["html2wt"],
26279 "scrubWikitext": true
26280 }
26281 !! html/parsoid
26282 <p>Foo
26283 bar
26284 baz</p>
26285
26286 <table><tr><td>Foo
26287 bar
26288 baz bang</td></tr></table>
26289
26290 <p><!--boo--> foo
26291 bar</p>
26292
26293 <p> foo
26294 bar<span>boo</span></p>
26295 !! wikitext
26296 Foo
26297 bar
26298 baz
26299
26300 {|
26301 |Foo
26302 bar
26303 baz bang
26304 |}
26305
26306 <!--boo-->foo
26307 bar
26308
26309 foo
26310 bar<span>boo</span>
26311 !! end
26312
26313 !! test
26314 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26315 !! options
26316 parsoid={
26317 "modes": ["selser"],
26318 "scrubWikitext": true,
26319 "changes": [
26320 [ "p", "html", " a\n b" ]
26321 ]
26322 }
26323 !! wikitext
26324 xyz
26325 !! wikitext/edited
26326 a
26327 b
26328 !! end
26329
26330 !! test
26331 1. New links that end in spaces
26332 !! options
26333 parsoid={
26334 "modes": ["html2wt"],
26335 "scrubWikitext": false
26336 }
26337 !! html/parsoid
26338 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26339 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26340 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26341 !! wikitext
26342 [[Berlin ]]<nowiki/>is the capital of Germany.
26343
26344 [[Foo ]]'''bar'''
26345
26346 [[Boston ]] is a city.
26347 !! end
26348
26349 !! test
26350 2. New links that end in spaces
26351 !! options
26352 parsoid={
26353 "modes": ["html2wt"],
26354 "scrubWikitext": true
26355 }
26356 !! html/parsoid
26357 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26358 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26359 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26360 !! wikitext
26361 [[Berlin]] is the capital of Germany.
26362
26363 [[Foo]] '''bar'''
26364
26365 [[Boston]] is a city.
26366 !! end
26367
26368 !! test
26369 1. Table cells with escapable prefixes
26370 !! options
26371 parsoid={
26372 "modes": ["html2wt"],
26373 "scrubWikitext": false
26374 }
26375 !! html
26376 <table>
26377 <tr><td>a</td></tr>
26378 <tr><td>-</td></tr>
26379 <tr><td>+</td></tr>
26380 </table>
26381 !! wikitext
26382 {|
26383 |a
26384 |-
26385 |<nowiki>-</nowiki>
26386 |-
26387 |<nowiki>+</nowiki>
26388 |}
26389 !! end
26390
26391 !! test
26392 2. Table cells with escapable prefixes
26393 !! options
26394 parsoid={
26395 "modes": ["html2wt"],
26396 "scrubWikitext": true
26397 }
26398 !! html
26399 <table>
26400 <tr><td>a</td></tr>
26401 <tr><td>-</td></tr>
26402 <tr><td>+</td></tr>
26403 </table>
26404 !! wikitext
26405 {|
26406 |a
26407 |-
26408 | -
26409 |-
26410 | +
26411 |}
26412 !! end
26413
26414 !! test
26415 3a. Table cells with escapable prefixes after edits
26416 !! options
26417 parsoid={
26418 "modes": ["selser"],
26419 "scrubWikitext": true,
26420 "changes": [
26421 [ "table tbody tr:first-child td:first-child", "remove"]
26422 ]
26423 }
26424 !! wikitext
26425 {|
26426 |a||-
26427 |}
26428 !! wikitext/edited
26429 {|
26430 | -
26431 |}
26432 !! end
26433
26434 !! test
26435 3b. Table cells with escapable prefixes after edits
26436 !! options
26437 parsoid={
26438 "modes": ["selser"],
26439 "scrubWikitext": true,
26440 "changes": [
26441 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26442 [ "#x", "remove" ]
26443 ]
26444 }
26445 !! wikitext
26446 {|
26447 |pqr
26448 |<span id="x">foo</span>+
26449 |}
26450 !! wikitext/edited
26451 {|
26452 | -
26453 | +
26454 |}
26455 !! end
26456
26457 # FIXME: This test will fail because
26458 # normalization doesn't realize that the id attribute
26459 # will eliminate the escapable scenario
26460 !! test
26461 4a. Table cells without escapable prefixes after edits
26462 !! options
26463 parsoid={
26464 "modes": ["selser"],
26465 "scrubWikitext": true,
26466 "changes": [
26467 [ "#x", "html", "-" ]
26468 ]
26469 }
26470 !! wikitext
26471 {|
26472 | id="x" |abcd
26473 |}
26474 !! wikitext/edited
26475 {|
26476 | id="x" |-
26477 |}
26478 !! end
26479
26480 ## This tests normalizer's ability to discriminate between
26481 ## cells having identical content.
26482 !! test
26483 4b. Table cells without escapable prefixes after edits
26484 !! options
26485 parsoid={
26486 "modes": ["selser"],
26487 "scrubWikitext": true,
26488 "changes": [
26489 [ "td", "html", "-" ]
26490 ]
26491 }
26492 !! wikitext
26493 {|
26494 |a||b
26495 |}
26496 !! wikitext/edited
26497 {|
26498 | -||-
26499 |}
26500 !! end
26501
26502 ## This tests normalizer's ability to not be tripped by
26503 ## comments (and whitespace)
26504 !! test
26505 4c. Table cells without escapable prefixes after edits
26506 !! options
26507 parsoid={
26508 "modes": ["selser"],
26509 "scrubWikitext": true,
26510 "changes": [
26511 [ "table tbody tr td:first-child", "remove" ]
26512 ]
26513 }
26514 !! wikitext
26515 {|
26516 |-
26517 <!--foo--> |a||-
26518 |}
26519 !! wikitext/edited
26520 {|
26521 |-
26522 <!--foo--> | -
26523 |}
26524 !! end
26525
26526 ## This tests normalizer's ability to handle HTML cells
26527 !! test
26528 4d. Table cells without escapable prefixes after edits
26529 !! options
26530 parsoid={
26531 "modes": ["selser"],
26532 "scrubWikitext": true,
26533 "changes": [
26534 [ "td", "html", "-" ]
26535 ]
26536 }
26537 !! wikitext
26538 <table>
26539 <tr><td>a</td></tr>
26540 </table>
26541 !! wikitext/edited
26542 <table>
26543 <tr><td>-</td></tr>
26544 </table>
26545 !! end
26546
26547 ## T111151 Remove font elements without attributes
26548 !! test
26549 5a. font tags without attributes should be dropped in scrubWikitext mode
26550 !! options
26551 parsoid={
26552 "modes": ["html2wt"],
26553 "scrubWikitext": true
26554 }
26555 !! html
26556 <font>foo</font>
26557 <font><font>bar</font></font>
26558 <font class="x">boo</font>
26559 !! wikitext
26560 foo
26561 bar
26562 <font class="x">boo</font>
26563 !! end
26564
26565 !! test
26566 5b. font tags should not be dropped without scrubWikitext being enabled
26567 !! options
26568 parsoid={
26569 "modes": ["html2wt"],
26570 "scrubWikitext": false
26571 }
26572 !! html
26573 <font>foo</font>
26574 !! wikitext
26575 <font>foo</font>
26576 !! end
26577
26578 !! test
26579 Escape nowiki DOM elements
26580 !! options
26581 parsoid=html2wt
26582 !! html/parsoid
26583 <nowiki><i>foo</i></nowiki>
26584 !! wikitext
26585 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26586 !! end
26587
26588 # This is meant to be an interim fix while we go about figuring out
26589 # how to not introduce these trailing <nowiki/>s in the first place.
26590 !! test
26591 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
26592 !! options
26593 parsoid=html2wt
26594 !! html/parsoid
26595 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
26596 y</p>
26597 <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>
26598 <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>
26599 !! wikitext
26600 x
26601 y
26602
26603 {{echo|
26604 1 = <nowiki/>}}
26605
26606 {{echo|
26607 1 = <nowiki/>
26608 }}
26609 !! end
26610
26611 # ---------------------------------------------------
26612 # End of tests spec'ing wikitext serialization norms |
26613 # ---------------------------------------------------
26614
26615 # T104032
26616 !! test
26617 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
26618 !! options
26619 parsoid=html2wt
26620 !! html/parsoid
26621 a<p>b</p>
26622 <b>c</b><p>d</p>
26623 <table><tr>
26624 <td>a<p>b</p></td>
26625 <td><b>c</b><p>d</p></td>
26626 </tr></table>
26627 !! wikitext
26628 a
26629
26630 b
26631
26632 '''c'''
26633
26634 d
26635 {|
26636 |a
26637 b
26638 |'''c'''
26639 d
26640 |}
26641 !! end
26642
26643 # -----------------------------------------------------------------
26644 # End of section for Parsoid-only html2wt tests for serialization
26645 # of new content
26646 # -----------------------------------------------------------------
26647
26648 # -----------------------------------------------------------------
26649 # The following section of tests are primarily to spec behavior of
26650 # the selective serializer. All these tests have manual selser
26651 # changes. The automated selser changes for all tests handle the
26652 # wide variation of changes, but these tests here capture specs
26653 # deterministically.
26654 # ----------------------------------------------------------------
26655
26656 ## T90517
26657 !! test
26658 Selser: New comments should not be lost
26659 !! options
26660 parsoid={
26661 "modes": ["selser"],
26662 "changes": [
26663 [ "#a", "after", "<!--c1-->" ],
26664 [ "#b", "before", "<!--c2-->" ]
26665 ]
26666 }
26667 !! wikitext
26668 <span id="a">a</span>
26669
26670 <span id="b">b</span>
26671 !! wikitext/edited
26672 <span id="a">a</span><!--c1-->
26673
26674 <!--c2--><span id="b">b</span>
26675 !! end
26676
26677 ## T89383
26678 !! test
26679 Selser: Check for validity of DSR before using it
26680 !! options
26681 parsoid={
26682 "modes": ["selser"],
26683 "changes": [
26684 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26685 ]
26686 }
26687 !! wikitext
26688 <span id="a">a</span>
26689 !! wikitext/edited
26690 {{DISPLAYTITLE:foo}}
26691 <span id="a">a</span>
26692 !! end
26693
26694 !! test
26695 1. DOMDiff: Changes to <ref> content should be looked up using id
26696 !! options
26697 parsoid={
26698 "modes": ["selser"],
26699 "changes": [
26700 ["#X", "after", "bar"],
26701 ["#Y", "after", "baz"]
26702 ]
26703 }
26704 !! wikitext
26705 X <ref><span id="X">foo</span></ref>
26706 Y <ref name="a" />
26707 <references>
26708 <ref name="a"><span id="Y">foo</span></ref>
26709 </references>
26710 !! wikitext/edited
26711 X <ref><span id="X">foo</span>bar</ref>
26712 Y <ref name="a" />
26713 <references>
26714 <ref name="a"><span id="Y">foo</span>baz</ref>
26715 </references>
26716 !! end
26717
26718 !! test
26719 2. DOMDiff: Changes to <ref> content should be looked up using id
26720 !! options
26721 parsoid={
26722 "modes": ["selser"],
26723 "changes": [
26724 ["#Z", "after", "bar"]
26725 ]
26726 }
26727 !! wikitext
26728 A <ref>foo bar for a</ref>
26729 B <ref group="X" name="b" />
26730
26731 <references />
26732
26733 <references group="X">
26734 <ref name="b"><span id="Z">foo</span></ref>
26735 </references>
26736 !! wikitext/edited
26737 A <ref>foo bar for a</ref>
26738 B <ref group="X" name="b" />
26739
26740 <references />
26741
26742 <references group="X">
26743 <ref name="b"><span id="Z">foo</span>bar</ref>
26744 </references>
26745 !! end
26746
26747 !! test
26748 Empty LI (T49673)
26749 !! wikitext
26750 * a
26751 *
26752 *
26753 * b
26754 !! html/php+tidy
26755 <ul>
26756 <li>a</li>
26757 <li class="mw-empty-li"></li>
26758 <li class="mw-empty-li"></li>
26759 <li>b</li>
26760 </ul>
26761 !! end